2006-06-02 Stepan Kasal * lib/m4sugar/m4sugar.m4 (m4_require): Modify the error message issued by AC_REQUIRE. * tests/m4sugar.at: Check m4_require's error message. * tests/base.at: Check AC_REQUIRE's error message. * tests/local.at (AT_CHECK_M4): New macro, almost identical to... (AT_CHECK_AUTOM4TE): ... which is now a thin wrapper around AT_CHECK_M4. (AT_CHECK_AUTOCONF): Use AT_CHECK_M4; no longer support `expout' as the last parameter. * tests/tools.at: Adapt to the above change. Index: lib/m4sugar/m4sugar.m4 =================================================================== RCS file: /cvsroot/autoconf/autoconf/lib/m4sugar/m4sugar.m4,v retrieving revision 2.97 diff -u -r2.97 m4sugar.m4 --- lib/m4sugar/m4sugar.m4 20 Feb 2006 21:43:06 -0000 2.97 +++ lib/m4sugar/m4sugar.m4 4 Jun 2006 14:13:17 -0000 @@ -1249,7 +1249,8 @@ [m4_ifdef([_m4_expanding($1)], [m4_fatal([$0: circular dependency of $1])])dnl m4_ifndef([_m4_divert_dump], - [m4_fatal([$0($1): cannot be used outside of an m4_defun'd macro])])dnl + [m4_fatal([$0($1): cannot be used outside of an ]dnl +m4_bmatch([$0], [^AC_], [[AC_DEFUN]], [[m4_defun]])['d macro])])dnl m4_provide_if([$1], [], [_m4_require_call([$1], [$2])])dnl Index: tests/base.at =================================================================== RCS file: /cvsroot/autoconf/autoconf/tests/base.at,v retrieving revision 1.37 diff -u -r1.37 base.at --- tests/base.at 27 May 2006 00:01:27 -0000 1.37 +++ tests/base.at 4 Jun 2006 14:13:17 -0000 @@ -63,6 +63,24 @@ AT_CLEANUP +## --------------------------- ## +## AC_REQUIRE: error message. ## +## --------------------------- ## + +# Check that the message mentions AC_DEFUN, not m4_defun. + +AT_SETUP([AC_REQUIRE: error message]) +AT_DATA([configure.ac], +[[AC_REQUIRE([AC_PROG_CC]) +]]) + +AT_CHECK_AUTOCONF([], [1], [], +[[configure.ac:1: error: AC_REQUIRE(AC_PROG_CC): cannot be used outside of an AC_DEFUN'd macro +configure.ac:1: the top level +autom4te: m4 failed with exit status: 1 +]]) +AT_CLEANUP + ## ----------------------------------------------- ## ## AC_REQUIRE and AC_DEFUN_ONCE: Require, expand. ## Index: tests/local.at =================================================================== RCS file: /cvsroot/autoconf/autoconf/tests/local.at,v retrieving revision 1.32 diff -u -r1.32 local.at --- tests/local.at 13 May 2006 09:54:51 -0000 1.32 +++ tests/local.at 4 Jun 2006 14:13:18 -0000 @@ -62,7 +62,7 @@ ## ------------------ ## -# AT_CHECK_AUTOM4TE(FLAGS, [EXIT-STATUS = 0], STDOUT, STDERR) +# AT_CHECK_M4(COMMAND, [EXIT-STATUS = 0], STDOUT, STDERR) # ----------------------------------------------------------- # If stderr is specified, normalize the observed stderr. E.g. (GNU M4 1.5): # @@ -87,18 +87,24 @@ # # and # autom4te: [^ ]m4 +# or autom4te: [^ ]m4.exe # to autom4te: m4 -m4_define([AT_CHECK_AUTOM4TE], -[AT_CHECK([autom4te $1], [$2], [$3], m4_ifval([$4], [stderr])) +m4_define([AT_CHECK_M4], +[AT_CHECK([$1], [$2], [$3], m4_ifval([$4], [stderr])) m4_ifval([$4], [AT_CHECK([[sed -e 's/^\([^:]*\): *\([0-9][0-9]*\): *[^:]*m4: /m4: \1: \2: /' \ -e 's/^[^:]*m4: *\([^:]*\): *\([0-9][0-9]*\): /m4: \1: \2: /' \ -e 's/^autom4te: [^ ]*m4 /autom4te: m4 /' \ - -e 's/^autom4te: [^ ]*m4.exe /autom4te: m4 /' \ + -e 's/^autom4te: [^ ]*m4\.exe /autom4te: m4 /' \ -e 's/ (E[A-Z]*)$//' \ stderr]], [0],[$4])]) ]) +# AT_CHECK_AUTOM4TE(FLAGS, [EXIT-STATUS = 0], STDOUT, STDERR) +# ----------------------------------------------------------- +m4_define([AT_CHECK_AUTOM4TE], +[AT_CHECK_M4([autom4te $1], [$2], [$3], [$4])]) + ## ----------------- ## @@ -203,7 +209,7 @@ # We always use "--force", to prevent problems with timestamps if the testsuite # were running too fast. m4_define([AT_CHECK_AUTOCONF], -[AT_CHECK([autoconf --force $1], [$2], [$3], [$4]) +[AT_CHECK_M4([autoconf --force $1], [$2], [$3], [$4]) if test -s configure; then AT_CHECK_SHELL_SYNTAX(configure) fi Index: tests/m4sugar.at =================================================================== RCS file: /cvsroot/autoconf/autoconf/tests/m4sugar.at,v retrieving revision 1.29 diff -u -r1.29 m4sugar.at --- tests/m4sugar.at 20 Feb 2006 21:43:06 -0000 1.29 +++ tests/m4sugar.at 4 Jun 2006 14:13:18 -0000 @@ -95,6 +95,25 @@ AT_CLEANUP +## --------------------------- ## +## m4_require: error message. ## +## --------------------------- ## + +AT_SETUP([m4@&address@hidden: error message]) + +AT_DATA_M4SUGAR([script.4s], +[[m4_defun([foo], [FOO]) +m4_require([foo]) +]]) + +AT_CHECK_M4SUGAR([], 1, [], +[[script.4s:2: error: m4@&address@hidden(foo): cannot be used outside of an m4_defun'd macro +script.4s:2: the top level +autom4te: m4 failed with exit status: 1 +]]) +AT_CLEANUP + + ## ----------------------------------- ## ## m4_require: circular dependencies. ## ## ----------------------------------- ## Index: tests/tools.at =================================================================== RCS file: /cvsroot/autoconf/autoconf/tests/tools.at,v retrieving revision 1.86 diff -u -r1.86 tools.at --- tests/tools.at 27 May 2006 02:54:33 -0000 1.86 +++ tests/tools.at 4 Jun 2006 14:13:18 -0000 @@ -253,18 +253,16 @@ [dnl] ]]) -AT_DATA_M4SH([experr], -[[configure.ac:2: error: possibly undefined macro: m4_foo - If this token and others are legitimate, please use m4_pattern_allow. +AT_CHECK_AUTOCONF([], 1, [], +[[configure.ac:2: error: possibly undefined macro: m4@&address@hidden + If this token and others are legitimate, please use m4@&address@hidden See the Autoconf documentation. -configure.ac:3: error: possibly undefined macro: _m4_bar -configure.ac:4: error: possibly undefined macro: AS_FOO -configure.ac:5: error: possibly undefined macro: _AS_BAR -configure.ac:6: error: possibly undefined macro: dnl +configure.ac:3: error: possibly undefined macro: _m4@&address@hidden +configure.ac:4: error: possibly undefined macro: AS@&address@hidden +configure.ac:5: error: possibly undefined macro: _AS@&address@hidden +configure.ac:6: error: possibly undefined macro: d@&address@hidden ]]) -AT_CHECK_AUTOCONF([], 1, [], experr) - AT_CLEANUP @@ -294,18 +292,16 @@ It would be very bad if Autoconf forgot to expand [AS_]INIT! ]]) -AT_DATA_M4SH([experr], -[[configure.ac:1: error: possibly undefined macro: AS_INIT - If this token and others are legitimate, please use m4_pattern_allow. +AT_CHECK_AUTOCONF([], 1, [], +[[configure.ac:1: error: possibly undefined macro: AS@&address@hidden + If this token and others are legitimate, please use m4@&address@hidden See the Autoconf documentation. -configure.ac:7: error: possibly undefined macro: AS_ALLOWED_NOT +configure.ac:7: error: possibly undefined macro: AS@&address@hidden configure.ac:10: error: possibly undefined macro: FORBIDDEN -configure.ac:14: error: possibly undefined macro: AS_THIS_IS_INVALID -configure.ac:14: error: possibly undefined macro: _AS_THIS_IS_INVALID_TOO +configure.ac:14: error: possibly undefined macro: AS@&address@hidden +configure.ac:14: error: possibly undefined macro: _AS@&address@hidden ]]) -AT_CHECK_AUTOCONF([], 1, [], [experr]) - AT_CLEANUP