autoconf
[Top][All Lists]
Advanced

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

Re: Why conditionally include config.h?


From: Eric Blake
Subject: Re: Why conditionally include config.h?
Date: Thu, 13 Sep 2012 17:43:54 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120828 Thunderbird/15.0

On 09/13/2012 05:22 PM, Kip Warner wrote:
> Hey list,
> 
> Why do many autoconfiscated projects bracket inclusion of the generated
> config.h with #if HAVE_CONFIG_H / #endif.

Bad copy-and-paste habits.  Probably because historically, libtool
prided itself on being usable even without autoconf, and therefore
libtool headers have to use HAVE_CONFIG_H.  Projects that use libtool
would then copy libtool's habits, even when they use autoconf, and the
practice has spread to projects that don't even use libtool.

> Assuming the build
> environment was configured, why shouldn't the source just always
> unconditionally include config.h? I mean if it isn't there, typically
> that means the user didn't configure first which ought to be an error
> anyways, no?

Yep, you are exactly right, which is why gnulib doesn't use
HAVE_CONFIG_H, and even provides a syntax check rule that you can copy
into your project to also avoid it yourself.

-- 
Eric Blake   address@hidden    +1-919-301-3266
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]