autoconf
[Top][All Lists]
Advanced

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

Re: If-statement influencing syntax/content in config.h? Naming convent


From: Eric Blake
Subject: Re: If-statement influencing syntax/content in config.h? Naming convention for preprocessor variables.
Date: Fri, 30 Apr 2010 11:46:25 -0600
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.9) Gecko/20100330 Fedora/3.0.4-1.fc12 Lightning/1.0b1 Thunderbird/3.0.4

On 04/30/2010 11:32 AM, Lukas Kaser wrote:
[slightly reorganized, to make my reply flow better]

> 
> => config.h
> /* Whether compiled with NEWRENDERER */
> /* #undef COMPILE_NEWRENDERER_RENDERER */ dnl ############# <-- here

This is the default action if the configure script never reaches an
AC_DEFINE* for that variable.

> [configure.ac]
> if test x$build_newrenderer = xtrue ; then
>         AC_DEFINE_UNQUOTED([COMPILE_NEWRENDERER_RENDERER],
> [${build_newrenderer}], [Whether compiled with NEWRENDERER])
> fi

In this case, if $build_newrenderer is not true, then the AC_DEFINE is
unreached, explaining why config.h ends up with the default behavior.

> 
> dnl if test x$build_newrenderer = xtrue ; then
>         AC_DEFINE_UNQUOTED([COMPILE_NEWRENDERER_RENDERER],
> [${build_newrenderer}], [Whether compiled with NEWRENDERER])
> dnl fi

Here, the AC_DEFINE is reached unconditionally, which explains why:

> 
> => config.h
> /* Whether compiled with NEWRENDERER */
> #define COMPILE_NEWRENDERER_RENDERER false  dnl ############# <-- here

you get an unconditional substitution, whether $build_newrenderer was
true or false.

> Second I would like to know how the naming conventions are. Does most
> of the people follow the naming-convention "HAVE_VAR_NAME" for
> config.h?.

As long as the name doesn't conflict with other names defined
automatically by autoconf, and reads well in your usage contexts, you
are probably okay with that name.  If you follow recommended practice of
not installing config.h, then only your package has to worry about the
name you chose, even if you don't name it in the HAVE_* namespace.

-- 
Eric Blake   address@hidden    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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