From 4d2b0cfab68df5b87ce800fb07e69df82588a792 Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Sat, 3 Apr 1999 07:32:17 +0000 Subject: [PATCH] Reorder the pthreads tests and hope for the best. IRIX users beware. --- configure | 164 +++++++++++++++++++++++++-------------------------- configure.in | 44 +++++++------- 2 files changed, 104 insertions(+), 104 deletions(-) diff --git a/configure b/configure index 41ac6cf287..07ea9eaa06 100755 --- a/configure +++ b/configure @@ -4950,26 +4950,26 @@ fi LIBS="$save_LIBS" fi - if test $ol_link_threads = no ; then + if test $ol_link_threads = no ; then save_LIBS="$LIBS" - echo $ac_n "checking for pthread_create in -lpthread""... $ac_c" 1>&6 -echo "configure:4957: checking for pthread_create in -lpthread" >&5 -ac_lib_var=`echo pthread'_'pthread_create | sed 'y%./+-%__p_%'` + echo $ac_n "checking for pthread_join in -lpthread""... $ac_c" 1>&6 +echo "configure:4957: checking for pthread_join in -lpthread" >&5 +ac_lib_var=`echo pthread'_'pthread_join | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" -LIBS="-lpthread $LIBS" +LIBS="-lpthread -Wl,-woff,85 $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then @@ -4990,6 +4990,7 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then ol_link_threads=posix LTHREAD_LIBS="$LTHREAD_LIBS -lpthread" + else echo "$ac_t""no" 1>&6 : @@ -5000,16 +5001,16 @@ fi if test $ol_link_threads = no ; then save_LIBS="$LIBS" - echo $ac_n "checking for pthread_create in -lc_r""... $ac_c" 1>&6 -echo "configure:5005: checking for pthread_create in -lc_r" >&5 -ac_lib_var=`echo c_r'_'pthread_create | sed 'y%./+-%__p_%'` + echo $ac_n "checking for pthread_create in -lpthread""... $ac_c" 1>&6 +echo "configure:5006: checking for pthread_create in -lpthread" >&5 +ac_lib_var=`echo pthread'_'pthread_create | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" -LIBS="-lc_r $LIBS" +LIBS="-lpthread $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5025: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5037,7 +5038,7 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 ol_link_threads=posix - LTHREAD_LIBS="$LTHREAD_LIBS -lc_r" + LTHREAD_LIBS="$LTHREAD_LIBS -lpthread" else echo "$ac_t""no" 1>&6 : @@ -5048,16 +5049,16 @@ fi if test $ol_link_threads = no ; then save_LIBS="$LIBS" - echo $ac_n "checking for pthread_create in -lpthreads""... $ac_c" 1>&6 -echo "configure:5053: checking for pthread_create in -lpthreads" >&5 -ac_lib_var=`echo pthreads'_'pthread_create | sed 'y%./+-%__p_%'` + echo $ac_n "checking for pthread_create in -lc_r""... $ac_c" 1>&6 +echo "configure:5054: checking for pthread_create in -lc_r" >&5 +ac_lib_var=`echo c_r'_'pthread_create | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" -LIBS="-lpthreads $LIBS" +LIBS="-lc_r $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" - -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - - ol_link_threads=posix - LTHREAD_LIBS="$LTHREAD_LIBS -lpthreads" -else - echo "$ac_t""no" 1>&6 -: -fi - - LIBS="$save_LIBS" - fi - - if test $ol_link_threads = no ; then - save_LIBS="$LIBS" - echo $ac_n "checking for pthread_join in -lpthreads""... $ac_c" 1>&6 -echo "configure:5101: checking for pthread_join in -lpthreads" >&5 -ac_lib_var=`echo pthreads'_'pthread_join | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - ac_save_LIBS="$LIBS" -LIBS="-lpthreads -Wl,-woff,85 $LIBS" -cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5073: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5133,8 +5086,7 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 ol_link_threads=posix - LTHREAD_LIBS="$LTHREAD_LIBS -lpthreads" - + LTHREAD_LIBS="$LTHREAD_LIBS -lc_r" else echo "$ac_t""no" 1>&6 : @@ -5145,7 +5097,7 @@ fi if test $ol_link_threads = no ; then echo $ac_n "checking for pthread_create with -threads""... $ac_c" 1>&6 -echo "configure:5149: checking for pthread_create with -threads" >&5 +echo "configure:5101: checking for pthread_create with -threads" >&5 if eval "test \"`echo '$''{'ol_cv_threads_flag'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5153,7 +5105,7 @@ else save_LIBS="$LIBS" LIBS="-threads $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5118: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ol_cv_threads_flag=yes else @@ -5187,7 +5139,7 @@ echo "$ac_t""$ol_cv_threads_flag" 1>&6 if test $ol_link_threads = no ; then save_LIBS="$LIBS" echo $ac_n "checking for pthread_mutex_unlock in -lpthreads""... $ac_c" 1>&6 -echo "configure:5191: checking for pthread_mutex_unlock in -lpthreads" >&5 +echo "configure:5143: checking for pthread_mutex_unlock in -lpthreads" >&5 ac_lib_var=`echo pthreads'_'pthread_mutex_unlock | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5195,7 +5147,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lpthreads -lmach -lexc -lc_r $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5162: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5239,7 +5191,7 @@ fi if test $ol_link_threads = no ; then save_LIBS="$LIBS" echo $ac_n "checking for pthread_mutex_lock in -lpthreads""... $ac_c" 1>&6 -echo "configure:5243: checking for pthread_mutex_lock in -lpthreads" >&5 +echo "configure:5195: checking for pthread_mutex_lock in -lpthreads" >&5 ac_lib_var=`echo pthreads'_'pthread_mutex_lock | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5247,7 +5199,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lpthreads -lmach -lexc $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5214: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5291,7 +5243,7 @@ fi if test $ol_link_threads = no ; then save_LIBS="$LIBS" echo $ac_n "checking for pthread_mutex_trylock in -lpthreads""... $ac_c" 1>&6 -echo "configure:5295: checking for pthread_mutex_trylock in -lpthreads" >&5 +echo "configure:5247: checking for pthread_mutex_trylock in -lpthreads" >&5 ac_lib_var=`echo pthreads'_'pthread_mutex_trylock | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5299,7 +5251,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lpthreads -lexc $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5266: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5340,6 +5292,54 @@ fi LIBS="$save_LIBS" fi + if test $ol_link_threads = no ; then + save_LIBS="$LIBS" + echo $ac_n "checking for pthread_create in -lpthreads""... $ac_c" 1>&6 +echo "configure:5299: checking for pthread_create in -lpthreads" >&5 +ac_lib_var=`echo pthreads'_'pthread_create | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lpthreads $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + + ol_link_threads=posix + LTHREAD_LIBS="$LTHREAD_LIBS -lpthreads" +else + echo "$ac_t""no" 1>&6 +: +fi + + LIBS="$save_LIBS" + fi + if test $ol_link_threads != no ; then cat >> confdefs.h <<\EOF #define HAVE_PTHREADS 1 diff --git a/configure.in b/configure.in index 87a2b45fd8..5654573571 100644 --- a/configure.in +++ b/configure.in @@ -605,10 +605,9 @@ if test $ol_with_threads = auto -o $ol_with_threads = yes \ dnl pthread_mutex_unlock() in -lpthread -lmach -lexc -lc_r (OSF/1) dnl pthread_mutex_lock() in -lpthread -lmach -lexc (OSF/1) dnl pthread_mutex_trylock() in -lpthread -lexc (OSF/1) + dnl pthread_join() -Wl,-woff,85 -lpthread (IRIX) dnl pthread_create() in -lpthread (many) dnl pthread_create() in -lc_r (FreeBSD) - dnl pthread_create() in -lpthreads (many) - dnl pthread_join() -Wl,-woff,85 -lpthreads (IRIX) dnl dnl Check pthread (draft4) flags (depreciated) dnl pthread_create() with -threads (OSF/1) @@ -617,6 +616,7 @@ if test $ol_with_threads = auto -o $ol_with_threads = yes \ dnl pthread_mutex_unlock() in -lpthreads -lmach -lexc -lc_r (OSF/1) dnl pthread_mutex_lock() in -lpthreads -lmach -lexc (OSF/1) dnl pthread_mutex_trylock() in -lpthreads -lexc (OSF/1) + dnl pthread_create() in -lpthreads (many) dnl dnl pthread_create in $LIBS @@ -828,41 +828,32 @@ int main(argc, argv) LIBS="$save_LIBS" fi + dnl IRIX Pthread check if test $ol_link_threads = no ; then - dnl try -lpthread - save_LIBS="$LIBS" - AC_CHECK_LIB(pthread, pthread_create, [ - ol_link_threads=posix - LTHREAD_LIBS="$LTHREAD_LIBS -lpthread"],:) - LIBS="$save_LIBS" - fi - - if test $ol_link_threads = no ; then - dnl try -lc_r + dnl try IRIX Pthreads -Wl,-woff,85 -lpthread save_LIBS="$LIBS" - AC_CHECK_LIB(c_r, pthread_create, [ + AC_CHECK_LIB(pthread, pthread_join, [ ol_link_threads=posix - LTHREAD_LIBS="$LTHREAD_LIBS -lc_r"],:) + LTHREAD_LIBS="$LTHREAD_LIBS -lpthread" + ],:,[-Wl,-woff,85]) LIBS="$save_LIBS" fi if test $ol_link_threads = no ; then - dnl try -lpthreads + dnl try -lpthread save_LIBS="$LIBS" - AC_CHECK_LIB(pthreads, pthread_create, [ + AC_CHECK_LIB(pthread, pthread_create, [ ol_link_threads=posix - LTHREAD_LIBS="$LTHREAD_LIBS -lpthreads"],:) + LTHREAD_LIBS="$LTHREAD_LIBS -lpthread"],:) LIBS="$save_LIBS" fi - dnl IRIX Pthread check if test $ol_link_threads = no ; then - dnl try IRIX Pthreads -Wl,-woff,85 -lpthreads + dnl try -lc_r save_LIBS="$LIBS" - AC_CHECK_LIB(pthreads, pthread_join, [ + AC_CHECK_LIB(c_r, pthread_create, [ ol_link_threads=posix - LTHREAD_LIBS="$LTHREAD_LIBS -lpthreads" - ],:,[-Wl,-woff,85]) + LTHREAD_LIBS="$LTHREAD_LIBS -lc_r"],:) LIBS="$save_LIBS" fi @@ -925,6 +916,15 @@ int main(argc, argv) LIBS="$save_LIBS" fi + if test $ol_link_threads = no ; then + dnl try -lpthreads + save_LIBS="$LIBS" + AC_CHECK_LIB(pthreads, pthread_create, [ + ol_link_threads=posix + LTHREAD_LIBS="$LTHREAD_LIBS -lpthreads"],:) + LIBS="$save_LIBS" + fi + if test $ol_link_threads != no ; then AC_DEFINE(HAVE_PTHREADS,1, [define if you have POSIX Threads]) -- 2.39.5