]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
* bin/autoreconf.in (&parse_args): Work only on the configure.ac
authorAkim Demaille <akim@epita.fr>
Sat, 3 Nov 2001 11:59:35 +0000 (11:59 +0000)
committerAkim Demaille <akim@epita.fr>
Sat, 3 Nov 2001 11:59:35 +0000 (11:59 +0000)
passed on command line, defaulting to ./configure.ac if present.
(&maybe_autoreconf, File::Find): Remove, unused.
(&autoreconf): If autoconf is not used, don't try to trace.

ChangeLog
bin/autoreconf.in
man/autoreconf.1

index 25afed7c74a306057a7172dffbec0bc129656375..c6e889f43e5a4cd86d4b11aaa2d2fefb578e220c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2001-11-03  Akim Demaille  <akim@epita.fr>
+
+       * bin/autoreconf.in (&parse_args): Work only on the configure.ac
+       passed on command line, defaulting to ./configure.ac if present.
+       (&maybe_autoreconf, File::Find): Remove, unused.
+       (&autoreconf): If autoconf is not used, don't try to trace.
+
 2001-11-02  Akim Demaille  <akim@epita.fr>
 
        * configure.ac: Bump to 2.52g.
index 2e5f0a74c4dd486b9960bea7d1f2e0ec8adf4dfd..6aed18a6ff0347053f46aa31ef8f854960fbd9ce 100644 (file)
@@ -34,7 +34,7 @@ BEGIN
 
 use Autom4te::General;
 use Autom4te::XFile;
-use File::Find;
+use Cwd 'chdir', 'cwd';
 use strict;
 
 ## ----------- ##
@@ -43,11 +43,13 @@ use strict;
 
 # $HELP
 # -----
-$help = "Usage: $0 [OPTION] ... [TEMPLATE-FILE]
+$help = "Usage: $0 [OPTION] ... [CONFIGURE-AC] ...
 
 Run `autoconf' (and `autoheader', `aclocal', `automake', `gettextize',
 and `libtoolize' where appropriate) repeatedly to remake the GNU Build
-System files in the directory tree rooted at the current directory.
+System files in the directory tree driven by CONFIGURE-AC (defaulting
+to `./configure.ac').
+
 By default, it only remakes those files that are older than their
 predecessors.  If you install new versions of the GNU Build System,
 running `autoreconf' remakes all of the files by giving it the
@@ -62,9 +64,6 @@ Operation modes:
   -i, --install   copy missing auxiliary files
   -s, --symlink   instead of copying, install symbolic links
 
-The option `--install' is similar to the option `--add-missing' in
-other tools.
-
 Library directories:
   -I, --include=DIR  look for FILES in DIR (cumulative)
 
@@ -100,6 +99,8 @@ my $status = 0;
 # symlink -- when --install, use symlinks instead.
 my $symlink = 0;
 
+# The directory where autoreconf was run.
+my $cwd = cwd;
 
 ## ---------- ##
 ## Routines.  ##
@@ -117,8 +118,8 @@ sub parse_args ()
          'i|install'                                        => \$install,
          's|symlink'                                        => \$symlink);
 
-  die "$me: too many arguments\n"
-    if @ARGV;
+  push @ARGV, find_configure_ac
+    unless @ARGV;
 
   if ($verbose && $debug)
     {
@@ -174,31 +175,36 @@ sub parse_args ()
 }
 
 
-# &maybe_autoreconf ()
-# --------------------
-# If the current file ($_) is configure.ac, then there is work to perform
-# there.  Otherwise return.  The main point is preserving $_.
-sub maybe_autoreconf ()
+# &autoreconf ($CONFIGURE_AC_PATH)
+# --------------------------------
+# Reconf the directory of $CONFIGURE_AC_PATH.
+sub autoreconf ($)
 {
-  # If there it's not `configure.ac' or `configure.in', we are not
-  # interested in the directory.
-  return
-    if !/^configure\.(ac|in)$/;
-
-  # Save $_ as Find::File requires it to be preserved.
-  my $underscore = $_;
-  autoreconf ($_);
-  $_ = $underscore;
-}
+  my ($configure_ac_path) = @_;
+  my ($subdir, $configure_ac) = fileparse ($configure_ac_path);
 
