+2008-10-15 Eric Blake <ebb9@byu.net>
+
+ 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 <ebb9@byu.net>
Cleanups to previous patches.
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.
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
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.
_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
[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
# Exit status is that of the last command.
exit
}
+m4_popdef([AS_MESSAGE_LOG_FD])dnl
])# _AS_LINENO_PREPARE