From dcb52e7b86576519d5e94d09ac492b6dd5284a9d Mon Sep 17 00:00:00 2001 From: "cls%seawood.org" Date: Thu, 26 Oct 2000 07:53:51 +0000 Subject: [PATCH] Add gcc check for -pthreads if -pthread check fails. bug #44504 Thanks to madams @janna.com (Mark G. Adams) for the patch. git-svn-id: svn://10.0.0.236/trunk@81804 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/nsprpub/configure | 44 ++++++++++++++++++++++++++---------- mozilla/nsprpub/configure.in | 22 ++++++++++++++++++ 2 files changed, 54 insertions(+), 12 deletions(-) diff --git a/mozilla/nsprpub/configure b/mozilla/nsprpub/configure index d35ceaab59e..b32a91778ad 100755 --- a/mozilla/nsprpub/configure +++ b/mozilla/nsprpub/configure @@ -3628,6 +3628,23 @@ echo "configure:3619: checking whether ${CC-cc} accepts -pthread" >&5 rm -f conftest* echo "$ac_t""$ac_cv_have_dash_pthread" 1>&6 + ac_cv_have_dash_pthreads=no + if test "$ac_cv_have_dash_pthread" = "no"; then + echo $ac_n "checking whether ${CC-cc} accepts -pthreads""... $ac_c" 1>&6 +echo "configure:3635: checking whether ${CC-cc} accepts -pthreads" >&5 + echo 'int main() { return 0; }' | cat > conftest.c + ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1 + if test $? -eq 0; then + if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then + ac_cv_have_dash_pthreads=yes + CFLAGS="$CFLAGS -pthreads" + CXXFLAGS="$CXXFLAGS -pthreads" + fi + fi + rm -f conftest* + echo "$ac_t""$ac_cv_have_dash_pthreads" 1>&6 + fi + case "$target" in *-mingw*|*-cygwin*|*-uwin*) ;; @@ -3636,6 +3653,9 @@ echo "configure:3619: checking whether ${CC-cc} accepts -pthread" >&5 #define _REENTRANT 1 EOF + if test "$ac_cv_have_dash_pthreads" = "yes"; then + PTHREAD_LDFLAGS= + fi ;; *-freebsd*) cat >> confdefs.h <<\EOF @@ -3685,12 +3705,12 @@ EOF esac echo $ac_n "checking for pthread_create""... $ac_c" 1>&6 -echo "configure:3689: checking for pthread_create" >&5 +echo "configure:3709: checking for pthread_create" >&5 if eval "test \"`echo '$''{'ac_cv_func_pthread_create'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3737: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_pthread_create=yes" else @@ -3732,7 +3752,7 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for pthread_create in -lpthread""... $ac_c" 1>&6 -echo "configure:3736: checking for pthread_create in -lpthread" >&5 +echo "configure:3756: 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 @@ -3740,7 +3760,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lpthread $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3775: \"$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 @@ -3850,12 +3870,12 @@ EOF esac echo $ac_n "checking for dlopen""... $ac_c" 1>&6 -echo "configure:3854: checking for dlopen" >&5 +echo "configure:3874: checking for dlopen" >&5 if eval "test \"`echo '$''{'ac_cv_func_dlopen'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3902: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_dlopen=yes" else @@ -3897,7 +3917,7 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6 -echo "configure:3901: checking for dlopen in -ldl" >&5 +echo "configure:3921: checking for dlopen in -ldl" >&5 ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3905,7 +3925,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3940: \"$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 diff --git a/mozilla/nsprpub/configure.in b/mozilla/nsprpub/configure.in index d4e14f9e19e..ba583180fe5 100644 --- a/mozilla/nsprpub/configure.in +++ b/mozilla/nsprpub/configure.in @@ -965,11 +965,33 @@ if test -n "$USE_PTHREADS"; then rm -f conftest* AC_MSG_RESULT($ac_cv_have_dash_pthread) + dnl + dnl See if -pthreads is supported. + dnl + ac_cv_have_dash_pthreads=no + if test "$ac_cv_have_dash_pthread" = "no"; then + AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads) + echo 'int main() { return 0; }' | cat > conftest.c + ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1 + if test $? -eq 0; then + if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then + ac_cv_have_dash_pthreads=yes + CFLAGS="$CFLAGS -pthreads" + CXXFLAGS="$CXXFLAGS -pthreads" + fi + fi + rm -f conftest* + AC_MSG_RESULT($ac_cv_have_dash_pthreads) + fi + case "$target" in *-mingw*|*-cygwin*|*-uwin*) ;; *-solaris*) AC_DEFINE(_REENTRANT) + if test "$ac_cv_have_dash_pthreads" = "yes"; then + PTHREAD_LDFLAGS= + fi ;; *-freebsd*) AC_DEFINE(_REENTRANT)