]> granicus.if.org Git - apache/blob - server/mpm/config.m4
These changes are committed together, because they depend on each other.
[apache] / server / mpm / config.m4
1 AC_MSG_CHECKING(which MPM to use)
2 AC_ARG_WITH(mpm,
3 [  --with-mpm=MPM          Choose the process model for Apache to use.
4                           MPM={dexter,mpmt_beos,mpmt_pthread,prefork}],[
5   APACHE_MPM=$withval
6 ],[
7   APACHE_MPM=mpmt_pthread
8 ])
9 AC_MSG_RESULT($APACHE_MPM)
10
11 apache_cv_mpm=$APACHE_MPM
12         
13 if test "$apache_cv_mpm" != "prefork"; then
14   APACHE_CHECK_THREADS
15   AC_MSG_CHECKING([for which threading library to use])
16   AC_MSG_RESULT($threads_result)
17
18   if test "$apache_threads_working" = "no"; then
19     AC_MSG_RESULT(The currently selected MPM requires threads which your system seems to lack)
20     AC_MSG_CHECKING(checking for replacement)
21     AC_MSG_RESULT(prefork selected)
22     apache_cv_mpm=prefork
23   fi
24 fi
25
26 APACHE_CHECK_SHM_RW
27
28 APACHE_FAST_OUTPUT(modules/mpm/Makefile)
29 MPM_NAME=$apache_cv_mpm
30 MPM_DIR=modules/mpm/$MPM_NAME
31 MPM_LIB=$MPM_DIR/lib${MPM_NAME}.la
32
33 APACHE_SUBST(MPM_NAME)
34 MODLIST="$MODLIST mpm_${MPM_NAME}"
35
36 dnl All the unix MPMs use shared memory; save a little duplication
37 AC_DEFUN(APACHE_MPM_CHECK_SHMEM, [
38     AC_CHECK_FUNCS(shmget)
39     AC_FUNC_MMAP
40     
41     AC_MSG_CHECKING(which shared memory mechanism to use)
42     if test "$ac_cv_func_shmget" = "yes" ; then
43         AC_DEFINE(USE_SHMGET_SCOREBOARD,,
44             [Define if MPMs should use shmget to implement their shared memory])
45         AC_MSG_RESULT(shmget)
46     elif test "$ac_cv_func_mmap" = "yes" ; then
47         AC_DEFINE(USE_MMAP_SCOREBOARD,,
48             [Define if MPMs should use mmap to implement their shared memory])
49         AC_MSG_RESULT(mmap)
50     else
51         AC_MSG_ERROR(No known shared memory system)
52     fi
53 ])
54
55 dnl Check for pthreads and attempt to support it
56 AC_DEFUN(APACHE_MPM_PTHREAD, [
57
58 dnl XXX - We should be checking for the proper flags to use on a particular 
59 dnl platform. This will cover a couple of them, anyway
60
61     AC_CHECK_HEADER(pthread.h, [ ],[
62         AC_MSG_ERROR(This MPM requires pthreads. Try --with-mpm=prefork.)
63     ])
64     AC_CHECK_FUNC(pthread_create, [ ],[
65         AC_MSG_ERROR(Can't compile pthread code.)
66     ])
67
68     dnl User threads libraries need pthread.h included everywhere
69     AC_DEFINE(PTHREAD_EVERYWHERE,,
70         [Define if all code should have #include <pthread.h>])
71 ])