From 42dccefb376aaa7a2a577bfd838103bc754b7380 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Sat, 17 Mar 2018 16:49:21 +0000 Subject: [PATCH] C compiler standard atomics support is now required to compile --- config.h.in | 3 - configure | 4101 +++++++++------------- configure.in | 226 +- lib/dns/include/dns/rbt.h | 64 - lib/dns/rbtdb.c | 46 - lib/dns/zone.c | 11 - lib/isc/Makefile.in | 5 +- lib/isc/alpha/Makefile.in | 17 - lib/isc/alpha/include/Makefile.in | 17 - lib/isc/alpha/include/isc/Makefile.in | 34 - lib/isc/alpha/include/isc/atomic.h | 178 - lib/isc/ia64/Makefile.in | 17 - lib/isc/ia64/include/Makefile.in | 17 - lib/isc/ia64/include/isc/Makefile.in | 34 - lib/isc/ia64/include/isc/atomic.h | 94 - lib/isc/include/isc/platform.h.in | 57 - lib/isc/include/isc/refcount.h | 123 +- lib/isc/include/isc/rwlock.h | 44 +- lib/isc/mips/Makefile.in | 17 - lib/isc/mips/include/Makefile.in | 17 - lib/isc/mips/include/isc/Makefile.in | 34 - lib/isc/mips/include/isc/atomic.h | 88 - lib/isc/noatomic/Makefile.in | 17 - lib/isc/noatomic/include/Makefile.in | 17 - lib/isc/noatomic/include/isc/Makefile.in | 34 - lib/isc/noatomic/include/isc/atomic.h | 18 - lib/isc/powerpc/Makefile.in | 17 - lib/isc/powerpc/include/Makefile.in | 17 - lib/isc/powerpc/include/isc/Makefile.in | 34 - lib/isc/powerpc/include/isc/atomic.h | 191 - lib/isc/refcount.c | 4 - lib/isc/rwlock.c | 337 -- lib/isc/sparc64/Makefile.in | 17 - lib/isc/sparc64/include/Makefile.in | 17 - lib/isc/sparc64/include/isc/Makefile.in | 29 - lib/isc/sparc64/include/isc/atomic.h | 120 - lib/isc/stats.c | 220 +- lib/isc/tests/Kyuafile | 1 - lib/isc/tests/Makefile.in | 8 +- lib/isc/tests/atomic_test.c | 352 -- lib/isc/win32/include/isc/atomic.h | 74 - lib/isc/win32/include/isc/platform.h.in | 24 - lib/isc/x86_32/Makefile.in | 17 - lib/isc/x86_32/include/Makefile.in | 17 - lib/isc/x86_32/include/isc/Makefile.in | 34 - lib/isc/x86_32/include/isc/atomic.h | 190 - lib/isc/x86_64/Makefile.in | 17 - lib/isc/x86_64/include/Makefile.in | 17 - lib/isc/x86_64/include/isc/Makefile.in | 34 - lib/isc/x86_64/include/isc/atomic.h | 137 - make/includes.in | 3 +- 51 files changed, 1631 insertions(+), 5627 deletions(-) delete mode 100644 lib/isc/alpha/Makefile.in delete mode 100644 lib/isc/alpha/include/Makefile.in delete mode 100644 lib/isc/alpha/include/isc/Makefile.in delete mode 100644 lib/isc/alpha/include/isc/atomic.h delete mode 100644 lib/isc/ia64/Makefile.in delete mode 100644 lib/isc/ia64/include/Makefile.in delete mode 100644 lib/isc/ia64/include/isc/Makefile.in delete mode 100644 lib/isc/ia64/include/isc/atomic.h delete mode 100644 lib/isc/mips/Makefile.in delete mode 100644 lib/isc/mips/include/Makefile.in delete mode 100644 lib/isc/mips/include/isc/Makefile.in delete mode 100644 lib/isc/mips/include/isc/atomic.h delete mode 100644 lib/isc/noatomic/Makefile.in delete mode 100644 lib/isc/noatomic/include/Makefile.in delete mode 100644 lib/isc/noatomic/include/isc/Makefile.in delete mode 100644 lib/isc/noatomic/include/isc/atomic.h delete mode 100644 lib/isc/powerpc/Makefile.in delete mode 100644 lib/isc/powerpc/include/Makefile.in delete mode 100644 lib/isc/powerpc/include/isc/Makefile.in delete mode 100644 lib/isc/powerpc/include/isc/atomic.h delete mode 100644 lib/isc/sparc64/Makefile.in delete mode 100644 lib/isc/sparc64/include/Makefile.in delete mode 100644 lib/isc/sparc64/include/isc/Makefile.in delete mode 100644 lib/isc/sparc64/include/isc/atomic.h delete mode 100644 lib/isc/tests/atomic_test.c delete mode 100644 lib/isc/win32/include/isc/atomic.h delete mode 100644 lib/isc/x86_32/Makefile.in delete mode 100644 lib/isc/x86_32/include/Makefile.in delete mode 100644 lib/isc/x86_32/include/isc/Makefile.in delete mode 100644 lib/isc/x86_32/include/isc/atomic.h delete mode 100644 lib/isc/x86_64/Makefile.in delete mode 100644 lib/isc/x86_64/include/Makefile.in delete mode 100644 lib/isc/x86_64/include/isc/Makefile.in delete mode 100644 lib/isc/x86_64/include/isc/atomic.h diff --git a/config.h.in b/config.h.in index 69e3c1fd315..c90e5a28661 100644 --- a/config.h.in +++ b/config.h.in @@ -595,9 +595,6 @@ int sigwait(const unsigned int *set, int *sig); /* Define if GOST private keys are encoded in ASN.1. */ #undef PREFER_GOSTASN1 -/* The size of `void *', as computed by sizeof. */ -#undef SIZEOF_VOID_P - /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS diff --git a/configure b/configure index 28840a8a9ca..f15cfe44e14 100755 --- a/configure +++ b/configure @@ -711,17 +711,7 @@ DNSTAP FSTRM_CAPTURE PROTOC_C ISC_PLATFORM_BUSYWAITNOP -ISC_ARCH_DIR -ISC_PLATFORM_USEMACASM -ISC_PLATFORM_USESTDASM -ISC_PLATFORM_USEOSFASM -ISC_PLATFORM_USEGCCASM -ISC_PLATFORM_HAVEATOMICSTOREQ -ISC_PLATFORM_HAVEATOMICSTORE -ISC_PLATFORM_HAVECMPXCHG -ISC_PLATFORM_HAVEXADDQ -ISC_PLATFORM_HAVEXADD -ISC_PLATFORM_HAVESTDATOMIC +ISC_ATOMIC_LIBS ISC_PLATFORM_HAVEIFNAMETOINDEX ISC_PLATFORM_HAVESTRINGSH ISC_PLATFORM_BRACEPTHREADONCEINIT @@ -880,7 +870,6 @@ STD_CINCLUDES INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM -CPP LT_SYS_LIBRARY_PATH OTOOL64 OTOOL @@ -904,6 +893,8 @@ FGREP EGREP GREP SED +LIBTOOL +CPP OBJEXT EXEEXT ac_ct_CC @@ -911,7 +902,6 @@ CPPFLAGS LDFLAGS CFLAGS CC -LIBTOOL SET_MAKE host_os host_vendor @@ -1023,7 +1013,6 @@ enable_isc_spnego enable_chroot enable_linux_caps with_rlimtype -enable_atomic enable_fixed_rrset enable_rpz_nsip enable_rpz_nsdname @@ -1058,8 +1047,8 @@ CFLAGS LDFLAGS LIBS CPPFLAGS -LT_SYS_LIBRARY_PATH -CPP' +CPP +LT_SYS_LIBRARY_PATH' # Initialize some variables set by options. @@ -1705,8 +1694,6 @@ Optional Features: --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] @@ -1792,9 +1779,9 @@ Some influential environment variables: LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory + CPP C preprocessor LT_SYS_LIBRARY_PATH User-defined run-time library search path. - CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. @@ -1923,6 +1910,43 @@ fi } # ac_fn_c_try_compile +# ac_fn_c_try_cpp LINENO +# ---------------------- +# Try to preprocess conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_cpp () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } > conftest.i && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_cpp + # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. @@ -2000,43 +2024,6 @@ $as_echo "$ac_res" >&6; } } # ac_fn_c_check_header_compile -# ac_fn_c_try_cpp LINENO -# ---------------------- -# Try to preprocess conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_cpp () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } > conftest.i && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_cpp - # ac_fn_c_try_run LINENO # ---------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes @@ -2290,189 +2277,6 @@ fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_mongrel - -# 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 -#include -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 config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. @@ -2964,153 +2768,48 @@ $as_echo "no" >&6; } fi -# -# GNU libtool support -# -case $build_os in -sunos*) - # Just set the maximum command line length for sunos as it otherwise - # takes a exceptionally long time to work it out. Required for libtool. - - lt_cv_sys_max_cmd_len=4096; - ;; -esac - -case `pwd` in - *\ * | *\ *) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 -$as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; -esac - +# Set compiler compatibility flags +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS - -macro_version='2.4.6' -macro_revision='2.4.6' - - - - - - - - - - - - - -ltmain=$ac_aux_dir/ltmain.sh - -# Backslashify metacharacters that are still active within -# double-quoted strings. -sed_quote_subst='s/\(["`$\\]\)/\\\1/g' - -# Same as above, but do not quote variable references. -double_quote_subst='s/\(["`\\]\)/\\\1/g' - -# Sed substitution to delay expansion of an escaped shell variable in a -# double_quote_subst'ed string. -delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' - -# Sed substitution to delay expansion of an escaped single quote. -delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' - -# Sed substitution to avoid accidental globbing in evaled expressions -no_glob_subst='s/\*/\\\*/g' - -ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO -ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 -$as_echo_n "checking how to print strings... " >&6; } -# Test print first, because it will be a builtin if present. -if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ - test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then - ECHO='print -r --' -elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then - ECHO='printf %s\n' -else - # Use this function as a fallback that always works. - func_fallback_echo () - { - eval 'cat <<_LTECHO_EOF -$1 -_LTECHO_EOF' - } - ECHO='func_fallback_echo' -fi - -# func_echo_all arg... -# Invoke $ECHO with all args, space-separated. -func_echo_all () -{ - $ECHO "" -} - -case $ECHO in - printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5 -$as_echo "printf" >&6; } ;; - print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 -$as_echo "print -r" >&6; } ;; - *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5 -$as_echo "cat" >&6; } ;; -esac - - - - - - - - - - - - - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. -set dummy ${ac_tool_prefix}gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi fi @@ -3859,294 +3558,344 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 -$as_echo_n "checking for a sed that does not truncate output... " >&6; } -if ${ac_cv_path_SED+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C99" >&5 +$as_echo_n "checking for $CC option to accept ISO C99... " >&6; } +if ${ac_cv_prog_cc_c99+:} false; then : $as_echo_n "(cached) " >&6 else - ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ - for ac_i in 1 2 3 4 5 6 7; do - ac_script="$ac_script$as_nl$ac_script" - done - echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed - { ac_script=; unset ac_script;} - if test -z "$SED"; then - ac_path_SED_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in sed gsed; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_SED" || continue -# Check for GNU ac_path_SED and select it if it is found. - # Check for GNU $ac_path_SED -case `"$ac_path_SED" --version 2>&1` in -*GNU*) - ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo '' >> "conftest.nl" - "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_SED_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_SED="$ac_path_SED" - ac_path_SED_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac + ac_cv_prog_cc_c99=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include +#include - $ac_path_SED_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_SED"; then - as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 - fi -else - ac_cv_path_SED=$SED -fi +// Check varargs macros. These examples are taken from C99 6.10.3.5. +#define debug(...) fprintf (stderr, __VA_ARGS__) +#define showlist(...) puts (#__VA_ARGS__) +#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) +static void +test_varargs_macros (void) +{ + int x = 1234; + int y = 5678; + debug ("Flag"); + debug ("X = %d\n", x); + showlist (The first, second, and third items.); + report (x>y, "x is %d but y is %d", x, y); +} -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 -$as_echo "$ac_cv_path_SED" >&6; } - SED="$ac_cv_path_SED" - rm -f conftest.sed +// Check long long types. +#define BIG64 18446744073709551615ull +#define BIG32 4294967295ul +#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) +#if !BIG_OK + your preprocessor is broken; +#endif +#if BIG_OK +#else + your preprocessor is broken; +#endif +static long long int bignum = -9223372036854775807LL; +static unsigned long long int ubignum = BIG64; -test -z "$SED" && SED=sed -Xsed="$SED -e 1s/^X//" +struct incomplete_array +{ + int datasize; + double data[]; +}; +struct named_init { + int number; + const wchar_t *name; + double average; +}; +typedef const char *ccp; +static inline int +test_restrict (ccp restrict text) +{ + // See if C++-style comments work. + // Iterate through items via the restricted pointer. + // Also check for declarations in for loops. + for (unsigned int i = 0; *(text+i) != '\0'; ++i) + continue; + return 0; +} +// Check varargs and va_copy. +static void +test_varargs (const char *format, ...) +{ + va_list args; + va_start (args, format); + va_list args_copy; + va_copy (args_copy, args); + const char *str; + int number; + float fnumber; + while (*format) + { + switch (*format++) + { + case 's': // string + str = va_arg (args_copy, const char *); + break; + case 'd': // int + number = va_arg (args_copy, int); + break; + case 'f': // float + fnumber = va_arg (args_copy, double); + break; + default: + break; + } + } + va_end (args_copy); + va_end (args); +} +int +main () +{ + // Check bool. + _Bool success = false; + // Check restrict. + if (test_restrict ("String literal") == 0) + success = true; + char *restrict newvar = "Another string"; + // Check varargs. + test_varargs ("s, d' f .", "string", 65, 34.234); + test_varargs_macros (); -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 -$as_echo_n "checking for grep that handles long lines and -e... " >&6; } -if ${ac_cv_path_GREP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -z "$GREP"; then - ac_path_GREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin + // Check flexible array members. + struct incomplete_array *ia = + malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); + ia->datasize = 10; + for (int i = 0; i < ia->datasize; ++i) + ia->data[i] = i * 1.234; + + // Check named initializers. + struct named_init ni = { + .number = 34, + .name = L"Test wide string", + .average = 543.34343, + }; + + ni.number = 58; + + int dynamic_array[ni.number]; + dynamic_array[ni.number - 1] = 543; + + // work around unused variable warnings + return (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x' + || dynamic_array[ni.number - 1] != 543); + + ; + return 0; +} +_ACEOF +for ac_arg in '' -std=gnu99 -std=c99 -c99 -AC99 -D_STDC_C99= -qlanglvl=extc99 do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in grep ggrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_GREP" || continue -# Check for GNU ac_path_GREP and select it if it is found. - # Check for GNU $ac_path_GREP -case `"$ac_path_GREP" --version 2>&1` in -*GNU*) - ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'GREP' >> "conftest.nl" - "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_GREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_GREP="$ac_path_GREP" - ac_path_GREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_c99=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c99" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC - $ac_path_GREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_GREP"; then - as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_GREP=$GREP fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c99" in + x) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c99" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 +$as_echo "$ac_cv_prog_cc_c99" >&6; } ;; +esac +if test "x$ac_cv_prog_cc_c99" != xno; then : fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 -$as_echo "$ac_cv_path_GREP" >&6; } - GREP="$ac_cv_path_GREP" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 -$as_echo_n "checking for egrep... " >&6; } -if ${ac_cv_path_EGREP+:} false; then : +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 +$as_echo_n "checking how to run the C preprocessor... " >&6; } +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else - if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 - then ac_cv_path_EGREP="$GREP -E" - else - if test -z "$EGREP"; then - ac_path_EGREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in egrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_EGREP" || continue -# Check for GNU ac_path_EGREP and select it if it is found. - # Check for GNU $ac_path_EGREP -case `"$ac_path_EGREP" --version 2>&1` in -*GNU*) - ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'EGREP' >> "conftest.nl" - "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_EGREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_EGREP="$ac_path_EGREP" - ac_path_EGREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : - $ac_path_EGREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_EGREP"; then - as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi else - ac_cv_path_EGREP=$EGREP + # Broken: fails on valid input. +continue fi +rm -f conftest.err conftest.i conftest.$ac_ext - fi + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 -$as_echo "$ac_cv_path_EGREP" >&6; } - EGREP="$ac_cv_path_EGREP" +rm -f conftest.err conftest.i conftest.$ac_ext +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + break +fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 -$as_echo_n "checking for fgrep... " >&6; } -if ${ac_cv_path_FGREP+:} false; then : - $as_echo_n "(cached) " >&6 + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP else - if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 - then ac_cv_path_FGREP="$GREP -F" - else - if test -z "$FGREP"; then - ac_path_FGREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin + ac_cv_prog_CPP=$CPP +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 +$as_echo "$CPP" >&6; } +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in fgrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_FGREP" || continue -# Check for GNU ac_path_FGREP and select it if it is found. - # Check for GNU $ac_path_FGREP -case `"$ac_path_FGREP" --version 2>&1` in -*GNU*) - ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'FGREP' >> "conftest.nl" - "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_FGREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_FGREP="$ac_path_FGREP" - ac_path_FGREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : - $ac_path_FGREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_FGREP"; then - as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi else - ac_cv_path_FGREP=$FGREP + # Broken: fails on valid input. +continue fi +rm -f conftest.err conftest.i conftest.$ac_ext - fi + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 -$as_echo "$ac_cv_path_FGREP" >&6; } - FGREP="$ac_cv_path_FGREP" +rm -f conftest.err conftest.i conftest.$ac_ext +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : -test -z "$GREP" && GREP=grep +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 $? "C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details" "$LINENO" 5; } +fi +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +ac_c_preproc_warn_flag=yes +# +# GNU libtool support +# +case $build_os in +sunos*) + # Just set the maximum command line length for sunos as it otherwise + # takes a exceptionally long time to work it out. Required for libtool. + lt_cv_sys_max_cmd_len=4096; + ;; +esac +case `pwd` in + *\ * | *\ *) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 +$as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; +esac +macro_version='2.4.6' +macro_revision='2.4.6' @@ -4158,108 +3907,65 @@ test -z "$GREP" && GREP=grep -# Check whether --with-gnu-ld was given. -if test "${with_gnu_ld+set}" = set; then : - withval=$with_gnu_ld; test no = "$withval" || with_gnu_ld=yes -else - with_gnu_ld=no -fi -ac_prog=ld -if test yes = "$GCC"; then - # Check if gcc -print-prog-name=ld gives a path. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 -$as_echo_n "checking for ld used by $CC... " >&6; } - case $host in - *-*-mingw*) - # gcc leaves a trailing carriage return, which upsets mingw - ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; - *) - ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; - esac - case $ac_prog in - # Accept absolute paths. - [\\/]* | ?:[\\/]*) - re_direlt='/[^/][^/]*/\.\./' - # Canonicalize the pathname of ld - ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` - while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do - ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` - done - test -z "$LD" && LD=$ac_prog - ;; - "") - # If it fails, then pretend we aren't using GCC. - ac_prog=ld - ;; - *) - # If it is relative, then search for the first ld in PATH. - with_gnu_ld=unknown - ;; - esac -elif test yes = "$with_gnu_ld"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 -$as_echo_n "checking for GNU ld... " >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 -$as_echo_n "checking for non-GNU ld... " >&6; } -fi -if ${lt_cv_path_LD+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -z "$LD"; then - lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR - for ac_dir in $PATH; do - IFS=$lt_save_ifs - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - lt_cv_path_LD=$ac_dir/$ac_prog - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some variants of GNU ld only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - case `"$lt_cv_path_LD" -v 2>&1 &5 -$as_echo "$LD" >&6; } +ltmain=$ac_aux_dir/ltmain.sh + +# Backslashify metacharacters that are still active within +# double-quoted strings. +sed_quote_subst='s/\(["`$\\]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\(["`\\]\)/\\\1/g' + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Sed substitution to delay expansion of an escaped single quote. +delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' + +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' + +ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 +$as_echo_n "checking how to print strings... " >&6; } +# Test print first, because it will be a builtin if present. +if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ + test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='print -r --' +elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='printf %s\n' else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + # Use this function as a fallback that always works. + func_fallback_echo () + { + eval 'cat <<_LTECHO_EOF +$1 +_LTECHO_EOF' + } + ECHO='func_fallback_echo' fi -test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 -$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } -if ${lt_cv_prog_gnu_ld+:} false; then : - $as_echo_n "(cached) " >&6 -else - # I'd rather use --version here, but apparently some GNU lds only accept -v. -case `$LD -v 2>&1 &5 +$as_echo "printf" >&6; } ;; + print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 +$as_echo "print -r" >&6; } ;; + *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5 +$as_echo "cat" >&6; } ;; esac -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_gnu_ld" >&5 -$as_echo "$lt_cv_prog_gnu_ld" >&6; } -with_gnu_ld=$lt_cv_prog_gnu_ld @@ -4269,507 +3975,412 @@ with_gnu_ld=$lt_cv_prog_gnu_ld -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 -$as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } -if ${lt_cv_path_NM+:} false; then : + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 +$as_echo_n "checking for a sed that does not truncate output... " >&6; } +if ${ac_cv_path_SED+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$NM"; then - # Let the user override the test. - lt_cv_path_NM=$NM + ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ + for ac_i in 1 2 3 4 5 6 7; do + ac_script="$ac_script$as_nl$ac_script" + done + echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed + { ac_script=; unset ac_script;} + if test -z "$SED"; then + ac_path_SED_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_SED" || continue +# Check for GNU ac_path_SED and select it if it is found. + # Check for GNU $ac_path_SED +case `"$ac_path_SED" --version 2>&1` in +*GNU*) + ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo '' >> "conftest.nl" + "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_SED_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_SED="$ac_path_SED" + ac_path_SED_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_SED_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_SED"; then + as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 + fi else - lt_nm_to_check=${ac_tool_prefix}nm - if test -n "$ac_tool_prefix" && test "$build" = "$host"; then - lt_nm_to_check="$lt_nm_to_check nm" - fi - for lt_tmp_nm in $lt_nm_to_check; do - lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR - for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do - IFS=$lt_save_ifs - test -z "$ac_dir" && ac_dir=. - tmp_nm=$ac_dir/$lt_tmp_nm - if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext"; then - # Check to see if the nm accepts a BSD-compat flag. - # Adding the 'sed 1q' prevents false positives on HP-UX, which says: - # nm: unknown option "B" ignored - # Tru64's nm complains that /dev/null is an invalid object file - # MSYS converts /dev/null to NUL, MinGW nm treats NUL as empty - case $build_os in - mingw*) lt_bad_file=conftest.nm/nofile ;; - *) lt_bad_file=/dev/null ;; - esac - case `"$tmp_nm" -B $lt_bad_file 2>&1 | sed '1q'` in - *$lt_bad_file* | *'Invalid file or object type'*) - lt_cv_path_NM="$tmp_nm -B" - break 2 - ;; - *) - case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in - */dev/null*) - lt_cv_path_NM="$tmp_nm -p" - break 2 - ;; - *) - lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but - continue # so that we can try to find one that supports BSD flags - ;; - esac - ;; - esac - fi - done - IFS=$lt_save_ifs - done - : ${lt_cv_path_NM=no} + ac_cv_path_SED=$SED fi + fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 -$as_echo "$lt_cv_path_NM" >&6; } -if test no != "$lt_cv_path_NM"; then - NM=$lt_cv_path_NM -else - # Didn't find any BSD compatible name lister, look for dumpbin. - if test -n "$DUMPBIN"; then : - # Let the user override the test. - else - if test -n "$ac_tool_prefix"; then - for ac_prog in dumpbin "link -dump" - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_DUMPBIN+:} false; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 +$as_echo "$ac_cv_path_SED" >&6; } + SED="$ac_cv_path_SED" + rm -f conftest.sed + +test -z "$SED" && SED=sed +Xsed="$SED -e 1s/^X//" + + + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 +$as_echo_n "checking for grep that handles long lines and -e... " >&6; } +if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$DUMPBIN"; then - ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH + if test -z "$GREP"; then + ac_path_GREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. + for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done + ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_GREP" || continue +# Check for GNU ac_path_GREP and select it if it is found. + # Check for GNU $ac_path_GREP +case `"$ac_path_GREP" --version 2>&1` in +*GNU*) + ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'GREP' >> "conftest.nl" + "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_GREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_GREP="$ac_path_GREP" + ac_path_GREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break done -IFS=$as_save_IFS + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac -fi -fi -DUMPBIN=$ac_cv_prog_DUMPBIN -if test -n "$DUMPBIN"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 -$as_echo "$DUMPBIN" >&6; } + $ac_path_GREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_GREP"; then + as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + ac_cv_path_GREP=$GREP fi - - test -n "$DUMPBIN" && break - done fi -if test -z "$DUMPBIN"; then - ac_ct_DUMPBIN=$DUMPBIN - for ac_prog in dumpbin "link -dump" -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 +$as_echo "$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 +$as_echo_n "checking for egrep... " >&6; } +if ${ac_cv_path_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$ac_ct_DUMPBIN"; then - ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + if test -z "$EGREP"; then + ac_path_EGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. + for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done + ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_EGREP" || continue +# Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break done -IFS=$as_save_IFS + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac -fi -fi -ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN -if test -n "$ac_ct_DUMPBIN"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 -$as_echo "$ac_ct_DUMPBIN" >&6; } + $ac_path_EGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_EGREP"; then + as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + ac_cv_path_EGREP=$EGREP fi - - test -n "$ac_ct_DUMPBIN" && break -done - - if test "x$ac_ct_DUMPBIN" = x; then - DUMPBIN=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - DUMPBIN=$ac_ct_DUMPBIN - fi + fi fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 +$as_echo "$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" - case `$DUMPBIN -symbols -headers /dev/null 2>&1 | sed '1q'` in - *COFF*) - DUMPBIN="$DUMPBIN -symbols -headers" - ;; - *) - DUMPBIN=: - ;; - esac - fi - - if test : != "$DUMPBIN"; then - NM=$DUMPBIN - fi -fi -test -z "$NM" && NM=nm - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 -$as_echo_n "checking the name lister ($NM) interface... " >&6; } -if ${lt_cv_nm_interface+:} false; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 +$as_echo_n "checking for fgrep... " >&6; } +if ${ac_cv_path_FGREP+:} false; then : $as_echo_n "(cached) " >&6 else - lt_cv_nm_interface="BSD nm" - echo "int some_variable = 0;" > conftest.$ac_ext - (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5) - (eval "$ac_compile" 2>conftest.err) - cat conftest.err >&5 - (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5) - (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) - cat conftest.err >&5 - (eval echo "\"\$as_me:$LINENO: output\"" >&5) - cat conftest.out >&5 - if $GREP 'External.*some_variable' conftest.out > /dev/null; then - lt_cv_nm_interface="MS dumpbin" - fi - rm -f conftest* -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 -$as_echo "$lt_cv_nm_interface" >&6; } + if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 + then ac_cv_path_FGREP="$GREP -F" + else + if test -z "$FGREP"; then + ac_path_FGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in fgrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_FGREP" || continue +# Check for GNU ac_path_FGREP and select it if it is found. + # Check for GNU $ac_path_FGREP +case `"$ac_path_FGREP" --version 2>&1` in +*GNU*) + ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'FGREP' >> "conftest.nl" + "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_FGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_FGREP="$ac_path_FGREP" + ac_path_FGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 -$as_echo_n "checking whether ln -s works... " >&6; } -LN_S=$as_ln_s -if test "$LN_S" = "ln -s"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } + $ac_path_FGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_FGREP"; then + as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 -$as_echo "no, using $LN_S" >&6; } + ac_cv_path_FGREP=$FGREP fi -# find the maximum length of command line arguments -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 -$as_echo_n "checking the maximum length of command line arguments... " >&6; } -if ${lt_cv_sys_max_cmd_len+:} false; then : - $as_echo_n "(cached) " >&6 -else - i=0 - teststring=ABCD - - case $build_os in - msdosdjgpp*) - # On DJGPP, this test can blow up pretty badly due to problems in libc - # (any single argument exceeding 2000 bytes causes a buffer overrun - # during glob expansion). Even if it were fixed, the result of this - # check would be larger than it should be. - lt_cv_sys_max_cmd_len=12288; # 12K is about right - ;; + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 +$as_echo "$ac_cv_path_FGREP" >&6; } + FGREP="$ac_cv_path_FGREP" - gnu*) - # Under GNU Hurd, this test is not required because there is - # no limit to the length of command line arguments. - # Libtool will interpret -1 as no limit whatsoever - lt_cv_sys_max_cmd_len=-1; - ;; - cygwin* | mingw* | cegcc*) - # On Win9x/ME, this test blows up -- it succeeds, but takes - # about 5 minutes as the teststring grows exponentially. - # Worse, since 9x/ME are not pre-emptively multitasking, - # you end up with a "frozen" computer, even though with patience - # the test eventually succeeds (with a max line length of 256k). - # Instead, let's just punt: use the minimum linelength reported by - # all of the supported platforms: 8192 (on NT/2K/XP). - lt_cv_sys_max_cmd_len=8192; - ;; +test -z "$GREP" && GREP=grep - mint*) - # On MiNT this can take a long time and run out of memory. - lt_cv_sys_max_cmd_len=8192; - ;; - amigaos*) - # On AmigaOS with pdksh, this test takes hours, literally. - # So we just punt and use a minimum line length of 8192. - lt_cv_sys_max_cmd_len=8192; - ;; - bitrig* | darwin* | dragonfly* | freebsd* | netbsd* | openbsd*) - # This has been around since 386BSD, at least. Likely further. - if test -x /sbin/sysctl; then - lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` - elif test -x /usr/sbin/sysctl; then - lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` - else - lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs - fi - # And add a safety zone - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` - ;; - interix*) - # We know the value 262144 and hardcode it with a safety zone (like BSD) - lt_cv_sys_max_cmd_len=196608 - ;; - os2*) - # The test takes a long time on OS/2. - lt_cv_sys_max_cmd_len=8192 - ;; - osf*) - # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure - # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not - # nice to cause kernel panics so lets avoid the loop below. - # First set a reasonable default. - lt_cv_sys_max_cmd_len=16384 - # - if test -x /sbin/sysconfig; then - case `/sbin/sysconfig -q proc exec_disable_arg_limit` in - *1*) lt_cv_sys_max_cmd_len=-1 ;; - esac - fi - ;; - sco3.2v5*) - lt_cv_sys_max_cmd_len=102400 - ;; - sysv5* | sco5v6* | sysv4.2uw2*) - kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` - if test -n "$kargmax"; then - lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` - else - lt_cv_sys_max_cmd_len=32768 - fi - ;; - *) - lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` - if test -n "$lt_cv_sys_max_cmd_len" && \ - test undefined != "$lt_cv_sys_max_cmd_len"; then - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` - else - # Make teststring a little bigger before we do anything with it. - # a 1K string should be a reasonable start. - for i in 1 2 3 4 5 6 7 8; do - teststring=$teststring$teststring - done - SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} - # If test is not a shell built-in, we'll probably end up computing a - # maximum length that is only half of the actual maximum length, but - # we can't tell. - while { test X`env echo "$teststring$teststring" 2>/dev/null` \ - = "X$teststring$teststring"; } >/dev/null 2>&1 && - test 17 != "$i" # 1/2 MB should be enough - do - i=`expr $i + 1` - teststring=$teststring$teststring - done - # Only check the string length outside the loop. - lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` - teststring= - # Add a significant safety factor because C++ compilers can tack on - # massive amounts of additional arguments before passing them to the - # linker. It appears as though 1/2 is a usable value. - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` - fi - ;; - esac -fi -if test -n "$lt_cv_sys_max_cmd_len"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 -$as_echo "$lt_cv_sys_max_cmd_len" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 -$as_echo "none" >&6; } -fi -max_cmd_len=$lt_cv_sys_max_cmd_len -: ${CP="cp -f"} -: ${MV="mv -f"} -: ${RM="rm -f"} -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - lt_unset=unset -else - lt_unset=false -fi +# Check whether --with-gnu-ld was given. +if test "${with_gnu_ld+set}" = set; then : + withval=$with_gnu_ld; test no = "$withval" || with_gnu_ld=yes +else + with_gnu_ld=no +fi -# test EBCDIC or ASCII -case `echo X|tr X '\101'` in - A) # ASCII based system - # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr - lt_SP2NL='tr \040 \012' - lt_NL2SP='tr \015\012 \040\040' - ;; - *) # EBCDIC based system - lt_SP2NL='tr \100 \n' - lt_NL2SP='tr \r\n \100\100' - ;; -esac - - - - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 -$as_echo_n "checking how to convert $build file names to $host format... " >&6; } -if ${lt_cv_to_host_file_cmd+:} false; then : - $as_echo_n "(cached) " >&6 -else +ac_prog=ld +if test yes = "$GCC"; then + # Check if gcc -print-prog-name=ld gives a path. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 +$as_echo_n "checking for ld used by $CC... " >&6; } case $host in - *-*-mingw* ) - case $build in - *-*-mingw* ) # actually msys - lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 - ;; - *-*-cygwin* ) - lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 - ;; - * ) # otherwise, assume *nix - lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 - ;; - esac - ;; - *-*-cygwin* ) - case $build in - *-*-mingw* ) # actually msys - lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin - ;; - *-*-cygwin* ) - lt_cv_to_host_file_cmd=func_convert_file_noop - ;; - * ) # otherwise, assume *nix - lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin - ;; - esac + *-*-mingw*) + # gcc leaves a trailing carriage return, which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [\\/]* | ?:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' + # Canonicalize the pathname of ld + ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` + while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do + ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` + done + test -z "$LD" && LD=$ac_prog + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld ;; - * ) # unhandled hosts (and "normal" native builds) - lt_cv_to_host_file_cmd=func_convert_file_noop + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown ;; -esac - + esac +elif test yes = "$with_gnu_ld"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 +$as_echo_n "checking for GNU ld... " >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 +$as_echo_n "checking for non-GNU ld... " >&6; } fi - -to_host_file_cmd=$lt_cv_to_host_file_cmd -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5 -$as_echo "$lt_cv_to_host_file_cmd" >&6; } - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5 -$as_echo_n "checking how to convert $build file names to toolchain format... " >&6; } -if ${lt_cv_to_tool_file_cmd+:} false; then : +if ${lt_cv_path_LD+:} false; then : $as_echo_n "(cached) " >&6 else - #assume ordinary cross tools, or native build. -lt_cv_to_tool_file_cmd=func_convert_file_noop -case $host in - *-*-mingw* ) - case $build in - *-*-mingw* ) # actually msys - lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 - ;; - esac - ;; -esac - + if test -z "$LD"; then + lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS=$lt_save_ifs + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD=$ac_dir/$ac_prog + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some variants of GNU ld only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$lt_cv_path_LD" -v 2>&1 &5 -$as_echo "$lt_cv_to_tool_file_cmd" >&6; } - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 -$as_echo_n "checking for $LD option to reload object files... " >&6; } -if ${lt_cv_ld_reload_flag+:} false; then : - $as_echo_n "(cached) " >&6 +LD=$lt_cv_path_LD +if test -n "$LD"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5 +$as_echo "$LD" >&6; } else - lt_cv_ld_reload_flag='-r' + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 -$as_echo "$lt_cv_ld_reload_flag" >&6; } -reload_flag=$lt_cv_ld_reload_flag -case $reload_flag in -"" | " "*) ;; -*) reload_flag=" $reload_flag" ;; -esac -reload_cmds='$LD$reload_flag -o $output$reload_objs' -case $host_os in - cygwin* | mingw* | pw32* | cegcc*) - if test yes != "$GCC"; then - reload_cmds=false - fi - ;; - darwin*) - if test yes = "$GCC"; then - reload_cmds='$LTCC $LTCFLAGS -nostdlib $wl-r -o $output$reload_objs' - else - reload_cmds='$LD$reload_flag -o $output$reload_objs' - fi - ;; +test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 +$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } +if ${lt_cv_prog_gnu_ld+:} false; then : + $as_echo_n "(cached) " >&6 +else + # I'd rather use --version here, but apparently some GNU lds only accept -v. +case `$LD -v 2>&1 &5 +$as_echo "$lt_cv_prog_gnu_ld" >&6; } +with_gnu_ld=$lt_cv_prog_gnu_ld @@ -4779,56 +4390,125 @@ esac -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. -set dummy ${ac_tool_prefix}objdump; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_OBJDUMP+:} false; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 +$as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } +if ${lt_cv_path_NM+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$OBJDUMP"; then - ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. + if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM=$NM else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 + lt_nm_to_check=${ac_tool_prefix}nm + if test -n "$ac_tool_prefix" && test "$build" = "$host"; then + lt_nm_to_check="$lt_nm_to_check nm" fi -done + for lt_tmp_nm in $lt_nm_to_check; do + lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR + for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do + IFS=$lt_save_ifs + test -z "$ac_dir" && ac_dir=. + tmp_nm=$ac_dir/$lt_tmp_nm + if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext"; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the 'sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + # MSYS converts /dev/null to NUL, MinGW nm treats NUL as empty + case $build_os in + mingw*) lt_bad_file=conftest.nm/nofile ;; + *) lt_bad_file=/dev/null ;; + esac + case `"$tmp_nm" -B $lt_bad_file 2>&1 | sed '1q'` in + *$lt_bad_file* | *'Invalid file or object type'*) + lt_cv_path_NM="$tmp_nm -B" + break 2 + ;; + *) + case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in + */dev/null*) + lt_cv_path_NM="$tmp_nm -p" + break 2 + ;; + *) + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + ;; + esac + ;; + esac + fi + done + IFS=$lt_save_ifs done -IFS=$as_save_IFS - + : ${lt_cv_path_NM=no} fi fi -OBJDUMP=$ac_cv_prog_OBJDUMP -if test -n "$OBJDUMP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 -$as_echo "$OBJDUMP" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 +$as_echo "$lt_cv_path_NM" >&6; } +if test no != "$lt_cv_path_NM"; then + NM=$lt_cv_path_NM +else + # Didn't find any BSD compatible name lister, look for dumpbin. + if test -n "$DUMPBIN"; then : + # Let the user override the test. + else + if test -n "$ac_tool_prefix"; then + for ac_prog in dumpbin "link -dump" + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_DUMPBIN+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$DUMPBIN"; then + ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +DUMPBIN=$ac_cv_prog_DUMPBIN +if test -n "$DUMPBIN"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 +$as_echo "$DUMPBIN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi + test -n "$DUMPBIN" && break + done fi -if test -z "$ac_cv_prog_OBJDUMP"; then - ac_ct_OBJDUMP=$OBJDUMP - # Extract the first word of "objdump", so it can be a program name with args. -set dummy objdump; ac_word=$2 +if test -z "$DUMPBIN"; then + ac_ct_DUMPBIN=$DUMPBIN + for ac_prog in dumpbin "link -dump" +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : +if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$ac_ct_OBJDUMP"; then - ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. + if test -n "$ac_ct_DUMPBIN"; then + ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH @@ -4837,7 +4517,7 @@ do test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_OBJDUMP="objdump" + ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -4847,17 +4527,21 @@ IFS=$as_save_IFS fi fi -ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP -if test -n "$ac_ct_OBJDUMP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 -$as_echo "$ac_ct_OBJDUMP" >&6; } +ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN +if test -n "$ac_ct_DUMPBIN"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 +$as_echo "$ac_ct_DUMPBIN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi - if test "x$ac_ct_OBJDUMP" = x; then - OBJDUMP="false" + + test -n "$ac_ct_DUMPBIN" && break +done + + if test "x$ac_ct_DUMPBIN" = x; then + DUMPBIN=":" else case $cross_compiling:$ac_tool_warned in yes:) @@ -4865,255 +4549,348 @@ yes:) $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac - OBJDUMP=$ac_ct_OBJDUMP + DUMPBIN=$ac_ct_DUMPBIN fi -else - OBJDUMP="$ac_cv_prog_OBJDUMP" fi -test -z "$OBJDUMP" && OBJDUMP=objdump + case `$DUMPBIN -symbols -headers /dev/null 2>&1 | sed '1q'` in + *COFF*) + DUMPBIN="$DUMPBIN -symbols -headers" + ;; + *) + DUMPBIN=: + ;; + esac + fi + if test : != "$DUMPBIN"; then + NM=$DUMPBIN + fi +fi +test -z "$NM" && NM=nm +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 +$as_echo_n "checking the name lister ($NM) interface... " >&6; } +if ${lt_cv_nm_interface+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_nm_interface="BSD nm" + echo "int some_variable = 0;" > conftest.$ac_ext + (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5) + (eval "$ac_compile" 2>conftest.err) + cat conftest.err >&5 + (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5) + (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) + cat conftest.err >&5 + (eval echo "\"\$as_me:$LINENO: output\"" >&5) + cat conftest.out >&5 + if $GREP 'External.*some_variable' conftest.out > /dev/null; then + lt_cv_nm_interface="MS dumpbin" + fi + rm -f conftest* +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 +$as_echo "$lt_cv_nm_interface" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 +$as_echo_n "checking whether ln -s works... " >&6; } +LN_S=$as_ln_s +if test "$LN_S" = "ln -s"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 +$as_echo "no, using $LN_S" >&6; } +fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 -$as_echo_n "checking how to recognize dependent libraries... " >&6; } -if ${lt_cv_deplibs_check_method+:} false; then : +# find the maximum length of command line arguments +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 +$as_echo_n "checking the maximum length of command line arguments... " >&6; } +if ${lt_cv_sys_max_cmd_len+:} false; then : $as_echo_n "(cached) " >&6 else - lt_cv_file_magic_cmd='$MAGIC_CMD' -lt_cv_file_magic_test_file= -lt_cv_deplibs_check_method='unknown' -# Need to set the preceding variable on all platforms that support -# interlibrary dependencies. -# 'none' -- dependencies not supported. -# 'unknown' -- same as none, but documents that we really don't know. -# 'pass_all' -- all dependencies passed with no checks. -# 'test_compile' -- check by making test program. -# 'file_magic [[regex]]' -- check by looking for files in library path -# that responds to the $file_magic_cmd with a given extended regex. -# If you have 'file' or equivalent on your system and you're not sure -# whether 'pass_all' will *always* work, you probably want this one. + i=0 + teststring=ABCD -case $host_os in -aix[4-9]*) - lt_cv_deplibs_check_method=pass_all - ;; + case $build_os in + msdosdjgpp*) + # On DJGPP, this test can blow up pretty badly due to problems in libc + # (any single argument exceeding 2000 bytes causes a buffer overrun + # during glob expansion). Even if it were fixed, the result of this + # check would be larger than it should be. + lt_cv_sys_max_cmd_len=12288; # 12K is about right + ;; -beos*) - lt_cv_deplibs_check_method=pass_all - ;; + gnu*) + # Under GNU Hurd, this test is not required because there is + # no limit to the length of command line arguments. + # Libtool will interpret -1 as no limit whatsoever + lt_cv_sys_max_cmd_len=-1; + ;; -bsdi[45]*) - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' - lt_cv_file_magic_cmd='/usr/bin/file -L' - lt_cv_file_magic_test_file=/shlib/libc.so - ;; + cygwin* | mingw* | cegcc*) + # On Win9x/ME, this test blows up -- it succeeds, but takes + # about 5 minutes as the teststring grows exponentially. + # Worse, since 9x/ME are not pre-emptively multitasking, + # you end up with a "frozen" computer, even though with patience + # the test eventually succeeds (with a max line length of 256k). + # Instead, let's just punt: use the minimum linelength reported by + # all of the supported platforms: 8192 (on NT/2K/XP). + lt_cv_sys_max_cmd_len=8192; + ;; -cygwin*) - # func_win32_libid is a shell function defined in ltmain.sh - lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' - lt_cv_file_magic_cmd='func_win32_libid' - ;; + mint*) + # On MiNT this can take a long time and run out of memory. + lt_cv_sys_max_cmd_len=8192; + ;; -mingw* | pw32*) - # Base MSYS/MinGW do not provide the 'file' command needed by - # func_win32_libid shell function, so use a weaker test based on 'objdump', - # unless we find 'file', for example because we are cross-compiling. - if ( file / ) >/dev/null 2>&1; then - lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' - lt_cv_file_magic_cmd='func_win32_libid' - else - # Keep this pattern in sync with the one in func_win32_libid. - lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' - lt_cv_file_magic_cmd='$OBJDUMP -f' - fi - ;; + amigaos*) + # On AmigaOS with pdksh, this test takes hours, literally. + # So we just punt and use a minimum line length of 8192. + lt_cv_sys_max_cmd_len=8192; + ;; -cegcc*) - # use the weaker test based on 'objdump'. See mingw*. - lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' - lt_cv_file_magic_cmd='$OBJDUMP -f' - ;; + bitrig* | darwin* | dragonfly* | freebsd* | netbsd* | openbsd*) + # This has been around since 386BSD, at least. Likely further. + if test -x /sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` + elif test -x /usr/sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` + else + lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs + fi + # And add a safety zone + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + ;; -darwin* | rhapsody*) - lt_cv_deplibs_check_method=pass_all - ;; + interix*) + # We know the value 262144 and hardcode it with a safety zone (like BSD) + lt_cv_sys_max_cmd_len=196608 + ;; -freebsd* | dragonfly*) - if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then - case $host_cpu in - i*86 ) - # Not sure whether the presence of OpenBSD here was a mistake. - # Let's accept both of them until this is cleared up. - lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` - ;; - esac - else - lt_cv_deplibs_check_method=pass_all - fi - ;; - -haiku*) - lt_cv_deplibs_check_method=pass_all - ;; + os2*) + # The test takes a long time on OS/2. + lt_cv_sys_max_cmd_len=8192 + ;; -hpux10.20* | hpux11*) - lt_cv_file_magic_cmd=/usr/bin/file - case $host_cpu in - ia64*) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' - lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so + osf*) + # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure + # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not + # nice to cause kernel panics so lets avoid the loop below. + # First set a reasonable default. + lt_cv_sys_max_cmd_len=16384 + # + if test -x /sbin/sysconfig; then + case `/sbin/sysconfig -q proc exec_disable_arg_limit` in + *1*) lt_cv_sys_max_cmd_len=-1 ;; + esac + fi ;; - hppa*64*) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]' - lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl + sco3.2v5*) + lt_cv_sys_max_cmd_len=102400 + ;; + sysv5* | sco5v6* | sysv4.2uw2*) + kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` + if test -n "$kargmax"; then + lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` + else + lt_cv_sys_max_cmd_len=32768 + fi ;; *) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library' - lt_cv_file_magic_test_file=/usr/lib/libc.sl + lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` + if test -n "$lt_cv_sys_max_cmd_len" && \ + test undefined != "$lt_cv_sys_max_cmd_len"; then + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + else + # Make teststring a little bigger before we do anything with it. + # a 1K string should be a reasonable start. + for i in 1 2 3 4 5 6 7 8; do + teststring=$teststring$teststring + done + SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} + # If test is not a shell built-in, we'll probably end up computing a + # maximum length that is only half of the actual maximum length, but + # we can't tell. + while { test X`env echo "$teststring$teststring" 2>/dev/null` \ + = "X$teststring$teststring"; } >/dev/null 2>&1 && + test 17 != "$i" # 1/2 MB should be enough + do + i=`expr $i + 1` + teststring=$teststring$teststring + done + # Only check the string length outside the loop. + lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` + teststring= + # Add a significant safety factor because C++ compilers can tack on + # massive amounts of additional arguments before passing them to the + # linker. It appears as though 1/2 is a usable value. + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` + fi ;; esac - ;; -interix[3-9]*) - # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' - ;; +fi -irix5* | irix6* | nonstopux*) - case $LD in - *-32|*"-32 ") libmagic=32-bit;; - *-n32|*"-n32 ") libmagic=N32;; - *-64|*"-64 ") libmagic=64-bit;; - *) libmagic=never-match;; - esac - lt_cv_deplibs_check_method=pass_all - ;; +if test -n "$lt_cv_sys_max_cmd_len"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 +$as_echo "$lt_cv_sys_max_cmd_len" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 +$as_echo "none" >&6; } +fi +max_cmd_len=$lt_cv_sys_max_cmd_len -# This must be glibc/ELF. -linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) - lt_cv_deplibs_check_method=pass_all - ;; -netbsd*) - if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' - else - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' - fi - ;; -newos6*) - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=/usr/lib/libnls.so - ;; -*nto* | *qnx*) - lt_cv_deplibs_check_method=pass_all - ;; -openbsd* | bitrig*) - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' - else - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' - fi - ;; -osf3* | osf4* | osf5*) - lt_cv_deplibs_check_method=pass_all - ;; +: ${CP="cp -f"} +: ${MV="mv -f"} +: ${RM="rm -f"} -rdos*) - lt_cv_deplibs_check_method=pass_all - ;; +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + lt_unset=unset +else + lt_unset=false +fi -solaris*) - lt_cv_deplibs_check_method=pass_all - ;; -sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) - lt_cv_deplibs_check_method=pass_all - ;; -sysv4 | sysv4.3*) - case $host_vendor in - motorola) - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` - ;; - ncr) - lt_cv_deplibs_check_method=pass_all - ;; - sequent) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' - ;; - sni) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" - lt_cv_file_magic_test_file=/lib/libc.so - ;; - siemens) - lt_cv_deplibs_check_method=pass_all - ;; - pc) - lt_cv_deplibs_check_method=pass_all - ;; - esac - ;; -tpf*) - lt_cv_deplibs_check_method=pass_all + +# test EBCDIC or ASCII +case `echo X|tr X '\101'` in + A) # ASCII based system + # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr + lt_SP2NL='tr \040 \012' + lt_NL2SP='tr \015\012 \040\040' ;; -os2*) - lt_cv_deplibs_check_method=pass_all + *) # EBCDIC based system + lt_SP2NL='tr \100 \n' + lt_NL2SP='tr \r\n \100\100' ;; esac -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 -$as_echo "$lt_cv_deplibs_check_method" >&6; } -file_magic_glob= -want_nocaseglob=no -if test "$build" = "$host"; then - case $host_os in - mingw* | pw32*) - if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then - want_nocaseglob=yes - else - file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"` - fi - ;; - esac -fi -file_magic_cmd=$lt_cv_file_magic_cmd -deplibs_check_method=$lt_cv_deplibs_check_method -test -z "$deplibs_check_method" && deplibs_check_method=unknown +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 +$as_echo_n "checking how to convert $build file names to $host format... " >&6; } +if ${lt_cv_to_host_file_cmd+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 + ;; + esac + ;; + *-*-cygwin* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin + ;; + esac + ;; + * ) # unhandled hosts (and "normal" native builds) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; +esac +fi +to_host_file_cmd=$lt_cv_to_host_file_cmd +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5 +$as_echo "$lt_cv_to_host_file_cmd" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5 +$as_echo_n "checking how to convert $build file names to toolchain format... " >&6; } +if ${lt_cv_to_tool_file_cmd+:} false; then : + $as_echo_n "(cached) " >&6 +else + #assume ordinary cross tools, or native build. +lt_cv_to_tool_file_cmd=func_convert_file_noop +case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 + ;; + esac + ;; +esac + +fi + +to_tool_file_cmd=$lt_cv_to_tool_file_cmd +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5 +$as_echo "$lt_cv_to_tool_file_cmd" >&6; } + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 +$as_echo_n "checking for $LD option to reload object files... " >&6; } +if ${lt_cv_ld_reload_flag+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_ld_reload_flag='-r' +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 +$as_echo "$lt_cv_ld_reload_flag" >&6; } +reload_flag=$lt_cv_ld_reload_flag +case $reload_flag in +"" | " "*) ;; +*) reload_flag=" $reload_flag" ;; +esac +reload_cmds='$LD$reload_flag -o $output$reload_objs' +case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + if test yes != "$GCC"; then + reload_cmds=false + fi + ;; + darwin*) + if test yes = "$GCC"; then + reload_cmds='$LTCC $LTCFLAGS -nostdlib $wl-r -o $output$reload_objs' + else + reload_cmds='$LD$reload_flag -o $output$reload_objs' + fi + ;; +esac @@ -5124,15 +4901,15 @@ test -z "$deplibs_check_method" && deplibs_check_method=unknown if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. -set dummy ${ac_tool_prefix}dlltool; ac_word=$2 + # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. +set dummy ${ac_tool_prefix}objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_DLLTOOL+:} false; then : +if ${ac_cv_prog_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$DLLTOOL"; then - ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. + if test -n "$OBJDUMP"; then + ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH @@ -5141,7 +4918,7 @@ do test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" + ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -5151,10 +4928,10 @@ IFS=$as_save_IFS fi fi -DLLTOOL=$ac_cv_prog_DLLTOOL -if test -n "$DLLTOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 -$as_echo "$DLLTOOL" >&6; } +OBJDUMP=$ac_cv_prog_OBJDUMP +if test -n "$OBJDUMP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 +$as_echo "$OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } @@ -5162,17 +4939,17 @@ fi fi -if test -z "$ac_cv_prog_DLLTOOL"; then - ac_ct_DLLTOOL=$DLLTOOL - # Extract the first word of "dlltool", so it can be a program name with args. -set dummy dlltool; ac_word=$2 +if test -z "$ac_cv_prog_OBJDUMP"; then + ac_ct_OBJDUMP=$OBJDUMP + # Extract the first word of "objdump", so it can be a program name with args. +set dummy objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : +if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$ac_ct_DLLTOOL"; then - ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. + if test -n "$ac_ct_OBJDUMP"; then + ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH @@ -5181,7 +4958,7 @@ do test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_DLLTOOL="dlltool" + ac_cv_prog_ac_ct_OBJDUMP="objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -5191,17 +4968,17 @@ IFS=$as_save_IFS fi fi -ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL -if test -n "$ac_ct_DLLTOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 -$as_echo "$ac_ct_DLLTOOL" >&6; } +ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP +if test -n "$ac_ct_OBJDUMP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 +$as_echo "$ac_ct_OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi - if test "x$ac_ct_DLLTOOL" = x; then - DLLTOOL="false" + if test "x$ac_ct_OBJDUMP" = x; then + OBJDUMP="false" else case $cross_compiling:$ac_tool_warned in yes:) @@ -5209,14 +4986,13 @@ yes:) $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac - DLLTOOL=$ac_ct_DLLTOOL + OBJDUMP=$ac_ct_OBJDUMP fi else - DLLTOOL="$ac_cv_prog_DLLTOOL" + OBJDUMP="$ac_cv_prog_OBJDUMP" fi -test -z "$DLLTOOL" && DLLTOOL=dlltool - +test -z "$OBJDUMP" && OBJDUMP=objdump @@ -5226,50 +5002,395 @@ test -z "$DLLTOOL" && DLLTOOL=dlltool -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5 -$as_echo_n "checking how to associate runtime and link libraries... " >&6; } -if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 +$as_echo_n "checking how to recognize dependent libraries... " >&6; } +if ${lt_cv_deplibs_check_method+:} false; then : $as_echo_n "(cached) " >&6 else - lt_cv_sharedlib_from_linklib_cmd='unknown' + lt_cv_file_magic_cmd='$MAGIC_CMD' +lt_cv_file_magic_test_file= +lt_cv_deplibs_check_method='unknown' +# Need to set the preceding variable on all platforms that support +# interlibrary dependencies. +# 'none' -- dependencies not supported. +# 'unknown' -- same as none, but documents that we really don't know. +# 'pass_all' -- all dependencies passed with no checks. +# 'test_compile' -- check by making test program. +# 'file_magic [[regex]]' -- check by looking for files in library path +# that responds to the $file_magic_cmd with a given extended regex. +# If you have 'file' or equivalent on your system and you're not sure +# whether 'pass_all' will *always* work, you probably want this one. case $host_os in -cygwin* | mingw* | pw32* | cegcc*) - # two different shell functions defined in ltmain.sh; - # decide which one to use based on capabilities of $DLLTOOL - case `$DLLTOOL --help 2>&1` in - *--identify-strict*) - lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib +aix[4-9]*) + lt_cv_deplibs_check_method=pass_all + ;; + +beos*) + lt_cv_deplibs_check_method=pass_all + ;; + +bsdi[45]*) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' + lt_cv_file_magic_cmd='/usr/bin/file -L' + lt_cv_file_magic_test_file=/shlib/libc.so + ;; + +cygwin*) + # func_win32_libid is a shell function defined in ltmain.sh + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + ;; + +mingw* | pw32*) + # Base MSYS/MinGW do not provide the 'file' command needed by + # func_win32_libid shell function, so use a weaker test based on 'objdump', + # unless we find 'file', for example because we are cross-compiling. + if ( file / ) >/dev/null 2>&1; then + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + else + # Keep this pattern in sync with the one in func_win32_libid. + lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' + lt_cv_file_magic_cmd='$OBJDUMP -f' + fi + ;; + +cegcc*) + # use the weaker test based on 'objdump'. See mingw*. + lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + ;; + +darwin* | rhapsody*) + lt_cv_deplibs_check_method=pass_all + ;; + +freebsd* | dragonfly*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then + case $host_cpu in + i*86 ) + # Not sure whether the presence of OpenBSD here was a mistake. + # Let's accept both of them until this is cleared up. + lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; + +haiku*) + lt_cv_deplibs_check_method=pass_all + ;; + +hpux10.20* | hpux11*) + lt_cv_file_magic_cmd=/usr/bin/file + case $host_cpu in + ia64*) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' + lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so + ;; + hppa*64*) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]' + lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) - lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library' + lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; -*) - # fallback: assume linklib IS sharedlib - lt_cv_sharedlib_from_linklib_cmd=$ECHO + +interix[3-9]*) + # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' ;; -esac -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 -$as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; } -sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd -test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO +irix5* | irix6* | nonstopux*) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + lt_cv_deplibs_check_method=pass_all + ;; +# This must be glibc/ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) + lt_cv_deplibs_check_method=pass_all + ;; +netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' + fi + ;; +newos6*) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; +*nto* | *qnx*) + lt_cv_deplibs_check_method=pass_all + ;; +openbsd* | bitrig*) + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' + fi + ;; +osf3* | osf4* | osf5*) + lt_cv_deplibs_check_method=pass_all + ;; +rdos*) + lt_cv_deplibs_check_method=pass_all + ;; -if test -n "$ac_tool_prefix"; then - for ac_prog in ar - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +solaris*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv4 | sysv4.3*) + case $host_vendor in + motorola) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; + siemens) + lt_cv_deplibs_check_method=pass_all + ;; + pc) + lt_cv_deplibs_check_method=pass_all + ;; + esac + ;; + +tpf*) + lt_cv_deplibs_check_method=pass_all + ;; +os2*) + lt_cv_deplibs_check_method=pass_all + ;; +esac + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 +$as_echo "$lt_cv_deplibs_check_method" >&6; } + +file_magic_glob= +want_nocaseglob=no +if test "$build" = "$host"; then + case $host_os in + mingw* | pw32*) + if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then + want_nocaseglob=yes + else + file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"` + fi + ;; + esac +fi + +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method +test -z "$deplibs_check_method" && deplibs_check_method=unknown + + + + + + + + + + + + + + + + + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. +set dummy ${ac_tool_prefix}dlltool; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_DLLTOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$DLLTOOL"; then + ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +DLLTOOL=$ac_cv_prog_DLLTOOL +if test -n "$DLLTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 +$as_echo "$DLLTOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_DLLTOOL"; then + ac_ct_DLLTOOL=$DLLTOOL + # Extract the first word of "dlltool", so it can be a program name with args. +set dummy dlltool; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_DLLTOOL"; then + ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_DLLTOOL="dlltool" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL +if test -n "$ac_ct_DLLTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 +$as_echo "$ac_ct_DLLTOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_DLLTOOL" = x; then + DLLTOOL="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + DLLTOOL=$ac_ct_DLLTOOL + fi +else + DLLTOOL="$ac_cv_prog_DLLTOOL" +fi + +test -z "$DLLTOOL" && DLLTOOL=dlltool + + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5 +$as_echo_n "checking how to associate runtime and link libraries... " >&6; } +if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_sharedlib_from_linklib_cmd='unknown' + +case $host_os in +cygwin* | mingw* | pw32* | cegcc*) + # two different shell functions defined in ltmain.sh; + # decide which one to use based on capabilities of $DLLTOOL + case `$DLLTOOL --help 2>&1` in + *--identify-strict*) + lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib + ;; + *) + lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback + ;; + esac + ;; +*) + # fallback: assume linklib IS sharedlib + lt_cv_sharedlib_from_linklib_cmd=$ECHO + ;; +esac + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 +$as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; } +sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd +test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO + + + + + + + + +if test -n "$ac_tool_prefix"; then + for ac_prog in ar + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AR+:} false; then : @@ -7225,147 +7346,10 @@ func_munge_path_list () esac } -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 -$as_echo_n "checking how to run the C preprocessor... " >&6; } -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= -fi -if test -z "$CPP"; then - if ${ac_cv_prog_CPP+:} false; then : - $as_echo_n "(cached) " >&6 -else - # Double quotes because CPP needs to be expanded - for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" - do - ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - break -fi - - done - ac_cv_prog_CPP=$CPP - -fi - CPP=$ac_cv_prog_CPP -else - ac_cv_prog_CPP=$CPP -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 -$as_echo "$CPP" >&6; } -ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - -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 $? "C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details" "$LINENO" 5; } -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 -$as_echo_n "checking for ANSI C header files... " >&6; } -if ${ac_cv_header_stdc+:} false; then : + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 +$as_echo_n "checking for ANSI C header files... " >&6; } +if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -12493,599 +12477,59 @@ case "$INSTALL" in ac_dir="`echo $INSTALL | sed 's%/[^/]*$%%'`" - ac_prog="`echo $INSTALL | sed 's%.*/%%'`" - test "X$ac_dir" = "X$ac_prog" && ac_dir=. - test -d "$ac_dir" && ac_dir="`(cd \"$ac_dir\" && pwd)`" - INSTALL="$ac_dir/$ac_prog" - ;; -esac - -# -# On these hosts, we really want to use cc, not gcc, even if it is -# found. The gcc that these systems have will not correctly handle -# pthreads. -# -# However, if the user sets $CC to be something, let that override -# our change. -# -if test "X$CC" = "X" ; then - case "$host" in - *-dec-osf*) - CC="cc" - ;; - *-solaris*) - # Use Sun's cc if it is available, but watch - # out for /usr/ucb/cc; it will never be the right - # compiler to use. - # - # If setting CC here fails, the AC_PROG_CC done - # below might still find gcc. - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - case "$ac_dir" in - /usr/ucb) - # exclude - ;; - *) - if test -f "$ac_dir/cc"; then - CC="$ac_dir/cc" - break - fi - ;; - esac - done - IFS="$ac_save_ifs" - ;; - *-hp-hpux*) - CC="cc" - ;; - mips-sgi-irix*) - CC="cc" - ;; - esac -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. -set dummy ${ac_tool_prefix}gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -else - CC="$ac_cv_prog_CC" -fi - -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. -set dummy ${ac_tool_prefix}cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - fi -fi -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - ac_prog_rejected=no -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $# != 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" - fi -fi -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - for ac_prog in cl.exe - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$CC" && break - done -fi -if test -z "$CC"; then - ac_ct_CC=$CC - for ac_prog in cl.exe -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$ac_ct_CC" && break -done - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -fi - -fi - - -test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "no acceptable C compiler found in \$PATH -See \`config.log' for more details" "$LINENO" 5; } - -# Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 -set X $ac_compile -ac_compiler=$2 -for ac_option in --version -v -V -qversion; do - { { ac_try="$ac_compiler $ac_option >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compiler $ac_option >&5") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - sed '10a\ -... rest of stderr output deleted ... - 10q' conftest.err >conftest.er1 - cat conftest.er1 >&5 - fi - rm -f conftest.er1 conftest.err - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -done - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 -$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } -if ${ac_cv_c_compiler_gnu+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_compiler_gnu=yes -else - ac_compiler_gnu=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_c_compiler_gnu=$ac_compiler_gnu - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 -$as_echo "$ac_cv_c_compiler_gnu" >&6; } -if test $ac_compiler_gnu = yes; then - GCC=yes -else - GCC= -fi -ac_test_CFLAGS=${CFLAGS+set} -ac_save_CFLAGS=$CFLAGS -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 -$as_echo_n "checking whether $CC accepts -g... " >&6; } -if ${ac_cv_prog_cc_g+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_save_c_werror_flag=$ac_c_werror_flag - ac_c_werror_flag=yes - ac_cv_prog_cc_g=no - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes -else - CFLAGS="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - -else - ac_c_werror_flag=$ac_save_c_werror_flag - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_c_werror_flag=$ac_save_c_werror_flag -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 -$as_echo "$ac_cv_prog_cc_g" >&6; } -if test "$ac_test_CFLAGS" = set; then - CFLAGS=$ac_save_CFLAGS -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then - CFLAGS="-O2" - else - CFLAGS= - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 -$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if ${ac_cv_prog_cc_c89+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_prog_cc_c89=no -ac_save_CC=$CC -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -struct stat; -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} - -/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has - function prototypes and stuff, but not '\xHH' hex character constants. - These don't provoke an error unfortunately, instead are silently treated - as 'x'. The following induces an error, until -std is added to get - proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an - array size at least. It's necessary to write '\x00'==0 to get something - that's true only with -std. */ -int osf4_cc_array ['\x00' == 0 ? 1 : -1]; - -/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters - inside strings and character constants. */ -#define FOO(x) 'x' -int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; - -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} -_ACEOF -for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ - -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_c89=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext - test "x$ac_cv_prog_cc_c89" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC - -fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c89" in - x) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; - xno) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c89" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 -$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; + ac_prog="`echo $INSTALL | sed 's%.*/%%'`" + test "X$ac_dir" = "X$ac_prog" && ac_dir=. + test -d "$ac_dir" && ac_dir="`(cd \"$ac_dir\" && pwd)`" + INSTALL="$ac_dir/$ac_prog" + ;; esac -if test "x$ac_cv_prog_cc_c89" != xno; then : +# +# On these hosts, we really want to use cc, not gcc, even if it is +# found. The gcc that these systems have will not correctly handle +# pthreads. +# +# However, if the user sets $CC to be something, let that override +# our change. +# +if test "X$CC" = "X" ; then + case "$host" in + *-dec-osf*) + CC="cc" + ;; + *-solaris*) + # Use Sun's cc if it is available, but watch + # out for /usr/ucb/cc; it will never be the right + # compiler to use. + # + # If setting CC here fails, the AC_PROG_CC done + # below might still find gcc. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + case "$ac_dir" in + /usr/ucb) + # exclude + ;; + *) + if test -f "$ac_dir/cc"; then + CC="$ac_dir/cc" + break + fi + ;; + esac + done + IFS="$ac_save_ifs" + ;; + *-hp-hpux*) + CC="cc" + ;; + mips-sgi-irix*) + CC="cc" + ;; + esac fi -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - # # gcc's optimiser is broken at -02 for ultrasparc # @@ -20327,102 +19771,15 @@ _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) - case "$host" in - powerpc-ibm-aix*) - if test "X$GCC" = "Xyes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if asm(\"ics\"); works" >&5 -$as_echo_n "checking if asm(\"ics\"); works... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - main() { asm("ics"); exit(0); } - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - use_atomic=yes -else - - saved_cflags="$CFLAGS" - CFLAGS="$CFLAGS -Wa,-many" - if test "$cross_compiling" = yes; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: cross compile, assume yes" >&5 -$as_echo "cross compile, assume yes" >&6; } - CFLAGS="$saved_cflags" - use_atomic=yes -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - main() { asm("ics"); exit(0); } - -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes, required -Wa,-many" >&5 -$as_echo "yes, required -Wa,-many" >&6; } - use_atomic=yes else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, use_atomic disabled" >&5 -$as_echo "no, use_atomic disabled" >&6; } - CFLAGS="$saved_cflags" - use_atomic=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - - - + as_fn_error $? "a compiler with atomics support is required" "$LINENO" 5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - else - use_atomic=yes - fi - ;; - *) - use_atomic=yes - ;; - esac - ;; - 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 +ISC_ATOMIC_LIBS= +{ $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 +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int @@ -20445,244 +19802,6 @@ $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_USEOSFASM="#undef ISC_PLATFORM_USEOSFASM" -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: error: in \`$ac_pwd':" >&2;} -as_fn_error 77 "cannot compute sizeof (void *) -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 - ;; - alpha*-*) - arch=alpha - ;; - 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 -/* end confdefs.h. */ - -int -main () -{ - - __asm__ volatile ("li r0, 0x0\n"::); - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - compiler="mac" - ISC_PLATFORM_USEMACASM="#define ISC_PLATFORM_USEMACASM 1" - -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 - else - case "$host" in - alpha*-dec-osf*) - # Tru64 compiler has its own syntax for inline - # assembly. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - -#ifndef __DECC -#error "unexpected compiler" -#endif - return (0); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - compiler=osf -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ;; - powerpc-ibm-aix*) - compiler=aix - ;; - esac - fi - case "$compiler" in - gcc) - ISC_PLATFORM_USEGCCASM="#define ISC_PLATFORM_USEGCCASM 1" - ;; - osf) - ISC_PLATFORM_USEOSFASM="#define ISC_PLATFORM_USEOSFASM 1" - ;; - aix) - ;; - mac) - ;; - *) - # See if the generic __asm function works. If not, - # we need to disable the atomic operations. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - __asm("nop") - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - compiler="standard" - ISC_PLATFORM_USESTDASM="#define ISC_PLATFORM_USESTDASM 1" -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: $compiler" >&5 -$as_echo "$compiler" >&6; } -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 - - - - - - - - - - - - -ISC_ARCH_DIR=$arch # diff --git a/configure.in b/configure.in index 9594c01630c..996322074d0 100644 --- a/configure.in +++ b/configure.in @@ -22,6 +22,10 @@ AC_CANONICAL_HOST AC_PROG_MAKE_SET +# Set compiler compatibility flags +AC_PROG_CC_C99 +AC_PROG_CPP_WERROR + # # GNU libtool support # @@ -414,8 +418,6 @@ if test "X$CC" = "X" ; then esac fi -AC_PROG_CC - # # gcc's optimiser is broken at -02 for ultrasparc # @@ -3895,65 +3897,12 @@ AC_TRY_COMPILE([ [ 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) - case "$host" in - powerpc-ibm-aix*) - if test "X$GCC" = "Xyes"; then - AC_MSG_CHECKING([if asm("ics"); works]) - AC_TRY_COMPILE(,[ - main() { asm("ics"); exit(0); } - ], - [AC_MSG_RESULT(yes) - use_atomic=yes], - [ - saved_cflags="$CFLAGS" - CFLAGS="$CFLAGS -Wa,-many" - AC_TRY_RUN([ - main() { asm("ics"); exit(0); } - ], - [AC_MSG_RESULT([yes, required -Wa,-many]) - use_atomic=yes], - [AC_MSG_RESULT([no, use_atomic disabled]) - CFLAGS="$saved_cflags" - use_atomic=no], - [AC_MSG_RESULT([cross compile, assume yes]) - CFLAGS="$saved_cflags" - use_atomic=yes]) - ] - ) - else - use_atomic=yes - fi - ;; - *) - use_atomic=yes - ;; - esac - ;; - no) - have_stdatomic=no - ISC_PLATFORM_HAVESTDATOMIC="#undef ISC_PLATFORM_HAVESTDATOMIC" - use_atomic=no - arch=noatomic - ;; -esac + [AC_MSG_RESULT(yes)], + [AC_MSG_ERROR([a compiler with atomics support is required])]) -if test "X$have_stdatomic" = "Xyes"; then - AC_MSG_CHECKING(if -latomic is needed to use 64-bit stdatomic.h primitives) - AC_LINK_IFELSE( +ISC_ATOMIC_LIBS= +AC_MSG_CHECKING(if -latomic is needed to use 64-bit stdatomic.h primitives) +AC_LINK_IFELSE( [AC_LANG_PROGRAM([#include ], [atomic_int_fast64_t val = 0; atomic_fetch_add_explicit(&val, 1, memory_order_relaxed);])], [AC_MSG_RESULT(no) @@ -3961,162 +3910,7 @@ if test "X$have_stdatomic" = "Xyes"; then [AC_MSG_RESULT(yes) ISC_ATOMIC_LIBS="-latomic"] ) - LIBS="$LIBS $ISC_ATOMIC_LIBS" -fi - -AC_SUBST(ISC_PLATFORM_HAVESTDATOMIC) - -ISC_PLATFORM_USEOSFASM="#undef ISC_PLATFORM_USEOSFASM" -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 - ;; - alpha*-*) - arch=alpha - ;; - 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 - else - case "$host" in - alpha*-dec-osf*) - # Tru64 compiler has its own syntax for inline - # assembly. - AC_TRY_COMPILE(, [ -#ifndef __DECC -#error "unexpected compiler" -#endif - return (0);], - [compiler=osf],) - ;; - powerpc-ibm-aix*) - compiler=aix - ;; - esac - fi - case "$compiler" in - gcc) - ISC_PLATFORM_USEGCCASM="#define ISC_PLATFORM_USEGCCASM 1" - ;; - osf) - ISC_PLATFORM_USEOSFASM="#define ISC_PLATFORM_USEOSFASM 1" - ;; - aix) - ;; - 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_USEOSFASM) -AC_SUBST(ISC_PLATFORM_USESTDASM) -AC_SUBST(ISC_PLATFORM_USEMACASM) - -ISC_ARCH_DIR=$arch -AC_SUBST(ISC_ARCH_DIR) +AC_SUBST([ISC_ATOMIC_LIBS]) # # Check for __builtin_expect diff --git a/lib/dns/include/dns/rbt.h b/lib/dns/include/dns/rbt.h index 0a7c0f83ffe..14bdf030609 100644 --- a/lib/dns/include/dns/rbt.h +++ b/lib/dns/include/dns/rbt.h @@ -38,12 +38,6 @@ ISC_LANG_BEGINDECLS #define DNS_RBTFIND_NOPREDECESSOR 0x04 /*@}*/ -#ifndef DNS_RBT_USEISCREFCOUNT -#ifdef ISC_REFCOUNT_HAVEATOMIC -#define DNS_RBT_USEISCREFCOUNT 1 -#endif -#endif - #define DNS_RBT_USEMAGIC 1 /* @@ -160,13 +154,8 @@ struct dns_rbtnode { unsigned int dirty:1; unsigned int wild:1; unsigned int locknum:DNS_RBT_LOCKLENGTH; -#ifndef DNS_RBT_USEISCREFCOUNT - unsigned int references:DNS_RBT_REFLENGTH; -#endif unsigned int :0; /* end of bitfields c/o node lock */ -#ifdef DNS_RBT_USEISCREFCOUNT isc_refcount_t references; /* note that this is not in the bitfield */ -#endif /*@}*/ }; @@ -1055,7 +1044,6 @@ dns_rbtnodechain_nextflat(dns_rbtnodechain_t *chain, dns_name_t *name); * The following macros provide a common interface to these operations, * hiding the back-end. The usage is the same as that of isc_refcount_xxx(). */ -#ifdef DNS_RBT_USEISCREFCOUNT #define dns_rbtnode_refinit(node, n) \ do { \ isc_refcount_init(&(node)->references, (n)); \ @@ -1078,58 +1066,6 @@ dns_rbtnodechain_nextflat(dns_rbtnodechain_t *chain, dns_name_t *name); do { \ isc_refcount_decrement(&(node)->references, (refs)); \ } while (0) -#else /* DNS_RBT_USEISCREFCOUNT */ -#define dns_rbtnode_refinit(node, n) ((node)->references = (n)) -#define dns_rbtnode_refdestroy(node) ISC_REQUIRE((node)->references == 0) -#define dns_rbtnode_refcurrent(node) ((node)->references) - -#if (__STDC_VERSION__ + 0) >= 199901L || defined __GNUC__ -static inline void -dns_rbtnode_refincrement0(dns_rbtnode_t *node, unsigned int *refs) { - node->references++; - if (refs != NULL) - *refs = node->references; -} - -static inline void -dns_rbtnode_refincrement(dns_rbtnode_t *node, unsigned int *refs) { - ISC_REQUIRE(node->references > 0); - node->references++; - if (refs != NULL) - *refs = node->references; -} - -static inline void -dns_rbtnode_refdecrement(dns_rbtnode_t *node, unsigned int *refs) { - ISC_REQUIRE(node->references > 0); - node->references--; - if (refs != NULL) - *refs = node->references; -} -#else -#define dns_rbtnode_refincrement0(node, refs) \ - do { \ - unsigned int *_tmp = (unsigned int *)(refs); \ - (node)->references++; \ - if ((_tmp) != NULL) \ - (*_tmp) = (node)->references; \ - } while (0) -#define dns_rbtnode_refincrement(node, refs) \ - do { \ - ISC_REQUIRE((node)->references > 0); \ - (node)->references++; \ - if ((refs) != NULL) \ - (*refs) = (node)->references; \ - } while (0) -#define dns_rbtnode_refdecrement(node, refs) \ - do { \ - ISC_REQUIRE((node)->references > 0); \ - (node)->references--; \ - if ((refs) != NULL) \ - (*refs) = (node)->references; \ - } while (0) -#endif -#endif /* DNS_RBT_USEISCREFCOUNT */ void dns_rbtnode_nodename(dns_rbtnode_t *node, dns_name_t *name); diff --git a/lib/dns/rbtdb.c b/lib/dns/rbtdb.c index b64350c62df..670f5df9f21 100644 --- a/lib/dns/rbtdb.c +++ b/lib/dns/rbtdb.c @@ -135,31 +135,10 @@ typedef isc_uint32_t rbtdb_rdatatype_t; #define RBTDB_RDATATYPE_NCACHEANY \ RBTDB_RDATATYPE_VALUE(0, dns_rdatatype_any) -/* - * We use rwlock for DB lock only when ISC_RWLOCK_USEATOMIC is non 0. - * Using rwlock is effective with regard to lookup performance only when - * it is implemented in an efficient way. - * Otherwise, it is generally wise to stick to the simple locking since rwlock - * would require more memory or can even make lookups slower due to its own - * overhead (when it internally calls mutex locks). - */ -#ifdef ISC_RWLOCK_USEATOMIC -#define DNS_RBTDB_USERWLOCK 1 -#else -#define DNS_RBTDB_USERWLOCK 0 -#endif - -#if DNS_RBTDB_USERWLOCK #define RBTDB_INITLOCK(l) isc_rwlock_init((l), 0, 0) #define RBTDB_DESTROYLOCK(l) isc_rwlock_destroy(l) #define RBTDB_LOCK(l, t) RWLOCK((l), (t)) #define RBTDB_UNLOCK(l, t) RWUNLOCK((l), (t)) -#else -#define RBTDB_INITLOCK(l) isc_mutex_init(l) -#define RBTDB_DESTROYLOCK(l) DESTROYLOCK(l) -#define RBTDB_LOCK(l, t) LOCK(l) -#define RBTDB_UNLOCK(l, t) UNLOCK(l) -#endif /* * Since node locking is sensitive to both performance and memory footprint, @@ -180,7 +159,6 @@ typedef isc_uint32_t rbtdb_rdatatype_t; * Note that we cannot use NODE_LOCK()/NODE_UNLOCK() wherever the protected * section is also protected by NODE_STRONGLOCK(). */ -#if defined(ISC_RWLOCK_USEATOMIC) && defined(DNS_RBT_USEISCREFCOUNT) typedef isc_rwlock_t nodelock_t; #define NODE_INITLOCK(l) isc_rwlock_init((l), 0, 0) @@ -194,21 +172,6 @@ typedef isc_rwlock_t nodelock_t; #define NODE_WEAKLOCK(l, t) NODE_LOCK(l, t) #define NODE_WEAKUNLOCK(l, t) NODE_UNLOCK(l, t) #define NODE_WEAKDOWNGRADE(l) isc_rwlock_downgrade(l) -#else -typedef isc_mutex_t nodelock_t; - -#define NODE_INITLOCK(l) isc_mutex_init(l) -#define NODE_DESTROYLOCK(l) DESTROYLOCK(l) -#define NODE_LOCK(l, t) LOCK(l) -#define NODE_UNLOCK(l, t) UNLOCK(l) -#define NODE_TRYUPGRADE(l) ISC_R_SUCCESS - -#define NODE_STRONGLOCK(l) LOCK(l) -#define NODE_STRONGUNLOCK(l) UNLOCK(l) -#define NODE_WEAKLOCK(l, t) ((void)0) -#define NODE_WEAKUNLOCK(l, t) ((void)0) -#define NODE_WEAKDOWNGRADE(l) ((void)0) -#endif /*% * Whether to rate-limit updating the LRU to avoid possible thread contention. @@ -467,11 +430,7 @@ struct dns_rbtdb { /* Unlocked. */ dns_db_t common; /* Locks the data in this struct */ -#if DNS_RBTDB_USERWLOCK isc_rwlock_t lock; -#else - isc_mutex_t lock; -#endif /* Locks the tree structure (prevents nodes appearing/disappearing) */ isc_rwlock_t tree_lock; /* Locks for individual tree nodes */ @@ -4479,11 +4438,6 @@ check_stale_header(dns_rbtnode_t *node, rdatasetheader_t *header, isc_rwlocktype_t *locktype, nodelock_t *lock, rbtdb_search_t *search, rdatasetheader_t **header_prev) { - -#if !defined(ISC_RWLOCK_USEATOMIC) || !defined(DNS_RBT_USEISCREFCOUNT) - UNUSED(lock); -#endif - if (!ACTIVE(header, search->now)) { dns_ttl_t stale = header->rdh_ttl + search->rbtdb->serve_stale_ttl; diff --git a/lib/dns/zone.c b/lib/dns/zone.c index 158e6f83c00..a14a4a05897 100644 --- a/lib/dns/zone.c +++ b/lib/dns/zone.c @@ -174,17 +174,10 @@ typedef struct dns_include dns_include_t; do { result = isc_mutex_trylock(&(z)->lock); } while (0) #endif -#ifdef ISC_RWLOCK_USEATOMIC #define ZONEDB_INITLOCK(l) isc_rwlock_init((l), 0, 0) #define ZONEDB_DESTROYLOCK(l) isc_rwlock_destroy(l) #define ZONEDB_LOCK(l, t) RWLOCK((l), (t)) #define ZONEDB_UNLOCK(l, t) RWUNLOCK((l), (t)) -#else -#define ZONEDB_INITLOCK(l) isc_mutex_init(l) -#define ZONEDB_DESTROYLOCK(l) DESTROYLOCK(l) -#define ZONEDB_LOCK(l, t) LOCK(l) -#define ZONEDB_UNLOCK(l, t) UNLOCK(l) -#endif struct dns_zone { /* Unlocked */ @@ -196,11 +189,7 @@ struct dns_zone { isc_mem_t *mctx; isc_refcount_t erefs; -#ifdef ISC_RWLOCK_USEATOMIC isc_rwlock_t dblock; -#else - isc_mutex_t dblock; -#endif dns_db_t *db; /* Locked by dblock */ /* Locked */ diff --git a/lib/isc/Makefile.in b/lib/isc/Makefile.in index 64f5f4c9110..9c1465fe78c 100644 --- a/lib/isc/Makefile.in +++ b/lib/isc/Makefile.in @@ -21,7 +21,6 @@ PROVIDER = @PKCS11_PROVIDER@ CINCLUDES = -I${srcdir}/unix/include \ -I${srcdir}/@ISC_THREAD_DIR@/include \ - -I${srcdir}/@ISC_ARCH_DIR@/include \ -I./include \ -I${srcdir}/include ${DNS_INCLUDES} @ISC_OPENSSL_INC@ CDEFINES = -DPK11_LIB_LOCATION=\"${PROVIDER}\" @@ -81,13 +80,13 @@ SRCS = @ISC_EXTRA_SRCS@ @ISC_PK11_C@ @ISC_PK11_RESULT_C@ \ strtoul.c symtab.c task.c taskpool.c timer.c \ tm.c version.c -LIBS = @ISC_OPENSSL_LIBS@ @LIBS@ +LIBS = @ISC_OPENSSL_LIBS@ @ISC_ATOMIC_LIBS@ @LIBS@ # Note: the order of SUBDIRS is important. # Attempt to disable parallel processing. .NOTPARALLEL: .NO_PARALLEL: -SUBDIRS = include unix nls @ISC_THREAD_DIR@ @ISC_ARCH_DIR@ +SUBDIRS = include unix nls @ISC_THREAD_DIR@ TARGETS = timestamp TESTDIRS = @UNITTESTS@ diff --git a/lib/isc/alpha/Makefile.in b/lib/isc/alpha/Makefile.in deleted file mode 100644 index 419cf9f8755..00000000000 --- a/lib/isc/alpha/Makefile.in +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright (C) Internet Systems Consortium, Inc. ("ISC") -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# See the COPYRIGHT file distributed with this work for additional -# information regarding copyright ownership. - -srcdir = @srcdir@ -VPATH = @srcdir@ -top_srcdir = @top_srcdir@ - -SUBDIRS = include -TARGETS = - -@BIND9_MAKE_RULES@ diff --git a/lib/isc/alpha/include/Makefile.in b/lib/isc/alpha/include/Makefile.in deleted file mode 100644 index d33c0fcb2c9..00000000000 --- a/lib/isc/alpha/include/Makefile.in +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright (C) Internet Systems Consortium, Inc. ("ISC") -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# See the COPYRIGHT file distributed with this work for additional -# information regarding copyright ownership. - -srcdir = @srcdir@ -VPATH = @srcdir@ -top_srcdir = @top_srcdir@ - -SUBDIRS = isc -TARGETS = - -@BIND9_MAKE_RULES@ diff --git a/lib/isc/alpha/include/isc/Makefile.in b/lib/isc/alpha/include/isc/Makefile.in deleted file mode 100644 index 9f87e48935a..00000000000 --- a/lib/isc/alpha/include/isc/Makefile.in +++ /dev/null @@ -1,34 +0,0 @@ -# Copyright (C) Internet Systems Consortium, Inc. ("ISC") -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# See the COPYRIGHT file distributed with this work for additional -# information regarding copyright ownership. - -srcdir = @srcdir@ -VPATH = @srcdir@ -top_srcdir = @top_srcdir@ - -VERSION=@BIND9_VERSION@ - -HEADERS = atomic.h - -SUBDIRS = -TARGETS = - -@BIND9_MAKE_RULES@ - -installdirs: - $(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${includedir}/isc - -install:: installdirs - for i in ${HEADERS}; do \ - ${INSTALL_DATA} $(srcdir)/$$i ${DESTDIR}${includedir}/isc ; \ - done - -uninstall:: - for i in ${HEADERS}; do \ - rm -f ${DESTDIR}${includedir}/isc/$$i ; \ - done diff --git a/lib/isc/alpha/include/isc/atomic.h b/lib/isc/alpha/include/isc/atomic.h deleted file mode 100644 index 8d7c10fad84..00000000000 --- a/lib/isc/alpha/include/isc/atomic.h +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Copyright (C) Internet Systems Consortium, Inc. ("ISC") - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * See the COPYRIGHT file distributed with this work for additional - * information regarding copyright ownership. - */ - - -/* - * This code was written based on FreeBSD's kernel source whose copyright - * follows: - */ - -/*- - * Copyright (c) 1998 Doug Rabson - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD: src/sys/alpha/include/atomic.h,v 1.18.6.1 2004/09/13 21:52:04 wilko Exp $ - */ - -#ifndef ISC_ATOMIC_H -#define ISC_ATOMIC_H 1 - -#include -#include - -#ifdef ISC_PLATFORM_USEOSFASM -#include - -#pragma intrinsic(asm) - -/* - * This routine atomically increments the value stored in 'p' by 'val', and - * returns the previous value. Memory access ordering around this function - * can be critical, so we add explicit memory block instructions at the - * beginning and the end of it (same for other functions). - */ -static inline isc_int32_t -isc_atomic_xadd(isc_int32_t *p, isc_int32_t val) { - return (asm("mb;" - "1:" - "ldl_l %t0, 0(%a0);" /* load old value */ - "mov %t0, %v0;" /* copy the old value */ - "addl %t0, %a1, %t0;" /* calculate new value */ - "stl_c %t0, 0(%a0);" /* attempt to store */ - "beq %t0, 1b;" /* spin if failed */ - "mb;", - p, val)); -} - -/* - * This routine atomically stores the value 'val' in 'p'. - */ -static inline void -isc_atomic_store(isc_int32_t *p, isc_int32_t val) { - (void)asm("mb;" - "1:" - "ldl_l %t0, 0(%a0);" /* load old value */ - "mov %a1, %t0;" /* value to store */ - "stl_c %t0, 0(%a0);" /* attempt to store */ - "beq %t0, 1b;" /* spin if failed */ - "mb;", - p, val); -} - -/* - * This routine atomically replaces the value in 'p' with 'val', if the - * original value is equal to 'cmpval'. The original value is returned in any - * case. - */ -static inline isc_int32_t -isc_atomic_cmpxchg(isc_int32_t *p, isc_int32_t cmpval, isc_int32_t val) { - - return(asm("mb;" - "1:" - "ldl_l %t0, 0(%a0);" /* load old value */ - "mov %t0, %v0;" /* copy the old value */ - "cmpeq %t0, %a1, %t0;" /* compare */ - "beq %t0, 2f;" /* exit if not equal */ - "mov %a2, %t0;" /* value to store */ - "stl_c %t0, 0(%a0);" /* attempt to store */ - "beq %t0, 1b;" /* if it failed, spin */ - "2:" - "mb;", - p, cmpval, val)); -} -#elif defined (ISC_PLATFORM_USEGCCASM) -static inline isc_int32_t -isc_atomic_xadd(isc_int32_t *p, isc_int32_t val) { - isc_int32_t temp, prev; - - __asm__ volatile( - "mb;" - "1:" - "ldl_l %0, %1;" /* load old value */ - "mov %0, %2;" /* copy the old value */ - "addl %0, %3, %0;" /* calculate new value */ - "stl_c %0, %1;" /* attempt to store */ - "beq %0, 1b;" /* spin if failed */ - "mb;" - : "=&r"(temp), "+m"(*p), "=&r"(prev) - : "r"(val) - : "memory"); - - return (prev); -} - -static inline void -isc_atomic_store(isc_int32_t *p, isc_int32_t val) { - isc_int32_t temp; - - __asm__ volatile( - "mb;" - "1:" - "ldl_l %0, %1;" /* load old value */ - "mov %2, %0;" /* value to store */ - "stl_c %0, %1;" /* attempt to store */ - "beq %0, 1b;" /* if it failed, spin */ - "mb;" - : "=&r"(temp), "+m"(*p) - : "r"(val) - : "memory"); -} - -static inline isc_int32_t -isc_atomic_cmpxchg(isc_int32_t *p, isc_int32_t cmpval, isc_int32_t val) { - isc_int32_t temp, prev; - - __asm__ volatile( - "mb;" - "1:" - "ldl_l %0, %1;" /* load old value */ - "mov %0, %2;" /* copy the old value */ - "cmpeq %0, %3, %0;" /* compare */ - "beq %0, 2f;" /* exit if not equal */ - "mov %4, %0;" /* value to store */ - "stl_c %0, %1;" /* attempt to store */ - "beq %0, 1b;" /* if it failed, spin */ - "2:" - "mb;" - : "=&r"(temp), "+m"(*p), "=&r"(prev) - : "r"(cmpval), "r"(val) - : "memory"); - - return (prev); -} -#else - -#error "unsupported compiler. disable atomic ops by --disable-atomic" - -#endif - -#endif /* ISC_ATOMIC_H */ diff --git a/lib/isc/ia64/Makefile.in b/lib/isc/ia64/Makefile.in deleted file mode 100644 index 419cf9f8755..00000000000 --- a/lib/isc/ia64/Makefile.in +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright (C) Internet Systems Consortium, Inc. ("ISC") -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# See the COPYRIGHT file distributed with this work for additional -# information regarding copyright ownership. - -srcdir = @srcdir@ -VPATH = @srcdir@ -top_srcdir = @top_srcdir@ - -SUBDIRS = include -TARGETS = - -@BIND9_MAKE_RULES@ diff --git a/lib/isc/ia64/include/Makefile.in b/lib/isc/ia64/include/Makefile.in deleted file mode 100644 index d33c0fcb2c9..00000000000 --- a/lib/isc/ia64/include/Makefile.in +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright (C) Internet Systems Consortium, Inc. ("ISC") -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# See the COPYRIGHT file distributed with this work for additional -# information regarding copyright ownership. - -srcdir = @srcdir@ -VPATH = @srcdir@ -top_srcdir = @top_srcdir@ - -SUBDIRS = isc -TARGETS = - -@BIND9_MAKE_RULES@ diff --git a/lib/isc/ia64/include/isc/Makefile.in b/lib/isc/ia64/include/isc/Makefile.in deleted file mode 100644 index 9f87e48935a..00000000000 --- a/lib/isc/ia64/include/isc/Makefile.in +++ /dev/null @@ -1,34 +0,0 @@ -# Copyright (C) Internet Systems Consortium, Inc. ("ISC") -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# See the COPYRIGHT file distributed with this work for additional -# information regarding copyright ownership. - -srcdir = @srcdir@ -VPATH = @srcdir@ -top_srcdir = @top_srcdir@ - -VERSION=@BIND9_VERSION@ - -HEADERS = atomic.h - -SUBDIRS = -TARGETS = - -@BIND9_MAKE_RULES@ - -installdirs: - $(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${includedir}/isc - -install:: installdirs - for i in ${HEADERS}; do \ - ${INSTALL_DATA} $(srcdir)/$$i ${DESTDIR}${includedir}/isc ; \ - done - -uninstall:: - for i in ${HEADERS}; do \ - rm -f ${DESTDIR}${includedir}/isc/$$i ; \ - done diff --git a/lib/isc/ia64/include/isc/atomic.h b/lib/isc/ia64/include/isc/atomic.h deleted file mode 100644 index 361e46f0bb5..00000000000 --- a/lib/isc/ia64/include/isc/atomic.h +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (C) Internet Systems Consortium, Inc. ("ISC") - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * See the COPYRIGHT file distributed with this work for additional - * information regarding copyright ownership. - */ - - -#ifndef ISC_ATOMIC_H -#define ISC_ATOMIC_H 1 - -#include -#include - -#ifdef ISC_PLATFORM_USEGCCASM -/* - * This routine atomically increments the value stored in 'p' by 'val', and - * returns the previous value. - * - * Open issue: can 'fetchadd' make the code faster for some particular values - * (e.g., 1 and -1)? - */ -static inline isc_int32_t -#ifdef __GNUC__ -__attribute__ ((unused)) -#endif -isc_atomic_xadd(isc_int32_t *p, isc_int32_t val) -{ - isc_int32_t prev, swapped; - - for (prev = *(volatile isc_int32_t *)p; ; prev = swapped) { - swapped = prev + val; - __asm__ volatile( - "mov ar.ccv=%2;;" - "cmpxchg4.acq %0=%4,%3,ar.ccv" - : "=r" (swapped), "=m" (*p) - : "r" (prev), "r" (swapped), "m" (*p) - : "memory"); - if (swapped == prev) - break; - } - - return (prev); -} - -/* - * This routine atomically stores the value 'val' in 'p'. - */ -static inline void -#ifdef __GNUC__ -__attribute__ ((unused)) -#endif -isc_atomic_store(isc_int32_t *p, isc_int32_t val) -{ - __asm__ volatile( - "st4.rel %0=%1" - : "=m" (*p) - : "r" (val) - : "memory" - ); -} - -/* - * This routine atomically replaces the value in 'p' with 'val', if the - * original value is equal to 'cmpval'. The original value is returned in any - * case. - */ -static inline isc_int32_t -#ifdef __GNUC__ -__attribute__ ((unused)) -#endif -isc_atomic_cmpxchg(isc_int32_t *p, isc_int32_t cmpval, isc_int32_t val) -{ - isc_int32_t ret; - - __asm__ volatile( - "mov ar.ccv=%2;;" - "cmpxchg4.acq %0=%4,%3,ar.ccv" - : "=r" (ret), "=m" (*p) - : "r" (cmpval), "r" (val), "m" (*p) - : "memory"); - - return (ret); -} -#else /* !ISC_PLATFORM_USEGCCASM */ - -#error "unsupported compiler. disable atomic ops by --disable-atomic" - -#endif -#endif /* ISC_ATOMIC_H */ diff --git a/lib/isc/include/isc/platform.h.in b/lib/isc/include/isc/platform.h.in index 9a74ee64d53..815ded850f3 100644 --- a/lib/isc/include/isc/platform.h.in +++ b/lib/isc/include/isc/platform.h.in @@ -271,57 +271,6 @@ */ @ISC_PLATFORM_HAVESYSUNH@ -/* - * If the "xadd" operation is available on this architecture, - * ISC_PLATFORM_HAVEXADD will be defined. - */ -@ISC_PLATFORM_HAVEXADD@ - -/* - * If the "xaddq" operation (64bit xadd) is available on this architecture, - * ISC_PLATFORM_HAVEXADDQ will be defined. - */ -@ISC_PLATFORM_HAVEXADDQ@ - -/* - * If the 32-bit "atomic swap" operation is available on this - * architecture, ISC_PLATFORM_HAVEATOMICSTORE" will be defined. - */ -@ISC_PLATFORM_HAVEATOMICSTORE@ - -/* - * If the 64-bit "atomic swap" operation is available on this - * architecture, ISC_PLATFORM_HAVEATOMICSTORE" will be defined. - */ -@ISC_PLATFORM_HAVEATOMICSTOREQ@ - -/* - * If the "compare-and-exchange" operation is available on this architecture, - * ISC_PLATFORM_HAVECMPXCHG will be defined. - */ -@ISC_PLATFORM_HAVECMPXCHG@ - -/* - * If is available on this architecture, - * ISC_PLATFORM_HAVESTDATOMIC will be defined. - */ -@ISC_PLATFORM_HAVESTDATOMIC@ - -/* - * Define if gcc ASM extension is available - */ -@ISC_PLATFORM_USEGCCASM@ - -/* - * Define if Tru64 style ASM syntax must be used. - */ -@ISC_PLATFORM_USEOSFASM@ - -/* - * Define if the standard __asm function must be used. - */ -@ISC_PLATFORM_USESTDASM@ - /* * Define with the busy wait nop asm or function call. */ @@ -352,12 +301,6 @@ *** Windows dll support. ***/ -/* - * Define if MacOS style of PPC assembly must be used. - * e.g. "r6", not "6", for register six. - */ -@ISC_PLATFORM_USEMACASM@ - #ifndef ISC_PLATFORM_USEDECLSPEC #define LIBISC_EXTERNAL_DATA #define LIBDNS_EXTERNAL_DATA diff --git a/lib/isc/include/isc/refcount.h b/lib/isc/include/isc/refcount.h index 8b77f2e457f..e0df1c82aea 100644 --- a/lib/isc/include/isc/refcount.h +++ b/lib/isc/include/isc/refcount.h @@ -13,18 +13,15 @@ #ifndef ISC_REFCOUNT_H #define ISC_REFCOUNT_H 1 +#include + #include -#include #include #include #include #include #include -#if defined(ISC_PLATFORM_HAVESTDATOMIC) -#include -#endif - /*! \file isc/refcount.h * \brief Implements a locked reference counter. * @@ -93,22 +90,11 @@ ISC_LANG_BEGINDECLS * Sample implementations */ #ifdef ISC_PLATFORM_USETHREADS -#if (defined(ISC_PLATFORM_HAVESTDATOMIC) && defined(ATOMIC_INT_LOCK_FREE)) || defined(ISC_PLATFORM_HAVEXADD) -#define ISC_REFCOUNT_HAVEATOMIC 1 -#if (defined(ISC_PLATFORM_HAVESTDATOMIC) && defined(ATOMIC_INT_LOCK_FREE)) -#define ISC_REFCOUNT_HAVESTDATOMIC 1 -#endif typedef struct isc_refcount { -#if defined(ISC_REFCOUNT_HAVESTDATOMIC) atomic_int_fast32_t refs; -#else - isc_int32_t refs; -#endif } isc_refcount_t; -#if defined(ISC_REFCOUNT_HAVESTDATOMIC) - #define isc_refcount_current(rp) \ ((unsigned int)(atomic_load_explicit(&(rp)->refs, \ memory_order_relaxed))) @@ -146,111 +132,6 @@ typedef struct isc_refcount { *_tmp = prev - 1; \ } while (0) -#else /* ISC_REFCOUNT_HAVESTDATOMIC */ - -#define isc_refcount_current(rp) \ - ((unsigned int)(isc_atomic_xadd(&(rp)->refs, 0))) -#define isc_refcount_destroy(rp) ISC_REQUIRE(isc_refcount_current(rp) == 0) - -#define isc_refcount_increment0(rp, tp) \ - do { \ - unsigned int *_tmp = (unsigned int *)(tp); \ - isc_int32_t prev; \ - prev = isc_atomic_xadd(&(rp)->refs, 1); \ - if (_tmp != NULL) \ - *_tmp = prev + 1; \ - } while (0) - -#define isc_refcount_increment(rp, tp) \ - do { \ - unsigned int *_tmp = (unsigned int *)(tp); \ - isc_int32_t prev; \ - prev = isc_atomic_xadd(&(rp)->refs, 1); \ - ISC_REQUIRE(prev > 0); \ - if (_tmp != NULL) \ - *_tmp = prev + 1; \ - } while (0) - -#define isc_refcount_decrement(rp, tp) \ - do { \ - unsigned int *_tmp = (unsigned int *)(tp); \ - isc_int32_t prev; \ - prev = isc_atomic_xadd(&(rp)->refs, -1); \ - ISC_REQUIRE(prev > 0); \ - if (_tmp != NULL) \ - *_tmp = prev - 1; \ - } while (0) - -#endif /* ISC_REFCOUNT_HAVESTDATOMIC */ - -#else /* ISC_PLATFORM_HAVEXADD */ - -typedef struct isc_refcount { - int refs; - isc_mutex_t lock; -} isc_refcount_t; - -/*% Destroys a reference counter. */ -#define isc_refcount_destroy(rp) \ - do { \ - isc_result_t _result; \ - ISC_REQUIRE((rp)->refs == 0); \ - _result = isc_mutex_destroy(&(rp)->lock); \ - ISC_ERROR_RUNTIMECHECK(_result == ISC_R_SUCCESS); \ - } while (0) - -#define isc_refcount_current(rp) ((unsigned int)((rp)->refs)) - -/*% - * Increments the reference count, returning the new value in - * 'tp' if it's not NULL. - */ -#define isc_refcount_increment0(rp, tp) \ - do { \ - isc_result_t _result; \ - unsigned int *_tmp = (unsigned int *)(tp); \ - _result = isc_mutex_lock(&(rp)->lock); \ - ISC_ERROR_RUNTIMECHECK(_result == ISC_R_SUCCESS); \ - ++((rp)->refs); \ - if (_tmp != NULL) \ - *_tmp = ((rp)->refs); \ - _result = isc_mutex_unlock(&(rp)->lock); \ - ISC_ERROR_RUNTIMECHECK(_result == ISC_R_SUCCESS); \ - } while (0) - -#define isc_refcount_increment(rp, tp) \ - do { \ - isc_result_t _result; \ - unsigned int *_tmp = (unsigned int *)(tp); \ - _result = isc_mutex_lock(&(rp)->lock); \ - ISC_ERROR_RUNTIMECHECK(_result == ISC_R_SUCCESS); \ - ISC_REQUIRE((rp)->refs > 0); \ - ++((rp)->refs); \ - if (_tmp != NULL) \ - *_tmp = ((rp)->refs); \ - _result = isc_mutex_unlock(&(rp)->lock); \ - ISC_ERROR_RUNTIMECHECK(_result == ISC_R_SUCCESS); \ - } while (0) - -/*% - * Decrements the reference count, returning the new value in 'tp' - * if it's not NULL. - */ -#define isc_refcount_decrement(rp, tp) \ - do { \ - isc_result_t _result; \ - unsigned int *_tmp = (unsigned int *)(tp); \ - _result = isc_mutex_lock(&(rp)->lock); \ - ISC_ERROR_RUNTIMECHECK(_result == ISC_R_SUCCESS); \ - ISC_REQUIRE((rp)->refs > 0); \ - --((rp)->refs); \ - if (_tmp != NULL) \ - *_tmp = ((rp)->refs); \ - _result = isc_mutex_unlock(&(rp)->lock); \ - ISC_ERROR_RUNTIMECHECK(_result == ISC_R_SUCCESS); \ - } while (0) - -#endif /* (defined(ISC_PLATFORM_HAVESTDATOMIC) && defined(ATOMIC_INT_LOCK_FREE)) || defined(ISC_PLATFORM_HAVEXADD) */ #else /* ISC_PLATFORM_USETHREADS */ typedef struct isc_refcount { diff --git a/lib/isc/include/isc/rwlock.h b/lib/isc/include/isc/rwlock.h index c47b8d062e8..e00f851cb4d 100644 --- a/lib/isc/include/isc/rwlock.h +++ b/lib/isc/include/isc/rwlock.h @@ -15,15 +15,14 @@ /*! \file isc/rwlock.h */ +#include +#include + #include #include #include #include -#if defined(ISC_PLATFORM_HAVESTDATOMIC) -#include -#include -#endif ISC_LANG_BEGINDECLS @@ -34,12 +33,6 @@ typedef enum { } isc_rwlocktype_t; #ifdef ISC_PLATFORM_USETHREADS -#if (defined(ISC_PLATFORM_HAVESTDATOMIC) && defined(ATOMIC_INT_LOCK_FREE)) || (defined(ISC_PLATFORM_HAVEXADD) && defined(ISC_PLATFORM_HAVECMPXCHG)) -#define ISC_RWLOCK_USEATOMIC 1 -#if (defined(ISC_PLATFORM_HAVESTDATOMIC) && defined(ATOMIC_INT_LOCK_FREE)) -#define ISC_RWLOCK_USESTDATOMIC 1 -#endif -#endif struct isc_rwlock { /* Unlocked. */ @@ -47,7 +40,6 @@ struct isc_rwlock { isc_mutex_t lock; isc_int32_t spins; -#if defined(ISC_RWLOCK_USEATOMIC) /* * When some atomic instructions with hardware assistance are * available, rwlock will use those so that concurrent readers do not @@ -62,15 +54,9 @@ struct isc_rwlock { */ /* Read or modified atomically. */ -#if defined(ISC_RWLOCK_USESTDATOMIC) atomic_int_fast32_t write_requests; atomic_int_fast32_t write_completions; atomic_int_fast32_t cnt_and_flag; -#else - isc_int32_t write_requests; - isc_int32_t write_completions; - isc_int32_t cnt_and_flag; -#endif /* Locked by lock. */ isc_condition_t readable; @@ -82,30 +68,6 @@ struct isc_rwlock { /* Unlocked. */ unsigned int write_quota; - -#else /* ISC_RWLOCK_USEATOMIC */ - - /*%< Locked by lock. */ - isc_condition_t readable; - isc_condition_t writeable; - isc_rwlocktype_t type; - - /*% The number of threads that have the lock. */ - unsigned int active; - - /*% - * The number of lock grants made since the lock was last switched - * from reading to writing or vice versa; used in determining - * when the quota is reached and it is time to switch. - */ - unsigned int granted; - - unsigned int readers_waiting; - unsigned int writers_waiting; - unsigned int read_quota; - unsigned int write_quota; - isc_rwlocktype_t original; -#endif /* ISC_RWLOCK_USEATOMIC */ }; #else /* ISC_PLATFORM_USETHREADS */ struct isc_rwlock { diff --git a/lib/isc/mips/Makefile.in b/lib/isc/mips/Makefile.in deleted file mode 100644 index 419cf9f8755..00000000000 --- a/lib/isc/mips/Makefile.in +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright (C) Internet Systems Consortium, Inc. ("ISC") -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# See the COPYRIGHT file distributed with this work for additional -# information regarding copyright ownership. - -srcdir = @srcdir@ -VPATH = @srcdir@ -top_srcdir = @top_srcdir@ - -SUBDIRS = include -TARGETS = - -@BIND9_MAKE_RULES@ diff --git a/lib/isc/mips/include/Makefile.in b/lib/isc/mips/include/Makefile.in deleted file mode 100644 index d33c0fcb2c9..00000000000 --- a/lib/isc/mips/include/Makefile.in +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright (C) Internet Systems Consortium, Inc. ("ISC") -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# See the COPYRIGHT file distributed with this work for additional -# information regarding copyright ownership. - -srcdir = @srcdir@ -VPATH = @srcdir@ -top_srcdir = @top_srcdir@ - -SUBDIRS = isc -TARGETS = - -@BIND9_MAKE_RULES@ diff --git a/lib/isc/mips/include/isc/Makefile.in b/lib/isc/mips/include/isc/Makefile.in deleted file mode 100644 index 9f87e48935a..00000000000 --- a/lib/isc/mips/include/isc/Makefile.in +++ /dev/null @@ -1,34 +0,0 @@ -# Copyright (C) Internet Systems Consortium, Inc. ("ISC") -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# See the COPYRIGHT file distributed with this work for additional -# information regarding copyright ownership. - -srcdir = @srcdir@ -VPATH = @srcdir@ -top_srcdir = @top_srcdir@ - -VERSION=@BIND9_VERSION@ - -HEADERS = atomic.h - -SUBDIRS = -TARGETS = - -@BIND9_MAKE_RULES@ - -installdirs: - $(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${includedir}/isc - -install:: installdirs - for i in ${HEADERS}; do \ - ${INSTALL_DATA} $(srcdir)/$$i ${DESTDIR}${includedir}/isc ; \ - done - -uninstall:: - for i in ${HEADERS}; do \ - rm -f ${DESTDIR}${includedir}/isc/$$i ; \ - done diff --git a/lib/isc/mips/include/isc/atomic.h b/lib/isc/mips/include/isc/atomic.h deleted file mode 100644 index d8e0c312ad7..00000000000 --- a/lib/isc/mips/include/isc/atomic.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (C) Internet Systems Consortium, Inc. ("ISC") - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * See the COPYRIGHT file distributed with this work for additional - * information regarding copyright ownership. - */ - - -#ifndef ISC_ATOMIC_H -#define ISC_ATOMIC_H 1 - -#include -#include - -#ifdef ISC_PLATFORM_USEGCCASM -/* - * This routine atomically increments the value stored in 'p' by 'val', and - * returns the previous value. - */ -static inline isc_int32_t -isc_atomic_xadd(isc_int32_t *p, int val) { - isc_int32_t orig; - - __asm__ __volatile__ ( - " .set push \n" - " .set mips2 \n" - " .set noreorder \n" - " .set noat \n" - "1: ll $1, %1 \n" - " addu %0, $1, %2 \n" - " sc %0, %1 \n" - " beqz %0, 1b \n" - " move %0, $1 \n" - " .set pop \n" - : "=&r" (orig), "+R" (*p) - : "r" (val) - : "memory"); - - return (orig); -} - -/* - * This routine atomically stores the value 'val' in 'p'. - */ -static inline void -isc_atomic_store(isc_int32_t *p, isc_int32_t val) { - *p = val; -} - -/* - * This routine atomically replaces the value in 'p' with 'val', if the - * original value is equal to 'cmpval'. The original value is returned in any - * case. - */ -static inline isc_int32_t -isc_atomic_cmpxchg(isc_int32_t *p, int cmpval, int val) { - isc_int32_t orig; - isc_int32_t tmp; - - __asm__ __volatile__ ( - " .set push \n" - " .set mips2 \n" - " .set noreorder \n" - " .set noat \n" - "1: ll $1, %1 \n" - " bne $1, %3, 2f \n" - " move %2, %4 \n" - " sc %2, %1 \n" - " beqz %2, 1b \n" - "2: move %0, $1 \n" - " .set pop \n" - : "=&r"(orig), "+R" (*p), "=r" (tmp) - : "r"(cmpval), "r"(val) - : "memory"); - - return (orig); -} - -#else /* !ISC_PLATFORM_USEGCCASM */ - -#error "unsupported compiler. disable atomic ops by --disable-atomic" - -#endif -#endif /* ISC_ATOMIC_H */ diff --git a/lib/isc/noatomic/Makefile.in b/lib/isc/noatomic/Makefile.in deleted file mode 100644 index 419cf9f8755..00000000000 --- a/lib/isc/noatomic/Makefile.in +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright (C) Internet Systems Consortium, Inc. ("ISC") -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# See the COPYRIGHT file distributed with this work for additional -# information regarding copyright ownership. - -srcdir = @srcdir@ -VPATH = @srcdir@ -top_srcdir = @top_srcdir@ - -SUBDIRS = include -TARGETS = - -@BIND9_MAKE_RULES@ diff --git a/lib/isc/noatomic/include/Makefile.in b/lib/isc/noatomic/include/Makefile.in deleted file mode 100644 index d33c0fcb2c9..00000000000 --- a/lib/isc/noatomic/include/Makefile.in +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright (C) Internet Systems Consortium, Inc. ("ISC") -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# See the COPYRIGHT file distributed with this work for additional -# information regarding copyright ownership. - -srcdir = @srcdir@ -VPATH = @srcdir@ -top_srcdir = @top_srcdir@ - -SUBDIRS = isc -TARGETS = - -@BIND9_MAKE_RULES@ diff --git a/lib/isc/noatomic/include/isc/Makefile.in b/lib/isc/noatomic/include/isc/Makefile.in deleted file mode 100644 index 9f87e48935a..00000000000 --- a/lib/isc/noatomic/include/isc/Makefile.in +++ /dev/null @@ -1,34 +0,0 @@ -# Copyright (C) Internet Systems Consortium, Inc. ("ISC") -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# See the COPYRIGHT file distributed with this work for additional -# information regarding copyright ownership. - -srcdir = @srcdir@ -VPATH = @srcdir@ -top_srcdir = @top_srcdir@ - -VERSION=@BIND9_VERSION@ - -HEADERS = atomic.h - -SUBDIRS = -TARGETS = - -@BIND9_MAKE_RULES@ - -installdirs: - $(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${includedir}/isc - -install:: installdirs - for i in ${HEADERS}; do \ - ${INSTALL_DATA} $(srcdir)/$$i ${DESTDIR}${includedir}/isc ; \ - done - -uninstall:: - for i in ${HEADERS}; do \ - rm -f ${DESTDIR}${includedir}/isc/$$i ; \ - done diff --git a/lib/isc/noatomic/include/isc/atomic.h b/lib/isc/noatomic/include/isc/atomic.h deleted file mode 100644 index 5953e4b9524..00000000000 --- a/lib/isc/noatomic/include/isc/atomic.h +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright (C) Internet Systems Consortium, Inc. ("ISC") - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * See the COPYRIGHT file distributed with this work for additional - * information regarding copyright ownership. - */ - - -#ifndef ISC_ATOMIC_H -#define ISC_ATOMIC_H 1 - -/* This file is inherently empty. */ - -#endif /* ISC_ATOMIC_H */ diff --git a/lib/isc/powerpc/Makefile.in b/lib/isc/powerpc/Makefile.in deleted file mode 100644 index 419cf9f8755..00000000000 --- a/lib/isc/powerpc/Makefile.in +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright (C) Internet Systems Consortium, Inc. ("ISC") -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# See the COPYRIGHT file distributed with this work for additional -# information regarding copyright ownership. - -srcdir = @srcdir@ -VPATH = @srcdir@ -top_srcdir = @top_srcdir@ - -SUBDIRS = include -TARGETS = - -@BIND9_MAKE_RULES@ diff --git a/lib/isc/powerpc/include/Makefile.in b/lib/isc/powerpc/include/Makefile.in deleted file mode 100644 index d33c0fcb2c9..00000000000 --- a/lib/isc/powerpc/include/Makefile.in +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright (C) Internet Systems Consortium, Inc. ("ISC") -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# See the COPYRIGHT file distributed with this work for additional -# information regarding copyright ownership. - -srcdir = @srcdir@ -VPATH = @srcdir@ -top_srcdir = @top_srcdir@ - -SUBDIRS = isc -TARGETS = - -@BIND9_MAKE_RULES@ diff --git a/lib/isc/powerpc/include/isc/Makefile.in b/lib/isc/powerpc/include/isc/Makefile.in deleted file mode 100644 index 9f87e48935a..00000000000 --- a/lib/isc/powerpc/include/isc/Makefile.in +++ /dev/null @@ -1,34 +0,0 @@ -# Copyright (C) Internet Systems Consortium, Inc. ("ISC") -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# See the COPYRIGHT file distributed with this work for additional -# information regarding copyright ownership. - -srcdir = @srcdir@ -VPATH = @srcdir@ -top_srcdir = @top_srcdir@ - -VERSION=@BIND9_VERSION@ - -HEADERS = atomic.h - -SUBDIRS = -TARGETS = - -@BIND9_MAKE_RULES@ - -installdirs: - $(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${includedir}/isc - -install:: installdirs - for i in ${HEADERS}; do \ - ${INSTALL_DATA} $(srcdir)/$$i ${DESTDIR}${includedir}/isc ; \ - done - -uninstall:: - for i in ${HEADERS}; do \ - rm -f ${DESTDIR}${includedir}/isc/$$i ; \ - done diff --git a/lib/isc/powerpc/include/isc/atomic.h b/lib/isc/powerpc/include/isc/atomic.h deleted file mode 100644 index 42e509fb2c9..00000000000 --- a/lib/isc/powerpc/include/isc/atomic.h +++ /dev/null @@ -1,191 +0,0 @@ -/* - * Copyright (C) Internet Systems Consortium, Inc. ("ISC") - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * See the COPYRIGHT file distributed with this work for additional - * information regarding copyright ownership. - */ - - -#ifndef ISC_ATOMIC_H -#define ISC_ATOMIC_H 1 - -#include -#include - -/*!\file - * static inline isc_int32_t - * isc_atomic_xadd(isc_int32_t *p, isc_int32_t val); - * - * This routine atomically increments the value stored in 'p' by 'val', and - * returns the previous value. - * - * static inline void - * isc_atomic_store(void *p, isc_int32_t val); - * - * This routine atomically stores the value 'val' in 'p'. - * - * static inline isc_int32_t - * isc_atomic_cmpxchg(isc_int32_t *p, isc_int32_t cmpval, isc_int32_t val); - * - * This routine atomically replaces the value in 'p' with 'val', if the - * original value is equal to 'cmpval'. The original value is returned in any - * case. - */ - -#if defined(_AIX) - -#include - -#define isc_atomic_store(p, v) _clear_lock(p, v) - -#ifdef __GNUC__ -static inline isc_int32_t -#else -static isc_int32_t -#endif -isc_atomic_xadd(isc_int32_t *p, isc_int32_t val) { - int ret; - -#ifdef __GNUC__ - asm("ics"); -#else - __isync(); -#endif - - ret = fetch_and_add((atomic_p)p, (int)val); - -#ifdef __GNUC__ - asm("ics"); -#else - __isync(); -#endif - - return (ret); -} - -#ifdef __GNUC__ -static inline int -#else -static int -#endif -isc_atomic_cmpxchg(atomic_p p, int old, int replacement) { - int orig = old; - -#ifdef __GNUC__ - asm("ics"); -#else - __isync(); -#endif - if (compare_and_swap(p, &orig, replacement)) - orig = old; - -#ifdef __GNUC__ - asm("ics"); -#else - __isync(); -#endif - - return (orig); -} - -#elif defined(ISC_PLATFORM_USEGCCASM) || defined(ISC_PLATFORM_USEMACASM) -static inline isc_int32_t -isc_atomic_xadd(isc_int32_t *p, isc_int32_t val) { - isc_int32_t orig; - - __asm__ volatile ( -#ifdef ISC_PLATFORM_USEMACASM - "1:" - "lwarx r6, 0, %1\n" - "mr %0, r6\n" - "add r6, r6, %2\n" - "stwcx. r6, 0, %1\n" - "bne- 1b\n" - "sync" -#else - "1:" - "lwarx 6, 0, %1\n" - "mr %0, 6\n" - "add 6, 6, %2\n" - "stwcx. 6, 0, %1\n" - "bne- 1b\n" - "sync" -#endif - : "=&r"(orig) - : "r"(p), "r"(val) - : "r6", "memory" - ); - - return (orig); -} - -static inline void -isc_atomic_store(void *p, isc_int32_t val) { - __asm__ volatile ( -#ifdef ISC_PLATFORM_USEMACASM - "1:" - "lwarx r6, 0, %0\n" - "lwz r6, %1\n" - "stwcx. r6, 0, %0\n" - "bne- 1b\n" - "sync" -#else - "1:" - "lwarx 6, 0, %0\n" - "lwz 6, %1\n" - "stwcx. 6, 0, %0\n" - "bne- 1b\n" - "sync" -#endif - : - : "r"(p), "m"(val) - : "r6", "memory" - ); -} - -static inline isc_int32_t -isc_atomic_cmpxchg(isc_int32_t *p, isc_int32_t cmpval, isc_int32_t val) { - isc_int32_t orig; - - __asm__ volatile ( -#ifdef ISC_PLATFORM_USEMACASM - "1:" - "lwarx r6, 0, %1\n" - "mr %0,r6\n" - "cmpw r6, %2\n" - "bne 2f\n" - "mr r6, %3\n" - "stwcx. r6, 0, %1\n" - "bne- 1b\n" - "2:\n" - "sync" -#else - "1:" - "lwarx 6, 0, %1\n" - "mr %0,6\n" - "cmpw 6, %2\n" - "bne 2f\n" - "mr 6, %3\n" - "stwcx. 6, 0, %1\n" - "bne- 1b\n" - "2:\n" - "sync" -#endif - : "=&r" (orig) - : "r"(p), "r"(cmpval), "r"(val) - : "r6", "memory" - ); - - return (orig); -} - -#else - -#error "unsupported compiler. disable atomic ops by --disable-atomic" - -#endif -#endif /* ISC_ATOMIC_H */ diff --git a/lib/isc/refcount.c b/lib/isc/refcount.c index 033af7b4cd8..0adc447e0d1 100644 --- a/lib/isc/refcount.c +++ b/lib/isc/refcount.c @@ -24,9 +24,5 @@ isc_refcount_init(isc_refcount_t *ref, unsigned int n) { REQUIRE(ref != NULL); ref->refs = n; -#if defined(ISC_PLATFORM_USETHREADS) && !defined(ISC_REFCOUNT_HAVEATOMIC) - return (isc_mutex_init(&ref->lock)); -#else return (ISC_R_SUCCESS); -#endif } diff --git a/lib/isc/rwlock.c b/lib/isc/rwlock.c index 8c9455932f3..178ea8d608a 100644 --- a/lib/isc/rwlock.c +++ b/lib/isc/rwlock.c @@ -16,7 +16,6 @@ #include -#include #include #include #include @@ -41,10 +40,8 @@ #define RWLOCK_MAX_ADAPTIVE_COUNT 100 #endif -#if defined(ISC_RWLOCK_USEATOMIC) static isc_result_t isc__rwlock_lock(isc_rwlock_t *rwl, isc_rwlocktype_t type); -#endif #ifdef ISC_RWLOCK_TRACE #include /* Required for fprintf/stderr. */ @@ -52,7 +49,6 @@ isc__rwlock_lock(isc_rwlock_t *rwl, isc_rwlocktype_t type); static void print_lock(const char *operation, isc_rwlock_t *rwl, isc_rwlocktype_t type) { -#if defined(ISC_RWLOCK_USEATOMIC) fprintf(stderr, isc_msgcat_get(isc_msgcat, ISC_MSGSET_RWLOCK, ISC_MSG_PRINTLOCK2, @@ -69,26 +65,6 @@ print_lock(const char *operation, isc_rwlock_t *rwl, isc_rwlocktype_t type) { rwl->write_requests, rwl->write_completions, rwl->cnt_and_flag, rwl->readers_waiting, rwl->write_granted, rwl->write_quota); -#else - fprintf(stderr, - isc_msgcat_get(isc_msgcat, ISC_MSGSET_RWLOCK, - ISC_MSG_PRINTLOCK, - "rwlock %p thread %lu %s(%s): %s, %u active, " - "%u granted, %u rwaiting, %u wwaiting\n"), - rwl, isc_thread_self(), operation, - (type == isc_rwlocktype_read ? - isc_msgcat_get(isc_msgcat, ISC_MSGSET_RWLOCK, - ISC_MSG_READ, "read") : - isc_msgcat_get(isc_msgcat, ISC_MSGSET_RWLOCK, - ISC_MSG_WRITE, "write")), - (rwl->type == isc_rwlocktype_read ? - isc_msgcat_get(isc_msgcat, ISC_MSGSET_RWLOCK, - ISC_MSG_READING, "reading") : - isc_msgcat_get(isc_msgcat, ISC_MSGSET_RWLOCK, - ISC_MSG_WRITING, "writing")), - rwl->active, rwl->granted, - rwl->readers_waiting, rwl->writers_waiting); -#endif } #endif /* ISC_RWLOCK_TRACE */ @@ -107,7 +83,6 @@ isc_rwlock_init(isc_rwlock_t *rwl, unsigned int read_quota, rwl->magic = 0; rwl->spins = 0; -#if defined(ISC_RWLOCK_USEATOMIC) rwl->write_requests = 0; rwl->write_completions = 0; rwl->cnt_and_flag = 0; @@ -120,20 +95,6 @@ isc_rwlock_init(isc_rwlock_t *rwl, unsigned int read_quota, if (write_quota == 0) write_quota = RWLOCK_DEFAULT_WRITE_QUOTA; rwl->write_quota = write_quota; -#else - rwl->type = isc_rwlocktype_read; - rwl->original = isc_rwlocktype_none; - rwl->active = 0; - rwl->granted = 0; - rwl->readers_waiting = 0; - rwl->writers_waiting = 0; - if (read_quota == 0) - read_quota = RWLOCK_DEFAULT_READ_QUOTA; - rwl->read_quota = read_quota; - if (write_quota == 0) - write_quota = RWLOCK_DEFAULT_WRITE_QUOTA; - rwl->write_quota = write_quota; -#endif result = isc_mutex_init(&rwl->lock); if (result != ISC_R_SUCCESS) @@ -176,16 +137,8 @@ void isc_rwlock_destroy(isc_rwlock_t *rwl) { REQUIRE(VALID_RWLOCK(rwl)); -#if defined(ISC_RWLOCK_USEATOMIC) REQUIRE(rwl->write_requests == rwl->write_completions && rwl->cnt_and_flag == 0 && rwl->readers_waiting == 0); -#else - LOCK(&rwl->lock); - REQUIRE(rwl->active == 0 && - rwl->readers_waiting == 0 && - rwl->writers_waiting == 0); - UNLOCK(&rwl->lock); -#endif rwl->magic = 0; (void)isc_condition_destroy(&rwl->readable); @@ -193,8 +146,6 @@ isc_rwlock_destroy(isc_rwlock_t *rwl) { DESTROYLOCK(&rwl->lock); } -#if defined(ISC_RWLOCK_USEATOMIC) - /* * When some architecture-dependent atomic operations are available, * rwlock can be more efficient than the generic algorithm defined below. @@ -283,13 +234,9 @@ isc__rwlock_lock(isc_rwlock_t *rwl, isc_rwlocktype_t type) { UNLOCK(&rwl->lock); } -#if defined(ISC_RWLOCK_USESTDATOMIC) cntflag = atomic_fetch_add_explicit(&rwl->cnt_and_flag, READER_INCR, memory_order_relaxed); -#else - cntflag = isc_atomic_xadd(&rwl->cnt_and_flag, READER_INCR); -#endif POST(cntflag); while (1) { if ((rwl->cnt_and_flag & WRITER_ACTIVE) == 0) @@ -339,12 +286,8 @@ isc__rwlock_lock(isc_rwlock_t *rwl, isc_rwlocktype_t type) { isc_int32_t prev_writer; /* enter the waiting queue, and wait for our turn */ -#if defined(ISC_RWLOCK_USESTDATOMIC) prev_writer = atomic_fetch_add_explicit(&rwl->write_requests, 1, memory_order_relaxed); -#else - prev_writer = isc_atomic_xadd(&rwl->write_requests, 1); -#endif while (rwl->write_completions != prev_writer) { LOCK(&rwl->lock); if (rwl->write_completions != prev_writer) { @@ -357,16 +300,10 @@ isc__rwlock_lock(isc_rwlock_t *rwl, isc_rwlocktype_t type) { } while (1) { -#if defined(ISC_RWLOCK_USESTDATOMIC) int_fast32_t cntflag2 = 0; atomic_compare_exchange_strong_explicit (&rwl->cnt_and_flag, &cntflag2, WRITER_ACTIVE, memory_order_relaxed, memory_order_relaxed); -#else - isc_int32_t cntflag2; - cntflag2 = isc_atomic_cmpxchg(&rwl->cnt_and_flag, 0, - WRITER_ACTIVE); -#endif if (cntflag2 == 0) break; @@ -431,26 +368,17 @@ isc_rwlock_trylock(isc_rwlock_t *rwl, isc_rwlocktype_t type) { return (ISC_R_LOCKBUSY); /* Otherwise, be ready for reading. */ -#if defined(ISC_RWLOCK_USESTDATOMIC) cntflag = atomic_fetch_add_explicit(&rwl->cnt_and_flag, READER_INCR, memory_order_relaxed); -#else - cntflag = isc_atomic_xadd(&rwl->cnt_and_flag, READER_INCR); -#endif if ((cntflag & WRITER_ACTIVE) != 0) { /* * A writer is working. We lose, and cancel the read * request. */ -#if defined(ISC_RWLOCK_USESTDATOMIC) cntflag = atomic_fetch_sub_explicit (&rwl->cnt_and_flag, READER_INCR, memory_order_relaxed); -#else - cntflag = isc_atomic_xadd(&rwl->cnt_and_flag, - -READER_INCR); -#endif /* * If no other readers are waiting and we've suspended * new writers in this short period, wake them up. @@ -466,29 +394,18 @@ isc_rwlock_trylock(isc_rwlock_t *rwl, isc_rwlocktype_t type) { } } else { /* Try locking without entering the waiting queue. */ -#if defined(ISC_RWLOCK_USESTDATOMIC) int_fast32_t zero = 0; if (!atomic_compare_exchange_strong_explicit (&rwl->cnt_and_flag, &zero, WRITER_ACTIVE, memory_order_relaxed, memory_order_relaxed)) return (ISC_R_LOCKBUSY); -#else - cntflag = isc_atomic_cmpxchg(&rwl->cnt_and_flag, 0, - WRITER_ACTIVE); - if (cntflag != 0) - return (ISC_R_LOCKBUSY); -#endif /* * XXXJT: jump into the queue, possibly breaking the writer * order. */ -#if defined(ISC_RWLOCK_USESTDATOMIC) atomic_fetch_sub_explicit(&rwl->write_completions, 1, memory_order_relaxed); -#else - (void)isc_atomic_xadd(&rwl->write_completions, -1); -#endif rwl->write_granted++; } @@ -505,7 +422,6 @@ isc_result_t isc_rwlock_tryupgrade(isc_rwlock_t *rwl) { REQUIRE(VALID_RWLOCK(rwl)); -#if defined(ISC_RWLOCK_USESTDATOMIC) { int_fast32_t reader_incr = READER_INCR; @@ -531,30 +447,6 @@ isc_rwlock_tryupgrade(isc_rwlock_t *rwl) { return (ISC_R_LOCKBUSY); } -#else - { - isc_int32_t prevcnt; - - /* Try to acquire write access. */ - prevcnt = isc_atomic_cmpxchg(&rwl->cnt_and_flag, - READER_INCR, WRITER_ACTIVE); - /* - * There must have been no writer, and there must have - * been at least one reader. - */ - INSIST((prevcnt & WRITER_ACTIVE) == 0 && - (prevcnt & ~WRITER_ACTIVE) != 0); - - if (prevcnt == READER_INCR) { - /* - * We are the only reader and have been upgraded. - * Now jump into the head of the writer waiting queue. - */ - (void)isc_atomic_xadd(&rwl->write_completions, -1); - } else - return (ISC_R_LOCKBUSY); - } -#endif return (ISC_R_SUCCESS); } @@ -565,7 +457,6 @@ isc_rwlock_downgrade(isc_rwlock_t *rwl) { REQUIRE(VALID_RWLOCK(rwl)); -#if defined(ISC_RWLOCK_USESTDATOMIC) { /* Become an active reader. */ prev_readers = atomic_fetch_add_explicit(&rwl->cnt_and_flag, @@ -580,18 +471,6 @@ isc_rwlock_downgrade(isc_rwlock_t *rwl) { atomic_fetch_add_explicit(&rwl->write_completions, 1, memory_order_relaxed); } -#else - { - /* Become an active reader. */ - prev_readers = isc_atomic_xadd(&rwl->cnt_and_flag, READER_INCR); - /* We must have been a writer. */ - INSIST((prev_readers & WRITER_ACTIVE) != 0); - - /* Complete write */ - (void)isc_atomic_xadd(&rwl->cnt_and_flag, -WRITER_ACTIVE); - (void)isc_atomic_xadd(&rwl->write_completions, 1); - } -#endif /* Resume other readers */ LOCK(&rwl->lock); @@ -612,13 +491,9 @@ isc_rwlock_unlock(isc_rwlock_t *rwl, isc_rwlocktype_t type) { #endif if (type == isc_rwlocktype_read) { -#if defined(ISC_RWLOCK_USESTDATOMIC) prev_cnt = atomic_fetch_sub_explicit(&rwl->cnt_and_flag, READER_INCR, memory_order_relaxed); -#else - prev_cnt = isc_atomic_xadd(&rwl->cnt_and_flag, -READER_INCR); -#endif /* * If we're the last reader and any writers are waiting, wake * them up. We need to wake up all of them to ensure the @@ -637,15 +512,10 @@ isc_rwlock_unlock(isc_rwlock_t *rwl, isc_rwlocktype_t type) { * Reset the flag, and (implicitly) tell other writers * we are done. */ -#if defined(ISC_RWLOCK_USESTDATOMIC) atomic_fetch_sub_explicit(&rwl->cnt_and_flag, WRITER_ACTIVE, memory_order_relaxed); atomic_fetch_add_explicit(&rwl->write_completions, 1, memory_order_relaxed); -#else - (void)isc_atomic_xadd(&rwl->cnt_and_flag, -WRITER_ACTIVE); - (void)isc_atomic_xadd(&rwl->write_completions, 1); -#endif if (rwl->write_granted >= rwl->write_quota || rwl->write_requests == rwl->write_completions || @@ -683,213 +553,6 @@ isc_rwlock_unlock(isc_rwlock_t *rwl, isc_rwlocktype_t type) { return (ISC_R_SUCCESS); } -#else /* ISC_RWLOCK_USEATOMIC */ - -static isc_result_t -doit(isc_rwlock_t *rwl, isc_rwlocktype_t type, isc_boolean_t nonblock) { - isc_boolean_t skip = ISC_FALSE; - isc_boolean_t done = ISC_FALSE; - isc_result_t result = ISC_R_SUCCESS; - - REQUIRE(VALID_RWLOCK(rwl)); - - LOCK(&rwl->lock); - -#ifdef ISC_RWLOCK_TRACE - print_lock(isc_msgcat_get(isc_msgcat, ISC_MSGSET_RWLOCK, - ISC_MSG_PRELOCK, "prelock"), rwl, type); -#endif - - if (type == isc_rwlocktype_read) { - if (rwl->readers_waiting != 0) - skip = ISC_TRUE; - while (!done) { - if (!skip && - ((rwl->active == 0 || - (rwl->type == isc_rwlocktype_read && - (rwl->writers_waiting == 0 || - rwl->granted < rwl->read_quota))))) - { - rwl->type = isc_rwlocktype_read; - rwl->active++; - rwl->granted++; - done = ISC_TRUE; - } else if (nonblock) { - result = ISC_R_LOCKBUSY; - done = ISC_TRUE; - } else { - skip = ISC_FALSE; - rwl->readers_waiting++; - WAIT(&rwl->readable, &rwl->lock); - rwl->readers_waiting--; - } - } - } else { - if (rwl->writers_waiting != 0) - skip = ISC_TRUE; - while (!done) { - if (!skip && rwl->active == 0) { - rwl->type = isc_rwlocktype_write; - rwl->active = 1; - rwl->granted++; - done = ISC_TRUE; - } else if (nonblock) { - result = ISC_R_LOCKBUSY; - done = ISC_TRUE; - } else { - skip = ISC_FALSE; - rwl->writers_waiting++; - WAIT(&rwl->writeable, &rwl->lock); - rwl->writers_waiting--; - } - } - } - -#ifdef ISC_RWLOCK_TRACE - print_lock(isc_msgcat_get(isc_msgcat, ISC_MSGSET_RWLOCK, - ISC_MSG_POSTLOCK, "postlock"), rwl, type); -#endif - - UNLOCK(&rwl->lock); - - return (result); -} - -isc_result_t -isc_rwlock_lock(isc_rwlock_t *rwl, isc_rwlocktype_t type) { - isc_int32_t cnt = 0; - isc_int32_t max_cnt = rwl->spins * 2 + 10; - isc_result_t result = ISC_R_SUCCESS; - - if (max_cnt > RWLOCK_MAX_ADAPTIVE_COUNT) - max_cnt = RWLOCK_MAX_ADAPTIVE_COUNT; - - do { - if (cnt++ >= max_cnt) { - result = doit(rwl, type, ISC_FALSE); - break; - } -#ifdef ISC_PLATFORM_BUSYWAITNOP - ISC_PLATFORM_BUSYWAITNOP; -#endif - } while (doit(rwl, type, ISC_TRUE) != ISC_R_SUCCESS); - - rwl->spins += (cnt - rwl->spins) / 8; - - return (result); -} - -isc_result_t -isc_rwlock_trylock(isc_rwlock_t *rwl, isc_rwlocktype_t type) { - return (doit(rwl, type, ISC_TRUE)); -} - -isc_result_t -isc_rwlock_tryupgrade(isc_rwlock_t *rwl) { - isc_result_t result = ISC_R_SUCCESS; - - REQUIRE(VALID_RWLOCK(rwl)); - LOCK(&rwl->lock); - REQUIRE(rwl->type == isc_rwlocktype_read); - REQUIRE(rwl->active != 0); - - /* If we are the only reader then succeed. */ - if (rwl->active == 1) { - rwl->original = (rwl->original == isc_rwlocktype_none) ? - isc_rwlocktype_read : isc_rwlocktype_none; - rwl->type = isc_rwlocktype_write; - } else - result = ISC_R_LOCKBUSY; - - UNLOCK(&rwl->lock); - return (result); -} - -void -isc_rwlock_downgrade(isc_rwlock_t *rwl) { - - REQUIRE(VALID_RWLOCK(rwl)); - LOCK(&rwl->lock); - REQUIRE(rwl->type == isc_rwlocktype_write); - REQUIRE(rwl->active == 1); - - rwl->type = isc_rwlocktype_read; - rwl->original = (rwl->original == isc_rwlocktype_none) ? - isc_rwlocktype_write : isc_rwlocktype_none; - /* - * Resume processing any read request that were blocked when - * we upgraded. - */ - if (rwl->original == isc_rwlocktype_none && - (rwl->writers_waiting == 0 || rwl->granted < rwl->read_quota) && - rwl->readers_waiting > 0) - BROADCAST(&rwl->readable); - - UNLOCK(&rwl->lock); -} - -isc_result_t -isc_rwlock_unlock(isc_rwlock_t *rwl, isc_rwlocktype_t type) { - - REQUIRE(VALID_RWLOCK(rwl)); - LOCK(&rwl->lock); - REQUIRE(rwl->type == type); - - UNUSED(type); - -#ifdef ISC_RWLOCK_TRACE - print_lock(isc_msgcat_get(isc_msgcat, ISC_MSGSET_RWLOCK, - ISC_MSG_PREUNLOCK, "preunlock"), rwl, type); -#endif - - INSIST(rwl->active > 0); - rwl->active--; - if (rwl->active == 0) { - if (rwl->original != isc_rwlocktype_none) { - rwl->type = rwl->original; - rwl->original = isc_rwlocktype_none; - } - if (rwl->type == isc_rwlocktype_read) { - rwl->granted = 0; - if (rwl->writers_waiting > 0) { - rwl->type = isc_rwlocktype_write; - SIGNAL(&rwl->writeable); - } else if (rwl->readers_waiting > 0) { - /* Does this case ever happen? */ - BROADCAST(&rwl->readable); - } - } else { - if (rwl->readers_waiting > 0) { - if (rwl->writers_waiting > 0 && - rwl->granted < rwl->write_quota) { - SIGNAL(&rwl->writeable); - } else { - rwl->granted = 0; - rwl->type = isc_rwlocktype_read; - BROADCAST(&rwl->readable); - } - } else if (rwl->writers_waiting > 0) { - rwl->granted = 0; - SIGNAL(&rwl->writeable); - } else { - rwl->granted = 0; - } - } - } - INSIST(rwl->original == isc_rwlocktype_none); - -#ifdef ISC_RWLOCK_TRACE - print_lock(isc_msgcat_get(isc_msgcat, ISC_MSGSET_RWLOCK, - ISC_MSG_POSTUNLOCK, "postunlock"), - rwl, type); -#endif - - UNLOCK(&rwl->lock); - - return (ISC_R_SUCCESS); -} - -#endif /* ISC_RWLOCK_USEATOMIC */ #else /* ISC_PLATFORM_USETHREADS */ isc_result_t diff --git a/lib/isc/sparc64/Makefile.in b/lib/isc/sparc64/Makefile.in deleted file mode 100644 index 419cf9f8755..00000000000 --- a/lib/isc/sparc64/Makefile.in +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright (C) Internet Systems Consortium, Inc. ("ISC") -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# See the COPYRIGHT file distributed with this work for additional -# information regarding copyright ownership. - -srcdir = @srcdir@ -VPATH = @srcdir@ -top_srcdir = @top_srcdir@ - -SUBDIRS = include -TARGETS = - -@BIND9_MAKE_RULES@ diff --git a/lib/isc/sparc64/include/Makefile.in b/lib/isc/sparc64/include/Makefile.in deleted file mode 100644 index d33c0fcb2c9..00000000000 --- a/lib/isc/sparc64/include/Makefile.in +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright (C) Internet Systems Consortium, Inc. ("ISC") -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# See the COPYRIGHT file distributed with this work for additional -# information regarding copyright ownership. - -srcdir = @srcdir@ -VPATH = @srcdir@ -top_srcdir = @top_srcdir@ - -SUBDIRS = isc -TARGETS = - -@BIND9_MAKE_RULES@ diff --git a/lib/isc/sparc64/include/isc/Makefile.in b/lib/isc/sparc64/include/isc/Makefile.in deleted file mode 100644 index 11e93a42bce..00000000000 --- a/lib/isc/sparc64/include/isc/Makefile.in +++ /dev/null @@ -1,29 +0,0 @@ -# Copyright (C) Internet Systems Consortium, Inc. ("ISC") -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# See the COPYRIGHT file distributed with this work for additional -# information regarding copyright ownership. - -srcdir = @srcdir@ -VPATH = @srcdir@ -top_srcdir = @top_srcdir@ - -VERSION=@BIND9_VERSION@ - -HEADERS = atomic.h - -SUBDIRS = -TARGETS = - -@BIND9_MAKE_RULES@ - -installdirs: - $(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${includedir}/isc - -install:: installdirs - for i in ${HEADERS}; do \ - ${INSTALL_DATA} $(srcdir)/$$i ${DESTDIR}${includedir}/isc ; \ - done diff --git a/lib/isc/sparc64/include/isc/atomic.h b/lib/isc/sparc64/include/isc/atomic.h deleted file mode 100644 index fd5cf1da5ae..00000000000 --- a/lib/isc/sparc64/include/isc/atomic.h +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright (C) Internet Systems Consortium, Inc. ("ISC") - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * See the COPYRIGHT file distributed with this work for additional - * information regarding copyright ownership. - */ - - -/* - * This code was written based on FreeBSD's kernel source whose copyright - * follows: - */ - -/*- - * Copyright (c) 1998 Doug Rabson. - * Copyright (c) 2001 Jake Burkholder. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: FreeBSD: src/sys/i386/include/atomic.h,v 1.20 2001/02/11 - * $FreeBSD: src/sys/sparc64/include/atomic.h,v 1.8 2004/05/22 00:52:16 marius Exp $ - */ - -#ifndef ISC_ATOMIC_H -#define ISC_ATOMIC_H 1 - -#include -#include - -#define ASI_P 0x80 /* Primary Address Space Identifier */ - -#ifdef ISC_PLATFORM_USEGCCASM - -/* - * This routine atomically increments the value stored in 'p' by 'val', and - * returns the previous value. - */ -static inline isc_int32_t -isc_atomic_xadd(isc_int32_t *p, isc_int32_t val) { - isc_int32_t prev, swapped; - - for (prev = *(volatile isc_int32_t *)p; ; prev = swapped) { - swapped = prev + val; - __asm__ volatile( - "casa [%2] %3, %4, %0" - : "+r"(swapped), "=m"(*p) - : "r"(p), "n"(ASI_P), "r"(prev), "m"(*p)); - if (swapped == prev) - break; - } - - return (prev); -} - -/* - * This routine atomically stores the value 'val' in 'p'. - */ -static inline void -isc_atomic_store(isc_int32_t *p, isc_int32_t val) { - isc_int32_t prev, swapped; - - for (prev = *(volatile isc_int32_t *)p; ; prev = swapped) { - swapped = val; - __asm__ volatile( - "casa [%2] %3, %4, %0" - : "+r"(swapped), "=m"(*p) - : "r"(p), "n"(ASI_P), "r"(prev), "m"(*p)); - if (swapped == prev) - break; - } -} - -/* - * This routine atomically replaces the value in 'p' with 'val', if the - * original value is equal to 'cmpval'. The original value is returned in any - * case. - */ -static inline isc_int32_t -isc_atomic_cmpxchg(isc_int32_t *p, isc_int32_t cmpval, isc_int32_t val) { - isc_int32_t temp = val; - - __asm__ volatile( - "casa [%2] %3, %4, %0" - : "+r"(temp), "=m"(*p) - : "r"(p), "n"(ASI_P), "r"(cmpval), "m"(*p)); - - return (temp); -} - -#else /* ISC_PLATFORM_USEGCCASM */ - -#error "unsupported compiler. disable atomic ops by --disable-atomic" - -#endif /* ISC_PLATFORM_USEGCCASM */ - -#endif /* ISC_ATOMIC_H */ diff --git a/lib/isc/stats.c b/lib/isc/stats.c index 5de077943c9..4f89e0c0f8a 100644 --- a/lib/isc/stats.c +++ b/lib/isc/stats.c @@ -15,8 +15,8 @@ #include #include +#include -#include #include #include #include @@ -26,77 +26,10 @@ #include #include -#if defined(ISC_PLATFORM_HAVESTDATOMIC) -#include -#endif - #define ISC_STATS_MAGIC ISC_MAGIC('S', 't', 'a', 't') #define ISC_STATS_VALID(x) ISC_MAGIC_VALID(x, ISC_STATS_MAGIC) -/*% - * Local macro confirming prescence of 64-bit - * increment and store operations, just to make - * the later macros simpler - */ -#if (defined(ISC_PLATFORM_HAVESTDATOMIC) && defined(ATOMIC_LONG_LOCK_FREE)) || \ - (defined(ISC_PLATFORM_HAVEXADDQ) && defined(ISC_PLATFORM_HAVEATOMICSTOREQ)) -#define ISC_STATS_HAVEATOMICQ 1 -#if (defined(ISC_PLATFORM_HAVESTDATOMIC) && defined(ATOMIC_LONG_LOCK_FREE)) -#define ISC_STATS_HAVESTDATOMICQ 1 -#endif -#else -#define ISC_STATS_HAVEATOMICQ 0 -#endif - -/*% - * Only lock the counters if 64-bit atomic operations are - * not available but cheap atomic lock operations are. - * On a modern 64-bit system this should never be the case. - * - * Normal locks are too expensive to be used whenever a counter - * is updated. - */ -#if !ISC_STATS_HAVEATOMICQ && defined(ISC_RWLOCK_HAVEATOMIC) -#define ISC_STATS_LOCKCOUNTERS 1 -#else -#define ISC_STATS_LOCKCOUNTERS 0 -#endif - -/*% - * If 64-bit atomic operations are not available but - * 32-bit operations are then split the counter into two, - * using the atomic operations to try to ensure that any carry - * from the low word is correctly carried into the high word. - * - * Otherwise, just rely on standard 64-bit data types - * and operations - */ -#if !ISC_STATS_HAVEATOMICQ && ((defined(ISC_PLATFORM_HAVESTDATOMIC) && defined(ATOMIC_INT_LOCK_FREE)) || defined(ISC_PLATFORM_HAVEXADD)) -#define ISC_STATS_USEMULTIFIELDS 1 -#if (defined(ISC_PLATFORM_HAVESTDATOMIC) && defined(ATOMIC_INT_LOCK_FREE)) -#define ISC_STATS_HAVESTDATOMIC 1 -#endif -#else -#define ISC_STATS_USEMULTIFIELDS 0 -#endif - -#if ISC_STATS_USEMULTIFIELDS -typedef struct { -#if defined(ISC_STATS_HAVESTDATOMIC) - atomic_int_fast32_t hi; - atomic_int_fast32_t lo; -#else - isc_uint32_t hi; - isc_uint32_t lo; -#endif -} isc_stat_t; -#else -#if defined(ISC_STATS_HAVESTDATOMICQ) typedef atomic_int_fast64_t isc_stat_t; -#else -typedef isc_uint64_t isc_stat_t; -#endif -#endif struct isc_stats { /*% Unlocked */ @@ -111,9 +44,6 @@ struct isc_stats { * Locked by counterlock or unlocked if efficient rwlock is not * available. */ -#if ISC_STATS_LOCKCOUNTERS - isc_rwlock_t counterlock; -#endif isc_stat_t *counters; /*% @@ -157,12 +87,6 @@ create_stats(isc_mem_t *mctx, int ncounters, isc_stats_t **statsp) { goto clean_counters; } -#if ISC_STATS_LOCKCOUNTERS - result = isc_rwlock_init(&stats->counterlock, 0, 0); - if (result != ISC_R_SUCCESS) - goto clean_copiedcounters; -#endif - stats->references = 1; memset(stats->counters, 0, sizeof(isc_stat_t) * ncounters); stats->mctx = NULL; @@ -177,12 +101,6 @@ create_stats(isc_mem_t *mctx, int ncounters, isc_stats_t **statsp) { clean_counters: isc_mem_put(mctx, stats->counters, sizeof(isc_stat_t) * ncounters); -#if ISC_STATS_LOCKCOUNTERS -clean_copiedcounters: - isc_mem_put(mctx, stats->copiedcounters, - sizeof(isc_stat_t) * ncounters); -#endif - clean_mutex: DESTROYLOCK(&stats->lock); @@ -223,9 +141,6 @@ isc_stats_detach(isc_stats_t **statsp) { sizeof(isc_stat_t) * stats->ncounters); UNLOCK(&stats->lock); DESTROYLOCK(&stats->lock); -#if ISC_STATS_LOCKCOUNTERS - isc_rwlock_destroy(&stats->counterlock); -#endif isc_mem_putanddetach(&stats->mctx, stats, sizeof(*stats)); return; } @@ -242,135 +157,25 @@ isc_stats_ncounters(isc_stats_t *stats) { static inline void incrementcounter(isc_stats_t *stats, int counter) { - isc_int32_t prev; - -#if ISC_STATS_LOCKCOUNTERS - /* - * We use a "read" lock to prevent other threads from reading the - * counter while we "writing" a counter field. The write access itself - * is protected by the atomic operation. - */ - isc_rwlock_lock(&stats->counterlock, isc_rwlocktype_read); -#endif - -#if ISC_STATS_USEMULTIFIELDS -#if defined(ISC_STATS_HAVESTDATOMIC) - prev = atomic_fetch_add_explicit(&stats->counters[counter].lo, 1, - memory_order_relaxed); -#else - prev = isc_atomic_xadd((isc_int32_t *)&stats->counters[counter].lo, 1); -#endif - /* - * If the lower 32-bit field overflows, increment the higher field. - * Note that it's *theoretically* possible that the lower field - * overlaps again before the higher field is incremented. It doesn't - * matter, however, because we don't read the value until - * isc_stats_copy() is called where the whole process is protected - * by the write (exclusive) lock. - */ - if (prev == (isc_int32_t)0xffffffff) { -#if defined(ISC_STATS_HAVESTDATOMIC) - atomic_fetch_add_explicit(&stats->counters[counter].hi, 1, - memory_order_relaxed); -#else - isc_atomic_xadd((isc_int32_t *)&stats->counters[counter].hi, 1); -#endif - } -#elif ISC_STATS_HAVEATOMICQ - UNUSED(prev); -#if defined(ISC_STATS_HAVESTDATOMICQ) atomic_fetch_add_explicit(&stats->counters[counter], 1, memory_order_relaxed); -#else - isc_atomic_xaddq((isc_int64_t *)&stats->counters[counter], 1); -#endif -#else - UNUSED(prev); - stats->counters[counter]++; -#endif - -#if ISC_STATS_LOCKCOUNTERS - isc_rwlock_unlock(&stats->counterlock, isc_rwlocktype_read); -#endif } static inline void decrementcounter(isc_stats_t *stats, int counter) { - isc_int32_t prev; - -#if ISC_STATS_LOCKCOUNTERS - isc_rwlock_lock(&stats->counterlock, isc_rwlocktype_read); -#endif - -#if ISC_STATS_USEMULTIFIELDS -#if defined(ISC_STATS_HAVESTDATOMIC) - prev = atomic_fetch_sub_explicit(&stats->counters[counter].lo, 1, - memory_order_relaxed); -#else - prev = isc_atomic_xadd((isc_int32_t *)&stats->counters[counter].lo, -1); -#endif - if (prev == 0) { -#if defined(ISC_STATS_HAVESTDATOMIC) - atomic_fetch_sub_explicit(&stats->counters[counter].hi, 1, - memory_order_relaxed); -#else - isc_atomic_xadd((isc_int32_t *)&stats->counters[counter].hi, - -1); -#endif - } -#elif ISC_STATS_HAVEATOMICQ - UNUSED(prev); -#if defined(ISC_STATS_HAVESTDATOMICQ) atomic_fetch_sub_explicit(&stats->counters[counter], 1, memory_order_relaxed); -#else - isc_atomic_xaddq((isc_int64_t *)&stats->counters[counter], -1); -#endif -#else - UNUSED(prev); - stats->counters[counter]--; -#endif - -#if ISC_STATS_LOCKCOUNTERS - isc_rwlock_unlock(&stats->counterlock, isc_rwlocktype_read); -#endif } static void copy_counters(isc_stats_t *stats) { int i; -#if ISC_STATS_LOCKCOUNTERS - /* - * We use a "write" lock before "reading" the statistics counters as - * an exclusive lock. - */ - isc_rwlock_lock(&stats->counterlock, isc_rwlocktype_write); -#endif - for (i = 0; i < stats->ncounters; i++) { -#if ISC_STATS_USEMULTIFIELDS - stats->copiedcounters[i] = - (isc_uint64_t)(stats->counters[i].hi) << 32 | - stats->counters[i].lo; -#elif ISC_STATS_HAVEATOMICQ -#if defined(ISC_STATS_HAVESTDATOMICQ) stats->copiedcounters[i] = atomic_load_explicit(&stats->counters[i], memory_order_relaxed); -#else - /* use xaddq(..., 0) as an atomic load */ - stats->copiedcounters[i] = - (isc_uint64_t)isc_atomic_xaddq((isc_int64_t *)&stats->counters[i], 0); -#endif -#else - stats->copiedcounters[i] = stats->counters[i]; -#endif } - -#if ISC_STATS_LOCKCOUNTERS - isc_rwlock_unlock(&stats->counterlock, isc_rwlocktype_write); -#endif } isc_result_t @@ -421,29 +226,6 @@ isc_stats_set(isc_stats_t *stats, isc_uint64_t val, REQUIRE(ISC_STATS_VALID(stats)); REQUIRE(counter < stats->ncounters); -#if ISC_STATS_LOCKCOUNTERS - /* - * We use a "write" lock before "reading" the statistics counters as - * an exclusive lock. - */ - isc_rwlock_lock(&stats->counterlock, isc_rwlocktype_write); -#endif - -#if ISC_STATS_USEMULTIFIELDS - stats->counters[counter].hi = (isc_uint32_t)((val >> 32) & 0xffffffff); - stats->counters[counter].lo = (isc_uint32_t)(val & 0xffffffff); -#elif ISC_STATS_HAVEATOMICQ -#if defined(ISC_STATS_HAVESTDATOMICQ) atomic_store_explicit(&stats->counters[counter], val, memory_order_relaxed); -#else - isc_atomic_storeq((isc_int64_t *)&stats->counters[counter], val); -#endif -#else - stats->counters[counter] = val; -#endif - -#if ISC_STATS_LOCKCOUNTERS - isc_rwlock_unlock(&stats->counterlock, isc_rwlocktype_write); -#endif } diff --git a/lib/isc/tests/Kyuafile b/lib/isc/tests/Kyuafile index 1c510c12119..9cbcb8899d2 100644 --- a/lib/isc/tests/Kyuafile +++ b/lib/isc/tests/Kyuafile @@ -2,7 +2,6 @@ syntax(2) test_suite('bind9') atf_test_program{name='aes_test'} -atf_test_program{name='atomic_test'} atf_test_program{name='buffer_test'} atf_test_program{name='counter_test'} atf_test_program{name='errno_test'} diff --git a/lib/isc/tests/Makefile.in b/lib/isc/tests/Makefile.in index 58b3e4f4a67..2bbe5f55abb 100644 --- a/lib/isc/tests/Makefile.in +++ b/lib/isc/tests/Makefile.in @@ -28,7 +28,7 @@ ISCDEPLIBS = ../libisc.@A@ LIBS = @LIBS@ @ATFLIBS@ OBJS = isctest.@O@ -SRCS = isctest.c aes_test.c atomic_test.c buffer_test.c \ +SRCS = isctest.c aes_test.c buffer_test.c \ counter_test.c errno_test.c file_test.c hash_test.c \ heap_test.c ht_test.c inet_ntop_test.c lex_test.c \ mem_test.c netaddr_test.c parse_test.c pool_test.c \ @@ -38,7 +38,7 @@ SRCS = isctest.c aes_test.c atomic_test.c buffer_test.c \ taskpool_test.c time_test.c timer_test.c SUBDIRS = -TARGETS = aes_test@EXEEXT@ atomic_test@EXEEXT@ buffer_test@EXEEXT@ \ +TARGETS = aes_test@EXEEXT@ buffer_test@EXEEXT@ \ counter_test@EXEEXT@ errno_test@EXEEXT@ file_test@EXEEXT@ \ hash_test@EXEEXT@ heap_test@EXEEXT@ ht_test@EXEEXT@ \ inet_ntop_test@EXEEXT@ lex_test@EXEEXT@ mem_test@EXEEXT@ \ @@ -51,10 +51,6 @@ TARGETS = aes_test@EXEEXT@ atomic_test@EXEEXT@ buffer_test@EXEEXT@ \ @BIND9_MAKE_RULES@ -atomic_test@EXEEXT@: atomic_test.@O@ isctest.@O@ ${ISCDEPLIBS} - ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ \ - atomic_test.@O@ isctest.@O@ ${ISCLIBS} ${LIBS} - aes_test@EXEEXT@: aes_test.@O@ ${ISCDEPLIBS} ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ \ aes_test.@O@ ${ISCLIBS} ${LIBS} diff --git a/lib/isc/tests/atomic_test.c b/lib/isc/tests/atomic_test.c deleted file mode 100644 index d38d84774bb..00000000000 --- a/lib/isc/tests/atomic_test.c +++ /dev/null @@ -1,352 +0,0 @@ -/* - * Copyright (C) Internet Systems Consortium, Inc. ("ISC") - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * See the COPYRIGHT file distributed with this work for additional - * information regarding copyright ownership. - */ - -#include -#include - -#include - -#include -#include -#include - -#include "isctest.h" - -#define TASKS 32 -#define ITERATIONS 1000 -#define COUNTS_PER_ITERATION 1000 -#define INCREMENT_64 (isc_int64_t)0x0000000010000000 -#define EXPECTED_COUNT_32 (TASKS * ITERATIONS * COUNTS_PER_ITERATION) -#define EXPECTED_COUNT_64 (TASKS * ITERATIONS * COUNTS_PER_ITERATION * INCREMENT_64) - -typedef struct { - isc_uint32_t iteration; -} counter_t; - -counter_t counters[TASKS]; - -#if defined(ISC_PLATFORM_HAVEXADD) -static isc_int32_t counter_32; - -static void -do_xadd(isc_task_t *task, isc_event_t *ev) { - counter_t *state = (counter_t *)ev->ev_arg; - int i; - - for (i = 0 ; i < COUNTS_PER_ITERATION ; i++) { - isc_atomic_xadd(&counter_32, 1); - } - - state->iteration++; - if (state->iteration < ITERATIONS) { - isc_task_send(task, &ev); - } else { - isc_event_free(&ev); - } -} - -ATF_TC(atomic_xadd); -ATF_TC_HEAD(atomic_xadd, tc) { - atf_tc_set_md_var(tc, "descr", "atomic XADD"); -} -ATF_TC_BODY(atomic_xadd, tc) { - isc_result_t result; - isc_task_t *tasks[TASKS]; - isc_event_t *event = NULL; - int i; - - UNUSED(tc); - - result = isc_test_begin(NULL, ISC_TRUE, 0); - ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); - - memset(counters, 0, sizeof(counters)); - counter_32 = 0; - - /* - * Create our tasks, and allocate an event to get the counters going. - */ - for (i = 0 ; i < TASKS ; i++) { - tasks[i] = NULL; - ATF_REQUIRE_EQ(isc_task_create(taskmgr, 0, &tasks[i]), - ISC_R_SUCCESS); - event = isc_event_allocate(mctx, NULL, 1000, do_xadd, - &counters[i], - sizeof(struct isc_event)); - ATF_REQUIRE(event != NULL); - isc_task_sendanddetach(&tasks[i], &event); - } - - isc_test_end(); - - printf("32-bit counter %d, expected %d\n", - counter_32, EXPECTED_COUNT_32); - - ATF_CHECK_EQ(counter_32, EXPECTED_COUNT_32); - counter_32 = 0; -} -#endif - -#if defined(ISC_PLATFORM_HAVEXADDQ) -static isc_int64_t counter_64; - -static void -do_xaddq(isc_task_t *task, isc_event_t *ev) { - counter_t *state = (counter_t *)ev->ev_arg; - int i; - - for (i = 0 ; i < COUNTS_PER_ITERATION ; i++) { - isc_atomic_xaddq(&counter_64, INCREMENT_64); - } - - state->iteration++; - if (state->iteration < ITERATIONS) { - isc_task_send(task, &ev); - } else { - isc_event_free(&ev); - } -} - -ATF_TC(atomic_xaddq); -ATF_TC_HEAD(atomic_xaddq, tc) { - atf_tc_set_md_var(tc, "descr", "atomic XADDQ"); -} -ATF_TC_BODY(atomic_xaddq, tc) { - isc_result_t result; - isc_task_t *tasks[TASKS]; - isc_event_t *event = NULL; - int i; - - UNUSED(tc); - - result = isc_test_begin(NULL, ISC_TRUE, 0); - ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); - - memset(counters, 0, sizeof(counters)); - counter_64 = 0; - - /* - * Create our tasks, and allocate an event to get the counters going. - */ - for (i = 0 ; i < TASKS ; i++) { - tasks[i] = NULL; - ATF_REQUIRE_EQ(isc_task_create(taskmgr, 0, &tasks[i]), - ISC_R_SUCCESS); - event = isc_event_allocate(mctx, NULL, 1000, do_xaddq, - &counters[i], - sizeof(struct isc_event)); - ATF_REQUIRE(event != NULL); - isc_task_sendanddetach(&tasks[i], &event); - } - - isc_test_end(); - - printf("64-bit counter %"ISC_PRINT_QUADFORMAT"d, " - "expected %"ISC_PRINT_QUADFORMAT"d\n", - counter_64, EXPECTED_COUNT_64); - - ATF_CHECK_EQ(counter_64, EXPECTED_COUNT_64); - counter_32 = 0; -} -#endif - -#if defined(ISC_PLATFORM_HAVEATOMICSTORE) -static isc_int32_t store_32; - -static void -do_store(isc_task_t *task, isc_event_t *ev) { - counter_t *state = (counter_t *)ev->ev_arg; - int i; - isc_uint32_t r; - isc_uint32_t val; - - r = random() % 256; - val = (r << 24) | (r << 16) | (r << 8) | r; - - for (i = 0 ; i < COUNTS_PER_ITERATION ; i++) { - isc_atomic_store(&store_32, val); - } - - state->iteration++; - if (state->iteration < ITERATIONS) { - isc_task_send(task, &ev); - } else { - isc_event_free(&ev); - } -} - -ATF_TC(atomic_store); -ATF_TC_HEAD(atomic_store, tc) { - atf_tc_set_md_var(tc, "descr", "atomic STORE"); -} -ATF_TC_BODY(atomic_store, tc) { - isc_result_t result; - isc_task_t *tasks[TASKS]; - isc_event_t *event = NULL; - isc_uint32_t val; - isc_uint32_t r; - int i; - - UNUSED(tc); - - result = isc_test_begin(NULL, ISC_TRUE, 0); - ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); - - memset(counters, 0, sizeof(counters)); - store_32 = 0; - - /* - * Create our tasks, and allocate an event to get the counters - * going. - */ - for (i = 0 ; i < TASKS ; i++) { - tasks[i] = NULL; - ATF_REQUIRE_EQ(isc_task_create(taskmgr, 0, &tasks[i]), - ISC_R_SUCCESS); - event = isc_event_allocate(mctx, NULL, 1000, do_store, - &counters[i], - sizeof(struct isc_event)); - ATF_REQUIRE(event != NULL); - isc_task_sendanddetach(&tasks[i], &event); - } - - isc_test_end(); - - r = store_32 & 0xff; - val = (r << 24) | (r << 16) | (r << 8) | r; - - printf("32-bit store 0x%x, expected 0x%x\n", - (isc_uint32_t) store_32, val); - - ATF_CHECK_EQ((isc_uint32_t) store_32, val); - store_32 = 0; -} -#endif - -#if defined(ISC_PLATFORM_HAVEATOMICSTOREQ) -static isc_int64_t store_64; - -static void -do_storeq(isc_task_t *task, isc_event_t *ev) { - counter_t *state = (counter_t *)ev->ev_arg; - int i; - isc_uint8_t r; - isc_uint64_t val; - - r = random() % 256; - val = (((isc_uint64_t) r << 24) | - ((isc_uint64_t) r << 16) | - ((isc_uint64_t) r << 8) | - (isc_uint64_t) r); - val |= ((isc_uint64_t) val << 32); - - for (i = 0 ; i < COUNTS_PER_ITERATION ; i++) { - isc_atomic_storeq(&store_64, val); - } - - state->iteration++; - if (state->iteration < ITERATIONS) { - isc_task_send(task, &ev); - } else { - isc_event_free(&ev); - } -} - -ATF_TC(atomic_storeq); -ATF_TC_HEAD(atomic_storeq, tc) { - atf_tc_set_md_var(tc, "descr", "atomic STOREQ"); -} -ATF_TC_BODY(atomic_storeq, tc) { - isc_result_t result; - isc_task_t *tasks[TASKS]; - isc_event_t *event = NULL; - isc_uint64_t val; - isc_uint32_t r; - int i; - - UNUSED(tc); - - result = isc_test_begin(NULL, ISC_TRUE, 0); - ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); - - memset(counters, 0, sizeof(counters)); - store_64 = 0; - - /* - * Create our tasks, and allocate an event to get the counters - * going. - */ - for (i = 0 ; i < TASKS ; i++) { - tasks[i] = NULL; - ATF_REQUIRE_EQ(isc_task_create(taskmgr, 0, &tasks[i]), - ISC_R_SUCCESS); - event = isc_event_allocate(mctx, NULL, 1000, do_storeq, - &counters[i], - sizeof(struct isc_event)); - ATF_REQUIRE(event != NULL); - isc_task_sendanddetach(&tasks[i], &event); - } - - isc_test_end(); - - r = store_64 & 0xff; - val = (((isc_uint64_t) r << 24) | - ((isc_uint64_t) r << 16) | - ((isc_uint64_t) r << 8) | - (isc_uint64_t) r); - val |= ((isc_uint64_t) val << 32); - - printf("64-bit store 0x%"ISC_PRINT_QUADFORMAT"x, " - "expected 0x%"ISC_PRINT_QUADFORMAT"x\n", - (isc_uint64_t) store_64, val); - - ATF_CHECK_EQ((isc_uint64_t) store_64, val); - store_64 = 0; -} -#endif - -#if !defined(ISC_PLATFORM_HAVEXADD) && \ - !defined(ISC_PLATFORM_HAVEXADDQ) && \ - !defined(ISC_PLATFORM_HAVEATOMICSTOREQ) -ATF_TC(untested); -ATF_TC_HEAD(untested, tc) { - atf_tc_set_md_var(tc, "descr", "skipping aes test"); -} -ATF_TC_BODY(untested, tc) { - UNUSED(tc); - atf_tc_skip("AES not available"); -} -#endif /* !HAVEXADD, !HAVEXADDQ, !HAVEATOMICSTOREQ */ - -/* - * Main - */ -ATF_TP_ADD_TCS(tp) { -#if defined(ISC_PLATFORM_HAVEXADD) - ATF_TP_ADD_TC(tp, atomic_xadd); -#endif -#if defined(ISC_PLATFORM_HAVEXADDQ) - ATF_TP_ADD_TC(tp, atomic_xaddq); -#endif -#ifdef ISC_PLATFORM_HAVEATOMICSTORE - ATF_TP_ADD_TC(tp, atomic_store); -#endif -#if defined(ISC_PLATFORM_HAVEATOMICSTOREQ) - ATF_TP_ADD_TC(tp, atomic_storeq); -#endif -#if !defined(ISC_PLATFORM_HAVEXADD) && \ - !defined(ISC_PLATFORM_HAVEXADDQ) && \ - !defined(ISC_PLATFORM_HAVEATOMICSTOREQ) - ATF_TP_ADD_TC(tp, untested); -#endif - - return (atf_no_error()); -} diff --git a/lib/isc/win32/include/isc/atomic.h b/lib/isc/win32/include/isc/atomic.h deleted file mode 100644 index 800b9458ce8..00000000000 --- a/lib/isc/win32/include/isc/atomic.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (C) Internet Systems Consortium, Inc. ("ISC") - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * See the COPYRIGHT file distributed with this work for additional - * information regarding copyright ownership. - */ - - -#ifndef ISC_ATOMIC_H -#define ISC_ATOMIC_H 1 - -#include -#include -#include - -/* - * This routine atomically increments the value stored in 'p' by 'val', and - * returns the previous value. - */ -#ifdef ISC_PLATFORM_HAVEXADD -static __inline isc_int32_t -isc_atomic_xadd(isc_int32_t *p, isc_int32_t val) { - return (isc_int32_t) _InterlockedExchangeAdd((long *)p, (long)val); -} -#endif - -#ifdef ISC_PLATFORM_HAVEXADDQ -static __inline isc_int64_t -isc_atomic_xaddq(isc_int64_t *p, isc_int64_t val) { - return (isc_int64_t) _InterlockedExchangeAdd64((__int64 *)p, - (__int64) val); -} -#endif - -/* - * This routine atomically stores the value 'val' in 'p' (32-bit version). - */ -#ifdef ISC_PLATFORM_HAVEATOMICSTORE -static __inline void -isc_atomic_store(isc_int32_t *p, isc_int32_t val) { - (void) _InterlockedExchange((long *)p, (long)val); -} -#endif - -/* - * This routine atomically stores the value 'val' in 'p' (64-bit version). - */ -#ifdef ISC_PLATFORM_HAVEATOMICSTOREQ -static __inline void -isc_atomic_storeq(isc_int64_t *p, isc_int64_t val) { - (void) _InterlockedExchange64((__int64 *)p, (__int64)val); -} -#endif - -/* - * This routine atomically replaces the value in 'p' with 'val', if the - * original value is equal to 'cmpval'. The original value is returned in any - * case. - */ -#ifdef ISC_PLATFORM_HAVECMPXCHG -static __inline isc_int32_t -isc_atomic_cmpxchg(isc_int32_t *p, isc_int32_t cmpval, isc_int32_t val) { - /* beware: swap arguments */ - return (isc_int32_t) _InterlockedCompareExchange((long *)p, - (long)val, - (long)cmpval); -} -#endif - -#endif /* ISC_ATOMIC_H */ diff --git a/lib/isc/win32/include/isc/platform.h.in b/lib/isc/win32/include/isc/platform.h.in index d7f94a6ff09..14a487fc1c0 100644 --- a/lib/isc/win32/include/isc/platform.h.in +++ b/lib/isc/win32/include/isc/platform.h.in @@ -97,30 +97,6 @@ */ @ISC_PLATFORM_WANTAES@ -/* - * If the "xadd" operation is available on this architecture, - * ISC_PLATFORM_HAVEXADD will be defined. - */ -@ISC_PLATFORM_HAVEXADD@ - -/* - * If the "xaddq" operation (64bit xadd) is available on this architecture, - * ISC_PLATFORM_HAVEXADDQ will be defined. - */ -@ISC_PLATFORM_HAVEXADDQ@ - -/* - * If the "atomic swap" operation is available on this architecture, - * ISC_PLATFORM_HAVEATOMICSTORE" will be defined. - */ -@ISC_PLATFORM_HAVEATOMICSTORE@ - -/* - * If the "compare-and-exchange" operation is available on this architecture, - * ISC_PLATFORM_HAVECMPXCHG will be defined. - */ -@ISC_PLATFORM_HAVECMPXCHG@ - /* * Define with the busy wait nop asm or function call. */ diff --git a/lib/isc/x86_32/Makefile.in b/lib/isc/x86_32/Makefile.in deleted file mode 100644 index 419cf9f8755..00000000000 --- a/lib/isc/x86_32/Makefile.in +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright (C) Internet Systems Consortium, Inc. ("ISC") -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# See the COPYRIGHT file distributed with this work for additional -# information regarding copyright ownership. - -srcdir = @srcdir@ -VPATH = @srcdir@ -top_srcdir = @top_srcdir@ - -SUBDIRS = include -TARGETS = - -@BIND9_MAKE_RULES@ diff --git a/lib/isc/x86_32/include/Makefile.in b/lib/isc/x86_32/include/Makefile.in deleted file mode 100644 index d33c0fcb2c9..00000000000 --- a/lib/isc/x86_32/include/Makefile.in +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright (C) Internet Systems Consortium, Inc. ("ISC") -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# See the COPYRIGHT file distributed with this work for additional -# information regarding copyright ownership. - -srcdir = @srcdir@ -VPATH = @srcdir@ -top_srcdir = @top_srcdir@ - -SUBDIRS = isc -TARGETS = - -@BIND9_MAKE_RULES@ diff --git a/lib/isc/x86_32/include/isc/Makefile.in b/lib/isc/x86_32/include/isc/Makefile.in deleted file mode 100644 index 9f87e48935a..00000000000 --- a/lib/isc/x86_32/include/isc/Makefile.in +++ /dev/null @@ -1,34 +0,0 @@ -# Copyright (C) Internet Systems Consortium, Inc. ("ISC") -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# See the COPYRIGHT file distributed with this work for additional -# information regarding copyright ownership. - -srcdir = @srcdir@ -VPATH = @srcdir@ -top_srcdir = @top_srcdir@ - -VERSION=@BIND9_VERSION@ - -HEADERS = atomic.h - -SUBDIRS = -TARGETS = - -@BIND9_MAKE_RULES@ - -installdirs: - $(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${includedir}/isc - -install:: installdirs - for i in ${HEADERS}; do \ - ${INSTALL_DATA} $(srcdir)/$$i ${DESTDIR}${includedir}/isc ; \ - done - -uninstall:: - for i in ${HEADERS}; do \ - rm -f ${DESTDIR}${includedir}/isc/$$i ; \ - done diff --git a/lib/isc/x86_32/include/isc/atomic.h b/lib/isc/x86_32/include/isc/atomic.h deleted file mode 100644 index 6b0555ec307..00000000000 --- a/lib/isc/x86_32/include/isc/atomic.h +++ /dev/null @@ -1,190 +0,0 @@ -/* - * Copyright (C) Internet Systems Consortium, Inc. ("ISC") - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * See the COPYRIGHT file distributed with this work for additional - * information regarding copyright ownership. - */ - - -#ifndef ISC_ATOMIC_H -#define ISC_ATOMIC_H 1 - -#include -#include - -#ifdef ISC_PLATFORM_USEGCCASM -/* - * This routine atomically increments the value stored in 'p' by 'val', and - * returns the previous value. - */ -static __inline__ isc_int32_t -isc_atomic_xadd(isc_int32_t *p, isc_int32_t val) { - isc_int32_t prev = val; - - __asm__ volatile( -#ifdef ISC_PLATFORM_USETHREADS - "lock;" -#endif - "xadd %0, %1" - :"=q"(prev) - :"m"(*p), "0"(prev) - :"memory", "cc"); - - return (prev); -} - -#ifdef ISC_PLATFORM_HAVEXADDQ -static __inline__ isc_int64_t -isc_atomic_xaddq(isc_int64_t *p, isc_int64_t val) { - isc_int64_t prev = val; - - __asm__ volatile( -#ifdef ISC_PLATFORM_USETHREADS - "lock;" -#endif - "xaddq %0, %1" - :"=q"(prev) - :"m"(*p), "0"(prev) - :"memory", "cc"); - - return (prev); -} -#endif /* ISC_PLATFORM_HAVEXADDQ */ - -/* - * This routine atomically stores the value 'val' in 'p' (32-bit version). - */ -static __inline__ void -isc_atomic_store(isc_int32_t *p, isc_int32_t val) { - __asm__ volatile( -#ifdef ISC_PLATFORM_USETHREADS - /* - * xchg should automatically lock memory, but we add it - * explicitly just in case (it at least doesn't harm) - */ - "lock;" -#endif - - "xchgl %1, %0" - : - : "r"(val), "m"(*p) - : "memory"); -} - -#ifdef ISC_PLATFORM_HAVEATOMICSTOREQ -/* - * This routine atomically stores the value 'val' in 'p' (64-bit version). - */ -static __inline__ void -isc_atomic_storeq(isc_int64_t *p, isc_int64_t val) { - __asm__ volatile( -#ifdef ISC_PLATFORM_USETHREADS - /* - * xchg should automatically lock memory, but we add it - * explicitly just in case (it at least doesn't harm) - */ - "lock;" -#endif - - "xchgq %1, %0" - : - : "r"(val), "m"(*p) - : "memory"); -} -#endif /* ISC_PLATFORM_HAVEATOMICSTOREQ */ - -/* - * This routine atomically replaces the value in 'p' with 'val', if the - * original value is equal to 'cmpval'. The original value is returned in any - * case. - */ -static __inline__ isc_int32_t -isc_atomic_cmpxchg(isc_int32_t *p, isc_int32_t cmpval, isc_int32_t val) { - __asm__ volatile( -#ifdef ISC_PLATFORM_USETHREADS - "lock;" -#endif - "cmpxchgl %1, %2" - : "=a"(cmpval) - : "r"(val), "m"(*p), "a"(cmpval) - : "memory"); - - return (cmpval); -} - -#elif defined(ISC_PLATFORM_USESTDASM) -/* - * The followings are "generic" assembly code which implements the same - * functionality in case the gcc extension cannot be used. It should be - * better to avoid inlining below, since we directly refer to specific - * positions of the stack frame, which would not actually point to the - * intended address in the embedded mnemonic. - */ -static isc_int32_t -isc_atomic_xadd(isc_int32_t *p, isc_int32_t val) { - (void)(p); - (void)(val); - - __asm ( - "movl 8(%ebp), %ecx\n" - "movl 12(%ebp), %edx\n" -#ifdef ISC_PLATFORM_USETHREADS - "lock;" -#endif - "xadd %edx, (%ecx)\n" - - /* - * set the return value directly in the register so that we - * can avoid guessing the correct position in the stack for a - * local variable. - */ - "movl %edx, %eax" - ); -} - -static void -isc_atomic_store(isc_int32_t *p, isc_int32_t val) { - (void)(p); - (void)(val); - - __asm ( - "movl 8(%ebp), %ecx\n" - "movl 12(%ebp), %edx\n" -#ifdef ISC_PLATFORM_USETHREADS - "lock;" -#endif - "xchgl (%ecx), %edx\n" - ); -} - -static isc_int32_t -isc_atomic_cmpxchg(isc_int32_t *p, isc_int32_t cmpval, isc_int32_t val) { - (void)(p); - (void)(cmpval); - (void)(val); - - __asm ( - "movl 8(%ebp), %ecx\n" - "movl 12(%ebp), %eax\n" /* must be %eax for cmpxchgl */ - "movl 16(%ebp), %edx\n" -#ifdef ISC_PLATFORM_USETHREADS - "lock;" -#endif - - /* - * If (%ecx) == %eax then (%ecx) := %edx. - % %eax is set to old (%ecx), which will be the return value. - */ - "cmpxchgl %edx, (%ecx)" - ); -} -#else /* !ISC_PLATFORM_USEGCCASM && !ISC_PLATFORM_USESTDASM */ - -#error "unsupported compiler. disable atomic ops by --disable-atomic" - -#endif -#endif /* ISC_ATOMIC_H */ diff --git a/lib/isc/x86_64/Makefile.in b/lib/isc/x86_64/Makefile.in deleted file mode 100644 index 419cf9f8755..00000000000 --- a/lib/isc/x86_64/Makefile.in +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright (C) Internet Systems Consortium, Inc. ("ISC") -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# See the COPYRIGHT file distributed with this work for additional -# information regarding copyright ownership. - -srcdir = @srcdir@ -VPATH = @srcdir@ -top_srcdir = @top_srcdir@ - -SUBDIRS = include -TARGETS = - -@BIND9_MAKE_RULES@ diff --git a/lib/isc/x86_64/include/Makefile.in b/lib/isc/x86_64/include/Makefile.in deleted file mode 100644 index d33c0fcb2c9..00000000000 --- a/lib/isc/x86_64/include/Makefile.in +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright (C) Internet Systems Consortium, Inc. ("ISC") -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# See the COPYRIGHT file distributed with this work for additional -# information regarding copyright ownership. - -srcdir = @srcdir@ -VPATH = @srcdir@ -top_srcdir = @top_srcdir@ - -SUBDIRS = isc -TARGETS = - -@BIND9_MAKE_RULES@ diff --git a/lib/isc/x86_64/include/isc/Makefile.in b/lib/isc/x86_64/include/isc/Makefile.in deleted file mode 100644 index 9f87e48935a..00000000000 --- a/lib/isc/x86_64/include/isc/Makefile.in +++ /dev/null @@ -1,34 +0,0 @@ -# Copyright (C) Internet Systems Consortium, Inc. ("ISC") -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# See the COPYRIGHT file distributed with this work for additional -# information regarding copyright ownership. - -srcdir = @srcdir@ -VPATH = @srcdir@ -top_srcdir = @top_srcdir@ - -VERSION=@BIND9_VERSION@ - -HEADERS = atomic.h - -SUBDIRS = -TARGETS = - -@BIND9_MAKE_RULES@ - -installdirs: - $(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${includedir}/isc - -install:: installdirs - for i in ${HEADERS}; do \ - ${INSTALL_DATA} $(srcdir)/$$i ${DESTDIR}${includedir}/isc ; \ - done - -uninstall:: - for i in ${HEADERS}; do \ - rm -f ${DESTDIR}${includedir}/isc/$$i ; \ - done diff --git a/lib/isc/x86_64/include/isc/atomic.h b/lib/isc/x86_64/include/isc/atomic.h deleted file mode 100644 index 8d68574aad1..00000000000 --- a/lib/isc/x86_64/include/isc/atomic.h +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright (C) Internet Systems Consortium, Inc. ("ISC") - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * See the COPYRIGHT file distributed with this work for additional - * information regarding copyright ownership. - */ - - -#ifndef ISC_ATOMIC_H -#define ISC_ATOMIC_H 1 - -#include -#include - -#ifdef ISC_PLATFORM_USEGCCASM - -/* We share the gcc-version with x86_32 */ -#error "impossible case. check build configuration" - -#elif defined(ISC_PLATFORM_USESTDASM) -/* - * The followings are "generic" assembly code which implements the same - * functionality in case the gcc extension cannot be used. It should be - * better to avoid inlining below, since we directly refer to specific - * registers for arguments, which would not actually correspond to the - * intended address or value in the embedded mnemonic. - */ - -static isc_int32_t -isc_atomic_xadd(isc_int32_t *p, isc_int32_t val) { - (void)(p); - (void)(val); - - __asm ( - "movq %rdi, %rdx\n" - "movl %esi, %eax\n" -#ifdef ISC_PLATFORM_USETHREADS - "lock;" -#endif - "xadd %eax, (%rdx)\n" - /* - * XXX: assume %eax will be used as the return value. - */ - ); -} - -#ifdef ISC_PLATFORM_HAVEXADDQ -static isc_int64_t -isc_atomic_xaddq(isc_int64_t *p, isc_int64_t val) { - (void)(p); - (void)(val); - - __asm ( - "movq %rdi, %rdx\n" - "movq %rsi, %rax\n" -#ifdef ISC_PLATFORM_USETHREADS - "lock;" -#endif - "xaddq %rax, (%rdx)\n" - /* - * XXX: assume %rax will be used as the return value. - */ - ); -} -#endif - -static void -isc_atomic_store(isc_int32_t *p, isc_int32_t val) { - (void)(p); - (void)(val); - - __asm ( - "movq %rdi, %rax\n" - "movl %esi, %edx\n" -#ifdef ISC_PLATFORM_USETHREADS - "lock;" -#endif - "xchgl (%rax), %edx\n" - ); -} - -#ifdef ISC_PLATFORM_HAVEATOMICSTOREQ -static void -isc_atomic_storeq(isc_int64_t *p, isc_int64_t val) { - (void)(p); - (void)(val); - - __asm ( - "movq %rdi, %rax\n" - "movq %rsi, %rdx\n" -#ifdef ISC_PLATFORM_USETHREADS - "lock;" -#endif - "xchgq (%rax), %rdx\n" - ); -} -#endif - -static isc_int32_t -isc_atomic_cmpxchg(isc_int32_t *p, isc_int32_t cmpval, isc_int32_t val) { - (void)(p); - (void)(cmpval); - (void)(val); - - __asm ( - /* - * p is %rdi, cmpval is %esi, val is %edx. - */ - "movl %edx, %ecx\n" - "movl %esi, %eax\n" - "movq %rdi, %rdx\n" - -#ifdef ISC_PLATFORM_USETHREADS - "lock;" -#endif - /* - * If [%rdi] == %eax then [%rdi] := %ecx (equal to %edx - * from above), and %eax is untouched (equal to %esi) - * from above. - * - * Else if [%rdi] != %eax then [%rdi] := [%rdi] - * (rewritten in write cycle) and %eax := [%rdi]. - */ - "cmpxchgl %ecx, (%rdx)" - ); -} - -#else /* !ISC_PLATFORM_USEGCCASM && !ISC_PLATFORM_USESTDASM */ - -#error "unsupported compiler. disable atomic ops by --disable-atomic" - -#endif -#endif /* ISC_ATOMIC_H */ diff --git a/make/includes.in b/make/includes.in index 51a00f4d9e2..6d42de5db34 100644 --- a/make/includes.in +++ b/make/includes.in @@ -17,8 +17,7 @@ ISC_INCLUDES = @BIND9_ISC_BUILDINCLUDE@ \ -I${top_srcdir}/lib/isc \ -I${top_srcdir}/lib/isc/include \ -I${top_srcdir}/lib/isc/unix/include \ - -I${top_srcdir}/lib/isc/@ISC_THREAD_DIR@/include \ - -I${top_srcdir}/lib/isc/@ISC_ARCH_DIR@/include + -I${top_srcdir}/lib/isc/@ISC_THREAD_DIR@/include ISCCC_INCLUDES = @BIND9_ISCCC_BUILDINCLUDE@ \ -I${top_srcdir}/lib/isccc/include -- 2.47.3