* Ralf Wildenhues wrote on Mon, May 29, 2006 at 05:38:12PM CEST: > * Mikael Magnusson wrote on Mon, May 29, 2006 at 05:06:13PM CEST: > > > > If you call AC_PROG_CC and AC_C_BIGENDIAN in a macro, the checks for > > unistd.h and some other headers will fail. See attached test case.
OK, this is ugly. AC_C_BIGENDIAN requires (through some indirect macro chain) both AC_PROG_CC and AC_LANG_PREPROC(C). Now, since you've explicitly called AC_PROG_CC before, that requirement is already deemed fulfilled by the stacking algorithm. The AC_LANG_PREPROC(C) requirement is not yet fulfilled, so that macro is expanded right before the expansion of TEST_INIT. Boing: AC_PROG_CC will be expanded after it. :-( One solution is to write the AC_PROG_CC as a requirement, so that it will be expanded outside, like this: AC_DEFUN([TEST_INIT],[ AC_REQUIRE([AC_PROG_CC]) echo test2 AC_C_BIGENDIAN echo test3 ]) echo 2 TEST_INIT echo 3 AC_CHECK_HEADER([unistd.h], [], [AC_MSG_ERROR([unistd.h not available?])]) AC_OUTPUT Cheers, Ralf
