mirror of
git://git.sv.gnu.org/autoconf
synced 2024-12-03 02:00:36 +08:00
* lib/Autom4te/General.pm ($version, $help, &getopt): New.
* bin/autoupdate.in, bin/autoheader.in, bin/autom4te.in: Use them. * bin/autom4te.in ($autoconf): Pass --force. `print $out' doesn't print `$_' but `$out'. * tests/tools.at (Syntax of the Perl scripts): Pass the lib dir. (autoheader): Pass --force since the test suite goes too fast for the time stamps. Adjust to the new autoheader messages.
This commit is contained in:
parent
e3e7e0a0af
commit
b7e99feee5
11
ChangeLog
11
ChangeLog
@ -1,3 +1,14 @@
|
||||
2001-08-31 Akim Demaille <akim@epita.fr>
|
||||
|
||||
* lib/Autom4te/General.pm ($version, $help, &getopt): New.
|
||||
* bin/autoupdate.in, bin/autoheader.in, bin/autom4te.in: Use them.
|
||||
* bin/autom4te.in ($autoconf): Pass --force.
|
||||
`print $out' doesn't print `$_' but `$out'.
|
||||
* tests/tools.at (Syntax of the Perl scripts): Pass the lib dir.
|
||||
(autoheader): Pass --force since the test suite goes too fast for
|
||||
the time stamps.
|
||||
Adjust to the new autoheader messages.
|
||||
|
||||
2001-08-31 Akim Demaille <akim@epita.fr>
|
||||
|
||||
* bin/autoheader.in: Handle the acconfig.h etc. junk files.
|
||||
|
@ -53,17 +53,9 @@ my $m4 = $ENV{"M4"} || "@M4@";
|
||||
my $SIMPLE_BACKUP_SUFFIX = $ENV{'SIMPLE_BACKUP_SUFFIX'} || '~';
|
||||
|
||||
|
||||
## ---------- ##
|
||||
## Routines. ##
|
||||
## ---------- ##
|
||||
|
||||
|
||||
# print_usage ()
|
||||
# --------------
|
||||
# Display usage (--help).
|
||||
sub print_usage ()
|
||||
{
|
||||
print <<"END";
|
||||
# $HELP
|
||||
# -----
|
||||
$help = <<"END";
|
||||
Usage: $0 [OPTION] ... [TEMPLATE-FILE]
|
||||
|
||||
Create a template file of C \`#define\' statements for \`configure\' to
|
||||
@ -90,16 +82,11 @@ Library directories:
|
||||
|
||||
Report bugs to <bug-autoconf\@gnu.org>.
|
||||
END
|
||||
exit 0;
|
||||
}
|
||||
|
||||
|
||||
# print_version ()
|
||||
# ----------------
|
||||
# Display version (--version).
|
||||
sub print_version
|
||||
{
|
||||
print <<END;
|
||||
# $VERSION
|
||||
# --------
|
||||
$version = <<"END";
|
||||
autoheader (@PACKAGE_NAME@) @VERSION@
|
||||
Written by Roland McGrath.
|
||||
|
||||
@ -108,8 +95,11 @@ 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
|
||||
exit 0;
|
||||
}
|
||||
|
||||
|
||||
## ---------- ##
|
||||
## Routines. ##
|
||||
## ---------- ##
|
||||
|
||||
|
||||
# parse_args ()
|
||||
@ -122,16 +112,10 @@ sub parse_args ()
|
||||
# If fixed some day, use this: '' => sub { push @ARGV, "-" }
|
||||
my $stdin = grep /^-$/, @ARGV;
|
||||
@ARGV = grep !/^-$/, @ARGV;
|
||||
Getopt::Long::config ("bundling");
|
||||
Getopt::Long::GetOptions ('A|autoconf-dir|m|macrodir=s' => \$autoconf_dir,
|
||||
'l|localdir=s' => \$localdir,
|
||||
'd|debug' => \$debug,
|
||||
'h|help' => \&print_usage,
|
||||
'V|version' => \&print_version,
|
||||
'v|verbose' => \$verbose,
|
||||
'f|force' => \$force,
|
||||
'W|warning' => \@warning)
|
||||
or exit 1;
|
||||
getopt ('A|autoconf-dir|m|macrodir=s' => \$autoconf_dir,
|
||||
'l|localdir=s' => \$localdir,
|
||||
'f|force' => \$force,
|
||||
'W|warning' => \@warning);
|
||||
|
||||
push @ARGV, '-'
|
||||
if $stdin;
|
||||
@ -180,8 +164,9 @@ END
|
||||
|
||||
# Set up autoconf.
|
||||
$autoconf .= " --include=$autoconf_dir --include=$localdir";
|
||||
$autoconf .= ' --verbose' if $verbose;
|
||||
$autoconf .= ' --debug' if $debug;
|
||||
$autoconf .= ' --force' if $force;
|
||||
$autoconf .= ' --verbose' if $verbose;
|
||||
|
||||
# ----------------------- #
|
||||
# Real work starts here. #
|
||||
@ -219,7 +204,7 @@ if ($config_h_top)
|
||||
my $in = new IO::File ($config_h_top);
|
||||
while ($_ = $in->getline)
|
||||
{
|
||||
print $out;
|
||||
print $out $_;
|
||||
}
|
||||
}
|
||||
|
||||
@ -231,7 +216,7 @@ if ($acconfig_h)
|
||||
{
|
||||
last if /\@BOTTOM\@/;
|
||||
next if /\@TOP\@/;
|
||||
print $out;
|
||||
print $out $_;
|
||||
}
|
||||
}
|
||||
|
||||
@ -248,7 +233,7 @@ if ($acconfig_h)
|
||||
my $dump = 0;
|
||||
while ($_ = $in->getline)
|
||||
{
|
||||
print $out if $dump;
|
||||
print $out $_ if $dump;
|
||||
$dump = 1 if /\@BOTTOM\@/;
|
||||
}
|
||||
}
|
||||
@ -259,7 +244,7 @@ if ($config_h_bot)
|
||||
my $in = new IO::File ($config_h_bot);
|
||||
while ($_ = $in->getline)
|
||||
{
|
||||
print $out;
|
||||
print $out $_;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -230,7 +230,6 @@ sub load
|
||||
package Autom4te;
|
||||
|
||||
use Autom4te::General;
|
||||
use Getopt::Long;
|
||||
use File::Basename;
|
||||
use IO::File;
|
||||
use strict;
|
||||
@ -352,21 +351,9 @@ my %m4_builtin_alternate_name;
|
||||
@m4_builtin_alternate_name{"m4wrap", "m4_wrap"} = ("m4_wrap", "m4wrap");
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## ---------- ##
|
||||
## Routines. ##
|
||||
## ---------- ##
|
||||
|
||||
|
||||
# print_usage ()
|
||||
# --------------
|
||||
# Display usage (--help).
|
||||
sub print_usage ()
|
||||
{
|
||||
# Quotes are backslahed to help Emacs' font-lock-mode.
|
||||
print <<EOF;
|
||||
# $HELP
|
||||
# -----
|
||||
$help = << "EOF";
|
||||
Usage: $0 [OPTION] ... [FILES]
|
||||
|
||||
Run GNU M4 on the FILES, avoiding useless runs. If tracing, the output
|
||||
@ -415,16 +402,10 @@ Tracing:
|
||||
|
||||
Report bugs to <bug-autoconf\@gnu.org>.
|
||||
EOF
|
||||
exit 0;
|
||||
}
|
||||
|
||||
|
||||
# print_version ()
|
||||
# ----------------
|
||||
# Display version (--version).
|
||||
sub print_version
|
||||
{
|
||||
print <<EOF;
|
||||
# $VERSION
|
||||
# --------
|
||||
$version = <<"EOF";
|
||||
autom4te (@PACKAGE_NAME@) @VERSION@
|
||||
Written by Akim Demaille.
|
||||
|
||||
@ -433,8 +414,10 @@ This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
EOF
|
||||
|
||||
exit 0;
|
||||
}
|
||||
|
||||
## ---------- ##
|
||||
## Routines. ##
|
||||
## ---------- ##
|
||||
|
||||
|
||||
# load_configuration ()
|
||||
@ -486,16 +469,8 @@ sub parse_args ()
|
||||
|
||||
# We want to look for the early options, which should not be found
|
||||
# in the configuration file. Prepend to the user arguments.
|
||||
Getopt::Long::Configure ("bundling", "pass_through");
|
||||
GetOptions (
|
||||
"h|help" => \&print_usage,
|
||||
"V|version" => \&print_version,
|
||||
|
||||
"s|language=s" => \$language,
|
||||
"v|verbose" => \$verbose,
|
||||
"d|debug" => \$debug,
|
||||
)
|
||||
or exit 1;
|
||||
Getopt::Long::Configure ("pass_through");
|
||||
getopt ("s|language=s" => \$language);
|
||||
Getopt::Long::Configure ("defaults");
|
||||
unshift @ARGV, @{$language{$language}}
|
||||
if $language;
|
||||
@ -504,8 +479,7 @@ sub parse_args ()
|
||||
if $debug;
|
||||
|
||||
# Process the arguments for real this time.
|
||||
Getopt::Long::Configure ("bundling");
|
||||
GetOptions
|
||||
getopt
|
||||
(
|
||||
# Operation modes:
|
||||
"o|output=s" => \$output,
|
||||
@ -525,8 +499,7 @@ sub parse_args ()
|
||||
# by hand.
|
||||
"t|trace=s" => \@trace,
|
||||
"p|preselect=s" => \@preselect,
|
||||
)
|
||||
or exit 1;
|
||||
);
|
||||
|
||||
die "$me: too few arguments
|
||||
Try `$me --help' for more information.\n"
|
||||
|
@ -27,7 +27,6 @@ BEGIN
|
||||
unshift @INC, "$perllibdir";
|
||||
}
|
||||
|
||||
use Getopt::Long;
|
||||
use File::Basename;
|
||||
use Autom4te::General;
|
||||
use strict;
|
||||
@ -40,17 +39,9 @@ my $localdir = '.';
|
||||
my $m4 = $ENV{"M4"} || "@M4@";
|
||||
|
||||
|
||||
## ---------- ##
|
||||
## Routines. ##
|
||||
## ---------- ##
|
||||
|
||||
|
||||
# print_usage ()
|
||||
# --------------
|
||||
# Display usage (--help).
|
||||
sub print_usage ()
|
||||
{
|
||||
print <<"END";
|
||||
# $HELP
|
||||
# -----
|
||||
$help = <<"END";
|
||||
Usage: $0 [OPTION] ... [TEMPLATE-FILE...]
|
||||
|
||||
Update the TEMPLATE-FILE... if given, or \`configure.ac\' if present,
|
||||
@ -73,16 +64,10 @@ Environment variables:
|
||||
|
||||
Report bugs to <bug-autoconf\@gnu.org>.
|
||||
END
|
||||
exit 0;
|
||||
}
|
||||
|
||||
|
||||
# print_version ()
|
||||
# ----------------
|
||||
# Display version (--version).
|
||||
sub print_version
|
||||
{
|
||||
print <<END;
|
||||
# $VERSION
|
||||
# --------
|
||||
$version = <<"END";
|
||||
autoupdate (@PACKAGE_NAME@) @VERSION@
|
||||
Written by David J. MacKenzie and Akim Demaille.
|
||||
|
||||
@ -90,8 +75,11 @@ 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
|
||||
exit 0;
|
||||
}
|
||||
|
||||
|
||||
## ---------- ##
|
||||
## Routines. ##
|
||||
## ---------- ##
|
||||
|
||||
|
||||
# parse_args ()
|
||||
@ -104,14 +92,8 @@ sub parse_args ()
|
||||
# If fixed some day, use this: '' => sub { push @ARGV, "-" }
|
||||
my $update_stdin = grep /^-$/, @ARGV;
|
||||
@ARGV = grep !/^-$/, @ARGV;
|
||||
Getopt::Long::config ("bundling");
|
||||
Getopt::Long::GetOptions ('A|autoconf-dir|m|macrodir=s' => \$autoconf_dir,
|
||||
'l|localdir=s' => \$localdir,
|
||||
'd|debug' => \$debug,
|
||||
'h|help' => \&print_usage,
|
||||
'V|version' => \&print_version,
|
||||
'v|verbose' => \$verbose)
|
||||
or exit 1;
|
||||
getopt ('A|autoconf-dir|m|macrodir=s' => \$autoconf_dir,
|
||||
'l|localdir=s' => \$localdir);
|
||||
|
||||
push @ARGV, '-'
|
||||
if $update_stdin;
|
||||
|
@ -20,7 +20,6 @@ package Autom4te::General;
|
||||
|
||||
use 5.005;
|
||||
use Exporter;
|
||||
use Getopt::Long;
|
||||
use File::Basename;
|
||||
use File::stat;
|
||||
use IO::File;
|
||||
@ -30,26 +29,32 @@ use strict;
|
||||
use vars qw (@ISA @EXPORT);
|
||||
|
||||
@ISA = qw (Exporter);
|
||||
@EXPORT = qw (&find_configure_ac &find_file &mktmpdir &mtime
|
||||
@EXPORT = qw (&find_configure_ac &find_file &getopt &mktmpdir &mtime
|
||||
&uniq &update_file &verbose &xsystem
|
||||
$me $verbose $debug $tmp);
|
||||
$debug $help $me $tmp $verbose $version);
|
||||
|
||||
# Variable we share with the main package. Be sure to have a single
|
||||
# copy of them: using `my' together with multiple inclusion of this
|
||||
# package would introduce several copies.
|
||||
use vars qw ($me);
|
||||
$me = basename ($0);
|
||||
|
||||
use vars qw ($verbose);
|
||||
$verbose = 0;
|
||||
|
||||
use vars qw ($debug);
|
||||
$debug = 0;
|
||||
|
||||
use vars qw ($help);
|
||||
$help = undef;
|
||||
|
||||
use vars qw ($me);
|
||||
$me = basename ($0);
|
||||
|
||||
# Our tmp dir.
|
||||
use vars qw ($tmp);
|
||||
$tmp = undef;
|
||||
|
||||
use vars qw ($verbose);
|
||||
$verbose = 0;
|
||||
|
||||
use vars qw ($version);
|
||||
$version = undef;
|
||||
|
||||
|
||||
# END
|
||||
# ---
|
||||
@ -148,6 +153,26 @@ sub find_file ($@)
|
||||
}
|
||||
|
||||
|
||||
# getopt (%OPTIONS)
|
||||
# -----------------
|
||||
sub getopt (%)
|
||||
{
|
||||
my (%option) = @_;
|
||||
use Getopt::Long;
|
||||
|
||||
%option = (%option,
|
||||
"h|help" => sub { print $help; exit 0 },
|
||||
"V|version" => sub { print $version; exit 0 },
|
||||
|
||||
"v|verbose" => \$verbose,
|
||||
"d|debug" => \$debug,
|
||||
);
|
||||
Getopt::Long::Configure ("bundling");
|
||||
GetOptions (%option)
|
||||
or exit 1;
|
||||
}
|
||||
|
||||
|
||||
# mktmpdir ($SIGNATURE)
|
||||
# ---------------------
|
||||
# Create a temporary directory which name is based on $SIGNATURE.
|
||||
|
@ -97,10 +97,14 @@ AT_SETUP([Syntax of the Perl scripts])
|
||||
# | % perl -c ./autom4te
|
||||
# | ./autom4te syntax OK
|
||||
# Ignore it, it might change between releases.
|
||||
AT_CHECK([$PERL -c ../bin/autom4te], 0, [], [ignore])
|
||||
AT_CHECK([$PERL -c ../bin/autoheader], 0, [], [ignore])
|
||||
AT_CHECK([$PERL -c ../bin/autoscan], 0, [], [ignore])
|
||||
AT_CHECK([$PERL -c ../bin/autoupdate], 0, [], [ignore])
|
||||
AT_CHECK([autom4te_perllibdir=$top_srcdir/lib $PERL -c ../bin/autom4te],
|
||||
0, [], [ignore])
|
||||
AT_CHECK([autom4te_perllibdir=$top_srcdir/lib $PERL -c ../bin/autoheader],
|
||||
0, [], [ignore])
|
||||
AT_CHECK([autom4te_perllibdir=$top_srcdir/lib $PERL -c ../bin/autoscan],
|
||||
0, [], [ignore])
|
||||
AT_CHECK([autom4te_perllibdir=$top_srcdir/lib $PERL -c ../bin/autoupdate],
|
||||
0, [], [ignore])
|
||||
|
||||
AT_CLEANUP
|
||||
|
||||
@ -386,27 +390,28 @@ AT_DATA([acconfig.h],
|
||||
# 1. Check that `acconfig.h' is still honored.
|
||||
AT_DATA([configure.ac],
|
||||
[[AC_INIT
|
||||
AC_CONFIG_HEADERS(config.h)
|
||||
AC_CONFIG_HEADERS(config.h:config.hin)
|
||||
AC_DEFINE(this, "whatever you want.")
|
||||
]])
|
||||
|
||||
AT_CHECK([autoheader -<configure.ac], 0,
|
||||
[[/* config.h.in. Generated automatically from Standard input by autoheader. */
|
||||
AT_CHECK_AUTOHEADER([], [], [], [ignore])
|
||||
AT_CHECK([cat config.hin], 0,
|
||||
[[/* config.hin. Generated from configure.ac by autoheader. */
|
||||
/* Define this to whatever you want. */
|
||||
#undef this
|
||||
]], ignore)
|
||||
]])
|
||||
|
||||
|
||||
# 2. Check that missing templates are a fatal error.
|
||||
AT_DATA([configure.ac],
|
||||
[[AC_INIT
|
||||
AC_CONFIG_HEADERS(config.h)
|
||||
AC_CONFIG_HEADERS(config.h:config.hin)
|
||||
AC_DEFINE(that, "whatever you want.")
|
||||
]])
|
||||
|
||||
AT_CHECK([autoheader -<configure.ac], 1, [],
|
||||
[autoheader: No template for symbol `that'
|
||||
])
|
||||
# The test suite goes too fast for the cache time stamps...
|
||||
# Pass --force.
|
||||
AT_CHECK_AUTOHEADER([--force], [1], [], [ignore])
|
||||
|
||||
|
||||
# 3. Check TOP and BOTTOM.
|
||||
@ -420,7 +425,7 @@ AT_DATA([acconfig.h],
|
||||
|
||||
AT_DATA([configure.ac],
|
||||
[[AC_INIT
|
||||
AC_CONFIG_HEADERS(config.h)
|
||||
AC_CONFIG_HEADERS(config.h:config.hin)
|
||||
AH_TOP([Top1 from configure.ac.])
|
||||
AH_TOP([Top2 from configure.ac.])
|
||||
AH_VERBATIM([Middle], [Middle from configure.ac.])
|
||||
@ -434,10 +439,10 @@ AH_BOTTOM([Bottom2 from configure.ac.])
|
||||
# together.
|
||||
# Ignore STDERR which is the longuish complaint against autoheader junk
|
||||
# files.
|
||||
AT_CHECK([autoheader -<configure.ac], 0,
|
||||
[[/* config.h.in. Generated automatically from Standard input by autoheader. */
|
||||
AT_CHECK_AUTOHEADER([--force], [], [], [ignore])
|
||||
AT_CHECK([cat config.hin], 0,
|
||||
[[/* config.hin. Generated from configure.ac by autoheader. */
|
||||
/* Top from acconfig.h. */
|
||||
|
||||
/* Middle from acconfig.h. */
|
||||
|
||||
Top1 from configure.ac.
|
||||
@ -450,8 +455,7 @@ Bottom1 from configure.ac.
|
||||
|
||||
Bottom2 from configure.ac.
|
||||
/* Bottom from acconfig.h. */
|
||||
]], [ignore])
|
||||
|
||||
]])
|
||||
|
||||
AT_CLEANUP
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user