[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
81-fyi-autoscan-general-pm.patch
From: |
Akim Demaille |
Subject: |
81-fyi-autoscan-general-pm.patch |
Date: |
Wed, 05 Sep 2001 09:03:05 +0200 |
Index: ChangeLog
from Akim Demaille <address@hidden>
* 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.
Index: bin/autoheader.in
--- bin/autoheader.in Fri, 31 Aug 2001 12:00:17 +0200 akim
+++ bin/autoheader.in Tue, 04 Sep 2001 08:58:46 +0200 akim
@@ -104,16 +104,10 @@ Usage: $0 [OPTION] ... [TEMPLATE-FILE]
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' => address@hidden,
'f|force' => \$force,
'W|warning' => address@hidden);
-
- push @ARGV, '-'
- if $stdin;
if (! @ARGV)
{
Index: bin/autom4te.in
--- bin/autom4te.in Fri, 31 Aug 2001 14:07:29 +0200 akim
+++ bin/autom4te.in Tue, 04 Sep 2001 08:59:20 +0200 akim
@@ -42,7 +42,6 @@
use Autom4te::General;
use Autom4te::Struct;
use Carp;
-use Getopt::Long;
use IO::File;
use strict;
Index: bin/autoscan.in
--- bin/autoscan.in Thu, 30 Aug 2001 20:46:39 +0200 akim
+++ bin/autoscan.in Tue, 04 Sep 2001 09:14:45 +0200 akim
@@ -22,14 +22,12 @@
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;
@@ -71,21 +69,13 @@
or die "$me: cannot open $me.log: $!\n";
# Autoconf and lib files.
-my $autoconf = $ENV{'AUTOCONF'} || '@autoconf_name@';
-my $datadir = $ENV{"AC_MACRODIR"} || "@datadir@";
-
-
-## ------------------------ ##
-## Command line interface. ##
-## ------------------------ ##
-
-
-# print_usage ()
-# --------------
-# Display usage (--help).
-sub print_usage ()
-{
- print "Usage: $0 [OPTION] ... [SRCDIR]
+my $autom4te = $ENV{'AUTOM4TE'} || '@autom4te-name@';
+my $autoconf = "$autom4te --language=autoconf";
+my @include = ('@datadir@');
+
+# $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
@@ -93,55 +83,44 @@ sub print_usage ()
`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 <address@hidden>.\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" => address@hidden);
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";
}
@@ -170,7 +149,7 @@ sub init_tables ()
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)
@@ -189,7 +168,7 @@ sub init_tables ()
# 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;
}
@@ -213,8 +192,8 @@ sub init_tables ()
## ----------------------- ##
-# scan_c_file(FILENAME)
-# ---------------------
+# scan_c_file($FILENAME)
+# ----------------------
sub scan_c_file ($)
{
my ($filename) = @_;
@@ -277,8 +256,8 @@ sub scan_c_file ($)
}
-# scan_makefile(MAKEFILE-NAME)
-# ----------------------------
+# scan_makefile($MAKEFILE-NAME)
+# -----------------------------
sub scan_makefile ($)
{
my ($filename) = @_;
@@ -317,8 +296,8 @@ sub scan_makefile ($)
}
-# scan_sh_file(SHELL-SCRIPT-NAME)
-# -------------------------------
+# scan_sh_file($SHELL-SCRIPT-NAME)
+# --------------------------------
sub scan_sh_file ($)
{
my ($filename) = @_;
@@ -477,8 +456,8 @@ sub output_libraries ($)
}
-# output (CONFIGURE_SCAN)
-# -----------------------
+# output ($CONFIGURE_SCAN)
+# ------------------------
# Print a proto configure.ac.
sub output ($)
{
@@ -524,8 +503,8 @@ 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 ($)
@@ -539,9 +518,9 @@ 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)
@@ -592,6 +571,10 @@ sub check_configure_ac ($)
## -------------- ##
parse_args;
+$autoconf .= " --debug" if $debug;
+$autoconf .= " --verbose" if $verbose;
+$autoconf .= join (' --include=', '', @include);
+
my $configure_ac = find_configure_ac;
init_tables;
scan_files;
Index: bin/autoupdate.in
--- bin/autoupdate.in Tue, 04 Sep 2001 08:37:36 +0200 akim
+++ bin/autoupdate.in Tue, 04 Sep 2001 09:20:48 +0200 akim
@@ -33,6 +33,7 @@
# Lib files.
my $autom4te = $ENV{'AUTOM4TE'} || '@autom4te-name@';
+my $autoconf = "$autom4te --language=autoconf";
# We need to find m4sugar.
my @include = ('@datadir@');
my $force = 0;
@@ -42,35 +43,32 @@
# $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 <address@hidden>.
-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. ##
@@ -83,16 +81,10 @@ Usage: $0 [OPTION] ... [TEMPLATE-FILE..
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' => address@hidden,
'f|force' => \$force);
- push @ARGV, '-'
- if $update_stdin;
-
if (! @ARGV)
{
my $configure_ac = find_configure_ac;
@@ -109,8 +101,8 @@ sub parse_args ()
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.
@@ -243,11 +235,10 @@ sub handle_autoconf_macros ()
## -------------- ##
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;
Index: doc/autoconf.texi
--- doc/autoconf.texi Fri, 31 Aug 2001 14:24:41 +0200 akim
+++ doc/autoconf.texi Tue, 04 Sep 2001 09:22:21 +0200 akim
@@ -1061,15 +1061,10 @@ @node autoscan Invocation
Print the names of the files it examines and the potentially interesting
symbols it finds in them. This output can be voluminous.
address@hidden address@hidden
address@hidden -A @var{dir}
address@hidden 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.
address@hidden address@hidden
address@hidden -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
Index: lib/Autom4te/General.pm
--- lib/Autom4te/General.pm Fri, 31 Aug 2001 13:30:13 +0200 akim
+++ lib/Autom4te/General.pm Tue, 04 Sep 2001 08:58:48 +0200 akim
@@ -153,13 +153,19 @@ sub find_file ($@)
}
-# 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 },
@@ -170,6 +176,9 @@ sub getopt (%)
Getopt::Long::Configure ("bundling");
GetOptions (%option)
or exit 1;
+
+ push @ARGV, '-'
+ if $stdin;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- 81-fyi-autoscan-general-pm.patch,
Akim Demaille <=