more configure-time support for dynamically loadable MPMs:

. axe --with-mpm="shared" hack, replace with --enable-mpms-shared={all|list}
. replace singular MPM_NAME with access to the list of enabled MPMs
. replace singular MPM_SUBDIR with list MPM_SUBDIRS
. enable OS/2 MPM in same manner as others with configure support instead of
  hard-coding in configure.in

Current state: MPMs are built as static archives (but not linked to httpd) with
--enable-mpms-shared, so they still have to be built with apxs to load 
dynamically.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@832228 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jeff Trawick
2009-11-03 00:38:06 +00:00
parent baecf9e13f
commit 33e15a38e8
13 changed files with 79 additions and 49 deletions

View File

@ -60,7 +60,7 @@ exec sed "
/^OS_DIR/d
/^AP_LIBS/d
/^OS_SPECIFIC_VARS/d
/^MPM_SUBDIR_NAME/d
/^MPM_SUBDIRS/d
/^EXTRA_INCLUDES/{
s, = , = -I\$(includedir) ,
s, -I\$(top_srcdir)/[^ ]*,,g

View File

@ -273,7 +273,6 @@ case $host in
APR_SETVAR(SINGLE_LISTEN_UNSERIALIZED_ACCEPT, [1])
;;
*os2-emx*)
APR_SETVAR(APACHE_MPM, [mpmt_os2])
APR_SETVAR(SINGLE_LISTEN_UNSERIALIZED_ACCEPT, [1])
;;
*-linux-*)

View File

@ -1,12 +1,13 @@
APACHE_MODPATH_INIT(arch/unix)
if test "$APACHE_MPM" = "simple" -o "$APACHE_MPM" = "worker" \
-o "$APACHE_MPM" = "event" -o "$APACHE_MPM" = "prefork" \
-o "$APACHE_MPM" = "shared"; then
unixd_mods_enable=yes
if ap_mpm_is_enabled "simple" \
|| ap_mpm_is_enabled "worker" \
|| ap_mpm_is_enabled "event" \
|| ap_mpm_is_enabled "prefork"; then
unixd_mods_enable=yes
else
unixd_mods_enable=no
unixd_mods_enable=no
fi
APACHE_MODULE(unixd, unix specific support, , , $unixd_mods_enable)

View File

@ -1,4 +1,4 @@
SUBDIRS = $(MPM_SUBDIR_NAME)
SUBDIRS = $(MPM_SUBDIRS)
include $(top_builddir)/build/rules.mk

View File

@ -63,9 +63,7 @@ ap_mpm_is_supported ()
ap_mpm_is_threaded ()
{
dnl Special support for --with-mpm=shared
dnl Assume a threaded MPM can be used.
if test "x$MPM_NAME" = "xshared"; then
if test "$mpm_build" = "shared" -a ac_cv_define_APR_HAS_THREADS = "yes"; then
return 0
fi
@ -76,3 +74,12 @@ ap_mpm_is_threaded ()
done
return 1
}
ap_mpm_is_enabled ()
{
if echo "$ENABLED_MPMS" | grep " $1 " >/dev/null; then
return 0
else
return 1
fi
}

View File

