httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aaron Bannert <aa...@clove.org>
Subject [PATCH] add LoadModule directives for each built DSO to httpd.conf
Date Tue, 09 Oct 2001 17:44:39 GMT
This patch fixes a recent showstopper. A makefile variable has been
created to collect the names of all modules which were built as DSOs.
I've broken the sed substitution into phases so I could insert multiple
LoadModule lines into the resultant config file:

 1) do normal sed substitution until we find a @@LoadModule@@ string.
 2) if the string was found, print out formatted LoadModule lines,
    and then perform sed substitution on any lines following the first
    @@LoadModule@@ string.

Input config files containing no @@LoadModule@@ lines are not otherwise
affected. Input files containing more than one @@LoadModule@@ line will
only have LoadModule lines inserted for the first instance, and the other
@@LoadModule@@ lines will be simply removed.

I've tested this on Solaris8 (which has strict old-school sed syntax).

** I am by no means an experienced sed/borne shell user, so if anyone has
a better way of doing this, I'd love to hear it. I spent quite a long time
playing with the various levels of shell interpolation and this was the
only way I could get multiline insertions to work with generic sed called
in a borne shell script called in a makefile generated by autoconf. :)

-aaron


Index: acinclude.m4
===================================================================
RCS file: /home/cvspublic/httpd-2.0/acinclude.m4,v
retrieving revision 1.102
diff -u -r1.102 acinclude.m4
--- acinclude.m4	2001/10/03 17:47:50	1.102
+++ acinclude.m4	2001/10/09 17:22:57
@@ -94,6 +94,7 @@
   APACHE_SUBST(SH_LIBTOOL)
   APACHE_SUBST(MK_IMPLIB)
   APACHE_SUBST(INSTALL_PROG_FLAGS)
+  APACHE_SUBST(DSO_MODULES)
 
   abs_srcdir="`(cd $srcdir && pwd)`"
 
@@ -259,7 +260,9 @@
     shared*)
       enable_$1=`echo $ac_n $enable_$1$ac_c|sed 's/shared,*//'`
       sharedobjs=yes
-      shared=yes;;
+      shared=yes
+      DSO_MODULES="$DSO_MODULES $1"
+      ;;
     *)
       MODLIST="$MODLIST ifelse($4,,$1,$4)"
       if test "$1" = "so"; then
Index: Makefile.in
===================================================================
RCS file: /home/cvspublic/httpd-2.0/Makefile.in,v
retrieving revision 1.87
diff -u -r1.87 Makefile.in
--- Makefile.in	2001/10/08 10:15:37	1.87
+++ Makefile.in	2001/10/09 17:22:57
@@ -36,9 +36,24 @@
 	done; \
 	for i in *-std* ldap.conf proxy.conf ssl.conf; do \
 		[ -f $$i ] || continue; \
-		sed -e 's#@@ServerRoot@@#$(prefix)#g' \
-		    -e 's#@@Port@@#$(PORT)#g' \
-			< $$i > $(sysconfdir)/$$i; \
+		( \
+			sed -n -e '/@@LoadModule@@/q' \
+				-e 's#@@ServerRoot@@#$(prefix)#g' \
+				-e 's#@@Port@@#$(PORT)#g' \
+				-e 'p' \
+				< $$i; \
+			n_lm=`awk '/@@LoadModule@@/ {n+=1} END {print n}' < $$i`; \
+			if test $$n_lm -gt 0 -a "x$(DSO_MODULES)" != "x"; then \
+				for j in $(DSO_MODULES); do \
+					echo "LoadModule $${j}_module modules/mod_$${j}.so"; \
+				done; \
+				sed -e '1,/@@LoadModule@@/d' \
+					-e '/@@LoadModule@@/d' \
+					-e 's#@@ServerRoot@@#$(prefix)#g' \
+					-e 's#@@Port@@#$(PORT)#g' \
+					< $$i; \
+			fi \
+		) > $(sysconfdir)/$$i; \
 		chmod 0644 $(sysconfdir)/$$i; \
 		file=`echo $$i|sed s/-std//`; \
 		if [ "$$file" = "httpd.conf" ]; then \
Index: STATUS
===================================================================
RCS file: /home/cvspublic/httpd-2.0/STATUS,v
retrieving revision 1.301
diff -u -r1.301 STATUS
--- STATUS	2001/10/09 03:11:08	1.301
+++ STATUS	2001/10/09 17:22:58
@@ -89,10 +89,6 @@
       to make it agree with the operation of the StartServers
       directive.
 
-    * Fix the configure script to add a LoadModule directive to
-      the default httpd.conf for any module that was compiled
-      as a DSO.
-
     * revamp the input filter semantics, per discussions since
       February (and especially at the hackathon last
       April). Specifically, ap_get_brigade will return a brigade with
Index: CHANGES
===================================================================
RCS file: /home/cvspublic/httpd-2.0/CHANGES,v
retrieving revision 1.383
diff -u -r1.383 CHANGES
--- CHANGES	2001/10/09 02:40:56	1.383
+++ CHANGES	2001/10/09 17:23:11
@@ -1,5 +1,9 @@
 Changes with Apache 2.0.26-dev
 
+  *) Fixed the configure script to add a LoadModule directive to
+     the default httpd.conf for any module that was compiled
+     as a DSO.       [Aaron Bannert <aaron@clove.org>]
+
   *) Introduce ap_directory_walk rewrite (with further optimizations
      required) to adapt to the ap_process_request_internal() changes.
      Optimized so subrequests and redirects now reuse previous section 
Index: docs/conf/httpd-std.conf
===================================================================
RCS file: /home/cvspublic/httpd-2.0/docs/conf/httpd-std.conf,v
retrieving revision 1.56
diff -u -r1.56 httpd-std.conf
--- docs/conf/httpd-std.conf	2001/10/05 03:32:42	1.56
+++ docs/conf/httpd-std.conf	2001/10/09 17:23:12
@@ -193,6 +193,7 @@
 # Statically compiled modules (those listed by `httpd -l') do not need
 # to be loaded here.
 #
+@@LoadModule@@
 #LoadModule auth_anon_module modules/mod_auth_anon.so
 #LoadModule auth_db_module modules/mod_auth_db.so
 #LoadModule auth_dbm_module modules/mod_auth_dbm.so

Mime
View raw message