Debian Bug report logs - #593838
AX_CFLAGS_GCC_OPTION misuses AS_VAR_PUSHDEF variable

version graph

Package: autoconf-archive; Maintainer for autoconf-archive is Bastien Roucariès <rouca@debian.org>; Source for autoconf-archive is src:autoconf-archive (PTS, buildd, popcon).

Reported by: jgmb65@rezozer.net

Date: Sat, 21 Aug 2010 13:15:01 UTC

Severity: important

Tags: upstream

Merged with 612389

Fixed in version autoconf-archive/20110412-1

Done: Bastien ROUCARIÈS <roucaries.bastien+debian@gmail.com>

Bug is archived. No further changes may be made.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, Ben Pfaff <pfaffben@debian.org>:
Bug#593838; Package autoconf. (Sat, 21 Aug 2010 13:15:04 GMT) (full text, mbox, link).


Acknowledgement sent to jgmb65@rezozer.net:
New Bug report received and forwarded. Copy sent to Ben Pfaff <pfaffben@debian.org>. (Sat, 21 Aug 2010 13:15:04 GMT) (full text, mbox, link).


Message #5 received at submit@bugs.debian.org (full text, mbox, reply):

From: Jerome BENOIT <jgmb65@rezozer.net>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: autoconf: macro AX_CFLAGS_GCC_OPTION does not work with equation argument (as '-std=c99')
Date: Sat, 21 Aug 2010 20:58:28 +0800
Package: autoconf
Version: 2.67-2
Severity: important


Hello,

in my configure.ac files, the line

AX_CFLAGS_GCC_OPTION(-std=c99)

produces a boggus configure script.
Because it appeared that the trouble comes
from the equal (`=`) I guess it is an autoconf
issue: line as

AX_CFLAGS_GCC_OPTION(-Wno-unused-function)

works well.

Note that with the previous version of autoconf (2.65-4) everything
was fine. As a matter of fact, I suspect that the issue may be
related to bug #593546 , but I can not confirm this part of the story.


hth,
Jerome


