]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Fix configure issue detecting stdatomic.h support (#46959)
authorMukund Sivaraman <muks@isc.org>
Mon, 22 Jan 2018 08:05:29 +0000 (13:35 +0530)
committerMukund Sivaraman <muks@isc.org>
Mon, 22 Jan 2018 08:05:29 +0000 (13:35 +0530)
CHANGES
config.h.in
configure
configure.in

diff --git a/CHANGES b/CHANGES
index 57389df9adafa15b98f82541bfe2c70f15e8825a..cee82974fcf350411b4df13794b54335433671f2 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,7 @@
+4871.  [bug]           Fix configure glitch in detecting stdatomic.h
+                       support on systems with multiple compilers.
+                       [RT #46959]
+
 4870.  [test]          Update included ATF library to atf-0.21 preserving
                        the ATF tool. [RT #46967]
 
index 151b23912f26e5cc4270f0d3a3975be7e4ceb6c6..beddd173db0f3a93ac1e5e3dcfd4543eec7e7d0a 100644 (file)
@@ -451,9 +451,6 @@ int sigwait(const unsigned int *set, int *sig);
 /* Define to 1 if you have the `setresuid' function. */
 #undef HAVE_SETRESUID
 
-/* Define to 1 if you have the <stdatomic.h> header file. */
-#undef HAVE_STDATOMIC_H
-
 /* Define to 1 if you have the <stdint.h> header file. */
 #undef HAVE_STDINT_H
 
index db4d2fc16c704628340735b738beeac6f539b7be..037359f4e9099ad0caa4efe1ed4e13769f7afb62 100755 (executable)
--- a/configure
+++ b/configure
@@ -20200,22 +20200,36 @@ done
 # 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"
-if test "x$ac_cv_header_stdatomic_h" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_STDATOMIC_H 1
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for usable stdatomic.h" >&5
+$as_echo_n "checking for usable stdatomic.h... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <stdio.h>
+#include <stdatomic.h>
+
+int
+main ()
+{
+
+atomic_int_fast32_t val = 0; atomic_fetch_add_explicit(&val, 1, memory_order_relaxed);
+
+  ;
+  return 0;
+}
 _ACEOF
- have_stdatomic=yes
-                 ISC_PLATFORM_HAVESTDATOMIC="#define ISC_PLATFORM_HAVESTDATOMIC 1"
+if ac_fn_c_try_compile "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+        have_stdatomic=yes
+        ISC_PLATFORM_HAVESTDATOMIC="#define ISC_PLATFORM_HAVESTDATOMIC 1"
 else
-  have_stdatomic=no
-                 ISC_PLATFORM_HAVESTDATOMIC="#undef ISC_PLATFORM_HAVESTDATOMIC"
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+        have_stdatomic=no
+        ISC_PLATFORM_HAVESTDATOMIC="#undef ISC_PLATFORM_HAVESTDATOMIC"
 fi
-
-done
-
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
 # Check whether --enable-atomic was given.
 if test "${enable_atomic+set}" = set; then :
index e75985e768aae8f914e821b1cc6f8b13e0de2112..52d922b226eeec50b70690569e58b17c2026646e 100644 (file)
@@ -4086,11 +4086,20 @@ AC_CHECK_FUNCS(nanosleep usleep explicit_bzero)
 # Machine architecture dependent features
 #
 have_stdatomic=no
-AC_CHECK_HEADERS(stdatomic.h,
-                [have_stdatomic=yes
-                 ISC_PLATFORM_HAVESTDATOMIC="#define ISC_PLATFORM_HAVESTDATOMIC 1"],
-                [have_stdatomic=no
-                 ISC_PLATFORM_HAVESTDATOMIC="#undef ISC_PLATFORM_HAVESTDATOMIC"])
+AC_MSG_CHECKING(for usable stdatomic.h)
+AC_TRY_COMPILE([
+#include <stdio.h>
+#include <stdatomic.h>
+],
+[
+atomic_int_fast32_t val = 0; atomic_fetch_add_explicit(&val, 1, memory_order_relaxed);
+],
+        [AC_MSG_RESULT(yes)
+        have_stdatomic=yes
+        ISC_PLATFORM_HAVESTDATOMIC="#define ISC_PLATFORM_HAVESTDATOMIC 1"],
+       [AC_MSG_RESULT(no)
+        have_stdatomic=no
+        ISC_PLATFORM_HAVESTDATOMIC="#undef ISC_PLATFORM_HAVESTDATOMIC"])
 
 AC_ARG_ENABLE(atomic,
              AS_HELP_STRING([--enable-atomic],