According to Bruno Haible on 2/20/2010 7:48 PM:
> Hi Eric,
> 
> There seems to be a bug in warn-on-use.m4 when used with autoconf-2.60.
> No problem with autoconf-2.61 and newer.

Thanks for the report.

> 
> How to reproduce:
>   - Put autoconf 2.60 binaries in PATH.
>   - Use automake 1.10 or 1.9.6.
>   - $ ./gnulib-tool --create-testdir --dir=/tmp/testdir sys_stat
>   - $ cd /tmp/testdir
>   - $ ./configure

>      if test x"$$as_gl_Symbol" = x""yes; then
<====== BUG
>
> As you can see, all uses of $as_gl_Symbol are broken.

Especially nice to give a formula.  It's due to what I would describe as a
bug fix in 2.61 semantics of AS_VAR_PUSHDEF (back then, the AS_VAR_*
interfaces were undocumented).  Newer autoconf auto-dereferences the
argument given to AS_LITERAL_IF (that is, it uses enough m4 black magic to
see through quoted macro names, so that clients can follow normal
rule-of-thumb quoting), but older autoconf required that you under-quote
the argument.  In general, pre-expansion is risky if the macro contents
contain m4 metacharacters or other macro names, but in the case of
AS_VAR_*, the macro contents are safe and do not cause further expansion
issues.

If you didn't understand any of that, all you need to know is that this
patch has been tested with both autoconf 2.59 and 2.65; the resulting
configure files use proper eval statements in all cases where gl_Symbol is
used.

-- 
Don't work too hard, make some time for fun as well!

Eric Blake             e...@byu.net
From 801e7da121dc91ff6b0602ae68a10d910914e7d9 Mon Sep 17 00:00:00 2001
From: Eric Blake <ebl...@redhat.com>
Date: Tue, 23 Feb 2010 10:57:38 -0700
Subject: [PATCH] warn-on-use: work with old autoconf

Before autoconf documented the AS_VAR_* interfaces, it used to
require the user to pre-expand the pushed macro name.  Newer
autoconf can see through macros, but this is one case where
breaking the rule of thumb and underquoting does not hurt.

* m4/warn-on-use.m4 (gl_WARN_ON_USE_PREPARE): Accomodate older
AS_VAR semantics of autoconf 2.60.
Reported by Bruno Haible.

Signed-off-by: Eric Blake <ebl...@redhat.com>
---
 ChangeLog         |    5 +++++
 m4/warn-on-use.m4 |    8 ++++----
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index f47da8c..501c267 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2010-02-23  Eric Blake  <ebl...@redhat.com>

+       warn-on-use: work with old autoconf
+       * m4/warn-on-use.m4 (gl_WARN_ON_USE_PREPARE): Accomodate older
+       AS_VAR semantics of autoconf 2.60.
+       Reported by Bruno Haible.
+
        bootstrap: improve some comments
        * build-aux/bootstrap: Drop unneeded emacs hint.  Add some
        clarification comments.
diff --git a/m4/warn-on-use.m4 b/m4/warn-on-use.m4
index ab46422..42daae8 100644
--- a/m4/warn-on-use.m4
+++ b/m4/warn-on-use.m4
@@ -1,4 +1,4 @@
-# warn-on-use.m4 serial 1
+# warn-on-use.m4 serial 2
 dnl Copyright (C) 2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -30,12 +30,12 @@ AC_DEFUN([gl_WARN_ON_USE_PREPARE],
   for gl_func in m4_flatten([$2]); do
     AS_VAR_PUSHDEF([gl_Symbol], [gl_cv_have_raw_decl_$gl_func])dnl
     AC_CACHE_CHECK([whether $gl_func is declared without a macro],
-      [gl_Symbol],
+      gl_Symbol,
       [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([$1],
 [...@%:@undef $gl_func
   (void) $gl_func;])],
-        [AS_VAR_SET([gl_Symbol], [yes])], [AS_VAR_SET([gl_Symbol], [no])])])
-     AS_VAR_IF([gl_Symbol], [yes],
+        [AS_VAR_SET(gl_Symbol, [yes])], [AS_VAR_SET(gl_Symbol, [no])])])
+     AS_VAR_IF(gl_Symbol, [yes],
        [AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_RAW_DECL_$gl_func]), [1])
        dnl shortcut - if the raw declaration exists, then set a cache
        dnl variable to allow skipping any later AC_CHECK_DECL efforts
-- 
1.6.6.1

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to