FSTRM_CAPTURE
PROTOC_C
ISC_PLATFORM_BUSYWAITNOP
-ISC_ARCH_DIR
-ISC_PLATFORM_USEMACASM
-ISC_PLATFORM_USESTDASM
-ISC_PLATFORM_USEGCCASM
-ISC_PLATFORM_HAVEATOMICSTOREQ
-ISC_PLATFORM_HAVEATOMICSTORE
-ISC_PLATFORM_HAVECMPXCHG
-ISC_PLATFORM_HAVEXADDQ
-ISC_PLATFORM_HAVEXADD
-ISC_PLATFORM_HAVESTDATOMIC
ISC_PLATFORM_HAVEIFNAMETOINDEX
ISC_PLATFORM_HAVESTRINGSH
IRS_PLATFORM_USEDECLSPEC
enable_isc_spnego
enable_chroot
enable_linux_caps
-enable_atomic
enable_fixed_rrset
enable_rpz_nsip
enable_rpz_nsdname
--disable-isc-spnego use SPNEGO from GSSAPI library
--disable-chroot disable chroot
--disable-linux-caps disable Linux capabilities
- --enable-atomic enable machine specific atomic operations
- [default=autodetect]
--enable-fixed-rrset enable fixed rrset ordering [default=no]
--disable-rpz-nsip disable rpz nsip rules [default=enabled]
--disable-rpz-nsdname disable rpz nsdname rules [default=enabled]
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
} # ac_fn_c_check_type
-
-# ac_fn_c_compute_int LINENO EXPR VAR INCLUDES
-# --------------------------------------------
-# Tries to find the compile-time value of EXPR in a program that includes
-# INCLUDES, setting VAR accordingly. Returns whether the value could be
-# computed
-ac_fn_c_compute_int ()
-{
- as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
- if test "$cross_compiling" = yes; then
- # Depending upon the size, compute the lo and hi bounds.
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-$4
-int
-main ()
-{
-static int test_array [1 - 2 * !(($2) >= 0)];
-test_array [0] = 0;
-return test_array [0];
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- ac_lo=0 ac_mid=0
- while :; do
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-$4
-int
-main ()
-{
-static int test_array [1 - 2 * !(($2) <= $ac_mid)];
-test_array [0] = 0;
-return test_array [0];
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- ac_hi=$ac_mid; break
-else
- as_fn_arith $ac_mid + 1 && ac_lo=$as_val
- if test $ac_lo -le $ac_mid; then
- ac_lo= ac_hi=
- break
- fi
- as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- done
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-$4
-int
-main ()
-{
-static int test_array [1 - 2 * !(($2) < 0)];
-test_array [0] = 0;
-return test_array [0];
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- ac_hi=-1 ac_mid=-1
- while :; do
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-$4
-int
-main ()
-{
-static int test_array [1 - 2 * !(($2) >= $ac_mid)];
-test_array [0] = 0;
-return test_array [0];
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- ac_lo=$ac_mid; break
-else
- as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val
- if test $ac_mid -le $ac_hi; then
- ac_lo= ac_hi=
- break
- fi
- as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- done
-else
- ac_lo= ac_hi=
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-# Binary search between lo and hi bounds.
-while test "x$ac_lo" != "x$ac_hi"; do
- as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-$4
-int
-main ()
-{
-static int test_array [1 - 2 * !(($2) <= $ac_mid)];
-test_array [0] = 0;
-return test_array [0];
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- ac_hi=$ac_mid
-else
- as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-done
-case $ac_lo in #((
-?*) eval "$3=\$ac_lo"; ac_retval=0 ;;
-'') ac_retval=1 ;;
-esac
- else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-$4
-static long int longval () { return $2; }
-static unsigned long int ulongval () { return $2; }
-#include <stdio.h>
-#include <stdlib.h>
-int
-main ()
-{
-
- FILE *f = fopen ("conftest.val", "w");
- if (! f)
- return 1;
- if (($2) < 0)
- {
- long int i = longval ();
- if (i != ($2))
- return 1;
- fprintf (f, "%ld", i);
- }
- else
- {
- unsigned long int i = ulongval ();
- if (i != ($2))
- return 1;
- fprintf (f, "%lu", i);
- }
- /* Do not output a trailing newline, as this causes \r\n confusion
- on some platforms. */
- return ferror (f) || fclose (f) != 0;
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
- echo >>conftest.val; read $3 <conftest.val; ac_retval=0
-else
- ac_retval=1
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
- conftest.$ac_objext conftest.beam conftest.$ac_ext
-rm -f conftest.val
-
- fi
- eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
- as_fn_set_status $ac_retval
-
-} # ac_fn_c_compute_int
cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
done
-#
-# Machine architecture dependent features
-#
-have_stdatomic=no
-{ $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
+ISC_ATOMIC_LIBS=""
+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
+_ACEOF
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for memory model aware atomic operations" >&5
+$as_echo_n "checking for memory model aware atomic operations... " >&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);
;
}
_ACEOF
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
- { $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
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
-# Check whether --enable-atomic was given.
-if test "${enable_atomic+set}" = set; then :
- enableval=$enable_atomic; enable_atomic="$enableval"
-else
- enable_atomic="autodetect"
-fi
-
-case "$enable_atomic" in
- yes|''|autodetect)
- use_atomic=yes
- ;;
- no)
- have_stdatomic=no
- ISC_PLATFORM_HAVESTDATOMIC="#undef ISC_PLATFORM_HAVESTDATOMIC"
- use_atomic=no
- arch=noatomic
- ;;
-esac
-
-if test "X$have_stdatomic" = "Xyes"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking if -latomic is needed to use 64-bit stdatomic.h primitives" >&5
-$as_echo_n "checking if -latomic is needed to use 64-bit stdatomic.h primitives... " >&6; }
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: stdatomic.h" >&5
+$as_echo "stdatomic.h" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -latomic is needed for 64-bit stdatomic.h functions" >&5
+$as_echo_n "checking whether -latomic is needed for 64-bit stdatomic.h functions... " >&6; }
+ 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;
}
if ac_fn_c_try_link "$LINENO"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
- ISC_ATOMIC_LIBS=""
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
- LIBS="$LIBS $ISC_ATOMIC_LIBS"
-fi
-
-
-
-ISC_PLATFORM_USEGCCASM="#undef ISC_PLATFORM_USEGCCASM"
-ISC_PLATFORM_USESTDASM="#undef ISC_PLATFORM_USESTDASM"
-ISC_PLATFORM_USEMACASM="#undef ISC_PLATFORM_USEMACASM"
-if test "yes" = "$use_atomic"; then
- # The cast to long int works around a bug in the HP C Compiler
-# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
-# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
-# This bug is HP SR number 8606223364.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of void *" >&5
-$as_echo_n "checking size of void *... " >&6; }
-if ${ac_cv_sizeof_void_p+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (void *))" "ac_cv_sizeof_void_p" "$ac_includes_default"; then :
else
- if test "$ac_cv_type_void_p" = yes; then
- { { $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_fn_error 77 "cannot compute sizeof (void *)
+as_fn_error $? "stdatomic.h header found, but compilation failed, fix your toolchaing.
See \`config.log' for more details" "$LINENO" 5; }
- else
- ac_cv_sizeof_void_p=0
- fi
-fi
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_void_p" >&5
-$as_echo "$ac_cv_sizeof_void_p" >&6; }
-
-
-
-cat >>confdefs.h <<_ACEOF
-#define SIZEOF_VOID_P $ac_cv_sizeof_void_p
-_ACEOF
-
-
- have_atomic=yes # set default
- case "$host" in
- i[3456]86-*)
- # XXX: some old x86 architectures actually do not support
- # (some of) these operations. Do we need stricter checks?
- if test $ac_cv_sizeof_void_p = 8; then
- arch=x86_64
- have_xaddq=yes
- else
- arch=x86_32
- fi
- ;;
- x86_64-*|amd64-*)
- if test $ac_cv_sizeof_void_p = 8; then
- arch=x86_64
- have_xaddq=yes
- else
- arch=x86_32
- fi
- ;;
- powerpc-*|powerpc64-*)
- arch=powerpc
- ;;
- mips-*|mipsel-*|mips64-*|mips64el-*)
- arch=mips
- ;;
- ia64-*)
- arch=ia64
- ;;
- *)
- have_atomic=no
- arch=noatomic
- ;;
- esac
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking architecture type for atomic operations" >&5
-$as_echo_n "checking architecture type for atomic operations... " >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $arch" >&5
-$as_echo "$arch" >&6; }
-fi
-
-if test "yes" = "$have_atomic"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking compiler support for inline assembly code" >&5
-$as_echo_n "checking compiler support for inline assembly code... " >&6; }
-
- compiler=generic
- # Check whether the compiler supports the assembly syntax we provide.
- if test "X$GCC" = "Xyes"; then
- # GCC's ASM extension always works
- compiler=gcc
- if test $arch = "x86_64"; then
- # We can share the same code for gcc with x86_32
- arch=x86_32
- fi
- if test $arch = "powerpc"; then
- #
- # The MacOS (and maybe others) uses "r0" for register
- # zero. Under linux/ibm it is "0" for register 0.
- # Probe to see if we have a MacOS style assembler.
- #
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking Checking for MacOS style assembler syntax" >&5
-$as_echo_n "checking Checking for MacOS style assembler syntax... " >&6; }
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for memory model aware atomic operations" >&5
+$as_echo_n "checking for memory model aware atomic operations... " >&6; }
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-
+#include <inttypes.h>
int
main ()
{
-
- __asm__ volatile ("li r0, 0x0\n"::);
+int32_t val = 0; __atomic_fetch_add(&val, 1, __ATOMIC_RELAXED);
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: __atomic builtins" >&5
+$as_echo "__atomic builtins" >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
- compiler="mac"
- ISC_PLATFORM_USEMACASM="#define ISC_PLATFORM_USEMACASM 1"
+$as_echo "#define HAVE___ATOMIC 1" >>confdefs.h
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- fi
- fi
- case "$compiler" in
- gcc)
- ISC_PLATFORM_USEGCCASM="#define ISC_PLATFORM_USEGCCASM 1"
- ;;
- mac)
- ;;
- *)
- # See if the generic __asm function works. If not,
- # we need to disable the atomic operations.
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -latomic is needed for 64-bit __atomic builtins" >&5
+$as_echo_n "checking whether -latomic is needed for 64-bit __atomic builtins... " >&6; }
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-
+#include <inttypes.h>
int
main ()
{
-
- __asm("nop")
+int64_t val = 0; __atomic_fetch_add(&val, 1, __ATOMIC_RELAXED);
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
- compiler="standard"
- ISC_PLATFORM_USESTDASM="#define ISC_PLATFORM_USESTDASM 1"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
else
- compiler="not supported (atomic operations disabled)"
- have_atomic=no
- arch=noatomic
-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext;
- ;;
- esac
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ ISC_ATOMIC_LIBS="-latomic"
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $compiler" >&5
-$as_echo "$compiler" >&6; }
fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
-if test "yes" = "$have_atomic"; then
- ISC_PLATFORM_HAVEXADD="#define ISC_PLATFORM_HAVEXADD 1"
- ISC_PLATFORM_HAVECMPXCHG="#define ISC_PLATFORM_HAVECMPXCHG 1"
- ISC_PLATFORM_HAVEATOMICSTORE="#define ISC_PLATFORM_HAVEATOMICSTORE 1"
- if test "yes" = "$have_xaddq"; then
- ISC_PLATFORM_HAVEXADDQ="#define ISC_PLATFORM_HAVEXADDQ 1"
- ISC_PLATFORM_HAVEATOMICSTOREQ="#define ISC_PLATFORM_HAVEATOMICSTOREQ 1"
- else
- ISC_PLATFORM_HAVEXADDQ="#undef ISC_PLATFORM_HAVEXADDQ"
- ISC_PLATFORM_HAVEATOMICSTOREQ="#undef ISC_PLATFORM_HAVEATOMICSTOREQ"
- fi
else
- ISC_PLATFORM_HAVEXADD="#undef ISC_PLATFORM_HAVEXADD"
- ISC_PLATFORM_HAVECMPXCHG="#undef ISC_PLATFORM_HAVECMPXCHG"
- ISC_PLATFORM_HAVEATOMICSTORE="#undef ISC_PLATFORM_HAVEATOMICSTORE"
- ISC_PLATFORM_HAVEXADDQ="#undef ISC_PLATFORM_HAVEXADDQ"
- ISC_PLATFORM_HAVEATOMICSTOREQ="#undef ISC_PLATFORM_HAVEATOMICSTOREQ"
-fi
-
-
-
-
-
-
-
-
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: __sync builtins" >&5
+$as_echo "__sync builtins" >&6; }
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
-ISC_ARCH_DIR=$arch
+done
+LIBS="$LIBS $ISC_ATOMIC_LIBS"
#
# Check for __builtin_expect
AC_CHECK_FUNCS(nanosleep usleep explicit_bzero)
-#
-# Machine architecture dependent features
-#
-have_stdatomic=no
-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],
- [enable machine specific atomic operations [default=autodetect]]),
- enable_atomic="$enableval",
- enable_atomic="autodetect")
-case "$enable_atomic" in
- yes|''|autodetect)
- use_atomic=yes
- ;;
- no)
- have_stdatomic=no
- ISC_PLATFORM_HAVESTDATOMIC="#undef ISC_PLATFORM_HAVESTDATOMIC"
- use_atomic=no
- arch=noatomic
- ;;
-esac
-
-if test "X$have_stdatomic" = "Xyes"; then
- AC_MSG_CHECKING(if -latomic is needed to use 64-bit stdatomic.h primitives)
- 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(no)
- ISC_ATOMIC_LIBS=""],
- [AC_MSG_RESULT(yes)
- ISC_ATOMIC_LIBS="-latomic"]
- )
- LIBS="$LIBS $ISC_ATOMIC_LIBS"
-fi
-
-AC_SUBST(ISC_PLATFORM_HAVESTDATOMIC)
-
-ISC_PLATFORM_USEGCCASM="#undef ISC_PLATFORM_USEGCCASM"
-ISC_PLATFORM_USESTDASM="#undef ISC_PLATFORM_USESTDASM"
-ISC_PLATFORM_USEMACASM="#undef ISC_PLATFORM_USEMACASM"
-if test "yes" = "$use_atomic"; then
- AC_CHECK_SIZEOF([void *])
- have_atomic=yes # set default
- case "$host" in
- [i[3456]86-*])
- # XXX: some old x86 architectures actually do not support
- # (some of) these operations. Do we need stricter checks?
- if test $ac_cv_sizeof_void_p = 8; then
- arch=x86_64
- have_xaddq=yes
- else
- arch=x86_32
- fi
- ;;
- x86_64-*|amd64-*)
- if test $ac_cv_sizeof_void_p = 8; then
- arch=x86_64
- have_xaddq=yes
- else
- arch=x86_32
- fi
- ;;
- powerpc-*|powerpc64-*)
- arch=powerpc
- ;;
- mips-*|mipsel-*|mips64-*|mips64el-*)
- arch=mips
- ;;
- ia64-*)
- arch=ia64
- ;;
- *)
- have_atomic=no
- arch=noatomic
- ;;
- esac
- AC_MSG_CHECKING([architecture type for atomic operations])
- AC_MSG_RESULT($arch)
-fi
-
-if test "yes" = "$have_atomic"; then
- AC_MSG_CHECKING([compiler support for inline assembly code])
-
- compiler=generic
- # Check whether the compiler supports the assembly syntax we provide.
- if test "X$GCC" = "Xyes"; then
- # GCC's ASM extension always works
- compiler=gcc
- if test $arch = "x86_64"; then
- # We can share the same code for gcc with x86_32
- arch=x86_32
- fi
- if test $arch = "powerpc"; then
- #
- # The MacOS (and maybe others) uses "r0" for register
- # zero. Under linux/ibm it is "0" for register 0.
- # Probe to see if we have a MacOS style assembler.
- #
- AC_MSG_CHECKING([Checking for MacOS style assembler syntax])
- AC_TRY_COMPILE(, [
- __asm__ volatile ("li r0, 0x0\n"::);
- ], [
- AC_MSG_RESULT(yes)
- compiler="mac"
- ISC_PLATFORM_USEMACASM="#define ISC_PLATFORM_USEMACASM 1"
- ], [AC_MSG_RESULT(no)])
- fi
- fi
- case "$compiler" in
- gcc)
- ISC_PLATFORM_USEGCCASM="#define ISC_PLATFORM_USEGCCASM 1"
- ;;
- mac)
- ;;
- *)
- # See if the generic __asm function works. If not,
- # we need to disable the atomic operations.
- AC_TRY_LINK(, [
- __asm("nop")
- ],
- [compiler="standard"
- ISC_PLATFORM_USESTDASM="#define ISC_PLATFORM_USESTDASM 1"],
- [compiler="not supported (atomic operations disabled)"
- have_atomic=no
- arch=noatomic ]);
- ;;
- esac
-
- AC_MSG_RESULT($compiler)
-fi
-
-if test "yes" = "$have_atomic"; then
- ISC_PLATFORM_HAVEXADD="#define ISC_PLATFORM_HAVEXADD 1"
- ISC_PLATFORM_HAVECMPXCHG="#define ISC_PLATFORM_HAVECMPXCHG 1"
- ISC_PLATFORM_HAVEATOMICSTORE="#define ISC_PLATFORM_HAVEATOMICSTORE 1"
- if test "yes" = "$have_xaddq"; then
- ISC_PLATFORM_HAVEXADDQ="#define ISC_PLATFORM_HAVEXADDQ 1"
- ISC_PLATFORM_HAVEATOMICSTOREQ="#define ISC_PLATFORM_HAVEATOMICSTOREQ 1"
- else
- ISC_PLATFORM_HAVEXADDQ="#undef ISC_PLATFORM_HAVEXADDQ"
- ISC_PLATFORM_HAVEATOMICSTOREQ="#undef ISC_PLATFORM_HAVEATOMICSTOREQ"
- fi
-else
- ISC_PLATFORM_HAVEXADD="#undef ISC_PLATFORM_HAVEXADD"
- ISC_PLATFORM_HAVECMPXCHG="#undef ISC_PLATFORM_HAVECMPXCHG"
- ISC_PLATFORM_HAVEATOMICSTORE="#undef ISC_PLATFORM_HAVEATOMICSTORE"
- ISC_PLATFORM_HAVEXADDQ="#undef ISC_PLATFORM_HAVEXADDQ"
- ISC_PLATFORM_HAVEATOMICSTOREQ="#undef ISC_PLATFORM_HAVEATOMICSTOREQ"
-fi
-
-AC_SUBST(ISC_PLATFORM_HAVEXADD)
-AC_SUBST(ISC_PLATFORM_HAVEXADDQ)
-AC_SUBST(ISC_PLATFORM_HAVECMPXCHG)
-AC_SUBST(ISC_PLATFORM_HAVEATOMICSTORE)
-AC_SUBST(ISC_PLATFORM_HAVEATOMICSTOREQ)
-
-AC_SUBST(ISC_PLATFORM_USEGCCASM)
-AC_SUBST(ISC_PLATFORM_USESTDASM)
-AC_SUBST(ISC_PLATFORM_USEMACASM)
-
-ISC_ARCH_DIR=$arch
-AC_SUBST(ISC_ARCH_DIR)
+ISC_ATOMIC_LIBS=""
+AC_CHECK_HEADERS(
+ [stdatomic.h],
+ [AC_MSG_CHECKING([for memory model aware atomic operations])
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <stdatomic.h>]],
+ [[atomic_int_fast32_t val = 0; atomic_fetch_add_explicit(&val, 1, memory_order_relaxed);]]
+ )],
+ [AC_MSG_RESULT([stdatomic.h])
+ AC_MSG_CHECKING([whether -latomic is needed for 64-bit stdatomic.h functions])
+ 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([no])],
+ [AC_MSG_RESULT([yes])
+ ISC_ATOMIC_LIBS="-latomic"
+ ])
+ ],
+ [AC_MSG_FAILURE([stdatomic.h header found, but compilation failed, fix your toolchaing.])]
+ )],
+ [AC_MSG_CHECKING([for memory model aware atomic operations])
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <inttypes.h>]],
+ [[int32_t val = 0; __atomic_fetch_add(&val, 1, __ATOMIC_RELAXED);]]
+ )],
+ [AC_MSG_RESULT([__atomic builtins])
+ AC_DEFINE([HAVE___ATOMIC], [1], [define if __atomic builtins are not available])
+ AC_MSG_CHECKING([whether -latomic is needed for 64-bit __atomic builtins])
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <inttypes.h>]],
+ [[int64_t val = 0; __atomic_fetch_add(&val, 1, __ATOMIC_RELAXED);]]
+ )],
+ [AC_MSG_RESULT([no])],
+ [AC_MSG_RESULT([yes])
+ ISC_ATOMIC_LIBS="-latomic"
+ ])
+ ],
+ [AC_MSG_RESULT([__sync builtins])
+ ])
+ ])
+LIBS="$LIBS $ISC_ATOMIC_LIBS"
#
# Check for __builtin_expect