httpd-apreq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joe Schaefer <joe+gm...@sunstarsys.com>
Subject Re: [PATCH]: Enable static build of APREQ 2
Date Tue, 07 Oct 2003 20:11:51 GMT
Joe Schaefer <joe+gmane@sunstarsys.com> writes:

[...]

> Ok, I just got httpd to compile with this:
> 
>   % CPPFLAGS=-I/path/to/httpd-apreq-2/src \
>     HTTPD_LDFLAGS=/path/to/httpd-apreq-2/src/libapreq.la \
>     ./configure --with-module=filters:../httpd-apreq-2/env/mod_apreq.c
>   % make

Here's a PATCH against current cvs that carries this out.
It's based on Bojan's patch, but it has several practical
advantages:

  1) does not require a preinstallation of httpd,
  2) does not require mod_so (except to run the env/c-modules tests),
  3) does not require a rerun of httpd's buildconf.

One remaining problem it has is to get the env/ tests to work
from an httpd source directory.  I took a naive stab at it by
passing "-httpd=..." to Apache::Test, but that's not doing the trick.
If we manage to get this to work, users would be able to build
everything (apr,httpd,apreq,modperl too?) and test it all out before 
installing *anything*.

Here's the patch-  I'd like to commit something along these lines
in short order.

TIA.

Index: INSTALL
===================================================================
RCS file: /home/cvs/httpd-apreq-2/INSTALL,v
retrieving revision 1.6
diff -u -r1.6 INSTALL
--- INSTALL	23 Jul 2003 05:07:11 -0000	1.6
+++ INSTALL	7 Oct 2003 19:48:21 -0000
@@ -50,3 +50,26 @@
   C:\httpd-apreq-2> nmake mod_apreq
   C:\httpd-apreq-2> nmake perl_glue
   C:\httpd-apreq-2> nmake perl_test
+
+
+
+TO COMPILE mod_apreq.c AS A STATIC MODULE:
+
+First configure httpd to add mod_apreq.c to its filter modules:
+
+  % cd /path/to/httpd-2.0
+  % CPPFLAGS=-I/path/to/httpd-apreq-2/src \
+    HTTPD_LDFLAGS=/path/to/httpd-apreq-2/src/libapreq.la \
+    ./configure --with-module=filters:/path/to/httpd-apreq-2/env/mod_apreq.c \
+    ...(add usual httpd+apr options here)...
+
+then compile and install everything using httpd-apreq-2's build system:
+
+            % cd /path/to/httpd-apreq-2
+            % ./configure --with-apache2-src=/path/to/httpd-2.0
+            % make
+  (optional)% make test
+            % make httpd_install
+            % make install
+
+
Index: Makefile.am
===================================================================
RCS file: /home/cvs/httpd-apreq-2/Makefile.am,v
retrieving revision 1.12
diff -u -r1.12 Makefile.am
--- Makefile.am	2 Oct 2003 01:50:45 -0000	1.12
+++ Makefile.am	7 Oct 2003 19:48:21 -0000
@@ -1,10 +1,10 @@
 AUTOMAKE_OPTIONS = foreign
 SUBDIRS = src env t
 EXTRA_DIST = INSTALL
-APUDIR=`@APU_CONFIG@ --srcdir`
-APRDIR=`@APR_CONFIG@ --srcdir`
-APUDOX = (cd $(APUDIR); cat - docs/doxygen.conf | doxygen -)
-APRDOX = (cd $(APRDIR); cat - docs/doxygen.conf | doxygen -)
+APU_SRCDIR=`@APU_CONFIG@ --srcdir`
+APR_SRCDIR=`@APR_CONFIG@ --srcdir`
+APU_DOX = (cd $(APU_SRCDIR); cat - docs/doxygen.conf | doxygen -)
+APR_DOX = (cd $(APR_SRCDIR); cat - docs/doxygen.conf | doxygen -)
 COOKIE_POD=glue/perl/blib/lib/Apache/Cookie.pod
 REQUEST_POD=glue/perl/blib/lib/Apache/Request.pod
 
