autoconf
[Top][All Lists]
Advanced

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

Re: Suppressing default #defines created by autoheader


From: Alexander Konovalenko
Subject: Re: Suppressing default #defines created by autoheader
Date: Wed, 5 Jun 2002 04:53:07 -0700 (PDT)

--- Paul Eggert <address@hidden> wrote:
> > From: Alexander Konovalenko <address@hidden>
> > Date: Fri, 31 May 2002 06:04:50 -0700 (PDT)
> > 
> > I have a C++ program using autoconf and automake, and I 
> > would like to generate a config.h that will include my
> > package meta-info as const char* variables instead of 
> > C macros.
> 
> I don't offhand know how to suppress the #undef's, but can't you
> do something like this?
> 
> myconfig.h:
> #include "config.h"
> static char const my_PACKAGE[] = PACKAGE;
> 
> and then use "myconfig.h" and my_PACKAGE in the rest of your source?
> There is a style of C++ that prefers not to use the C preprocessor at
> all; is that what's going on here?
> If so, it seems to me that you'd need to modify Autoconf quite a bit.

I've found a very simple solution for my problem.  The above suggestion
is not enough since the point in C++ is not to use any macros that can 
be avoided, especially with potentially conflicting names.  Since I 
do not want to suppress all the macros but only some known ones, I 
can simply wrap them into C++-style const char's and then #undef them.
I do this in a wrapper `config.hpp' header file which #includes 
the autoheader-generated `config.h'.  The other code only #includes
`config.hpp'.

That's all.
Thank you for your reply, Paul.

Regards,
  Alexander Konovalenko.



__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com



reply via email to

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