rse 98/03/12 23:27:58
Modified: . STATUS src CHANGES Configure src/modules/proxy Makefile.tmpl Log: Support for building library-based modules (mod_proxy) as shared objects and support for the situation where all modules of a modules/ subdir are build as shared objects (mod_example). Revision Changes Path 1.185 +1 -0 apache-1.3/STATUS Index: STATUS =================================================================== RCS file: /export/home/cvs/apache-1.3/STATUS,v retrieving revision 1.184 retrieving revision 1.185 diff -u -r1.184 -r1.185 --- STATUS 1998/03/12 11:30:07 1.184 +++ STATUS 1998/03/13 07:27:51 1.185 @@ -79,6 +79,7 @@ * Fix for rputs() which did not calculate r->sent_bodyct properly. PR#1900 * Don't tweak TZ envvar if the user has specified an explicit one. PR#1888 * Ralf's mod_so changes to keep track of loaded modules ourself. + * Ralf's support for building shared objects even for library-style modules Available Patches: 1.702 +7 -0 apache-1.3/src/CHANGES Index: CHANGES =================================================================== RCS file: /export/home/cvs/apache-1.3/src/CHANGES,v retrieving revision 1.701 retrieving revision 1.702 diff -u -r1.701 -r1.702 --- CHANGES 1998/03/12 10:28:52 1.701 +++ CHANGES 1998/03/13 07:27:53 1.702 @@ -1,5 +1,12 @@ Changes with Apache 1.3b6 + *) Added support for building shared objects even for library-style modules + (which are build from 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 1.205 +41 -15 apache-1.3/src/Configure Index: Configure =================================================================== RCS file: /export/home/cvs/apache-1.3/src/Configure,v retrieving revision 1.204 retrieving revision 1.205 diff -u -r1.204 -r1.205 --- Configure 1998/03/11 23:58:03 1.204 +++ Configure 1998/03/13 07:27:54 1.205 @@ -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. @@ -1061,6 +1076,11 @@ 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,32 @@ INCDIR=../../include EOF if [ -f $moddir/Makefile.libdir ]; then - # it's responsible for the rest of its Makefile - : - else basedir=`echo $moddir | sed '[EMAIL PROTECTED]/]*/@@g'` awk >> $moddir/Makefile < $tmpfile ' - BEGIN { - printf "OBJS=" + ($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 '[EMAIL PROTECTED]/]*/@@g'` + 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 + # essential! + echo "LIB=" >> $moddir/Makefile + fi awk >> $moddir/Makefile < $tmpfile ' ($1 == "SharedModule" && $2 ~ /^modules\/'$basedir'\//) { split($2, pp, "/") @@ -1274,6 +1298,8 @@ }' $CAT << 'EOF' >> $moddir/Makefile + +all: lib shlib lib: $(LIB) 1.6 +32 -6 apache-1.3/src/modules/proxy/Makefile.tmpl Index: Makefile.tmpl =================================================================== RCS file: /export/home/cvs/apache-1.3/src/modules/proxy/Makefile.tmpl,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- Makefile.tmpl 1998/03/02 07:05:56 1.5 +++ Makefile.tmpl 1998/03/13 07:27:57 1.6 @@ -1,20 +1,46 @@ -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) +all: lib -$(LIB): $(OBJS) +lib: $(LIB) + +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 here 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 +# extension .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