* configure.ac: Don't look for AWK.
* tests/tools.at (AWK portability): Remove.
(Syntax of the shell scripts): Don't check ifnames.
(AT_CHECK_PERL_SYNTAX): New.
(Syntax of the Perl scripts): Check ifnames.
* tests/ifnames: New.
+2001-09-13 Akim Demaille <akim@epita.fr>
+
+ * bin/ifnames.in: Rewrite in Perl.
+ * configure.ac: Don't look for AWK.
+ * tests/tools.at (AWK portability): Remove.
+ (Syntax of the shell scripts): Don't check ifnames.
+ (AT_CHECK_PERL_SYNTAX): New.
+ (Syntax of the Perl scripts): Check ifnames.
+ * tests/ifnames: New.
+
2001-09-13 Akim Demaille <akim@epita.fr>
* lib/autotest/general.m4 (AT_INIT): Let --keywords also match
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
-AWK = @AWK@
EXPR = @EXPR@
HELP2MAN = @HELP2MAN@
M4 = @M4@
** AC_CHECK_TOOL...
Write a test that checks that it honors the values set by the user.
-** ifnames
-Rewrite in Perl. Drop the AWK dependency. Remove the AWK portability
-tests. Add ifnames to the Perl sanity checks.
-
** autom4te and warnings.
Decide what must be done.
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
-AWK = @AWK@
EXPR = @EXPR@
HELP2MAN = @HELP2MAN@
M4 = @M4@
BEGIN
{
- my $datadir = ($ENV{'autom4te_perllibdir'}
- || $ENV{'AC_MACRODIR'}
- || '@datadir@');
+ my $datadir = ($ENV{'autom4te_perllibdir'} || '@datadir@');
unshift @INC, "$datadir";
}
-#! @SHELL@
-# -*- shell-script -*-
+#! @PERL@ -w
+# -*- perl -*-
+# @configure_input@
+
+eval 'exec @PERL@ -S $0 ${1+"$@"}'
+ if 0;
+
# ifnames - print the identifiers used in C preprocessor conditionals
-# Copyright 1994, 1995, 1999, 2000 Free Software Foundation, Inc.
+# Copyright 1994, 1995, 1999, 2000, 2001 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# Written by David MacKenzie <djm@gnu.ai.mit.edu>
# and Paul Eggert <eggert@twinsun.com>.
-me=`echo "$0" | sed -e 's,.*/,,'`
+BEGIN
+{
+ my $datadir = ($ENV{'autom4te_perllibdir'} || '@datadir@');
+ unshift @INC, "$datadir";
+}
-usage="\
-Usage: $0 [OPTION] ... [FILE] ...
+use Autom4te::General;
+use Autom4te::XFile;
+
+# $HELP
+# -----
+$help = "Usage: $0 [OPTION] ... [FILE] ...
Scan all of the C source FILES (or the standard input, if none are
given) and write to the standard output a sorted list of all the
-identifiers that appear in those files in \`#if', \`#elif', \`#ifdef', or
-\`#ifndef' directives. Print each identifier on a line, followed by a
+identifiers that appear in those files in `#if', `#elif', `#ifdef', or
+`#ifndef' directives. Print each identifier on a line, followed by a
space-separated list of the files in which that identifier occurs.
-h, --help print this help, then exit
-V, --version print version number, then exit
-Report bugs to <bug-autoconf@gnu.org>."
+Report bugs to <bug-autoconf\@gnu.org>.";
+
-version="\
+# $VERSION
+# --------
+$version = "\
ifnames (@PACKAGE_NAME@) @VERSION@
Written by David J. MacKenzie and Paul Eggert.
-Copyright 1994, 1995, 1999, 2000 Free Software Foundation, Inc.
+Copyright 1994, 1995, 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."
-
-help="\
-Try \`$me --help' for more information."
-
-while test $# -gt 0; do
- case "$1" in
- --help | -h )
- echo "$usage"; exit 0 ;;
- --version | -V )
- echo "$version"; exit 0 ;;
- --) # Stop option processing.
- shift; break ;;
- -*)
- exec >&2
- echo "$me: invalid option $1"
- echo "$help"
- exit 1 ;;
- *) break ;;
- esac
-done
-
-# Variables.
-: ${AWK=@AWK@}
-
-$AWK '
- # Record that sym was found in FILENAME.
- function file_sym(sym, i, fs)
- {
- if (sym ~ /^[A-Za-z_]/)
- {
- if (!found[sym,FILENAME])
- {
- found[sym,FILENAME] = 1
-
- # Insert FILENAME into files[sym], keeping the list sorted.
- i = 1
- fs = files[sym]
- while (match(substr(fs, i), /^ [^ ]*/) \
- && substr(fs, i + 1, RLENGTH - 1) < FILENAME)
- {
- i += RLENGTH
- }
- files[sym] = substr(fs, 1, i - 1) " " FILENAME substr(fs, i)
- }
- }
- }
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.";
- {
- while (sub(/\\$/, "", $0) > 0)
- {
- if ((getline tmp) > 0)
- $0 = $0 tmp
- else
- break
- }
- }
- /^[\t ]*#/ {
- if (sub(/^[\t ]*#[\t ]*ifn?def[\t ]+/, "", $0))
- {
- sub(/[^A-Za-z_0-9].*/, "", $0)
- file_sym($0)
- }
- if (sub(/^[\t ]*#[\t ]*(el)?if[\t ]+/, "", $0))
+# &parse_args ()
+# --------------
+# Process any command line arguments.
+sub parse_args ()
+{
+ getopt ();
+}
+
+
+# %OCCURRENCE
+# -----------
+my %occurrence;
+
+
+# &scan_file ($FILENAME)
+# ----------------------
+sub scan_file ($)
+{
+ my ($filename) = @_;
+ my $file = new Autom4te::XFile ($filename);
+ while ($_ = $file->getline)
{
- # Remove comments. Not perfect, but close enough.
- gsub(/\/\*[^\/]*(\*\/)?/, "", $0)
-
- for (i = split($0, field, /[^A-Za-z_0-9]+/); 1 <= i; i--)
- {
- if (field[i] != "defined")
- {
- file_sym(field[i])
+ # Continuation lines.
+ $_ .= $file->getline
+ while (s/\\$//);
+
+ # Preprocessor directives.
+ if (s/^\s*\#\s*(if|ifdef|ifndef|elif)\s+//)
+ {
+ # Remove comments. Not perfect, but close enough.
+ s(/\*.*?\*/)();
+ s(/\*.*)();
+ foreach my $word (split (/\W+/))
+ {
+ next
+ if $word eq 'defined' || $word !~ /^[a-zA-Z_]/;
+ $occurrence{$word}{$filename} = 1;
+ }
}
- }
}
- }
+}
- END {
- for (sym in files)
- {
- print sym files[sym]
- }
+
+## ------ ##
+## Main. ##
+## ------ ##
+
+parse_args();
+foreach (@ARGV)
+ {
+ scan_file ($_);
+ }
+foreach (sort keys %occurrence)
+ {
+ print "$_ ", join (' ', sort keys %{$occurrence{$_}}), "\n";
}
-' ${1+"$@"} | sort
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
-AWK = @AWK@
EXPR = @EXPR@
HELP2MAN = @HELP2MAN@
M4 = @M4@
# This is needed because Automake does not seem to realize there is
# a AC-SUBST inside AC-PROG-GNU-M4. Grmph!
-# `ifnames' uses AWK.
-for ac_prog in mawk gawk nawk awk
-do
- # Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-echo "$as_me:1372: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_AWK+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$AWK"; then
- ac_cv_prog_AWK="$AWK" # Let the user override the test.
-else
- ac_save_IFS=$IFS; IFS=$ac_path_separator
-ac_dummy="$PATH"
-for ac_dir in $ac_dummy; do
- IFS=$ac_save_IFS
- test -z "$ac_dir" && ac_dir=.
- $as_executable_p "$ac_dir/$ac_word" || continue
-ac_cv_prog_AWK="$ac_prog"
-echo "$as_me:1387: found $ac_dir/$ac_word" >&5
-break
-done
-
-fi
-fi
-AWK=$ac_cv_prog_AWK
-if test -n "$AWK"; then
- echo "$as_me:1395: result: $AWK" >&5
-echo "${ECHO_T}$AWK" >&6
-else
- echo "$as_me:1398: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
- test -n "$AWK" && break
-done
-
# Generating man pages.
HELP2MAN=${HELP2MAN-"${am_missing_run}help2man"}
# We use a path for perl so the #! line in autoscan will work.
# Extract the first word of "perl", so it can be a program name with args.
set dummy perl; ac_word=$2
-echo "$as_me:1412: checking for $ac_word" >&5
+echo "$as_me:1374: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_path_PERL+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
test -z "$ac_dir" && ac_dir=.
if $as_executable_p "$ac_dir/$ac_word"; then
ac_cv_path_PERL="$ac_dir/$ac_word"
- echo "$as_me:1429: found $ac_dir/$ac_word" >&5
+ echo "$as_me:1391: found $ac_dir/$ac_word" >&5
break
fi
done
PERL=$ac_cv_path_PERL
if test -n "$PERL"; then
- echo "$as_me:1441: result: $PERL" >&5
+ echo "$as_me:1403: result: $PERL" >&5
echo "${ECHO_T}$PERL" >&6
else
- echo "$as_me:1444: result: no" >&5
+ echo "$as_me:1406: result: no" >&5
echo "${ECHO_T}no" >&6
fi
if test "$PERL" = no; then
- { { echo "$as_me:1449: error: perl is not found" >&5
+ { { echo "$as_me:1411: error: perl is not found" >&5
echo "$as_me: error: perl is not found" >&2;}
{ (exit 1); exit 1; }; }
fi
$PERL -e 'require 5.005;' || {
- { { echo "$as_me:1454: error: Perl 5.005 or better is required" >&5
+ { { echo "$as_me:1416: error: Perl 5.005 or better is required" >&5
echo "$as_me: error: Perl 5.005 or better is required" >&2;}
{ (exit 1); exit 1; }; }
}
: ${CONFIG_STATUS=./config.status}
ac_clean_files_save=$ac_clean_files
ac_clean_files="$ac_clean_files $CONFIG_STATUS"
-{ echo "$as_me:1573: creating $CONFIG_STATUS" >&5
+{ echo "$as_me:1535: creating $CONFIG_STATUS" >&5
echo "$as_me: creating $CONFIG_STATUS" >&6;}
cat >$CONFIG_STATUS <<_ACEOF
#! $SHELL
echo "$ac_cs_version"; exit 0 ;;
--he | --h)
# Conflict between --help and --header
- { { echo "$as_me:1771: error: ambiguous option: $1
+ { { echo "$as_me:1733: error: ambiguous option: $1
Try \`$0 --help' for more information." >&5
echo "$as_me: error: ambiguous option: $1
Try \`$0 --help' for more information." >&2;}
ac_need_defaults=false;;
# This is an error.
- -*) { { echo "$as_me:1790: error: unrecognized option: $1
+ -*) { { echo "$as_me:1752: error: unrecognized option: $1
Try \`$0 --help' for more information." >&5
echo "$as_me: error: unrecognized option: $1
Try \`$0 --help' for more information." >&2;}
"bin/Makefile" ) CONFIG_FILES="$CONFIG_FILES bin/Makefile" ;;
"tests/Makefile" ) CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;;
"tests/atconfig" ) CONFIG_COMMANDS="$CONFIG_COMMANDS tests/atconfig" ;;
- *) { { echo "$as_me:1842: error: invalid argument: $ac_config_target" >&5
+ *) { { echo "$as_me:1804: error: invalid argument: $ac_config_target" >&5
echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
{ (exit 1); exit 1; }; };;
esac
as_incr_dir=$as_incr_dir/$as_mkdir_dir
test -d "$as_incr_dir" ||
mkdir "$as_incr_dir" ||
- { { echo "$as_me:2030: error: cannot create \"$ac_dir\"" >&5
+ { { echo "$as_me:1992: error: cannot create \"$ac_dir\"" >&5
echo "$as_me: error: cannot create \"$ac_dir\"" >&2;}
{ (exit 1); exit 1; }; }
;;
esac
if test x"$ac_file" != x-; then
- { echo "$as_me:2067: creating $ac_file" >&5
+ { echo "$as_me:2029: creating $ac_file" >&5
echo "$as_me: creating $ac_file" >&6;}
rm -f "$ac_file"
fi
-) echo $tmp/stdin ;;
[\\/$]*)
# Absolute (can't be DOS-style, as IFS=:)
- test -f "$f" || { { echo "$as_me:2085: error: cannot find input file: $f" >&5
+ test -f "$f" || { { echo "$as_me:2047: error: cannot find input file: $f" >&5
echo "$as_me: error: cannot find input file: $f" >&2;}
{ (exit 1); exit 1; }; }
echo $f;;
echo $srcdir/$f
else
# /dev/null tree
- { { echo "$as_me:2098: error: cannot find input file: $f" >&5
+ { { echo "$as_me:2060: error: cannot find input file: $f" >&5
echo "$as_me: error: cannot find input file: $f" >&2;}
{ (exit 1); exit 1; }; }
fi;;
ac_top_srcdir=$ac_top_builddir$srcdir ;;
esac
- { echo "$as_me:2170: executing $ac_dest commands" >&5
+ { echo "$as_me:2132: executing $ac_dest commands" >&5
echo "$as_me: executing $ac_dest commands" >&6;}
case $ac_dest in
tests/atconfig ) # Do not use _ACEOF as we are being dumped into config.status via
# a AC-SUBST inside AC-PROG-GNU-M4. Grmph!
AC_SUBST(M4)
-# `ifnames' uses AWK.
-AC_PROG_AWK
-
# Generating man pages.
AM_MISSING_PROG(HELP2MAN, help2man)
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
-AWK = @AWK@
EXPR = @EXPR@
HELP2MAN = @HELP2MAN@
M4 = @M4@
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
-AWK = @AWK@
EXPR = @EXPR@
HELP2MAN = @HELP2MAN@
M4 = @M4@
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
-AWK = @AWK@
EXPR = @EXPR@
HELP2MAN = @HELP2MAN@
M4 = @M4@
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
-AWK = @AWK@
EXPR = @EXPR@
HELP2MAN = @HELP2MAN@
M4 = @M4@
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
-AWK = @AWK@
EXPR = @EXPR@
HELP2MAN = @HELP2MAN@
M4 = @M4@
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
-AWK = @AWK@
EXPR = @EXPR@
HELP2MAN = @HELP2MAN@
M4 = @M4@
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
-AWK = @AWK@
EXPR = @EXPR@
HELP2MAN = @HELP2MAN@
M4 = @M4@
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
-AWK = @AWK@
EXPR = @EXPR@
HELP2MAN = @HELP2MAN@
M4 = @M4@
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
-AWK = @AWK@
EXPR = @EXPR@
HELP2MAN = @HELP2MAN@
M4 = @M4@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.24.
-.TH AUTOCONF "1" "August 2001" "GNU Autoconf 2.52e" FSF
+.TH AUTOCONF "1" "September 2001" "GNU Autoconf 2.52e" FSF
.SH NAME
autoconf \- Generate configuration scripts
.SH SYNOPSIS
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.24.
-.TH AUTORECONF "1" "August 2001" "GNU Autoconf 2.52e" FSF
+.TH AUTORECONF "1" "September 2001" "GNU Autoconf 2.52e" FSF
.SH NAME
autoreconf \- Update generated configuration files
.SH SYNOPSIS
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.24.
-.TH IFNAMES "1" "August 2001" "GNU Autoconf 2.52e" FSF
+.TH IFNAMES "1" "September 2001" "ifnames " FSF
.SH NAME
ifnames \- Extract CPP conditionals from a set of files
.SH SYNOPSIS
.SH AUTHOR
Written by David J. MacKenzie and Paul Eggert.
.PP
-Copyright 1994, 1995, 1999, 2000 Free Software Foundation, Inc.
+Copyright 1994, 1995, 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.
.SH "REPORTING BUGS"
Report bugs to <bug-autoconf@gnu.org>.
+.PP
+ifnames (GNU Autoconf) 2.52e
.SH "SEE ALSO"
.BR autoconf (1),
.BR automake (1),
atlocal.in
# Running the uninstalled scripts.
-WRAPPERS = autoconf autoheader autoreconf autom4te autoupdate
+WRAPPERS = autoconf autoheader autoreconf autom4te autoupdate ifnames
DISTCLEANFILES = atconfig atlocal $(TESTSUITE)
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
-AWK = @AWK@
EXPR = @EXPR@
HELP2MAN = @HELP2MAN@
M4 = @M4@
# Running the uninstalled scripts.
-WRAPPERS = autoconf autoheader autoreconf autom4te autoupdate
+WRAPPERS = autoconf autoheader autoreconf autom4te autoupdate ifnames
DISTCLEANFILES = atconfig atlocal $(TESTSUITE)
mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
CONFIG_CLEAN_FILES =
DIST_SOURCES =
-DIST_COMMON = README Makefile.am Makefile.in
+DIST_COMMON = README Makefile.am Makefile.in configure.ac
all: all-am
.SUFFIXES:
--- /dev/null
+#! /bin/sh
+# Running `ifnames' as if it were installed.
+
+. ./atconfig
+
+# Be sure to use the non installed Perl modules.
+# We need no special protection for the subtools (e.g., autoheader runs
+# autoconf which runs autom4te) because by themselves, they try to use
+# subtools from the same directory (i.e., foo/autoheader will run
+# foo/autoconf etc.).
+autom4te_perllibdir=$top_srcdir/lib
+export autom4te_perllibdir
+
+exec ../bin/ifnames ${1+"$@"}
AT_CHECK([/bin/sh -n ../bin/autoconf], 0)
AT_CHECK([/bin/sh -n ../bin/autoreconf], 0)
-AT_CHECK([/bin/sh -n ../bin/ifnames], 0)
# These are not built, they are in the src tree.
AT_CHECK([/bin/sh -n $at_top_srcdir/config/install-sh], 0)
# | % perl -c ./autom4te
# | ./autom4te syntax OK
# Ignore it, it might change between releases.
-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])
+m4_define([AT_CHECK_PERL_SYNTAX],
+[AT_CHECK([autom4te_perllibdir=$top_srcdir/lib $PERL -c ../bin/$1],
+ 0, [], [ignore])])
-AT_CLEANUP
-
-
-
-## ----------------- ##
-## AWK portability. ##
-## ----------------- ##
-
-AT_SETUP([AWK portability])
-
-# Skip if we don't have GNU Awk.
-AT_CHECK([gawk --version || exit 77], 0, ignore, ignore)
-
-# Syntax correctness of ifnames.
-AT_CHECK([AWK='gawk --posix' ifnames /dev/null])
+AT_CHECK_PERL_SYNTAX([autoheader])
+AT_CHECK_PERL_SYNTAX([autom4te])
+AT_CHECK_PERL_SYNTAX([autoscan])
+AT_CHECK_PERL_SYNTAX([autoupdate])
+AT_CHECK_PERL_SYNTAX([ifnames])
AT_CLEANUP
-
## ------------------ ##
## autoconf --trace. ##
## ------------------ ##