From: Jeff Trawick Date: Tue, 3 Nov 2009 00:38:06 +0000 (+0000) Subject: more configure-time support for dynamically loadable MPMs: X-Git-Tag: 2.3.3~76 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=33e15a38e8fcaafd3f89aa6f315559657aa2f4cc;p=apache 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 --- diff --git a/build/config_vars.sh.in b/build/config_vars.sh.in index 7a60c0634e..4a6eddafcc 100644 --- a/build/config_vars.sh.in +++ b/build/config_vars.sh.in @@ -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 diff --git a/configure.in b/configure.in index b9b5eeeaae..dc487c1f8a 100644 --- a/configure.in +++ b/configure.in @@ -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-*) diff --git a/modules/arch/unix/config5.m4 b/modules/arch/unix/config5.m4 index 1815b6198b..01c6e6938e 100644 --- a/modules/arch/unix/config5.m4 +++ b/modules/arch/unix/config5.m4 @@ -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) diff --git a/server/mpm/Makefile.in b/server/mpm/Makefile.in index 2decbde60f..a158f8b080 100644 --- a/server/mpm/Makefile.in +++ b/server/mpm/Makefile.in @@ -1,4 +1,4 @@ -SUBDIRS = $(MPM_SUBDIR_NAME) +SUBDIRS = $(MPM_SUBDIRS) include $(top_builddir)/build/rules.mk diff --git a/server/mpm/config.m4 b/server/mpm/config.m4 index 04d8562981..963bb18e7a 100644 --- a/server/mpm/config.m4 +++ b/server/mpm/config.m4 @@ -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 +} diff --git a/server/mpm/config2.m4 b/server/mpm/config2.m4 index 798edf9b23..9ba6a7ccf0 100644 --- a/server/mpm/config2.m4 +++ b/server/mpm/config2.m4 @@ -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) + +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]) -apache_cv_mpm=$APACHE_MPM -APACHE_MPM_ENABLED($APACHE_MPM) +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) diff --git a/server/mpm/event/config3.m4 b/server/mpm/event/config3.m4 index 5e1db5398b..d4378cf3ab 100644 --- a/server/mpm/event/config3.m4 +++ b/server/mpm/event/config3.m4 @@ -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 diff --git a/server/mpm/mpmt_os2/config.m4 b/server/mpm/mpmt_os2/config.m4 new file mode 100644 index 0000000000..9a29903c42 --- /dev/null +++ b/server/mpm/mpmt_os2/config.m4 @@ -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 diff --git a/server/mpm/mpmt_os2/config5.m4 b/server/mpm/mpmt_os2/config5.m4 index b27c296d2a..51bc4cb61c 100644 --- a/server/mpm/mpmt_os2/config5.m4 +++ b/server/mpm/mpmt_os2/config5.m4 @@ -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 diff --git a/server/mpm/prefork/config3.m4 b/server/mpm/prefork/config3.m4 index 9c189a8642..9cafecbd3f 100644 --- a/server/mpm/prefork/config3.m4 +++ b/server/mpm/prefork/config3.m4 @@ -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 diff --git a/server/mpm/simple/config3.m4 b/server/mpm/simple/config3.m4 index 4b027a7c63..fcdc9b0327 100644 --- a/server/mpm/simple/config3.m4 +++ b/server/mpm/simple/config3.m4 @@ -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 diff --git a/server/mpm/winnt/config3.m4 b/server/mpm/winnt/config3.m4 index 181322b0bb..8486288092 100644 --- a/server/mpm/winnt/config3.m4 +++ b/server/mpm/winnt/config3.m4 @@ -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 diff --git a/server/mpm/worker/config3.m4 b/server/mpm/worker/config3.m4 index cc13134845..be55625909 100644 --- a/server/mpm/worker/config3.m4 +++ b/server/mpm/worker/config3.m4 @@ -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