diff --git a/ChangeLog b/ChangeLog index 2a3b92c8..2abf990d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,33 @@ +2001-08-03 Akim Demaille + + * lib/m4sugar/m4sugar.m4 (m4_init): Also forbid `_m4_*' tokens. + (m4_divert_pop): Dump the whole diversion stack when a diversion + mismatch happens. + * bin/autom4te.in (&handle_output): Remember of the first + occurrence of a possibly undefined macro, not the last. + Complain about the possibly undefined macros in the same order as + the appear in the output. + * lib/autoconf/Makefile.am (autoconf.m4f): List its dependencies. + * tests/tools.at (autoconf: forbidden tokens, basic) + (autoconf: forbidden tokens, exceptions): No longer sort + autoconf's stderr, as it is now deterministic. + Check that `dnl' is caught. + +2001-08-03 Akim Demaille + + * lib/m4sugar/m4sugar.m4 (m4_init): Also forbid `_m4_*' tokens. + (m4_divert_pop): Dump the whole diversion stack when a diversion + mismatch happens. + * bin/autom4te.in (&handle_output): Remember of the first + occurrence of a possibly undefined macro, not the last. + Complain about the possibly undefined macros in the same order as + the appear in the output. + * lib/autoconf/Makefile.am (autoconf.m4f): List its dependencies. + * tests/tools.at (autoconf: forbidden tokens, basic) + (autoconf: forbidden tokens, exceptions): No longer sort + autoconf's stderr, as it is now deterministic. + Check that `dnl' is caught. + 2001-08-01 Akim Demaille * configure.ac: Bump to 2.52c. diff --git a/bin/autom4te.in b/bin/autom4te.in index 891bfd77..22eaf30e 100644 --- a/bin/autom4te.in +++ b/bin/autom4te.in @@ -532,7 +532,7 @@ sub handle_output ($) foreach (split (/\W+/)) { $prohibited{$_} = $oline - if /$forbidden/ && !/$allowed/; + if /$forbidden/ && !/$allowed/ && ! exists $prohibited{$_}; } } @@ -566,7 +566,7 @@ sub handle_output ($) } } warn "$output:$prohibited{$_}: error: possibly undefined macro: $_\n" - foreach (keys %prohibited); + foreach (sort { $prohibited{$a} <=> $prohibited{$b} } keys %prohibited); } diff --git a/lib/autoconf/Makefile.am b/lib/autoconf/Makefile.am index 4e220c71..21a83fb8 100644 --- a/lib/autoconf/Makefile.am +++ b/lib/autoconf/Makefile.am @@ -69,7 +69,21 @@ M4_INCLUDES = --include $(srcdir) \ rm -f freeze.log; \ fi -autoconf.m4f: $(m4sources) +# Some day we should explain to Automake how to use autom4te to compute +# the dependencies... +srclibdir = $(top_srcdir)/lib +autoconf.m4f: $(srclibdir)/m4sugar/m4sugar.m4 \ + $(srclibdir)/m4sugar/m4sh.m4 \ + $(srclibdir)/autoconf/autoconf.m4 \ + $(srclibdir)/autoconf/general.m4 \ + $(srclibdir)/autoconf/oldnames.m4 \ + $(srclibdir)/autoconf/specific.m4 \ + $(srclibdir)/autoconf/lang.m4 \ + $(srclibdir)/autoconf/c.m4 \ + $(srclibdir)/autoconf/fortran.m4 \ + $(srclibdir)/autoconf/functions.m4 \ + $(srclibdir)/autoconf/headers.m4 \ + $(srclibdir)/autoconf/types.m4 # Files that should be removed, but which Automake does not know. CLEANFILES = autoconf.m4f diff --git a/lib/autoconf/Makefile.in b/lib/autoconf/Makefile.in index e572097a..246bd6d7 100644 --- a/lib/autoconf/Makefile.in +++ b/lib/autoconf/Makefile.in @@ -79,6 +79,10 @@ SUFFIXES = .m4 .m4f M4_INCLUDES = --include $(srcdir) --include $(top_builddir)/lib --include $(top_srcdir)/lib +# Some day we should explain to Automake how to use autom4te to compute +# the dependencies... +srclibdir = $(top_srcdir)/lib + # Files that should be removed, but which Automake does not know. CLEANFILES = autoconf.m4f mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs @@ -277,8 +281,18 @@ $(srcdir)/version.m4: $(srcdir)/version.in $(top_srcdir)/configure.ac else \ rm -f freeze.log; \ fi - -autoconf.m4f: $(m4sources) +autoconf.m4f: $(srclibdir)/m4sugar/m4sugar.m4 \ + $(srclibdir)/m4sugar/m4sh.m4 \ + $(srclibdir)/autoconf/autoconf.m4 \ + $(srclibdir)/autoconf/general.m4 \ + $(srclibdir)/autoconf/oldnames.m4 \ + $(srclibdir)/autoconf/specific.m4 \ + $(srclibdir)/autoconf/lang.m4 \ + $(srclibdir)/autoconf/c.m4 \ + $(srclibdir)/autoconf/fortran.m4 \ + $(srclibdir)/autoconf/functions.m4 \ + $(srclibdir)/autoconf/headers.m4 \ + $(srclibdir)/autoconf/types.m4 # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/lib/m4sugar/m4sugar.m4 b/lib/m4sugar/m4sugar.m4 index e25d7da3..2f5504c5 100644 --- a/lib/m4sugar/m4sugar.m4 +++ b/lib/m4sugar/m4sugar.m4 @@ -728,7 +728,8 @@ m4_builtin([divert], _m4_divert(_m4_divert_diversion))dnl m4_define([m4_divert_pop], [m4_ifval([$1], [m4_if(_m4_divert([$1]), m4_divnum, [], - [m4_fatal([$0($1): unexpected current diversion: ]m4_divnum)])])dnl + [m4_fatal([$0($1): diversion mismatch: ] +m4_defn([m4_divert_stack]))])])dnl m4_popdef([_m4_divert_diversion])dnl dnl m4_ifndef([_m4_divert_diversion], dnl [m4_fatal([too many m4_divert_pop])])dnl @@ -1724,14 +1725,14 @@ m4_define([m4_init], m4_ifndef([m4_tmpdir], [m4_define([m4_tmpdir], [/tmp])]) -# M4sugar reserves `m4_[A-Za-z0-9_]*'. We'd need \b and +, -# but they are not portable. -m4_pattern_forbid([^m4_]) +# All the M4sugar macros start with `m4_', except `dnl' kept as is +# for sake of simplicity. +m4_pattern_forbid([^_?m4_]) m4_pattern_forbid([^dnl$]) # Check the divert push/pop perfect balance. m4_wrap([m4_ifdef([_m4_divert_diversion], - [m4_fatal([$0: unbalanced m4_divert_push:] + [m4_fatal([$0: unbalanced m4_divert_push:] m4_defn([m4_divert_stack]))])[]]) m4_divert_push([KILL]) diff --git a/man/autom4te.1 b/man/autom4te.1 index 4c63403a..9fd590ff 100644 --- a/man/autom4te.1 +++ b/man/autom4te.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.24. -.TH AUTOM4TE "1" "August 2001" "GNU Autoconf 2.52b" FSF +.TH AUTOM4TE "1" "August 2001" "GNU Autoconf 2.52c" FSF .SH NAME autom4te \- Generate files and scripts thanks to M4 .SH SYNOPSIS diff --git a/tests/tools.at b/tests/tools.at index 275ec9bb..8fc62af4 100644 --- a/tests/tools.at +++ b/tests/tools.at @@ -208,7 +208,7 @@ AT_CLEANUP AT_SETUP([autoconf: forbidden tokens, basic]) AT_DATA([configure.ac], -[[AC_PLAIN_SCRIPT()dnl +[[AC_PLAIN_SCRIPT() AC_FOO _AC_BAR m4_foo @@ -217,21 +217,21 @@ BAC_FOO B_AC_FOO AS_FOO _AS_BAR +[dnl] ]]) -AT_CHECK_AUTOCONF([], 1, [], [stderr]) -# The output of autoconf is not deterministic here because it -# uses `for (ind in array)'. So be sure to have a unique representation. -AT_CHECK([sort stderr], 0, +AT_CHECK_AUTOCONF([], 1, [], [[configure.ac:2: error: possibly undefined macro: AC_FOO configure.ac:3: error: possibly undefined macro: _AC_BAR configure.ac:4: error: possibly undefined macro: m4_foo +configure.ac:5: error: possibly undefined macro: _m4_bar configure.ac:7: error: possibly undefined macro: B_AC_FOO configure.ac:8: error: possibly undefined macro: AS_FOO configure.ac:9: error: possibly undefined macro: _AS_BAR +configure.ac:10: error: possibly undefined macro: dnl ]]) -AT_CLEANUP(configure) +AT_CLEANUP # autoconf: forbidden tokens, exceptions @@ -260,20 +260,17 @@ BAC_DEFINE It would be very bad if Autoconf forgot to expand [AC_]OUTPUT! ]]) -AT_CHECK_AUTOCONF([], 1, [], [stderr]) -# The output of autoconf is not deterministic here because it -# uses `for (ind in array)'. So be sure to have a unique representation. -AT_CHECK([sort stderr], 0, -[[configure.ac:10: error: possibly undefined macro: FORBIDDEN +AT_CHECK_AUTOCONF([], 1, [], +[[configure.ac:7: error: possibly undefined macro: NOT_AC_ALLOWED +configure.ac:7: error: possibly undefined macro: AC_ALLOWED_NOT +configure.ac:10: error: possibly undefined macro: FORBIDDEN configure.ac:14: error: possibly undefined macro: AC_THIS_IS_INVALID configure.ac:14: error: possibly undefined macro: _AC_THIS_IS_INVALID_TOO configure.ac:15: error: possibly undefined macro: ALTHOUGH_AC_THIS_IS -configure.ac:7: error: possibly undefined macro: AC_ALLOWED_NOT -configure.ac:7: error: possibly undefined macro: NOT_AC_ALLOWED configure:18: error: possibly undefined macro: AC_OUTPUT ]]) -AT_CLEANUP(configure err) +AT_CLEANUP