Hi Eric, a couple of comments (sorry for reviewing patches out-of-order):
* Eric Blake wrote on Wed, Jan 21, 2009 at 05:32:34PM CET: > commit 46009205a943a5f5b712cc11b72e9b017141ffeb > Author: Eric Blake <[email protected]> > Date: Tue Jan 20 14:22:41 2009 -0700 > > Fix out-of-order expansion with expand-before-require. > > * lib/m4sugar/m4sugar.m4 (m4_require): Redundantly expand a > required macro when issuing expand-before-require warning. > * doc/autoconf.texi (Prerequisite Macros): Adjust documentation. > (Expanded Before Required): New node. > --- a/doc/autoconf.texi > +++ b/doc/autoconf.texi > +...@node Expanded Before Required > +...@section Expanded Before Required > + > +...@cindex expanded before required > +Older versions of Autoconf silently built files with incorrect ordering > +between dependent macros if an outer macro first expanded, then later > +indirectly required, an inner macro. Starting with Autoconf 2.64, this > +situation no longer generates out-of-order code, but results in > +duplicate output and a diagnosis of a syntax warning: s/a diagnosis of // ? > +...@example > +$ @kbd{cat configure.ac} > +...@result{}ac_defun([TESTA], [[echo in A > +...@result{}if test -n "$SEEN_A" ; then echo duplicate ; fi > +...@result{}seen_a=:]]) > +...@result{}ac_defun([TESTB], [AC_REQUIRE([TESTA])[echo in B > +...@result{}if test -z "$SEEN_A" ; then echo bug ; fi]]) > +...@result{}ac_defun([TESTC], [AC_REQUIRE([TESTB])[echo in C]]) > +...@result{}ac_defun([OUTER], [[echo in OUTER] > +...@result{}testa > +...@result{}testc]) > +...@result{}ac_init > +...@result{}outer > +...@result{}ac_output > +$ @kbd{autoconf} > +...@result{}configure.ac:11: warning: AC_REQUIRE: > +...@result{} `TESTA' was expanded before it was required > +...@result{}configure.ac:4: TESTB is expanded from... > +...@result{}configure.ac:6: TESTC is expanded from... > +...@result{}configure.ac:7: OUTER is expanded from... > +...@result{}configure.ac:11: the top level > +...@end example > + @noindent ? > +To avoid this warning, decide what purpose the macro in question serves. > +If it only needs to be expanded once (for example, if it provides > +initialization text used by later macros), then the fix is to change all > +instance of direct calls to instead go through @code{AC_REQUIRE} s/instance/&s/ > +(@pxref{Prerequisite Macros}). If, instead, the macro is parameterized > +by arguments or by the current definition of other macros in the m4 > +environment, then the macro should always be directly expanded instead > +of required. Cheers, Ralf
