File: autoconf.info, Node: One-Shot Macros, Prev: Suggested Ordering, Up: Dependencies Between Macros 10.3.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 (*note 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 (*note Macro Definitions::), but add additional logic that guarantees that only the first use of the macro (whether by direct expansion or ‘AC_REQUIRE’) causes an expansion of MACRO-BODY; the expansion will occur before the start of any enclosing macro defined by ‘AC_DEFUN’. Subsequent expansions are silently ignored. Generally, it does not make sense for MACRO-BODY to use parameters such as ‘$1’. Prior to Autoconf 2.64, a macro defined by ‘AC_DEFUN_ONCE’ would emit a warning if it was directly expanded a second time, so for portability, it is better to use ‘AC_REQUIRE’ than direct invocation of MACRO-NAME inside a macro defined by ‘AC_DEFUN’ (*note Prerequisite Macros::).