2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-29 13:38:26 +00:00

Add explicit check for libatomic

This commit is contained in:
Ondřej Surý 2019-03-01 10:10:17 +01:00 committed by Evan Hunt
parent db7a7357a6
commit fcade0610f
2 changed files with 74 additions and 8 deletions

54
configure vendored
View File

@ -17958,9 +17958,33 @@ if ac_fn_c_try_link "$LINENO"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; } $as_echo "no" >&6; }
else else
ISC_ATOMIC_LIBS="-latomic"
save_LIBS="$LIBS"
LIBS="$LIBS $ISC_ATOMIC_LIBS"
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: yes" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; } $as_echo "yes" >&6; }
ISC_ATOMIC_LIBS="-latomic" else
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "libatomic needed, but linking with -latomic failed, please fix your toolchain.
See \`config.log' for more details" "$LINENO" 5; }
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS="$save_LIBS"
fi fi
rm -f core conftest.err conftest.$ac_objext \ rm -f core conftest.err conftest.$ac_objext \
@ -17969,7 +17993,7 @@ rm -f core conftest.err conftest.$ac_objext \
else else
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "stdatomic.h header found, but compilation failed, fix your toolchaing. as_fn_error $? "stdatomic.h header found, but compilation failed, please fix your toolchain.
See \`config.log' for more details" "$LINENO" 5; } See \`config.log' for more details" "$LINENO" 5; }
fi fi
@ -18013,9 +18037,33 @@ if ac_fn_c_try_link "$LINENO"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; } $as_echo "no" >&6; }
else else
ISC_ATOMIC_LIBS="-latomic"
save_LIBS="$LIBS"
LIBS="$LIBS $ISC_ATOMIC_LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <inttypes.h>
int
main ()
{
int64_t val = 0; __atomic_fetch_add(&val, 1, __ATOMIC_RELAXED);
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; } $as_echo "yes" >&6; }
ISC_ATOMIC_LIBS="-latomic" else
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "libatomic needed, but linking with -latomic failed, please fix your toolchain.
See \`config.log' for more details" "$LINENO" 5; }
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS="$save_LIBS"
fi fi
rm -f core conftest.err conftest.$ac_objext \ rm -f core conftest.err conftest.$ac_objext \

View File

@ -1939,11 +1939,20 @@ AC_CHECK_HEADERS(
[[atomic_int_fast64_t val = 0; atomic_fetch_add_explicit(&val, 1, memory_order_relaxed);]] [[atomic_int_fast64_t val = 0; atomic_fetch_add_explicit(&val, 1, memory_order_relaxed);]]
)], )],
[AC_MSG_RESULT([no])], [AC_MSG_RESULT([no])],
[AC_MSG_RESULT([yes]) [ISC_ATOMIC_LIBS="-latomic"
ISC_ATOMIC_LIBS="-latomic" save_LIBS="$LIBS"
LIBS="$LIBS $ISC_ATOMIC_LIBS"
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([yes])],
[AC_MSG_FAILURE([libatomic needed, but linking with -latomic failed, please fix your toolchain.])])
LIBS="$save_LIBS"
]) ])
], ],
[AC_MSG_FAILURE([stdatomic.h header found, but compilation failed, fix your toolchaing.])] [AC_MSG_FAILURE([stdatomic.h header found, but compilation failed, please fix your toolchain.])]
)], )],
[AC_MSG_CHECKING([for memory model aware atomic operations]) [AC_MSG_CHECKING([for memory model aware atomic operations])
AC_COMPILE_IFELSE( AC_COMPILE_IFELSE(
@ -1960,8 +1969,17 @@ AC_CHECK_HEADERS(
[[int64_t val = 0; __atomic_fetch_add(&val, 1, __ATOMIC_RELAXED);]] [[int64_t val = 0; __atomic_fetch_add(&val, 1, __ATOMIC_RELAXED);]]
)], )],
[AC_MSG_RESULT([no])], [AC_MSG_RESULT([no])],
[AC_MSG_RESULT([yes]) [ISC_ATOMIC_LIBS="-latomic"
ISC_ATOMIC_LIBS="-latomic" save_LIBS="$LIBS"
LIBS="$LIBS $ISC_ATOMIC_LIBS"
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[[#include <inttypes.h>]],
[[int64_t val = 0; __atomic_fetch_add(&val, 1, __ATOMIC_RELAXED);]]
)],
[AC_MSG_RESULT([yes])],
[AC_MSG_FAILURE([libatomic needed, but linking with -latomic failed, please fix your toolchain.])])
LIBS="$save_LIBS"
]) ])
], ],
[AC_MSG_RESULT([__sync builtins]) [AC_MSG_RESULT([__sync builtins])