httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aaron Bannert <aa...@clove.org>
Subject Re: [PATCH] add LoadModule directives for each built DSO to httpd.conf
Date Wed, 10 Oct 2001 20:58:36 GMT
[second posting, snafu(s) fixed]

> > 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. :)

I tested --enable-mods-shared=most and it now will start with the default
httpd.conf. My other test case was just a simple ./configure --prefix
and that also seems to work. In both cases I verified that the other
filtered files were otherwise unaffected by these new changes.

-aaron


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/10 19:41:09
@@ -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
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/10 19:41:09
@@ -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/10 19:41:10
@@ -36,9 +36,31 @@
 	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; \
+		( \
+			n_lm=`awk 'BEGIN {n=0} /@@LoadModule@@/ {n+=1} END {print n}' < $$i`; \
+			if test $$n_lm -eq 0 -o "x$(DSO_MODULES)" = "x"; then \
+				sed -e 's#@@ServerRoot@@#$(prefix)#g' \
+					-e 's#@@Port@@#$(PORT)#g' \
+					-e '/@@LoadModule@@/d' \
+					< $$i; \
+			else \
+				sed -n -e '/@@LoadModule@@/q' \
+					-e 's#@@ServerRoot@@#$(prefix)#g' \
+					-e 's#@@Port@@#$(PORT)#g' \
+					-e 'p' \
+					< $$i; \
+				for j in $(DSO_MODULES) "^EOL^"; do \
+					if test $$j != "^EOL^"; then \
+						echo "LoadModule $${j}_module modules/mod_$${j}.so"; \
+					fi; \
+				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: CHANGES
===================================================================
RCS file: /home/cvspublic/httpd-2.0/CHANGES,v
retrieving revision 1.386
diff -u -r1.386 CHANGES
--- CHANGES	2001/10/10 15:12:12	1.386
+++ CHANGES	2001/10/10 19:41:23
@@ -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>]
+
   *) prefork: Don't segfault when we are able to listen on some but
      not all of the configured ports.  [Jeff Trawick]
 
Index: STATUS
===================================================================
RCS file: /home/cvspublic/httpd-2.0/STATUS,v
retrieving revision 1.302
diff -u -r1.302 STATUS
--- STATUS	2001/10/09 19:29:19	1.302
+++ STATUS	2001/10/10 19:41:23
@@ -91,10 +91,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

Mime
View raw message