summaryrefslogtreecommitdiff
path: root/TSRM/tsrm.m4
diff options
context:
space:
mode:
authorSascha Schumann <sas@php.net>1999-12-22 22:23:06 +0000
committerSascha Schumann <sas@php.net>1999-12-22 22:23:06 +0000
commitaa3737e6e1880d20cf7f1e8388f6584c7a1cea33 (patch)
tree683c38dce5f1992d21ced9ce1f636b66172f6b6e /TSRM/tsrm.m4
parentb0e1f9ca2f1b0a0bce7764f11849a0d1f7788b40 (diff)
downloadphp-git-aa3737e6e1880d20cf7f1e8388f6584c7a1cea33.tar.gz
Improved check for GCC's -pthread and -pthreads flag
Diffstat (limited to 'TSRM/tsrm.m4')
-rw-r--r--TSRM/tsrm.m433
1 files changed, 29 insertions, 4 deletions
diff --git a/TSRM/tsrm.m4 b/TSRM/tsrm.m4
index 1523c58f48..4c3ddd8ed4 100644
--- a/TSRM/tsrm.m4
+++ b/TSRM/tsrm.m4
@@ -1,3 +1,15 @@
+AC_DEFUN(TSRM_CHECK_GCC_ARG,[
+ AC_MSG_CHECKING(whether $CC supports $1)
+ > conftest.c
+ cmd='$CC $1 -c conftest.c'
+ if eval $cmd 2>&1 | egrep -e $1 >/dev/null ; then
+ $2=no
+ else
+ $2=yes
+ fi
+ AC_MSG_RESULT($$2)
+ rm -f conftest.*
+])
AC_DEFUN(TSRM_BASIC_CHECKS,[
@@ -31,11 +43,24 @@ AC_MSG_RESULT(yes - installed in $PTH_PREFIX)
AC_DEFUN(TSRM_CHECK_PTHREADS,[
-dnl Check for FreeBSD/Linux -pthread option
-
old_LDFLAGS="$LDFLAGS"
-LDFLAGS="$LDFLAGS -pthread"
-AC_CHECK_FUNCS(pthread_kill)
+
+if test -n "$GCC"; then
+ dnl FreeBSD/Linux
+ TSRM_CHECK_GCC_ARG(-pthread, gcc_pthread)
+
+ if test "$gcc_pthread" = "yes"; then
+ LDFLAGS="$LDFLAGS -pthread"
+ else
+ dnl gcc on Solaris
+ TSRM_CHECK_GCC_ARG(-pthreads, gcc_pthreads)
+ if test "$gcc_pthreads" = "yes"; then
+ LDFLAGS="$LDFLAGS -pthreads"
+ fi
+ fi
+
+ AC_CHECK_FUNCS(pthread_kill)
+fi
if test "$ac_cv_func_pthread_kill" != "yes"; then
LDFLAGS="$old_LDFLAGS"