Hi Eric, In <http://lists.gnu.org/archive/html/bug-gnulib/2009-01/msg00134.html> you write: > This is the same issue as Bruno's > recently reported issue with gl_MULTIARCH. For an example fix, see: > > http://lists.gnu.org/archive/html/bug-gnulib/2008-12/msg00301.html > > but realize that although that message claims it is a bug in autoconf, > later discussion on the autoconf determined that the behavior of > AC_REQUIRE, albeit a bit surprising, is indeed desirable
Thank you very much for looking into the problem. I see you analyzed it for a couple of days in <http://lists.gnu.org/archive/html/bug-autoconf/2008-12/msg00039.html> <http://lists.gnu.org/archive/html/autoconf-patches/2008-12/msg00063.html> I somehow understand your argument that in AC_PROG_GCC_TRADITIONAL if ... AC_EGREP_CPP fi the check for egrep should not be executed until the 'if' branch is entered. That is ok: here the user has written AC_EGREP_CPP, not AC_REQUIRE([AC_EGREP_CPP]). But the documentation of AC_REQUIRE <http://www.gnu.org/software/autoconf/manual/html_node/Prerequisite-Macros.html> says: "To be more precise, the required macro is expanded before the outermost defined macro in the current expansion stack." and in your simplified example $ m4 -Ilib m4sugar/m4sugar.m4 - <<\EOF m4_init m4_defun([a],[in A ]) m4_defun([b],[in B m4_require([a])]) m4_defun([c],[in C m4_require([b])]) m4_defun([outer], [pre a c post ]) m4_divert[]dnl outer EOF in B pre in A in C post the "outermost defined macro in the current expansion stack" for both 'a' and 'b' is 'outer' (no?), therefore both the 'in A' and 'in B' texts should come out before 'pre'. If not, then what else does the sentence "outermost defined macro in the current expansion stack" mean? In <http://lists.gnu.org/archive/html/autoconf-patches/2008-12/msg00058.html> you propose: + For an example: + AC_DEFUN([a], [A]) + AC_DEFUN([b], [B AC_REQUIRE([a])]) + AC_DEFUN([c], [C AC_REQUIRE([b])]) + AC_DEFUN([outer], [PRE a c POST]) + outer + now outputs `PRE A B C POST' instead of `B PRE A C POST'. Both outputs look wrong to me. According to the documentation, the "outermost defined macro in the current expansion stack" is 'outer'. The expansion of 'a' and the one of 'b' therefore have to occur before the expansion of 'outer'. Since 'b' requires 'a', the output should be A B PRE C POST Bruno
