configure: check for the stdatomic.h header in configure

... and only set HAVE_ATOMIC if that header exists since we use
typedefes set in it.

Reported-by: Ryan Schmidt
Fixes #9059
Closes #9060
This commit is contained in:
Daniel Stenberg 2022-06-28 08:37:22 +02:00
parent 33fd57b8ff
commit a68074b5db
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

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