]> granicus.if.org Git - apache/blob - server/mpm/config.m4
autoconf: Generate modules.c based on configuration. This is the first
[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, etc. for Apache to use.],
4 [
5   if test "$withval" != "no" ; then
6     apache_cv_mpm=$withval
7     AC_MSG_RESULT($apache_cv_mpm)
8   else
9     AC_MSG_ERROR(An MPM must be specified)
10   fi
11 ],[
12   AC_MSG_ERROR(An MPM must be specified)
13 ])
14
15 APACHE_OUTPUT(modules/mpm/Makefile)
16 MPM_NAME=$apache_cv_mpm
17 MPM_DIR=modules/mpm/$MPM_NAME
18 MPM_LIB=$MPM_DIR/lib${MPM_NAME}.la
19
20 AC_SUBST(MPM_NAME)
21 MODLIST="$MODLIST mpm_${MPM_NAME}"
22
23 dnl All the unix MPMs use shared memory; save a little duplication
24 AC_DEFUN(APACHE_MPM_CHECK_SHMEM, [
25     AC_CHECK_FUNCS(shmget)
26     AC_FUNC_MMAP
27     
28     AC_MSG_CHECKING(which shared memory mechanism to use)
29     if test "$ac_cv_func_shmget" = "yes" ; then
30         AC_DEFINE(USE_SHMGET_SCOREBOARD)
31         AC_MSG_RESULT(shmget)
32     elif test "$ac_cv_func_mmap" = "yes" ; then
33         AC_DEFINE(USE_MMAP_SCOREBOARD)
34         AC_MSG_RESULT(mmap)
35     else
36         AC_MSG_ERROR(No known shared memory system)
37     fi
38 ])
39
40 dnl Check for pthreads and attempt to support it
41 AC_DEFUN(APACHE_MPM_PTHREAD, [
42
43 dnl XXX - We should be checking for the proper flags to use on a particular 
44 dnl platform. This will cover a couple of them, anyway
45     CFLAGS="-pthread $CFLAGS"
46     CXXFLAGS="-pthread $CXXFLAGS"
47
48     AC_CHECK_HEADER(pthread.h, [ ],[
49         AC_MSG_ERROR(This MPM requires pthreads. Try --with-mpm=prefork.)
50     ])
51     AC_CHECK_FUNC(pthread_create, [ ],[
52         AC_MSG_ERROR(Can't compile pthread code.)
53     ])
54
55     dnl User threads libraries need pthread.h included everywhere
56     AC_DEFINE(PTHREAD_EVERYWHERE)
57 ])