diff options
author | cls%seawood.org <devnull@localhost> | 2000-10-26 07:52:12 +0000 |
---|---|---|
committer | cls%seawood.org <devnull@localhost> | 2000-10-26 07:52:12 +0000 |
commit | 40db685d681c855345ceccaa90d417c48031be93 (patch) | |
tree | 7eeeb26a80d96a5a1d2466a89420ef9f738e8575 | |
parent | 426420c62e8e093e10bd4ad1438dc68662988633 (diff) | |
download | nspr-hg-40db685d681c855345ceccaa90d417c48031be93.tar.gz |
Add gcc check for -pthreads if -pthread check fails. bug #44504 Thanks to madams@janna.com (Mark G. Adams) for the patch.
-rwxr-xr-x | configure | 44 | ||||
-rw-r--r-- | configure.in | 22 |
2 files changed, 54 insertions, 12 deletions
@@ -3624,6 +3624,23 @@ echo "configure:3615: 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:3631: 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*) ;; @@ -3632,6 +3649,9 @@ echo "configure:3615: 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 @@ -3681,12 +3701,12 @@ EOF esac echo $ac_n "checking for pthread_create""... $ac_c" 1>&6 -echo "configure:3685: checking for pthread_create" >&5 +echo "configure:3705: 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 <<EOF -#line 3690 "configure" +#line 3710 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char pthread_create(); below. */ @@ -3709,7 +3729,7 @@ pthread_create(); ; return 0; } EOF -if { (eval echo configure:3713: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3733: \"$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 @@ -3728,7 +3748,7 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for pthread_create in -lpthread""... $ac_c" 1>&6 -echo "configure:3732: checking for pthread_create in -lpthread" >&5 +echo "configure:3752: 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 @@ -3736,7 +3756,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lpthread $LIBS" cat > conftest.$ac_ext <<EOF -#line 3740 "configure" +#line 3760 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -3747,7 +3767,7 @@ int main() { pthread_create() ; return 0; } EOF -if { (eval echo configure:3751: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3771: \"$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 @@ -3846,12 +3866,12 @@ EOF esac echo $ac_n "checking for dlopen""... $ac_c" 1>&6 -echo "configure:3850: checking for dlopen" >&5 +echo "configure:3870: 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 <<EOF -#line 3855 "configure" +#line 3875 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char dlopen(); below. */ @@ -3874,7 +3894,7 @@ dlopen(); ; return 0; } EOF -if { (eval echo configure:3878: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3898: \"$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 @@ -3893,7 +3913,7 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6 -echo "configure:3897: checking for dlopen in -ldl" >&5 +echo "configure:3917: 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 @@ -3901,7 +3921,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldl $LIBS" cat > conftest.$ac_ext <<EOF -#line 3905 "configure" +#line 3925 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -3912,7 +3932,7 @@ int main() { dlopen() ; return 0; } EOF -if { (eval echo configure:3916: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3936: \"$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/configure.in b/configure.in index 19a99695..9f5ed494 100644 --- a/configure.in +++ b/configure.in @@ -945,11 +945,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) |