rbb 99/12/22 12:29:20
Modified: src/lib/apr acconfig.h configure.in src/lib/apr/locks/unix intraproc.c src/lib/apr/misc/unix start.c src/modules/mpm/prefork config.m4 Log: Clean up APR's configure script a bit. This commit also allows Apache to specify that APR should be built without threads for the prefork MPM. This is broken if we then try to configure Apache again using a threaded MPM, but this is easily fixable, and I will be doing that soon. Lastly, I removed all thread calls from APR when it is told to build without threads. Revision Changes Path 1.18 +1 -0 apache-2.0/src/lib/apr/acconfig.h Index: acconfig.h =================================================================== RCS file: /home/cvs/apache-2.0/src/lib/apr/acconfig.h,v retrieving revision 1.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- acconfig.h 1999/12/21 21:16:14 1.17 +++ acconfig.h 1999/12/22 20:29:16 1.18 @@ -45,6 +45,7 @@ #undef USEBCOPY #undef HAVE_GMTOFF +#undef USE_THREADS #undef SIZEOF_SSIZE_T 1.38 +50 -67 apache-2.0/src/lib/apr/configure.in Index: configure.in =================================================================== RCS file: /home/cvs/apache-2.0/src/lib/apr/configure.in,v retrieving revision 1.37 retrieving revision 1.38 diff -u -r1.37 -r1.38 --- configure.in 1999/12/21 21:16:17 1.37 +++ configure.in 1999/12/22 20:29:16 1.38 @@ -1,3 +1,4 @@ + AC_CONFIG_AUX_DIR(./helpers) OS=`./config.guess` OS=`./config.sub $OS` @@ -28,6 +29,42 @@ AC_CHECK_PROG(RM, rm, rm) AC_CHECK_PROG(AR, ar, ar) +# This macro needs to be here in case we are on an AIX box. +AC_AIX + +AC_CACHE_CHECK([for threads], ac_cv_enable_threads, + [ AC_ARG_ENABLE(threads, + [ --enable-threads Enable threading support in APR.], + [ ] , + [ AC_CHECK_HEADERS(pthread.h, + [ ac_cv_enable_threads="pthread" ] , + [ ac_cv_enable_threads="no" ] ) ] ) ] ) + +if test "$ac_cv_enable_threads" = "no"; then + threads="0" + pthreadh="0" +else + if test "$ac_cv_enable_threads" = "pthread"; then + AC_CHECK_HEADERS(pthread.h, [ + threads="1" + pthreadh="1" + AC_DEFINE(USE_THREADS) ], [ + threads="0" + pthreadh="0" ] ) + fi +fi + +pthreadser="0" +if test "$threads" = "1"; then + AC_CHECK_DEFINE(PTHREAD_PROCESS_SHARED, pthread.h) + AC_CHECK_LIB(pthread, pthread_mutex_init, [ + AC_DEFINE(USE_PTHREAD_SERIALIZE) + pthreadser="1" ]) + AC_CHECK_LIB(c_r, pthread_mutex_init, [ + AC_DEFINE(USE_PTHREAD_SERIALIZE) + pthreadser="1"]) +fi + AC_ARG_WITH(debug,[ --with-debug Turn on debugging and compile time warnings], [if test "$GCC" = "yes"; then CFLAGS="$CFLAGS -g -Wall"; else CFLAGS="$CFLAGS -g"; fi]) @@ -42,10 +79,6 @@ ;; esac - -# This macro needs to be here in case we are on an AIX box. -AC_AIX - dnl Checks for standard typedefs AC_TYPE_OFF_T AC_TYPE_PID_T @@ -80,9 +113,6 @@ if test "$ac_cv_sizeof_longlong" = "8"; then long_value="__int64" fi -AC_SUBST(short_value) -AC_SUBST(int_value) -AC_SUBST(long_value) if test "$ac_cv_type_off_t" = "yes"; then off_t_value="off_t" @@ -100,10 +130,6 @@ ssize_t_value="ap_int32_t" fi -AC_SUBST(off_t_value) -AC_SUBST(size_t_value) -AC_SUBST(ssize_t_value) - AC_CHECK_SIZEOF_EXTENDED([#include <sys/types.h>], ssize_t, 8) # Use /bin/sh if it exists, otherwise go looking for sh in the path @@ -114,7 +140,6 @@ AC_CHECK_DEFINE(LOCK_EX, sys/file.h) AC_CHECK_DEFINE(F_SETLK, fcntl.h) -AC_CHECK_DEFINE(PTHREAD_PROCESS_SHARED, pthread.h) dnl Checks for libraries. AC_BEGIN_DECISION([lock implementation method]) @@ -153,24 +178,9 @@ procpthreadser="0" fi -AC_SUBST(flockser) -AC_SUBST(sysvser) -AC_SUBST(fcntlser) -AC_SUBST(procpthreadser) - -pthreadser="0" -AC_CHECK_LIB(pthread, pthread_mutex_init, [ - AC_DEFINE(USE_PTHREAD_SERIALIZE) - pthreadser="1" ]) -AC_CHECK_LIB(c_r, pthread_mutex_init, [ - AC_DEFINE(USE_PTHREAD_SERIALIZE) - pthreadser="1"]) -AC_SUBST(pthreadser) - ac_cv_define_READDIR_IS_THREAD_SAFE=no AC_CHECK_LIB(c_r, readdir, AC_DEFINE(READDIR_IS_THREAD_SAFE)) - case "$OS" in *-os2*) CFLAGS="$CFLAGS -DOS2 -Zmt" @@ -308,46 +318,6 @@ AC_CHECK_FUNCS(gmtime_r localtime_r) -AC_MSG_CHECKING(whether to enable thread support) -AC_ARG_ENABLE(threads, -[ --enable-threads Enable threading support in APR.], -[ - if test "$enableval" = "no"; then - threads="0" - pthreadh="0" - AC_SUBST(threads) - AC_SUBST(pthreadh) - AC_MSG_RESULT(no) - else - if test "$enableval" = "pthread"; then - AC_CHECK_HEADERS(pthread.h, [ - threads="1" - pthreadh="1" - AC_SUBST(pthreadh) - AC_SUBST(threads) ], [ - threads="0" - pthreadh="0" - AC_SUBST(pthreadh) - AC_SUBST(threads) ] ) - AC_MSG_RESULT(yes) - else - AC_MSG_RESULT(no) - fi - fi -], -[ - AC_CHECK_HEADERS(pthread.h, [ - threads="1" - pthreadh="1" - AC_SUBST(pthreadh) - AC_SUBST(threads) ], [ - threads="0" - pthreadh="0" - AC_SUBST(pthreadh) - AC_SUBST(threads) ] ) -]) - - dnl Start building stuff from our information AC_SUBST(LDLIBS) AC_SUBST(OPTIM) @@ -366,6 +336,19 @@ AC_SUBST(stdioh) AC_SUBST(sys_typesh) AC_SUBST(sys_uioh) +AC_SUBST(threads) +AC_SUBST(pthreadh) +AC_SUBST(short_value) +AC_SUBST(int_value) +AC_SUBST(long_value) +AC_SUBST(off_t_value) +AC_SUBST(size_t_value) +AC_SUBST(ssize_t_value) +AC_SUBST(flockser) +AC_SUBST(sysvser) +AC_SUBST(fcntlser) +AC_SUBST(procpthreadser) +AC_SUBST(pthreadser) AC_CACHE_CHECK([for tm_gmtoff in struct tm], ac_cv_struct_tm_gmtoff, [AC_TRY_COMPILE([#include <sys/types.h> 1.9 +1 -1 apache-2.0/src/lib/apr/locks/unix/intraproc.c Index: intraproc.c =================================================================== RCS file: /home/cvs/apache-2.0/src/lib/apr/locks/unix/intraproc.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- intraproc.c 1999/12/03 15:18:27 1.8 +++ intraproc.c 1999/12/22 20:29:18 1.9 @@ -56,7 +56,7 @@ #if APR_HAS_THREADS -#if defined (USE_PTHREAD_SERIALIZE) +#if defined(USE_PTHREAD_SERIALIZE) ap_status_t lock_intra_cleanup(void *data) { 1.16 +3 -4 apache-2.0/src/lib/apr/misc/unix/start.c Index: start.c =================================================================== RCS file: /home/cvs/apache-2.0/src/lib/apr/misc/unix/start.c,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- start.c 1999/12/03 15:18:30 1.15 +++ start.c 1999/12/22 20:29:19 1.16 @@ -186,14 +186,13 @@ */ ap_status_t ap_initialize(void) { -#ifdef HAVE_PTHREAD_SIGMASK sigset_t sigset; sigfillset(&sigset); - /*@@@ FIXME: This should *NOT* be called for the prefork MPM, - * even if HAVE_PTHREAD_SIGMASK is defined!!!! MnKr - */ +#if defined(HAVE_PTHREAD_SIGMASK) && defined(USE_THREADS) pthread_sigmask(SIG_BLOCK, &sigset, NULL); +#else + sigprocmask(SIG_BLOCK, &sigset, NULL); #endif return APR_SUCCESS; } 1.3 +4 -0 apache-2.0/src/modules/mpm/prefork/config.m4 Index: config.m4 =================================================================== RCS file: /home/cvs/apache-2.0/src/modules/mpm/prefork/config.m4,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- config.m4 1999/11/30 03:52:45 1.2 +++ config.m4 1999/12/22 20:29:20 1.3 @@ -1,4 +1,8 @@ if test "$MPM_NAME" = "prefork" ; then +dnl Turn off all threading functions in APR + ac_cv_enable_threads="no" + AC_CACHE_SAVE + APACHE_OUTPUT(modules/mpm/$MPM_NAME/Makefile) APACHE_MPM_CHECK_SHMEM