@@ -20,8 +20,8 @@
 
 apr_tags: 
 	-mkdir docs
-	echo GENERATE_TAGFILE=`pwd`/docs/apu.tag | $(APUDOX)
-	echo GENERATE_TAGFILE=`pwd`/docs/apr.tag | $(APRDOX)
+	echo GENERATE_TAGFILE=`pwd`/docs/apu.tag | $(APU_DOX)
+	echo GENERATE_TAGFILE=`pwd`/docs/apr.tag | $(APR_DOX)
 
 test: lib_test env_test
 
@@ -41,3 +41,10 @@
 	cd glue/perl; @PERL@ ../../build/xsbuilder.pl run
 	cd glue/perl; @PERL@ Makefile.PL -apxs @APACHE2_APXS@
 	cd glue/perl; make
+
+if BUILD_HTTPD
+
+httpd_install:
+	cd @APACHE2_SRC@; make install
+
+endif
Index: acinclude.m4
===================================================================
RCS file: /home/cvs/httpd-apreq-2/acinclude.m4,v
retrieving revision 1.8
diff -u -r1.8 acinclude.m4
--- acinclude.m4	2 Oct 2003 02:21:55 -0000	1.8
+++ acinclude.m4	7 Oct 2003 19:48:22 -0000
@@ -1,31 +1,71 @@
 AC_DEFUN(AC_APREQ, [
 	AC_ARG_WITH(apache2-apxs,
-		[  --with-apache2-apxs  path to apache2's apxs],
+		AC_HELP_STRING([--with-apache2-apxs],[path to apache2's apxs]),
 		[APACHE2_APXS=$withval],
-		[APACHE2_APXS="/usr/local/apache2/bin/apxs"])
+		[APACHE2_APXS="apxs"])
+	AC_ARG_WITH(apache2-src,
+        	AC_HELP_STRING([--with-apache2-src],[path to httpd-2 source]),
+		[APACHE2_SRC=$withval],
+		[APACHE2_SRC=""])
 	AC_ARG_WITH(perl,
-		[  --with-perl  path to perl executable],
+		AC_HELP_STRING([--with-perl],[path to perl executable]),
 		[PERL=$withval],
 		[PERL="perl"])
-        APU_CONFIG=`$APACHE2_APXS -q APU_BINDIR`/apu-config
-        APR_CONFIG=`$APACHE2_APXS -q APR_BINDIR`/apr-config
-	APACHE2_INCLUDES=`$APACHE2_APXS -q INCLUDEDIR`
-        APACHE2_MODULES=`$APACHE2_APXS -q LIBEXECDIR`
-        APACHE2_LIBS=`$APACHE2_APXS -q LIBDIR`
+
+        AM_CONDITIONAL(BUILD_HTTPD, test -n "$APACHE2_SRC")
+
+        if test -n "$APACHE2_SRC"; then
+                APACHE2_SRC=`cd $APACHE2_SRC;pwd`
+                APACHE2_INCLUDES=$APACHE2_SRC/include
+                APACHE2_HTTPD=$APACHE2_SRC/httpd
+                AC_ARG_WITH(apr-config,
+                    AC_HELP_STRING([--with-apr-config],[path to apr-config (requires --with-apache2-src)]),
+                    [APR_CONFIG=$withval],
+                    [APR_CONFIG="$APACHE2_SRC/srclib/apr/apr-config"])
+                AC_ARG_WITH(apu-config,
+                    AC_HELP_STRING([--with-apu-config],[path to apu-config (requires --with-apache2-src)]),
+                    [APU_CONFIG=$withval],
+                    [APU_CONFIG="$APACHE2_SRC/srclib/apr-util/apu-config"])
+
+        else
+                APACHE2_INCLUDES=`$APACHE2_APXS -q INCLUDEDIR`
+                APACHE2_HTTPD=`$APACHE2_APXS -q BINDIR`/httpd
+                APR_CONFIG=`$APACHE2_APXS -q APR_BINDIR`/apr-config
+                APU_CONFIG=`$APACHE2_APXS -q APU_BINDIR`/apu-config
+ 
+        fi
+
+        AC_CHECK_FILE([$APACHE2_INCLUDES/httpd.h],,
+                AC_MSG_ERROR([invalid Apache2 include directory]))
+        AC_CHECK_FILE([$APR_CONFIG],,
+                AC_MSG_ERROR([invalid apr-config location- perhaps you need to configure
apr first?]))
+        AC_CHECK_FILE([$APU_CONFIG],,
+                AC_MSG_ERROR([invalid apu-config location- perhaps you need to configure
apr-util first?]))
+
+        AM_CONDITIONAL(BUILD_APR, test "x$APR_CONFIG" = x`$APR_CONFIG --srcdir`/apr-config)
+        AM_CONDITIONAL(BUILD_APU, test "x$APU_CONFIG" = x`$APU_CONFIG --srcdir`/apu-config)
+
+        dnl Reset the default installation prefix to be the same as apu's
+        ac_default_prefix=`$APU_CONFIG --prefix`
+        
         APR_INCLUDES=`$APR_CONFIG --includedir`
         APU_INCLUDES=`$APU_CONFIG --includedir`
-        APR_LIBS=`$APR_CONFIG --link-ld --link-libtool`
-        APU_LIBS=`$APU_CONFIG --link-ld --link-libtool`
-        AC_SUBST(APU_CONFIG)
-        AC_SUBST(APR_CONFIG)
+        APR_LIBS=`$APR_CONFIG --link-libtool --libs`
+        APU_LIBS=`$APU_CONFIG --link-libtool --libs`
+        APR_LA=`$APR_CONFIG --link-libtool`
+        APU_LA=`$APU_CONFIG --link-libtool`
         AC_SUBST(APACHE2_APXS)
+        AC_SUBST(APACHE2_SRC)
 	AC_SUBST(APACHE2_INCLUDES)
-        AC_SUBST(APACHE2_MODULES)
-        AC_SUBST(APACHE2_LIBS)
+        AC_SUBST(APACHE2_HTTPD)
+        AC_SUBST(APU_CONFIG)
+        AC_SUBST(APR_CONFIG)
         AC_SUBST(APR_INCLUDES)
         AC_SUBST(APU_INCLUDES)
         AC_SUBST(APR_LIBS)
         AC_SUBST(APU_LIBS)
+        AC_SUBST(APR_LA)
+        AC_SUBST(APU_LA)
         AC_SUBST(PERL)
 ])
 
@@ -50,4 +90,3 @@
     done
   fi
 ])
