rse 98/04/03 05:29:08
Modified: . STATUS src CHANGES src/support apxs.pl apxs.8 Log: Add query option to APXS for manually determining setting. Revision Changes Path 1.257 +1 -0 apache-1.3/STATUS Index: STATUS =================================================================== RCS file: /export/home/cvs/apache-1.3/STATUS,v retrieving revision 1.256 retrieving revision 1.257 diff -u -r1.256 -r1.257 --- STATUS 1998/04/03 12:12:48 1.256 +++ STATUS 1998/04/03 13:29:03 1.257 @@ -136,6 +136,7 @@ * Martin's fix accept (and pass) http://user:[EMAIL PROTECTED] proxy requests * Martin's fix CONNECT proxy handling again * Ralf's fallback strategy for DSO by trying to guess flags from Perl + * Ralf's add of the query (-q) option to apxs Available Patches: 1.754 +6 -0 apache-1.3/src/CHANGES Index: CHANGES =================================================================== RCS file: /export/home/cvs/apache-1.3/src/CHANGES,v retrieving revision 1.753 retrieving revision 1.754 diff -u -r1.753 -r1.754 --- CHANGES 1998/04/03 12:12:50 1.753 +++ CHANGES 1998/04/03 13:29:05 1.754 @@ -1,5 +1,11 @@ Changes with Apache 1.3b6 + *) Add query (-q) option to apxs support tool to be able to manually query + specific settings from apxs. This is needed for instance when you + manually want to access Apache's header files and you need to assemble + the -I option. Now you can do -I`apxs -q INCLUDEDIR`. + [Ralf S. Engelschall] + *) Now src/Configure uses a fallback strategy for the shared object support on platforms where no explicit information is available: If a Perl installation exists we ask it about its shared object support and if it's 1.3 +52 -14 apache-1.3/src/support/apxs.pl Index: apxs.pl =================================================================== RCS file: /export/home/cvs/apache-1.3/src/support/apxs.pl,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- apxs.pl 1998/04/01 11:48:28 1.2 +++ apxs.pl 1998/04/03 13:29:07 1.3 @@ -75,11 +75,18 @@ my $CFG_LDFLAGS_SHLIB = '@LDFLAGS_SHLIB@'; # substituted via Makefile.tmpl my $CFG_PREFIX = '@prefix@'; # substituted via APACI install my $CFG_SBINDIR = '@sbindir@'; # substituted via APACI install -my $CFG_INCDIR = '@includedir@'; # substituted via APACI install +my $CFG_INCLUDEDIR = '@includedir@'; # substituted via APACI install my $CFG_LIBEXECDIR = '@libexecdir@'; # substituted via APACI install my $CFG_SYSCONFDIR = '@sysconfdir@'; # substituted via APACI install ## +## Cleanup the above stuff +## +$CFG_CFLAGS =~ s|^\s+||; +$CFG_CFLAGS =~ s|\s+$||; +$CFG_CFLAGS =~ s|\s+`.+apaci`||; + +## ## Initial shared object support check ## if (not grep(/mod_so/, `$CFG_SBINDIR/httpd -l`)) { @@ -106,6 +113,7 @@ my $opt_i = 0; my $opt_a = 0; my $opt_A = 0; +my $opt_q = 0; # this subroutine is derived from Perl's getopts.pl with the enhancement of # the "+" metacharater at the format string to allow a list to be build by @@ -173,21 +181,23 @@ } sub usage { - print STDERR "apxs:Usage: apxs -g -n <name>\n"; - print STDERR "apxs:Usage: apxs -c [-o mod_<name>.so] [-D..] [-I..] [-l..] [-L..] mod_<name>.c ...\n"; - print STDERR "apxs:Usage: apxs -i [-e] [-n <name>] mod_<name>.so ...\n"; + print STDERR "Usage: apxs -g -n <modname>\n"; + print STDERR " apxs -q <query> ...\n"; + print STDERR " apxs -c [-o <dsofile>] [-D <name>[=<value>]] [-I <incdir>]\n"; + print STDERR " [-L <libdir>] [-l <libname>] <files> ...\n"; + print STDERR " apxs -i [-a] [-n <modname>] <dsofile> ...\n"; exit(1); } # option handling my $rc; -($rc, @ARGV) = &Getopts("n:gco:I+D+L+l+iaA", @ARGV); +($rc, @ARGV) = &Getopts("qn:gco:I+D+L+l+iaA", @ARGV); &usage if ($rc == 0); &usage if ($#ARGV == -1 and not $opt_g); -&usage if (not ($opt_g and $opt_n) and not $opt_i and not $opt_c); +&usage if (not $opt_q and not ($opt_g and $opt_n) and not $opt_i and not $opt_c); # argument handling -my @files = @ARGV; +my @args = @ARGV; my $name = 'unknown'; $name = $opt_n if ($opt_n ne ''); @@ -240,6 +250,37 @@ exit(0); } + +if ($opt_q) { + ## + ## QUERY INFORMATION + ## + + my $result = ''; + my $arg; + foreach $arg (@args) { + my $ok = 0; + my $name; + foreach $name (qw( + CC LD CFLAGS CFLAGS_SHLIB LDFLAGS_SHLIB + PREFIX SBINDIR INCLUDEDIR LIBEXECDIR SYSCONFDIR + )) { + if ($arg eq $name or $arg eq lc($name)) { + my $val = eval "\$CFG_$name"; + $result .= "${val}::"; + $ok = 1; + } + } + if (not $ok) { + printf(STDERR "apxs:Error: Invalid query string `%s'\n", $arg); + exit(1); + } + } + $result =~ s|::$||; + $result =~ s|::| |; + print $result; +} + if ($opt_c) { ## ## SHARED OBJECT COMPILATION @@ -249,7 +290,7 @@ my @srcs = (); my @objs = (); my $f; - foreach $f (@files) { + foreach $f (@args) { if ($f =~ m|\.c$|) { push(@srcs, $f); } @@ -288,14 +329,11 @@ $opt .= "-D$opt_D "; } my $cflags = "$CFG_CFLAGS $CFG_CFLAGS_SHLIB"; - $cflags =~ s|^\s+||; - $cflags =~ s|\s+$||; - $cflags =~ s|\s+`.+apaci`||; my $s; foreach $s (@srcs) { my $o = $s; $o =~ s|\.c$|.o|; - push(@cmds, "$CFG_CC $cflags -I$CFG_INCDIR $opt -c $s"); + push(@cmds, "$CFG_CC $cflags -I$CFG_INCLUDEDIR $opt -c $s"); unshift(@objs, $o); } @@ -321,7 +359,7 @@ # allow one-step compilation and installation if ($opt_i) { - @files = ( $dso_file ); + @args = ( $dso_file ); } } @@ -335,7 +373,7 @@ my @lmd = (); my @cmds = (); my $f; - foreach $f (@files) { + foreach $f (@args) { if ($f !~ m|\.so$|) { print STDERR "apxs:Error: file $f is not a shared object\n"; exit(1); 1.2 +30 -4 apache-1.3/src/support/apxs.8 Index: apxs.8 =================================================================== RCS file: /export/home/cvs/apache-1.3/src/support/apxs.8,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- apxs.8 1998/03/31 15:46:16 1.1 +++ apxs.8 1998/04/03 13:29:08 1.2 @@ -59,6 +59,10 @@ .BI \-n " modname" .B apxs +.B \-q +.IR query " ..." + +.B apxs .B \-c [ .BI \-o " dsofile" @@ -168,7 +172,7 @@ .PP .SH OPTIONS -Shared options: +Common options: .TP 12 .BI \-n " modname" This explicitly sets the module name for the @@ -186,7 +190,29 @@ tool tries to determine the name from the source or (as a fallback) at least by guessing it from the filename. .PP -Template generation: +Query options: +.TP 12 +.B \-q +Performs a query for +.BR apxs 's +knowledge about certain settings. The +.I query +parameters can be one or more of the following strings: +.nf + CC PREFIX + LD SBINDIR + CFLAGS INCLUDEDIR + CFLAGS_SHLIB LIBEXECDIR + LDFLAGS_SHLIB SYSCONFDIR +.fi +Use this for manually determining settings. For instance use +.nf + INC=-I`apxs -q INCLUDEDIR` +.fi +inside your own Makefiles if you need manual access +to Apache's C header files. +.PP +Template Generation options: .TP 12 .B \-g This generates a subdirectory @@ -201,7 +227,7 @@ .B Makefile for even easier build and installing of this module. .PP -Shared object compilation: +DSO compilation options: .TP 12 .B \-c This indicates the compilation operation. It first compiles the C source @@ -244,7 +270,7 @@ This option is directly passed through to the linker command. Use this to add your own libraries to search to the build process. .PP -Shared object installation: +DSO installation options: .TP 12 .B \-i This indicates the installation operartion and installs one or more