On 13/12/2019 14:51, Peter Eisentraut wrote:
> Keeping pg_config.h.win32 up to date with pg_config.h.in is a gratuitous
> annoyance.
Hear hear!
> My proposal is that we essentially emulate what config.status does in
> Perl code. config.status gets a list of defines discovered by configure
> and processes pg_config.h.in to pg_config.h by substituting the defines.
> The MSVC build system basically has those defines hardcoded, but the
> processing we can do in just the same way. It already had code to do a
> bit of that anyway, so it's really not a big leap. See attached
> patches. (I put the remove of pg_config.h.win32 into a separate patch
> so that reviewers can just apply the first patch and then diff the
> produced pg_config.h with the existing pg_config.h.win32.)
Sounds good. I hadn't realized we already had the infrastructure ready
for this.
A couple of minor comments:
> + print $o "/* src/include/pg_config.h. Generated from
pg_config.h.in by ", basename(__FILE__), ". */\n";
How about just hardcoding this to "Generated from pg_config.h.in by
Solution.pm". Using basename(__FILE__) seems overly cute.
> + my @simple_defines = qw(
> + HAVE_ATOMICS
> + ... long list ...
> + USE_WIN32_SHARED_MEMORY
> + );
> +
> + foreach my $k (@simple_defines)
> + {
> + $define{$k} = 1;
> + }
I don't think this @simple_defines is really any better than listing all
the options directly with "$define{HAVE_ATOMICS} = 1". And some simple
defines are already listed like that, e.g. HAVE_DECL_STRNLEN above that
list.
- Heikki