* lib/m4sugar/m4sugar.m4 (m4_pattern_forbid): Accepts $2.

* lib/autoconf/general.m4 (AC_INTI): Forbid LIBOBJS.
(_AC_LIBOBJ): s/LIBOBJS/LIB@&t@OBJS/.
* bin/autom4te.in (warn_forbidden): New.
(handle_output): Use it.
Read m4_pattern_forbid with messages.
This commit is contained in:
Akim Demaille 2001-11-07 19:34:20 +00:00
parent eec4a3470d
commit 21b8d2f2dc
5 changed files with 129 additions and 10 deletions

View File

@ -1,3 +1,12 @@
2001-11-07 Akim Demaille <akim@epita.fr>
* lib/m4sugar/m4sugar.m4 (m4_pattern_forbid): Accepts $2.
* lib/autoconf/general.m4 (AC_INTI): Forbid LIBOBJS.
(_AC_LIBOBJ): s/LIBOBJS/LIB@&t@OBJS/.
* bin/autom4te.in (warn_forbidden): New.
(handle_output): Use it.
Read m4_pattern_forbid with messages.
2001-11-05 Akim Demaille <akim@epita.fr>
* bin/autom4te.in (--normalize): Remove.

View File

@ -587,6 +587,29 @@ sub handle_m4 ($@)
}
# warn_forbidden ($WHERE, $WORD, %FORBIDDEN)
# ------------------------------------------
# $WORD is forbidden. Warn with a dedicated error message if in
# %FORBIDDEN, otherwise, a simple `error: possibly undefined macro'
# will do.
sub warn_forbidden ($$%)
{
my ($where, $word, %forbidden) = @_;
my $message;
for my $re (sort keys %forbidden)
{
if ($word =~ $re)
{
$message = $forbidden{$re};
last;
}
}
$message ||= "possibly undefined macro: $word";
warn "$where: error: $message\n";
}
# handle_output ($REQ, $OUTPUT)
# -----------------------------
# Run m4 on the input files, perform quadrigraphs substitution, check for
@ -599,14 +622,18 @@ sub handle_output ($$)
# Load the forbidden/allowed patterns.
handle_traces ($req, "$tmp/patterns",
('m4_pattern_forbid' => 'forbid:$1',
('m4_pattern_forbid' => 'forbid:$1:$2',
'm4_pattern_allow' => 'allow:$1'));
my @patterns = new Autom4te::XFile ("$tmp/patterns")->getlines;
chomp @patterns;
my $forbidden = join ('|', map { /^forbid:(.*)/ } @patterns) || "^\$";
my $allowed = join ('|', map { /^allow:(.*)/ } @patterns) || "^\$";
my %forbidden =
map { /^forbid:([^:]+):.+$/ => /^forbid:[^:]+:(.+)$/ } @patterns;
my $forbidden = join ('|', map { /^forbid:([^:]+)/ } @patterns) || "^\$";
my $allowed = join ('|', map { /^allow:([^:]+)/ } @patterns) || "^\$";
verbose "forbidden tokens: $forbidden";
verbose "forbidden token : $_ => $forbidden{$_}"
foreach (sort keys %forbidden);
verbose "allowed tokens: $allowed";
# Read the (cached) raw M4 output, produce the actual result. We
@ -675,15 +702,16 @@ sub handle_output ($$)
# Complain once per word, but possibly several times per line.
while (/$prohibited/)
{
warn "$ARGV[$#ARGV]:$.: error: possibly undefined macro: $1\n";
delete $prohibited{$1};
my $word = $1;
warn_forbidden ("$ARGV[$#ARGV]:$.", $word, %forbidden);
delete $prohibited{$word};
# If we're done, exit.
return
if ! %prohibited;
$prohibited = '\b(' . join ('|', keys %prohibited) . ')\b';
}
}
warn "$output:$prohibited{$_}: error: possibly undefined macro: $_\n"
warn_forbidden ("$output:$prohibited{$_}", $_, %forbidden)
foreach (sort { $prohibited{$a} <=> $prohibited{$b} } keys %prohibited);
}

80
configure vendored
View File

