messages.
* libm4.m4 (m4_location): New macro.
(m4_errprint): Rename as...
(m4_diagnose): this. Use m4_location.
Adjust dependencies.
(m4_errprint): New macro, similar to `errprint' but for an
additional trailing `n'.
* acgeneral.m4 (AC_DEFUN, AC_DEFUN_ONCE): Define `m4_location($1)'
to the current location (i.e., that of the definition of $1).
(_AC_DEFUN_PRO, _AC_REQUIRE): Also push the location of the
current macro in the stack.
(_AC_EXPANSION_STACK_DUMP): Adjust.
+2000-10-17 Akim Demaille <akim@epita.fr>
+
+ Give a means to report where the macros have been defined in error
+ messages.
+
+ * libm4.m4 (m4_location): New macro.
+ (m4_errprint): Rename as...
+ (m4_diagnose): this. Use m4_location.
+ Adjust dependencies.
+ (m4_errprint): New macro, similar to `errprint' but for an
+ additional trailing `\n'.
+ * acgeneral.m4 (AC_DEFUN, AC_DEFUN_ONCE): Define `m4_location($1)'
+ to the current location (i.e., that of the definition of $1).
+ (_AC_DEFUN_PRO, _AC_REQUIRE): Also push the location of the
+ current macro in the stack.
+ (_AC_EXPANSION_STACK_DUMP): Adjust.
+
2000-10-17 Akim Demaille <akim@epita.fr>
Fix autoupdate: updating `AC_OUTPUT_COMMANDS' was failing because
# Dump the expansion stack.
define([_AC_EXPANSION_STACK_DUMP],
[ifdef([_AC_EXPANSION_STACK],
- [m4_errprint([ ]defn([_AC_EXPANSION_STACK]))dnl
+ [m4_errprint(defn([_AC_EXPANSION_STACK]))dnl
popdef([_AC_EXPANSION_STACK])dnl
_AC_EXPANSION_STACK_DUMP()],
- [m4_errprint([ the top level])])])
+ [m4_diagnose([the top level])])])
# _AC_DEFUN_PRO(MACRO-NAME)
# The prologue for Autoconf macros.
define([_AC_DEFUN_PRO],
[AC_PROVIDE([$1])dnl
-pushdef([_AC_EXPANSION_STACK], [$1 is expanded from...])dnl
+pushdef([_AC_EXPANSION_STACK],
+ defn([m4_location($1)])[: $1 is expanded from...])dnl
pushdef([_AC_EXPANDING($1)])dnl
ifdef([_AC_DIVERT_DUMP],
[AC_DIVERT_PUSH(defn([_AC_DIVERT_DIVERSION]))],
# macros that are not involved in ordering constraints, to save m4
# processing.
define([AC_DEFUN],
-[define([$1], [_AC_DEFUN_PRO([$1])$2[]_AC_DEFUN_EPI([$1])])])
+[define([m4_location($1)], m4_location)dnl
+define([$1],
+ [_AC_DEFUN_PRO([$1])$2[]_AC_DEFUN_EPI([$1])])])
# AC_DEFUN_ONCE(NAME, EXPANSION)
# it passes to `AC_LANG_COMPILER(C)'.
define([_AC_REQUIRE],
[pushdef([_AC_EXPANSION_STACK],
- [$1 is required by...])dnl
+ m4_location[: $1 is required by...])dnl
ifdef([_AC_EXPANDING($1)],
- [m4_errprint([AC_REQUIRE: circular dependency of $1])dnl
+ [m4_diagnose([AC_REQUIRE: circular dependency of $1])dnl
_AC_EXPANSION_STACK_DUMP()dnl
m4exit(1)])dnl
ifndef([_AC_DIVERT_DUMP],
_AC_INIT_HELP
_AC_INIT_VERSION
_AC_INIT_PREPARE
-dnl _AC__INIT_COPYRIGHT must be called after _AC_INIT_VERSION, since
+dnl _AC_INIT_COPYRIGHT must be called after _AC_INIT_VERSION, since
dnl it dumps into a diversion prepared by _AC_INIT_VERSION.
_AC_INIT_NOTICE
_AC_INIT_COPYRIGHT
# Dump the expansion stack.
define([_AC_EXPANSION_STACK_DUMP],
[ifdef([_AC_EXPANSION_STACK],
- [m4_errprint([ ]defn([_AC_EXPANSION_STACK]))dnl
+ [m4_errprint(defn([_AC_EXPANSION_STACK]))dnl
popdef([_AC_EXPANSION_STACK])dnl
_AC_EXPANSION_STACK_DUMP()],
- [m4_errprint([ the top level])])])
+ [m4_diagnose([the top level])])])
# _AC_DEFUN_PRO(MACRO-NAME)
# The prologue for Autoconf macros.
define([_AC_DEFUN_PRO],
[AC_PROVIDE([$1])dnl
-pushdef([_AC_EXPANSION_STACK], [$1 is expanded from...])dnl
+pushdef([_AC_EXPANSION_STACK],
+ defn([m4_location($1)])[: $1 is expanded from...])dnl
pushdef([_AC_EXPANDING($1)])dnl
ifdef([_AC_DIVERT_DUMP],
[AC_DIVERT_PUSH(defn([_AC_DIVERT_DIVERSION]))],
# macros that are not involved in ordering constraints, to save m4
# processing.
define([AC_DEFUN],
-[define([$1], [_AC_DEFUN_PRO([$1])$2[]_AC_DEFUN_EPI([$1])])])
+[define([m4_location($1)], m4_location)dnl
+define([$1],
+ [_AC_DEFUN_PRO([$1])$2[]_AC_DEFUN_EPI([$1])])])
# AC_DEFUN_ONCE(NAME, EXPANSION)
# it passes to `AC_LANG_COMPILER(C)'.
define([_AC_REQUIRE],
[pushdef([_AC_EXPANSION_STACK],
- [$1 is required by...])dnl
+ m4_location[: $1 is required by...])dnl
ifdef([_AC_EXPANDING($1)],
- [m4_errprint([AC_REQUIRE: circular dependency of $1])dnl
+ [m4_diagnose([AC_REQUIRE: circular dependency of $1])dnl
_AC_EXPANSION_STACK_DUMP()dnl
m4exit(1)])dnl
ifndef([_AC_DIVERT_DUMP],
_AC_INIT_HELP
_AC_INIT_VERSION
_AC_INIT_PREPARE
-dnl _AC__INIT_COPYRIGHT must be called after _AC_INIT_VERSION, since
+dnl _AC_INIT_COPYRIGHT must be called after _AC_INIT_VERSION, since
dnl it dumps into a diversion prepared by _AC_INIT_VERSION.
_AC_INIT_NOTICE
_AC_INIT_COPYRIGHT
## Move some m4 builtins to a safer name space. ##
## --------------------------------------------- ##
+
+# m4_location
+# -----------
+define([m4_location], [__file__:__line__])
+
+
# m4_errprint(MSG)
# ----------------
-# Same as `errprint', but reports the file and line.
-define([m4_errprint], [errprint(__file__:__line__: [$1
+# Same as `errprint', but with the missing end of line.
+define([m4_errprint], [errprint([$1
])])
+# m4_diagnose(MSG)
+# ----------------
+# Same as `m4_errprint', but reports the file and line.
+define([m4_diagnose],
+[m4_errprint(m4_location: [$1])])
+
+
# m4_warn(MSG)
# ------------
# Warn the user.
-define([m4_warn], [m4_errprint([warning: $1])])
+define([m4_warn], [m4_diagnose([warning: $1])])
# m4_fatal(MSG, [EXIT-STATUS])
# ----------------------------
# Fatal the user. :)
define([m4_fatal],
-[m4_errprint([error: $1])dnl
+[m4_diagnose([error: $1])dnl
m4exit(ifelse([$2],, 1, [$2]))])