This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] libiberty: add HAVE_CONFIG_H check to all files (lacking it already)


On Tue, Aug 17, 2010 at 9:15 AM, Ian Lance Taylor wrote:
> Mike Frysinger writes:
>> it isnt an issue of libiberty being compiled correctly.  i
>> specifically wanted to compile a few files by hand to simplify some
>> local testing.
>
> There is nothing wrong with doing that, of course, but I'm not sure why
> it leads to a libiberty patch.  If none of the files in libiberty had
> the #ifdef HAVE_CONFIG_H, I doubt you would consider adding it to
> others.

of course ... the only reason i proposed adding HAVE_CONFIG_H is
because (1) i didnt have a config.h and (2) ~75% of the files using
config.h have the protection.  i was standardizing the other 25%
because i hit a problem with one or two of those files and i figured
i'd fix everything instead of focusing on my specific problem case.

> Also, all of the files in libiberty which #include "config.h" presumably
> do it in order to test macros which should be defined in config.h (e.g.,
> HAVE_DECL_BASENAME, etc.). ?So it is a good marker that for correct
> general compilation you need to define those macros.

autoconf, when not paired with autoheader or similar functionality,
will stick all the defines into CPPFLAGS.  so config.h is not a
prerequisite for HAVE_xxx defines.  while not the most common use
case, it is not uncommon to hit packages that do this.  like e2fsprogs
or util-linux (although, they converted recently to autoheader).
plus, there is no hard requirement anywhere that it be named
explicitly "config.h".

>>> The cases where libiberty .c files check #ifdef HAVE_CONFIG_H are
>>> generally cases where libiberty has copied code from other projects,
>>> which have their own reasons for testing HAVE_CONFIG_H.
>>
>> so if i include an arbitrary file in my own project, i can request it
>> be given a HAVE_CONFIG_H ?
>
> No, those files were copied from projects like gnulib, which exist to
> provide files to be included in other programs.

looking closer, i'm not sure that's true.  there are plenty of files
labeled "This file is part of libiberty." that have HAVE_CONFIG_H
protection.  what really strikes me though is that some files which
have this protection require other files which do not.  which again is
how i got here in the first place.
-mike


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]