@ -15,6 +15,7 @@ else
as_expr=false
fi
## --------------------- ##
## M4sh Initialization. ##
## --------------------- ##
@ -60,6 +61,7 @@ fi
{ $as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set; } ||
{ LC_MESSAGES=C; export LC_MESSAGES; }
# Name of the executable.
as_me=`(basename "$0") 2>/dev/null ||
$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
@ -93,6 +95,7 @@ if test "${PATH_SEPARATOR+set}" != set; then
rm -f conftest.sh
fi
as_lineno_1=$LINENO
as_lineno_2=$LINENO
as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
@ -177,6 +180,7 @@ done
exit
}
case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
*c*,-n*) ECHO_N= ECHO_C='
' ECHO_T=' ' ;;
@ -216,6 +220,7 @@ as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g"
# Sed expression to map a string onto a valid variable name.
as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g"
# IFS
# We need space, tab and new line, in precisely that order.
as_nl='
@ -225,6 +230,7 @@ IFS=" $as_nl"
# CDPATH.
$as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=$PATH_SEPARATOR; export CDPATH; }
# Name of the host.
# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
# so uname gets run too.
@ -644,6 +650,7 @@ test -n "$host_alias" && ac_tool_prefix=$host_alias-
test "$silent" = yes && exec 6>/dev/null
# Find the source files, if location was not specified.
if test -z "$srcdir"; then
ac_srcdir_defaulted=yes
@ -895,12 +902,14 @@ done
cat >&5 <<_ACEOF
## ----------- ##
## Core tests. ##
## ----------- ##
_ACEOF
# Keep a trace of the command line.
# Strip out --no-create and --no-recursion so they do not pile up.
# Also quote any args containing shell meta-characters.
@ -1073,6 +1082,33 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
ac_aux_dir=
for ac_dir in config $srcdir/config; do
if test -f $ac_dir/install-sh; then
@ -1100,6 +1136,7 @@ ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure.
ac_config_files="$ac_config_files config/Makefile"
# Find a good install program. We prefer a C program (faster),
# so one script is as good as another. But avoid the broken or
# incompatible versions:
@ -1154,6 +1191,7 @@ case $as_dir/ in
esac
done
fi
if test "${ac_cv_path_install+set}" = set; then
INSTALL=$ac_cv_path_install
@ -1234,6 +1272,7 @@ _ACEOF
program_transform_name=`echo $program_transform_name | sed -f conftest.sed`
rm conftest.sed
# expand $ac_aux_dir to an absolute path
am_aux_dir=`cd $ac_aux_dir && pwd`
@ -1327,6 +1366,7 @@ if test "x$enable_dependency_tracking" != xno; then
AMDEPBACKSLASH='\'
fi
if test "x$enable_dependency_tracking" != xno; then
AMDEP_TRUE=
AMDEP_FALSE='#'
@ -1335,6 +1375,9 @@ else
AMDEP_FALSE=
fi
rm -f .deps 2>/dev/null
mkdir .deps 2>/dev/null
if test -d .deps; then
@ -1345,6 +1388,7 @@ else
fi
rmdir .deps 2>/dev/null
# test to see if srcdir already configured
if test "`cd $srcdir && pwd`" != "`pwd`" &&
test -f $srcdir/config.status; then
@ -1361,10 +1405,12 @@ cat >>confdefs.h <<_ACEOF
#define PACKAGE "$PACKAGE"
_ACEOF
cat >>confdefs.h <<_ACEOF
#define VERSION "$VERSION"
_ACEOF
# Autoconf 2.50 wants to disallow AM_ names. We explicitly allow
# the ones we care about.
@ -1372,14 +1418,19 @@ _ACEOF
ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal"}
AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"}
AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake"}
AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"}
MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
AMTAR=${AMTAR-"${am_missing_run}tar"}
install_sh=${install_sh-"$am_aux_dir/install-sh"}
@ -1389,11 +1440,14 @@ INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
# We need awk for the "check" target. The system "awk" is bad on
# some platforms.
# Initialize the test suite and build position independent wrappers.
ac_config_commands="$ac_config_commands tests/package.m4"
ac_config_commands="$ac_config_commands tests/atconfig"
ac_config_files="$ac_config_files tests/Makefile tests/atlocal"
ac_config_files="$ac_config_files tests/autoconf:tests/wrapsh.in"
@ -1449,6 +1503,8 @@ else
echo "${ECHO_T}no" >&6
fi
# We use a path for GNU m4 so even if users have another m4 first in
# their path, the installer can configure with a path that has GNU m4
# first and get that path embedded in the installed autoconf and
@ -1520,11 +1576,14 @@ fi
# This is needed because Automake does not seem to realize there is
# a AC-SUBST inside AC-PROG-GNU-M4. Grmph!
# Man pages.
ac_config_files="$ac_config_files man/Makefile"
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
@ -1580,6 +1639,7 @@ echo "$as_me: error: Perl 5.005_03 or better is required" >&2;}
# Emacs modes.
ac_config_files="$ac_config_files lib/emacs/Makefile"
# Check whether --with-lispdir or --without-lispdir was given.
if test "${with_lispdir+set}" = set; then
withval="$with_lispdir"
@ -1665,11 +1725,17 @@ echo "${ECHO_T}$am_cv_lispdir" >&6
fi;
# Automake can't see inner AC_SUBSTS (`aclocal' is bypassed), so we tag the
# AC_SUBSTS here too.
ac_config_files="$ac_config_files Makefile doc/Makefile lib/Makefile lib/Autom4te/Makefile lib/autoscan/Makefile lib/m4sugar/Makefile lib/autoconf/Makefile lib/autotest/Makefile bin/Makefile"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
# tests run on this system so they can be shared between configure
@ -1776,6 +1842,8 @@ ac_LF_and_DOT=`echo; echo .`
DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'`
rm -f confdef2opt.sed
: ${CONFIG_STATUS=./config.status}
ac_clean_files_save=$ac_clean_files
ac_clean_files="$ac_clean_files $CONFIG_STATUS"
@ -1839,6 +1907,7 @@ fi
{ $as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set; } ||
{ LC_MESSAGES=C; export LC_MESSAGES; }
# Name of the executable.
as_me=`(basename "$0") 2>/dev/null ||
$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
@ -1872,6 +1941,7 @@ if test "${PATH_SEPARATOR+set}" != set; then
rm -f conftest.sh
fi
as_lineno_1=$LINENO
as_lineno_2=$LINENO
as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
@ -1958,6 +2028,7 @@ echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;
exit
}
case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
*c*,-n*) ECHO_N= ECHO_C='
' ECHO_T=' ' ;;
@ -1997,6 +2068,7 @@ as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g"
# Sed expression to map a string onto a valid variable name.
as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g"
# IFS
# We need space, tab and new line, in precisely that order.
as_nl='
@ -2166,8 +2238,11 @@ PACKAGE_VERSION='$PACKAGE_VERSION'
PACKAGE_STRING='$PACKAGE_STRING'
PACKAGE_BUGREPORT='$PACKAGE_BUGREPORT'
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF
for ac_config_target in $ac_config_targets
do
@ -2424,6 +2499,7 @@ ac_top_buildpath=`cd "$ac_dir" && cd $ac_top_builddir && pwd`
ac_srcpath=`cd "$ac_dir" && cd $ac_srcdir && pwd`
ac_top_srcpath=`cd "$ac_dir" && cd $ac_top_srcdir && pwd`
case $INSTALL in
[\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
*) ac_INSTALL=$ac_top_builddir$INSTALL ;;
@ -2563,6 +2639,7 @@ ac_top_buildpath=`cd "$ac_dir" && cd $ac_top_builddir && pwd`
ac_srcpath=`cd "$ac_dir" && cd $ac_srcdir && pwd`
ac_top_srcpath=`cd "$ac_dir" && cd $ac_top_srcdir && pwd`
{ echo "$as_me:$LINENO: executing $ac_dest commands" >&5
echo "$as_me: executing $ac_dest commands" >&6;}
case $ac_dest in
@ -2605,6 +2682,7 @@ _ACEOF
chmod +x $CONFIG_STATUS
ac_clean_files=$ac_clean_files_save
# configure is writing to config.log, and then calls config.status.
# config.status does its own redirection, appending to config.log.
# Unfortunately, on DOS this fails, as config.log is still kept open
@ -2631,5 +2709,7 @@ read the relevant mailing lists, most importantly <autoconf@gnu.org>.
Below you will find information on the status of this version of Autoconf.
EOF
sed -n '/^\* Status/,$p' $srcdir/BUGS

View File

@ -1224,6 +1224,8 @@ m4_define([AC_INIT],
[# Forbidden tokens and exceptions.
m4_pattern_forbid([^_?A[CHUM]_])
m4_pattern_forbid([_AC_])
m4_pattern_forbid([^LIBOBJS$],
[do not use LIBOBJ directly, use AC_LIBOBJS])
# Actually reserved by M4sh.
m4_pattern_allow([^AS_FLAGS$])
AS_INIT
@ -2342,8 +2344,8 @@ m4_define([_AC_LIBOBJ],
[AS_LITERAL_IF([$1],
[AC_LIBSOURCE([$1.c])],
[$2])dnl
AC_SUBST([LIBOBJS])dnl
LIBOBJS="$LIBOBJS $1.$ac_objext"])
AC_SUBST([LIB@&t@OBJS])dnl
LIB@&t@OBJS="$LIB@&t@OBJS $1.$ac_objext"])
# AC_LIBOBJ(FILENAME-NOEXT)

View File

@ -1222,8 +1222,8 @@ m4_define([$1],
[_m4_defun_pro([$1])$2[]_m4_defun_epi([$1])])])])
# m4_pattern_forbid(ERE)
# ----------------------
# m4_pattern_forbid(ERE, [WHY])
# -----------------------------
# Declare that no token matching the extended regular expression ERE
# should be seen in the output but if...
m4_define([m4_pattern_forbid], [])