-- System Information:
Debian Release: Squeeze*
  APT prefers testing
  APT policy: (990, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.34-mbp (SMP w/4 CPU cores)
Locale: LANG=en_GB, LC_CTYPE=en_GB (charmap=ISO-8859-1)
Shell: /bin/sh linked to /bin/bash

Versions of packages autoconf depends on:
ii  debianutils                   3.4        Miscellaneous utilities specific t
ii  m4                            1.4.14-3   a macro processing language
ii  perl                          5.10.1-14  Larry Wall's Practical Extraction 

Versions of packages autoconf recommends:
ii  automake [automaken]    1:1.11.1-1       A tool for generating GNU Standard
ii  automake1.7 [automaken] 1.7.9-9.1        A tool for generating GNU Standard
ii  automake1.9 [automaken] 1.9.6+nogfdl-3.1 A tool for generating GNU Standard

Versions of packages autoconf suggests:
ii  autoconf-archive            20090426-1   The Autoconf Macro Archive
ii  autoconf-doc                2.67-1       automatic configure script builder
ii  autoconf2.13                2.13-60      automatic configure script builder
ii  gettext                     0.18.1.1-1   GNU Internationalization utilities
ii  gnu-standards               2010.03.11-1 GNU coding and package maintenance
ii  libtool                     2.2.6b-2     Generic library support script

-- no debconf information




Information forwarded to debian-bugs-dist@lists.debian.org, Ben Pfaff <pfaffben@debian.org>:
Bug#593838; Package autoconf. (Sat, 21 Aug 2010 13:54:03 GMT) (full text, mbox, link).


Acknowledgement sent to Ralf Wildenhues <Ralf.Wildenhues@gmx.de>:
Extra info received and forwarded to list. Copy sent to Ben Pfaff <pfaffben@debian.org>. (Sat, 21 Aug 2010 13:54:03 GMT) (full text, mbox, link).


Message #10 received at 593838@bugs.debian.org (full text, mbox, reply):

From: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
To: jgmb65@rezozer.net, 593838@bugs.debian.org, bug-autoconf@gnu.org
Subject: Re: Bug#593838: autoconf: macro AX_CFLAGS_GCC_OPTION does not work with equation argument (as '-std=c99')
Date: Sat, 21 Aug 2010 15:52:04 +0200
tags + upstream
thanks

[ http://bugs.debian.org/593838 ]

Hi Jerome,

* Jerome BENOIT wrote on Sat, Aug 21, 2010 at 02:58:28PM CEST:
> Version: 2.67-2

> AX_CFLAGS_GCC_OPTION(-std=c99)
> 
> produces a boggus configure script.

Confirmed with upstream git Autoconf:

cat >configure.ac <<\END
AC_INIT
AX_CFLAGS_GCC_OPTION(-std=c99)
END
aclocal -I /path/to/autoconf-archive/m4
autoconf
./configure

[...]
checking CFLAGS for gcc -std=c99... ./configure: line 2493: ax_cv_cflags_gcc_option__std_c99=no, unknown: command not found
./configure: line 2516: ax_cv_cflags_gcc_option__std_c99=-std=c99: command not found

> Because it appeared that the trouble comes
> from the equal (`=`) I guess it is an autoconf
> issue: line as
> 
> AX_CFLAGS_GCC_OPTION(-Wno-unused-function)
> 
> works well.
> 
> Note that with the previous version of autoconf (2.65-4) everything
> was fine. As a matter of fact, I suspect that the issue may be
> related to bug #593546 , but I can not confirm this part of the story.

Related yes, but #593546 is about '*' and this is about '='.

Thanks for the report,
Ralf




Added tag(s) upstream. Request was from Ralf Wildenhues <Ralf.Wildenhues@gmx.de> to control@bugs.debian.org. (Sat, 21 Aug 2010 14:03:07 GMT) (full text, mbox, link).


Information forwarded to debian-bugs-dist@lists.debian.org, Ben Pfaff <pfaffben@debian.org>:
Bug#593838; Package autoconf. (Mon, 23 Aug 2010 14:15:03 GMT) (full text, mbox, link).


Acknowledgement sent to Eric Blake <eblake@redhat.com>:
Extra info received and forwarded to list. Copy sent to Ben Pfaff <pfaffben@debian.org>. (Mon, 23 Aug 2010 14:15:03 GMT) (full text, mbox, link).


Message #17 received at 593838@bugs.debian.org (full text, mbox, reply):

From: Eric Blake <eblake@redhat.com>
To: jgmb65@rezozer.net, 593838@bugs.debian.org, bug-autoconf@gnu.org, autoconf-archive-maintainers@gnu.org
Subject: Re: Bug#593838: autoconf: macro AX_CFLAGS_GCC_OPTION does not work with equation argument (as '-std=c99')
Date: Mon, 23 Aug 2010 08:11:35 -0600
[adding autoconf-archive list, as owner of the AX_CFLAGS_GCC_OPTION macro]

On 08/21/2010 07:52 AM, Ralf Wildenhues wrote:
> tags + upstream
> thanks
>
> [ http://bugs.debian.org/593838 ]
>
> Hi Jerome,
>
> * Jerome BENOIT wrote on Sat, Aug 21, 2010 at 02:58:28PM CEST:
>> Version: 2.67-2
>
>> AX_CFLAGS_GCC_OPTION(-std=c99)
>>
>> produces a boggus configure script.
>
> Confirmed with upstream git Autoconf:
>
> cat>configure.ac<<\END
> AC_INIT
> AX_CFLAGS_GCC_OPTION(-std=c99)
> END
> aclocal -I /path/to/autoconf-archive/m4
> autoconf
> ./configure
>
> [...]
> checking CFLAGS for gcc -std=c99... ./configure: line 2493: ax_cv_cflags_gcc_option__std_c99=no, unknown: command not found
> ./configure: line 2516: ax_cv_cflags_gcc_option__std_c99=-std=c99: command not found

I'm wondering if the AX_CFLAGS_GCC_OPTION macro is at fault here, or if 
it is a true regression in autoconf.

>
>> Because it appeared that the trouble comes
>> from the equal (`=`) I guess it is an autoconf
>> issue: line as
>>
>> AX_CFLAGS_GCC_OPTION(-Wno-unused-function)
>>
>> works well.
>>
>> Note that with the previous version of autoconf (2.65-4) everything
>> was fine. As a matter of fact, I suspect that the issue may be
>> related to bug #593546 , but I can not confirm this part of the story.
>
> Related yes, but #593546 is about '*' and this is about '='.

I think it is obvious that something changed so that 
AX_CFLAGS_GCC_OPTION is no longer transliterating = into _ when creating 
the cache variable name.  But I don't know where the fault lies without 
seeing the implementation of this macro.

-- 
Eric Blake   eblake@redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org




Information forwarded to debian-bugs-dist@lists.debian.org, Ben Pfaff <pfaffben@debian.org>:
Bug#593838; Package autoconf. (Mon, 23 Aug 2010 15:09:03 GMT) (full text, mbox, link).


Acknowledgement sent to jgmb65@rezozer.net:
Extra info received and forwarded to list. Copy sent to Ben Pfaff <pfaffben@debian.org>. (Mon, 23 Aug 2010 15:09:03 GMT) (full text, mbox, link).


Message #22 received at 593838@bugs.debian.org (full text, mbox, reply):

From: Jerome BENOIT <jgmb65@rezozer.net>
To: Eric Blake <eblake@redhat.com>
Cc: 593838@bugs.debian.org, bug-autoconf@gnu.org, autoconf-archive-maintainers@gnu.org
Subject: Re: Bug#593838: autoconf: macro AX_CFLAGS_GCC_OPTION does not work with equation argument (as '-std=c99')
Date: Mon, 23 Aug 2010 22:45:34 +0800
Hi !

On 23/08/10 22:11, Eric Blake wrote:
> [adding autoconf-archive list, as owner of the AX_CFLAGS_GCC_OPTION macro]
>
> On 08/21/2010 07:52 AM, Ralf Wildenhues wrote:
>> tags + upstream
>> thanks
>>
>> [ http://bugs.debian.org/593838 ]
>>
>> Hi Jerome,
>>
>> * Jerome BENOIT wrote on Sat, Aug 21, 2010 at 02:58:28PM CEST:
>>> Version: 2.67-2
>>
>>> AX_CFLAGS_GCC_OPTION(-std=c99)
>>>
>>> produces a boggus configure script.
>>
>> Confirmed with upstream git Autoconf:
>>
>> cat>configure.ac<<\END
>> AC_INIT
>> AX_CFLAGS_GCC_OPTION(-std=c99)
>> END
>> aclocal -I /path/to/autoconf-archive/m4
>> autoconf
>> ./configure
>>
>> [...]
>> checking CFLAGS for gcc -std=c99... ./configure: line 2493:
>> ax_cv_cflags_gcc_option__std_c99=no, unknown: command not found
>> ./configure: line 2516: ax_cv_cflags_gcc_option__std_c99=-std=c99:
>> command not found
>
> I'm wondering if the AX_CFLAGS_GCC_OPTION macro is at fault here, or if
> it is a true regression in autoconf.
>
>>
>>> Because it appeared that the trouble comes
>>> from the equal (`=`) I guess it is an autoconf
>>> issue: line as
>>>
>>> AX_CFLAGS_GCC_OPTION(-Wno-unused-function)
>>>
>>> works well.
>>>
>>> Note that with the previous version of autoconf (2.65-4) everything
>>> was fine. As a matter of fact, I suspect that the issue may be
>>> related to bug #593546 , but I can not confirm this part of the story.
>>
>> Related yes, but #593546 is about '*' and this is about '='.
>
> I think it is obvious that something changed so that
> AX_CFLAGS_GCC_OPTION is no longer transliterating = into _ when creating
> the cache variable name. But I don't know where the fault lies without
> seeing the implementation of this macro.
>

The macro AX_CFLAGS_GCC_OPTION is the one distributed in the package autoconf-archive (20090426-1),
more specifically this macro is defined in the file`ax_cflags_gcc_option.m4'

hth,
Jerome




Information forwarded to debian-bugs-dist@lists.debian.org, Ben Pfaff <pfaffben@debian.org>:
Bug#593838; Package autoconf. (Tue, 24 Aug 2010 15:36:10 GMT) (full text, mbox, link).


Acknowledgement sent to Vincent Bernat <bernat@debian.org>:
Extra info received and forwarded to list. Copy sent to Ben Pfaff <pfaffben@debian.org>. (Tue, 24 Aug 2010 15:36:10 GMT) (full text, mbox, link).


Message #27 received at 593838@bugs.debian.org (full text, mbox, reply):

From: Vincent Bernat <bernat@debian.org>
To: Debian Bug Tracking System <593838@bugs.debian.org>
Subject: Re: macro AX_CFLAGS_GCC_OPTION does not work with equation argument (as '-std=c99')
Date: Tue, 24 Aug 2010 17:27:33 +0200
[Message part 1 (text/plain, inline)]
Package: autoconf
Version: 2.67-2
Severity: normal

Hi!

I get the very same problem here.

Here is the code produced by an older version of autoconf:

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking CFLAGS for gcc -std=gnu99" >&5
$as_echo_n "checking CFLAGS for gcc -std=gnu99... " >&6; }
if test "${ac_cv_cflags_gcc_option__std_gnu99+set}" = set; then :
  $as_echo_n "(cached) " >&6
else
  ac_cv_cflags_gcc_option__std_gnu99="no, unknown"

With autoconf 2.67, we get:

as_VAR=`$as_echo "ac_cv_cflags_gcc_option_-std=gnu99" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking CFLAGS for gcc -std=gnu99" >&5
$as_echo_n "checking CFLAGS for gcc -std=gnu99... " >&6; }
if eval "test \"\${$as_VAR+set}\"" = set; then :
  $as_echo_n "(cached) " >&6
else
  $as_VAR="no, unknown"

I suppose that $as_VAR is an invalid assignment:

$ i=j
$ $i=4
sh: j=4: not found

I don't understand why autoconf is doing the substitution at runtime
instead of doing statically like it was doing before.
AX_CFLAGS_GCC_OPTION macro starts with:

AC_DEFUN([AX_CFLAGS_GCC_OPTION_OLD], [dnl
AS_VAR_PUSHDEF([FLAGS],[CFLAGS])dnl
AS_VAR_PUSHDEF([VAR],[ac_cv_cflags_gcc_option_$2])dnl
AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for gcc m4_ifval($2,$2,-option)],
VAR,[VAR="no, unknown"
 AC_LANG_SAVE

Maybe the assignment to VAR should be replaed by AS_VAR_SET call? VAR
is also used with "$VAR". Nested substitution is not allowed. This
could be replaced with AS_VAR_COPY.

I attach a patch that I got by trial and error. Notably, I use ac_res
as a variable to store the content of VAR. I don't know if it is a
safe method since I am no autoconf guru.

-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-5-amd64 (SMP w/1 CPU core)
Locale: LANG=fr_FR.utf8, LC_CTYPE=fr_FR.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages autoconf depends on:
ii  debianutils                   3.4        Miscellaneous utilities specific t
ii  m4                            1.4.14-3   a macro processing language
ii  perl                          5.10.1-14  Larry Wall's Practical Extraction 

Versions of packages autoconf recommends:
ii  automake [automaken]    1:1.11.1-1       A tool for generating GNU Standard
ii  automake1.9 [automaken] 1.9.6+nogfdl-3.1 A tool for generating GNU Standard

Versions of packages autoconf suggests:
ii  autoconf-archive            20090426-1   The Autoconf Macro Archive
ii  autoconf-doc                2.67-1       automatic configure script builder
pn  autoconf2.13                <none>       (no description available)
ii  gettext                     0.18.1.1-1   GNU Internationalization utilities
ii  gnu-standards               2010.03.11-1 GNU coding and package maintenance
ii  libtool                     2.2.6b-2     Generic library support script

-- no debconf information
[ax_cflags_gcc_options.patch (text/x-diff, attachment)]

Information forwarded to debian-bugs-dist@lists.debian.org, Ben Pfaff <pfaffben@debian.org>:
Bug#593838; Package autoconf. (Tue, 24 Aug 2010 15:51:03 GMT) (full text, mbox, link).


Acknowledgement sent to Vincent Bernat <bernat@luffy.cx>:
Extra info received and forwarded to list. Copy sent to Ben Pfaff <pfaffben@debian.org>. (Tue, 24 Aug 2010 15:51:03 GMT) (full text, mbox, link).


Message #32 received at 593838@bugs.debian.org (full text, mbox, reply):

From: Vincent Bernat <bernat@luffy.cx>
To: Vincent Bernat <bernat@debian.org>
Cc: Debian Bug Tracking System <593838@bugs.debian.org>
Subject: Re: macro AX_CFLAGS_GCC_OPTION does not work with equation argument (as '-std=c99')
Date: Tue, 24 Aug 2010 17:48:35 +0200
On Tue, 24 Aug 2010 17:27:33 +0200, Vincent Bernat <bernat@debian.org>
wrote:

> I attach a patch that I got by trial and error. Notably, I use ac_res
> as a variable to store the content of VAR. I don't know if it is a
> safe method since I am no autoconf guru.

The patch contains additional stuff that should be ignored. Only the
changes to ax_cflags_gcc_options.m4 are concerned. :)




Changed Bug title to 'AX_CFLAGS_GCC_OPTION misuses AS_VAR_PUSHDEF variable' from 'autoconf: macro AX_CFLAGS_GCC_OPTION does not work with equation argument (as '-std=c99')' Request was from Ben Pfaff <blp@cs.stanford.edu> to control@bugs.debian.org. (Sat, 25 Sep 2010 18:27:03 GMT) (full text, mbox, link).


Bug reassigned from package 'autoconf' to 'autoconf-archive'. Request was from Ben Pfaff <blp@cs.stanford.edu> to control@bugs.debian.org. (Sat, 25 Sep 2010 18:27:04 GMT) (full text, mbox, link).


Bug No longer marked as found in versions autoconf/2.67-2. Request was from Ben Pfaff <blp@cs.stanford.edu> to control@bugs.debian.org. (Sat, 25 Sep 2010 18:27:04 GMT) (full text, mbox, link).


Information forwarded to debian-bugs-dist@lists.debian.org, Qingning Huo <qhuo@mayhq.co.uk>:
Bug#593838; Package autoconf-archive. (Sat, 25 Sep 2010 18:57:06 GMT) (full text, mbox, link).


Acknowledgement sent to Ben Pfaff <blp@cs.stanford.edu>:
Extra info received and forwarded to list. Copy sent to Qingning Huo <qhuo@mayhq.co.uk>. (Sat, 25 Sep 2010 18:57:06 GMT) (full text, mbox, link).


Message #43 received at 593838@bugs.debian.org (full text, mbox, reply):

From: Ben Pfaff <blp@cs.stanford.edu>
To: control@bugs.debian.org, 593838@bugs.debian.org
Cc: Jerome BENOIT <jgmb65@rezozer.net>, Ralf Wildenhues <Ralf.Wildenhues@gmx.de>, bug-autoconf@gnu.org, autoconf-archive-maintainers@gnu.org, Eric Blake <eblake@redhat.com>, Vincent Bernat <bernat@debian.org>
Subject: Bug #593838: AX_CFLAGS_GCC_OPTION misuses AS_VAR_PUSHDEF variable
Date: Sat, 25 Sep 2010 11:22:40 -0700
retitle 593838 AX_CFLAGS_GCC_OPTION misuses AS_VAR_PUSHDEF variable
reassign 593838 autoconf-archive
thanks

Jerome BENOIT <jgmb65@rezozer.net> initially reported that
AX_CFLAGS_GCC_OPTION(-std=c99) fails with Autoconf 2.67.  Vincent
Bernat <bernat@debian.org> determined that the bug could be fixed
by replacing a literal shell assignment by AS_VAR_SET.

Just now, I took a closer look.  I was able to reduce the problem
to the following trivial case:

--8<--------------------------cut here-------------------------->8--
AC_DEFUN([MY_MACRO], 
  [AS_VAR_PUSHDEF([VAR],[prefix_$1])

   dnl This is the version used by AX_CFLAGS_GCC_OPTION.
   dnl I believe that it is incorrect.  It does not work on Autoconf >= 2.67.
   VAR=the_value

   dnl This version works.
   dnl AS_VAR_SET([VAR], [the_value])

   AS_VAR_POPDEF([VAR])])

AC_INIT
MY_MACRO([a=b])
--8<--------------------------cut here-------------------------->8--

If I comment out the first version and uncomment the second
version, it works.

The documentation in the Autoconf manual for AS_VAR_PUSHDEF says
this:

 -- Macro: AS_VAR_PUSHDEF (M4-NAME, VALUE)
 -- Macro: AS_VAR_POPDEF (M4-NAME)
     A common M4sh idiom involves composing shell variable names from
     an m4 argument (for example, writing a macro that uses a cache
     variable).  VALUE can be an arbitrary string, which will be
     transliterated into a valid shell name by `AS_TR_SH'.  In order to
     access the composed variable name based on VALUE, it is easier to
     declare a temporary m4 macro M4-NAME with `AS_VAR_PUSHDEF', then
     use that macro as the argument to subsequent `AS_VAR' macros as a
     polymorphic variable name, and finally free the temporary macro
     with `AS_VAR_POPDEF'.  These macros are often followed with `dnl',
     to avoid excess newlines in the output.

     Here is an involved example, that shows the power of writing
     macros that can handle composed shell variable names:

          m4_define([MY_CHECK_HEADER],
          [AS_VAR_PUSHDEF([my_Header], [ac_cv_header_$1])dnl
          AS_VAR_IF([my_Header], [yes], [echo "header $1 available"])dnl
          AS_VAR_POPDEF([my_Header])dnl
          ])
          MY_CHECK_HEADER([stdint.h])
          for header in inttypes.h stdlib.h ; do
            MY_CHECK_HEADER([$header])
          done

This description says one may "use that macro as the argument to
subsequent `AS_VAR' macros as a polymorphic variable name", not
that one may use the M4-NAME literally.  The example that it
gives also shows the specific M4-NAME of my_Header used only as
a polymorphic variable argument, not as a literal shell variable.

On that basis, I infer that one is not supposed to use the
M4-NAME literally, and thus I believe that this is a bug in
AX_CFLAGS_GCC_OPTION.  So, I am reassigning this bug to
autoconf-archive (with this email).

If I am making any bad assumptions here, please correct me.

Thanks,

Ben.
-- 
Ben Pfaff 
http://benpfaff.org




Information forwarded to debian-bugs-dist@lists.debian.org, Qingning Huo <qhuo@mayhq.co.uk>:
Bug#593838; Package autoconf-archive. (Mon, 27 Sep 2010 17:51:02 GMT) (full text, mbox, link).


Acknowledgement sent to Eric Blake <eblake@redhat.com>:
Extra info received and forwarded to list. Copy sent to Qingning Huo <qhuo@mayhq.co.uk>. (Mon, 27 Sep 2010 17:51:02 GMT) (full text, mbox, link).


Message #48 received at 593838@bugs.debian.org (full text, mbox, reply):

From: Eric Blake <eblake@redhat.com>
To: Ben Pfaff <blp@cs.stanford.edu>
Cc: control@bugs.debian.org, 593838@bugs.debian.org, Jerome BENOIT <jgmb65@rezozer.net>, Ralf Wildenhues <Ralf.Wildenhues@gmx.de>, bug-autoconf@gnu.org, autoconf-archive-maintainers@gnu.org, Vincent Bernat <bernat@debian.org>
Subject: Re: Bug #593838: AX_CFLAGS_GCC_OPTION misuses AS_VAR_PUSHDEF variable
Date: Mon, 27 Sep 2010 11:46:50 -0600
On 09/25/2010 12:22 PM, Ben Pfaff wrote:
> retitle 593838 AX_CFLAGS_GCC_OPTION misuses AS_VAR_PUSHDEF variable
> reassign 593838 autoconf-archive
> thanks
>
> Jerome BENOIT<jgmb65@rezozer.net>  initially reported that
> AX_CFLAGS_GCC_OPTION(-std=c99) fails with Autoconf 2.67.  Vincent
> Bernat<bernat@debian.org>  determined that the bug could be fixed
> by replacing a literal shell assignment by AS_VAR_SET.
>
> Just now, I took a closer look.  I was able to reduce the problem
> to the following trivial case:
>
> --8<--------------------------cut here-------------------------->8--
> AC_DEFUN([MY_MACRO],
>    [AS_VAR_PUSHDEF([VAR],[prefix_$1])
>
>     dnl This is the version used by AX_CFLAGS_GCC_OPTION.
>     dnl I believe that it is incorrect.  It does not work on Autoconf>= 2.67.
>     VAR=the_value

You are correct that this will not work if VAR is an indirect variable 
name.  It all depends on whether $1 is determined to be an indirection.

MY_MACRO([blah])

is direct; it expands to AS_VAR_PUSHDEF([VAR],[prefix_blah]), at which 
point VAR is the literal string prefix_blah, and you still have valid 
shell code (by sheer luck, and not because you followed the 
documentation).  But

foo=bar
MY_MACRO([$foo])

is indirect; it expands to AS_VAR_PUSHDEF([VAR],[prefix_$foo]), and you 
MUST use AS_VAR_SET([VAR]) in order to set the shell variable prefix_bar 
(as that is what the indirection results in).  Direct use of VAR as a 
shell-variable name will result in invalid shell code.

>
> On that basis, I infer that one is not supposed to use the
> M4-NAME literally, and thus I believe that this is a bug in
> AX_CFLAGS_GCC_OPTION.  So, I am reassigning this bug to
> autoconf-archive (with this email).

That is the correct course of action.

-- 
Eric Blake   eblake@redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org




Information forwarded to debian-bugs-dist@lists.debian.org, Qingning Huo <qhuo@mayhq.co.uk>:
Bug#593838; Package autoconf-archive. (Fri, 08 Oct 2010 17:57:06 GMT) (full text, mbox, link).


Acknowledgement sent to Eric Blake <eblake@redhat.com>:
Extra info received and forwarded to list. Copy sent to Qingning Huo <qhuo@mayhq.co.uk>. (Fri, 08 Oct 2010 17:57:06 GMT) (full text, mbox, link).


Message #53 received at 593838@bugs.debian.org (full text, mbox, reply):

From: Eric Blake <eblake@redhat.com>
To: autoconf-patches@gnu.org
Cc: 593838@bugs.debian.org, jgmb65@rezozer.net, autoconf-archive-maintainers@gnu.org, blp@cs.stanford.edu
Subject: [PATCH] AS_LITERAL_IF: Treat raw = as literal again.
Date: Fri, 8 Oct 2010 11:54:45 -0600
* lib/m4sugar/m4sh.m4 (_AS_LITERAL_IF): Treat = like +.
* tests/m4sh.at (AS@&t@_TR_SH and AS@&t@_TR_CPP)
(AS@&t@_LITERAL_IF): Expand tests.
* NEWS: Document the fix.
Reported via Ben Pfaff; originally http://bugs.debian.org/593838

Signed-off-by: Eric Blake <eblake@redhat.com>
---

It turns out that the original Debian bug report is two for the price
of one.  In autoconf-archive, AX_CFLAGS_GCC_OPTION was using an
AS_VAR_PUSHDEF'd variable incorrectly, according to the documentation.
And in Autoconf, there was indeed a regression where = was no longer
treated as a literal character to be transliterated into _ at m4 time.
This fixes the autoconf side of the equation, and adds tests to avoid
future regressions.

 ChangeLog           |    9 +++++++++
 NEWS                |    3 +++
 lib/m4sugar/m4sh.m4 |    4 ++--
 tests/m4sh.at       |   36 ++++++++++++++++++++++++++----------
 4 files changed, 40 insertions(+), 12 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 576f615..609846a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2010-10-08  Eric Blake  <eblake@redhat.com>
+
+	AS_LITERAL_IF: Treat raw = as literal again.
+	* lib/m4sugar/m4sh.m4 (_AS_LITERAL_IF): Treat = like +.
+	* tests/m4sh.at (AS@&t@_TR_SH and AS@&t@_TR_CPP)
+	(AS@&t@_LITERAL_IF): Expand tests.
+	* NEWS: Document the fix.
+	Reported via Ben Pfaff; originally http://bugs.debian.org/593838
+
 2010-09-24  Joshua G. Hale  <jgh.emc@gmail.com>  (tiny change)

 	docs: fix typo in AC_CONFIG_FILES example code.
diff --git a/NEWS b/NEWS
index a3a50d6..6b62542 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,9 @@ GNU Autoconf NEWS - User visible changes.

 * Noteworthy changes in release ?.? (????-??-??) [?]

+** AS_LITERAL_IF again treats '=' as a literal.  Regression introduced in
+   2.66.
+

 * Noteworthy changes in release 2.68 (2010-09-22) [stable]
   Released by Eric Blake, based on git versions 2.67.*.
diff --git a/lib/m4sugar/m4sh.m4 b/lib/m4sugar/m4sh.m4
index 13ad849..3c9350a 100644
--- a/lib/m4sugar/m4sh.m4
+++ b/lib/m4sugar/m4sh.m4
@@ -1584,8 +1584,8 @@ m4_define([AS_LITERAL_IF],

 m4_define([_AS_LITERAL_IF],
 [m4_if(m4_index([$1], [@S|@]), [-1], [$0_(m4_translit([$1],
-  [-:%/@{}[]#(),.$2]]]m4_dquote(m4_dquote(m4_defn([m4_cr_symbols2])))[[,
-  [+++++$$`````]))], [$0_NO])])
+  [-:=%/@{}[]#(),.$2]]]m4_dquote(m4_dquote(m4_defn([m4_cr_symbols2])))[[,
+  [++++++$$`````]))], [$0_NO])])

 m4_define([_AS_LITERAL_IF_],
 [m4_if(m4_translit([$1], [+]), [], [$0YES],
diff --git a/tests/m4sh.at b/tests/m4sh.at
index 08680c3..c01027f 100644
--- a/tests/m4sh.at
+++ b/tests/m4sh.at
@@ -1278,6 +1278,10 @@ echo AS_LITERAL_HEREDOC_IF([(a)], [ok], [ERR]) 20
 echo AS_LITERAL_IF([@S|@a], [ERR], [ok]) 21
 echo AS_LITERAL_WORD_IF([@S|@a], [ERR], [ok]) 22
 echo AS_LITERAL_HEREDOC_IF([@S|@a], [ERR], [ok]) 23
+echo AS_LITERAL_IF([${a+b}], [ERR1], [ok], [ERR2]) 24
+echo AS_LITERAL_IF([${a=b}], [ERR1], [ok], [ERR2]) 25
+echo AS_LITERAL_IF([a+b], [ok], [ERR1], [ERR2]) 26
+echo AS_LITERAL_IF([a=b], [ok], [ERR1], [ERR2]) 27
 ]])

 AT_CHECK_M4SH
@@ -1305,6 +1309,10 @@ ok 20
 ok 21
 ok 22
 ok 23
+ok 24
+ok 25
+ok 26
+ok 27
 ]])

 AT_CLEANUP
@@ -1342,12 +1350,13 @@ echo AS_TR_CPP(`echo abc`) AS_TR_CPP(`echo aBc`) AS_TR_CPP(`echo ABC`)
 echo AS_TR_CPP([`echo abc`]) AS_TR_CPP([`echo aBc`]) AS_TR_CPP([`echo ABC`])
 echo AS_TR_CPP([[`echo abc`]]) AS_TR_CPP([[`echo aBc`]]) AS_TR_CPP([[`echo ABC`]])
 echo ===
-echo AS_TR_SH([a.b/c+*-])
-echo AS_TR_CPP([a.b/c+*-])
-var=a.b/c+*-
+# start here
+echo AS_TR_SH([a.b/c+*-=])
+echo AS_TR_CPP([a.b/c+*-=])
+var=a.b/c+*-=
 echo AS_TR_SH([$var])
 echo AS_TR_CPP([$var])
-m4_define([macro], [a.b/c+*-])
+m4_define([macro], [a.b/c+*-=])
 echo AS_TR_SH([macro])
 echo AS_TR_CPP([macro])
 ]])
@@ -1375,12 +1384,19 @@ HI ABC HI
 HI ABC HI
 ABC ABC ABC
 ===
-a_b_cpp_
-A_B_C_P_
-a_b_cpp_
-A_B_C_P_
-a_b_cpp_
-A_B_C_P_
+a_b_cpp__
+A_B_C_P__
+a_b_cpp__
+A_B_C_P__
+a_b_cpp__
+A_B_C_P__
+]])
+
+dnl Check that of the last 6 macros, only 2 needed command substitution.
+dnl This test abuses our knowledge of m4sh internals a bit; oh well.
+AT_CHECK([sed -n '/start here/,$ {
+/`.*`/p
+}' script | wc -l], [], [[2
 ]])

 AT_CLEANUP
-- 
1.7.2.3





Forcibly Merged 593838 612389. Request was from blp@cs.stanford.edu (Ben Pfaff) to control@bugs.debian.org. (Wed, 09 Feb 2011 17:00:07 GMT) (full text, mbox, link).


Reply sent to Bastien ROUCARIÈS <roucaries.bastien+debian@gmail.com>:
You have taken responsibility. (Fri, 15 Jul 2011 09:03:53 GMT) (full text, mbox, link).


Notification sent to jgmb65@rezozer.net:
Bug acknowledged by developer. (Fri, 15 Jul 2011 09:03:53 GMT) (full text, mbox, link).


Message #60 received at 593838-close@bugs.debian.org (full text, mbox, reply):

From: Bastien ROUCARIÈS <roucaries.bastien+debian@gmail.com>
To: 593838-close@bugs.debian.org
Subject: Bug#593838: fixed in autoconf-archive 20110412-1
Date: Fri, 15 Jul 2011 09:02:18 +0000
Source: autoconf-archive
Source-Version: 20110412-1

We believe that the bug you reported is fixed in the latest version of
autoconf-archive, which is due to be installed in the Debian FTP archive:

autoconf-archive_20110412-1.debian.tar.bz2
  to main/a/autoconf-archive/autoconf-archive_20110412-1.debian.tar.bz2
autoconf-archive_20110412-1.dsc
  to main/a/autoconf-archive/autoconf-archive_20110412-1.dsc
autoconf-archive_20110412-1_all.deb
  to main/a/autoconf-archive/autoconf-archive_20110412-1_all.deb
autoconf-archive_20110412.orig.tar.bz2
  to main/a/autoconf-archive/autoconf-archive_20110412.orig.tar.bz2



A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 593838@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Bastien ROUCARIÈS <roucaries.bastien+debian@gmail.com> (supplier of updated autoconf-archive package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Format: 1.8
Date: Sun, 26 Jun 2011 21:37:32 +0200
Source: autoconf-archive
Binary: autoconf-archive
Architecture: source all
Version: 20110412-1
Distribution: unstable
Urgency: low
Maintainer: Bastien ROUCARIÈS <roucaries.bastien+debian@gmail.com>
Changed-By: Bastien ROUCARIÈS <roucaries.bastien+debian@gmail.com>
Description: 
 autoconf-archive - Autoconf Macro Archive
Closes: 214089 568413 572669 584180 593838 622369
Changes: 
 autoconf-archive (20110412-1) unstable; urgency=low
 .
   * New upstream version (Closes: 568413):
     - Bug fix: "AX_BOOST macros contain bashisms", thanks to Olaf Meeuwissen
       (Closes: #584180).
     - Bug fix: "AX_CFLAGS_GCC_OPTION misuses AS_VAR_PUSHDEF variable",
       thanks to jgmb65@rezozer.net; (Closes: #593838).
     - switch upstream web site (Closes: 214089)
     - Bug fix: "with dash as shell, ax_prefix_config_h has a wrong
       behavior", thanks to Jean-Pierre Flori (Closes: #622369).
     - Fix problem with ax_boost_unit_test_framework (LP: #391092)
   * Qingning Huo <qhuo@mayhq.co.uk> has retired
     (Closes: #572669).
   * Add myself as maintainer with permission of Deng Xiyue
   * Use DEP5 copyright file
   * Use cdbs
   * Bump standard-version
Checksums-Sha1: 
 9c8a67ee66f672e15816c16ba00211073b7a4f5a 1362 autoconf-archive_20110412-1.dsc
 fa0824674c64354fe290cf8dac085912923f572a 629971 autoconf-archive_20110412.orig.tar.bz2
 81787828dcccfd1d4a2a03eb649f19f071ce562f 15876 autoconf-archive_20110412-1.debian.tar.bz2
 1c8abacda62357910e027d3ef848535b1e7a8bef 808366 autoconf-archive_20110412-1_all.deb
Checksums-Sha256: 
 70a943dc4dcec67c49caba2ba15a0cc9e1b87b3254215765ed91c5b79a91330b 1362 autoconf-archive_20110412-1.dsc
 59b304f42c806840db121d7077046275e572136359445537bc1ae3f82bb316b6 629971 autoconf-archive_20110412.orig.tar.bz2
 462d5696f16b38f62f88b6b52f59e3134f8f1927d98d5363cb4ccc0d19093adb 15876 autoconf-archive_20110412-1.debian.tar.bz2
 dfbfcd0d9ca6c08ca7f913b04caf5833cfe5d4e9e92be7cb18a49efafa9bdfd8 808366 autoconf-archive_20110412-1_all.deb
Files: 
 71cf37b83eaabd84660531c50d1f2e4e 1362 devel optional autoconf-archive_20110412-1.dsc
 735e884b4419caf53d4445d1f554930e 629971 devel optional autoconf-archive_20110412.orig.tar.bz2
 7b15d47b3f91fabe7ed67dba05f9cdeb 15876 devel optional autoconf-archive_20110412-1.debian.tar.bz2
 37702cf8ffbc32914d9aeae8b7c8439e 808366 devel optional autoconf-archive_20110412-1_all.deb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iD8DBQFOH/53vdkzt4X+wX8RAlwRAJwP1RRKeb4j4p9OrL9xX2En4lHTUwCdE/us
gHtVhSVH8G4pTK2qJHtjLzk=
=J1yQ
-----END PGP SIGNATURE-----





Reply sent to Bastien ROUCARIÈS <roucaries.bastien+debian@gmail.com>:
You have taken responsibility. (Fri, 15 Jul 2011 09:04:00 GMT) (full text, mbox, link).


Notification sent to LACROIX Jean Marc <jeanmarc.lacroix@free.fr>:
Bug acknowledged by developer. (Fri, 15 Jul 2011 09:04:04 GMT) (full text, mbox, link).


Bug archived. Request was from Debbugs Internal Request <owner@bugs.debian.org> to internal_control@bugs.debian.org. (Sat, 13 Aug 2011 07:33:48 GMT) (full text, mbox, link).


Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Sat Dec 23 10:23:02 2023; Machine Name: bembo

Debian Bug tracking system

Debbugs is free software and licensed under the terms of the GNU Public License version 2. The current version can be obtained from https://bugs.debian.org/debbugs-source/.

Copyright © 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson, 2005-2017 Don Armstrong, and many other contributors.