[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
42-fyi-autoreconf-subdirs.patch
From: |
Akim Demaille |
Subject: |
42-fyi-autoreconf-subdirs.patch |
Date: |
Sat, 03 Nov 2001 12:58:47 +0100 |
First time ever I see autoreconf working properly on a tree such as
GNU Make's. And finally, autoreconf on Autoconf does not autoreconf
the tests/ dir if a stray configure.ac is still there.
Index: ChangeLog
from Akim Demaille <address@hidden>
* lib/Autom4te/General.pm: (&catfile, &canonfile)
(&file_name_is_absolute): New, wrappers around routines from
File::Spec.
Use and export them.
(&find_configure_ac): Optionally take a directory where to look at.
* bin/autoreconf.in (&parse_args): Trim the configure.ac part of
the arguments.
Default @ARGV to `.', not find_configure_ac.
(&autoreconf): Argument is a directory.
Trace AC_CONFIG_SUBDIRS and schedule the subdirs for autoreconf'ing.
* doc/autoconf.texi (autoreconf Invocation): Update.
Index: NEWS
--- NEWS Fri, 02 Nov 2001 19:26:39 +0100 akim
+++ NEWS Sat, 03 Nov 2001 12:50:38 +0100 akim
@@ -48,6 +48,12 @@
Runs gettextize and libtoolize when appropriate.
- autoreconf
--m4dir is no longer supported.
+- autoreconf
+ Now runs only in the specified directories, defaulting to `.',
+ but understands AC_CONFIG_SUBDIRS for dependent directories.
+ Before, it used to run on all the `configure.ac' found in the
+ current tree.
+ Independent packages are properly updated.
** Bug fixes
Index: TODO
--- TODO Wed, 12 Sep 2001 17:00:45 +0200 akim
+++ TODO Sat, 03 Nov 2001 12:49:35 +0100 akim
@@ -651,23 +651,6 @@ From: address@hidden (Keith Bostic)
------------------------------------------------------------------------------
-autoreconf doesn't support having (in the same tree) both directories
-that are parts of a larger package (sharing aclocal.m4 and
-acconfig.h), and directories that are independent packages (each with
-their own ac*). It assumes that they are all part of the same
-package, if you use --localdir, or that each directory is a separate
-package, if you don't use it.
-
-autoreconf should automatically figure out which ac* files to use--the
-closest ones up the tree from each directory, probably, unless
-overridden by --localdir.
-
-Also, autoreconf recurses on all subdirectories containing a
-configure.in, not just those given by an AC_CONFIG_SUBDIRS directive.
-This may not be a problem in practice.
-
-------------------------------------------------------------------------------
-
Copyright 1994, 1995, 1996, 1999, 2000, 2001 Free Software
Foundation, Inc.
Index: bin/autoreconf.in
--- bin/autoreconf.in Sat, 03 Nov 2001 11:30:17 +0100 akim
+++ bin/autoreconf.in Sat, 03 Nov 2001 12:32:23 +0100 akim
@@ -43,12 +43,12 @@
# $HELP
# -----
-$help = "Usage: $0 [OPTION] ... [CONFIGURE-AC] ...
+$help = "Usage: $0 [OPTION] ... [CONFIGURE-AC or DIRECTORY] ...
Run `autoconf' (and `autoheader', `aclocal', `automake', `gettextize',
and `libtoolize' where appropriate) repeatedly to remake the GNU Build
-System files in the directory tree driven by CONFIGURE-AC (defaulting
-to `./configure.ac').
+System files in the DIRECTORIES or the directory trees driven by
+CONFIGURE-AC (defaulting to `.').
By default, it only remakes those files that are older than their
predecessors. If you install new versions of the GNU Build System,
@@ -118,8 +118,12 @@ sub parse_args ()
'i|install' => \$install,
's|symlink' => \$symlink);
- push @ARGV, find_configure_ac
- unless @ARGV;
+ # Even if the user specified a configure.ac, trim to get the
+ # directory, and look for configure.ac again. Because (i) the code
+ # is simpler, and (ii) we are still able to diagnose simultaneous
+ # presence of configure.ac and configure.in.
+ @ARGV = map { /configure\.(ac|in)$/ ? dirname ($_) : $_ } @ARGV;
+ push @ARGV, '.' unless @ARGV;
if ($verbose && $debug)
{
@@ -175,17 +179,20 @@ sub parse_args ()
}
-# &autoreconf ($CONFIGURE_AC_PATH)
-# --------------------------------
-# Reconf the directory of $CONFIGURE_AC_PATH.
+# &autoreconf ($DIRECTORY)
+# ------------------------
+# Reconf the $DIRECTORY.
sub autoreconf ($)
{
- my ($configure_ac_path) = @_;
- my ($configure_ac, $subdir) = fileparse ($configure_ac_path);
- verbose "working in $subdir, on $configure_ac";
- chdir $subdir
- or die "$me: cannot chdir to $subdir: $!\n";
+ my ($directory) = @_;
+ verbose "working in `$directory'";
+ chdir $directory
+ or die "$me: cannot chdir to $directory: $!\n";
+
+ my $configure_ac = find_configure_ac;
+ die "$me: cannot find `configure.ac' in `$directory'\n"
+ unless $configure_ac;
# ---------------------- #
# Is it using Autoconf? #
@@ -219,18 +226,21 @@ sub autoreconf ($)
my $uses_libtool;
my $uses_autoheader;
my $uses_aclocal;
+ my @subdir;
my $traces = new Autom4te::XFile
("$autoconf"
. join (' --trace=', '',
'AC_INIT', 'AM_GNU_GETTEXT', 'AM_PROG_LIBTOOL',
- 'AC_CONFIG_HEADERS')
- . " |");
+ 'AC_CONFIG_HEADERS',
+ 'AC_CONFIG_SUBDIRS:AC_CONFIG_SUBDIRS:\$1')
+ . ' |');
while ($_ = $traces->getline)
{
- $uses_autoconf = 1 if /AC_INIT/;
- $uses_gettext = 1 if /AM_GNU_GETTEXT/;
- $uses_libtool = 1 if /AM_PROG_LIBTOOL/;
- $uses_autoheader = 1 if /AC_CONFIG_HEADERS/;
+ $uses_autoconf = 1 if /AC_INIT/;
+ $uses_gettext = 1 if /AM_GNU_GETTEXT/;
+ $uses_libtool = 1 if /AM_PROG_LIBTOOL/;
+ $uses_autoheader = 1 if /AC_CONFIG_HEADERS/;
+ push @ARGV, split (' ', $1) if /AC_CONFIG_SUBDIRS:(.*)/;
}
@@ -381,5 +391,6 @@ sub 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.
+print STDERR "@ARGV\n";
autoreconf (shift @ARGV)
while (@ARGV);
Index: doc/autoconf.texi
--- doc/autoconf.texi Fri, 02 Nov 2001 19:26:39 +0100 akim
+++ doc/autoconf.texi Sat, 03 Nov 2001 12:50:07 +0100 akim
@@ -1371,37 +1371,25 @@ configure.ac:2:AC_SUBST:ECHO_T
@node autoreconf Invocation
@section Using @code{autoreconf} to Update @code{configure} Scripts
address@hidden @code{autoreconf}
address@hidden @command{autoreconf}
address@hidden FIXME: Now completely outdated.
+Installing the various components of the @sc{gnu} Build System can be
+tedious: running @command{gettextize}, @command{automake} etc. in each
+directory. It may be needed either because some tools such as
address@hidden have been updated on your system, or because some of
+the sources such as @file{configure.ac} have been updated, or finally,
+simply in order to install the @sc{gnu} Build System in a fresh tree.
+
+It runs @command{autoconf}, @command{autoheader}, @command{aclocal},
address@hidden, @command{libtoolize}, and @command{gettextize} (when
+appropriate) repeatedly to update the @sc{gnu} Build System in specified
+directories, and their subdirectories (@pxref{Subdirectories}). By
+default, it only remakes those files that are older than their sources.
-If you have a lot of Autoconf-generated @code{configure} scripts, the
address@hidden program can save you some work. It runs
address@hidden (and @code{autoheader}, where appropriate) repeatedly to
-remake the Autoconf @code{configure} scripts and configuration header
-templates in the directory tree rooted at the current directory. By
-default, it only remakes those files that are older than their
address@hidden or (if present) @file{aclocal.m4}. Since
address@hidden does not change the timestamp of its output file if
-the file wouldn't be changing, this is not necessarily the minimum
-amount of work. If you install a new version of Autoconf, you can make
address@hidden remake @emph{all} of the files by giving it the
+If you install a new version of some tools, you can make
address@hidden remake @emph{all} of the files by giving it the
@option{--force} option.
-If you give @code{autoreconf} the @address@hidden or
address@hidden@var{dir}} options, it passes them down to
address@hidden and @code{autoheader} (with relative paths adjusted
-properly).
-
address@hidden does not support having, in the same directory tree,
-both directories that are parts of a larger package (sharing
address@hidden and @file{acconfig.h}) and directories that are
-independent packages (each with their own @file{aclocal.m4} and
address@hidden). It assumes that they are all part of the same
-package if you use @option{--localdir}, or that each directory is a
-separate package if you don't use it. This restriction may be removed
-in the future.
-
@xref{Automatic Remaking}, for @file{Makefile} rules to automatically
remake @code{configure} scripts when their source files change. That
method handles the timestamps of configuration header templates
@@ -1409,7 +1397,7 @@ @node autoreconf Invocation
@address@hidden
@noindent
address@hidden accepts the following options:
address@hidden accepts the following options:
@table @option
@item --help
@@ -8265,7 +8253,7 @@ @node Special Shell Variables
7. 7
8. 8
9. 9
-10. 10
+10. 10
@end group
@end example
Index: lib/Autom4te/General.pm
--- lib/Autom4te/General.pm Sat, 03 Nov 2001 11:30:17 +0100 akim
+++ lib/Autom4te/General.pm Sat, 03 Nov 2001 12:26:51 +0100 akim
@@ -21,6 +21,7 @@
use 5.005_03;
use Exporter;
use File::Basename;
+use File::Spec;
use File::stat;
use IO::File;
use Carp;
@@ -36,7 +37,8 @@
# Functions we define and export.
my @export_subs =
- qw (&backname &debug &find_configure_ac &find_file
+ qw (&backname &catfile &canonpath &debug
+ &file_name_is_absolute &find_configure_ac &find_file
&getopt &mktmpdir &mtime
&uniq &update_file &up_to_date_p &verbose &xsystem);
@@ -131,8 +133,6 @@ sub END
# Works with non strictly increasing paths, i.e., `src/../lib' => `..'.
sub backname ($)
{
- use File::Spec;
-
my ($file) = @_;
my $underscore = $_;
my @res;
@@ -151,7 +151,27 @@ sub backname ($)
}
$_ = $underscore;
- return File::Spec->canonpath (File::Spec->catfile (@res))
+ return canonpath (catfile (@res))
+}
+
+
+# $FILE
+# &catfile (@COMPONENT)
+# ---------------------
+sub catfile (@)
+{
+ my (@component) = @_;
+ return File::Spec->catfile (@component);
+}
+
+
+# $FILE
+# &canonpath ($FILE)
+# ------------------
+sub canonpath ($)
+{
+ my ($file) = @_;
+ return File::Spec->canonpath ($file);
}
@@ -165,23 +185,38 @@ sub debug (@)
}
+# $BOOLEAN
+# &file_name_is_absolute ($FILE)
+# ------------------------------
+sub file_name_is_absolute ($)
+{
+ my ($file) = @_;
+ return File::Spec->file_name_is_absolute ($file);
+}
+
+
# $CONFIGURE_AC
-# &find_configure_ac ()
-# ---------------------
-sub find_configure_ac ()
+# &find_configure_ac ([$DIRECTORY = `.'])
+# ---------------------------------------
+sub find_configure_ac (;$)
{
- if (-f 'configure.ac')
+ my ($directory) = @_;
+ $directory ||= '.';
+ my $configure_ac = canonpath (catfile ($directory, 'configure.ac'));
+ my $configure_in = canonpath (catfile ($directory, 'configure.in'));
+
+ if (-f $configure_ac)
{
- if (-f 'configure.in')
+ if (-f $configure_in)
{
- carp "warning: `configure.ac' and `configure.in' both present.\n";
- carp "warning: proceeding with `configure.ac'.\n";
+ carp "$me: warning: `$configure_ac' and `$configure_in' both
present.\n";
+ carp "$me: warning: proceeding with `$configure_ac'.\n";
}
- return 'configure.ac';
+ return $configure_ac;
}
- elsif (-f 'configure.in')
+ elsif (-f $configure_in)
{
- return 'configure.in';
+ return $configure_in;
}
return;
}
@@ -198,18 +233,16 @@ sub find_configure_ac ()
# if absent.
sub find_file ($@)
{
- use File::Spec;
-
my ($filename, @include) = @_;
my $optional = 0;
$optional = 1
if $filename =~ s/\?$//;
- return File::Spec->canonpath ($filename)
+ return canonpath ($filename)
if -e $filename;
- if (File::Spec->file_name_is_absolute ($filename))
+ if (file_name_is_absolute ($filename))
{
die "$me: no such file or directory: $filename\n"
unless $optional;
@@ -218,8 +251,8 @@ sub find_file ($@)
foreach my $path (reverse @include)
{
- return File::Spec->canonpath (File::Spec->catfile ($path, $filename))
- if -e File::Spec->catfile ($path, $filename)
+ return canonpath (catfile ($path, $filename))
+ if -e catfile ($path, $filename);
}
die "$me: no such file or directory: $filename\n"
@@ -254,7 +287,7 @@ sub getopt (%)
GetOptions (%option)
or exit 1;
- push @ARGV, '-'
+ push @ARGV, '-'
if $stdin;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- 42-fyi-autoreconf-subdirs.patch,
Akim Demaille <=