-
Index: env/Makefile.am
===================================================================
RCS file: /home/cvs/httpd-apreq-2/env/Makefile.am,v
retrieving revision 1.11
diff -u -r1.11 Makefile.am
--- env/Makefile.am	2 Oct 2003 02:21:55 -0000	1.11
+++ env/Makefile.am	7 Oct 2003 19:48:22 -0000
@@ -1,25 +1,42 @@
 INCLUDES = -I../src -I@APACHE2_INCLUDES@ -I@APR_INCLUDES@ -I@APU_INCLUDES@
-LIBS = @APR_LIBS@ @APU_LIBS@
+LIBS = ../src/libapreq.la @APR_LIBS@ @APU_LIBS@
 TEST_CONFIG_SCRIPT = package Apache::TestMM; filter_args(); generate_script("t/TEST")
 
 lib_LIBRARIES = libapreq_cgi.a
-noinst_LTLIBRARIES = mod_apreq.la
+libapreq_cgi_a_SOURCES = libapreq_cgi.c
 
-mod_apreq_la_SOURCES = mod_apreq.c
-mod_apreq_la_LDFLAGS = -export-dynamic -module -avoid-version -rpath @APACHE2_MODULES@
-mod_apreq_la_LIBADD = ../src/libapreq.la
+if BUILD_APACHE
 
-libapreq_cgi_a_SOURCES = libapreq_cgi.c
-libapreq_cgi_a_LIBADD = ../src/libapreq.la
+# mod_apreq.c needs to be built from httpd-2.X, e.g.
+#
+# % cd ../httpd-2.X;
+# % ./configure --with-module=filters:../httpd-apreq-2/env/mod_apreq.c ...
+#
+# See the INSTALL file for details.
 
