]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
* lib/Autom4te/General.pm (&getopt): Work around the `-' Getopt bug.
authorAkim Demaille <akim@epita.fr>
Wed, 5 Sep 2001 07:06:02 +0000 (07:06 +0000)
committerAkim Demaille <akim@epita.fr>
Wed, 5 Sep 2001 07:06:02 +0000 (07:06 +0000)
* bin/autoheader.in, bin/autoupdate.in (&parse_args): Adjust.
* bin/autoscan.in: Use `getopt' and `find_files' etc.
Add -I, --include support.
* doc/autoconf.texi (autoscan Invocation): Adjust.

ChangeLog
bin/autoheader.in
bin/autom4te.in
bin/autoscan.in
bin/autoupdate.in
doc/autoconf.texi
lib/Autom4te/General.pm
man/autoheader.1
man/autom4te.1
man/autoscan.1
man/autoupdate.1

index dba605d10fc0ff1670569f3afde6d1ef5bbc0111..aa21301178fdccc04ba93301935d9e25bdf7ab89 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2001-09-05  Akim Demaille  <akim@epita.fr>
+
+       * lib/Autom4te/General.pm (&getopt): Work around the `-' Getopt bug.
+       * bin/autoheader.in, bin/autoupdate.in (&parse_args): Adjust.
+
+       * bin/autoscan.in: Use `getopt' and `find_files' etc.
+       Add -I, --include support.
+       * doc/autoconf.texi (autoscan Invocation): Adjust.
+
 2001-09-05  Akim Demaille  <akim@epita.fr>
 
        CVS GNU M4 doesn't like `undefine(undefined)'.
