[Libvir] Re: [PATCH] #include "config.h" needed

Jim Meyering jim at meyering.net
Thu Jan 3 15:37:08 UTC 2008

Hi Rich.

Happy new year :)

"Richard W.M. Jones" <rjones at redhat.com> wrote:
> There is one file missing:
>   #include "config.h"
> which ought to be included at the beginning of every C file.  If
> missing, it causes problems on Windows -- in particular the C99
> keyword 'restrict' won't be recognised and that causes compile errors
> all over the place.

Yes, indeed.
I like to use a "make distcheck"-time check for this.
Just grep all version-controlled .c files, with a list of exceptions.
Otherwise, it's too easy to forget.

> I've also changed a few <config.h> --> "config.h", which I think is
> more correct because config.h is a local file and should never come
> from the system include files (CC'd to Jim Meyering -- is this right
> in your opinion?)

I used to prefer "config.h", too, but after some discussion
many years ago, I switched, and now coreutils, gnulib, etc.
use <config.h> everywhere.

The "Configuration Header Files" section of the autoconf
manual explains the subtle preference for <config.h>.
All it takes is being burned once by a stray config.h
file built for another architecture or with different
options, and you'll never use "config.h" again :-)

More information about the libvir-list mailing list