@ -2,54 +2,67 @@ AC_MSG_CHECKING(which MPM to use)
AC_ARG_WITH(mpm,
APACHE_HELP_STRING(--with-mpm=MPM,Choose the process model for Apache to use.
MPM={simple|event|worker|prefork|winnt}
Specify "shared" instead of an MPM name to load MPMs dynamically.
),[
APACHE_MPM=$withval
default_mpm=$withval
AC_MSG_RESULT($withval);
],[
dnl Order of preference for default MPM:
dnl Windows: WinNT
dnl The Windows and OS/2 MPMs are used on those platforms.
dnl Everywhere else: event, worker, prefork
if ap_mpm_is_supported "winnt"; then
APACHE_MPM=winnt
default_mpm=winnt
AC_MSG_RESULT(winnt)
elif ap_mpm_is_supported "mpmt_os2"; then
default_mpm=mpmt_os2
AC_MSG_RESULT(mpmt_os2)
elif ap_mpm_is_supported "event"; then
APACHE_MPM=event
default_mpm=event
AC_MSG_RESULT(event)
elif ap_mpm_is_supported "worker"; then
APACHE_MPM=worker
default_mpm=worker
AC_MSG_RESULT(worker - event is not supported)
else
APACHE_MPM=prefork
default_mpm=prefork
AC_MSG_RESULT(prefork - event and worker are not supported)
fi
])
if test $APACHE_MPM = "shared"; then
:
elif ap_mpm_is_supported $APACHE_MPM; then
:
else
AC_MSG_ERROR([The specified MPM, $APACHE_MPM, is not supported on this platform.])
fi
APACHE_MPM_ENABLED($default_mpm)
apache_cv_mpm=$APACHE_MPM
APACHE_MPM_ENABLED($APACHE_MPM)
AC_ARG_ENABLE(mpms-shared,
APACHE_HELP_STRING(--enable-mpms-shared=MODULE-LIST,Space-separated list of shared MPM modules to enable | "all"),[
mpm_build=shared
for i in $enableval; do
if test "$i" = "all"; then
for j in $SUPPORTED_MPMS; do
eval "enable_mpm_$j=shared"
APACHE_MPM_ENABLED($j)
done
else
i=`echo $i | sed 's/-/_/g'`
eval "enable_mpm_$i=shared"
APACHE_MPM_ENABLED($i)
fi
done
], [mpm_build=static])
for i in $ENABLED_MPMS; do
if ap_mpm_is_supported $i; then
:
else
AC_MSG_ERROR([MPM $i is not supported on this platform.])
fi
done
APACHE_FAST_OUTPUT(server/mpm/Makefile)
if test "$apache_cv_mpm" = "shared"; then
MPM_NAME=""
MPM_SUBDIR_NAME=""
if test $mpm_build = "shared"; then
MPM_LIB=""
else
MPM_NAME=$apache_cv_mpm
MPM_SUBDIR_NAME=$MPM_NAME
MPM_LIB=server/mpm/$MPM_SUBDIR_NAME/lib${MPM_NAME}.la
MODLIST="$MODLIST mpm_${MPM_NAME}"
MPM_LIB=server/mpm/$default_mpm/lib${default_mpm}.la
MODLIST="$MODLIST mpm_${default_mpm}"
fi
APACHE_SUBST(MPM_NAME)
APACHE_SUBST(MPM_SUBDIR_NAME)
MPM_SUBDIRS=$ENABLED_MPMS
APACHE_SUBST(MPM_SUBDIRS)
APACHE_SUBST(MPM_LIB)

View File

@ -1,6 +1,6 @@
dnl ## XXX - Need a more thorough check of the proper flags to use
if test "$MPM_NAME" = "event" ; then
if ap_mpm_is_enabled "event"; then
AC_CHECK_FUNCS(pthread_kill)
APACHE_FAST_OUTPUT(server/mpm/$MPM_SUBDIR_NAME/Makefile)
APACHE_FAST_OUTPUT(server/mpm/event/Makefile)
fi

View File

@ -0,0 +1,10 @@
AC_MSG_CHECKING(if mpmt_os2 MPM supports this platform)
case $host in
*os2-emx*)
AC_MSG_RESULT(yes)
APACHE_MPM_SUPPORTED(mpmt_os2, no, yes)
;;
*)
AC_MSG_RESULT(no)
;;
esac

View File

@ -1,5 +1,5 @@
if test "$MPM_NAME" = "mpmt_os2" ; then
if ap_mpm_is_enabled "mpmt_os2"; then
AC_CACHE_SAVE
APACHE_FAST_OUTPUT(server/mpm/$MPM_NAME/Makefile)
APACHE_FAST_OUTPUT(server/mpm/mpmt_os2/Makefile)
APR_ADDTO(CFLAGS,-Zmt)
fi

View File

@ -1,3 +1,3 @@
if test "$MPM_NAME" = "prefork" ; then
APACHE_FAST_OUTPUT(server/mpm/$MPM_NAME/Makefile)
if ap_mpm_is_enabled "prefork"; then
APACHE_FAST_OUTPUT(server/mpm/prefork/Makefile)
fi

View File

@ -1,3 +1,3 @@
if test "$MPM_NAME" = "simple" ; then
APACHE_FAST_OUTPUT(server/mpm/$MPM_NAME/Makefile)
if ap_mpm_is_enabled "simple"; then
APACHE_FAST_OUTPUT(server/mpm/simple/Makefile)
fi

View File

@ -1,3 +1,3 @@
if test "$MPM_NAME" = "winnt" ; then
APACHE_FAST_OUTPUT(server/mpm/$MPM_NAME/Makefile)
if ap_mpm_is_enabled "winnt"; then
APACHE_FAST_OUTPUT(server/mpm/winnt/Makefile)
fi

View File

@ -1,6 +1,6 @@
dnl ## XXX - Need a more thorough check of the proper flags to use
if test "$MPM_NAME" = "worker" ; then
if ap_mpm_is_enabled "worker"; then
AC_CHECK_FUNCS(pthread_kill)
APACHE_FAST_OUTPUT(server/mpm/$MPM_NAME/Makefile)
APACHE_FAST_OUTPUT(server/mpm/worker/Makefile)
fi