* 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>
+
+ * 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)'.
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;
use Autom4te::General;
use Autom4te::Struct;
use Carp;
-use Getopt::Long;
use IO::File;
use strict;
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;
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
`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";
}
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)
# 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;
}
## ----------------------- ##
-# scan_c_file(FILENAME)
-# ---------------------
+# scan_c_file($FILENAME)
+# ----------------------
sub scan_c_file ($)
{
my ($filename) = @_;
}
-# scan_makefile(MAKEFILE-NAME)
-# ----------------------------
+# scan_makefile($MAKEFILE-NAME)
+# -----------------------------
sub scan_makefile ($)
{
my ($filename) = @_;
}
-# scan_sh_file(SHELL-SCRIPT-NAME)
-# -------------------------------
+# scan_sh_file($SHELL-SCRIPT-NAME)
+# --------------------------------
sub scan_sh_file ($)
{
my ($filename) = @_;
}
-# output (CONFIGURE_SCAN)
-# -----------------------
+# output ($CONFIGURE_SCAN)
+# ------------------------
# Print a proto configure.ac.
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 ($)
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)
## -------------- ##
parse_args;
+$autoconf .= " --debug" if $debug;
+$autoconf .= " --verbose" if $verbose;
+$autoconf .= join (' --include=', '', @include);
+
my $configure_ac = find_configure_ac;
init_tables;
scan_files;
# Lib files.
my $autom4te = $ENV{'AUTOM4TE'} || '@autom4te-name@';
+my $autoconf = "$autom4te --language=autoconf";
# We need to find m4sugar.
my @include = ('@datadir@');
my $force = 0;
# $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. ##
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;
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.
## -------------- ##
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;
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
}
-# 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 },
Getopt::Long::Configure ("bundling");
GetOptions (%option)
or exit 1;
+
+ push @ARGV, '-'
+ if $stdin;
}
.\" 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
.\" 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
.\" 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
.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
.\" 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