bug-autoconf
[Top][All Lists]
Advanced

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

Re: autoconf 2.61: AC_DEFINE variable with parenthesis


From: Stepan Kasal
Subject: Re: autoconf 2.61: AC_DEFINE variable with parenthesis
Date: Fri, 15 Dec 2006 15:46:50 +0100
User-agent: Mutt/1.4.2.1i

[ This is part 1 of 2 of my answer to the report. ]

Hello,

On Thu, Dec 14, 2006 at 02:32:54PM +0200, Andrey Simonenko wrote:
> There is something different between 2.59 and 2.61 versions,

indeed, you have discovered a regression, thank you.

My reply comes in two mails; this one explains the solution to the
problem reported, the other one analyses the regression.

> Why DEF is defined two times in config.h and why ABC is not defined
> two times?

This question shows a misunderstanding: each of the line in the
config.h.in is processed independently; it's just a pure coincidence
when the earlier one is processed and the later one is passed
untouched.

In general, all #undef and #define directives are in danger that
configure might modify them, so config.h.in should not contain any
additional definitions.

Please modify your templates this way:

---- config.h.in:
# undef ABC
# undef DEF
#include <addendum.h>
--------------

---- addendum.h:
#ifdef lint
/* The undefs prevent warnings. */
# undef ABC
# undef DEF
# define ABC
# define DEF(x)
#endif /* lint */
--------------

addendum.h is safe; configure won't touch it.

The template file is usually created by autoheader; to get a template
like the above, use:

------ configure.ac:
AC_INIT([TEST], [1], [somebody])
dnl The third parameter describes the define.
AC_DEFINE([ABC], [something], [Define ABC to a thing.])
AC_DEFINE([DEF(x)], [somevalue], [A macro to do a woo.])
AC_CONFIG_HEADERS([config.h])
AC_OUTPUT
---------

Hope this helps,
        Stepan




reply via email to

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