diff options
author | Zack Weinberg <zackw@panix.com> | 2020-12-04 16:32:35 -0500 |
---|---|---|
committer | Zack Weinberg <zackw@panix.com> | 2020-12-04 16:41:43 -0500 |
commit | c38538737c6d221674b9bc746b6b1430f64d4aaa (patch) | |
tree | ca11e11215d9f37ded68a746ec18ef9a12dbcf4b /doc/autoconf.texi | |
parent | 2a7a441b437d9a87271078877c2fc425137f9a3b (diff) | |
download | autoconf-c38538737c6d221674b9bc746b6b1430f64d4aaa.tar.gz |
Revert "AC_PROG_CC: define via AC_DEFUN_ONCE". (#110350)
Revert commit 18c140b50b0619454d4da50d58a318cc257d580a, restoring
AC_PROG_CC to being defined as an ordinary AC_DEFUN. This broke
third-party macros (e.g. the Autoconf Macro Archive’s
AX_PROG_CC_FOR_BUILD) that intentionally invoked AC_PROG_CC a second
time with its guts redefined via a whole bunch of ‘pushdef’s. I don’t
think we want to support this long-term, but needing access to a
build-native compiler in cross-compilation is common enough that we
should have *some* supported way to do it, and it may as well be
AX_PROG_CC_FOR_BUILD until we come up with something better.
If we go back to AC_DEFUN_ONCE for AC_PROG_CC in the future, we should
do it consistently for all the “find me a compiler” macros -- it
was *only* done for AC_PROG_CC in 18c140b5.
The rationale for AC_DEFUN_ONCE seems to have been to reduce the size
of the generated configure script. The bulk of the size accountable to
AC_PROG_CC is the test programs for figuring out which version of the
C standard is available, so I tweaked _AC_C_STD_TRY (and _AC_CXX_STD_TRY)
to emit that text only once per program, into shell variables which
can then be referenced repeatedly.
Fixes bug #110350.
* NEWS, doc/autoconf.texi: Revert documentation changes associated
with AC_PROG_CC being a one-shot macro.
* lib/autoconf/c.m4 (AC_PROG_CC): Revert to defining with AC_DEFUN.
(_AC_C_STD_TRY, _AC_CXX_STD_TRY): Emit the test program only once,
even if invoked multiple times with the same arguments.
* tests/foreign.at (AX_PROG_CC_FOR_BUILD, AX_PROG_CXX_FOR_BUILD):
New tests.
Diffstat (limited to 'doc/autoconf.texi')
-rw-r--r-- | doc/autoconf.texi | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/doc/autoconf.texi b/doc/autoconf.texi index afeca056..01af2b29 100644 --- a/doc/autoconf.texi +++ b/doc/autoconf.texi @@ -7495,8 +7495,11 @@ and before @code{AC_PROG_CC} to select an empty default instead. Many Autoconf macros use a compiler, and thus call @samp{AC_REQUIRE([AC_PROG_CC])} to ensure that the compiler has been determined before the body of the outermost @code{AC_DEFUN} macro. -@code{AC_PROG_CC} is therefore defined via @code{AC_DEFUN_ONCE} to avoid -needless reexpansion (@pxref{One-Shot Macros}). +Although @code{AC_PROG_CC} is safe to directly expand multiple times, it +performs certain checks (such as the proper value of @env{EXEEXT}) only +on the first invocation. Therefore, care must be used when invoking +this macro from within another macro rather than at the top level +(@pxref{Expanded Before Required}). @end defmac @anchor{AC_PROG_CC_C_O} |