On 12 January 2016 at 00:53, Gavin Smith <gavinsmith0...@gmail.com> wrote: > Maybe AC_REQUIRE isn't hoisting the code far enough? The code is > remaining in the function corresponding to a gnulib module's code, and > not going to the very top level. The code is expanded, but is executed > too late.
So gnulib-m4.comp, which gnulib-tool creates, looks like this: func_gl_gnulib_m4code_langinfo () { if ! $gl_gnulib_enabled_langinfo; then gl_LANGINFO_H gl_gnulib_enabled_langinfo=true fi } func_gl_gnulib_m4code_nl_langinfo () { if ! $gl_gnulib_enabled_nl_langinfo; then gl_FUNC_NL_LANGINFO if test $HAVE_NL_LANGINFO = 0 || test $REPLACE_NL_LANGINFO = 1; then AC_LIBOBJ([nl_langinfo]) fi gl_LANGINFO_MODULE_INDICATOR([nl_langinfo]) gl_gnulib_enabled_nl_langinfo=true func_gl_gnulib_m4code_langinfo if test $HAVE_NL_LANGINFO = 0 || test $REPLACE_NL_LANGINFO = 1; then func_gl_gnulib_m4code_localeconv fi fi if test $ac_use_included_regex = yes; then func_gl_gnulib_m4code_nl_langinfo fi I think because gl_LANGINFO_H is used earlier in the file, in the body of func_gl_gnulib_m4code_langinfo, the macro that is AC_REQUIRE'd is expanded there, and not later in gl_FUNC_NL_LANGINFO.