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
This commit is contained in:
44
mozilla/nsprpub/configure
vendored
44
mozilla/nsprpub/configure
vendored
@@ -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 <<EOF
|
||||
#line 3694 "configure"
|
||||
#line 3714 "configure"
|
||||
#include "confdefs.h"
|
||||
/* System header to define __stub macros and hopefully few prototypes,
|
||||
which can conflict with char pthread_create(); below. */
|
||||
@@ -3713,7 +3733,7 @@ pthread_create();
|
||||
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:3717: \"$ac_link\") 1>&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 <<EOF
|
||||
#line 3744 "configure"
|
||||
#line 3764 "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
|
||||
@@ -3751,7 +3771,7 @@ int main() {
|
||||
pthread_create()
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:3755: \"$ac_link\") 1>&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 <<EOF
|
||||
#line 3859 "configure"
|
||||
#line 3879 "configure"
|
||||
#include "confdefs.h"
|
||||
/* System header to define __stub macros and hopefully few prototypes,
|
||||
which can conflict with char dlopen(); below. */
|
||||
@@ -3878,7 +3898,7 @@ dlopen();
|
||||
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:3882: \"$ac_link\") 1>&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 <<EOF
|
||||
#line 3909 "configure"
|
||||
#line 3929 "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
|
||||
@@ -3916,7 +3936,7 @@ int main() {
|
||||
dlopen()
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:3920: \"$ac_link\") 1>&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
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user