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

Etusivu
Poista viesti
Lähettäjä: Graycode
Päiväys:  
Vastaanottaja: pcre-dev
Aihe: Re: [pcre-dev] A problem with config.h.generic
On Sat, 8 Dec 2012, Philip Hazel wrote:

> 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



Here is another idea. For all "config.h" boolean #defines, require
that the value be specified as one of the following:

1) #undef VAR     /* (or a commented out mention) */
2) #define VAR 0   /* explicit Off */
3) #define VAR 1   /* explicit On */


And change all their comments to "Define to 1" vs. "Define to any
value".

/* Define to 1 if you have the <stdint.h> header file. */
#ifndef HAVE_STDINT_H
#define HAVE_STDINT_H 1
#endif

/* Define to 1 to enable the 16 bit PCRE library. */
/* #undef SUPPORT_PCRE16 */


Hopefully that would satisfy compiler "/D" command assignments &
overrides, auto-tools, hand-crafted changes, and unknown other methods
of specifying configuration options.


Now at the bottom of "config.h" always #include a new H file, for
example named "conf_internal.h". Being an "internal" file, end-users
should not (must not) change it, and auto-tools need not touch it.

The purpose of the new file is to interpret our option settings into
PCRE's own code development standards. PCRE developers may define,
un-define, re-define, validate, and do whatever is desired there.


#if defined(HAVE_STDINT_H) && (HAVE_STDINT_H == 0)
#undef HAVE_STDINT_H
#endif
#if defined(SUPPORT_PCRE16) && (SUPPORT_PCRE == 0)
#undef SUPPORT_PCRE16
#endif

#if (LINK_SIZE < 2) || (LINK_SIZE > 4)
#error Invalid LINK_SIZE, refer to the documentation.
#endif

etc.


Basically it would let you have more assurance that the #defs end up
in whatever format you want them to be. The new file belongs to PCRE
developers while "config.h" is everybody's interface.

Later, you might even decide to move some things that end-users should
not be messing with out of "config.h" and into "conf_internal.h".

#ifndef PACKAGE_STRING
#define PACKAGE_STRING "PCRE 8.32"
#endif
#ifndef PACKAGE_VERSION
#define PACKAGE_VERSION "8.32"
#endif
#ifndef VERSION
#define VERSION "8.32"
#endif


Graycode