Rewrite pthreads check to be more tool-independent, and propagate flags

to APR.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@84474 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sascha Schumann
2000-01-16 18:24:39 +00:00
parent fe938b5b70
commit e959e6b340
2 changed files with 32 additions and 43 deletions

View File

@ -141,28 +141,6 @@ AC_DEFUN(APACHE_ONCE,[
fi fi
]) ])
dnl APACHE_CHECK_GCC_ARG(ARG, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND)
AC_DEFUN(APACHE_CHECK_GCC_ARG,[
gcc_arg_name=[ac_cv_gcc_arg]translit($1,A-Z-,a-z_)
AC_CACHE_CHECK([whether $CC supports $1], [ac_cv_gcc_arg]translit($1,A-Z-,a-z_), [
echo 'void somefunc() { };' > conftest.c
cmd='$CC $1 -c conftest.c'
if eval $cmd 2>&1 | egrep -e $1 >/dev/null ; then
ac_result=no
else
ac_result=yes
fi
eval $gcc_arg_name=$ac_result
rm -f conftest.*
])
if eval test "\$$gcc_arg_name" = "yes"; then
$2
else
:
$3
fi
])
dnl dnl
dnl APACHE_CHECK_THREADS() dnl APACHE_CHECK_THREADS()
dnl dnl
@ -189,26 +167,35 @@ int main() {
AC_DEFUN(APACHE_CHECK_THREADS,[ AC_DEFUN(APACHE_CHECK_THREADS,[
old_CFLAGS="$CFLAGS"
if test -n "$GCC"; then
APACHE_CHECK_GCC_ARG(-pthread, [
CFLAGS="$CFLAGS -pthread"
],[
APACHE_CHECK_GCC_ARG(-pthreads, [
CFLAGS="$CFLAGS -pthreads"
],[
APACHE_CHECK_GCC_ARG(-mthreads, [
CFLAGS="$CFLAGS -mthreads"
])])])
fi
APACHE_THREAD_TEST APACHE_THREAD_TEST
if test "$apache_threads_working" != "yes"; then if test "$apache_threads_working" != "yes"; then
CFLAGS="$old_CFLAGS" for flag in -pthreads -pthread -mthreads; do
AC_CHECK_LIB(pthread, pthread_kill) AC_MSG_CHECKING(whether $flag enables POSIX threads)
APACHE_THREAD_TEST ac_save="$CFLAGS"
CFLAGS="$CFLAGS $flag"
APACHE_THREAD_TEST
if test "$apache_threads_working" = "yes"; then
AC_MSG_RESULT(yes)
REENTRANCY_CFLAGS="$REENTRANCY_CFLAGS $flag"
break
fi
CFLAGS="$ac_save"
AC_MSG_RESULT(no)
done
fi
if test "$apache_threads_working" != "yes"; then
for lib in pthread pthreads c_r; do
ac_save="$LIBS"
LIBS="$LIBS -l$lib"
APACHE_THREAD_TEST
if test "$apache_threads_working" = "yes"; then
REENTRANCY_LDFLAGS="$REENTRANCY_LDFLAGS -l$lib"
break
fi
LIBS="$ac_save"
done
fi fi
if test "$apache_threads_working" = "yes"; then if test "$apache_threads_working" = "yes"; then

View File

@ -104,10 +104,12 @@ APACHE_INADDR_NONE
case "`uname -sr`" in case "`uname -sr`" in
"SunOS 5"*) "SunOS 5"*)
REENTRANCY_FLAGS="$REENTRANCY_FLAGS -D_POSIX_PTHREAD_SEMANTICS";; REENTRANCY_CFLAGS="$REENTRANCY_CFLAGS -D_POSIX_PTHREAD_SEMANTICS";;
esac esac
REENTRANCY_FLAGS="$REENTRANCY_FLAGS -D_REENTRANT" REENTRANCY_CFLAGS="$REENTRANCY_CFLAGS -D_REENTRANT"
CFLAGS="$CFLAGS $REENTRANCY_CFLAGS"
AC_FUNC_SELECT_ARGTYPES AC_FUNC_SELECT_ARGTYPES
@ -156,7 +158,6 @@ if test "$apache_need_shared" = "yes"; then
$SHELL $srcdir/ltconfig --output=shlibtool --disable-static --srcdir=$srcdir --cache-file=./config.cache $srcdir/ltmain.sh $SHELL $srcdir/ltconfig --output=shlibtool --disable-static --srcdir=$srcdir --cache-file=./config.cache $srcdir/ltmain.sh
fi fi
CPPFLAGS="$CPPFLAGS $REENTRANCY_FLAGS"
APACHE_FAST_OUTPUT(Makefile ap/Makefile lib/Makefile main/Makefile APACHE_FAST_OUTPUT(Makefile ap/Makefile lib/Makefile main/Makefile
modules/Makefile os/Makefile) modules/Makefile os/Makefile)
APACHE_FAST_GENERATE APACHE_FAST_GENERATE
@ -165,6 +166,7 @@ dnl ## Build modules.c
rm -f $srcdir/modules.c rm -f $srcdir/modules.c
echo $MODLIST | $AWK -f $srcdir/helpers/build-modules-c.awk > $srcdir/modules.c echo $MODLIST | $AWK -f $srcdir/helpers/build-modules-c.awk > $srcdir/modules.c
APACHE_PASSTHRU(REENTRANCY_FLAGS) APACHE_PASSTHRU(REENTRANCY_CFLAGS)
APACHE_PASSTHRU(REENTRANCY_LDFLAGS)
AC_OUTPUT($APACHE_OUTPUT_FILES) AC_OUTPUT($APACHE_OUTPUT_FILES)