index 7e342186596b89671afb50a3c954448aa5f07054..9c43aa91be01814057d2d694e76077b55f721578 100644 (file)
@@ -104,17 +104,11 @@ END
 sub parse_args ()
 {
   my $srcdir;
-  # F*k.  Getopt seems bogus and dies when given `-' with `bundling'.
-  # If fixed some day, use this: '' => sub { push @ARGV, "-" }
-  my $stdin = grep /^-$/, @ARGV;
-  @ARGV = grep !/^-$/, @ARGV;
+
   getopt ('I|include|A|autoconf-dir|m|macrodir|l|localdir=s' => \@include,
          'f|force'   => \$force,
          'W|warning' => \@warning);
 
-  push @ARGV, '-'
-    if $stdin;
-
   if (! @ARGV)
     {
       my $configure_ac = find_configure_ac;
index c501b41d8f026a031ab17b02ce0ac101d5c1adc2..947e93f406caa2d275e337c9a3a354e6df4b569f 100644 (file)
@@ -42,7 +42,6 @@ use Data::Dumper;
 use Autom4te::General;
 use Autom4te::Struct;
 use Carp;
-use Getopt::Long;
 use IO::File;
 use strict;
 
index ce7b5f727bc12fe2ec3eae1fcba784b61004c5dd..930dbd61cc4dbae2fcded59488823e4811da3328 100644 (file)
 
 BEGIN
 {
-  my $prefix = "@prefix@";
   my $perllibdir = $ENV{'autom4te_perllibdir'} || "@datadir@";
   unshift @INC, "$perllibdir";
 }
 
 use File::Basename;
 use File::Find;
-use Getopt::Long;
 use IO::File;
 use Autom4te::General;
 use strict;
@@ -71,21 +69,13 @@ my $log = new IO::File ">$me.log"
   or die "$me: cannot open $me.log: $!\n";
 
 # Autoconf and lib files.
-my $autoconf = $ENV{'AUTOCONF'} || '@autoconf_name@';
-my $datadir = $ENV{"AC_MACRODIR"} || "@datadir@";
+my $autom4te = $ENV{'AUTOM4TE'} || '@autom4te-name@';
+my $autoconf = "$autom4te --language=autoconf";
+my @include = ('@datadir@');
 
-
-## ------------------------ ##
-## Command line interface.  ##
-## ------------------------ ##
-
-
-# print_usage ()
-# --------------
-# Display usage (--help).
-sub print_usage ()
-{
-  print "Usage: $0 [OPTION] ... [SRCDIR]
+# $help
+# -----
+$help = "Usage: $0 [OPTION] ... [SRCDIR]
 
 Examine source files in the directory tree rooted at SRCDIR, or the
 current directory if none is given.  Search the source files for
@@ -93,55 +83,44 @@ common portability problems, check for incompleteness of
 `configure.ac', and create a file `$configure_scan' which is a
 preliminary `configure.ac' for that package.
 
-  -h, --help            print this help, then exit
-  -V, --version         print version number, then exit
-  -v, --verbose         verbosely report processing
-
-Library directories:
-  -A, --autoconf-dir=ACDIR  Autoconf's files location (rarely needed)
-  -l, --localdir=DIR        location of `aclocal.m4' and `acconfig.h'
+  -h, --help          print this help, then exit
+  -V, --version       print version number, then exit
+  -v, --verbose       verbosely report processing
+  -d, --debug         don't remove temporary files
+  -I, --include=DIR   look for input files in DIR.  Accumulates
 
 Report bugs to <bug-autoconf\@gnu.org>.\n";
-  exit 0;
-}
-
 
-# print_version ()
-# ----------------
-# Display version (--version).
-sub print_version
-{
-  print "autoscan (@PACKAGE_NAME@) @VERSION@
+# $version
+# --------
+$version = "autoscan (@PACKAGE_NAME@) @VERSION@
 Written by David J. MacKenzie.
 
 Copyright 1994, 1999, 2000, 2001 Free Software Foundation, Inc.
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n";
-  exit 0;
-}
 
 
+
+
+## ------------------------ ##
+## Command line interface.  ##
+## ------------------------ ##
+
 # parse_args ()
 # -------------
 # Process any command line arguments.
 sub parse_args ()
 {
-  my $srcdir;
-  Getopt::Long::config ("bundling");
-  Getopt::Long::GetOptions ("A|autoconf-dir|m|macrodir=s" => \$datadir,
-                           "h|help" => \&print_usage,
-                           "V|version" => \&print_version,
-                           "v|verbose" => \$verbose)
-    or exit 1;
+  getopt ("I|include|A|autoconf-dir|m|macrodir=s" => \@include);
 
   die "$me: too many arguments
 Try `$me --help' for more information.\n"
-    if (@ARGV > 1);
-  ($srcdir) = @ARGV;
-  $srcdir = "."
-    if !defined $srcdir;
+    if @ARGV > 1;
+
+  my $srcdir = $ARGV[0] || ".";
 
-  print "srcdir=$srcdir\n" if $verbose;
+  verbose "srcdir = $srcdir";
   chdir $srcdir || die "$me: cannot cd to $srcdir: $!\n";
 }
 
@@ -170,7 +149,7 @@ sub init_tables ()
   my $tables_are_consistent = 1;
   foreach my $kind (@kinds)
     {
-      my $file = "$datadir/autoscan/$kind";
+      my $file = find_file ("autoscan/$kind", @include);
       my $table = new IO::File $file
        or die "$me: cannot open $file: $!\n";
       while ($_ = $table->getline)
@@ -189,7 +168,7 @@ sub init_tables ()
          # consistency checks.
          if (!defined $2 && exists $macro{$kind}{$word})
            {
-             warn ("$datadir/autoscan/$kind:$.: "
+             warn ("$file:$.: "
                    . "ignoring implicit call to the generic macro for $word\n");
              $tables_are_consistent = 0;
            }
@@ -213,8 +192,8 @@ sub init_tables ()
 ## ----------------------- ##
 
 
-# scan_c_file(FILENAME)
-# ---------------------
+# scan_c_file($FILENAME)
+# ----------------------
 sub scan_c_file ($)
 {
   my ($filename) = @_;
@@ -277,8 +256,8 @@ sub scan_c_file ($)
 }
 
 
-# scan_makefile(MAKEFILE-NAME)
-# ----------------------------
+# scan_makefile($MAKEFILE-NAME)
+# -----------------------------
 sub scan_makefile ($)
 {
   my ($filename) = @_;
@@ -317,8 +296,8 @@ sub scan_makefile ($)
 }
 
 
-# scan_sh_file(SHELL-SCRIPT-NAME)
-# -------------------------------
+# scan_sh_file($SHELL-SCRIPT-NAME)
+# --------------------------------
 sub scan_sh_file ($)
 {
   my ($filename) = @_;
@@ -477,8 +456,8 @@ sub output_libraries ($)
 }
 
 
-# output (CONFIGURE_SCAN)
-# -----------------------
+# output ($CONFIGURE_SCAN)
+# ------------------------
 # Print a proto configure.ac.
 sub output ($)
 {
@@ -524,8 +503,8 @@ sub output ($)
 ## --------------------------------------- ##
 
 
-# check_configure_ac (CONFIGURE_AC)
-# ---------------------------------
+# check_configure_ac ($CONFIGURE_AC)
+# ----------------------------------
 # Use autoconf to check if all the suggested macros are included
 # in CONFIGURE_AC.
 sub check_configure_ac ($)
@@ -539,9 +518,9 @@ sub check_configure_ac ($)
     join (' -t ', '',
          uniq (sort (map { s/\(.*//; $_ } keys %needed_macros)));
 
-  verbose "running: $autoconf -A $datadir $trace_option $configure_ac";
+  verbose "running: $autoconf $trace_option $configure_ac";
   my $traces =
-    new IO::File "$autoconf -A $datadir $trace_option $configure_ac|"
+    new IO::File "$autoconf $trace_option $configure_ac|"
       or die "$me: cannot open traces reading pipe: $!\n";
 
   while ($_ = $traces->getline)
@@ -592,6 +571,10 @@ sub check_configure_ac ($)
 ## -------------- ##
 
 parse_args;
+$autoconf .= " --debug" if $debug;
+$autoconf .= " --verbose" if $verbose;
+$autoconf .= join (' --include=', '', @include);
+
 my $configure_ac = find_configure_ac;
 init_tables;
 scan_files;
index 7b60f7b06d8dc8269fd2cd6bba590ab6049835e8..af3198a1d4d601481bf3569d1f084dc77e5d2501 100644 (file)
@@ -33,6 +33,7 @@ use strict;
 
 # Lib files.
 my $autom4te = $ENV{'AUTOM4TE'} || '@autom4te-name@';
+my $autoconf = "$autom4te --language=autoconf";
 # We need to find m4sugar.
 my @include = ('@datadir@');
 my $force = 0;
@@ -42,35 +43,32 @@ my $m4 = $ENV{"M4"} || "@M4@";
 
 # $HELP
 # -----
-$help = <<"END";
-Usage: $0 [OPTION] ...  [TEMPLATE-FILE...]
+$help = "Usage: $0 [OPTION] ...  [TEMPLATE-FILE...]
 
-Update the TEMPLATE-FILE... if given, or \`configure.ac\' if present,
-or else \`configure.in\', to the syntax of the current version of
+Update the TEMPLATE-FILE... if given, or `configure.ac' if present,
+or else `configure.in', to the syntax of the current version of
 Autoconf.  The original files are backed up.
 
 Operation modes:
   -h, --help           print this help, then exit
   -V, --version        print version number, then exit
   -v, --verbose        verbosely report processing
-  -d, --debug          don\'t remove temporary files
+  -d, --debug          don't remove temporary files
   -I, --include=DIR    look for input files in DIR.  Accumulates
   -f, --force          consider all the files are obsolete
 
 Report bugs to <bug-autoconf\@gnu.org>.
-END
+";
 
 # $VERSION
 # --------
-$version = <<"END";
-autoupdate (@PACKAGE_NAME@) @VERSION@
+$version = "autoupdate (@PACKAGE_NAME@) @VERSION@
 Written by David J. MacKenzie and Akim Demaille.
 
 Copyright 1994, 1999, 2000, 2001 Free Software Foundation, Inc.
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-END
-
+";
 
 ## ---------- ##
 ## Routines.  ##
@@ -83,16 +81,10 @@ END
 sub parse_args ()
 {
   my $srcdir;
-  # F*k.  Getopt seems bogus and dies when given `-' with `bundling'.
-  # If fixed some day, use this: '' => sub { push @ARGV, "-" }
-  my $update_stdin = grep /^-$/, @ARGV;
-  @ARGV = grep !/^-$/, @ARGV;
+
   getopt ('I|include|A|autoconf-dir|m|macrodir|l|localdir=s' => \@include,
          'f|force' => \$force);
 
-  push @ARGV, '-'
-    if $update_stdin;
-
   if (! @ARGV)
     {
       my $configure_ac = find_configure_ac;
@@ -109,8 +101,8 @@ sub parse_args ()
 
 my @m4_builtins;
 
-# HANDLE_M4_SYMBOLS ()
-# --------------------
+# &handle_m4_symbols ()
+# ---------------------
 # Create the following $tmp files:
 # m4.m4 -- enable the m4 builtins.
 # unm4.m4 -- disable the m4 builtins.
@@ -243,11 +235,10 @@ sub handle_autoconf_macros ()
 ## -------------- ##
 
 parse_args;
-my $autoconf = "$autom4te --language=autoconf ";
-$autoconf .= join (' --include=', '', @include);
 $autoconf .= " --debug" if $debug;
 $autoconf .= " --force" if $force;
 $autoconf .= " --verbose" if $verbose;
+$autoconf .= join (' --include=', '', @include);
 
 mktmpdir ('au');
 handle_m4_macros;
index 0f5cff5892a6c97a0e8aeb8f82d61c559ad7473e..f7fba22aec89b4c2580d7abadd960a6b24fd998c 100644 (file)
@@ -1061,15 +1061,10 @@ Print the version number of Autoconf and exit.
 Print the names of the files it examines and the potentially interesting
 symbols it finds in them.  This output can be voluminous.
 
-@item --autoconf-dir=@var{dir}
-@itemx -A @var{dir}
-@evindex AC_MACRODIR
-Override the location where the installed Autoconf data files are looked
-for.  You can also set the @code{AC_MACRODIR} environment variable to a
-directory; this option overrides the environment variable.
-
-This option is rarely needed and dangerous; it is only used when one
-plays with different versions of Autoconf simultaneously.
+@item --include=@var{dir}
+@itemx -I @var{dir}
+Also look for input files in @var{dir}.  Multiple invocations
+accumulate.  Latest directories are looking in first.
 @end table
 
 @node ifnames Invocation
index 930646b6adb8dac38788951ecf63ff315f1e87fe..b34554595513654924765b88c99c5e1823542847 100644 (file)
@@ -153,13 +153,19 @@ sub find_file ($@)
 }
 
 
-# getopt (%OPTIONS)
-# -----------------
+# getopt (%OPTION)
+# ----------------
+# Handle the %OPTION, plus all the common options.
+# Work around Getopt bugs wrt `-'.
 sub getopt (%)
 {
   my (%option) = @_;
   use Getopt::Long;
 
+  # F*k.  Getopt seems bogus and dies when given `-' with `bundling'.
+  # If fixed some day, use this: '' => sub { push @ARGV, "-" }
+  my $stdin = grep /^-$/, @ARGV;
+  @ARGV = grep !/^-$/, @ARGV;
   %option = (%option,
             "h|help"     => sub { print $help; exit 0 },
              "V|version"  => sub { print $version; exit 0 },
@@ -170,6 +176,9 @@ sub getopt (%)
   Getopt::Long::Configure ("bundling");
   GetOptions (%option)
     or exit 1;
+
+    push @ARGV, '-'
+    if $stdin;
 }
 
 
index 508afb4787b92d9d56c8757ea6c81798964f32da..a9b670f4c0c34aea0060246a193d536dd13dc939 100644 (file)
@@ -1,5 +1,5 @@
 .\" DO NOT MODIFY THIS FILE!  It was generated by help2man 1.24.
-.TH AUTOHEADER "1" "August 2001" "GNU Autoconf 2.52e" FSF
+.TH AUTOHEADER "1" "September 2001" "GNU Autoconf 2.52e" FSF
 .SH NAME
 autoheader \- Create a template header for configure
 .SH SYNOPSIS
index a13567812db40bd9ac49a15589928342993d70cc..b291fd45266c27ab1134b17ff77bf0064eab7d33 100644 (file)
@@ -1,5 +1,5 @@
 .\" DO NOT MODIFY THIS FILE!  It was generated by help2man 1.24.
-.TH AUTOM4TE "1" "August 2001" "GNU Autoconf 2.52e" FSF
+.TH AUTOM4TE "1" "September 2001" "GNU Autoconf 2.52e" FSF
 .SH NAME
 autom4te \- Generate files and scripts thanks to M4
 .SH SYNOPSIS
index a47db24d54c3342f5cee793f068941cc8f632f6f..eefcc48a98306d4af4b20dee001570ed99b30220 100644 (file)
@@ -1,5 +1,5 @@
 .\" DO NOT MODIFY THIS FILE!  It was generated by help2man 1.24.
-.TH AUTOSCAN "1" "August 2001" "GNU Autoconf 2.52e" FSF
+.TH AUTOSCAN "1" "September 2001" "GNU Autoconf 2.52e" FSF
 .SH NAME
 autoscan \- Generate a preliminary configure.in
 .SH SYNOPSIS
@@ -20,13 +20,12 @@ print version number, then exit
 .TP
 \fB\-v\fR, \fB\-\-verbose\fR
 verbosely report processing
-.SS "Library directories:"
 .TP
-\fB\-A\fR, \fB\-\-autoconf\-dir\fR=\fIACDIR\fR
-Autoconf's files location (rarely needed)
+\fB\-d\fR, \fB\-\-debug\fR
+don't remove temporary files
 .TP
-\fB\-l\fR, \fB\-\-localdir\fR=\fIDIR\fR
-location of `aclocal.m4' and `acconfig.h'
+\fB\-I\fR, \fB\-\-include\fR=\fIDIR\fR
+look for input files in DIR.  Accumulates
 .SH AUTHOR
 Written by David J. MacKenzie.
 .PP
index 4c1478c0730e3ea1a2b5036c21724f79013b0a9a..45b1df6fb208f0f94152e2dec9532d1c5b1949c7 100644 (file)
@@ -1,5 +1,5 @@
 .\" DO NOT MODIFY THIS FILE!  It was generated by help2man 1.24.
-.TH AUTOUPDATE "1" "August 2001" "GNU Autoconf 2.52e" FSF
+.TH AUTOUPDATE "1" "September 2001" "GNU Autoconf 2.52e" FSF
 .SH NAME
 autoupdate \- Update a configure.in to a newer Autoconf
 .SH SYNOPSIS