Using config_xxx.h instead of -DHAVE_XXX

Norbert Thiebaud nthiebaud at gmail.com
Fri Dec 7 14:23:36 PST 2012


On Fri, Dec 7, 2012 at 12:56 PM, Lubos Lunak <l.lunak at suse.cz> wrote:
> On Friday 07 of December 2012, Norbert Thiebaud wrote:
>> On Fri, Dec 7, 2012 at 11:42 AM, Lubos Lunak <l.lunak at suse.cz> wrote:
>> >  There are more such -D options that could be changed, although with some
>> > it'd be better be careful, e.g. OSL_DEBUG can't go there, because it can
>> > be overriden by command-line,
>>
>> That is a case of addinf a guard in config.h
>> #ifndef HAVE_FOO
>> #define HAVE_FOO <0|1>
>> #endif
>>
>> and always use these HAVE_xx
>> with
>> #if HAVE_  #if !HAVE_
>>
>> rather than
>> #ifdef HAVE_
>> #ifndef HAVE_
>
>  I don't know what you are referring to exactly with this.

I'm refering to the ability to override from the environment a define
in config.h
if it based on def/undef you can override a def
if it is based on 0/1 then you can override by defining stuff in the
environment (using CXXFLAGS for instance)


>
>> >and I'm not sure if adding #include
>> > <config_global.h> to sal/config.h would be really included everywhere
>> > where needed.
>>
>> One remark...
>> can we generate these in $WORKDIR   like $WORKDIR/inc/config/* or
>> something to that effect
>> and have
>> #include <config/vckplug.h>
>> rather than include <config_vclplug.h>
>> ?
>
>  They can't be in $WORKDIR, because it's like with config_host.mk - that one
> also survives make clean.

humm. true... I'm just concened about puting stuff in the source
tree... but we will cross that bridge when we get there (the ability
to build with a read-only source tree)

>
>> and we could also mandate that every source need to include
>> #include <config/lo.h>
>> or some some other thoroughly bikesheded name
>> which would in turn include  the global config, sal/config and other
>> fundamental includes
>
>  I seem to remember somebody has already said that this file is in fact
> sal/config.h , I'd just prefer to hear to for sure instead of seeming to
> remember it.

That _cannot_ be sal/config.h

sal/config is part of the URE.. it is published, it is very often
omitted and only included indrectly, and it cannot be used to group
commonly used include like ustring.hxx.
and certainly cannot be used to server LibreOffice centric hack purpose.

>
>  In other news, I've already committed the two patches by mistake, so I'll
> keep them in unless somebody finds out something wrong with them.

oh well...I still don't like to pollution of the build root with an
ever growing series of config_foo.h file... that will need to be added
to .gitignore... if they were in a config directory that would be much
neater and much easier to do a safe distro-clean

Norbert


More information about the LibreOffice mailing list