From 3b536e758c0cb5e983ba178293c2ae27c21329cc Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Sat, 3 Nov 2001 11:59:48 +0000 Subject: [PATCH] * lib/Autom4te/General.pm (@export_vars, @export_subs) (@export_forward_subs): New. Add basename, dirname, and fileparse. (@EXPORT): Adjust. * bin/autoreconf.in (&autoreconf): Fix call to fileparse. Don't look for aclocal flags if we already know aclocal is not used. Move aclocal.m4t only if it exists. Reported by Ezra Peisach. --- ChangeLog | 13 +++++++++++++ bin/autoreconf.in | 17 ++++++++++------- lib/Autom4te/General.pm | 20 ++++++++++++++++---- 3 files changed, 39 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index c6e889f4..c5a83e57 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2001-11-03 Akim Demaille + + * lib/Autom4te/General.pm (@export_vars, @export_subs) + (@export_forward_subs): New. + Add basename, dirname, and fileparse. + (@EXPORT): Adjust. + * bin/autoreconf.in (&autoreconf): Fix call to fileparse. + Don't look for aclocal flags if we already know aclocal is not + used. + Move aclocal.m4t only if it exists. + Reported by Ezra Peisach. + + 2001-11-03 Akim Demaille * bin/autoreconf.in (&parse_args): Work only on the configure.ac diff --git a/bin/autoreconf.in b/bin/autoreconf.in index 6aed18a6..062ab827 100644 --- a/bin/autoreconf.in +++ b/bin/autoreconf.in @@ -181,8 +181,7 @@ sub parse_args () sub autoreconf ($) { my ($configure_ac_path) = @_; - my ($subdir, $configure_ac) = fileparse ($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"; @@ -196,8 +195,11 @@ sub autoreconf ($) my $configure_ac_file = new Autom4te::XFile $configure_ac; while ($_ = $configure_ac_file->getline) { - $uses_autoconf = 1 - if /AC_INIT/; + if (/AC_INIT/) + { + $uses_autoconf = 1; + last; + } } if (!$uses_autoconf) { @@ -294,7 +296,7 @@ sub autoreconf ($) # If there are flags for aclocal in Makefile.am, use them. my $aclocal_flags = ''; - if (-f 'Makefile.am') + if ($uses_aclocal && -f 'Makefile.am') { my $makefile = new Autom4te::XFile 'Makefile.am'; while ($_ = $makefile->getline) @@ -302,7 +304,6 @@ sub autoreconf ($) if (/^ACLOCAL_[A-Z_]*FLAGS\s*=\s*(.*)/) { $aclocal_flags = $1; - $uses_aclocal = 1; last; } } @@ -315,7 +316,9 @@ sub autoreconf ($) else { xsystem ("$aclocal $aclocal_flags --output=aclocal.m4t"); - update_file ('aclocal.m4t', 'aclocal.m4'); + # aclocal may produce no output. + update_file ('aclocal.m4t', 'aclocal.m4') + if -f 'aclocal.m4t'; } # ------------------ # diff --git a/lib/Autom4te/General.pm b/lib/Autom4te/General.pm index d7959071..6230fe38 100644 --- a/lib/Autom4te/General.pm +++ b/lib/Autom4te/General.pm @@ -29,10 +29,22 @@ use strict; use vars qw (@ISA @EXPORT); @ISA = qw (Exporter); -@EXPORT = qw (&backname &debug &find_configure_ac &find_file - &getopt &mktmpdir &mtime - &uniq &update_file &up_to_date_p &verbose &xsystem - $debug $force $help $me $tmp $verbose $version); + +# Variables we define and export. +my @export_vars = + qw ($debug $force $help $me $tmp $verbose $version); + +# Functions we define and export. +my @export_subs = + qw (&backname &debug &find_configure_ac &find_file + &getopt &mktmpdir &mtime + &uniq &update_file &up_to_date_p &verbose &xsystem); + +# Functions we forward (coming from modules we use). +my @export_forward_subs = + qw (&basename &dirname &fileparse); + +@EXPORT = (@export_vars, @export_subs, @export_forward_subs); # Variable we share with the main package. Be sure to have a single # copy of them: using `my' together with multiple inclusion of this