[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: expand-before-require bug
From: |
Eric Blake |
Subject: |
Re: expand-before-require bug |
Date: |
Mon, 26 Jan 2009 17:54:59 +0000 (UTC) |
User-agent: |
Loom/3.14 (http://gmane.org/) |
Bruno Haible <bruno <at> clisp.org> writes:
> This patch introduces
> "AC_COMPILE_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS"
> warnings in gettext, with autoconf 2.63. (gettext uses AC_GNU_SOURCE
> in a couple of places, and even though the macro is marked obsolete,
> it's not invalid to use it.) As explained in
> <http://news.gmane.org/gmane.comp.sysutils.autoconf.bugs/cutoff=6480>,
> the bug is that AC_GNU_SOURCE invokes rather than requires
> AC_USE_SYSTEM_EXTENSIONS.
>
> I'm adding this workaround. In case that it introduces warnings with
> the current autoconf HEAD, the fix will be to fix AC_GNU_SOURCE in the
> first place.
And your workaround re-adds warnings with autoconf 2.63.262 (the version
present this morning, before my AC_DEFUN_ONCE patch on the autoconf side):
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: M4_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
Trading one warning for another is not a good patch in my mind; and what's
worse, the warnings are correct - you reintroduced duplicate expansion.
Fortunately, your were correct in your analysis that AC_USE_SYSTEM_EXTENSIONS
is a lot easier to use if defined by AC_DEFUN_ONCE; with the second patch
below, I have confirmed that both autoconf 2.63 and autoconf.git are silent,
and that neither autoconf version suffers from duplicate or out-of-order
expansion.
So, without further ado, here's the gnulib side of the patch to fix
AC_DEFUN_ONCE when used with older autoconf, then use it; now applied.
However, now that AC_DEFUN_ONCE works, maybe it is worth reverting your patch
to AC_USE_SYSTEM_EXTENSIONS in favor of _just_ using AC_DEFUN_ONCE, although I
did not test that (I minimized my patch, to ensure that the changes I was
making had the desired effects). Technically, the two-argument form of
AC_REQUIRE is not documented, but it has been around for longer than 2.59.
>From fcf62c3dfcc0a9ca32860327494e9971623f062c Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Mon, 26 Jan 2009 09:08:48 -0700
Subject: [PATCH] Backport improved autoconf semantics of AC_DEFUN_ONCE.
* m4/00gnulib.m4: New file.
* gnulib-tool (func_get_filelist): Always use it.
* m4/gnulib-common.m4 (gl_COMMON): Force the file to be used.
Reported by Bruno Haible, with suggestions from Paolo Bonzini.
Signed-off-by: Eric Blake <address@hidden>
---
ChangeLog | 8 ++++++++
gnulib-tool | 1 +
m4/00gnulib.m4 | 30 ++++++++++++++++++++++++++++++
m4/gnulib-common.m4 | 3 ++-
4 files changed, 41 insertions(+), 1 deletions(-)
create mode 100644 m4/00gnulib.m4
diff --git a/ChangeLog b/ChangeLog
index 78f8aa3..a8f6e1d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2009-01-26 Eric Blake <address@hidden>
+
+ Backport improved autoconf semantics of AC_DEFUN_ONCE.
+ * m4/00gnulib.m4: New file.
+ * gnulib-tool (func_get_filelist): Always use it.
+ * m4/gnulib-common.m4 (gl_COMMON): Force the file to be used.
+ Reported by Bruno Haible, with suggestions from Paolo Bonzini.
+
2009-01-25 Bruno Haible <address@hidden>
Make test-quotearg work on MacOS X and AIX.
diff --git a/gnulib-tool b/gnulib-tool
index c6725d3..a044ead 100755
--- a/gnulib-tool
+++ b/gnulib-tool
@@ -1378,6 +1378,7 @@ func_get_filelist ()
{
func_lookup_file "modules/$1"
sed -n -e "/^Files$sed_extract_prog" < "$lookedup_file"
+ echo m4/00gnulib.m4
echo m4/gnulib-common.m4
case "$autoconf_minversion" in
2.59)
diff --git a/m4/00gnulib.m4 b/m4/00gnulib.m4
new file mode 100644
index 0000000..a6b5e21
--- /dev/null
+++ b/m4/00gnulib.m4
@@ -0,0 +1,30 @@
+# 00gnulib.m4 serial 1
+dnl Copyright (C) 2009 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl This file must be named something that sorts before all other
+dnl gnulib-provided .m4 files. It is needed until such time as we can
+dnl assume Autoconf 2.64, with its improved AC_DEFUN_ONCE semantics.
+
+# AC_DEFUN_ONCE(NAME, VALUE)
+# --------------------------
+# Define NAME to expand to VALUE on the first use (whether by direct
+# expansion, or by AC_REQUIRE), and to nothing on all subsequent uses.
+# Avoid bugs in AC_REQUIRE in Autoconf 2.63 and earlier. This
+# definition is slower than the version in Autoconf 2.64, because it
+# can only use interfaces that existed since 2.59; but it achieves the
+# same effect. Quoting is necessary to avoid confusing Automake.
+m4_version_prereq([2.63.263], [],
+[m4_define([AC][_DEFUN_ONCE],
+ [AC][_DEFUN([$1],
+ [AC_REQUIRE([_gl_DEFUN_ONCE([$1])],
+ [m4_indir([_gl_DEFUN_ONCE([$1])])])])]dnl
+[AC][_DEFUN([_gl_DEFUN_ONCE([$1])], [$2])])])
+
+# gl_00GNULIB
+# -----------
+# Witness macro that this file has been included. Needed to force
+# Automake to include this file prior to all other gnulib .m4 files.
+AC_DEFUN([gl_00GNULIB])
diff --git a/m4/gnulib-common.m4 b/m4/gnulib-common.m4
index cfd1b99..fff9d0f 100644
--- a/m4/gnulib-common.m4
+++ b/m4/gnulib-common.m4
@@ -1,4 +1,4 @@
-# gnulib-common.m4 serial 8
+# gnulib-common.m4 serial 9
dnl Copyright (C) 2007-2009 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -8,6 +8,7 @@ dnl with or without modifications, as long as this notice is
preserved.
# is expanded unconditionally through gnulib-tool magic.
AC_DEFUN([gl_COMMON], [
dnl Use AC_REQUIRE here, so that the code is expanded once only.
+ AC_REQUIRE([gl_00GNULIB])
AC_REQUIRE([gl_COMMON_BODY])
])
AC_DEFUN([gl_COMMON_BODY], [
--
1.6.0.4
>From 984e414921a4e22c44d877d3f10fd55ae942397b Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Mon, 26 Jan 2009 09:24:23 -0700
Subject: [PATCH] Silence warning reintroduced by recent extensions patch.
* m4/extensions.m4 (AC_USE_SYSTEM_EXTENSIONS)
(gl_USE_SYSTEM_EXTENSIONS): Use AC_DEFUN_ONCE to silence newer
autoconf.
Signed-off-by: Eric Blake <address@hidden>
---
ChangeLog | 5 +++++
m4/extensions.m4 | 6 +++---
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index a8f6e1d..bd387c9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2009-01-26 Eric Blake <address@hidden>
+ Silence warning reintroduced by recent extensions patch.
+ * m4/extensions.m4 (AC_USE_SYSTEM_EXTENSIONS)
+ (gl_USE_SYSTEM_EXTENSIONS): Use AC_DEFUN_ONCE to silence newer
+ autoconf.
+
Backport improved autoconf semantics of AC_DEFUN_ONCE.
* m4/00gnulib.m4: New file.
* gnulib-tool (func_get_filelist): Always use it.
diff --git a/m4/extensions.m4 b/m4/extensions.m4
index b7ee9ef..ba6d5e1 100644
--- a/m4/extensions.m4
+++ b/m4/extensions.m4
@@ -1,4 +1,4 @@
-# serial 7 -*- Autoconf -*-
+# serial 8 -*- Autoconf -*-
# Enable extensions on systems that normally disable them.
# Copyright (C) 2003, 2006-2009 Free Software Foundation, Inc.
@@ -20,7 +20,7 @@
# AC_DEFINE. The goal here is to define all known feature-enabling
# macros, then, if reports of conflicts are made, disable macros that
# cause problems on some platforms (such as __EXTENSIONS__).
-AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS],
+AC_DEFUN_ONCE([AC_USE_SYSTEM_EXTENSIONS],
[AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl
AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
@@ -90,7 +90,7 @@ AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
# ------------------------
# Enable extensions on systems that normally disable them,
# typically due to standards-conformance issues.
-AC_DEFUN([gl_USE_SYSTEM_EXTENSIONS],
+AC_DEFUN_ONCE([gl_USE_SYSTEM_EXTENSIONS],
[
dnl Require this macro before AC_USE_SYSTEM_EXTENSIONS.
dnl gnulib does not need it. But if it gets required by third-party macros
--
1.6.0.4
- Re: expand-before-require bug, (continued)
Re: expand-before-require bug, Eric Blake, 2009/01/21
Re: expand-before-require bug, Bruno Haible, 2009/01/22
Re: expand-before-require bug, Bruno Haible, 2009/01/25
- Re: expand-before-require bug,
Eric Blake <=
- Re: expand-before-require bug, Bruno Haible, 2009/01/26
- Re: expand-before-require bug, Jim Meyering, 2009/01/28
- Re: expand-before-require bug, Eric Blake, 2009/01/28
- Re: expand-before-require bug, Bruno Haible, 2009/01/28
- Re: expand-before-require bug, Eric Blake, 2009/01/28