diff --git a/configure b/configure index d8d5edfb9aa..ad33c34e7c9 100755 --- a/configure +++ b/configure @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in Revision: 1.410 . +# From configure.in Revision: 1.411 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53 for python 2.3. # @@ -3949,6 +3949,68 @@ echo "$as_me:$LINENO: result: $ac_cv_kthread" >&5 echo "${ECHO_T}$ac_cv_kthread" >&6 fi +if test $ac_cv_kthread = no +then +# -pthread, if available, provides the right #defines +# and linker options to make pthread_create available +# Some compilers won't report that they do not support -pthread, +# so we need to run a program to see whether it really made the +# function available. +echo "$as_me:$LINENO: checking whether $CC accepts -pthread" >&5 +echo $ECHO_N "checking whether $CC accepts -pthread... $ECHO_C" >&6 +if test "${ac_cv_thread+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_save_cc="$CC" +CC="$CC -pthread" +if test "$cross_compiling" = yes; then + ac_cv_pthread=no +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +#include + +void* routine(void* p){return NULL;} + +int main(){ + pthread_t p; + if(pthread_create(&p,NULL,routine,NULL)!=0) + return 1; + (void)pthread_detach(p); + return 0; +} + +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_pthread=yes +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +( exit $ac_status ) +ac_cv_pthread=no +fi +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +CC="$ac_save_cc" +fi + +echo "$as_me:$LINENO: result: $ac_cv_pthread" >&5 +echo "${ECHO_T}$ac_cv_pthread" >&6 +fi + # checks for header files echo "$as_me:$LINENO: checking for ANSI C header files" >&5 @@ -9202,6 +9264,8 @@ if test "$ac_cv_kpthread" = "yes" then CC="$CC -Kpthread" elif test "$ac_cv_kthread" = "yes" then CC="$CC -Kthread" +elif test "$ac_cv_pthread" = "yes" +then CC="$CC -pthread" fi echo "$as_me:$LINENO: checking for pthread_t" >&5 echo $ECHO_N "checking for pthread_t... $ECHO_C" >&6 @@ -10218,6 +10282,15 @@ then CC="$CC -Kthread" cat >>confdefs.h <<\_ACEOF #define WITH_THREAD 1 +_ACEOF + + posix_threads=yes + THREADOBJ="Python/thread.o" +elif test "$ac_cv_pthread" = "yes" +then + CC="$CC -pthread" + cat >>confdefs.h <<\_ACEOF +#define WITH_THREAD 1 _ACEOF posix_threads=yes @@ -11232,159 +11305,6 @@ fi - if test "$posix_threads" = "yes"; then - if test "$unistd_defines_pthreads" = "no"; then - -cat >>confdefs.h <<\_ACEOF -#define _POSIX_THREADS 1 -_ACEOF - - fi - - # Bug 662787: Using semaphores causes unexplicable hangs on Solaris 8. - case $ac_sys_system/$ac_sys_release in - SunOS/5.8) -cat >>confdefs.h <<\_ACEOF -#define HAVE_BROKEN_POSIX_SEMAPHORES 1 -_ACEOF -;; - esac - - echo "$as_me:$LINENO: checking if PTHREAD_SCOPE_SYSTEM is supported" >&5 -echo $ECHO_N "checking if PTHREAD_SCOPE_SYSTEM is supported... $ECHO_C" >&6 - if test "${ac_cv_pthread_system_supported+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$cross_compiling" = yes; then - ac_cv_pthread_system_supported=no -else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" -#include - void *foo(void *parm) { - return NULL; - } - main() { - pthread_attr_t attr; - pthread_t id; - if (pthread_attr_init(&attr)) exit(-1); - if (pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM)) exit(-1); - if (pthread_create(&id, &attr, foo, NULL)) exit(-1); - exit(0); - } -_ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_pthread_system_supported=yes -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -( exit $ac_status ) -ac_cv_pthread_system_supported=no -fi -rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi - -fi - - echo "$as_me:$LINENO: result: $ac_cv_pthread_system_supported" >&5 -echo "${ECHO_T}$ac_cv_pthread_system_supported" >&6 - if test "$ac_cv_pthread_system_supported" = "yes"; then - -cat >>confdefs.h <<\_ACEOF -#define PTHREAD_SYSTEM_SCHED_SUPPORTED 1 -_ACEOF - - fi - -for ac_func in pthread_sigmask -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -if eval "test \"\${$as_ac_var+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. */ -#include -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func (); -char (*f) (); - -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif -int -main () -{ -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -choke me -#else -f = $ac_func; -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_var=yes" -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -eval "$as_ac_var=no" -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - - fi - echo "$as_me:$LINENO: checking for usconfig in -lmpc" >&5 echo $ECHO_N "checking for usconfig in -lmpc... $ECHO_C" >&6 if test "${ac_cv_lib_mpc_usconfig+set}" = set; then @@ -11527,19 +11447,169 @@ fi OSF1) LDLAST=-threads;; esac fi +fi - if test "$posix_threads" = yes -a \ - "$ac_sys_system" = "SunOS" -a \ - "$ac_sys_release" = "5.6"; then +if test "$posix_threads" = "yes"; then + if test "$unistd_defines_pthreads" = "no"; then cat >>confdefs.h <<\_ACEOF +#define _POSIX_THREADS 1 +_ACEOF + + fi + + # Bug 662787: Using semaphores causes unexplicable hangs on Solaris 8. + case $ac_sys_system/$ac_sys_release in + SunOS/5.6) +cat >>confdefs.h <<\_ACEOF #define HAVE_PTHREAD_DESTRUCTOR 1 _ACEOF - fi + ;; + SunOS/5.8) +cat >>confdefs.h <<\_ACEOF +#define HAVE_BROKEN_POSIX_SEMAPHORES 1 +_ACEOF + + ;; + esac + + echo "$as_me:$LINENO: checking if PTHREAD_SCOPE_SYSTEM is supported" >&5 +echo $ECHO_N "checking if PTHREAD_SCOPE_SYSTEM is supported... $ECHO_C" >&6 + if test "${ac_cv_pthread_system_supported+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then + ac_cv_pthread_system_supported=no +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include + void *foo(void *parm) { + return NULL; + } + main() { + pthread_attr_t attr; + pthread_t id; + if (pthread_attr_init(&attr)) exit(-1); + if (pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM)) exit(-1); + if (pthread_create(&id, &attr, foo, NULL)) exit(-1); + exit(0); + } +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_pthread_system_supported=yes +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +( exit $ac_status ) +ac_cv_pthread_system_supported=no +fi +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi fi + echo "$as_me:$LINENO: result: $ac_cv_pthread_system_supported" >&5 +echo "${ECHO_T}$ac_cv_pthread_system_supported" >&6 + if test "$ac_cv_pthread_system_supported" = "yes"; then + +cat >>confdefs.h <<\_ACEOF +#define PTHREAD_SYSTEM_SCHED_SUPPORTED 1 +_ACEOF + + fi + +for ac_func in pthread_sigmask +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. */ +#include +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +char (*f) (); + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +f = $ac_func; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$as_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + +fi + + # Check for enable-ipv6 @@ -12592,6 +12662,48 @@ echo "${ECHO_T}no" >&6 fi rm -f conftest.$ac_objext conftest.$ac_ext +for ac_prog in true +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_TRUE+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$TRUE"; then + ac_cv_prog_TRUE="$TRUE" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_TRUE="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +TRUE=$ac_cv_prog_TRUE +if test -n "$TRUE"; then + echo "$as_me:$LINENO: result: $TRUE" >&5 +echo "${ECHO_T}$TRUE" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$TRUE" && break +done +test -n "$TRUE" || TRUE="/bin/true" + + echo "$as_me:$LINENO: checking for inet_aton in -lc" >&5 echo $ECHO_N "checking for inet_aton in -lc... $ECHO_C" >&6 if test "${ac_cv_lib_c_inet_aton+set}" = set; then @@ -12648,7 +12760,7 @@ fi echo "$as_me:$LINENO: result: $ac_cv_lib_c_inet_aton" >&5 echo "${ECHO_T}$ac_cv_lib_c_inet_aton" >&6 if test $ac_cv_lib_c_inet_aton = yes; then - /bin/true + $ac_cv_prog_TRUE else echo "$as_me:$LINENO: checking for inet_aton in -lresolv" >&5 @@ -18074,6 +18186,7 @@ s,@THREADOBJ@,$THREADOBJ,;t t s,@DLINCLDIR@,$DLINCLDIR,;t t s,@DYNLOADFILE@,$DYNLOADFILE,;t t s,@MACHDEP_OBJS@,$MACHDEP_OBJS,;t t +s,@TRUE@,$TRUE,;t t s,@LIBOBJS@,$LIBOBJS,;t t s,@HAVE_GETHOSTBYNAME_R_6_ARG@,$HAVE_GETHOSTBYNAME_R_6_ARG,;t t s,@HAVE_GETHOSTBYNAME_R_5_ARG@,$HAVE_GETHOSTBYNAME_R_5_ARG,;t t diff --git a/configure.in b/configure.in index 51b35a9e99f..aae3eca8024 100644 --- a/configure.in +++ b/configure.in @@ -792,6 +792,37 @@ CC="$ac_save_cc"]) AC_MSG_RESULT($ac_cv_kthread) fi +if test $ac_cv_kthread = no +then +# -pthread, if available, provides the right #defines +# and linker options to make pthread_create available +# Some compilers won't report that they do not support -pthread, +# so we need to run a program to see whether it really made the +# function available. +AC_MSG_CHECKING(whether $CC accepts -pthread) +AC_CACHE_VAL(ac_cv_thread, +[ac_save_cc="$CC" +CC="$CC -pthread" +AC_TRY_RUN([ +#include + +void* routine(void* p){return NULL;} + +int main(){ + pthread_t p; + if(pthread_create(&p,NULL,routine,NULL)!=0) + return 1; + (void)pthread_detach(p); + return 0; +} +], + ac_cv_pthread=yes, + ac_cv_pthread=no, + ac_cv_pthread=no) +CC="$ac_save_cc"]) +AC_MSG_RESULT($ac_cv_pthread) +fi + dnl # check for ANSI or K&R ("traditional") preprocessor dnl AC_MSG_CHECKING(for C preprocessor type) dnl AC_TRY_COMPILE([ @@ -982,6 +1013,8 @@ if test "$ac_cv_kpthread" = "yes" then CC="$CC -Kpthread" elif test "$ac_cv_kthread" = "yes" then CC="$CC -Kthread" +elif test "$ac_cv_pthread" = "yes" +then CC="$CC -pthread" fi AC_MSG_CHECKING(for pthread_t) have_pthread_t=no @@ -1415,6 +1448,12 @@ then AC_DEFINE(WITH_THREAD) posix_threads=yes THREADOBJ="Python/thread.o" +elif test "$ac_cv_pthread" = "yes" +then + CC="$CC -pthread" + AC_DEFINE(WITH_THREAD) + posix_threads=yes + THREADOBJ="Python/thread.o" else if test ! -z "$with_threads" -a -d "$with_threads" then LDFLAGS="$LDFLAGS -L$with_threads" @@ -1510,7 +1549,29 @@ pthread_create (NULL, NULL, start_routine, NULL)], [ USE_THREAD_MODULE="#"]) ])])])])])])])])])])]) - if test "$posix_threads" = "yes"; then + AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD) + LIBS="$LIBS -lmpc" + THREADOBJ="Python/thread.o" + USE_THREAD_MODULE=""]) + + if test "$posix_threads" != "yes"; then + AC_CHECK_LIB(thread, thr_create, [AC_DEFINE(WITH_THREAD) + LIBS="$LIBS -lthread" + THREADOBJ="Python/thread.o" + USE_THREAD_MODULE=""]) + fi + + if test "$USE_THREAD_MODULE" != "#" + then + # If the above checks didn't disable threads, (at least) OSF1 + # needs this '-threads' argument during linking. + case $ac_sys_system in + OSF1) LDLAST=-threads;; + esac + fi +fi + +if test "$posix_threads" = "yes"; then if test "$unistd_defines_pthreads" = "no"; then AC_DEFINE(_POSIX_THREADS, 1, [Define if you have POSIX threads, @@ -1519,8 +1580,12 @@ pthread_create (NULL, NULL, start_routine, NULL)], [ # Bug 662787: Using semaphores causes unexplicable hangs on Solaris 8. case $ac_sys_system/$ac_sys_release in + SunOS/5.6) AC_DEFINE(HAVE_PTHREAD_DESTRUCTOR, 1, + Defined for Solaris 2.6 bug in pthread header.) + ;; SunOS/5.8) AC_DEFINE(HAVE_BROKEN_POSIX_SEMAPHORES, 1, - Define if the Posix semaphores do not work on your system);; + Define if the Posix semaphores do not work on your system) + ;; esac AC_MSG_CHECKING(if PTHREAD_SCOPE_SYSTEM is supported) @@ -1546,38 +1611,9 @@ pthread_create (NULL, NULL, start_routine, NULL)], [ AC_DEFINE(PTHREAD_SYSTEM_SCHED_SUPPORTED, 1, [Defined if PTHREAD_SCOPE_SYSTEM supported.]) fi AC_CHECK_FUNCS(pthread_sigmask) - fi - - AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD) - LIBS="$LIBS -lmpc" - THREADOBJ="Python/thread.o" - USE_THREAD_MODULE=""]) - - if test "$posix_threads" != "yes"; then - AC_CHECK_LIB(thread, thr_create, [AC_DEFINE(WITH_THREAD) - LIBS="$LIBS -lthread" - THREADOBJ="Python/thread.o" - USE_THREAD_MODULE=""]) - fi - - if test "$USE_THREAD_MODULE" != "#" - then - # If the above checks didn't disable threads, (at least) OSF1 - # needs this '-threads' argument during linking. - case $ac_sys_system in - OSF1) LDLAST=-threads;; - esac - fi - - if test "$posix_threads" = yes -a \ - "$ac_sys_system" = "SunOS" -a \ - "$ac_sys_release" = "5.6"; then - AC_DEFINE(HAVE_PTHREAD_DESTRUCTOR, 1, - [Defined for Solaris 2.6 bug in pthread header.]) - fi - fi + # Check for enable-ipv6 AH_TEMPLATE(ENABLE_IPV6, [Define if --enable-ipv6 is specified]) AC_MSG_CHECKING([if --enable-ipv6 is specified]) @@ -1977,9 +2013,12 @@ AC_TRY_COMPILE([ AC_MSG_RESULT(no) ) +dnl check for true +AC_CHECK_PROGS(TRUE, true, /bin/true) + dnl On some systems (e.g. Solaris 9), hstrerror and inet_aton are in -lresolv dnl On others, they are in the C library, so we to take no action -AC_CHECK_LIB(c, inet_aton, [/bin/true], +AC_CHECK_LIB(c, inet_aton, [$ac_cv_prog_TRUE], AC_CHECK_LIB(resolv, inet_aton) )