From: Eric Blake Date: Wed, 15 Oct 2008 22:15:52 +0000 (-0600) Subject: Break circular require chain in _AS_LINENO_PREPARE. X-Git-Tag: v2.63b~248 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7eba1c0ae03df9227cbd6ec47893395d72e2ef0f;p=thirdparty%2Fautoconf.git Break circular require chain in _AS_LINENO_PREPARE. * lib/m4sugar/m4sh.m4 (_AS_LINENO_PREPARE): Ensure that logging is disabled when reporting LINENO failure, since logging requires LINENO. * doc/autoconf.texi (Initialization Macros): Recommend m4_pushdef, not m4_rename, since the latter is undocumented. * lib/autoconf/status.m4 (_AC_OUTPUT_CONFIG_STATUS): Avoid m4_rename, as it does not yet handle pushdef stacks. Reported by Ralf Wildenhues. Signed-off-by: Eric Blake --- diff --git a/ChangeLog b/ChangeLog index d4619b9b..e627d14f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2008-10-15 Eric Blake + + Break circular require chain in _AS_LINENO_PREPARE. + * lib/m4sugar/m4sh.m4 (_AS_LINENO_PREPARE): Ensure that logging is + disabled when reporting LINENO failure, since logging requires + LINENO. + * doc/autoconf.texi (Initialization Macros): Recommend m4_pushdef, + not m4_rename, since the latter is undocumented. + * lib/autoconf/status.m4 (_AC_OUTPUT_CONFIG_STATUS): Avoid + m4_rename, as it does not yet handle pushdef stacks. + Reported by Ralf Wildenhues. + 2008-10-15 Eric Blake Cleanups to previous patches. diff --git a/doc/autoconf.texi b/doc/autoconf.texi index b3ffc766..43227a6b 100644 --- a/doc/autoconf.texi +++ b/doc/autoconf.texi @@ -11978,11 +11978,14 @@ Note that @code{AS_INIT_GENERATED} does not emit the entire prolog. In particular, a line containing @code{#!$SHELL} must have already been emitted to the child script; you should not use @code{#!/bin/sh}, or the child script will not use the more modern shell that the parent script -might have detected. Currently, the suggested idiom for writing a M4sh +might have detected. Likewise, the child script starts life without a +log file open, so you must temporarily disable any attempts to use the +log file until after emitting code to open a log within the child. +Currently, the suggested idiom for writing a M4sh shell script from within another script is: @example -m4_rename([AS_MESSAGE_LOG_FD], [save_AS_MESSAGE_LOG_FD])dnl +m4_pushdef([AS_MESSAGE_LOG_FD])dnl cat > "@var{file}" <<__EOF__ #! $SHELL # Generated by $as_me. @@ -11995,7 +11998,7 @@ cat >>"@var{file}" <<\__EOF__ AS_INIT_GENERATED # ... __EOF__ -m4_rename([save_AS_MESSAGE_LOG_FD], [AS_MESSAGE_LOG_FD])dnl +m4_popdef([AS_MESSAGE_LOG_FD])dnl @end example This, however, may change in the future as the M4sh interface is diff --git a/lib/autoconf/status.m4 b/lib/autoconf/status.m4 index 6d622b9e..26fa2cff 100644 --- a/lib/autoconf/status.m4 +++ b/lib/autoconf/status.m4 @@ -1317,7 +1317,7 @@ fi m4_define([_AC_OUTPUT_CONFIG_STATUS], [AC_MSG_NOTICE([creating $CONFIG_STATUS]) dnl AS_MESSAGE_LOG_FD is not available yet: -m4_rename([AS_MESSAGE_LOG_FD], [_AC_save_AS_MESSAGE_LOG_FD])dnl +m4_pushdef([AS_MESSAGE_LOG_FD])dnl cat >$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 #! $SHELL # Generated by $as_me. @@ -1541,7 +1541,7 @@ fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 dnl Open the log: -m4_rename([_AC_save_AS_MESSAGE_LOG_FD], [AS_MESSAGE_LOG_FD])dnl +m4_popdef([AS_MESSAGE_LOG_FD])dnl exec AS_MESSAGE_LOG_FD>>config.log { echo diff --git a/lib/m4sugar/m4sh.m4 b/lib/m4sugar/m4sh.m4 index b42e87fa..44c80491 100644 --- a/lib/m4sugar/m4sh.m4 +++ b/lib/m4sugar/m4sh.m4 @@ -953,6 +953,9 @@ m4_defun([_AS_LINENO_PREPARE], [AS_REQUIRE([_AS_CR_PREPARE])dnl AS_REQUIRE([_AS_ME_PREPARE])dnl _AS_DETECT_SUGGESTED([_AS_LINENO_WORKS])dnl +dnl Even if the logging fd is open, we don't want to use $LINENO in the +dnl AS_ERROR complaining that LINENO is broken. +m4_pushdef([AS_MESSAGE_LOG_FD])dnl _AS_LINENO_WORKS || { dnl Create $as_me.lineno as a copy of $as_myself, but with $LINENO @@ -989,6 +992,7 @@ _AS_LINENO_WORKS || { # Exit status is that of the last command. exit } +m4_popdef([AS_MESSAGE_LOG_FD])dnl ])# _AS_LINENO_PREPARE