+  verbose "working in $subdir, on $configure_ac";
+  chdir $subdir
+    or die "$me: cannot chdir to $subdir: $!\n";
+
+
+  # ---------------------- #
+  # Is it using Autoconf?  #
+  # ---------------------- #
+
+  my $uses_autoconf;
+  my $configure_ac_file = new Autom4te::XFile $configure_ac;
+  while ($_ = $configure_ac_file->getline)
+     {
+       $uses_autoconf = 1
+        if /AC_INIT/;
+     }
+  if (!$uses_autoconf)
+    {
+      verbose "$configure_ac: not using Autoconf";
+      return;
+    }
 
-# &autoreconf ($CONFIGURE_AC)
-# ---------------------------
-# Reconf the current directory.
-sub autoreconf ($)
-{
-  my ($configure_ac) = @_;
-  verbose "working on $File::Find::name";
 
   # ------------------------------- #
   # See what tools will be needed.  #
@@ -207,18 +213,10 @@ sub autoreconf ($)
   # Perform a single trace reading to avoid --force forcing a rerun
   # between two --trace, that's useless.  If there is no AC_INIT, then
   # we are not interested: it looks like a Cygnus thingy.
-  my $configure_ac_file = new Autom4te::XFile $configure_ac;
-  my $uses_autoconf;
   my $uses_gettext;
   my $uses_libtool;
   my $uses_autoheader;
   my $uses_aclocal;
-  while ($_ = $configure_ac_file->getline)
-     {
-       $uses_autoconf = 1
-        if /AC_INIT/;
-     }
-
   my $traces = new Autom4te::XFile
     ("$autoconf"
      . join (' --trace=', '',
@@ -233,15 +231,6 @@ sub autoreconf ($)
       $uses_autoheader = 1 if /AC_CONFIG_HEADERS/;
     }
 
-  # ------------------ #
-  # Running autoconf.  #
-  # ------------------ #
-
-  if (!$uses_autoconf)
-    {
-      verbose "$configure_ac: not using Autoconf";
-      return;
-    }
 
   # -------------------- #
   # Running gettexitze.  #
@@ -371,6 +360,9 @@ sub autoreconf ($)
     {
       xsystem ($autoheader);
     }
+
+  chdir $cwd
+    or die "$me: cannot chdir to $cwd: $!\n";
 }
 
 
@@ -380,7 +372,11 @@ sub autoreconf ($)
 
 # When debugging, it is convenient that all the related temporary
 # files be at the same place.
-mktmpdir ('ah');
+mktmpdir ('ar');
 $ENV{'TMPDIR'} = $tmp;
 parse_args;
-find (\&maybe_autoreconf, '.');
+
+# Autoreconf all the given configure.ac.  A while loop, not a for,
+# since the list can change at runtime because of AC_CONFIG_SUBDIRS.
+autoreconf (shift @ARGV)
+  while (@ARGV);
index fda7a7c644214c31745e649583d28d8ea098d80b..cec0092d71b2917005eb789343a962d18a1e12f2 100644 (file)
@@ -4,11 +4,13 @@
 autoreconf \- Update generated configuration files
 .SH SYNOPSIS
 .B autoreconf
-[\fIOPTION\fR] ... [\fITEMPLATE-FILE\fR]
+[\fIOPTION\fR] ... [\fICONFIGURE-AC\fR] ...
 .SH DESCRIPTION
 Run `autoconf' (and `autoheader', `aclocal', `automake', `gettextize',
 and `libtoolize' where appropriate) repeatedly to remake the GNU Build
-System files in the directory tree rooted at the current directory.
+System files in the directory tree driven by CONFIGURE-AC (defaulting
+to `./configure.ac').
+.PP
 By default, it only remakes those files that are older than their
 predecessors.  If you install new versions of the GNU Build System,
 running `autoreconf' remakes all of the files by giving it the
@@ -35,9 +37,6 @@ copy missing auxiliary files
 .TP
 \fB\-s\fR, \fB\-\-symlink\fR
 instead of copying, install symbolic links
-.PP
-The option `--install' is similar to the option `--add-missing' in
-other tools.
 .SS "Library directories:"
 .TP
 \fB\-I\fR, \fB\-\-include\fR=\fIDIR\fR