You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by sc...@apache.org on 2007/02/01 20:31:42 UTC

svn commit: r502323 - in /httpd/httpd/trunk: CHANGES docs/man/apxs.8 docs/manual/programs/apxs.html.en docs/manual/programs/apxs.xml support/apxs.in

Author: sctemme
Date: Thu Feb  1 11:31:41 2007
New Revision: 502323

URL: http://svn.apache.org/viewvc?view=rev&rev=502323
Log:
apxs: Enhance -q flag to print all known variables and their values
      when invoked without variable name(s). 

Modified:
    httpd/httpd/trunk/CHANGES
    httpd/httpd/trunk/docs/man/apxs.8
    httpd/httpd/trunk/docs/manual/programs/apxs.html.en
    httpd/httpd/trunk/docs/manual/programs/apxs.xml
    httpd/httpd/trunk/support/apxs.in

Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?view=diff&rev=502323&r1=502322&r2=502323
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Thu Feb  1 11:31:41 2007
@@ -2,6 +2,10 @@
 Changes with Apache 2.3.0
   [Remove entries to the current 2.0 and 2.2 section below, when backported]
 
+  *) apxs: Enhance -q flag to print all known variables and their values
+     when invoked without variable name(s). 
+     [William Rowe, Sander Temme]
+
   *) mod_dbd: Create memory sub-pools for each DB connection and close
      DB connections in a pool cleanup function.  Ensure prepared statements
      are destroyed before DB connection is closed.  When using reslists,

Modified: httpd/httpd/trunk/docs/man/apxs.8
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/man/apxs.8?view=diff&rev=502323&r1=502322&r2=502323
==============================================================================
--- httpd/httpd/trunk/docs/man/apxs.8 (original)
+++ httpd/httpd/trunk/docs/man/apxs.8 Thu Feb  1 11:31:41 2007
@@ -19,7 +19,7 @@
 .el .ne 3
 .IP "\\$1" \\$2
 ..
-.TH "APXS" 8 "2004-10-01" "Apache HTTP Server" "apxs"
+.TH "APXS" 8 "2007-02-01" "Apache HTTP Server" "apxs"
 
 .SH NAME
 apxs \- APache eXtenSion tool
@@ -30,7 +30,7 @@
 \fBapxs\fR -\fBg\fR [ -\fBS\fR \fIname\fR=\fIvalue\fR ] -\fBn\fR \fImodname\fR
  
 .PP
-\fBapxs\fR -\fBq\fR [ -\fBS\fR \fIname\fR=\fIvalue\fR ] \fIquery\fR \&.\&.\&.
+\fBapxs\fR -\fBq\fR [ -\fBv\fR ] [ -\fBS\fR \fIname\fR=\fIvalue\fR ] \fIquery\fR \&.\&.\&.
  
 .PP
 \fBapxs\fR -\fBc\fR [ -\fBS\fR \fIname\fR=\fIvalue\fR ] [ -\fBo\fR \fIdsofile\fR ] [ -\fBI\fR \fIincdir\fR ] [ -\fBD\fR \fIname\fR=\fIvalue\fR ] [ -\fBL\fR \fIlibdir\fR ] [ -\fBl\fR \fIlibname\fR ] [ -\fBWc,\fR\fIcompiler-flags\fR ] [ -\fBWl,\fR\fIlinker-flags\fR ] \fIfiles\fR \&.\&.\&.
@@ -96,7 +96,7 @@
  
 .TP
 -q
-Performs a query for apxs's knowledge about certain settings\&. The \fIquery\fR parameters can be one or more of the following strings: CC, CFLAGS, CFLAGS_SHLIB, INCLUDEDIR, LD_SHLIB, LDFLAGS_SHLIB, LIBEXECDIR, LIBS_SHLIB, SBINDIR, SYSCONFDIR, TARGET\&. .PP Use this for manually determining settings\&. For instance use INC=-I`apxs -q INCLUDEDIR` .PP inside your own Makefiles if you need manual access to Apache's C header files\&.  
+Performs a query for variables and environment settings used to build httpd\&. When invoked without \fIquery\fR parameters, it prints all known variables and their values\&. The optional -v parameter formats the list output\&. .PP Use this to manually determine settings used to build the httpd that will load your module\&. For instance use INC=-I`apxs -q INCLUDEDIR` .PP inside your own Makefiles if you need manual access to Apache's C header files\&.  
   
 .SS "Configuration Options"
  

Modified: httpd/httpd/trunk/docs/manual/programs/apxs.html.en
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/programs/apxs.html.en?view=diff&rev=502323&r1=502322&r2=502323
==============================================================================
--- httpd/httpd/trunk/docs/manual/programs/apxs.html.en (original)
+++ httpd/httpd/trunk/docs/manual/programs/apxs.html.en Thu Feb  1 11:31:41 2007
@@ -85,6 +85,7 @@
     -<strong>n</strong> <var>modname</var></code></p>
 
     <p><code><strong>apxs</strong> -<strong>q</strong>
+    [ -<strong>v</strong> ]
     [ -<strong>S</strong> <var>name</var>=<var>value</var> ]
     <var>query</var> ...</code></p>
 
@@ -130,15 +131,13 @@
     <h3><a name="options.query" id="options.query">Query Options</a></h3>
       <dl>
       <dt><code>-q</code></dt>
