cvs commit: apache-2.0/src/modules/mpm config.m4
dreid 00/02/07 04:05:23 Modified:src/modules/mpm config.m4 Log: These changes allow the MPM to be selected based on platform. At present it works for BeOS but adding others shouldn't be hard. Also added the OS2 MPM to the list. Revision ChangesPath 1.11 +5 -1 apache-2.0/src/modules/mpm/config.m4 Index: config.m4 === RCS file: /home/cvs/apache-2.0/src/modules/mpm/config.m4,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- config.m4 2000/01/26 07:47:34 1.10 +++ config.m4 2000/02/07 12:05:22 1.11 @@ -1,10 +1,14 @@ AC_MSG_CHECKING(which MPM to use) AC_ARG_WITH(mpm, [ --with-mpm=MPM Choose the process model for Apache to use. - MPM={dexter,mpmt_beos,mpmt_pthread,prefork}],[ + MPM={dexter,mpmt_beos,mpmt_pthread,prefork,spmt_os2}],[ APACHE_MPM=$withval ],[ APACHE_MPM=mpmt_pthread + case `uname -sr` in +BeOS*) + APACHE_MPM=mpmt_beos;; + esac ]) AC_MSG_RESULT($APACHE_MPM)
cvs commit: apache-2.0/src/modules/mpm config.m4
bjh 00/01/25 23:47:35 Modified:src/modules/mpm config.m4 Log: Only check for pthreads for mpms that actually need it rather than assuming everything except prefork needs it. Clarify threads != pthreads. Revision ChangesPath 1.10 +2 -2 apache-2.0/src/modules/mpm/config.m4 Index: config.m4 === RCS file: /home/cvs/apache-2.0/src/modules/mpm/config.m4,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- config.m4 2000/01/16 20:00:51 1.9 +++ config.m4 2000/01/26 07:47:34 1.10 @@ -10,13 +10,13 @@ apache_cv_mpm=$APACHE_MPM -if test $apache_cv_mpm != prefork; then +if test $apache_cv_mpm = mpmt_pthread -o $apache_cv_mpm = dexter; then PTHREADS_CHECK AC_MSG_CHECKING([for which threading library to use]) AC_MSG_RESULT($threads_result) if test $apache_threads_working = no; then -AC_MSG_RESULT(The currently selected MPM requires threads which your system seems to lack) +AC_MSG_RESULT(The currently selected MPM requires pthreads which your system seems to lack) AC_MSG_CHECKING(checking for replacement) AC_MSG_RESULT(prefork selected) apache_cv_mpm=prefork
cvs commit: apache-2.0/src/modules/mpm config.m4
sascha 00/01/16 12:00:52 Modified:src acinclude.m4 configure.in src/build build2.mk src/lib/apr aclocal.m4 configure.in src/modules/mpm config.m4 Added: src/lib/apr threads.m4 Log: Move threads/reentrancy m4 macros into threads.m4. All results are now cached and can be made easily available to Apache and APR. Revision ChangesPath 1.17 +1 -63 apache-2.0/src/acinclude.m4 Index: acinclude.m4 === RCS file: /home/cvs/apache-2.0/src/acinclude.m4,v retrieving revision 1.16 retrieving revision 1.17 diff -u -u -r1.16 -r1.17 --- acinclude.m4 2000/01/16 18:24:39 1.16 +++ acinclude.m4 2000/01/16 20:00:46 1.17 @@ -141,69 +141,7 @@ fi ]) -dnl -dnl APACHE_CHECK_THREADS() -dnl -dnl Determine the best flags for linking against a threading library. -dnl -AC_DEFUN(APACHE_THREAD_TEST, [ -AC_TRY_RUN( [ -#include pthread.h - -void *thread_routine(void *data) { -return data; -} - -int main() { -pthread_t thd; -int data = 1; -return pthread_create(thd, NULL, thread_routine, data); -} ], [ - apache_threads_working=yes - ], [ - apache_threads_working=no - ], apache_threads_working=no ) ] ) - - -AC_DEFUN(APACHE_CHECK_THREADS,[ - -APACHE_THREAD_TEST - -if test $apache_threads_working != yes; then - for flag in -pthreads -pthread -mthreads; do -AC_MSG_CHECKING(whether $flag enables POSIX threads) -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 - -if test $apache_threads_working = yes; then - threads_result=POSIX Threads found -else - threads_result=POSIX Threads not found -fi -]) +sinclude(lib/apr/threads.m4) dnl dnl APACHE_INADDR_NONE 1.20 +1 -11 apache-2.0/src/configure.in Index: configure.in === RCS file: /home/cvs/apache-2.0/src/configure.in,v retrieving revision 1.19 retrieving revision 1.20 diff -u -u -r1.19 -r1.20 --- configure.in 2000/01/16 18:24:39 1.19 +++ configure.in 2000/01/16 20:00:46 1.20 @@ -102,15 +102,8 @@ APACHE_INADDR_NONE -case `uname -sr` in -SunOS 5*) - REENTRANCY_CFLAGS=$REENTRANCY_CFLAGS -D_POSIX_PTHREAD_SEMANTICS;; -esac +REENTRANCY_FLAGS -REENTRANCY_CFLAGS=$REENTRANCY_CFLAGS -D_REENTRANT - -CFLAGS=$CFLAGS $REENTRANCY_CFLAGS - AC_FUNC_SELECT_ARGTYPES dnl Check if we'll actually need to cast select args all the time @@ -165,8 +158,5 @@ dnl ## Build modules.c rm -f $srcdir/modules.c echo $MODLIST | $AWK -f $srcdir/helpers/build-modules-c.awk $srcdir/modules.c - -APACHE_PASSTHRU(REENTRANCY_CFLAGS) -APACHE_PASSTHRU(REENTRANCY_LDFLAGS) AC_OUTPUT($APACHE_OUTPUT_FILES) 1.4 +2 -2 apache-2.0/src/build/build2.mk Index: build2.mk === RCS file: /home/cvs/apache-2.0/src/build/build2.mk,v retrieving revision 1.3 retrieving revision 1.4 diff -u -u -r1.3 -r1.4 --- build2.mk 2000/01/16 18:20:17 1.3 +++ build2.mk 2000/01/16 20:00:48 1.4 @@ -21,7 +21,7 @@ # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # ## -# $Id: build2.mk,v 1.3 2000/01/16 18:20:17 sascha Exp $ +# $Id: build2.mk,v 1.4 2000/01/16 20:00:48 sascha Exp $ include generated_lists @@ -73,6 +73,6 @@ @rm -f $@ (cd lib/apr autoheader) -$(apr_configure): lib/apr/aclocal.m4 lib/apr/configure.in +$(apr_configure): lib/apr/aclocal.m4 lib/apr/configure.in lib/apr/threads.m4 @echo rebuilding $@ (cd lib/apr autoconf) 1.10 +2 -0 apache-2.0/src/lib/apr/aclocal.m4 Index: aclocal.m4 === RCS file: /home/cvs/apache-2.0/src/lib/apr/aclocal.m4,v retrieving revision 1.9 retrieving revision 1.10 diff -u -u -r1.9 -r1.10 --- aclocal.m42000/01/11 12:58:46 1.9 +++ aclocal.m42000/01/16 20:00:49 1.10 @@ -187,3 +187,5 @@ AC_DEFINE(HAVE_SOCKLEN_T, 1, [Whether you have socklen_t]) fi ]) + +sinclude(threads.m4)
cvs commit: apache-2.0/src/modules/mpm config.m4
rbb 99/12/24 10:31:11 Modified:src acinclude.m4 configure.in src/modules/mpm config.m4 Log: Finish the MPM decision logic. This moves the threads checking stuff into the mpm directory where it belongs. It also adds logic so that if threads aren't detected, we automatically choose to use the prefork mpm. Lastly, I also cleaned up a variable name to make it more consistent with the other variables used in our configure script. Revision ChangesPath 1.9 +5 -5 apache-2.0/src/acinclude.m4 Index: acinclude.m4 === RCS file: /home/cvs/apache-2.0/src/acinclude.m4,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- acinclude.m4 1999/12/23 21:01:27 1.8 +++ acinclude.m4 1999/12/24 18:31:08 1.9 @@ -113,10 +113,10 @@ int data = 1; return pthread_create(thd, NULL, thread_routine, data); } ], [ - THREADS_WORKING=yes + apache_threads_working=yes ], [ - THREADS_WORKING=no - ], THREADS_WORKING=no ) ] ) + apache_threads_working=no + ], apache_threads_working=no ) ] ) define(APACHE_CHECK_THREADS, [dnl cflags_orig=$CFLAGS @@ -126,11 +126,11 @@ CFLAGS=$test_cflag $cflags_orig LDFLAGS=$test_ldflag $ldflags_orig THREAD_TEST() - if test $THREADS_WORKING = yes; then + if test $apache_threads_working = yes; then break fi done -if test $THREADS_WORKING = yes; then +if test $apache_threads_working = yes; then threads_result=Updating CFLAGS and LDFLAGS break fi 1.16 +0 -4 apache-2.0/src/configure.in Index: configure.in === RCS file: /home/cvs/apache-2.0/src/configure.in,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- configure.in 1999/12/23 21:01:28 1.15 +++ configure.in 1999/12/24 18:31:09 1.16 @@ -73,10 +73,6 @@ dnl ## Check for library functions -AC_MSG_CHECKING([for which threading library to use]) -APACHE_CHECK_THREADS('' -pthread -D_REENTRANT, '' -lpthread -lc_r) -AC_MSG_RESULT($threads_result) - dnl See Comment #Spoon AC_CHECK_FUNCS( \ 1.6 +12 -0 apache-2.0/src/modules/mpm/config.m4 Index: config.m4 === RCS file: /home/cvs/apache-2.0/src/modules/mpm/config.m4,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- config.m4 1999/12/23 21:01:31 1.5 +++ config.m4 1999/12/24 18:31:10 1.6 @@ -14,6 +14,18 @@ AC_MSG_RESULT(No MPM specified. Using pthread) ]) +AC_MSG_CHECKING([for which threading library to use]) +APACHE_CHECK_THREADS('' -pthread -D_REENTRANT, '' -lpthread -lc_r) +AC_MSG_RESULT($threads_result) + +AC_MSG_CHECKING([to ensure I can compile the selected MPM]) +if test $apache_threads_working = no $apache_cv_mpm != prefork; then +AC_MSG_RESULT([can't compile selected MPM because there are no threads, defaulting to prefork]) +apache_cv_mpm=prefork +else +AC_MSG_RESULT([OK]) +fi + APACHE_OUTPUT(modules/mpm/Makefile) MPM_NAME=$apache_cv_mpm MPM_DIR=modules/mpm/$MPM_NAME
cvs commit: apache-2.0/src/modules/mpm config.m4
rbb 99/12/24 13:12:24 Modified:src/modules/mpm config.m4 Log: Fix the threads check so it works on non-bash shells. Submitted by: Sascha Schumann Reviewed by:Ryan Bloom Revision ChangesPath 1.7 +1 -1 apache-2.0/src/modules/mpm/config.m4 Index: config.m4 === RCS file: /home/cvs/apache-2.0/src/modules/mpm/config.m4,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- config.m4 1999/12/24 18:31:10 1.6 +++ config.m4 1999/12/24 21:12:20 1.7 @@ -19,7 +19,7 @@ AC_MSG_RESULT($threads_result) AC_MSG_CHECKING([to ensure I can compile the selected MPM]) -if test $apache_threads_working = no $apache_cv_mpm != prefork; then +if test $apache_threads_working = no test $apache_cv_mpm != prefork; then AC_MSG_RESULT([can't compile selected MPM because there are no threads, defaulting to prefork]) apache_cv_mpm=prefork else
cvs commit: apache-2.0/src/modules/mpm config.m4
rbb 99/12/23 13:01:32 Modified:src acinclude.m4 configure.in src/modules/mpm config.m4 Log: First stab at logic to determine which threading library to use. This also gets rid of the hack of always putting -pthread in the CFLAGS variable. Revision ChangesPath 1.8 +43 -0 apache-2.0/src/acinclude.m4 Index: acinclude.m4 === RCS file: /home/cvs/apache-2.0/src/acinclude.m4,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- acinclude.m4 1999/12/20 03:09:43 1.7 +++ acinclude.m4 1999/12/23 21:01:27 1.8 @@ -95,3 +95,46 @@ fi ]) +dnl +dnl APACHE_CHECK_THREADS() +dnl +dnl Determine the best flags for linking against a threading library. +dnl +AC_DEFUN(THREAD_TEST, [ +AC_TRY_RUN( [ +#include pthread.h + +void *thread_routine(void *data) { +return data; +} + +int main() { +pthread_t thd; +int data = 1; +return pthread_create(thd, NULL, thread_routine, data); +} ], [ + THREADS_WORKING=yes + ], [ + THREADS_WORKING=no + ], THREADS_WORKING=no ) ] ) + +define(APACHE_CHECK_THREADS, [dnl + cflags_orig=$CFLAGS + ldflags_orig=$LDFLAGS + for test_cflag in $1; do +for test_ldflag in $2; do + CFLAGS=$test_cflag $cflags_orig + LDFLAGS=$test_ldflag $ldflags_orig + THREAD_TEST() + if test $THREADS_WORKING = yes; then +break + fi +done +if test $THREADS_WORKING = yes; then + threads_result=Updating CFLAGS and LDFLAGS + break +fi + threads_result=Threads not found + done +] ) + 1.15 +4 -0 apache-2.0/src/configure.in Index: configure.in === RCS file: /home/cvs/apache-2.0/src/configure.in,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- configure.in 1999/12/21 21:41:40 1.14 +++ configure.in 1999/12/23 21:01:28 1.15 @@ -73,6 +73,10 @@ dnl ## Check for library functions +AC_MSG_CHECKING([for which threading library to use]) +APACHE_CHECK_THREADS('' -pthread -D_REENTRANT, '' -lpthread -lc_r) +AC_MSG_RESULT($threads_result) + dnl See Comment #Spoon AC_CHECK_FUNCS( \ 1.5 +0 -2 apache-2.0/src/modules/mpm/config.m4 Index: config.m4 === RCS file: /home/cvs/apache-2.0/src/modules/mpm/config.m4,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- config.m4 1999/12/20 03:09:50 1.4 +++ config.m4 1999/12/23 21:01:31 1.5 @@ -46,8 +46,6 @@ dnl XXX - We should be checking for the proper flags to use on a particular dnl platform. This will cover a couple of them, anyway -CFLAGS=-pthread $CFLAGS -CXXFLAGS=-pthread $CXXFLAGS AC_CHECK_HEADER(pthread.h, [ ],[ AC_MSG_ERROR(This MPM requires pthreads. Try --with-mpm=prefork.)
Re: cvs commit: apache-2.0/src/modules/mpm config.m4
Okay, I just committed this bit of logic to detect the best flags for compiling threaded programs. A few caveats. This is tested only on Linux 2.2.10, but it should work everywhere. It doesn't always come up with the best possible flags, but it should alwyas work. For example, on Linux, it seems to come up with -lpthread in LDFLAGS instead of -pthread in CFLAGS, but since this is what I have been using to compile the server since we started, that should be okay. I also have not started to use this logic to help us pick which MPM to use. For example, picking prefork if there is no threading library defined. That is work for after this has been tested by more people. I would appreciate it if everybody who gave input on getting this test working would extract the new code, and try to configure and compile it. If there are no problems reported, then I will finish this work. If there are problems, we'll fix them when we know about them. :) Thanks to everybody who helped me get this test right. It does look like I missed a -lpthread somewhere in the configure stuff, but I'll track it down soon. Ryan On 23 Dec 1999 [EMAIL PROTECTED] wrote: rbb 99/12/23 13:01:32 Modified:src acinclude.m4 configure.in src/modules/mpm config.m4 Log: First stab at logic to determine which threading library to use. This also gets rid of the hack of always putting -pthread in the CFLAGS variable. Revision ChangesPath 1.8 +43 -0 apache-2.0/src/acinclude.m4 Index: acinclude.m4 === RCS file: /home/cvs/apache-2.0/src/acinclude.m4,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- acinclude.m41999/12/20 03:09:43 1.7 +++ acinclude.m41999/12/23 21:01:27 1.8 @@ -95,3 +95,46 @@ fi ]) +dnl +dnl APACHE_CHECK_THREADS() +dnl +dnl Determine the best flags for linking against a threading library. +dnl +AC_DEFUN(THREAD_TEST, [ +AC_TRY_RUN( [ +#include pthread.h + +void *thread_routine(void *data) { +return data; +} + +int main() { +pthread_t thd; +int data = 1; +return pthread_create(thd, NULL, thread_routine, data); +} ], [ + THREADS_WORKING=yes + ], [ + THREADS_WORKING=no + ], THREADS_WORKING=no ) ] ) + +define(APACHE_CHECK_THREADS, [dnl + cflags_orig=$CFLAGS + ldflags_orig=$LDFLAGS + for test_cflag in $1; do +for test_ldflag in $2; do + CFLAGS=$test_cflag $cflags_orig + LDFLAGS=$test_ldflag $ldflags_orig + THREAD_TEST() + if test $THREADS_WORKING = yes; then +break + fi +done +if test $THREADS_WORKING = yes; then + threads_result=Updating CFLAGS and LDFLAGS + break +fi + threads_result=Threads not found + done +] ) + 1.15 +4 -0 apache-2.0/src/configure.in Index: configure.in === RCS file: /home/cvs/apache-2.0/src/configure.in,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- configure.in1999/12/21 21:41:40 1.14 +++ configure.in1999/12/23 21:01:28 1.15 @@ -73,6 +73,10 @@ dnl ## Check for library functions +AC_MSG_CHECKING([for which threading library to use]) +APACHE_CHECK_THREADS('' -pthread -D_REENTRANT, '' -lpthread -lc_r) +AC_MSG_RESULT($threads_result) + dnl See Comment #Spoon AC_CHECK_FUNCS( \ 1.5 +0 -2 apache-2.0/src/modules/mpm/config.m4 Index: config.m4 === RCS file: /home/cvs/apache-2.0/src/modules/mpm/config.m4,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- config.m4 1999/12/20 03:09:50 1.4 +++ config.m4 1999/12/23 21:01:31 1.5 @@ -46,8 +46,6 @@ dnl XXX - We should be checking for the proper flags to use on a particular dnl platform. This will cover a couple of them, anyway -CFLAGS=-pthread $CFLAGS -CXXFLAGS=-pthread $CXXFLAGS AC_CHECK_HEADER(pthread.h, [ ],[ AC_MSG_ERROR(This MPM requires pthreads. Try --with-mpm=prefork.) ___ Ryan Bloom [EMAIL PROTECTED] 4205 S Miami Blvd RTP, NC 27709 Come to the first official Apache Software Foundation Conference! http://ApacheCon.Com/
cvs commit: apache-2.0/src/modules/mpm config.m4
rbb 99/12/05 11:36:42 Modified:src/modules/mpm config.m4 Log: I shouldn't have to explicitly provide an MPM. I am setting the default as mpmt_pthread. I would much rather it was prefork, but the autoconf work hasn't progressed to the point that prefork will work yet. When it does work, I expect the default to change. Revision ChangesPath 1.3 +4 -2 apache-2.0/src/modules/mpm/config.m4 Index: config.m4 === RCS file: /home/cvs/apache-2.0/src/modules/mpm/config.m4,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- config.m4 1999/12/05 08:54:39 1.2 +++ config.m4 1999/12/05 19:36:42 1.3 @@ -6,10 +6,12 @@ apache_cv_mpm=$withval AC_MSG_RESULT($apache_cv_mpm) else -AC_MSG_ERROR(An MPM must be specified) +apache_cv_mpm=mpmt_pthread +AC_MSG_RESULT(No MPM specified. Using pthread) fi ],[ - AC_MSG_ERROR(An MPM must be specified) + apache_cv_mpm=mpmt_pthread + AC_MSG_RESULT(No MPM specified. Using pthread) ]) APACHE_OUTPUT(modules/mpm/Makefile)