From fcade0610fbfc888b324e46cb869cb3c9942c67a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Fri, 1 Mar 2019 10:10:17 +0100 Subject: [PATCH 1/2] Add explicit check for libatomic --- configure | 54 +++++++++++++++++++++++++++++++++++++++++++++++++--- configure.ac | 28 ++++++++++++++++++++++----- 2 files changed, 74 insertions(+), 8 deletions(-) diff --git a/configure b/configure index 7bccde0437..8516eaa1d1 100755 --- a/configure +++ b/configure @@ -17958,9 +17958,33 @@ if ac_fn_c_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } else + ISC_ATOMIC_LIBS="-latomic" + save_LIBS="$LIBS" + LIBS="$LIBS $ISC_ATOMIC_LIBS" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +atomic_int_fast64_t val = 0; atomic_fetch_add_explicit(&val, 1, memory_order_relaxed); + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - ISC_ATOMIC_LIBS="-latomic" +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "libatomic needed, but linking with -latomic failed, please fix your toolchain. +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LIBS="$save_LIBS" fi rm -f core conftest.err conftest.$ac_objext \ @@ -17969,7 +17993,7 @@ rm -f core conftest.err conftest.$ac_objext \ else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "stdatomic.h header found, but compilation failed, fix your toolchaing. +as_fn_error $? "stdatomic.h header found, but compilation failed, please fix your toolchain. See \`config.log' for more details" "$LINENO" 5; } fi @@ -18013,9 +18037,33 @@ if ac_fn_c_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } else + ISC_ATOMIC_LIBS="-latomic" + save_LIBS="$LIBS" + LIBS="$LIBS $ISC_ATOMIC_LIBS" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +int64_t val = 0; __atomic_fetch_add(&val, 1, __ATOMIC_RELAXED); + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - ISC_ATOMIC_LIBS="-latomic" +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "libatomic needed, but linking with -latomic failed, please fix your toolchain. +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LIBS="$save_LIBS" fi rm -f core conftest.err conftest.$ac_objext \ diff --git a/configure.ac b/configure.ac index 69d44c71ed..3b787b8815 100644 --- a/configure.ac +++ b/configure.ac @@ -1939,11 +1939,20 @@ AC_CHECK_HEADERS( [[atomic_int_fast64_t val = 0; atomic_fetch_add_explicit(&val, 1, memory_order_relaxed);]] )], [AC_MSG_RESULT([no])], - [AC_MSG_RESULT([yes]) - ISC_ATOMIC_LIBS="-latomic" + [ISC_ATOMIC_LIBS="-latomic" + save_LIBS="$LIBS" + LIBS="$LIBS $ISC_ATOMIC_LIBS" + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[#include ]], + [[atomic_int_fast64_t val = 0; atomic_fetch_add_explicit(&val, 1, memory_order_relaxed);]] + )], + [AC_MSG_RESULT([yes])], + [AC_MSG_FAILURE([libatomic needed, but linking with -latomic failed, please fix your toolchain.])]) + LIBS="$save_LIBS" ]) ], - [AC_MSG_FAILURE([stdatomic.h header found, but compilation failed, fix your toolchaing.])] + [AC_MSG_FAILURE([stdatomic.h header found, but compilation failed, please fix your toolchain.])] )], [AC_MSG_CHECKING([for memory model aware atomic operations]) AC_COMPILE_IFELSE( @@ -1960,8 +1969,17 @@ AC_CHECK_HEADERS( [[int64_t val = 0; __atomic_fetch_add(&val, 1, __ATOMIC_RELAXED);]] )], [AC_MSG_RESULT([no])], - [AC_MSG_RESULT([yes]) - ISC_ATOMIC_LIBS="-latomic" + [ISC_ATOMIC_LIBS="-latomic" + save_LIBS="$LIBS" + LIBS="$LIBS $ISC_ATOMIC_LIBS" + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[#include ]], + [[int64_t val = 0; __atomic_fetch_add(&val, 1, __ATOMIC_RELAXED);]] + )], + [AC_MSG_RESULT([yes])], + [AC_MSG_FAILURE([libatomic needed, but linking with -latomic failed, please fix your toolchain.])]) + LIBS="$save_LIBS" ]) ], [AC_MSG_RESULT([__sync builtins]) From 9a16e0a5ae88455a9b9ecc24e8308277798f4c8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Fri, 1 Mar 2019 15:19:22 +0100 Subject: [PATCH 2/2] Add information about NetBSD 6 compilation on i386 --- PLATFORMS.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/PLATFORMS.md b/PLATFORMS.md index a236a7d3a4..6fee4a823c 100644 --- a/PLATFORMS.md +++ b/PLATFORMS.md @@ -95,8 +95,18 @@ armhf documentation): the processors to support here, therefore the recommended build option is `-mfpu=vfpv3-d16`. -The configure command should look like this: +The `configure` command should look like this: ``` CFLAGS="-march=armv7-a -mfpu=vfpv3-d16 -Os -g" ./configure ``` + +### NetBSD 6 i386 + +The i386 build of NetBSD requires the `libatomic` library, available from +the `gcc5-libs` package. Because this library is in a non-standard path, +its location must be specified in the `configure` command line: + +``` +LDFLAGS="-L/usr/pkg/gcc5/i486--netbsdelf/lib/ -Wl,-R/usr/pkg/gcc5/i486--netbsdelf/lib/" ./configure +```