-      <dd>Performs a query for <code>apxs</code>'s knowledge about certain
-      settings. The <var>query</var> parameters can be one or more of the
-      following strings: <code>CC</code>, <code>CFLAGS</code>,
-      <code>CFLAGS_SHLIB</code>, <code>INCLUDEDIR</code>, <code>LD_SHLIB</code>,
-      <code>LDFLAGS_SHLIB</code>, <code>LIBEXECDIR</code>,
-      <code>LIBS_SHLIB</code>, <code>SBINDIR</code>, <code>SYSCONFDIR</code>,
-      <code>TARGET</code>.
+      <dd>Performs a query for variables and environment settings used to 
+      build <code>httpd</code>.  When invoked without <var>query</var> parameters, 
+      it prints all known variables and their values.  The optional <code>-v</code> 
+      parameter formats the list output.
 
-      <p>Use this for manually determining settings. For instance use</p>
+      <p>Use this to manually determine settings used to build the 
+      <code>httpd</code> that will load your module.  For instance use</p>
       <div class="example"><p><code>
         INC=-I`apxs -q INCLUDEDIR`
       </code></p></div>

Modified: httpd/httpd/trunk/docs/manual/programs/apxs.xml
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/programs/apxs.xml?view=diff&rev=502323&r1=502322&r2=502323
==============================================================================
--- httpd/httpd/trunk/docs/manual/programs/apxs.xml (original)
+++ httpd/httpd/trunk/docs/manual/programs/apxs.xml Thu Feb  1 11:31:41 2007
@@ -86,6 +86,7 @@
     -<strong>n</strong> <var>modname</var></code></p>
 
     <p><code><strong>apxs</strong> -<strong>q</strong>
+    [ -<strong>v</strong> ]
     [ -<strong>S</strong> <var>name</var>=<var>value</var> ]
     <var>query</var> ...</code></p>
 
@@ -131,15 +132,13 @@
     <section id="options.query"><title>Query Options</title>
       <dl>
       <dt><code>-q</code></dt>
-      <dd>Performs a query for <code>apxs</code>'s knowledge about certain
-      settings. The <var>query</var> parameters can be one or more of the
-      following strings: <code>CC</code>, <code>CFLAGS</code>,
-      <code>CFLAGS_SHLIB</code>, <code>INCLUDEDIR</code>, <code>LD_SHLIB</code>,
-      <code>LDFLAGS_SHLIB</code>, <code>LIBEXECDIR</code>,
-      <code>LIBS_SHLIB</code>, <code>SBINDIR</code>, <code>SYSCONFDIR</code>,
-      <code>TARGET</code>.
+      <dd>Performs a query for variables and environment settings used to 
+      build <code>httpd</code>.  When invoked without <var>query</var> parameters, 
+      it prints all known variables and their values.  The optional <code>-v</code> 
+      parameter formats the list output.
 
-      <p>Use this for manually determining settings. For instance use</p>
+      <p>Use this to manually determine settings used to build the 
+      <code>httpd</code> that will load your module.  For instance use</p>
       <example>
         INC=-I`apxs -q INCLUDEDIR`
       </example>

Modified: httpd/httpd/trunk/support/apxs.in
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/support/apxs.in?view=diff&rev=502323&r1=502322&r2=502323
==============================================================================
--- httpd/httpd/trunk/support/apxs.in (original)
+++ httpd/httpd/trunk/support/apxs.in Thu Feb  1 11:31:41 2007
@@ -75,6 +75,7 @@
 my $opt_q = 0;
 my $opt_h = 0;
 my $opt_p = 0;
+my $opt_v = 0;
 
 #   this subroutine is derived from Perl's getopts.pl with the enhancement of
 #   the "+" metacharacter at the format string to allow a list to be built by
@@ -142,7 +143,7 @@
 
 sub usage {
     print STDERR "Usage: apxs -g [-S <var>=<val>] -n <modname>\n";
-    print STDERR "       apxs -q [-S <var>=<val>] <query> ...\n";
+    print STDERR "       apxs -q [-v] [-S <var>=<val>] [<query> ...]\n";
     print STDERR "       apxs -c [-S <var>=<val>] [-o <dsofile>] [-D <name>[=<value>]]\n";
     print STDERR "               [-I <incdir>] [-L <libdir>] [-l <libname>] [-Wc,<flags>]\n";
     print STDERR "               [-Wl,<flags>] [-p] <files> ...\n";
@@ -153,9 +154,9 @@
 
 #   option handling
 my $rc;
-($rc, @ARGV) = &Getopts("qn:gco:I+D+L+l+W+S+eiaAp", @ARGV);
+($rc, @ARGV) = &Getopts("qn:gco:I+D+L+l+W+S+eiaApv", @ARGV);
 &usage if ($rc == 0);
-&usage if ($#ARGV == -1 and not $opt_g);
+&usage if ($#ARGV == -1 and not $opt_g and not $opt_q);
 &usage if (not $opt_q and not ($opt_g and $opt_n) and not $opt_i and not $opt_c and not $opt_e);
 
 #   argument handling
@@ -303,8 +304,35 @@
     ##
     ##  QUERY INFORMATION 
     ##
-    my $result = get_vars(@args);
-    print "$result\n";
+    my $result;
+    if ($#args >= 0) { 
+        $result = get_vars(@args);
+        print "$result\n";
+    } else {
+        # -q without var name prints all variables and their values
+        
+        # Additional -v pretty-prints output
+        if ($opt_v) {
+            # Variable names in alphabetic order
+            my @vars = sort {uc($a) cmp uc($b)} keys %config_vars;
+            
+            # Make the left column as wide as the longest variable name
+            my $width = 0;
+            foreach (@vars) {
+                my $l = length $_; 
+                $width = $l unless ($l <= $width);
+            }
+    
+            foreach (@vars) {
+                printf "%-${width}s = %s\n", $_, $config_vars{$_};
+            }
+        } else {
+            # Unprettified name=value list
+            foreach (keys %config_vars) {
+                print "$_=$config_vars{$_}\n";
+            }
+        }
+    }
 }
 
 my $apr_config = get_vars("APR_CONFIG");