You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Rasmus Lerdorf <ra...@lerdorf.on.ca> on 1998/03/05 04:43:15 UTC

[PATCH] Make Configure generate ap_config.h

I think the following patch to Configure will make it generate an
ap_config.h file suitable for inclusion by external modules.  It would be
nice to also have a switch on Configure which makes it do nothing except
generate this file, but that seems to require more than this simple
change.

--- Configure   1998/03/03 01:22:06     1.193
+++ Configure   1998/03/05 03:35:03
@@ -1,6 +1,6 @@
 #!/bin/sh
 exitcode=0
-trap 'rm -f $tmpfile $tmpfile2 $tmpfile3 $awkfile; exit $exitcode' 0 1 2
3 15
+trap 'rm -f $tmpfile $tmpfile2 $tmpfile3 $tmpconfig $awkfile; exit
$exitcode' 0 1 2 3 15
 
 # Apache configuration script, first cut --- rst.
 # Don't like it?  Inspired to do something better?  Go for it.
@@ -26,6 +26,7 @@
 tmpfile2=$tmpfile.2
 tmpfile3=$tmpfile.3
 awkfile=$tmpfile.4
+tmpconfig=$tmpfile.5
 SUBDIRS='$(OSDIR) main ap modules'
 
 ####################################################################
@@ -838,6 +839,28 @@
                SEEN[pp[2]] = 1
            } 
        }'`
+
+#
+# At this point we can pick out all -D's from CFLAGS and create
ap_config.h
+# to be used by external modules needing to include Apache header files.
+#
+
+for cflag in $CFLAGS; do
+       echo $cflag >>$tmpconfig ;
+done
+awk > ap_config.h < $tmpconfig '
+       BEGIN {
+               printf "/* Automatically generated file - do not edit
*/\n\n"
+       }
+       /^-D.*/ {
+               split(substr($1,3,length($1)),parts,"=")
+               if(length(parts[2])) {
+                       printf ("#define %s \"%s\"\n",parts[1],parts[2])
+               } else {
+                       printf ("#define %s\n",parts[1])
+               }
+       }
+'
 
 #
 # Now autoconfigure each of the modules specified by AddModule.