"Richard W.M. Jones" <[EMAIL PROTECTED]> wrote:
> Jim Meyering wrote:
>> 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.
>
> Do you also prefer to defend with #ifdef HAVE_CONFIG_H / #endif around
> each one, or does it not matter?

I avoid #ifdef HAVE_CONFIG_H, since that #ifdef is useful only in a .c
file that might be compiled by a project with no config.h file.

> I'll take a look at adding a make distcheck rule later, thanks.

Here's what I use in coreutils/Makefile.maint:
[you can list the names of exceptions in the file, .x-sc_require_config_h]

# This is reported not to work with make-3.79.1
# ME := $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
ME := Makefile.maint

CVS_LIST = build-aux/vc-list-files

CVS_LIST_EXCEPT = \
  $(CVS_LIST) | if test -f .x-$@; then grep -vEf .x-$@; else grep -v ChangeLog; 
fi

# Nearly all .c files must include <config.h>.
sc_require_config_h:
        @if $(CVS_LIST_EXCEPT) | grep '\.c$$' > /dev/null; then         \
          grep -L '^# *include <config\.h>'                             \
                $$($(CVS_LIST_EXCEPT) | grep '\.c$$')                   \
              | grep . &&                                               \
          { echo '$(ME): the above files do not include <config.h>'     \
                1>&2; exit 1; } || :;                                   \
        else :;                                                         \
        fi

--
Libvir-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to