As of this morning, autoconf.git now warns you on instances of expand-before- require (aka ordering bugs in older autoconf, and redundant output when using bleeding edge autoconf). I'm working on a series of patches to reduce the number of warnings we trigger, starting with this one:
configure.ac:33: warning: AC_REQUIRE: `AC_USE_SYSTEM_EXTENSIONS' was expanded before it was required m4/extensions.m4:93: gl_USE_SYSTEM_EXTENSIONS is expanded from... m4/gnulib-comp.m4:21: gl_EARLY is expanded from... configure.ac:33: the top level configure.ac:33: warning: AC_COMPILE_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS m4/extensions.m4:23: AC_USE_SYSTEM_EXTENSIONS is expanded from... configure.ac:33: warning: AC_RUN_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS My analysis: gl_EARLY does the following: AC_REQUIRE([AC_GNU_SOURCE]) AB_INIT AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) but AC_GNU_SOURCE expands, rather than requires, AC_USE_SYSTEM_EXTENSIONS, such that the later gl_USE_SYSTEM_EXTENSIONS, which requires AC_USE_SYSTEM_EXTENSIONS. I can probably address some of this by changing AU_DEFUN in autoconf, such that autoupdate handles a macro differently than autoconf; but that will only affect autoconf 2.64+. For autoconf 2.63, this means that we truly have an out-of-order expansion situation. For even earlier autoconf, such as 2.59, AC_GNU_SOURCE did not require AC_USE_SYSTEM_EXTENSIONS, so there is no ordering dependency there; however, gnulib ALREADY provides a working AC_USE_SYSTEM_EXTENSIONS, even for autoconf 2.59. Therefore, I see no reason for us to even worry about using AC_GNU_SOURCE. Besides, the only use of AC_GNU_SOURCE in current gnulib sources is in m4/threadlib.m4, but that is from gettext, and is already coded to use AC_GNU_SOURCE only if AC_USE_SYSTEM_EXTENSIONS is not available, because Bruno didn't want that file to suck in gl_USE_SYSTEM_EXTENSIONS. Therefore, I'm committing this patch (I love it when pure deletion fixes a bug, and makes gnulib-tool fork fewer times to boot): From: Eric Blake <e...@byu.net> Date: Wed, 21 Jan 2009 09:55:55 -0700 Subject: [PATCH] gnulib-tool: avoid warnings from using obsolete AC_GNU_SOURCE * gnulib-tool (func_dest_tmpfilename, func_create_testdir): Using obsolete AC_GNU_SOURCE causes out-of-order expansion; avoid it, and rely solely on gl_USE_SYSTEM_EXTENSIONS. Signed-off-by: Eric Blake <e...@byu.net> --- ChangeLog | 7 +++++++ gnulib-tool | 11 ----------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index af6bee5..7b7c8bd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2009-01-21 Eric Blake <e...@byu.net> + + gnulib-tool: avoid warnings from using obsolete AC_GNU_SOURCE + * gnulib-tool (func_dest_tmpfilename, func_create_testdir): Using + obsolete AC_GNU_SOURCE causes out-of-order expansion; avoid it, + and rely solely on gl_USE_SYSTEM_EXTENSIONS. + 2009-01-21 Paolo Bonzini <bonz...@gnu.org> Revert: diff --git a/gnulib-tool b/gnulib-tool index c11ef35..c6725d3 100755 --- a/gnulib-tool +++ b/gnulib-tool @@ -3378,9 +3378,6 @@ s,//*$,/,' if test -n "$uses_subdirs"; then echo " AC_REQUIRE([AM_PROG_CC_C_O])" fi - if grep AC_GNU_SOURCE "$destdir"/$m4base/*.m4 >/dev/null 2>/dev/null; then - echo " AC_REQUIRE([AC_GNU_SOURCE])" - fi for module in $final_modules; do func_verify_module if test -n "$module"; then @@ -3919,10 +3916,6 @@ func_create_testdir () echo "AC_PROG_MAKE_SET" echo "AC_PROG_RANLIB" echo - if grep AC_GNU_SOURCE "$testdir/$m4base"/*.m4 >/dev/null 2>/dev/null; then - echo "AC_GNU_SOURCE" - echo - fi for module in $modules; do func_verify_module if test -n "$module"; then @@ -4052,10 +4045,6 @@ func_create_testdir () echo "AM_PROG_CC_C_O" echo fi - if grep AC_GNU_SOURCE "$testdir/$m4base"/*.m4 >/dev/null 2>/dev/null; then - echo "AC_GNU_SOURCE" - echo - fi for module in $modules; do func_verify_nontests_module if test -n "$module"; then -- 1.6.0.4