Re: [pcre-dev] A problem with config.h.generic

Pàgina inicial
Delete this message
Autor: Philip Hazel
Data:  
A: Ralf Junker
CC: pcre-dev
Assumpte: Re: [pcre-dev] A problem with config.h.generic
On Sat, 8 Dec 2012, Ralf Junker wrote:

> I very much like to keep this version because it allows to override
> config.h on the command line via the -D switch:
>
> -DHAVE_STDINT_H=0


.... which will not work! The reason is that all of the checks in the
code are of the form

#ifdef HAVE_STDINT_H

> Some users might find command line options easier and more flexible than
> modifying config.h[.generic].
>
> With #undef, this is not easily possible AFAIK.


That is indeed the problem. I suppose one possibility is to ensure that,
in config.h.generic, *all* macros (of this type) are undefined instead
of some having default values. I am coming round to this point of view.

> I would change the comment to point out what the default setting does
> and list other options and explain what they do:
>
> /*
> ** Assume that the system has the <stdint.h> header file.
> ** Define to 0 if it does not.
> */
> #ifndef HAVE_STDINT_H         <============ Added line =============
> #define HAVE_STDINT_H 1
> #endif                        <============ Added line =============


This is not always easy to do automatically, as the original from which
config.h.generic is copied is created by the autotools, and as far as I
know, it doesn't allow for inserting such comments for "standard" checks
such as checking for headers.

> I don't like #undef because when #defined in code, a value can not be
> undefined via the command line.


I understand, but the config.h that is generated by autotools or by
CMake does use #undef, and the majority of PCRE builders use one or the
other of those building methods.

Philip

--
Philip Hazel