-libdir = @APACHE2_LIBS@
-includedir = @APACHE2_INCLUDES@
+@APACHE2_HTTPD@:
+	cd @APACHE2_SRC@ && make
+
+all-local: @APACHE2_HTTPD@
+
+t/TEST : Makefile.am
+	@PERL@ -MApache::TestMM -e '$(TEST_CONFIG_SCRIPT)' -- -httpd @APACHE2_HTTPD@
+
+else
+
+APACHE2_MODULES=`@APACHE2_APXS@ -q LIBEXECDIR`
+
+noinst_LTLIBRARIES = mod_apreq.la
+mod_apreq_la_SOURCES = mod_apreq.c
+mod_apreq_la_LDFLAGS = -export-dynamic -module -avoid-version -rpath $(APACHE2_MODULES)
 
 install-exec-local: mod_apreq.la
 	@APACHE2_APXS@ -i -a -n apreq mod_apreq.la
 
 t/TEST : Makefile.am
 	@PERL@ -MApache::TestMM -e '$(TEST_CONFIG_SCRIPT)' -- -apxs @APACHE2_APXS@
+
+endif
 
 run_tests : t/TEST
 	@PERL@ t/TEST
Index: src/Makefile.am
===================================================================
RCS file: /home/cvs/httpd-apreq-2/src/Makefile.am,v
retrieving revision 1.10
diff -u -r1.10 Makefile.am
--- src/Makefile.am	2 Oct 2003 02:21:55 -0000	1.10
+++ src/Makefile.am	7 Oct 2003 19:48:22 -0000
@@ -1,12 +1,23 @@
 INCLUDES = -I@APR_INCLUDES@ -I@APU_INCLUDES@
 LIBS = @APR_LIBS@ @APU_LIBS@
-
 lib_LTLIBRARIES = libapreq.la
 nobase_include_HEADERS = apreq.h apreq_cookie.h apreq_params.h \
                          apreq_env.h apreq_parsers.h
+libapreq_la_LDFLAGS = -version-info 2:0 
+
+BUILT_SOURCES= @APR_LA@ @APU_LA@
 libapreq_la_SOURCES = apreq.c apreq_cookie.c \
                       apreq_params.c apreq_parsers.c
-libapreq_la_LDFLAGS = -version-info 2:0 
+if BUILD_APR
+
+@APR_LA@:
+	cd `@APR_CONFIG@ --srcdir` && make
+
+endif
+
+if BUILD_APU
+
+@APU_LA@: @APR_LA@
+	cd `@APU_CONFIG@ --srcdir` && make
 
-libdir=@APACHE2_LIBS@
-includedir=@APACHE2_INCLUDES@
+endif
cvs server: Diffing t
Index: t/Makefile.am
===================================================================
RCS file: /home/cvs/httpd-apreq-2/t/Makefile.am,v
retrieving revision 1.11
diff -u -r1.11 Makefile.am
--- t/Makefile.am	2 Oct 2003 02:21:55 -0000	1.11
+++ t/Makefile.am	7 Oct 2003 19:48:22 -0000
@@ -1,13 +1,11 @@
 INCLUDES = -I../src -I@APR_INCLUDES@ -I@APU_INCLUDES@
-LIBS = -L../src @APR_LIBS@ @APU_LIBS@
+LIBS = ../src/libapreq.la @APR_LIBS@ @APU_LIBS@
 
 noinst_LIBRARIES = libapreq_tests.a
 libapreq_tests_a_SOURCES = CuTest.c env.c cookie.c params.c parsers.c
-libapreq_tests_a_LIBADD = ../src/libapreq.la
 
 check_PROGRAMS = testall
-testall_LDADD =  libapreq_tests.a
-testall_LINK = @APACHE2_APXS@ -c -p -L../src -lapreq -o testall
+testall_LDADD  = libapreq_tests.a
 
 test:	check
 	./testall -v
cvs server: Diffing win32


Mime
View raw message