Previous: Suggested Ordering, Up: Dependencies Between Macros

9.4.3 One-Shot Macros

Some macros should be called only once, either because calling them multiple time is unsafe, or because it is bad style. For instance Autoconf ensures that AC_CANONICAL_BUILD and cousins (see Canonicalizing) are evaluated only once, because it makes no sense to run these expensive checks more than once. Such one-shot macros can be defined using AC_DEFUN_ONCE.

— Macro: AC_DEFUN_ONCE (macro-name, macro-body)

Declare macro macro-name like AC_DEFUN would (see Macro Definitions), and emit a warning any time the macro is called more than once.

Obviously it is not sensible to evaluate a macro defined by AC_DEFUN_ONCE in a macro defined by AC_DEFUN. Most of the time you want to use AC_REQUIRE (see Prerequisite Macros).