From: Vadim Zeitlin Date: Wed, 10 Mar 1999 16:21:20 +0000 (+0000) Subject: simplified test for thread libs X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/5e0b1434d493429cdae3a51d86f0b4c9dfbc89c6 simplified test for thread libs git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1895 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/configure b/configure index ea188c2ef7..42c046430e 100755 --- a/configure +++ b/configure @@ -7358,8 +7358,8 @@ THREADS_LINK="" UNIX_THREAD="" if test "$wxUSE_THREADS" = "1"; then - - echo $ac_n "checking for pthread_create in -lpthread-0.7""... $ac_c" 1>&6 + + echo $ac_n "checking for pthread_create in -lpthread-0.7""... $ac_c" 1>&6 echo "configure:7364: checking for pthread_create in -lpthread-0.7" >&5 ac_lib_var=`echo pthread-0.7'_'pthread_create | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then @@ -7395,70 +7395,33 @@ fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 - UNIX_THREAD="unix/threadpsx.cpp" - THREADS_LINK="pthread-0.7" - -else - echo "$ac_t""no" 1>&6 - - ac_safe=`echo "sys/prctl.h" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for sys/prctl.h""... $ac_c" 1>&6 -echo "configure:7407: checking for sys/prctl.h" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:7417: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - - UNIX_THREAD="gtk/threadsgi.cpp" - + UNIX_THREAD="unix/threadpsx.cpp" + THREADS_LINK="pthread-0.7" + else echo "$ac_t""no" 1>&6 -fi - - - echo $ac_n "checking for pthread_setcanceltype in -lpthread""... $ac_c" 1>&6 -echo "configure:7443: checking for pthread_setcanceltype in -lpthread" >&5 -ac_lib_var=`echo pthread'_'pthread_setcanceltype | sed 'y%./+-%__p_%'` + echo $ac_n "checking for pthread_create in -lpthread""... $ac_c" 1>&6 +echo "configure:7406: 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="-lpthread $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:7425: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7474,20 +7437,14 @@ fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 - UNIX_THREAD="unix/threadpsx.cpp" - THREADS_LINK="pthread" - + UNIX_THREAD="unix/threadpsx.cpp" + THREADS_LINK="pthread" + else echo "$ac_t""no" 1>&6 -fi - - -fi - - if test "x$THREADS_LINK" = "x"; then - echo $ac_n "checking for pthread_create in -lc_r""... $ac_c" 1>&6 -echo "configure:7491: checking for pthread_create in -lc_r" >&5 + echo $ac_n "checking for pthread_create in -lc_r""... $ac_c" 1>&6 +echo "configure:7448: 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 @@ -7495,7 +7452,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lc_r $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:7467: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7522,20 +7479,64 @@ fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 - UNIX_THREAD="unix/threadpsx.cpp" - THREADS_LINK="c_r" - + UNIX_THREAD="unix/threadpsx.cpp" + THREADS_LINK="c_r" + +else + echo "$ac_t""no" 1>&6 + + ac_safe=`echo "sys/prctl.h" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for sys/prctl.h""... $ac_c" 1>&6 +echo "configure:7491: checking for sys/prctl.h" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:7501: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + + UNIX_THREAD="gtk/threadsgi.cpp" + else echo "$ac_t""no" 1>&6 fi - fi + +fi + + +fi + + +fi + if test "$THREADS_LINK" != ""; then - cat >> confdefs.h <<\EOF + cat >> confdefs.h <<\EOF #define wxUSE_THREADS 1 EOF + else + echo "configure: warning: No thread support on this system" 1>&2 fi fi @@ -7550,17 +7551,17 @@ if test "$wxUSE_THREADS" = "1"; then do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:7554: checking for $ac_hdr" >&5 +echo "configure:7555: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:7564: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:7565: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -7588,7 +7589,7 @@ done echo $ac_n "checking for sched_yield in -l$THREADS_LINK""... $ac_c" 1>&6 -echo "configure:7592: checking for sched_yield in -l$THREADS_LINK" >&5 +echo "configure:7593: checking for sched_yield in -l$THREADS_LINK" >&5 ac_lib_var=`echo $THREADS_LINK'_'sched_yield | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -7596,7 +7597,7 @@ else ac_save_LIBS="$LIBS" LIBS="-l$THREADS_LINK $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:7612: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7629,7 +7630,7 @@ EOF else echo "$ac_t""no" 1>&6 echo $ac_n "checking for sched_yield in -l"posix4"""... $ac_c" 1>&6 -echo "configure:7633: checking for sched_yield in -l"posix4"" >&5 +echo "configure:7634: checking for sched_yield in -l"posix4"" >&5 ac_lib_var=`echo "posix4"'_'sched_yield | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -7637,7 +7638,7 @@ else ac_save_LIBS="$LIBS" LIBS="-l"posix4" $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:7653: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7678,7 +7679,7 @@ fi echo $ac_n "checking for sched_get_priority_min in -l$THREADS_LINK""... $ac_c" 1>&6 -echo "configure:7682: checking for sched_get_priority_min in -l$THREADS_LINK" >&5 +echo "configure:7683: checking for sched_get_priority_min in -l$THREADS_LINK" >&5 ac_lib_var=`echo $THREADS_LINK'_'sched_get_priority_min | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -7686,7 +7687,7 @@ else ac_save_LIBS="$LIBS" LIBS="-l$THREADS_LINK $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:7702: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7719,7 +7720,7 @@ EOF else echo "$ac_t""no" 1>&6 echo $ac_n "checking for sched_get_priority_min in -l"posix4"""... $ac_c" 1>&6 -echo "configure:7723: checking for sched_get_priority_min in -l"posix4"" >&5 +echo "configure:7724: checking for sched_get_priority_min in -l"posix4"" >&5 ac_lib_var=`echo "posix4"'_'sched_get_priority_min | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -7727,7 +7728,7 @@ else ac_save_LIBS="$LIBS" LIBS="-l"posix4" $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:7743: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7768,7 +7769,7 @@ fi echo $ac_n "checking for pthread_cancel in -l$THREADS_LINK""... $ac_c" 1>&6 -echo "configure:7772: checking for pthread_cancel in -l$THREADS_LINK" >&5 +echo "configure:7773: checking for pthread_cancel in -l$THREADS_LINK" >&5 ac_lib_var=`echo $THREADS_LINK'_'pthread_cancel | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -7776,7 +7777,7 @@ else ac_save_LIBS="$LIBS" LIBS="-l$THREADS_LINK $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:7792: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else diff --git a/configure.in b/configure.in index 5ed268a1ff..63e99a25f7 100644 --- a/configure.in +++ b/configure.in @@ -1397,36 +1397,35 @@ THREADS_LINK="" UNIX_THREAD="" if test "$wxUSE_THREADS" = "1"; then - dnl For glibc 2 users who have the old libc 5 too - - AC_CHECK_LIB(pthread-0.7, pthread_create, [ - UNIX_THREAD="unix/threadpsx.cpp" - THREADS_LINK="pthread-0.7" - ],[ - AC_CHECK_HEADER(sys/prctl.h, [ - UNIX_THREAD="gtk/threadsgi.cpp" - ]) - - dnl pthread_create is always available in pthread but it seems not to be - dnl the case for pthread_setcanceltype. - - AC_CHECK_LIB(pthread, pthread_setcanceltype, [ - UNIX_THREAD="unix/threadpsx.cpp" - THREADS_LINK="pthread" - ]) + dnl find if POSIX threads are available + + dnl For glibc 2 users who have the old libc 5 too check pthread-0.7 first + AC_CHECK_LIB(pthread-0.7, pthread_create, [ + UNIX_THREAD="unix/threadpsx.cpp" + THREADS_LINK="pthread-0.7" + ],[ + dnl standard lib name is pthread + AC_CHECK_LIB(pthread, pthread_create, [ + UNIX_THREAD="unix/threadpsx.cpp" + THREADS_LINK="pthread" + ], [ + dnl thread functions are in libc_r under FreeBSD + AC_CHECK_LIB(c_r, pthread_create, [ + UNIX_THREAD="unix/threadpsx.cpp" + THREADS_LINK="c_r" + ], [ + dnl VZ: SGI threads are not supported currently + AC_CHECK_HEADER(sys/prctl.h, [ + UNIX_THREAD="gtk/threadsgi.cpp" + ]) + ]) + ]) ]) - if test "x$THREADS_LINK" = "x"; then - dnl thread functions are in libc_r under FreeBSD - AC_CHECK_LIB(c_r, pthread_create, - [ - UNIX_THREAD="unix/threadpsx.cpp" - THREADS_LINK="c_r" - ]) - fi - if test "$THREADS_LINK" != ""; then - AC_DEFINE(wxUSE_THREADS) + AC_DEFINE(wxUSE_THREADS) + else + AC_MSG_WARN(No thread support on this system) fi fi