[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
FYI: misc. aclocal.in cleanups
From: |
Alexandre Duret-Lutz |
Subject: |
FYI: misc. aclocal.in cleanups |
Date: |
Tue, 07 Oct 2003 00:42:11 +0200 |
User-agent: |
Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3 (gnu/linux) |
I'm checking this in. This addresses some issues reported by
maintainer-check.
2003-10-07 Alexandre Duret-Lutz <address@hidden>
* aclocal.in ("MAIN", usage, parse_arguments): Move near
the end, so "MAIN" can use prototypes.
(scan_configure): Move later too, for the sake of prototypes.
(scan_configure_dep): Fix setting of $scanned_configure_dep.
(trace_used_macros): Do not take any argument.
Index: aclocal.in
===================================================================
RCS file: /cvs/automake/automake/aclocal.in,v
retrieving revision 1.94
diff -u -r1.94 aclocal.in
--- aclocal.in 23 Sep 2003 19:32:58 -0000 1.94
+++ aclocal.in 6 Oct 2003 22:40:43 -0000
@@ -101,156 +101,6 @@
$m4_include_rx = "(?:m4_)?s?include\\((?:\\[([^]]+)\\]|([^],)\n]+))\\)";
-
-local (@dirlist) = &parse_arguments (@ARGV);
-$configure_ac = require_configure_ac;
-&scan_m4_files (@dirlist);
-&scan_configure;
-if (! $exit_code)
- {
- my %macro_traced = &trace_used_macros;
- &write_aclocal ($output_file, keys %macro_traced);
- }
-&check_acinclude;
-
-exit $exit_code;
-
-################################################################
-
-# Print usage and exit.
-sub usage ($)
-{
- local ($status) = @_;
-
- print "Usage: aclocal [OPTIONS] ...\n\n";
- 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
-
-Report bugs to <address@hidden>.\n";
-
- exit $status;
-}
-
-# Parse command line.
-sub parse_arguments (@)
-{
- local (@arglist) = @_;
- local (@dirlist);
- local ($print_and_exit) = 0;
-
- while (@arglist)
- {
- if ($arglist[0] =~ /^--acdir=(.+)$/)
- {
- $acdir = $1;
- }
- elsif ($arglist[0] =~/^--output=(.+)$/)
- {
- $output_file = $1;
- }
- elsif ($arglist[0] eq '-I')
- {
- shift (@arglist);
- push (@dirlist, $arglist[0]);
- }
- elsif ($arglist[0] eq '--print-ac-dir')
- {
- $print_and_exit = 1;
- }
- elsif ($arglist[0] eq '--force')
- {
- $force_output = 1;
- }
- elsif ($arglist[0] eq '--verbose')
- {
- ++$verbose;
- }
- elsif ($arglist[0] eq '--version')
- {
- print "aclocal (GNU $PACKAGE) $VERSION\n\n";
- print "Copyright (C) 2003 Free Software Foundation, Inc.\n";
- print "This is free software; see the source for copying
conditions. There is NO\n";
- print "warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.\n\n";
- print "Written by Tom Tromey <address@hidden>\n";
- exit 0;
- }
- elsif ($arglist[0] eq '--help')
- {
- &usage (0);
- }
- else
- {
- print STDERR "aclocal: unrecognized option -- `$arglist[0]'\nTry
`aclocal --help' for more information.\n";
- exit 1;
- }
-
- shift (@arglist);
- }
-
- if ($print_and_exit)
- {
- print $acdir, "\n";
- exit 0;
- }
-
- $default_dirlist="$acdir/dirlist"
- if $acdir ne $default_acdir;
-
- # Search the versioned directory near the end, and then the
- # unversioned directory last. Only do this if the user didn't
- # override acdir.
- push (@dirlist, "$acdir-$APIVERSION")
- if $acdir eq $default_acdir;
-
- # By default $(datadir)/aclocal doesn't exist. We don't want to
- # get an error in the case where we are searching the default
- # directory and it hasn't been created.
- push (@dirlist, $acdir)
- unless $acdir eq $default_acdir && ! -d $acdir;
-
- # Finally, adds any directory listed in the `dirlist' file.
- if (open (DEFAULT_DIRLIST, $default_dirlist))
- {
- while (<DEFAULT_DIRLIST>)
- {
- # Ignore '#' lines.
- next if /^#/;
- # strip off newlines and end-of-line comments
- s/\s*\#.*$//;
- chomp ($contents=$_);
- if (-d $contents )
- {
- push (@dirlist, $contents);
- }
- }
- close (DEFAULT_DIRLIST);
- }
-
- return @dirlist;
-}
-
-################################################################
-
-sub scan_configure ()
-{
- # Make sure we include acinclude.m4 if it exists.
- if (-f 'acinclude.m4')
- {
- &add_file ('acinclude.m4');
- }
-
- &scan_configure_dep ($configure_ac);
-}
-
################################################################
# Check macros in acinclude.m4. If one is not used, warn.
@@ -355,7 +205,7 @@
# Do not scan a file twice.
return ()
if exists $scanned_configure_dep{$file};
- $scanned_configure_dep = 1;
+ $scanned_configure_dep{$file} = 1;
my $mtime = mtime $file;
$greatest_mtime = $mtime if $greatest_mtime < $mtime;
@@ -395,10 +245,9 @@
}
}
-
- &add_macro ($_) foreach (@rlist);
+ add_macro ($_) foreach (@rlist);
my $dirname = dirname $file;
- scan_configure_dep (File::Spec->rel2abs ($_, $dirname)) foreach (@ilist);
+ &scan_configure_dep (File::Spec->rel2abs ($_, $dirname)) foreach (@ilist);
}
# Add a file to output.
@@ -465,14 +314,12 @@
return $contents;
}
-sub trace_used_macros ($)
+sub trace_used_macros ()
{
- my ($filename) = @_;
-
my %files = map { $map{$_} => 1 } keys %macro_seen;
my $traces = ($ENV{AUTOM4TE} || 'autom4te');
- $traces .= " --language Autoconf-without-aclocal-m4 $filename ";
+ $traces .= " --language Autoconf-without-aclocal-m4 ";
# All candidate files.
$traces .= join (' ', grep { exists $files{$_} } @file_order) . " ";
# All candidate macros.
@@ -495,6 +342,16 @@
return %traced;
}
+sub scan_configure ()
+{
+ # Make sure we include acinclude.m4 if it exists.
+ if (-f 'acinclude.m4')
+ {
+ add_file ('acinclude.m4');
+ }
+ scan_configure_dep ($configure_ac);
+}
+
################################################################
# Write output.
@@ -575,6 +432,144 @@
print $out $output;
return;
}
+
+################################################################
+
+# Print usage and exit.
+sub usage ($)
+{
+ local ($status) = @_;
+
+ print "Usage: aclocal [OPTIONS] ...\n\n";
+ 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
+
+Report bugs to <address@hidden>.\n";
+
+ exit $status;
+}
+
+# Parse command line.
+sub parse_arguments (@)
+{
+ local (@arglist) = @_;
+ local (@dirlist);
+ local ($print_and_exit) = 0;
+
+ while (@arglist)
+ {
+ if ($arglist[0] =~ /^--acdir=(.+)$/)
+ {
+ $acdir = $1;
+ }
+ elsif ($arglist[0] =~/^--output=(.+)$/)
+ {
+ $output_file = $1;
+ }
+ elsif ($arglist[0] eq '-I')
+ {
+ shift (@arglist);
+ push (@dirlist, $arglist[0]);
+ }
+ elsif ($arglist[0] eq '--print-ac-dir')
+ {
+ $print_and_exit = 1;
+ }
+ elsif ($arglist[0] eq '--force')
+ {
+ $force_output = 1;
+ }
+ elsif ($arglist[0] eq '--verbose')
+ {
+ ++$verbose;
+ }
+ elsif ($arglist[0] eq '--version')
+ {
+ print "aclocal (GNU $PACKAGE) $VERSION\n\n";
+ print "Copyright (C) 2003 Free Software Foundation, Inc.\n";
+ print "This is free software; see the source for copying conditions.
There is NO\n";
+ print "warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.\n\n";
+ print "Written by Tom Tromey <address@hidden>\n";
+ exit 0;
+ }
+ elsif ($arglist[0] eq '--help')
+ {
+ &usage (0);
+ }
+ else
+ {
+ print STDERR "aclocal: unrecognized option -- `$arglist[0]'\nTry
`aclocal --help' for more information.\n";
+ exit 1;
+ }
+
+ shift (@arglist);
+ }
+
+ if ($print_and_exit)
+ {
+ print $acdir, "\n";
+ exit 0;
+ }
+
+ $default_dirlist="$acdir/dirlist"
+ if $acdir ne $default_acdir;
+
+ # Search the versioned directory near the end, and then the
+ # unversioned directory last. Only do this if the user didn't
+ # override acdir.
+ push (@dirlist, "$acdir-$APIVERSION")
+ if $acdir eq $default_acdir;
+
+ # By default $(datadir)/aclocal doesn't exist. We don't want to
+ # get an error in the case where we are searching the default
+ # directory and it hasn't been created.
+ push (@dirlist, $acdir)
+ unless $acdir eq $default_acdir && ! -d $acdir;
+
+ # Finally, adds any directory listed in the `dirlist' file.
+ if (open (DEFAULT_DIRLIST, $default_dirlist))
+ {
+ while (<DEFAULT_DIRLIST>)
+ {
+ # Ignore '#' lines.
+ next if /^#/;
+ # strip off newlines and end-of-line comments
+ s/\s*\#.*$//;
+ chomp ($contents=$_);
+ if (-d $contents )
+ {
+ push (@dirlist, $contents);
+ }
+ }
+ close (DEFAULT_DIRLIST);
+ }
+
+ return @dirlist;
+}
+
+################################################################
+
+local (@dirlist) = parse_arguments (@ARGV);
+$configure_ac = require_configure_ac;
+scan_m4_files (@dirlist);
+scan_configure;
+if (! $exit_code)
+ {
+ my %macro_traced = trace_used_macros;
+ write_aclocal ($output_file, keys %macro_traced);
+ }
+check_acinclude;
+
+exit $exit_code;
### Setup "GNU" style for perl-mode and cperl-mode.
## Local Variables:
--
Alexandre Duret-Lutz
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- FYI: misc. aclocal.in cleanups,
Alexandre Duret-Lutz <=