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.
+2006-06-05 Stepan Kasal <kasal@ucw.cz>
+
+ * 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.
+
2006-06-04 Stepan Kasal <kasal@ucw.cz>
* doc/autoconf.texi (Limitations of Usual Tools): Correct
[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
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. ##
## ------------------ ##
-# 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):
#
# /usr/local/bin/m4: script.4s: 1: Cannot open foo: No such file or directory
#
# 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])])
+
## ----------------- ##
# 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
AT_CLEANUP
+## --------------------------- ##
+## m4_require: error message. ##
+## --------------------------- ##
+
+AT_SETUP([m4@&t@_require: error message])
+
+AT_DATA_M4SUGAR([script.4s],
+[[m4_defun([foo], [FOO])
+m4_require([foo])
+]])
+
+AT_CHECK_M4SUGAR([], 1, [],
+[[script.4s:2: error: m4@&t@_require(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. ##
## ----------------------------------- ##
[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@&t@_foo
+ If this token and others are legitimate, please use m4@&t@_pattern_allow.
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@&t@_bar
+configure.ac:4: error: possibly undefined macro: AS@&t@_FOO
+configure.ac:5: error: possibly undefined macro: _AS@&t@_BAR
+configure.ac:6: error: possibly undefined macro: d@&t@nl
]])
-AT_CHECK_AUTOCONF([], 1, [], experr)
-
AT_CLEANUP
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@&t@_INIT
+ If this token and others are legitimate, please use m4@&t@_pattern_allow.
See the Autoconf documentation.
-configure.ac:7: error: possibly undefined macro: AS_ALLOWED_NOT
+configure.ac:7: error: possibly undefined macro: AS@&t@_ALLOWED_NOT
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@&t@_THIS_IS_INVALID
+configure.ac:14: error: possibly undefined macro: _AS@&t@_THIS_IS_INVALID_TOO
]])
-AT_CHECK_AUTOCONF([], 1, [], [experr])
-
AT_CLEANUP