bug-automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] New aclocal option to show source of a macro


From: Noah Misch
Subject: [PATCH] New aclocal option to show source of a macro
Date: Tue, 5 Oct 2004 01:58:26 -0700
User-agent: Mutt/1.5.6i

The option, --print-macro-source, accepts a macro name and prints the name of
the file aclocal will use for its definition.  Patch is against HEAD.

2004-10-05  Noah Misch  <address@hidden>

        * aclocal.in (--print-macro-source): New option.
        * automake.texi (aclocal options): Document --print-macro-source.
        * NEWS: Updated.

Index: aclocal.in
===================================================================
RCS file: /cvsroot/automake/automake/aclocal.in,v
retrieving revision 1.107
diff -u -r1.107 aclocal.in
--- aclocal.in  26 Sep 2004 21:11:32 -0000      1.107
+++ aclocal.in  5 Oct 2004 08:24:12 -0000
@@ -68,6 +68,9 @@
 # Option --force.
 $force_output = 0;
 
+# Option --print-macro-source
address@hidden = ();
+
 # Which macros have been seen.
 %macro_seen = ();
 
@@ -552,14 +555,15 @@
   print "\
 Generate `aclocal.m4' by scanning `configure.ac' or `configure.in'
 
-  --acdir=DIR           directory holding config files
-  --help                print this help, then exit
-  -I DIR                add directory to search list for .m4 files
-  --force               always update output file
-  --output=FILE         put output in FILE (default aclocal.m4)
-  --print-ac-dir        print name of directory holding m4 files
-  --verbose             don't be silent
-  --version             print version number, then exit
+  --acdir=DIR                  directory holding config files
+  --help                       print this help, then exit
+  -I DIR                       add directory to search list for .m4 files
+  --force                      always update output file
+  --output=FILE                put output in FILE (default aclocal.m4)
+  --print-ac-dir               print name of directory holding m4 files
+  --print-macro-source MACRO   print name of file defining MACRO
+  --verbose                    don't be silent
+  --version                    print version number, then exit
 
 Report bugs to <address@hidden>.\n";
 
@@ -592,6 +596,11 @@
        {
          $print_and_exit = 1;
        }
+      elsif ($arglist[0] eq '--print-macro-source')
+        {
+          shift (@arglist);
+          push (@locate_macro, $arglist[0]);
+        }
       elsif ($arglist[0] eq '--force')
        {
          $force_output = 1;
@@ -670,6 +679,21 @@
 local (@dirlist) = parse_arguments (@ARGV);
 $configure_ac = require_configure_ac;
 scan_m4_files (@dirlist);
+if(@locate_macro)
+  {
+    my $fail = 0;
+    foreach (@locate_macro)
+      {
+        if(not exists $map{$_})
+          {
+            ++$fail;
+            print "`$_' is not defined in the macro library.\n";
+          }
+        else
+          { print $map{$_}, "\n"; }
+      }
+    exit !!$fail;
+  }
 scan_configure;
 if (! $exit_code)
   {
Index: doc/automake.texi
===================================================================
RCS file: /cvsroot/automake/automake/doc/automake.texi,v
retrieving revision 1.56
diff -u -r1.56 automake.texi
--- doc/automake.texi   25 Sep 2004 20:50:29 -0000      1.56
+++ doc/automake.texi   5 Oct 2004 06:38:16 -0000
@@ -1595,6 +1595,16 @@
 processing is suppressed.  This option can be used by a package to
 determine where to install a macro file.
 
address@hidden --print-macro-source @var{macro}
address@hidden --print-macro-source
+Suppress normal output and print the name of the file from which
address@hidden would have taken the definition of @var{macro}.  In the
+absence of any such definition, print a diagnostic.  You may specify
+this option many times.  The return code is zero if and only if
address@hidden finds a definition for all requested macros.  You can use
+this in a @file{bootstrap.sh} or @file{autogen.sh} script to verify the
+availability of required third-party macro collections.
+
 @item --verbose
 @opindex --verbose
 Print the names of the files it examines.
Index: NEWS
===================================================================
RCS file: /cvsroot/automake/automake/NEWS,v
retrieving revision 1.287
diff -u -r1.287 NEWS
--- NEWS        26 Sep 2004 21:11:32 -0000      1.287
+++ NEWS        5 Oct 2004 08:24:14 -0000
@@ -9,6 +9,9 @@
   - The rebuild rules for distributed Yacc and Lex output will avoid
     overwriting existing files if AM_MAINTAINER_MODE and maintainer-mode
     is not enabled.
+
+  - A new aclocal option, --print-macro-source, shows where aclocal finds the
+    definition of particular macros.
 
 New in 1.9:
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]