Re: Why conditionally include config.h?

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

 



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   eblake@xxxxxxxxxx    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Autoconf mailing list
Autoconf@xxxxxxx
https://lists.gnu.org/mailman/listinfo/autoconf

[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux