diff options
Diffstat (limited to 'sntp/libevent/configure')
-rwxr-xr-x | sntp/libevent/configure | 4647 |
1 files changed, 277 insertions, 4370 deletions
diff --git a/sntp/libevent/configure b/sntp/libevent/configure index 09d6eedb5cd0..d2c07801dfe7 100755 --- a/sntp/libevent/configure +++ b/sntp/libevent/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for libevent 2.1.3-alpha-dev. +# Generated by GNU Autoconf 2.68 for libevent 2.1.5-beta. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -567,8 +567,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='libevent' PACKAGE_TARNAME='libevent' -PACKAGE_VERSION='2.1.3-alpha-dev' -PACKAGE_STRING='libevent 2.1.3-alpha-dev' +PACKAGE_VERSION='2.1.5-beta' +PACKAGE_STRING='libevent 2.1.5-beta' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -619,6 +619,8 @@ PTHREADS_FALSE PTHREADS_TRUE PTHREAD_CFLAGS PTHREAD_LIBS +PTHREAD_CC +acx_pthread_config SIGNAL_SUPPORT_FALSE SIGNAL_SUPPORT_TRUE EVPORT_BACKEND_FALSE @@ -655,6 +657,8 @@ ZLIB_REGRESS_TRUE ZLIB_LIBS BUILD_REGRESS_FALSE BUILD_REGRESS_TRUE +BUILD_SAMPLES_FALSE +BUILD_SAMPLES_TRUE LIBTOOL_DEPS OTOOL64 OTOOL @@ -778,6 +782,7 @@ enable_openssl enable_debug_mode enable_libevent_install enable_libevent_regress +enable_samples enable_function_sections enable_verbose_debug enable_shared @@ -788,8 +793,6 @@ with_gnu_ld with_sysroot enable_libtool_lock enable_largefile -with_threads -with_yielding_select ' ac_precious_vars='build_alias host_alias @@ -1342,7 +1345,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures libevent 2.1.3-alpha-dev to adapt to many kinds of systems. +\`configure' configures libevent 2.1.5-beta to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1412,7 +1415,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of libevent 2.1.3-alpha-dev:";; + short | recursive ) echo "Configuration of libevent 2.1.5-beta:";; esac cat <<\_ACEOF @@ -1437,6 +1440,8 @@ Optional Features: --disable-libevent-regress, skip regress in make check + --disable-samples, skip building of sample programs + --enable-function-sections, make static library allow smaller binaries with --gc-sections --enable-verbose-debug, verbose debug logging @@ -1456,8 +1461,6 @@ Optional Packages: --with-gnu-ld assume the C compiler uses GNU ld [default=no] --with-sysroot=DIR Search for dependent libraries within DIR (or the compiler's sysroot if not specified). - --with-threads with threads [auto] - --with-yielding-select with yielding select [auto] Some influential environment variables: CC C compiler command @@ -1535,7 +1538,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -libevent configure 2.1.3-alpha-dev +libevent configure 2.1.5-beta generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -2235,7 +2238,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by libevent $as_me 2.1.3-alpha-dev, which was +It was created by libevent $as_me 2.1.5-beta, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2616,7 +2619,6 @@ ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. - am__api_version='1.11' # Find a good install program. We prefer a C program (faster), @@ -3055,7 +3057,7 @@ fi # Define the identity of the package. PACKAGE='libevent' - VERSION='2.1.3-alpha-dev' + VERSION='2.1.5-beta' cat >>confdefs.h <<_ACEOF @@ -3110,7 +3112,7 @@ AM_BACKSLASH='\' ac_config_headers="$ac_config_headers config.h evconfig-private.h:evconfig-private.h.in" -$as_echo "#define NUMERIC_VERSION 0x02010301" >>confdefs.h +$as_echo "#define NUMERIC_VERSION 0x02010500" >>confdefs.h if test "$prefix" = "NONE"; then @@ -5004,6 +5006,13 @@ else enable_libevent_regress=yes fi +# Check whether --enable-samples was given. +if test "${enable_samples+set}" = set; then : + enableval=$enable_samples; +else + enable_samples=yes +fi + # Check whether --enable-function-sections was given. if test "${enable_function_sections+set}" = set; then : enableval=$enable_function_sections; @@ -12071,6 +12080,14 @@ CC="$lt_save_CC" + if test "$enable_samples" = "yes"; then + BUILD_SAMPLES_TRUE= + BUILD_SAMPLES_FALSE='#' +else + BUILD_SAMPLES_TRUE='#' + BUILD_SAMPLES_FALSE= +fi + if test "$enable_libevent_regress" = "yes"; then BUILD_REGRESS_TRUE= BUILD_REGRESS_FALSE='#' @@ -14825,58 +14842,127 @@ 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 -# OpenLDAP --with-threads - -# Check whether --with-threads was given. -if test "${with_threads+set}" = set; then : - withval=$with_threads; - ol_arg=invalid - for ol_val in auto nt posix mach pth lwp yes no manual ; do - if test "$withval" = "$ol_val" ; then - ol_arg="$ol_val" - fi - done - if test "$ol_arg" = "invalid" ; then - as_fn_error $? "bad value $withval for --with-threads" "$LINENO" 5 - fi - ol_with_threads="$ol_arg" +acx_pthread_ok=no + +# We used to check for pthread.h first, but this fails if pthread.h +# requires special compiler flags (e.g. on True64 or Sequent). +# It gets checked for in the link test anyway. + +# First of all, check if the user has set any of the PTHREAD_LIBS, +# etcetera environment variables, and if threads linking works using +# them: +if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + save_LIBS="$LIBS" + LIBS="$PTHREAD_LIBS $LIBS" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS" >&5 +$as_echo_n "checking for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ -else - ol_with_threads="auto" +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char pthread_join (); +int +main () +{ +return pthread_join (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + acx_pthread_ok=yes fi -# end --with-threads - - -case "$ol_with_threads$host" in - auto*-*-solaris2.[0-6]) - ol_with_threads=no - ;; +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_pthread_ok" >&5 +$as_echo "$acx_pthread_ok" >&6; } + if test x"$acx_pthread_ok" = xno; then + PTHREAD_LIBS="" + PTHREAD_CFLAGS="" + fi + LIBS="$save_LIBS" + CFLAGS="$save_CFLAGS" +fi + +# We must check for the threads library under a number of different +# names; the ordering is very important because some systems +# (e.g. DEC) have both -lpthread and -lpthreads, where one of the +# libraries is broken (non-POSIX). + +# Create a list of thread flags to try. Items starting with a "-" are +# C compiler flags, and other items are library names, except for "none" +# which indicates that we try without any flags at all, and "pthread-config" +# which is a program returning the flags for the Pth emulation library. + +acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config" + +# The ordering *is* (sometimes) important. Some notes on the +# individual items follow: + +# pthreads: AIX (must check this before -lpthread) +# none: in case threads are in libc; should be tried before -Kthread and +# other compiler flags to prevent continual compiler warnings +# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h) +# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) +# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) +# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads) +# -pthreads: Solaris/gcc +# -mthreads: Mingw32/gcc, Lynx/gcc +# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it +# doesn't hurt to check since this sometimes defines pthreads too; +# also defines -D_REENTRANT) +# ... -mt is also the pthreads flag for HP/aCC +# pthread: Linux, etcetera +# --thread-safe: KAI C++ +# pthread-config: use pthread-config program (for GNU Pth library) + +case "${host_cpu}-${host_os}" in + *solaris*) + + # On Solaris (at least, for some versions), libc contains stubbed + # (non-functional) versions of the pthreads routines, so link-based + # tests will erroneously succeed. (We need to link with -pthreads/-mt/ + # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather + # a function called by this macro, so we could check for that, but + # who knows whether they'll stub that too in a future libc.) So, + # we'll just look for -pthreads and -lpthread first: + + acx_pthread_flags="-pthreads pthread -mt -pthread $acx_pthread_flags" + ;; esac +if test x"$acx_pthread_ok" = xno; then +for flag in $acx_pthread_flags; do -ol_aix_threads=no -case "$host" in -*-*-aix*) if test -z "$CC" ; then - case "$ol_with_threads" in - auto | yes | posix) ol_aix_threads=yes ;; - esac - fi -;; -esac + case $flag in + none) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pthreads work without any flags" >&5 +$as_echo_n "checking whether pthreads work without any flags... " >&6; } + ;; -if test $ol_aix_threads = yes ; then - if test -z "${CC}" ; then - for ac_prog in cc_r xlc_r cc -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 whether pthreads work with $flag" >&5 +$as_echo_n "checking whether pthreads work with $flag... " >&6; } + PTHREAD_CFLAGS="$flag" + ;; + + pthread-config) + # Extract the first word of "pthread-config", so it can be a program name with args. +set dummy pthread-config; 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 : +if ${ac_cv_prog_acx_pthread_config+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. + if test -n "$acx_pthread_config"; then + ac_cv_prog_acx_pthread_config="$acx_pthread_config" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH @@ -14885,7 +14971,7 @@ do test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="$ac_prog" + ac_cv_prog_acx_pthread_config="yes" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -14893,4378 +14979,210 @@ done done IFS=$as_save_IFS + test -z "$ac_cv_prog_acx_pthread_config" && ac_cv_prog_acx_pthread_config="no" 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; } +acx_pthread_config=$ac_cv_prog_acx_pthread_config +if test -n "$acx_pthread_config"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_pthread_config" >&5 +$as_echo "$acx_pthread_config" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi - test -n "$CC" && break -done - - - if test "$CC" = cc ; then - if test $ol_with_threads != auto ; then - as_fn_error $? "--with-threads requires cc_r (or other suitable compiler) on AIX" "$LINENO" 5 - else - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: disabling threads, no cc_r on AIX" >&5 -$as_echo "$as_me: WARNING: disabling threads, no cc_r on AIX" >&2;} - fi - ol_with_threads=no - fi - fi - - case ${CC} in cc_r | xlc_r) - ol_with_threads=posix - ol_cv_pthread_create=yes + if test x"$acx_pthread_config" = xno; then continue; fi + PTHREAD_CFLAGS="`pthread-config --cflags`" + PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`" ;; - esac -fi - -ol_link_threads=no -# OpenLDAP --with-yielding_select - -# Check whether --with-yielding_select was given. -if test "${with_yielding_select+set}" = set; then : - withval=$with_yielding_select; - ol_arg=invalid - for ol_val in auto yes no manual ; do - if test "$withval" = "$ol_val" ; then - ol_arg="$ol_val" - fi - done - if test "$ol_arg" = "invalid" ; then - as_fn_error $? "bad value $withval for --with-yielding_select" "$LINENO" 5 - fi - ol_with_yielding_select="$ol_arg" - -else - ol_with_yielding_select="auto" -fi -# end --with-yielding_select - - -case $ol_with_threads in auto | yes | nt) - - - ac_fn_c_check_func "$LINENO" "_beginthread" "ac_cv_func__beginthread" -if test "x$ac_cv_func__beginthread" = xyes; then : - -fi - - - if test $ac_cv_func__beginthread = yes ; then - -$as_echo "#define HAVE_NT_THREADS 1" >>confdefs.h - - ol_cv_nt_threads=yes - fi - - - if test "$ol_cv_nt_threads" = yes ; then - ol_link_threads=nt - ol_with_threads=found - ol_with_yielding_select=yes - - -$as_echo "#define HAVE_NT_SERVICE_MANAGER 1" >>confdefs.h - - -$as_echo "#define HAVE_NT_EVENT_LOG 1" >>confdefs.h - - fi - - if test $ol_with_threads = nt ; then - as_fn_error $? "could not locate NT Threads" "$LINENO" 5 - fi - ;; -esac - -case $ol_with_threads in auto | yes | posix) - - for ac_header in pthread.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "pthread.h" "ac_cv_header_pthread_h" "$ac_includes_default" -if test "x$ac_cv_header_pthread_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_PTHREAD_H 1 -_ACEOF - -fi - -done - - - if test $ac_cv_header_pthread_h = yes ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking POSIX thread version" >&5 -$as_echo_n "checking POSIX thread version... " >&6; } -if ${ol_cv_pthread_version+:} false; then : - $as_echo_n "(cached) " >&6 -else - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -# include <pthread.h> - -int -main () -{ - - int i = PTHREAD_CREATE_JOINABLE; - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <pthread.h> - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "pthread_detach" >/dev/null 2>&1; then : - ol_cv_pthread_version=10 -else - ol_cv_pthread_version=8 -fi -rm -f conftest* - -else - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -# include <pthread.h> -# ifdef PTHREAD_CREATE_UNDETACHED - draft7 -# endif - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "draft7" >/dev/null 2>&1; then : - ol_cv_pthread_version=7 -else - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <pthread.h> - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "pthread_attr_init" >/dev/null 2>&1; then : - ol_cv_pthread_version=6 -else - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -# include <pthread.h> -#ifdef PTHREAD_MUTEX_INITIALIZER - draft5 -#endif - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "draft5" >/dev/null 2>&1; then : - ol_cv_pthread_version=5 -else - ol_cv_pthread_version=4 -fi -rm -f conftest* - -fi -rm -f conftest* - -fi -rm -f conftest* - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ol_cv_pthread_version" >&5 -$as_echo "$ol_cv_pthread_version" >&6; } - - - if test $ol_cv_pthread_version != 0 ; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_PTHREADS $ol_cv_pthread_version -_ACEOF - - else - as_fn_error $? "unknown pthread version" "$LINENO" 5 - fi - - # consider threads found - ol_with_threads=found - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for LinuxThreads pthread.h" >&5 -$as_echo_n "checking for LinuxThreads pthread.h... " >&6; } -if ${ol_cv_header_linux_threads+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <pthread.h> -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "pthread_kill_other_threads_np" >/dev/null 2>&1; then : - ol_cv_header_linux_threads=yes -else - ol_cv_header_linux_threads=no -fi -rm -f conftest* - - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ol_cv_header_linux_threads" >&5 -$as_echo "$ol_cv_header_linux_threads" >&6; } - if test $ol_cv_header_linux_threads = yes; then - -$as_echo "#define HAVE_LINUX_THREADS 1" >>confdefs.h - - fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU Pth pthread.h" >&5 -$as_echo_n "checking for GNU Pth pthread.h... " >&6; } -if ${ol_cv_header_gnu_pth_pthread_h+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <pthread.h> -#ifdef _POSIX_THREAD_IS_GNU_PTH - __gnu_pth__; -#endif - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "__gnu_pth__" >/dev/null 2>&1; then : - ol_cv_header_gnu_pth_pthread_h=yes -else - ol_cv_header_gnu_pth_pthread_h=no -fi -rm -f conftest* - - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ol_cv_header_gnu_pth_pthread_h" >&5 -$as_echo "$ol_cv_header_gnu_pth_pthread_h" >&6; } - - - if test $ol_cv_header_gnu_pth_pthread_h = no ; then - for ac_header in sched.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "sched.h" "ac_cv_header_sched_h" "$ac_includes_default" -if test "x$ac_cv_header_sched_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_SCHED_H 1 -_ACEOF - -fi - -done - - fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in default libraries" >&5 -$as_echo_n "checking for pthread_create in default libraries... " >&6; } -if ${ol_cv_pthread_create+:} false; then : - $as_echo_n "(cached) " >&6 -else - - if test "$cross_compiling" = yes; then : - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* pthread test headers */ -#include <pthread.h> -#if HAVE_PTHREADS < 7 -#include <errno.h> -#endif -#ifndef NULL -#define NULL (void*)0 -#endif - -static void *task(p) - void *p; -{ - return (void *) (p == NULL); -} - -int -main () -{ - - /* pthread test function */ -#ifndef PTHREAD_CREATE_DETACHED -#define PTHREAD_CREATE_DETACHED 1 -#endif - pthread_t t; - int status; - int detach = PTHREAD_CREATE_DETACHED; - -#if HAVE_PTHREADS > 4 - /* Final pthreads */ - pthread_attr_t attr; - - status = pthread_attr_init(&attr); - if( status ) return status; - -#if HAVE_PTHREADS < 7 - status = pthread_attr_setdetachstate(&attr, &detach); - if( status < 0 ) status = errno; -#else - status = pthread_attr_setdetachstate(&attr, detach); -#endif - if( status ) return status; - status = pthread_create( &t, &attr, task, NULL ); -#if HAVE_PTHREADS < 7 - if( status < 0 ) status = errno; -#endif - if( status ) return status; -#else - /* Draft 4 pthreads */ - status = pthread_create( &t, pthread_attr_default, task, NULL ); - if( status ) return errno; - - /* give thread a chance to complete */ - /* it should remain joinable and hence detachable */ - sleep( 1 ); - - status = pthread_detach( &t ); - if( status ) return errno; -#endif - -#ifdef HAVE_LINUX_THREADS - pthread_kill_other_threads_np(); -#endif - - return 0; - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ol_cv_pthread_create=yes -else - ol_cv_pthread_create=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -/* pthread test headers */ -#include <pthread.h> -#if HAVE_PTHREADS < 7 -#include <errno.h> -#endif -#ifndef NULL -#define NULL (void*)0 -#endif - -static void *task(p) - void *p; -{ - return (void *) (p == NULL); -} - - -int main(argc, argv) - int argc; - char **argv; -{ - - /* pthread test function */ -#ifndef PTHREAD_CREATE_DETACHED -#define PTHREAD_CREATE_DETACHED 1 -#endif - pthread_t t; - int status; - int detach = PTHREAD_CREATE_DETACHED; - -#if HAVE_PTHREADS > 4 - /* Final pthreads */ - pthread_attr_t attr; - - status = pthread_attr_init(&attr); - if( status ) return status; - -#if HAVE_PTHREADS < 7 - status = pthread_attr_setdetachstate(&attr, &detach); - if( status < 0 ) status = errno; -#else - status = pthread_attr_setdetachstate(&attr, detach); -#endif - if( status ) return status; - status = pthread_create( &t, &attr, task, NULL ); -#if HAVE_PTHREADS < 7 - if( status < 0 ) status = errno; -#endif - if( status ) return status; -#else - /* Draft 4 pthreads */ - status = pthread_create( &t, pthread_attr_default, task, NULL ); - if( status ) return errno; - - /* give thread a chance to complete */ - /* it should remain joinable and hence detachable */ - sleep( 1 ); - - status = pthread_detach( &t ); - if( status ) return errno; -#endif - -#ifdef HAVE_LINUX_THREADS - pthread_kill_other_threads_np(); -#endif - - return 0; - -} - -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - ol_cv_pthread_create=yes -else - ol_cv_pthread_create=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ol_cv_pthread_create" >&5 -$as_echo "$ol_cv_pthread_create" >&6; } - - if test $ol_cv_pthread_create != no ; then - ol_link_threads=posix - ol_link_pthreads="" - fi - - # Pthread try link: -kthread (ol_cv_pthread_kthread) -if test "$ol_link_threads" = no ; then - # try -kthread - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread link with -kthread" >&5 -$as_echo_n "checking for pthread link with -kthread... " >&6; } -if ${ol_cv_pthread_kthread+:} false; then : - $as_echo_n "(cached) " >&6 -else - - # save the flags - ol_LIBS="$LIBS" - LIBS="-kthread $LIBS" - - if test "$cross_compiling" = yes; then : - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* pthread test headers */ -#include <pthread.h> -#if HAVE_PTHREADS < 7 -#include <errno.h> -#endif -#ifndef NULL -#define NULL (void*)0 -#endif - -static void *task(p) - void *p; -{ - return (void *) (p == NULL); -} - -int -main () -{ - - /* pthread test function */ -#ifndef PTHREAD_CREATE_DETACHED -#define PTHREAD_CREATE_DETACHED 1 -#endif - pthread_t t; - int status; - int detach = PTHREAD_CREATE_DETACHED; - -#if HAVE_PTHREADS > 4 - /* Final pthreads */ - pthread_attr_t attr; - - status = pthread_attr_init(&attr); - if( status ) return status; - -#if HAVE_PTHREADS < 7 - status = pthread_attr_setdetachstate(&attr, &detach); - if( status < 0 ) status = errno; -#else - status = pthread_attr_setdetachstate(&attr, detach); -#endif - if( status ) return status; - status = pthread_create( &t, &attr, task, NULL ); -#if HAVE_PTHREADS < 7 - if( status < 0 ) status = errno; -#endif - if( status ) return status; -#else - /* Draft 4 pthreads */ - status = pthread_create( &t, pthread_attr_default, task, NULL ); - if( status ) return errno; - - /* give thread a chance to complete */ - /* it should remain joinable and hence detachable */ - sleep( 1 ); - - status = pthread_detach( &t ); - if( status ) return errno; -#endif - -#ifdef HAVE_LINUX_THREADS - pthread_kill_other_threads_np(); -#endif - - return 0; - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ol_cv_pthread_kthread=yes -else - ol_cv_pthread_kthread=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -/* pthread test headers */ -#include <pthread.h> -#if HAVE_PTHREADS < 7 -#include <errno.h> -#endif -#ifndef NULL -#define NULL (void*)0 -#endif - -static void *task(p) - void *p; -{ - return (void *) (p == NULL); -} - - -int main(argc, argv) - int argc; - char **argv; -{ - - /* pthread test function */ -#ifndef PTHREAD_CREATE_DETACHED -#define PTHREAD_CREATE_DETACHED 1 -#endif - pthread_t t; - int status; - int detach = PTHREAD_CREATE_DETACHED; - -#if HAVE_PTHREADS > 4 - /* Final pthreads */ - pthread_attr_t attr; - - status = pthread_attr_init(&attr); - if( status ) return status; - -#if HAVE_PTHREADS < 7 - status = pthread_attr_setdetachstate(&attr, &detach); - if( status < 0 ) status = errno; -#else - status = pthread_attr_setdetachstate(&attr, detach); -#endif - if( status ) return status; - status = pthread_create( &t, &attr, task, NULL ); -#if HAVE_PTHREADS < 7 - if( status < 0 ) status = errno; -#endif - if( status ) return status; -#else - /* Draft 4 pthreads */ - status = pthread_create( &t, pthread_attr_default, task, NULL ); - if( status ) return errno; - - /* give thread a chance to complete */ - /* it should remain joinable and hence detachable */ - sleep( 1 ); - - status = pthread_detach( &t ); - if( status ) return errno; -#endif - -#ifdef HAVE_LINUX_THREADS - pthread_kill_other_threads_np(); -#endif - - return 0; - -} - -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - ol_cv_pthread_kthread=yes -else - ol_cv_pthread_kthread=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - - - # restore the LIBS - LIBS="$ol_LIBS" - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ol_cv_pthread_kthread" >&5 -$as_echo "$ol_cv_pthread_kthread" >&6; } - - if test $ol_cv_pthread_kthread = yes ; then - ol_link_pthreads="-kthread" - ol_link_threads=posix - fi -fi - - # Pthread try link: -pthread (ol_cv_pthread_pthread) -if test "$ol_link_threads" = no ; then - # try -pthread - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread link with -pthread" >&5 -$as_echo_n "checking for pthread link with -pthread... " >&6; } -if ${ol_cv_pthread_pthread+:} false; then : - $as_echo_n "(cached) " >&6 -else - - # save the flags - ol_LIBS="$LIBS" - LIBS="-pthread $LIBS" - - if test "$cross_compiling" = yes; then : - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* pthread test headers */ -#include <pthread.h> -#if HAVE_PTHREADS < 7 -#include <errno.h> -#endif -#ifndef NULL -#define NULL (void*)0 -#endif - -static void *task(p) - void *p; -{ - return (void *) (p == NULL); -} - -int -main () -{ - - /* pthread test function */ -#ifndef PTHREAD_CREATE_DETACHED -#define PTHREAD_CREATE_DETACHED 1 -#endif - pthread_t t; - int status; - int detach = PTHREAD_CREATE_DETACHED; - -#if HAVE_PTHREADS > 4 - /* Final pthreads */ - pthread_attr_t attr; - - status = pthread_attr_init(&attr); - if( status ) return status; - -#if HAVE_PTHREADS < 7 - status = pthread_attr_setdetachstate(&attr, &detach); - if( status < 0 ) status = errno; -#else - status = pthread_attr_setdetachstate(&attr, detach); -#endif - if( status ) return status; - status = pthread_create( &t, &attr, task, NULL ); -#if HAVE_PTHREADS < 7 - if( status < 0 ) status = errno; -#endif - if( status ) return status; -#else - /* Draft 4 pthreads */ - status = pthread_create( &t, pthread_attr_default, task, NULL ); - if( status ) return errno; - - /* give thread a chance to complete */ - /* it should remain joinable and hence detachable */ - sleep( 1 ); - - status = pthread_detach( &t ); - if( status ) return errno; -#endif - -#ifdef HAVE_LINUX_THREADS - pthread_kill_other_threads_np(); -#endif - - return 0; - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ol_cv_pthread_pthread=yes -else - ol_cv_pthread_pthread=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -/* pthread test headers */ -#include <pthread.h> -#if HAVE_PTHREADS < 7 -#include <errno.h> -#endif -#ifndef NULL -#define NULL (void*)0 -#endif - -static void *task(p) - void *p; -{ - return (void *) (p == NULL); -} - - -int main(argc, argv) - int argc; - char **argv; -{ - - /* pthread test function */ -#ifndef PTHREAD_CREATE_DETACHED -#define PTHREAD_CREATE_DETACHED 1 -#endif - pthread_t t; - int status; - int detach = PTHREAD_CREATE_DETACHED; - -#if HAVE_PTHREADS > 4 - /* Final pthreads */ - pthread_attr_t attr; - - status = pthread_attr_init(&attr); - if( status ) return status; - -#if HAVE_PTHREADS < 7 - status = pthread_attr_setdetachstate(&attr, &detach); - if( status < 0 ) status = errno; -#else - status = pthread_attr_setdetachstate(&attr, detach); -#endif - if( status ) return status; - status = pthread_create( &t, &attr, task, NULL ); -#if HAVE_PTHREADS < 7 - if( status < 0 ) status = errno; -#endif - if( status ) return status; -#else - /* Draft 4 pthreads */ - status = pthread_create( &t, pthread_attr_default, task, NULL ); - if( status ) return errno; - - /* give thread a chance to complete */ - /* it should remain joinable and hence detachable */ - sleep( 1 ); - - status = pthread_detach( &t ); - if( status ) return errno; -#endif - -#ifdef HAVE_LINUX_THREADS - pthread_kill_other_threads_np(); -#endif - - return 0; - -} - -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - ol_cv_pthread_pthread=yes -else - ol_cv_pthread_pthread=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - - - # restore the LIBS - LIBS="$ol_LIBS" - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ol_cv_pthread_pthread" >&5 -$as_echo "$ol_cv_pthread_pthread" >&6; } - - if test $ol_cv_pthread_pthread = yes ; then - ol_link_pthreads="-pthread" - ol_link_threads=posix - fi -fi - - # Pthread try link: -pthreads (ol_cv_pthread_pthreads) -if test "$ol_link_threads" = no ; then - # try -pthreads - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread link with -pthreads" >&5 -$as_echo_n "checking for pthread link with -pthreads... " >&6; } -if ${ol_cv_pthread_pthreads+:} false; then : - $as_echo_n "(cached) " >&6 -else - - # save the flags - ol_LIBS="$LIBS" - LIBS="-pthreads $LIBS" - - if test "$cross_compiling" = yes; then : - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* pthread test headers */ -#include <pthread.h> -#if HAVE_PTHREADS < 7 -#include <errno.h> -#endif -#ifndef NULL -#define NULL (void*)0 -#endif - -static void *task(p) - void *p; -{ - return (void *) (p == NULL); -} - -int -main () -{ - - /* pthread test function */ -#ifndef PTHREAD_CREATE_DETACHED -#define PTHREAD_CREATE_DETACHED 1 -#endif - pthread_t t; - int status; - int detach = PTHREAD_CREATE_DETACHED; - -#if HAVE_PTHREADS > 4 - /* Final pthreads */ - pthread_attr_t attr; - - status = pthread_attr_init(&attr); - if( status ) return status; - -#if HAVE_PTHREADS < 7 - status = pthread_attr_setdetachstate(&attr, &detach); - if( status < 0 ) status = errno; -#else - status = pthread_attr_setdetachstate(&attr, detach); -#endif - if( status ) return status; - status = pthread_create( &t, &attr, task, NULL ); -#if HAVE_PTHREADS < 7 - if( status < 0 ) status = errno; -#endif - if( status ) return status; -#else - /* Draft 4 pthreads */ - status = pthread_create( &t, pthread_attr_default, task, NULL ); - if( status ) return errno; - - /* give thread a chance to complete */ - /* it should remain joinable and hence detachable */ - sleep( 1 ); - - status = pthread_detach( &t ); - if( status ) return errno; -#endif - -#ifdef HAVE_LINUX_THREADS - pthread_kill_other_threads_np(); -#endif - - return 0; - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ol_cv_pthread_pthreads=yes -else - ol_cv_pthread_pthreads=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -/* pthread test headers */ -#include <pthread.h> -#if HAVE_PTHREADS < 7 -#include <errno.h> -#endif -#ifndef NULL -#define NULL (void*)0 -#endif - -static void *task(p) - void *p; -{ - return (void *) (p == NULL); -} - - -int main(argc, argv) - int argc; - char **argv; -{ - - /* pthread test function */ -#ifndef PTHREAD_CREATE_DETACHED -#define PTHREAD_CREATE_DETACHED 1 -#endif - pthread_t t; - int status; - int detach = PTHREAD_CREATE_DETACHED; - -#if HAVE_PTHREADS > 4 - /* Final pthreads */ - pthread_attr_t attr; - - status = pthread_attr_init(&attr); - if( status ) return status; - -#if HAVE_PTHREADS < 7 - status = pthread_attr_setdetachstate(&attr, &detach); - if( status < 0 ) status = errno; -#else - status = pthread_attr_setdetachstate(&attr, detach); -#endif - if( status ) return status; - status = pthread_create( &t, &attr, task, NULL ); -#if HAVE_PTHREADS < 7 - if( status < 0 ) status = errno; -#endif - if( status ) return status; -#else - /* Draft 4 pthreads */ - status = pthread_create( &t, pthread_attr_default, task, NULL ); - if( status ) return errno; - - /* give thread a chance to complete */ - /* it should remain joinable and hence detachable */ - sleep( 1 ); - - status = pthread_detach( &t ); - if( status ) return errno; -#endif - -#ifdef HAVE_LINUX_THREADS - pthread_kill_other_threads_np(); -#endif - - return 0; - -} - -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - ol_cv_pthread_pthreads=yes -else - ol_cv_pthread_pthreads=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - - # restore the LIBS - LIBS="$ol_LIBS" - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ol_cv_pthread_pthreads" >&5 -$as_echo "$ol_cv_pthread_pthreads" >&6; } - - if test $ol_cv_pthread_pthreads = yes ; then - ol_link_pthreads="-pthreads" - ol_link_threads=posix - fi -fi - - # Pthread try link: -mthreads (ol_cv_pthread_mthreads) -if test "$ol_link_threads" = no ; then - # try -mthreads - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread link with -mthreads" >&5 -$as_echo_n "checking for pthread link with -mthreads... " >&6; } -if ${ol_cv_pthread_mthreads+:} false; then : - $as_echo_n "(cached) " >&6 -else - - # save the flags - ol_LIBS="$LIBS" - LIBS="-mthreads $LIBS" - - if test "$cross_compiling" = yes; then : - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* pthread test headers */ -#include <pthread.h> -#if HAVE_PTHREADS < 7 -#include <errno.h> -#endif -#ifndef NULL -#define NULL (void*)0 -#endif - -static void *task(p) - void *p; -{ - return (void *) (p == NULL); -} - -int -main () -{ - - /* pthread test function */ -#ifndef PTHREAD_CREATE_DETACHED -#define PTHREAD_CREATE_DETACHED 1 -#endif - pthread_t t; - int status; - int detach = PTHREAD_CREATE_DETACHED; - -#if HAVE_PTHREADS > 4 - /* Final pthreads */ - pthread_attr_t attr; - - status = pthread_attr_init(&attr); - if( status ) return status; - -#if HAVE_PTHREADS < 7 - status = pthread_attr_setdetachstate(&attr, &detach); - if( status < 0 ) status = errno; -#else - status = pthread_attr_setdetachstate(&attr, detach); -#endif - if( status ) return status; - status = pthread_create( &t, &attr, task, NULL ); -#if HAVE_PTHREADS < 7 - if( status < 0 ) status = errno; -#endif - if( status ) return status; -#else - /* Draft 4 pthreads */ - status = pthread_create( &t, pthread_attr_default, task, NULL ); - if( status ) return errno; - - /* give thread a chance to complete */ - /* it should remain joinable and hence detachable */ - sleep( 1 ); - - status = pthread_detach( &t ); - if( status ) return errno; -#endif - -#ifdef HAVE_LINUX_THREADS - pthread_kill_other_threads_np(); -#endif - - return 0; - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ol_cv_pthread_mthreads=yes -else - ol_cv_pthread_mthreads=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -/* pthread test headers */ -#include <pthread.h> -#if HAVE_PTHREADS < 7 -#include <errno.h> -#endif -#ifndef NULL -#define NULL (void*)0 -#endif - -static void *task(p) - void *p; -{ - return (void *) (p == NULL); -} - - -int main(argc, argv) - int argc; - char **argv; -{ - - /* pthread test function */ -#ifndef PTHREAD_CREATE_DETACHED -#define PTHREAD_CREATE_DETACHED 1 -#endif - pthread_t t; - int status; - int detach = PTHREAD_CREATE_DETACHED; - -#if HAVE_PTHREADS > 4 - /* Final pthreads */ - pthread_attr_t attr; - - status = pthread_attr_init(&attr); - if( status ) return status; - -#if HAVE_PTHREADS < 7 - status = pthread_attr_setdetachstate(&attr, &detach); - if( status < 0 ) status = errno; -#else - status = pthread_attr_setdetachstate(&attr, detach); -#endif - if( status ) return status; - status = pthread_create( &t, &attr, task, NULL ); -#if HAVE_PTHREADS < 7 - if( status < 0 ) status = errno; -#endif - if( status ) return status; -#else - /* Draft 4 pthreads */ - status = pthread_create( &t, pthread_attr_default, task, NULL ); - if( status ) return errno; - - /* give thread a chance to complete */ - /* it should remain joinable and hence detachable */ - sleep( 1 ); - - status = pthread_detach( &t ); - if( status ) return errno; -#endif - -#ifdef HAVE_LINUX_THREADS - pthread_kill_other_threads_np(); -#endif - - return 0; - -} - -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - ol_cv_pthread_mthreads=yes -else - ol_cv_pthread_mthreads=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - - - # restore the LIBS - LIBS="$ol_LIBS" - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ol_cv_pthread_mthreads" >&5 -$as_echo "$ol_cv_pthread_mthreads" >&6; } - - if test $ol_cv_pthread_mthreads = yes ; then - ol_link_pthreads="-mthreads" - ol_link_threads=posix - fi -fi - - # Pthread try link: -thread (ol_cv_pthread_thread) -if test "$ol_link_threads" = no ; then - # try -thread - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread link with -thread" >&5 -$as_echo_n "checking for pthread link with -thread... " >&6; } -if ${ol_cv_pthread_thread+:} false; then : - $as_echo_n "(cached) " >&6 -else - - # save the flags - ol_LIBS="$LIBS" - LIBS="-thread $LIBS" - - if test "$cross_compiling" = yes; then : - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the pthreads library -l$flag" >&5 +$as_echo_n "checking for the pthreads library -l$flag... " >&6; } + PTHREAD_LIBS="-l$flag" + ;; + esac + + save_LIBS="$LIBS" + save_CFLAGS="$CFLAGS" + LIBS="$PTHREAD_LIBS $LIBS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + + # Check for various functions. We must include pthread.h, + # since some functions may be macros. (On the Sequent, we + # need a special flag -Kthread to make this header compile.) + # We check for pthread_join because it is in -lpthread on IRIX + # while pthread_create is in libc. We check for pthread_attr_init + # due to DEC craziness with -lpthreads. We check for + # pthread_cleanup_push because it is one of the few pthread + # functions on Solaris that doesn't have a non-functional libc stub. + # We try pthread_create on general principles. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - -/* pthread test headers */ #include <pthread.h> -#if HAVE_PTHREADS < 7 -#include <errno.h> -#endif -#ifndef NULL -#define NULL (void*)0 -#endif - -static void *task(p) - void *p; -{ - return (void *) (p == NULL); -} - int main () { - - /* pthread test function */ -#ifndef PTHREAD_CREATE_DETACHED -#define PTHREAD_CREATE_DETACHED 1 -#endif - pthread_t t; - int status; - int detach = PTHREAD_CREATE_DETACHED; - -#if HAVE_PTHREADS > 4 - /* Final pthreads */ - pthread_attr_t attr; - - status = pthread_attr_init(&attr); - if( status ) return status; - -#if HAVE_PTHREADS < 7 - status = pthread_attr_setdetachstate(&attr, &detach); - if( status < 0 ) status = errno; -#else - status = pthread_attr_setdetachstate(&attr, detach); -#endif - if( status ) return status; - status = pthread_create( &t, &attr, task, NULL ); -#if HAVE_PTHREADS < 7 - if( status < 0 ) status = errno; -#endif - if( status ) return status; -#else - /* Draft 4 pthreads */ - status = pthread_create( &t, pthread_attr_default, task, NULL ); - if( status ) return errno; - - /* give thread a chance to complete */ - /* it should remain joinable and hence detachable */ - sleep( 1 ); - - status = pthread_detach( &t ); - if( status ) return errno; -#endif - -#ifdef HAVE_LINUX_THREADS - pthread_kill_other_threads_np(); -#endif - - return 0; - +pthread_t th; pthread_join(th, 0); + pthread_attr_init(0); pthread_cleanup_push(0, 0); + pthread_create(0,0,0,0); pthread_cleanup_pop(0); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - ol_cv_pthread_thread=yes -else - ol_cv_pthread_thread=no + acx_pthread_ok=yes fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -/* pthread test headers */ -#include <pthread.h> -#if HAVE_PTHREADS < 7 -#include <errno.h> -#endif -#ifndef NULL -#define NULL (void*)0 -#endif - -static void *task(p) - void *p; -{ - return (void *) (p == NULL); -} - - -int main(argc, argv) - int argc; - char **argv; -{ - - /* pthread test function */ -#ifndef PTHREAD_CREATE_DETACHED -#define PTHREAD_CREATE_DETACHED 1 -#endif - pthread_t t; - int status; - int detach = PTHREAD_CREATE_DETACHED; -#if HAVE_PTHREADS > 4 - /* Final pthreads */ - pthread_attr_t attr; - - status = pthread_attr_init(&attr); - if( status ) return status; - -#if HAVE_PTHREADS < 7 - status = pthread_attr_setdetachstate(&attr, &detach); - if( status < 0 ) status = errno; -#else - status = pthread_attr_setdetachstate(&attr, detach); -#endif - if( status ) return status; - status = pthread_create( &t, &attr, task, NULL ); -#if HAVE_PTHREADS < 7 - if( status < 0 ) status = errno; -#endif - if( status ) return status; -#else - /* Draft 4 pthreads */ - status = pthread_create( &t, pthread_attr_default, task, NULL ); - if( status ) return errno; - - /* give thread a chance to complete */ - /* it should remain joinable and hence detachable */ - sleep( 1 ); - - status = pthread_detach( &t ); - if( status ) return errno; -#endif - -#ifdef HAVE_LINUX_THREADS - pthread_kill_other_threads_np(); -#endif - - return 0; - -} - -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - ol_cv_pthread_thread=yes -else - ol_cv_pthread_thread=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - - - # restore the LIBS - LIBS="$ol_LIBS" - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ol_cv_pthread_thread" >&5 -$as_echo "$ol_cv_pthread_thread" >&6; } - - if test $ol_cv_pthread_thread = yes ; then - ol_link_pthreads="-thread" - ol_link_threads=posix - fi -fi - - - # Pthread try link: -lpthread -lmach -lexc -lc_r (ol_cv_pthread_lpthread_lmach_lexc_lc_r) -if test "$ol_link_threads" = no ; then - # try -lpthread -lmach -lexc -lc_r - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread link with -lpthread -lmach -lexc -lc_r" >&5 -$as_echo_n "checking for pthread link with -lpthread -lmach -lexc -lc_r... " >&6; } -if ${ol_cv_pthread_lpthread_lmach_lexc_lc_r+:} false; then : - $as_echo_n "(cached) " >&6 -else - - # save the flags - ol_LIBS="$LIBS" - LIBS="-lpthread -lmach -lexc -lc_r $LIBS" - - if test "$cross_compiling" = yes; then : - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* pthread test headers */ -#include <pthread.h> -#if HAVE_PTHREADS < 7 -#include <errno.h> -#endif -#ifndef NULL -#define NULL (void*)0 -#endif - -static void *task(p) - void *p; -{ - return (void *) (p == NULL); -} - -int -main () -{ - - /* pthread test function */ -#ifndef PTHREAD_CREATE_DETACHED -#define PTHREAD_CREATE_DETACHED 1 -#endif - pthread_t t; - int status; - int detach = PTHREAD_CREATE_DETACHED; - -#if HAVE_PTHREADS > 4 - /* Final pthreads */ - pthread_attr_t attr; - - status = pthread_attr_init(&attr); - if( status ) return status; - -#if HAVE_PTHREADS < 7 - status = pthread_attr_setdetachstate(&attr, &detach); - if( status < 0 ) status = errno; -#else - status = pthread_attr_setdetachstate(&attr, detach); -#endif - if( status ) return status; - status = pthread_create( &t, &attr, task, NULL ); -#if HAVE_PTHREADS < 7 - if( status < 0 ) status = errno; -#endif - if( status ) return status; -#else - /* Draft 4 pthreads */ - status = pthread_create( &t, pthread_attr_default, task, NULL ); - if( status ) return errno; - - /* give thread a chance to complete */ - /* it should remain joinable and hence detachable */ - sleep( 1 ); - - status = pthread_detach( &t ); - if( status ) return errno; -#endif - -#ifdef HAVE_LINUX_THREADS - pthread_kill_other_threads_np(); -#endif - - return 0; - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ol_cv_pthread_lpthread_lmach_lexc_lc_r=yes -else - ol_cv_pthread_lpthread_lmach_lexc_lc_r=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -/* pthread test headers */ -#include <pthread.h> -#if HAVE_PTHREADS < 7 -#include <errno.h> -#endif -#ifndef NULL -#define NULL (void*)0 -#endif - -static void *task(p) - void *p; -{ - return (void *) (p == NULL); -} - - -int main(argc, argv) - int argc; - char **argv; -{ - - /* pthread test function */ -#ifndef PTHREAD_CREATE_DETACHED -#define PTHREAD_CREATE_DETACHED 1 -#endif - pthread_t t; - int status; - int detach = PTHREAD_CREATE_DETACHED; - -#if HAVE_PTHREADS > 4 - /* Final pthreads */ - pthread_attr_t attr; - - status = pthread_attr_init(&attr); - if( status ) return status; - -#if HAVE_PTHREADS < 7 - status = pthread_attr_setdetachstate(&attr, &detach); - if( status < 0 ) status = errno; -#else - status = pthread_attr_setdetachstate(&attr, detach); -#endif - if( status ) return status; - status = pthread_create( &t, &attr, task, NULL ); -#if HAVE_PTHREADS < 7 - if( status < 0 ) status = errno; -#endif - if( status ) return status; -#else - /* Draft 4 pthreads */ - status = pthread_create( &t, pthread_attr_default, task, NULL ); - if( status ) return errno; - - /* give thread a chance to complete */ - /* it should remain joinable and hence detachable */ - sleep( 1 ); - - status = pthread_detach( &t ); - if( status ) return errno; -#endif - -#ifdef HAVE_LINUX_THREADS - pthread_kill_other_threads_np(); -#endif - - return 0; - -} - -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - ol_cv_pthread_lpthread_lmach_lexc_lc_r=yes -else - ol_cv_pthread_lpthread_lmach_lexc_lc_r=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - - - # restore the LIBS - LIBS="$ol_LIBS" - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ol_cv_pthread_lpthread_lmach_lexc_lc_r" >&5 -$as_echo "$ol_cv_pthread_lpthread_lmach_lexc_lc_r" >&6; } - - if test $ol_cv_pthread_lpthread_lmach_lexc_lc_r = yes ; then - ol_link_pthreads="-lpthread -lmach -lexc -lc_r" - ol_link_threads=posix - fi -fi - - # Pthread try link: -lpthread -lmach -lexc (ol_cv_pthread_lpthread_lmach_lexc) -if test "$ol_link_threads" = no ; then - # try -lpthread -lmach -lexc - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread link with -lpthread -lmach -lexc" >&5 -$as_echo_n "checking for pthread link with -lpthread -lmach -lexc... " >&6; } -if ${ol_cv_pthread_lpthread_lmach_lexc+:} false; then : - $as_echo_n "(cached) " >&6 -else - - # save the flags - ol_LIBS="$LIBS" - LIBS="-lpthread -lmach -lexc $LIBS" - - if test "$cross_compiling" = yes; then : - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* pthread test headers */ -#include <pthread.h> -#if HAVE_PTHREADS < 7 -#include <errno.h> -#endif -#ifndef NULL -#define NULL (void*)0 -#endif - -static void *task(p) - void *p; -{ - return (void *) (p == NULL); -} - -int -main () -{ - - /* pthread test function */ -#ifndef PTHREAD_CREATE_DETACHED -#define PTHREAD_CREATE_DETACHED 1 -#endif - pthread_t t; - int status; - int detach = PTHREAD_CREATE_DETACHED; - -#if HAVE_PTHREADS > 4 - /* Final pthreads */ - pthread_attr_t attr; - - status = pthread_attr_init(&attr); - if( status ) return status; - -#if HAVE_PTHREADS < 7 - status = pthread_attr_setdetachstate(&attr, &detach); - if( status < 0 ) status = errno; -#else - status = pthread_attr_setdetachstate(&attr, detach); -#endif - if( status ) return status; - status = pthread_create( &t, &attr, task, NULL ); -#if HAVE_PTHREADS < 7 - if( status < 0 ) status = errno; -#endif - if( status ) return status; -#else - /* Draft 4 pthreads */ - status = pthread_create( &t, pthread_attr_default, task, NULL ); - if( status ) return errno; - - /* give thread a chance to complete */ - /* it should remain joinable and hence detachable */ - sleep( 1 ); - - status = pthread_detach( &t ); - if( status ) return errno; -#endif - -#ifdef HAVE_LINUX_THREADS - pthread_kill_other_threads_np(); -#endif - - return 0; - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ol_cv_pthread_lpthread_lmach_lexc=yes -else - ol_cv_pthread_lpthread_lmach_lexc=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -/* pthread test headers */ -#include <pthread.h> -#if HAVE_PTHREADS < 7 -#include <errno.h> -#endif -#ifndef NULL -#define NULL (void*)0 -#endif - -static void *task(p) - void *p; -{ - return (void *) (p == NULL); -} - - -int main(argc, argv) - int argc; - char **argv; -{ - - /* pthread test function */ -#ifndef PTHREAD_CREATE_DETACHED -#define PTHREAD_CREATE_DETACHED 1 -#endif - pthread_t t; - int status; - int detach = PTHREAD_CREATE_DETACHED; - -#if HAVE_PTHREADS > 4 - /* Final pthreads */ - pthread_attr_t attr; - - status = pthread_attr_init(&attr); - if( status ) return status; - -#if HAVE_PTHREADS < 7 - status = pthread_attr_setdetachstate(&attr, &detach); - if( status < 0 ) status = errno; -#else - status = pthread_attr_setdetachstate(&attr, detach); -#endif - if( status ) return status; - status = pthread_create( &t, &attr, task, NULL ); -#if HAVE_PTHREADS < 7 - if( status < 0 ) status = errno; -#endif - if( status ) return status; -#else - /* Draft 4 pthreads */ - status = pthread_create( &t, pthread_attr_default, task, NULL ); - if( status ) return errno; - - /* give thread a chance to complete */ - /* it should remain joinable and hence detachable */ - sleep( 1 ); - - status = pthread_detach( &t ); - if( status ) return errno; -#endif - -#ifdef HAVE_LINUX_THREADS - pthread_kill_other_threads_np(); -#endif - - return 0; - -} - -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - ol_cv_pthread_lpthread_lmach_lexc=yes -else - ol_cv_pthread_lpthread_lmach_lexc=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - - - # restore the LIBS - LIBS="$ol_LIBS" - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ol_cv_pthread_lpthread_lmach_lexc" >&5 -$as_echo "$ol_cv_pthread_lpthread_lmach_lexc" >&6; } - - if test $ol_cv_pthread_lpthread_lmach_lexc = yes ; then - ol_link_pthreads="-lpthread -lmach -lexc" - ol_link_threads=posix - fi -fi - - - # Pthread try link: -lpthread -Wl,-woff,85 (ol_cv_pthread_lib_lpthread_woff) -if test "$ol_link_threads" = no ; then - # try -lpthread -Wl,-woff,85 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread link with -lpthread -Wl,-woff,85" >&5 -$as_echo_n "checking for pthread link with -lpthread -Wl,-woff,85... " >&6; } -if ${ol_cv_pthread_lib_lpthread_woff+:} false; then : - $as_echo_n "(cached) " >&6 -else - - # save the flags - ol_LIBS="$LIBS" - LIBS="-lpthread -Wl,-woff,85 $LIBS" - - if test "$cross_compiling" = yes; then : - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* pthread test headers */ -#include <pthread.h> -#if HAVE_PTHREADS < 7 -#include <errno.h> -#endif -#ifndef NULL -#define NULL (void*)0 -#endif - -static void *task(p) - void *p; -{ - return (void *) (p == NULL); -} - -int -main () -{ - - /* pthread test function */ -#ifndef PTHREAD_CREATE_DETACHED -#define PTHREAD_CREATE_DETACHED 1 -#endif - pthread_t t; - int status; - int detach = PTHREAD_CREATE_DETACHED; - -#if HAVE_PTHREADS > 4 - /* Final pthreads */ - pthread_attr_t attr; - - status = pthread_attr_init(&attr); - if( status ) return status; - -#if HAVE_PTHREADS < 7 - status = pthread_attr_setdetachstate(&attr, &detach); - if( status < 0 ) status = errno; -#else - status = pthread_attr_setdetachstate(&attr, detach); -#endif - if( status ) return status; - status = pthread_create( &t, &attr, task, NULL ); -#if HAVE_PTHREADS < 7 - if( status < 0 ) status = errno; -#endif - if( status ) return status; -#else - /* Draft 4 pthreads */ - status = pthread_create( &t, pthread_attr_default, task, NULL ); - if( status ) return errno; - - /* give thread a chance to complete */ - /* it should remain joinable and hence detachable */ - sleep( 1 ); - - status = pthread_detach( &t ); - if( status ) return errno; -#endif - -#ifdef HAVE_LINUX_THREADS - pthread_kill_other_threads_np(); -#endif - - return 0; - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ol_cv_pthread_lib_lpthread_woff=yes -else - ol_cv_pthread_lib_lpthread_woff=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -/* pthread test headers */ -#include <pthread.h> -#if HAVE_PTHREADS < 7 -#include <errno.h> -#endif -#ifndef NULL -#define NULL (void*)0 -#endif - -static void *task(p) - void *p; -{ - return (void *) (p == NULL); -} - - -int main(argc, argv) - int argc; - char **argv; -{ - - /* pthread test function */ -#ifndef PTHREAD_CREATE_DETACHED -#define PTHREAD_CREATE_DETACHED 1 -#endif - pthread_t t; - int status; - int detach = PTHREAD_CREATE_DETACHED; - -#if HAVE_PTHREADS > 4 - /* Final pthreads */ - pthread_attr_t attr; - - status = pthread_attr_init(&attr); - if( status ) return status; - -#if HAVE_PTHREADS < 7 - status = pthread_attr_setdetachstate(&attr, &detach); - if( status < 0 ) status = errno; -#else - status = pthread_attr_setdetachstate(&attr, detach); -#endif - if( status ) return status; - status = pthread_create( &t, &attr, task, NULL ); -#if HAVE_PTHREADS < 7 - if( status < 0 ) status = errno; -#endif - if( status ) return status; -#else - /* Draft 4 pthreads */ - status = pthread_create( &t, pthread_attr_default, task, NULL ); - if( status ) return errno; - - /* give thread a chance to complete */ - /* it should remain joinable and hence detachable */ - sleep( 1 ); - - status = pthread_detach( &t ); - if( status ) return errno; -#endif - -#ifdef HAVE_LINUX_THREADS - pthread_kill_other_threads_np(); -#endif - - return 0; - -} - -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - ol_cv_pthread_lib_lpthread_woff=yes -else - ol_cv_pthread_lib_lpthread_woff=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - - - # restore the LIBS - LIBS="$ol_LIBS" - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ol_cv_pthread_lib_lpthread_woff" >&5 -$as_echo "$ol_cv_pthread_lib_lpthread_woff" >&6; } - - if test $ol_cv_pthread_lib_lpthread_woff = yes ; then - ol_link_pthreads="-lpthread -Wl,-woff,85" - ol_link_threads=posix - fi -fi - - - # Pthread try link: -lpthread (ol_cv_pthread_lpthread) -if test "$ol_link_threads" = no ; then - # try -lpthread - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread link with -lpthread" >&5 -$as_echo_n "checking for pthread link with -lpthread... " >&6; } -if ${ol_cv_pthread_lpthread+:} false; then : - $as_echo_n "(cached) " >&6 -else - - # save the flags - ol_LIBS="$LIBS" - LIBS="-lpthread $LIBS" - - if test "$cross_compiling" = yes; then : - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* pthread test headers */ -#include <pthread.h> -#if HAVE_PTHREADS < 7 -#include <errno.h> -#endif -#ifndef NULL -#define NULL (void*)0 -#endif - -static void *task(p) - void *p; -{ - return (void *) (p == NULL); -} - -int -main () -{ - - /* pthread test function */ -#ifndef PTHREAD_CREATE_DETACHED -#define PTHREAD_CREATE_DETACHED 1 -#endif - pthread_t t; - int status; - int detach = PTHREAD_CREATE_DETACHED; - -#if HAVE_PTHREADS > 4 - /* Final pthreads */ - pthread_attr_t attr; - - status = pthread_attr_init(&attr); - if( status ) return status; - -#if HAVE_PTHREADS < 7 - status = pthread_attr_setdetachstate(&attr, &detach); - if( status < 0 ) status = errno; -#else - status = pthread_attr_setdetachstate(&attr, detach); -#endif - if( status ) return status; - status = pthread_create( &t, &attr, task, NULL ); -#if HAVE_PTHREADS < 7 - if( status < 0 ) status = errno; -#endif - if( status ) return status; -#else - /* Draft 4 pthreads */ - status = pthread_create( &t, pthread_attr_default, task, NULL ); - if( status ) return errno; - - /* give thread a chance to complete */ - /* it should remain joinable and hence detachable */ - sleep( 1 ); - - status = pthread_detach( &t ); - if( status ) return errno; -#endif - -#ifdef HAVE_LINUX_THREADS - pthread_kill_other_threads_np(); -#endif - - return 0; - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ol_cv_pthread_lpthread=yes -else - ol_cv_pthread_lpthread=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -/* pthread test headers */ -#include <pthread.h> -#if HAVE_PTHREADS < 7 -#include <errno.h> -#endif -#ifndef NULL -#define NULL (void*)0 -#endif - -static void *task(p) - void *p; -{ - return (void *) (p == NULL); -} - - -int main(argc, argv) - int argc; - char **argv; -{ - - /* pthread test function */ -#ifndef PTHREAD_CREATE_DETACHED -#define PTHREAD_CREATE_DETACHED 1 -#endif - pthread_t t; - int status; - int detach = PTHREAD_CREATE_DETACHED; - -#if HAVE_PTHREADS > 4 - /* Final pthreads */ - pthread_attr_t attr; - - status = pthread_attr_init(&attr); - if( status ) return status; - -#if HAVE_PTHREADS < 7 - status = pthread_attr_setdetachstate(&attr, &detach); - if( status < 0 ) status = errno; -#else - status = pthread_attr_setdetachstate(&attr, detach); -#endif - if( status ) return status; - status = pthread_create( &t, &attr, task, NULL ); -#if HAVE_PTHREADS < 7 - if( status < 0 ) status = errno; -#endif - if( status ) return status; -#else - /* Draft 4 pthreads */ - status = pthread_create( &t, pthread_attr_default, task, NULL ); - if( status ) return errno; - - /* give thread a chance to complete */ - /* it should remain joinable and hence detachable */ - sleep( 1 ); - - status = pthread_detach( &t ); - if( status ) return errno; -#endif - -#ifdef HAVE_LINUX_THREADS - pthread_kill_other_threads_np(); -#endif - - return 0; - -} - -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - ol_cv_pthread_lpthread=yes -else - ol_cv_pthread_lpthread=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - - - # restore the LIBS - LIBS="$ol_LIBS" - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ol_cv_pthread_lpthread" >&5 -$as_echo "$ol_cv_pthread_lpthread" >&6; } - - if test $ol_cv_pthread_lpthread = yes ; then - ol_link_pthreads="-lpthread" - ol_link_threads=posix - fi -fi - - # Pthread try link: -lc_r (ol_cv_pthread_lc_r) -if test "$ol_link_threads" = no ; then - # try -lc_r - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread link with -lc_r" >&5 -$as_echo_n "checking for pthread link with -lc_r... " >&6; } -if ${ol_cv_pthread_lc_r+:} false; then : - $as_echo_n "(cached) " >&6 -else - - # save the flags - ol_LIBS="$LIBS" - LIBS="-lc_r $LIBS" - - if test "$cross_compiling" = yes; then : - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* pthread test headers */ -#include <pthread.h> -#if HAVE_PTHREADS < 7 -#include <errno.h> -#endif -#ifndef NULL -#define NULL (void*)0 -#endif - -static void *task(p) - void *p; -{ - return (void *) (p == NULL); -} - -int -main () -{ - - /* pthread test function */ -#ifndef PTHREAD_CREATE_DETACHED -#define PTHREAD_CREATE_DETACHED 1 -#endif - pthread_t t; - int status; - int detach = PTHREAD_CREATE_DETACHED; - -#if HAVE_PTHREADS > 4 - /* Final pthreads */ - pthread_attr_t attr; - - status = pthread_attr_init(&attr); - if( status ) return status; - -#if HAVE_PTHREADS < 7 - status = pthread_attr_setdetachstate(&attr, &detach); - if( status < 0 ) status = errno; -#else - status = pthread_attr_setdetachstate(&attr, detach); -#endif - if( status ) return status; - status = pthread_create( &t, &attr, task, NULL ); -#if HAVE_PTHREADS < 7 - if( status < 0 ) status = errno; -#endif - if( status ) return status; -#else - /* Draft 4 pthreads */ - status = pthread_create( &t, pthread_attr_default, task, NULL ); - if( status ) return errno; - - /* give thread a chance to complete */ - /* it should remain joinable and hence detachable */ - sleep( 1 ); - - status = pthread_detach( &t ); - if( status ) return errno; -#endif + LIBS="$save_LIBS" + CFLAGS="$save_CFLAGS" -#ifdef HAVE_LINUX_THREADS - pthread_kill_other_threads_np(); -#endif - - return 0; - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ol_cv_pthread_lc_r=yes -else - ol_cv_pthread_lc_r=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -/* pthread test headers */ -#include <pthread.h> -#if HAVE_PTHREADS < 7 -#include <errno.h> -#endif -#ifndef NULL -#define NULL (void*)0 -#endif - -static void *task(p) - void *p; -{ - return (void *) (p == NULL); -} - - -int main(argc, argv) - int argc; - char **argv; -{ - - /* pthread test function */ -#ifndef PTHREAD_CREATE_DETACHED -#define PTHREAD_CREATE_DETACHED 1 -#endif - pthread_t t; - int status; - int detach = PTHREAD_CREATE_DETACHED; - -#if HAVE_PTHREADS > 4 - /* Final pthreads */ - pthread_attr_t attr; - - status = pthread_attr_init(&attr); - if( status ) return status; - -#if HAVE_PTHREADS < 7 - status = pthread_attr_setdetachstate(&attr, &detach); - if( status < 0 ) status = errno; -#else - status = pthread_attr_setdetachstate(&attr, detach); -#endif - if( status ) return status; - status = pthread_create( &t, &attr, task, NULL ); -#if HAVE_PTHREADS < 7 - if( status < 0 ) status = errno; -#endif - if( status ) return status; -#else - /* Draft 4 pthreads */ - status = pthread_create( &t, pthread_attr_default, task, NULL ); - if( status ) return errno; - - /* give thread a chance to complete */ - /* it should remain joinable and hence detachable */ - sleep( 1 ); - - status = pthread_detach( &t ); - if( status ) return errno; -#endif - -#ifdef HAVE_LINUX_THREADS - pthread_kill_other_threads_np(); -#endif - - return 0; - -} - -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - ol_cv_pthread_lc_r=yes -else - ol_cv_pthread_lc_r=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - - - # restore the LIBS - LIBS="$ol_LIBS" - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ol_cv_pthread_lc_r" >&5 -$as_echo "$ol_cv_pthread_lc_r" >&6; } - - if test $ol_cv_pthread_lc_r = yes ; then - ol_link_pthreads="-lc_r" - ol_link_threads=posix - fi -fi - - - # Pthread try link: -threads (ol_cv_pthread_threads) -if test "$ol_link_threads" = no ; then - # try -threads - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread link with -threads" >&5 -$as_echo_n "checking for pthread link with -threads... " >&6; } -if ${ol_cv_pthread_threads+:} false; then : - $as_echo_n "(cached) " >&6 -else - - # save the flags - ol_LIBS="$LIBS" - LIBS="-threads $LIBS" - - if test "$cross_compiling" = yes; then : - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* pthread test headers */ -#include <pthread.h> -#if HAVE_PTHREADS < 7 -#include <errno.h> -#endif -#ifndef NULL -#define NULL (void*)0 -#endif - -static void *task(p) - void *p; -{ - return (void *) (p == NULL); -} - -int -main () -{ - - /* pthread test function */ -#ifndef PTHREAD_CREATE_DETACHED -#define PTHREAD_CREATE_DETACHED 1 -#endif - pthread_t t; - int status; - int detach = PTHREAD_CREATE_DETACHED; - -#if HAVE_PTHREADS > 4 - /* Final pthreads */ - pthread_attr_t attr; - - status = pthread_attr_init(&attr); - if( status ) return status; - -#if HAVE_PTHREADS < 7 - status = pthread_attr_setdetachstate(&attr, &detach); - if( status < 0 ) status = errno; -#else - status = pthread_attr_setdetachstate(&attr, detach); -#endif - if( status ) return status; - status = pthread_create( &t, &attr, task, NULL ); -#if HAVE_PTHREADS < 7 - if( status < 0 ) status = errno; -#endif - if( status ) return status; -#else - /* Draft 4 pthreads */ - status = pthread_create( &t, pthread_attr_default, task, NULL ); - if( status ) return errno; - - /* give thread a chance to complete */ - /* it should remain joinable and hence detachable */ - sleep( 1 ); - - status = pthread_detach( &t ); - if( status ) return errno; -#endif - -#ifdef HAVE_LINUX_THREADS - pthread_kill_other_threads_np(); -#endif - - return 0; - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ol_cv_pthread_threads=yes -else - ol_cv_pthread_threads=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -/* pthread test headers */ -#include <pthread.h> -#if HAVE_PTHREADS < 7 -#include <errno.h> -#endif -#ifndef NULL -#define NULL (void*)0 -#endif - -static void *task(p) - void *p; -{ - return (void *) (p == NULL); -} - - -int main(argc, argv) - int argc; - char **argv; -{ - - /* pthread test function */ -#ifndef PTHREAD_CREATE_DETACHED -#define PTHREAD_CREATE_DETACHED 1 -#endif - pthread_t t; - int status; - int detach = PTHREAD_CREATE_DETACHED; - -#if HAVE_PTHREADS > 4 - /* Final pthreads */ - pthread_attr_t attr; - - status = pthread_attr_init(&attr); - if( status ) return status; - -#if HAVE_PTHREADS < 7 - status = pthread_attr_setdetachstate(&attr, &detach); - if( status < 0 ) status = errno; -#else - status = pthread_attr_setdetachstate(&attr, detach); -#endif - if( status ) return status; - status = pthread_create( &t, &attr, task, NULL ); -#if HAVE_PTHREADS < 7 - if( status < 0 ) status = errno; -#endif - if( status ) return status; -#else - /* Draft 4 pthreads */ - status = pthread_create( &t, pthread_attr_default, task, NULL ); - if( status ) return errno; - - /* give thread a chance to complete */ - /* it should remain joinable and hence detachable */ - sleep( 1 ); - - status = pthread_detach( &t ); - if( status ) return errno; -#endif - -#ifdef HAVE_LINUX_THREADS - pthread_kill_other_threads_np(); -#endif - - return 0; - -} - -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - ol_cv_pthread_threads=yes -else - ol_cv_pthread_threads=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - - - # restore the LIBS - LIBS="$ol_LIBS" - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ol_cv_pthread_threads" >&5 -$as_echo "$ol_cv_pthread_threads" >&6; } - - if test $ol_cv_pthread_threads = yes ; then - ol_link_pthreads="-threads" - ol_link_threads=posix - fi -fi - - - # Pthread try link: -lpthreads -lmach -lexc -lc_r (ol_cv_pthread_lpthreads_lmach_lexc_lc_r) -if test "$ol_link_threads" = no ; then - # try -lpthreads -lmach -lexc -lc_r - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread link with -lpthreads -lmach -lexc -lc_r" >&5 -$as_echo_n "checking for pthread link with -lpthreads -lmach -lexc -lc_r... " >&6; } -if ${ol_cv_pthread_lpthreads_lmach_lexc_lc_r+:} false; then : - $as_echo_n "(cached) " >&6 -else - - # save the flags - ol_LIBS="$LIBS" - LIBS="-lpthreads -lmach -lexc -lc_r $LIBS" - - if test "$cross_compiling" = yes; then : - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* pthread test headers */ -#include <pthread.h> -#if HAVE_PTHREADS < 7 -#include <errno.h> -#endif -#ifndef NULL -#define NULL (void*)0 -#endif - -static void *task(p) - void *p; -{ - return (void *) (p == NULL); -} - -int -main () -{ - - /* pthread test function */ -#ifndef PTHREAD_CREATE_DETACHED -#define PTHREAD_CREATE_DETACHED 1 -#endif - pthread_t t; - int status; - int detach = PTHREAD_CREATE_DETACHED; - -#if HAVE_PTHREADS > 4 - /* Final pthreads */ - pthread_attr_t attr; - - status = pthread_attr_init(&attr); - if( status ) return status; - -#if HAVE_PTHREADS < 7 - status = pthread_attr_setdetachstate(&attr, &detach); - if( status < 0 ) status = errno; -#else - status = pthread_attr_setdetachstate(&attr, detach); -#endif - if( status ) return status; - status = pthread_create( &t, &attr, task, NULL ); -#if HAVE_PTHREADS < 7 - if( status < 0 ) status = errno; -#endif - if( status ) return status; -#else - /* Draft 4 pthreads */ - status = pthread_create( &t, pthread_attr_default, task, NULL ); - if( status ) return errno; - - /* give thread a chance to complete */ - /* it should remain joinable and hence detachable */ - sleep( 1 ); - - status = pthread_detach( &t ); - if( status ) return errno; -#endif - -#ifdef HAVE_LINUX_THREADS - pthread_kill_other_threads_np(); -#endif - - return 0; - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ol_cv_pthread_lpthreads_lmach_lexc_lc_r=yes -else - ol_cv_pthread_lpthreads_lmach_lexc_lc_r=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -/* pthread test headers */ -#include <pthread.h> -#if HAVE_PTHREADS < 7 -#include <errno.h> -#endif -#ifndef NULL -#define NULL (void*)0 -#endif - -static void *task(p) - void *p; -{ - return (void *) (p == NULL); -} - - -int main(argc, argv) - int argc; - char **argv; -{ - - /* pthread test function */ -#ifndef PTHREAD_CREATE_DETACHED -#define PTHREAD_CREATE_DETACHED 1 -#endif - pthread_t t; - int status; - int detach = PTHREAD_CREATE_DETACHED; - -#if HAVE_PTHREADS > 4 - /* Final pthreads */ - pthread_attr_t attr; - - status = pthread_attr_init(&attr); - if( status ) return status; - -#if HAVE_PTHREADS < 7 - status = pthread_attr_setdetachstate(&attr, &detach); - if( status < 0 ) status = errno; -#else - status = pthread_attr_setdetachstate(&attr, detach); -#endif - if( status ) return status; - status = pthread_create( &t, &attr, task, NULL ); -#if HAVE_PTHREADS < 7 - if( status < 0 ) status = errno; -#endif - if( status ) return status; -#else - /* Draft 4 pthreads */ - status = pthread_create( &t, pthread_attr_default, task, NULL ); - if( status ) return errno; - - /* give thread a chance to complete */ - /* it should remain joinable and hence detachable */ - sleep( 1 ); - - status = pthread_detach( &t ); - if( status ) return errno; -#endif - -#ifdef HAVE_LINUX_THREADS - pthread_kill_other_threads_np(); -#endif - - return 0; - -} - -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - ol_cv_pthread_lpthreads_lmach_lexc_lc_r=yes -else - ol_cv_pthread_lpthreads_lmach_lexc_lc_r=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - - - # restore the LIBS - LIBS="$ol_LIBS" - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ol_cv_pthread_lpthreads_lmach_lexc_lc_r" >&5 -$as_echo "$ol_cv_pthread_lpthreads_lmach_lexc_lc_r" >&6; } - - if test $ol_cv_pthread_lpthreads_lmach_lexc_lc_r = yes ; then - ol_link_pthreads="-lpthreads -lmach -lexc -lc_r" - ol_link_threads=posix - fi -fi - - # Pthread try link: -lpthreads -lmach -lexc (ol_cv_pthread_lpthreads_lmach_lexc) -if test "$ol_link_threads" = no ; then - # try -lpthreads -lmach -lexc - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread link with -lpthreads -lmach -lexc" >&5 -$as_echo_n "checking for pthread link with -lpthreads -lmach -lexc... " >&6; } -if ${ol_cv_pthread_lpthreads_lmach_lexc+:} false; then : - $as_echo_n "(cached) " >&6 -else - - # save the flags - ol_LIBS="$LIBS" - LIBS="-lpthreads -lmach -lexc $LIBS" - - if test "$cross_compiling" = yes; then : - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* pthread test headers */ -#include <pthread.h> -#if HAVE_PTHREADS < 7 -#include <errno.h> -#endif -#ifndef NULL -#define NULL (void*)0 -#endif - -static void *task(p) - void *p; -{ - return (void *) (p == NULL); -} - -int -main () -{ - - /* pthread test function */ -#ifndef PTHREAD_CREATE_DETACHED -#define PTHREAD_CREATE_DETACHED 1 -#endif - pthread_t t; - int status; - int detach = PTHREAD_CREATE_DETACHED; - -#if HAVE_PTHREADS > 4 - /* Final pthreads */ - pthread_attr_t attr; - - status = pthread_attr_init(&attr); - if( status ) return status; - -#if HAVE_PTHREADS < 7 - status = pthread_attr_setdetachstate(&attr, &detach); - if( status < 0 ) status = errno; -#else - status = pthread_attr_setdetachstate(&attr, detach); -#endif - if( status ) return status; - status = pthread_create( &t, &attr, task, NULL ); -#if HAVE_PTHREADS < 7 - if( status < 0 ) status = errno; -#endif - if( status ) return status; -#else - /* Draft 4 pthreads */ - status = pthread_create( &t, pthread_attr_default, task, NULL ); - if( status ) return errno; - - /* give thread a chance to complete */ - /* it should remain joinable and hence detachable */ - sleep( 1 ); - - status = pthread_detach( &t ); - if( status ) return errno; -#endif - -#ifdef HAVE_LINUX_THREADS - pthread_kill_other_threads_np(); -#endif - - return 0; - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ol_cv_pthread_lpthreads_lmach_lexc=yes -else - ol_cv_pthread_lpthreads_lmach_lexc=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -/* pthread test headers */ -#include <pthread.h> -#if HAVE_PTHREADS < 7 -#include <errno.h> -#endif -#ifndef NULL -#define NULL (void*)0 -#endif - -static void *task(p) - void *p; -{ - return (void *) (p == NULL); -} - - -int main(argc, argv) - int argc; - char **argv; -{ - - /* pthread test function */ -#ifndef PTHREAD_CREATE_DETACHED -#define PTHREAD_CREATE_DETACHED 1 -#endif - pthread_t t; - int status; - int detach = PTHREAD_CREATE_DETACHED; - -#if HAVE_PTHREADS > 4 - /* Final pthreads */ - pthread_attr_t attr; - - status = pthread_attr_init(&attr); - if( status ) return status; - -#if HAVE_PTHREADS < 7 - status = pthread_attr_setdetachstate(&attr, &detach); - if( status < 0 ) status = errno; -#else - status = pthread_attr_setdetachstate(&attr, detach); -#endif - if( status ) return status; - status = pthread_create( &t, &attr, task, NULL ); -#if HAVE_PTHREADS < 7 - if( status < 0 ) status = errno; -#endif - if( status ) return status; -#else - /* Draft 4 pthreads */ - status = pthread_create( &t, pthread_attr_default, task, NULL ); - if( status ) return errno; - - /* give thread a chance to complete */ - /* it should remain joinable and hence detachable */ - sleep( 1 ); - - status = pthread_detach( &t ); - if( status ) return errno; -#endif - -#ifdef HAVE_LINUX_THREADS - pthread_kill_other_threads_np(); -#endif - - return 0; - -} - -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - ol_cv_pthread_lpthreads_lmach_lexc=yes -else - ol_cv_pthread_lpthreads_lmach_lexc=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - - - # restore the LIBS - LIBS="$ol_LIBS" - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ol_cv_pthread_lpthreads_lmach_lexc" >&5 -$as_echo "$ol_cv_pthread_lpthreads_lmach_lexc" >&6; } - - if test $ol_cv_pthread_lpthreads_lmach_lexc = yes ; then - ol_link_pthreads="-lpthreads -lmach -lexc" - ol_link_threads=posix - fi -fi - - # Pthread try link: -lpthreads -lexc (ol_cv_pthread_lpthreads_lexc) -if test "$ol_link_threads" = no ; then - # try -lpthreads -lexc - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread link with -lpthreads -lexc" >&5 -$as_echo_n "checking for pthread link with -lpthreads -lexc... " >&6; } -if ${ol_cv_pthread_lpthreads_lexc+:} false; then : - $as_echo_n "(cached) " >&6 -else - - # save the flags - ol_LIBS="$LIBS" - LIBS="-lpthreads -lexc $LIBS" - - if test "$cross_compiling" = yes; then : - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* pthread test headers */ -#include <pthread.h> -#if HAVE_PTHREADS < 7 -#include <errno.h> -#endif -#ifndef NULL -#define NULL (void*)0 -#endif - -static void *task(p) - void *p; -{ - return (void *) (p == NULL); -} - -int -main () -{ - - /* pthread test function */ -#ifndef PTHREAD_CREATE_DETACHED -#define PTHREAD_CREATE_DETACHED 1 -#endif - pthread_t t; - int status; - int detach = PTHREAD_CREATE_DETACHED; - -#if HAVE_PTHREADS > 4 - /* Final pthreads */ - pthread_attr_t attr; - - status = pthread_attr_init(&attr); - if( status ) return status; - -#if HAVE_PTHREADS < 7 - status = pthread_attr_setdetachstate(&attr, &detach); - if( status < 0 ) status = errno; -#else - status = pthread_attr_setdetachstate(&attr, detach); -#endif - if( status ) return status; - status = pthread_create( &t, &attr, task, NULL ); -#if HAVE_PTHREADS < 7 - if( status < 0 ) status = errno; -#endif - if( status ) return status; -#else - /* Draft 4 pthreads */ - status = pthread_create( &t, pthread_attr_default, task, NULL ); - if( status ) return errno; - - /* give thread a chance to complete */ - /* it should remain joinable and hence detachable */ - sleep( 1 ); - - status = pthread_detach( &t ); - if( status ) return errno; -#endif - -#ifdef HAVE_LINUX_THREADS - pthread_kill_other_threads_np(); -#endif - - return 0; - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ol_cv_pthread_lpthreads_lexc=yes -else - ol_cv_pthread_lpthreads_lexc=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -/* pthread test headers */ -#include <pthread.h> -#if HAVE_PTHREADS < 7 -#include <errno.h> -#endif -#ifndef NULL -#define NULL (void*)0 -#endif - -static void *task(p) - void *p; -{ - return (void *) (p == NULL); -} - - -int main(argc, argv) - int argc; - char **argv; -{ - - /* pthread test function */ -#ifndef PTHREAD_CREATE_DETACHED -#define PTHREAD_CREATE_DETACHED 1 -#endif - pthread_t t; - int status; - int detach = PTHREAD_CREATE_DETACHED; - -#if HAVE_PTHREADS > 4 - /* Final pthreads */ - pthread_attr_t attr; - - status = pthread_attr_init(&attr); - if( status ) return status; - -#if HAVE_PTHREADS < 7 - status = pthread_attr_setdetachstate(&attr, &detach); - if( status < 0 ) status = errno; -#else - status = pthread_attr_setdetachstate(&attr, detach); -#endif - if( status ) return status; - status = pthread_create( &t, &attr, task, NULL ); -#if HAVE_PTHREADS < 7 - if( status < 0 ) status = errno; -#endif - if( status ) return status; -#else - /* Draft 4 pthreads */ - status = pthread_create( &t, pthread_attr_default, task, NULL ); - if( status ) return errno; - - /* give thread a chance to complete */ - /* it should remain joinable and hence detachable */ - sleep( 1 ); - - status = pthread_detach( &t ); - if( status ) return errno; -#endif - -#ifdef HAVE_LINUX_THREADS - pthread_kill_other_threads_np(); -#endif - - return 0; - -} - -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - ol_cv_pthread_lpthreads_lexc=yes -else - ol_cv_pthread_lpthreads_lexc=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - - - # restore the LIBS - LIBS="$ol_LIBS" - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ol_cv_pthread_lpthreads_lexc" >&5 -$as_echo "$ol_cv_pthread_lpthreads_lexc" >&6; } - - if test $ol_cv_pthread_lpthreads_lexc = yes ; then - ol_link_pthreads="-lpthreads -lexc" - ol_link_threads=posix - fi -fi - - - # Pthread try link: -lpthreads (ol_cv_pthread_lib_lpthreads) -if test "$ol_link_threads" = no ; then - # try -lpthreads - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread link with -lpthreads" >&5 -$as_echo_n "checking for pthread link with -lpthreads... " >&6; } -if ${ol_cv_pthread_lib_lpthreads+:} false; then : - $as_echo_n "(cached) " >&6 -else - - # save the flags - ol_LIBS="$LIBS" - LIBS="-lpthreads $LIBS" - - if test "$cross_compiling" = yes; then : - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* pthread test headers */ -#include <pthread.h> -#if HAVE_PTHREADS < 7 -#include <errno.h> -#endif -#ifndef NULL -#define NULL (void*)0 -#endif - -static void *task(p) - void *p; -{ - return (void *) (p == NULL); -} - -int -main () -{ - - /* pthread test function */ -#ifndef PTHREAD_CREATE_DETACHED -#define PTHREAD_CREATE_DETACHED 1 -#endif - pthread_t t; - int status; - int detach = PTHREAD_CREATE_DETACHED; - -#if HAVE_PTHREADS > 4 - /* Final pthreads */ - pthread_attr_t attr; - - status = pthread_attr_init(&attr); - if( status ) return status; - -#if HAVE_PTHREADS < 7 - status = pthread_attr_setdetachstate(&attr, &detach); - if( status < 0 ) status = errno; -#else - status = pthread_attr_setdetachstate(&attr, detach); -#endif - if( status ) return status; - status = pthread_create( &t, &attr, task, NULL ); -#if HAVE_PTHREADS < 7 - if( status < 0 ) status = errno; -#endif - if( status ) return status; -#else - /* Draft 4 pthreads */ - status = pthread_create( &t, pthread_attr_default, task, NULL ); - if( status ) return errno; - - /* give thread a chance to complete */ - /* it should remain joinable and hence detachable */ - sleep( 1 ); - - status = pthread_detach( &t ); - if( status ) return errno; -#endif - -#ifdef HAVE_LINUX_THREADS - pthread_kill_other_threads_np(); -#endif - - return 0; - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ol_cv_pthread_lib_lpthreads=yes -else - ol_cv_pthread_lib_lpthreads=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -/* pthread test headers */ -#include <pthread.h> -#if HAVE_PTHREADS < 7 -#include <errno.h> -#endif -#ifndef NULL -#define NULL (void*)0 -#endif - -static void *task(p) - void *p; -{ - return (void *) (p == NULL); -} - - -int main(argc, argv) - int argc; - char **argv; -{ - - /* pthread test function */ -#ifndef PTHREAD_CREATE_DETACHED -#define PTHREAD_CREATE_DETACHED 1 -#endif - pthread_t t; - int status; - int detach = PTHREAD_CREATE_DETACHED; - -#if HAVE_PTHREADS > 4 - /* Final pthreads */ - pthread_attr_t attr; - - status = pthread_attr_init(&attr); - if( status ) return status; - -#if HAVE_PTHREADS < 7 - status = pthread_attr_setdetachstate(&attr, &detach); - if( status < 0 ) status = errno; -#else - status = pthread_attr_setdetachstate(&attr, detach); -#endif - if( status ) return status; - status = pthread_create( &t, &attr, task, NULL ); -#if HAVE_PTHREADS < 7 - if( status < 0 ) status = errno; -#endif - if( status ) return status; -#else - /* Draft 4 pthreads */ - status = pthread_create( &t, pthread_attr_default, task, NULL ); - if( status ) return errno; - - /* give thread a chance to complete */ - /* it should remain joinable and hence detachable */ - sleep( 1 ); - - status = pthread_detach( &t ); - if( status ) return errno; -#endif - -#ifdef HAVE_LINUX_THREADS - pthread_kill_other_threads_np(); -#endif - - return 0; - -} - -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - ol_cv_pthread_lib_lpthreads=yes -else - ol_cv_pthread_lib_lpthreads=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - - - # restore the LIBS - LIBS="$ol_LIBS" - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ol_cv_pthread_lib_lpthreads" >&5 -$as_echo "$ol_cv_pthread_lib_lpthreads" >&6; } - - if test $ol_cv_pthread_lib_lpthreads = yes ; then - ol_link_pthreads="-lpthreads" - ol_link_threads=posix - fi -fi - - - if test $ol_link_threads != no ; then - LTHREAD_LIBS="$LTHREAD_LIBS $ol_link_pthreads" - - save_CPPFLAGS="$CPPFLAGS" - save_LIBS="$LIBS" - LIBS="$LTHREAD_LIBS $LIBS" - - for ac_func in sched_yield pthread_yield thr_yield -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - - - if test $ac_cv_func_sched_yield = no && - test $ac_cv_func_pthread_yield = no && - test $ac_cv_func_thr_yield = no ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sched_yield in -lrt" >&5 -$as_echo_n "checking for sched_yield in -lrt... " >&6; } -if ${ac_cv_lib_rt_sched_yield+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lrt $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char sched_yield (); -int -main () -{ -return sched_yield (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_rt_sched_yield=yes -else - ac_cv_lib_rt_sched_yield=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_rt_sched_yield" >&5 -$as_echo "$ac_cv_lib_rt_sched_yield" >&6; } -if test "x$ac_cv_lib_rt_sched_yield" = xyes; then : - LTHREAD_LIBS="$LTHREAD_LIBS -lrt" - -$as_echo "#define HAVE_SCHED_YIELD 1" >>confdefs.h - - ac_cv_func_sched_yield=yes -else - ac_cv_func_sched_yield=no -fi - - fi - if test $ac_cv_func_sched_yield = no && - test $ac_cv_func_pthread_yield = no && - test "$ac_cv_func_thr_yield" = no ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: could not locate sched_yield() or pthread_yield()" >&5 -$as_echo "$as_me: WARNING: could not locate sched_yield() or pthread_yield()" >&2;} - fi - - for ac_func in pthread_kill -do : - ac_fn_c_check_func "$LINENO" "pthread_kill" "ac_cv_func_pthread_kill" -if test "x$ac_cv_func_pthread_kill" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_PTHREAD_KILL 1 -_ACEOF - -fi -done - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_rwlock_destroy with <pthread.h>" >&5 -$as_echo_n "checking for pthread_rwlock_destroy with <pthread.h>... " >&6; } -if ${ol_cv_func_pthread_rwlock_destroy+:} false; then : - $as_echo_n "(cached) " >&6 -else - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include <pthread.h> -pthread_rwlock_t rwlock; - -int -main () -{ -pthread_rwlock_destroy(&rwlock); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ol_cv_func_pthread_rwlock_destroy=yes -else - ol_cv_func_pthread_rwlock_destroy=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ol_cv_func_pthread_rwlock_destroy" >&5 -$as_echo "$ol_cv_func_pthread_rwlock_destroy" >&6; } - if test $ol_cv_func_pthread_rwlock_destroy = yes ; then - -$as_echo "#define HAVE_PTHREAD_RWLOCK_DESTROY 1" >>confdefs.h - - fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_detach with <pthread.h>" >&5 -$as_echo_n "checking for pthread_detach with <pthread.h>... " >&6; } -if ${ol_cv_func_pthread_detach+:} false; then : - $as_echo_n "(cached) " >&6 -else - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include <pthread.h> -#ifndef NULL -#define NULL (void*)0 -#endif - -int -main () -{ -pthread_detach(NULL); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ol_cv_func_pthread_detach=yes -else - ol_cv_func_pthread_detach=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ol_cv_func_pthread_detach" >&5 -$as_echo "$ol_cv_func_pthread_detach" >&6; } - - if test $ol_cv_func_pthread_detach = no ; then - as_fn_error $? "could not locate pthread_detach()" "$LINENO" 5 - fi - - -$as_echo "#define HAVE_PTHREAD_DETACH 1" >>confdefs.h - - - for ac_func in \ - pthread_setconcurrency \ - pthread_getconcurrency \ - thr_setconcurrency \ - thr_getconcurrency \ - -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - - - - for ac_func in pthread_kill_other_threads_np -do : - ac_fn_c_check_func "$LINENO" "pthread_kill_other_threads_np" "ac_cv_func_pthread_kill_other_threads_np" -if test "x$ac_cv_func_pthread_kill_other_threads_np" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_PTHREAD_KILL_OTHER_THREADS_NP 1 -_ACEOF + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_pthread_ok" >&5 +$as_echo "$acx_pthread_ok" >&6; } + if test "x$acx_pthread_ok" = xyes; then + break; + fi -fi + PTHREAD_LIBS="" + PTHREAD_CFLAGS="" done - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for LinuxThreads implementation" >&5 -$as_echo_n "checking for LinuxThreads implementation... " >&6; } -if ${ol_cv_sys_linux_threads+:} false; then : - $as_echo_n "(cached) " >&6 -else - ol_cv_sys_linux_threads=$ac_cv_func_pthread_kill_other_threads_np -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ol_cv_sys_linux_threads" >&5 -$as_echo "$ol_cv_sys_linux_threads" >&6; } - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for LinuxThreads consistency" >&5 -$as_echo_n "checking for LinuxThreads consistency... " >&6; } -if ${ol_cv_linux_threads+:} false; then : - $as_echo_n "(cached) " >&6 -else - - if test $ol_cv_header_linux_threads = yes && - test $ol_cv_sys_linux_threads = yes; then - ol_cv_linux_threads=yes - elif test $ol_cv_header_linux_threads = no && - test $ol_cv_sys_linux_threads = no; then - ol_cv_linux_threads=no - else - ol_cv_linux_threads=error - fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ol_cv_linux_threads" >&5 -$as_echo "$ol_cv_linux_threads" >&6; } - - - if test $ol_cv_linux_threads = error; then - as_fn_error $? "LinuxThreads header/library mismatch" "$LINENO" 5; - fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if pthread_create() works" >&5 -$as_echo_n "checking if pthread_create() works... " >&6; } -if ${ol_cv_pthread_create_works+:} false; then : - $as_echo_n "(cached) " >&6 -else - - if test "$cross_compiling" = yes; then : - ol_cv_pthread_create_works=yes -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -/* pthread test headers */ -#include <pthread.h> -#if HAVE_PTHREADS < 7 -#include <errno.h> -#endif -#ifndef NULL -#define NULL (void*)0 -#endif - -static void *task(p) - void *p; -{ - return (void *) (p == NULL); -} - - -int main(argc, argv) - int argc; - char **argv; -{ - - /* pthread test function */ -#ifndef PTHREAD_CREATE_DETACHED -#define PTHREAD_CREATE_DETACHED 1 -#endif - pthread_t t; - int status; - int detach = PTHREAD_CREATE_DETACHED; - -#if HAVE_PTHREADS > 4 - /* Final pthreads */ - pthread_attr_t attr; - - status = pthread_attr_init(&attr); - if( status ) return status; - -#if HAVE_PTHREADS < 7 - status = pthread_attr_setdetachstate(&attr, &detach); - if( status < 0 ) status = errno; -#else - status = pthread_attr_setdetachstate(&attr, detach); -#endif - if( status ) return status; - status = pthread_create( &t, &attr, task, NULL ); -#if HAVE_PTHREADS < 7 - if( status < 0 ) status = errno; -#endif - if( status ) return status; -#else - /* Draft 4 pthreads */ - status = pthread_create( &t, pthread_attr_default, task, NULL ); - if( status ) return errno; - - /* give thread a chance to complete */ - /* it should remain joinable and hence detachable */ - sleep( 1 ); - - status = pthread_detach( &t ); - if( status ) return errno; -#endif - -#ifdef HAVE_LINUX_THREADS - pthread_kill_other_threads_np(); -#endif - - return 0; - -} - -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - ol_cv_pthread_create_works=yes -else - ol_cv_pthread_create_works=no fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ol_cv_pthread_create_works" >&5 -$as_echo "$ol_cv_pthread_create_works" >&6; } - - if test $ol_cv_pthread_create_works = no ; then - as_fn_error $? "pthread_create is not usable, check environment settings" "$LINENO" 5 - fi - - ol_replace_broken_yield=no - - if test $ol_replace_broken_yield = yes ; then - -$as_echo "#define REPLACE_BROKEN_YIELD 1" >>confdefs.h - fi +# Various other checks: +if test "x$acx_pthread_ok" = xyes; then + save_LIBS="$LIBS" + LIBS="$PTHREAD_LIBS $LIBS" + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" - if test x$ol_with_yielding_select = xauto ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if select yields when using pthreads" >&5 -$as_echo_n "checking if select yields when using pthreads... " >&6; } -if ${ol_cv_pthread_select_yields+:} false; then : - $as_echo_n "(cached) " >&6 -else - - if test "$cross_compiling" = yes; then : - ol_cv_pthread_select_yields=cross -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + # Detect AIX lossage: JOINABLE attribute is called UNDETACHED. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for joinable pthread attribute" >&5 +$as_echo_n "checking for joinable pthread attribute... " >&6; } + attr_name=unknown + for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - -#include <sys/types.h> -#include <sys/time.h> -#include <unistd.h> #include <pthread.h> -#ifndef NULL -#define NULL (void*) 0 -#endif - -static int fildes[2]; - -static void *task(p) - void *p; -{ - int i; - struct timeval tv; - - fd_set rfds; - - tv.tv_sec=10; - tv.tv_usec=0; - - FD_ZERO(&rfds); - FD_SET(fildes[0], &rfds); - - /* we're not interested in any fds */ - i = select(FD_SETSIZE, &rfds, NULL, NULL, &tv); - - if(i < 0) { - perror("select"); - exit(10); - } - - exit(0); /* if we exit here, the select blocked the whole process */ -} - -int main(argc, argv) - int argc; - char **argv; -{ - pthread_t t; - - /* create a pipe to select */ - if(pipe(&fildes[0])) { - perror("select"); - exit(1); - } - -#ifdef HAVE_PTHREAD_SETCONCURRENCY - (void) pthread_setconcurrency(2); -#else -#ifdef HAVE_THR_SETCONCURRENCY - /* Set Solaris LWP concurrency to 2 */ - thr_setconcurrency(2); -#endif -#endif - -#if HAVE_PTHREADS < 6 - pthread_create(&t, pthread_attr_default, task, NULL); -#else - pthread_create(&t, NULL, task, NULL); -#endif - - /* make sure task runs first */ -#ifdef HAVE_THR_YIELD - thr_yield(); -#elif defined( HAVE_SCHED_YIELD ) - sched_yield(); -#elif defined( HAVE_PTHREAD_YIELD ) - pthread_yield(); -#endif - - exit(2); -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - ol_cv_pthread_select_yields=no -else - ol_cv_pthread_select_yields=yes -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ol_cv_pthread_select_yields" >&5 -$as_echo "$ol_cv_pthread_select_yields" >&6; } - - if test $ol_cv_pthread_select_yields = cross ; then - as_fn_error $? "crossing compiling: use --with-yielding-select=yes|no|manual" "$LINENO" 5 - fi - - if test $ol_cv_pthread_select_yields = yes ; then - ol_with_yielding_select=yes - fi - fi - - CPPFLAGS="$save_CPPFLAGS" - LIBS="$save_LIBS" - else - as_fn_error $? "could not locate usable POSIX Threads" "$LINENO" 5 - fi - fi - - if test $ol_with_threads = posix ; then - as_fn_error $? "could not locate POSIX Threads" "$LINENO" 5 - fi - ;; -esac - -case $ol_with_threads in auto | yes | mach) - - for ac_header in mach/cthreads.h cthreads.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - if test $ac_cv_header_mach_cthreads_h = yes ; then - ol_with_threads=found - - ac_fn_c_check_func "$LINENO" "cthread_fork" "ac_cv_func_cthread_fork" -if test "x$ac_cv_func_cthread_fork" = xyes; then : - ol_link_threads=yes -fi - - - if test $ol_link_threads = no ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cthread_fork with -all_load" >&5 -$as_echo_n "checking for cthread_fork with -all_load... " >&6; } -if ${ol_cv_cthread_all_load+:} false; then : - $as_echo_n "(cached) " >&6 -else - - save_LIBS="$LIBS" - LIBS="-all_load $LIBS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <mach/cthreads.h> int main () { - - cthread_fork((void *)0, (void *)0); - +int attr=$attr; return attr; ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - ol_cv_cthread_all_load=yes -else - ol_cv_cthread_all_load=no + attr_name=$attr; break fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext - LIBS="$save_LIBS" - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ol_cv_cthread_all_load" >&5 -$as_echo "$ol_cv_cthread_all_load" >&6; } - - if test $ol_cv_cthread_all_load = yes ; then - LTHREAD_LIBS="$LTHREAD_LIBS -all_load" - ol_link_threads=mach - ol_with_threads=found - fi - fi - - elif test $ac_cv_header_cthreads_h = yes ; then - - ol_with_threads=found - - save_LIBS="$LIBS" - LIBS="$LIBS -lthreads" - ac_fn_c_check_func "$LINENO" "cthread_fork" "ac_cv_func_cthread_fork" -if test "x$ac_cv_func_cthread_fork" = xyes; then : - ol_link_threads=yes -fi - - LIBS="$save_LIBS" - - if test $ol_link_threads = yes ; then - LTHREAD_LIBS="-lthreads" - ol_link_threads=mach - ol_with_threads=found - else - as_fn_error $? "could not link with Mach CThreads" "$LINENO" 5 - fi - - elif test $ol_with_threads = mach ; then - as_fn_error $? "could not locate Mach CThreads" "$LINENO" 5 - fi - - if test $ol_link_threads = mach ; then - -$as_echo "#define HAVE_MACH_CTHREADS 1" >>confdefs.h - - elif test $ol_with_threads = found ; then - as_fn_error $? "could not link with Mach CThreads" "$LINENO" 5 - fi - ;; -esac - -case $ol_with_threads in auto | yes | pth) - - for ac_header in pth.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "pth.h" "ac_cv_header_pth_h" "$ac_includes_default" -if test "x$ac_cv_header_pth_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_PTH_H 1 -_ACEOF - -fi - -done - - - if test $ac_cv_header_pth_h = yes ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pth_version in -lpth" >&5 -$as_echo_n "checking for pth_version in -lpth... " >&6; } -if ${ac_cv_lib_pth_pth_version+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lpth $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ + done + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $attr_name" >&5 +$as_echo "$attr_name" >&6; } + if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char pth_version (); -int -main () -{ -return pth_version (); - ; - return 0; -} +cat >>confdefs.h <<_ACEOF +#define PTHREAD_CREATE_JOINABLE $attr_name _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_pth_pth_version=yes -else - ac_cv_lib_pth_pth_version=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pth_pth_version" >&5 -$as_echo "$ac_cv_lib_pth_pth_version" >&6; } -if test "x$ac_cv_lib_pth_pth_version" = xyes; then : - have_pth=yes -else - have_pth=no -fi - - - if test $have_pth = yes ; then -$as_echo "#define HAVE_GNU_PTH 1" >>confdefs.h - - LTHREAD_LIBS="$LTHREAD_LIBS -lpth" - ol_link_threads=pth - ol_with_threads=found - - if test x$ol_with_yielding_select = xauto ; then - ol_with_yielding_select=yes - fi - fi - fi - ;; -esac - -case $ol_with_threads in auto | yes | lwp) - - for ac_header in thread.h synch.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF + fi -fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if more special flags are required for pthreads" >&5 +$as_echo_n "checking if more special flags are required for pthreads... " >&6; } + flag=no + case "${host_cpu}-${host_os}" in + *-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";; + *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";; + esac + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${flag}" >&5 +$as_echo "${flag}" >&6; } + if test "x$flag" != xno; then + PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS" + fi -done + LIBS="$save_LIBS" + CFLAGS="$save_CFLAGS" - if test $ac_cv_header_thread_h = yes && - test $ac_cv_header_synch_h = yes ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for thr_create in -lthread" >&5 -$as_echo_n "checking for thr_create in -lthread... " >&6; } -if ${ac_cv_lib_thread_thr_create+:} false; then : + # More AIX lossage: must compile with xlc_r or cc_r + if test x"$GCC" != xyes; then + for ac_prog in xlc_r cc_r +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_PTHREAD_CC+:} false; then : $as_echo_n "(cached) " >&6 else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lthread $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char thr_create (); -int -main () -{ -return thr_create (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_thread_thr_create=yes -else - ac_cv_lib_thread_thr_create=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_thread_thr_create" >&5 -$as_echo "$ac_cv_lib_thread_thr_create" >&6; } -if test "x$ac_cv_lib_thread_thr_create" = xyes; then : - have_thr=yes + if test -n "$PTHREAD_CC"; then + ac_cv_prog_PTHREAD_CC="$PTHREAD_CC" # Let the user override the test. else - have_thr=no -fi - - - if test $have_thr = yes ; then - -$as_echo "#define HAVE_THR 1" >>confdefs.h - - LTHREAD_LIBS="$LTHREAD_LIBS -lthread" - ol_link_threads=thr - - if test x$ol_with_yielding_select = xauto ; then - ol_with_yielding_select=yes - fi - - for ac_func in \ - thr_setconcurrency \ - thr_getconcurrency \ - -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - - fi - fi - - for ac_header in lwp/lwp.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "lwp/lwp.h" "ac_cv_header_lwp_lwp_h" "$ac_includes_default" -if test "x$ac_cv_header_lwp_lwp_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LWP_LWP_H 1 -_ACEOF - -fi - +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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_PTHREAD_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 - if test $ac_cv_header_lwp_lwp_h = yes ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for lwp_create in -llwp" >&5 -$as_echo_n "checking for lwp_create in -llwp... " >&6; } -if ${ac_cv_lib_lwp_lwp_create+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-llwp $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char lwp_create (); -int -main () -{ -return lwp_create (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_lwp_lwp_create=yes -else - ac_cv_lib_lwp_lwp_create=no fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_lwp_lwp_create" >&5 -$as_echo "$ac_cv_lib_lwp_lwp_create" >&6; } -if test "x$ac_cv_lib_lwp_lwp_create" = xyes; then : - have_lwp=yes +PTHREAD_CC=$ac_cv_prog_PTHREAD_CC +if test -n "$PTHREAD_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PTHREAD_CC" >&5 +$as_echo "$PTHREAD_CC" >&6; } else - have_lwp=no -fi - - - if test $have_lwp = yes ; then - -$as_echo "#define HAVE_LWP 1" >>confdefs.h - - LTHREAD_LIBS="$LTHREAD_LIBS -llwp" - ol_link_threads=lwp - - if test x$ol_with_yielding_select = xauto ; then - ol_with_yielding_select=no - fi - fi - fi - ;; -esac - -if test $ol_with_yielding_select = yes ; then - -$as_echo "#define HAVE_YIELDING_SELECT 1" >>confdefs.h - -fi - -if test $ol_with_threads = manual ; then - ol_link_threads=yes - - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: thread defines and link options must be set manually" >&5 -$as_echo "$as_me: WARNING: thread defines and link options must be set manually" >&2;} - - for ac_header in pthread.h sched.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi -done - - for ac_func in sched_yield pthread_yield -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF -fi + test -n "$PTHREAD_CC" && break done +test -n "$PTHREAD_CC" || PTHREAD_CC="${CC}" - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for LinuxThreads pthread.h" >&5 -$as_echo_n "checking for LinuxThreads pthread.h... " >&6; } -if ${ol_cv_header_linux_threads+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <pthread.h> -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "pthread_kill_other_threads_np" >/dev/null 2>&1; then : - ol_cv_header_linux_threads=yes -else - ol_cv_header_linux_threads=no -fi -rm -f conftest* - - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ol_cv_header_linux_threads" >&5 -$as_echo "$ol_cv_header_linux_threads" >&6; } - if test $ol_cv_header_linux_threads = yes; then - -$as_echo "#define HAVE_LINUX_THREADS 1" >>confdefs.h - + else + PTHREAD_CC=$CC fi - - - for ac_header in mach/cthreads.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "mach/cthreads.h" "ac_cv_header_mach_cthreads_h" "$ac_includes_default" -if test "x$ac_cv_header_mach_cthreads_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_MACH_CTHREADS_H 1 -_ACEOF - -fi - -done - - for ac_header in lwp/lwp.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "lwp/lwp.h" "ac_cv_header_lwp_lwp_h" "$ac_includes_default" -if test "x$ac_cv_header_lwp_lwp_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LWP_LWP_H 1 -_ACEOF - -fi - -done - - for ac_header in thread.h synch.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - -fi - -if test $ol_link_threads != no && test $ol_link_threads != nt ; then - -$as_echo "#define REENTRANT 1" >>confdefs.h - - -$as_echo "#define _REENTRANT 1" >>confdefs.h - - -$as_echo "#define THREAD_SAFE 1" >>confdefs.h - - -$as_echo "#define _THREAD_SAFE 1" >>confdefs.h - - -$as_echo "#define THREADSAFE 1" >>confdefs.h - - -$as_echo "#define _THREADSAFE 1" >>confdefs.h - - -$as_echo "#define _SGI_MP_SOURCE 1" >>confdefs.h - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for thread specific errno" >&5 -$as_echo_n "checking for thread specific errno... " >&6; } -if ${ol_cv_errno_thread_specific+:} false; then : - $as_echo_n "(cached) " >&6 -else - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <errno.h> -int -main () -{ -errno = 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ol_cv_errno_thread_specific=yes else - ol_cv_errno_thread_specific=no + PTHREAD_CC="$CC" fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ol_cv_errno_thread_specific" >&5 -$as_echo "$ol_cv_errno_thread_specific" >&6; } - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for thread specific h_errno" >&5 -$as_echo_n "checking for thread specific h_errno... " >&6; } -if ${ol_cv_h_errno_thread_specific+:} false; then : - $as_echo_n "(cached) " >&6 -else - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <netdb.h> -int -main () -{ -h_errno = 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ol_cv_h_errno_thread_specific=yes -else - ol_cv_h_errno_thread_specific=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ol_cv_h_errno_thread_specific" >&5 -$as_echo "$ol_cv_h_errno_thread_specific" >&6; } - if test $ol_cv_errno_thread_specific != yes || - test $ol_cv_h_errno_thread_specific != yes ; then - LIBS="$LTHREAD_LIBS $LIBS" - LTHREAD_LIBS="" - fi -fi -if test $ol_link_threads = no ; then - if test $ol_with_threads = yes ; then - as_fn_error $? "no suitable thread support" "$LINENO" 5 - fi - if test $ol_with_threads = auto ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: no suitable thread support, disabling threads" >&5 -$as_echo "$as_me: WARNING: no suitable thread support, disabling threads" >&2;} - ol_with_threads=no - fi +# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: +if test x"$acx_pthread_ok" = xyes; then -$as_echo "#define NO_THREADS 1" >>confdefs.h +$as_echo "#define HAVE_PTHREADS 1" >>confdefs.h - LTHREAD_LIBS="" - BUILD_THREAD=no + have_pthreads=yes + : else - BUILD_THREAD=yes -fi - -if test $ol_link_threads != no ; then - -$as_echo "#define LDAP_API_FEATURE_X_OPENLDAP_THREAD_SAFE 1" >>confdefs.h + acx_pthread_ok=no 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 -# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: -case "$ol_with_threads" in - no) - ol_pthread_ok=no - - ;; - *) - have_pthreads=yes - PTHREAD_LIBS="$LTHREAD_LIBS" - CFLAGS="$CFLAGS $PTHREAD_CFLAGS" - # The cast to long int works around a bug in the HP C Compiler + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + # 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. @@ -19273,10 +15191,8 @@ $as_echo_n "checking size of pthread_t... " >&6; } if ${ac_cv_sizeof_pthread_t+:} false; then : $as_echo_n "(cached) " >&6 else - if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (pthread_t))" "ac_cv_sizeof_pthread_t" " - $ac_includes_default - #include <pthread.h> - + if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (pthread_t))" "ac_cv_sizeof_pthread_t" "$ac_includes_default + #include <pthread.h> "; then : @@ -19302,20 +15218,7 @@ cat >>confdefs.h <<_ACEOF _ACEOF - - ;; -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 - - fi - - if test "$have_pthreads" != "no" && test "$enable_thread_support" != "no"; then PTHREADS_TRUE= PTHREADS_FALSE='#' @@ -19712,6 +15615,10 @@ if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${BUILD_SAMPLES_TRUE}" && test -z "${BUILD_SAMPLES_FALSE}"; then + as_fn_error $? "conditional \"BUILD_SAMPLES\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${BUILD_REGRESS_TRUE}" && test -z "${BUILD_REGRESS_FALSE}"; then as_fn_error $? "conditional \"BUILD_REGRESS\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 @@ -20189,7 +16096,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by libevent $as_me 2.1.3-alpha-dev, which was +This file was extended by libevent $as_me 2.1.5-beta, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -20255,7 +16162,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -libevent config.status 2.1.3-alpha-dev +libevent config.status 2.1.5-beta configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" |