From 11b827d202aa07b2b8c8f894d8f49844d570dfe9 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Tue, 6 Oct 2020 23:46:42 +0200 Subject: [PATCH] Clarify that AS_IF and AS_CASE are overkill inside AC_DEFUN. * doc/autoconf.texi (Common Shell Constructs): Document that AS_IF and AS_CASE provide no benefit regarding required macros when used inside macros defined by AC_DEFUN or AC_DEFUN_ONCE. * NEWS: Don't mention the undocumented macro AS_FOR. --- NEWS | 4 ++-- doc/autoconf.texi | 16 +++++++++++++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index 55e938b..5335709 100644 --- a/NEWS +++ b/NEWS @@ -36,8 +36,8 @@ GNU Autoconf NEWS - User visible changes. - Autoconf macros that use AC_REQUIRE internally, are not safe to use inside of hand-written shell control-flow constructs. Use - AS_IF, AS_CASE, AS_FOR, etc. instead. (See the “Prerequisite - Macros” section of the manual for further explanation.) + AS_IF, AS_CASE, etc. instead. (See the “Prerequisite Macros” + section of the manual for further explanation.) The set of macros that use AC_REQUIRE internally may change from release to release. The only macros that are guaranteed *not* to diff --git a/doc/autoconf.texi b/doc/autoconf.texi index dea85e4..f8d8f8b 100644 --- a/doc/autoconf.texi +++ b/doc/autoconf.texi @@ -13759,7 +13759,15 @@ Expand into a shell @samp{case} statement, where @var{word} is matched against one or more patterns. @var{if-matched} is run if the corresponding pattern matched @var{word}, else @var{default} is run. Avoids several portability issues (@pxref{case, , Limitations of Shell -Builtins}). +Builtins}). Also, @code{AS_CASE} ensures any macros required by +@var{if-matched1}, @dots{}, @var{default} are expanded before the +@samp{case} statement. + +The handling of required macros provided by @code{AS_CASE} is useful +in @file{configure.ac}, outside of macros defined by @code{AC_DEFUN} +or @code{AC_DEFUN_ONCE}. Inside macros defined by @code{AC_DEFUN} +or @code{AC_DEFUN_ONCE}, @code{AS_CASE} and the plain shell @samp{case} +syntax are equivalent. @end defmac @c Deprecated, to be replaced by a better API @@ -13881,6 +13889,12 @@ blanks, or expand to a nonempty shell command. For example, argument contains the nonblank characters @code{[]} which expand to nothing. This restriction on @var{run-if-false} also applies to other macros with ``if-false'' arguments denoting shell commands. + +The handling of required macros provided by @code{AS_IF} is useful +in @file{configure.ac}, outside of macros defined by @code{AC_DEFUN} +or @code{AC_DEFUN_ONCE}. Inside macros defined by @code{AC_DEFUN} +or @code{AC_DEFUN_ONCE}, @code{AS_IF} and the plain shell @samp{if} +syntax are equivalent. @end defmac @defmac AS_MKDIR_P (@var{file-name}) -- 2.7.4