Fix configure issue detecting stdatomic.h support (#46959)
(cherry picked from commit63d0c6a3fc) (cherry picked from commit7e1ed15762) (cherry picked from commitfd82c70695)
This commit is contained in:
@@ -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]
|
||||
|
||||
|
||||
@@ -453,9 +453,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
|
||||
|
||||
|
||||
@@ -20093,22 +20093,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 :
|
||||
|
||||
+14
-5
@@ -4037,11 +4037,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],
|
||||
|
||||
Reference in New Issue
Block a user