httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@engelschall.com (Ralf S. Engelschall)
Subject [PATCH] Shared Object Support for mod_proxy, mod_example, ...
Date Thu, 12 Mar 1998 16:39:02 GMT

Shared Object Support for mod_proxy and mod_example
---------------------------------------------------

Here it is: Support for shared objects even for the missing modules like
mod_proxy and mod_example which use a libxxx.a approach or reside alone in a
subdir. Shared object support for mod_proxy is great because for such a huge
module it is especially useful to be able to load it optionally. The same way
the various test modules or experimental modules now can be loaded.

                                       Ralf S. Engelschall
                                       rse@engelschall.com
                                       www.engelschall.com

Index: CHANGES
===================================================================
RCS file: /e/apache/REPOS/apache-1.3/src/CHANGES,v
retrieving revision 1.701
diff -u -r1.701 CHANGES
--- CHANGES	1998/03/12 10:28:52	1.701
+++ CHANGES	1998/03/12 16:34:41
@@ -1,5 +1,12 @@
 Changes with Apache 1.3b6
 
+  *) Added support for building shared objects even for library-style modules
+     (more than one object file). This now provides the ability to build
+     mod_proxy as a shared object module. Additionally modules like
+     mod_example are now also supported for shared object building because the
+     generated Makefiles now no longer assume there is at least one statically
+     linked module. [Ralf S. Engelschall]
+
   *) API: Clarify usage of content_type, handler, content_encoding,
      content_language and content_languages fields in request_rec.  They
      must always be lowercased; and the strings pointed to shouldn't
Index: Configure
===================================================================
RCS file: /e/apache/REPOS/apache-1.3/src/Configure,v
retrieving revision 1.204
diff -u -r1.204 Configure
--- Configure	1998/03/11 23:58:03	1.204
+++ Configure	1998/03/12 15:59:10
@@ -926,6 +926,21 @@
 		SEEN[pp[2]] = 1
 	    } 
     	}'`
+MODDIRS_NO_SO=`awk < $tmpfile '
+	($1 == "Module" && $3 ~ /^modules\//) {
+	    split ($3, pp, "/")
+	    if (! SEEN[pp[2]]) {
+		printf "%s ", pp[2]
+		SEEN[pp[2]] = 1
+	    }
+    	}
+	(($1 == "AddModule") && $2 ~ /^modules\//) { 
+	    split ($2, pp, "/")
+	    if (! SEEN[pp[2]]) {
+		printf "%s ", pp[2]
+		SEEN[pp[2]] = 1
+	    } 
+    	}'`
 
 #
 # Now autoconfigure each of the modules specified by AddModule.
@@ -1057,10 +1072,15 @@
 #              src
 #   AUTOLIBS   Space separated list of auto-generated library files
 
-for moddir in $MODDIRS 
+for moddir in $MODDIRS
 do
 	if [ -f modules/$moddir/Makefile.tmpl ] ; then
 		AUTODIRS="$AUTODIRS modules/$moddir"
+	fi
+done
+for moddir in $MODDIRS_NO_SO
+do
+	if [ -f modules/$moddir/Makefile.tmpl ] ; then
 		AUTOLIBS="$AUTOLIBS modules/$moddir/lib$moddir.a"
 	fi
 done
@@ -1237,28 +1257,31 @@
 INCDIR=../../include
 EOF
 	if [ -f $moddir/Makefile.libdir ]; then
-	    # it's responsible for the rest of its Makefile
-	    :
+	    basedir=`echo $moddir | sed 's@^[^/]*/@@g'`
+            awk >> $moddir/Makefile < $tmpfile '
+                ($2 ~ /^modules\/'$basedir'\//) {
+                    split($2, pp, "/");
+                    split(pp[3], parts, ".");
+                    libext=parts[2];
+                }
+                END { 
+                    printf "LIBEXT=%s\n", libext;
+                }'
+            # it's responsible for the rest of its Makefile...
 	else
 	    basedir=`echo $moddir | sed 's@^[^/]*/@@g'`
-	    awk >> $moddir/Makefile < $tmpfile '
-		BEGIN {
-		    printf "OBJS="
-		}
+	    OBJS=`awk < $tmpfile '
 		($1 == "Module" && $3 ~ /^modules\/'$basedir'\//) { 
 		    split ($3, pp, "/")
 		    printf "%s ", pp[3] 
 		} 
-		END {
-		    printf "\n"
-		}'
-
-	    $CAT << 'EOF' >> $moddir/Makefile
-
-all: lib shlib
-
-EOF
-	    echo "LIB=lib$basedir.a" >> $moddir/Makefile
+		'`
+	    echo "OBJS=$OBJS" >> $moddir/Makefile
+	    if [ ".$OBJS" != . ]; then
+	        echo "LIB=lib$basedir.a" >> $moddir/Makefile
+	    else
+	        echo "LIB=" >> $moddir/Makefile
+	    fi
 	    awk >> $moddir/Makefile < $tmpfile '
 	    ($1 == "SharedModule" && $2 ~ /^modules\/'$basedir'\//) {
 		split($2, pp, "/")
@@ -1274,6 +1297,8 @@
             }'
 
 	    $CAT << 'EOF' >> $moddir/Makefile
+
+all: lib shlib
 
 lib:	$(LIB) 
 
Index: modules/proxy/Makefile.tmpl
===================================================================
RCS file: /e/apache/REPOS/apache-1.3/src/modules/proxy/Makefile.tmpl,v
retrieving revision 1.5
diff -u -r1.5 Makefile.tmpl
--- Makefile.tmpl	1998/03/02 07:05:56	1.5
+++ Makefile.tmpl	1998/03/12 16:14:52
@@ -1,20 +1,43 @@
-LIB=libproxy.a
-OBJS=mod_proxy.o proxy_cache.o proxy_connect.o proxy_ftp.o proxy_http.o \
-	proxy_util.o
+
+LIB=libproxy.$(LIBEXT)
+
+OBJS=\
+     mod_proxy.o \
+     proxy_cache.o proxy_connect.o proxy_ftp.o proxy_http.o proxy_util.o
+SHLIB_OBJS=\
+     mod_proxy.so-o \
+     proxy_cache.so-o proxy_connect.so-o proxy_ftp.so-o proxy_http.so-o proxy_util.so-o
+
 INCDIR=../../include
 
 all:	$(LIB)
 
-$(LIB): $(OBJS)
+libproxy.a: $(OBJS)
 	rm -f $@
 	ar cr $@ $(OBJS)
 	$(RANLIB) $@
 
+libproxy.so: $(SHLIB_OBJS)
+	rm -f $@
+	$(LD) $(LDFLAGS_SHLIB) -o $@ $(SHLIB_OBJS)
+
+# 1. extension .o for shared objects cannot be used because
+#    first these files aren't still shared objects and 
+#    second we have to use a different name to trigger the
+#    different implicit Make rule
+# 2. extension -so.o (as used elsewhere) cannot be used because the
+#    suffix feature of Make really wants just .x, so we use .so-o
+
+.SUFFIXES: .o .so-o
+
 .c.o:
 	$(CC) -c $(INCLUDES) $(CFLAGS) $(SPACER) $<
 
+.c.so-o:
+	$(CC) -c $(INCLUDES) $(CFLAGS) $(CFLAGS_SHLIB) $(SPACER) -o $*.so-o $<
+
 clean:
-	rm -f *.o $(LIB)
+	rm -f $(OBJS) $(SHLIB_OBJS) $(LIB)
 
 # We really don't expect end users to use this rule.  It works only with
 # gcc, and rebuilds Makefile.tmpl.  You have to re-run Configure after

Mime
View raw message