Next: , Previous: Redefined M4 Macros, Up: Programming in M4sugar


8.3.2 Diagnostic messages from M4sugar

When macros statically diagnose abnormal situations, benign or fatal, they should report them using these macros. For issuing dynamic issues, i.e., when configure is run, see Printing Messages.

— Macro: m4_assert (expression, [exit-status = ‘1])

Assert that the arithmetic expression evaluates to non-zero. Otherwise, issue a fatal error, and exit autom4te with exit-status.

— Macro: m4_errprintn (message)

Similar to the builtin m4_errprint, except that a newline is guaranteed after message.

— Macro: m4_fatal (message)

Report a severe error message prefixed with the current location, and have autom4te die.

— Macro: m4_location

Useful as a prefix in a message line. Short for:

          __file__:__line__

— Macro: m4_warn (category, message)

Report message as a warning (or as an error if requested by the user) if warnings of the category are turned on. If the message is emitted, it is prefixed with the current location, and followed by a call trace of all macros defined via AC_DEFUN used to get to the current expansion. You are encouraged to use standard categories, which currently include:

all
messages that don't fall into one of the following categories. Use of an empty category is equivalent.
cross
related to cross compilation issues.
obsolete
use of an obsolete construct.
syntax
dubious syntactic constructs, incorrectly ordered macro calls.