]> granicus.if.org Git - apache/blob - server/mpm/config.m4
Fix VPATH builds
[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,spmt_os2}],[
5   APACHE_MPM=$withval
6   mpm_explicit="yes"
7 ],[
8   APACHE_MPM=mpmt_pthread
9   PLAT=`$ac_config_guess`
10   PLAT=`$ac_config_sub $PLAT`
11   case "$PLAT" in
12     *beos*)
13       APACHE_MPM=mpmt_beos;;
14     *os2_emx*)
15       APACHE_MPM=spmt_os2;;
16   esac 
17   mpm_explicit="no"
18 ])
19 AC_MSG_RESULT($APACHE_MPM)
20
21 apache_cv_mpm=$APACHE_MPM
22         
23 if test "$apache_cv_mpm" = "mpmt_pthread" -o "$apache_cv_mpm" = "dexter"; then
24   PTHREADS_CHECK
25   AC_MSG_CHECKING([for which threading library to use])
26   AC_MSG_RESULT($threads_result)
27
28   if test "$pthreads_working" = "no"; then
29     AC_MSG_RESULT(The currently selected MPM requires pthreads which your system seems to lack)
30     AC_MSG_CHECKING(checking for replacement)
31     AC_MSG_RESULT(prefork selected)
32     apache_cv_mpm=prefork
33   fi
34 fi
35
36 APACHE_CHECK_SIGWAIT_ONE_ARG
37
38 APACHE_FAST_OUTPUT(modules/mpm/Makefile)
39
40 MPM_NAME=$apache_cv_mpm
41 MPM_DIR=modules/mpm/$MPM_NAME
42 MPM_LIB=$MPM_DIR/lib${MPM_NAME}.la
43
44 if test "$mpm_explicit" = "no"; then
45   if test "$MPM_NAME" = "prefork" ; then
46     MPM_NAME="prefork"
47     MPM_FAKE_NAME=prefork.c
48     EXTRA_CFLAGS="$EXTRA_CFLAGS -DPREFORK"
49
50     ac_cv_enable_threads="no"
51     AC_CACHE_SAVE
52   fi
53
54 dnl The MPM_FAKE_NAME allow the mpmt MPM to emulate all of the MPMs without
55 dnl Apache actually knowing it.  The problem is IfModule.  IfModule uses
56 dnl the C file's name to know if the module is loaded.  Without this change
57 dnl mpmt always shows up as mpmt.c, and we can't distinguish between all
58 dnl of the emulated MPMs.
59 dnl
60 dnl This fixes that by creating a soft link that has the name of the
61 dnl desired MPM to mpmt.c.  Now, Apache can search for the specified MPM
62 dnl and actually find it.
63   test -d modules/mpm/mpmt || $srcdir/helpers/mkdir.sh modules/mpm/mpmt
64   if test "$MPM_NAME" = "mpmt_pthread" ; then
65     EXTRA_CFLAGS="$EXTRA_CFLAGS -DMPMT_PTHREAD"
66     MPM_FAKE_NAME=mpmt_pthread.c
67     $LN_S $abs_srcdir/modules/mpm/mpmt/mpmt.c modules/mpm/mpmt/mpmt_pthread.c
68   elif test "$MPM_NAME" = "dexter" ; then
69     EXTRA_CFLAGS="$EXTRA_CFLAGS -DDEXTER"
70     MPM_FAKE_NAME=dexter.c
71     $LN_S $abs_srcdir/modules/mpm/mpmt/mpmt.c modules/mpm/mpmt/dexter.c
72   fi
73
74   if test "$MPM_NAME" = "dexter" -o "$MPM_NAME" = "mpmt_pthread" -o "$MPM_NAME" = "prefork"; then
75     MPM_DIR=modules/mpm/mpmt;
76     MPM_LIB=$MPM_DIR/libmpmt.la
77     MPM_NAME="mpmt"
78   else
79     MPM_DIR=modules/mpm/$MPM_NAME
80     MPM_LIB=$MPM_DIR/lib${MPM_NAME}.la
81   fi
82 fi
83
84 APACHE_SUBST(MPM_NAME)
85 APACHE_SUBST(MPM_FAKE_NAME)
86 MODLIST="$MODLIST mpm_${MPM_NAME}"
87
88 dnl Check for pthreads and attempt to support it
89 AC_DEFUN(APACHE_MPM_PTHREAD, [
90   if test "$pthreads_working" != "yes"; then
91     AC_MSG_ERROR(This MPM requires pthreads. Try --with-mpm=prefork.)
92   fi
93
94   dnl User threads libraries need pthread.h included everywhere
95   AC_DEFINE(PTHREAD_EVERYWHERE,,
96     [Define if all code should have #include <pthread.h>])
97 ])