]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
configure: check for the stdatomic.h header in configure
authorDaniel Stenberg <daniel@haxx.se>
Tue, 28 Jun 2022 06:37:22 +0000 (08:37 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 28 Jun 2022 14:58:12 +0000 (16:58 +0200)
... and only set HAVE_ATOMIC if that header exists since we use
typedefes set in it.

Reported-by: Ryan Schmidt
Fixes #9059
Closes #9060

m4/curl-functions.m4

index ec406f56aed856669086349f7510484a918b73d5..f3e12a53a9fd6f7e736f08191bd9bb638a0fdfb6 100644 (file)
@@ -6570,24 +6570,26 @@ AC_DEFUN([CURL_COVERAGE],[
 ])
 
 dnl CURL_ATOMIC
-dnl --------------------------------------------------
-dnl Check if _Atomic works
+dnl -------------------------------------------------------------
+dnl Check if _Atomic works. But only check if stdatomic.h exists.
 dnl
 AC_DEFUN([CURL_ATOMIC],[
-  AC_MSG_CHECKING([if _Atomic is available])
-  AC_COMPILE_IFELSE([
-    AC_LANG_PROGRAM([[
-      $curl_includes_unistd
-    ]],[[
-      _Atomic int i = 0;
-    ]])
-  ],[
-    AC_MSG_RESULT([yes])
-    AC_DEFINE_UNQUOTED(HAVE_ATOMIC, 1,
-      [Define to 1 if you have _Atomic support.])
-    tst_atomic="yes"
-  ],[
-    AC_MSG_RESULT([no])
-    tst_atomic="no"
+  AC_CHECK_HEADERS(stdatomic.h, [
+    AC_MSG_CHECKING([if _Atomic is available])
+    AC_COMPILE_IFELSE([
+      AC_LANG_PROGRAM([[
+        $curl_includes_unistd
+      ]],[[
+        _Atomic int i = 0;
+      ]])
+    ],[
+      AC_MSG_RESULT([yes])
+      AC_DEFINE_UNQUOTED(HAVE_ATOMIC, 1,
+        [Define to 1 if you have _Atomic support.])
+      tst_atomic="yes"
+    ],[
+      AC_MSG_RESULT([no])
+      tst_atomic="no"
+    ])
   ])
 ])