From 4a36c5ba4cf03c721ef8c0ce69f42c2d1fd5648e Mon Sep 17 00:00:00 2001 From: Stefan Fritsch Date: Tue, 8 Nov 2011 00:20:24 +0000 Subject: [PATCH] By default, only load those modules that are either required or explicitly selected by a configure --enable-foo argument. The LoadModule statements for modules enabled by --enable-mods-shared=most and friends will be commented out. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1199027 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES | 5 +++++ Makefile.in | 6 +++++- acinclude.m4 | 13 +++++++++---- configure.in | 4 ++++ 4 files changed, 23 insertions(+), 5 deletions(-) diff --git a/CHANGES b/CHANGES index 356ec0606c..b345992faf 100644 --- a/CHANGES +++ b/CHANGES @@ -16,6 +16,11 @@ Changes with Apache 2.3.15 core: Fix integer overflow in ap_pregsub. This can be triggered e.g. with mod_setenvif via a malicious .htaccess. [Stefan Fritsch] + *) configure: By default, only load those modules that are either required + or explicitly selected by a configure --enable-foo argument. The + LoadModule statements for modules enabled by --enable-mods-shared=most + and friends will be commented out. [Stefan Fritsch] + *) mod_lua: Prevent early Lua hooks (LuaHookTranslateName and LuaHookQuickHandler) from being configured in , , and htaccess where the configuration would have been ignored. diff --git a/Makefile.in b/Makefile.in index c3b182df1b..6a3c7b9684 100644 --- a/Makefile.in +++ b/Makefile.in @@ -60,7 +60,11 @@ install-conf: < $$i; \ for j in $(DSO_MODULES) "^EOL^"; do \ if test $$j != "^EOL^"; then \ - echo "LoadModule $${j}_module $(rel_libexecdir)/mod_$${j}.so"; \ + if echo "$(ENABLED_DSO_MODULES)"|$(EGREP) "\<$$j\>" > /dev/null ; then \ + echo "LoadModule $${j}_module $(rel_libexecdir)/mod_$${j}.so"; \ + else \ + echo "#LoadModule $${j}_module $(rel_libexecdir)/mod_$${j}.so"; \ + fi; \ fi; \ done; \ sed -e '1,/@@LoadModule@@/d' \ diff --git a/acinclude.m4 b/acinclude.m4 index f51d27d960..984a21d794 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -89,6 +89,7 @@ AC_DEFUN(APACHE_GEN_CONFIG_VARS,[ APACHE_SUBST(MKDEP) APACHE_SUBST(INSTALL_PROG_FLAGS) APACHE_SUBST(DSO_MODULES) + APACHE_SUBST(ENABLED_DSO_MODULES) APACHE_SUBST(APR_BINDIR) APACHE_SUBST(APR_INCLUDEDIR) APACHE_SUBST(APR_VERSION) @@ -255,6 +256,7 @@ EOF # add default MPM to LoadModule list if test $1 = $default_mpm; then DSO_MODULES="$DSO_MODULES mpm_$1" + ENABLED_DSO_MODULES="$ENABLED_DSO_MODULES mpm_$1" fi fi $4 @@ -290,15 +292,15 @@ AC_DEFUN(APACHE_MODULE,[ dnl its pre-reqs fail. case "$enable_$1" in yes|static|shared) - _apmod_error_fatal="yes" + _apmod_required="yes" ;; *) case "$module_selection" in reallyall|all|most) - _apmod_error_fatal="no" + _apmod_required="no" ;; *) - _apmod_error_fatal="yes" + _apmod_required="yes" ;; esac esac @@ -335,7 +337,7 @@ AC_DEFUN(APACHE_MODULE,[ $6 AC_MSG_CHECKING(whether to enable mod_$1) if test "$enable_$1" = "no"; then - if test "$_apmod_error_fatal" = "no"; then + if test "$_apmod_required" = "no"; then _apmod_extra_msg=" (disabled)" else AC_MSG_ERROR([mod_$1 has been requested but can not be built due to prerequisite failures]) @@ -356,6 +358,9 @@ AC_DEFUN(APACHE_MODULE,[ sharedobjs=yes shared=yes DSO_MODULES="$DSO_MODULES $1" + if test "$_apmod_required" = "yes" ; then + ENABLED_DSO_MODULES="$ENABLED_DSO_MODULES $1" + fi ;; esac define([modprefix], [MOD_]translit($1, [a-z-], [A-Z_])) diff --git a/configure.in b/configure.in index 43ecea81e9..45207e72cc 100644 --- a/configure.in +++ b/configure.in @@ -59,6 +59,10 @@ nl=' dnl Check that mkdir -p works APR_MKDIR_P_CHECK($top_srcdir/build/mkdir.sh) +dnl get an EGREP to use in the Makefiles +AC_PROG_EGREP +APACHE_SUBST(EGREP) + dnl ## Run configure for packages Apache uses dnl shared library support for these packages doesn't currently -- 2.40.0