bug-autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

quoting bug in definition of AC_DEFINE and AC_DEFINE_UNQUOTED


From: Bruno Haible
Subject: quoting bug in definition of AC_DEFINE and AC_DEFINE_UNQUOTED
Date: Mon, 1 Jun 2009 12:07:10 +0200
User-agent: KMail/1.9.9

Hi,

The first argument passed to AC_DEFINE or AC_DEFINE_UNQUOTED is subject
to m4 macro expansion.

To reproduce:
- Use autoconf 2.63.
$ cat > configure.ac <<\EOF
AC_INIT
AC_CONFIG_HEADER([config.h])
m4_define([PETER], [SIMSALABIM])
m4_define([PAUL], [OPENSESAME])
AC_DEFINE([PETER], [10], [Peter's public info])
AC_DEFINE_UNQUOTED([PAUL], [`expr 4 + 6`], [Paul's public info])
AC_OUTPUT
EOF
$ autoconf
$ autoheader
$ grep SIMSALABIM configure config.h.in 
configure:#define SIMSALABIM 10
$ grep OPENSESAME configure config.h.in 
configure:#define OPENSESAME `expr 4 + 6`
$ ./configure 
configure: creating ./config.status
config.status: creating config.h
$ grep PETER config.status config.h
config.h:/* #undef PETER */
$ grep PAUL config.status config.h
config.h:/* #undef PAUL */
$ grep SIMSALABIM config.status config.h
config.status:D["SIMSALABIM"]=" 10"
$ grep OPENSESAME config.status config.h
config.status:D["OPENSESAME"]=" 10"

So it appears that the unexpanded argument is put into config.h.in
but
  1) the expanded argument is used in confdefs.h at configure time,
  2) the expanded argument is used in config.status (which has no
     effect because the config.h.in contains the unexpanded argument).

Should the unexpanded argument be used everywhere, or should the expanded
argument be used everywhere?

This is a long-standing bug. It exists at least since autoconf 2.53.

Bruno




reply via email to

[Prev in Thread] Current Thread [Next in Thread]