You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by rs...@hyperreal.org on 1999/12/16 17:10:32 UTC

cvs commit: apache-1.3/src/support apxs.pl apxs.8

rse         99/12/16 08:10:31

  Modified:    src      CHANGES
               src/support apxs.pl apxs.8
  Log:
  Consistency cleanup of the complete APXS tool and corresponding manpage
  after the numerous small recent changes.
  
  Revision  Changes    Path
  1.1481    +3 -0      apache-1.3/src/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/CHANGES,v
  retrieving revision 1.1480
  retrieving revision 1.1481
  diff -u -r1.1480 -r1.1481
  --- CHANGES	1999/12/15 23:04:07	1.1480
  +++ CHANGES	1999/12/16 16:10:25	1.1481
  @@ -1,5 +1,8 @@
   Changes with Apache 1.3.10
   
  +  *) Consistency cleanup of the complete APXS tool and corresponding manpage.
  +     [Ralf S. Engelschall]
  +
     *) Add %q logging format directive (logs "?" and the query string part
        of a query, or the empty string if no query).
        Can be used in combination with %m, %U and %H: "%m %U%q %H" is the
  
  
  
  1.31      +65 -69    apache-1.3/src/support/apxs.pl
  
  Index: apxs.pl
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/support/apxs.pl,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- apxs.pl	1999/12/07 00:03:24	1.30
  +++ apxs.pl	1999/12/16 16:10:30	1.31
  @@ -68,18 +68,18 @@
   ##  Configuration
   ##
   
  -my $CFG_TARGET        = '@TARGET@';            # substituted via Makefile.tmpl 
  -my $CFG_CC            = '@CC@';                # substituted via Makefile.tmpl
  -my $CFG_CFLAGS        = '@CFLAGS@';            # substituted via Makefile.tmpl
  -my $CFG_CFLAGS_SHLIB  = '@CFLAGS_SHLIB@';      # substituted via Makefile.tmpl
  -my $CFG_LD_SHLIB      = '@LD_SHLIB@';          # substituted via Makefile.tmpl
  -my $CFG_LDFLAGS_SHLIB = q(@LDFLAGS_MOD_SHLIB@);# substituted via Makefile.tmpl 
  -my $CFG_LIBS_SHLIB    = '@LIBS_SHLIB@';        # substituted via Makefile.tmpl 
  -my $CFG_PREFIX        = '@prefix@';            # substituted via APACI install
  -my $CFG_SBINDIR       = '@sbindir@';           # 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
  +my $CFG_TARGET        = q(@TARGET@);            # substituted via Makefile.tmpl 
  +my $CFG_CC            = q(@CC@);                # substituted via Makefile.tmpl
  +my $CFG_CFLAGS        = q(@CFLAGS@);            # substituted via Makefile.tmpl
  +my $CFG_CFLAGS_SHLIB  = q(@CFLAGS_SHLIB@);      # substituted via Makefile.tmpl
  +my $CFG_LD_SHLIB      = q(@LD_SHLIB@);          # substituted via Makefile.tmpl
  +my $CFG_LDFLAGS_SHLIB = q(@LDFLAGS_MOD_SHLIB@); # substituted via Makefile.tmpl 
  +my $CFG_LIBS_SHLIB    = q(@LIBS_SHLIB@);        # substituted via Makefile.tmpl 
  +my $CFG_PREFIX        = q(@prefix@);            # substituted via APACI install
  +my $CFG_SBINDIR       = q(@sbindir@);           # substituted via APACI install
  +my $CFG_INCLUDEDIR    = q(@includedir@);        # substituted via APACI install
  +my $CFG_LIBEXECDIR    = q(@libexecdir@);        # substituted via APACI install
  +my $CFG_SYSCONFDIR    = q(@sysconfdir@);        # substituted via APACI install
   
   ##
   ##  Cleanup the above stuff
  @@ -127,10 +127,10 @@
               last;
           }
           $pos = index($argumentative,$first);
  -        if($pos >= $[) {
  -            if($args[$pos+1] eq ':') {
  +        if ($pos >= $[) {
  +            if ($args[$pos+1] eq ':') {
                   shift(@ARGV);
  -                if($rest eq '') {
  +                if ($rest eq '') {
                       unless (@ARGV) {
                           print STDERR "apxs:Error: Incomplete option: $first (needs an argument)\n";
                           ++$errs;
  @@ -141,7 +141,7 @@
               }
               elsif ($args[$pos+1] eq '+') {
                   shift(@ARGV);
  -                if($rest eq '') {
  +                if ($rest eq '') {
                       unless (@ARGV) {
                           print STDERR "apxs:Error: Incomplete option: $first (needs an argument)\n";
                           ++$errs;
  @@ -152,7 +152,7 @@
               }
               else {
                   eval "\$opt_$first = 1";
  -                if($rest eq '') {
  +                if ($rest eq '') {
                       shift(@ARGV);
                   }
                   else {
  @@ -163,7 +163,7 @@
           else {
               print STDERR "apxs:Error: Unknown option: $first\n";
               ++$errs;
  -            if($rest ne '') {
  +            if ($rest ne '') {
                   $ARGV[0] = "-$rest";
               }
               else {
  @@ -197,39 +197,37 @@
   my $name = 'unknown';
   $name = $opt_n if ($opt_n ne '');
   
  +#   overriding of configuration variables
   if (@opt_S) {
       my ($opt_S);
       foreach $opt_S (@opt_S) {
  -	if ($opt_S =~ m/^([^=]+)=(.*)$/) {
  -	    my ($var) = $1;
  -	    my ($val) = $2;
  -	    my $oldval = eval "\$CFG_$var";
  -
  -	    unless ($var and $oldval) {
  -		print STDERR "apxs:Error: no config variable $var\n";
  -		&usage;
  -	    }
  -
  -	    eval "\$CFG_${var}=\"${val}\"";
  -	} else {
  -	    print STDERR "apxs:Error: malformatted -S option\n";
  -	    &usage;
  -	}	
  +        if ($opt_S =~ m/^([^=]+)=(.*)$/) {
  +            my ($var, $val) = ($1, $2);
  +            my $oldval = eval "\$CFG_$var";
  +            unless ($var and $oldval) {
  +                print STDERR "apxs:Error: no config variable $var\n";
  +                &usage;
  +            }
  +            eval "\$CFG_${var}=\"${val}\"";
  +        } else {
  +            print STDERR "apxs:Error: malformatted -S option\n";
  +            &usage;
  +        }       
       }
   }
   
   ##
  -##  Initial shared object support check
  +##  Initial DSO support check
   ##
   if (not -x "$CFG_SBINDIR/$CFG_TARGET") {
  -	print STDERR "apxs:Error: $CFG_SBINDIR/$CFG_TARGET not found or not executable\n";
  -	exit(1);
  +    print STDERR "apxs:Error: $CFG_SBINDIR/$CFG_TARGET not found or not executable\n";
  +    exit(1);
   }
   if (not grep(/mod_so/, `$CFG_SBINDIR/$CFG_TARGET -l`)) {
  -    print STDERR "apxs:Error: Sorry, no shared object support for Apache\n";
  -    print STDERR "apxs:Error: available under your platform. Make sure\n";
  -    print STDERR "apxs:Error: the Apache module mod_so is compiled into\n";
  -    print STDERR "apxs:Error: your server binary `$CFG_SBINDIR/$CFG_TARGET'.\n";
  +    print STDERR "apxs:Error: Sorry, no DSO support for Apache available\n";
  +    print STDERR "apxs:Error: under your platform. Make sure the Apache\n";
  +    print STDERR "apxs:Error: module mod_so is compiled into your server\n";
  +    print STDERR "apxs:Error: binary `$CFG_SBINDIR/$CFG_TARGET'.\n";
       exit(1);
   }
   
  @@ -259,7 +257,7 @@
       ##
   
       if (-d $name) {
  -        print STDERR "apxs:Error: Directory `$name' already exists. Remove first\n";
  +        print STDERR "apxs:Error: Directory `$name' already exists. Remove it first\n";
           exit(1);
       }
   
  @@ -283,7 +281,6 @@
       exit(0);
   }
   
  -
   if ($opt_q) {
       ##
       ##  QUERY INFORMATION 
  @@ -316,7 +313,7 @@
   
   if ($opt_c) {
       ##
  -    ##  SHARED OBJECT COMPILATION
  +    ##  DSO COMPILATION
       ##
   
       #   split files into sources and objects
  @@ -383,11 +380,11 @@
       $opt = '';
       my ($opt_Wl, $opt_L, $opt_l);
       foreach $opt_Wl (@opt_W) {
  -		if ($CFG_LD_SHLIB !~ m/gcc$/) {
  -	        $opt .= " $1" if ($opt_Wl =~ m|^\s*l,(.*)$|);
  -		} else {
  -	        $opt .= " -W$opt_Wl";
  -		}
  +        if ($CFG_LD_SHLIB !~ m/gcc$/) {
  +            $opt .= " $1" if ($opt_Wl =~ m|^\s*l,(.*)$|);
  +        } else {
  +            $opt .= " -W$opt_Wl";
  +        }
       }
       foreach $opt_L (@opt_L) {
           $opt .= " -L$opt_L";
  @@ -404,13 +401,13 @@
   
       #   allow one-step compilation and installation
       if ($opt_i or $opt_e) {
  -        @args = ( $dso_file );
  +        @args = ($dso_file);
       }
   }
   
   if ($opt_i or $opt_e) {
       ##
  -    ##  SHARED OBJECT INSTALLATION
  +    ##  DSO INSTALLATION
       ##
   
       #   determine installation commands
  @@ -421,14 +418,14 @@
       my $f;
       foreach $f (@args) {
           if ($f !~ m|\.so$|) {
  -            print STDERR "apxs:Error: file $f is not a shared object\n";
  +            print STDERR "apxs:Error: file $f is not a DSO\n";
               exit(1);
           }
           my $t = $f;
           $t =~ s|^.+/([^/]+)$|$1|;
           if ($opt_i) {
  -	    push(@cmds, "cp $f $CFG_LIBEXECDIR/$t");
  -	    push(@cmds, "chmod 755 $CFG_LIBEXECDIR/$t");
  +            push(@cmds, "cp $f $CFG_LIBEXECDIR/$t");
  +            push(@cmds, "chmod 755 $CFG_LIBEXECDIR/$t");
           }
   
           #   determine module symbolname and filename
  @@ -455,8 +452,8 @@
                   }
               }
               if ($name eq '') {
  -                print "apxs:Error: Sorry, cannot determine bootstrap symbol name\n";
  -                print "apxs:Error: Please specify one with option `-n'\n";
  +                print STDERR "apxs:Error: Sorry, cannot determine bootstrap symbol name.\n";
  +                print STDERR "apxs:Error: Please specify one with option `-n'.\n";
                   exit(1);
               }
           }
  @@ -476,7 +473,7 @@
       #   activate module via LoadModule/AddModule directive
       if ($opt_a or $opt_A) {
           if (not -f "$CFG_SYSCONFDIR/$CFG_TARGET.conf") {
  -            print "apxs:Error: Config file $CFG_SYSCONFDIR/$CFG_TARGET.conf not found\n";
  +            print STDERR "apxs:Error: Config file $CFG_SYSCONFDIR/$CFG_TARGET.conf not found\n";
               exit(1);
           }
   
  @@ -510,7 +507,7 @@
               } else {
                    $content =~ s|^(.*\n)#?\s*$amd[^\n]*\n|$1$c$amd\n|sg;
               }
  -	}
  +        }
           if (@lmd or @amd) {
               if (open(FP, ">$CFG_SYSCONFDIR/$CFG_TARGET.conf.new")) {
                   print FP $content;
  @@ -519,9 +516,9 @@
                          "cp $CFG_SYSCONFDIR/$CFG_TARGET.conf.new $CFG_SYSCONFDIR/$CFG_TARGET.conf && " .
                          "rm $CFG_SYSCONFDIR/$CFG_TARGET.conf.new");
               } else {
  -                print STDERR "unable to open configuration file\n";
  +                print STDERR "apxs:Error: unable to open configuration file\n";
               }
  -	}
  +        }
       }
   }
   
  @@ -536,7 +533,7 @@
   APXS=apxs
   APACHECTL=apachectl
   
  -#   additional defines, includes and libraries
  +#   additional user defines, includes and libraries
   #DEF=-Dmy_define=my_value
   #INC=-Imy/include/dir
   #LIB=-Lmy/lib/dir -lmylib
  @@ -544,11 +541,12 @@
   #   the default target
   all: mod_%NAME%.so
   
  -#   compile the shared object file
  +#   compile the DSO file
   mod_%NAME%.so: mod_%NAME%.c
   	$(APXS) -c $(DEF) $(INC) $(LIB) mod_%NAME%.c
   
  -#   install the shared object file into Apache 
  +#   install the DSO file into the Apache installation
  +#   and activate it in the Apache configuration
   install: all
   	$(APXS) -i -a -n '%NAME%' mod_%NAME%.so
   
  @@ -560,12 +558,10 @@
   test: reload
   	lynx -mime_header http://localhost/%NAME%
   
  -#   install and activate shared object by reloading Apache to
  -#   force a reload of the shared object file
  +#   reload the module by installing and restarting Apache
   reload: install restart
   
  -#   the general Apache start/restart/stop
  -#   procedures
  +#   the general Apache start/restart/stop procedures
   start:
   	$(APACHECTL) start
   restart:
  @@ -578,14 +574,14 @@
   **  mod_%NAME%.c -- Apache sample %NAME% module
   **  [Autogenerated via ``apxs -n %NAME% -g'']
   **
  -**  To play with this sample module first compile it into a
  +**  To play with this sample module, first compile it into a
   **  DSO file and install it into Apache's libexec directory 
   **  by running:
   **
   **    $ apxs -c -i mod_%NAME%.c
   **
  -**  Then activate it in Apache's %TARGET%.conf file for instance
  -**  for the URL /%NAME% in as follows:
  +**  Then activate it in Apache's %TARGET%.conf file, for instance
  +**  for the URL /%NAME%, as follows:
   **
   **    #   %TARGET%.conf
   **    LoadModule %NAME%_module libexec/mod_%NAME%.so
  
  
  
  1.10      +53 -48    apache-1.3/src/support/apxs.8
  
  Index: apxs.8
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/support/apxs.8,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- apxs.8	1999/07/09 21:44:31	1.9
  +++ apxs.8	1999/12/16 16:10:31	1.10
  @@ -57,21 +57,21 @@
   .B apxs
   .B \-g
   [
  -.BI \-S " name=value
  +.BI \-S " variable=value
   ]
  -.BI \-n " modname"
  +.BI \-n " name"
   
   .B apxs
   .B \-q
   [
  -.BI \-S " name=value
  +.BI \-S " variable=value
   ]
   .IR query " ..."
   
   .B apxs
   .B \-c
   [
  -.BI \-S " name=value
  +.BI \-S " variable=value
   ]
   [
   .BI \-o " dsofile"
  @@ -80,7 +80,7 @@
   .BI \-I " incdir"
   ]
   [
  -.BI \-D " name=value"
  +.BI \-D " variable[=value]"
   ]
   [
   .BI \-L " libdir"
  @@ -99,10 +99,10 @@
   .B apxs
   .B \-i
   [
  -.BI \-S " name=value
  +.BI \-S " variable=value
   ]
   [
  -.BI \-n " modname"
  +.BI \-n " name"
   ]
   [
   .B \-a
  @@ -115,10 +115,10 @@
   .B apxs
   .B \-e
   [
  -.BI \-S " name=value
  +.BI \-S " variable=value
   ]
   [
  -.BI \-n " modname"
  +.BI \-n " name"
   ]
   [
   .B \-a
  @@ -132,7 +132,7 @@
   .B apxs
   is a tool for building and installing extension modules for the Apache
   HyperText Transfer Protocol (HTTP) server. This is achieved by building a
  -dynamic shared object (DSO) from one or more source or object
  +Dynamic Shared Object (DSO) from one or more source or object
   .I files
   which then can be loaded into
   the Apache server under runtime via the
  @@ -140,7 +140,7 @@
   directive from
   .BR mod_so.
   
  -So to use this extension mechanism your platform has
  +So to use this extension mechanism, your platform has
   to support the DSO feature and your
   Apache
   .B httpd
  @@ -159,7 +159,7 @@
   The module
   .B mod_so
   should be part of the displayed list.
  -If these requirements are fulfilled you can easily extend
  +If these requirements are fulfilled, you can easily extend
   your Apache server's functionality by installing your own
   modules with the DSO mechanism by the help of this
   .B apxs
  @@ -184,31 +184,28 @@
   can be any C source file (.c), a object file (.o) or
   even a library archive (.a). The
   .B apxs
  -tool automatically recognizes these extensions and automtaically used the C
  -source files for compilation while just using the object and archive files for
  -the linking phase. But when using such pre-compiled objects make sure they are
  -compiled for position independend code (PIC) to be able to use them for a
  -dynamically loaded shared object.
  -For instance with GCC you always just have to use
  +tool automatically recognizes these extensions and automatically uses the C
  +source files for compilation while it just uses the object and archive files for
  +the linking phase. But when using such pre-compiled objects, make sure they are
  +compiled for Position Independend Code (PIC) to be able to use them for a
  +DSO. For instance with GCC you always just have to use
   .BR -fpic .
   For other
  -C compilers consult its manual
  -page or at watch for the flags
  +C compilers please consult its manual
  +page or watch for the flags
   .B apxs
   uses to compile the object files.
   
  -For more details about DSO support in Apache read the documentation
  +For more details about DSO support in Apache, first read the background
  +information about DSO in htdocs/manual/dso.html, then read the documentation
   of
  -.B mod_so
  -or perhaps even read the
  -.B src/modules/standard/mod_so.c
  -source file.
  +.BR mod_so .
   
   .PP
   .SH OPTIONS
   Common options:
   .TP 12
  -.BI \-n " modname"
  +.BI \-n " name"
   This explicitly sets the module name for the
   .B \-i
   (install)
  @@ -231,14 +228,14 @@
   .BR apxs 's
   knowledge about certain settings. The
   .I query
  -parameters can be one or more of the following strings:
  +parameters can be one or more of the following variable names:
   .nf
     CC              TARGET
     CFLAGS          SBINDIR    
     CFLAGS_SHLIB    INCLUDEDIR 
     LD_SHLIB        LIBEXECDIR 
     LDFLAGS_SHLIB   SYSCONFDIR 
  -  LIBS_SHLIB
  +  LIBS_SHLIB      PREFIX
   .fi
   Use this for manually determining settings. For instance use
   .nf
  @@ -249,8 +246,10 @@
   .PP
   Configuration options:
   .TP 12
  -.BI \-S " name=value"
  -This option changes the apxs settings described above.
  +.BI \-S " variable=value"
  +This option changes the 
  +.B apxs 
  +settings described above.
   .PP
   Template Generation options:
   .TP 12
  @@ -262,10 +261,12 @@
   and there two files: A sample module source file named
   .BI mod_ name.c
   which can be used as a template for creating your own modules or
  -as a quick start for playing with the APXS mechanism.
  +as a quick start for playing with the 
  +.B apxs
  +mechanism.
   And a corresponding
   .B Makefile
  -for even easier build and installing of this module.
  +for even easier building and installing of this module.
   .PP
   DSO compilation options:
   .TP 12
  @@ -273,7 +274,7 @@
   This indicates the compilation operation. It first compiles the C source
   files (.c) of
   .I files
  -into corresponding object files (.o) and then builds a dynamically shared object in
  +into corresponding object files (.o) and then builds a DSO in
   .I dsofile
   by linking these object files plus the remaining
   object files (.o and .a) of
  @@ -287,14 +288,14 @@
   .BI mod_ name.so
   .TP 12
   .BI \-o " dsofile"
  -Explicitly specifies the filename of the created dynamically shared object. If
  +Explicitly specifies the filename of the created DSO file. If
   not specified and the name cannot be guessed from the
   .I files
   list, the fallback name
   .B mod_unknown.so
   is used.
   .TP 12
  -.BI \-D " name=value"
  +.BI \-D " variable[=value]"
   This option is directly passed through to the compilation command(s).
   Use this to add your own defines to the build process.
   .TP 12
  @@ -326,7 +327,7 @@
   .TP 12
   .B \-i
   This indicates the installation operation and installs one or more
  -dynamically shared objects into the
  +DSOs into the
   server's
   .I libexec
   directory.
  @@ -360,7 +361,7 @@
   .SH EXAMPLES
   Assume you have an Apache module named mod_foo.c available which should extend
   Apache's server functionality. To accomplish this you first have to compile
  -the C source into a shared object suitable for loading into the Apache server
  +the C source into a DSO suitable for loading into the Apache server
   under runtime via the following command:
   
   .nf
  @@ -372,10 +373,10 @@
   
   Then you have to update the Apache configuration by making sure a
   .B LoadModule
  -directive is present to load this shared object. To simplify this
  +directive is present to load this DSO. To simplify this
   step
   .B apxs
  -provides an automatic way to install the shared object in its
  +provides an automatic way to install the DSO in the
   "libexec" directory and updating the
   .B httpd.conf
   file accordingly. This can be achieved by running:
  @@ -395,7 +396,7 @@
   .fi
   
   is added to the configuration file if still not present.
  -If you want to have this this disabled per default use the
  +If you want to have this operation to be disabled, use the
   .B \-A
   option, i.e.
   
  @@ -403,8 +404,12 @@
     $ apxs -i -A mod_foo.c
   .fi
   
  -For a quick test of the APXS mechanism you can create a sample Apache module
  -template plus a corresponding Makefile via:
  +For a quick test of the 
  +.B apxs
  +mechanism you can create a sample Apache module
  +template plus a corresponding 
  +.B Makefile 
  +via:
   
   .nf
     $ apxs -g -n foo
  @@ -414,7 +419,7 @@
     $ _
   .fi
   
  -Then you can immediately compile this sample module into a shared object and
  +Then you can immediately compile this sample module into a DSO and
   load it into the Apache server:
   
   .nf
  @@ -436,7 +441,9 @@
   
   You can even use
   .B apxs
  -to compile complex modules outside the Apache source tree, like PHP3:
  +to compile complex modules outside the Apache source tree, like PHP3, because
  +.B apxs 
  +automatically recognized C source files and object files.  
   
   .nf
     $ cd php3
  @@ -447,10 +454,8 @@
     $ _
   .fi
   
  -because
  -.B apxs
  -automatically recognized C source files and object files.  Only C source files
  -are compiled while remaining object files are used for the linking phase.
  +Only C source files are compiled while remaining object files are used for the
  +linking phase.
   
   .PD
   .SH SEE ALSO