+4809. [port] Check at configure time whether -latomic is needed
+ for stdatomic.h. [RT #46324]
+
4808. [bug] Properly test for zlib.h. [RT #46504]
4807. [cleanup] isc_rng_randombytes() returns a specified number of
#
# Machine architecture dependent features
#
+have_stdatomic=no
for ac_header in stdatomic.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "stdatomic.h" "ac_cv_header_stdatomic_h" "$ac_includes_default"
cat >>confdefs.h <<_ACEOF
#define HAVE_STDATOMIC_H 1
_ACEOF
- ISC_PLATFORM_HAVESTDATOMIC="#define ISC_PLATFORM_HAVESTDATOMIC 1"
+ have_stdatomic=yes
+ ISC_PLATFORM_HAVESTDATOMIC="#define ISC_PLATFORM_HAVESTDATOMIC 1"
else
- ISC_PLATFORM_HAVESTDATOMIC="#undef ISC_PLATFORM_HAVESTDATOMIC"
+ have_stdatomic=no
+ ISC_PLATFORM_HAVESTDATOMIC="#undef ISC_PLATFORM_HAVESTDATOMIC"
fi
done
esac
;;
no)
+ have_stdatomic=no
ISC_PLATFORM_HAVESTDATOMIC="#undef ISC_PLATFORM_HAVESTDATOMIC"
use_atomic=no
arch=noatomic
;;
esac
+if test "X$have_stdatomic" = "Xyes"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if -latomic is needed to use 64-bit stdatomic.h primitives" >&5
+$as_echo_n "checking if -latomic is needed to use 64-bit stdatomic.h primitives... " >&6; }
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdatomic.h>
+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: no" >&5
+$as_echo "no" >&6; }
+ ISC_ATOMIC_LIBS=""
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ ISC_ATOMIC_LIBS="-latomic"
+
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ LIBS="$LIBS $ISC_ATOMIC_LIBS"
+fi
+
ISC_PLATFORM_USEOSFASM="#undef ISC_PLATFORM_USEOSFASM"
#
# Machine architecture dependent features
#
+have_stdatomic=no
AC_CHECK_HEADERS(stdatomic.h,
- [ISC_PLATFORM_HAVESTDATOMIC="#define ISC_PLATFORM_HAVESTDATOMIC 1"],
- [ISC_PLATFORM_HAVESTDATOMIC="#undef ISC_PLATFORM_HAVESTDATOMIC"])
+ [have_stdatomic=yes
+ ISC_PLATFORM_HAVESTDATOMIC="#define ISC_PLATFORM_HAVESTDATOMIC 1"],
+ [have_stdatomic=no
+ ISC_PLATFORM_HAVESTDATOMIC="#undef ISC_PLATFORM_HAVESTDATOMIC"])
AC_ARG_ENABLE(atomic,
[ --enable-atomic enable machine specific atomic operations
esac
;;
no)
+ have_stdatomic=no
ISC_PLATFORM_HAVESTDATOMIC="#undef ISC_PLATFORM_HAVESTDATOMIC"
use_atomic=no
arch=noatomic
;;
esac
+if test "X$have_stdatomic" = "Xyes"; then
+ AC_MSG_CHECKING(if -latomic is needed to use 64-bit stdatomic.h primitives)
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM([#include <stdatomic.h>],
+ [atomic_int_fast64_t val = 0; atomic_fetch_add_explicit(&val, 1, memory_order_relaxed);])],
+ [AC_MSG_RESULT(no)
+ ISC_ATOMIC_LIBS=""],
+ [AC_MSG_RESULT(yes)
+ ISC_ATOMIC_LIBS="-latomic"]
+ )
+ LIBS="$LIBS $ISC_ATOMIC_LIBS"
+fi
+
AC_SUBST(ISC_PLATFORM_HAVESTDATOMIC)
ISC_PLATFORM_USEOSFASM="#undef ISC_PLATFORM_USEOSFASM"