]> granicus.if.org Git - apache/commitdiff
more configure-time support for dynamically loadable MPMs:
authorJeff Trawick <trawick@apache.org>
Tue, 3 Nov 2009 00:38:06 +0000 (00:38 +0000)
committerJeff Trawick <trawick@apache.org>
Tue, 3 Nov 2009 00:38:06 +0000 (00:38 +0000)
. 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

13 files changed:
build/config_vars.sh.in
configure.in
modules/arch/unix/config5.m4
server/mpm/Makefile.in
server/mpm/config.m4
server/mpm/config2.m4
server/mpm/event/config3.m4
server/mpm/mpmt_os2/config.m4 [new file with mode: 0644]
server/mpm/mpmt_os2/config5.m4
server/mpm/prefork/config3.m4
server/mpm/simple/config3.m4
server/mpm/winnt/config3.m4
server/mpm/worker/config3.m4

index 7a60c0634e682eaf833996d4622c25ab5ff0a708..4a6eddafccd5207e0d039ac77b5fe1629f6108b2 100644 (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
index b9b5eeeaae63b57eb4151eda444e6a5491e24d0c..dc487c1f8ae84e5e7bd7f3efb342bfcb1591e0b7 100644 (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-*)
index 1815b6198bfcad36650aa540b51fc77e3e3e4966..01c6e6938ec7e78ee2a438b20e9ae58c21642383 100644 (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)
index 2decbde60f4e788378d253990157a84b7e59df77..a158f8b080e39a32a90cc4c2103db2770dc20b1f 100644 (file)
@@ -1,4 +1,4 @@
 
-SUBDIRS = $(MPM_SUBDIR_NAME)
+SUBDIRS = $(MPM_SUBDIRS)
 
 include $(top_builddir)/build/rules.mk
index 04d85629814da50222dec786755e7ec4ada74c32..963bb18e7a1d80311d505b3d634ddd40b84a2d82 100644 (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
+}
index 798edf9b23b79b36b81ce240890e5cf23e235925..9ba6a7ccf082ea95caae37a614dcc13bc4589b8e 100644 (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)
+
+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)
index 5e1db5398bf3c0233f7862c1ee2d6e668dd3296d..d4378cf3ab80ef4934e4df8d45e33ca471f796f2 100644 (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
diff --git a/server/mpm/mpmt_os2/config.m4 b/server/mpm/mpmt_os2/config.m4
new file mode 100644 (file)
index 0000000..9a29903
--- /dev/null
@@ -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
index b27c296d2a47d3abc22a639d616de441f1a0f308..51bc4cb61c88bbbbbe679918700cb54855bc9a44 100644 (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
index 9c189a8642942145500637d099a6cce87fd896a7..9cafecbd3fc6e17854ac2bc446109e30ecd1e0a1 100644 (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
index 4b027a7c639740508c4b4027488fc1286333682e..fcdc9b03273e6142adfbbe3435c8950dd00654b7 100644 (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
index 181322b0bba5fee190b1c706505762fed897e9e7..8486288092ff203fc57ef28f6a47b12430278fe5 100644 (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
index cc131348457e23e614d8e19446223336188bc1e1..be55625909372f67fb1343fd211258afd8f665c3 100644 (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