Re: automating pg_config.h.win32 maintenance

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: automating pg_config.h.win32 maintenance
Date: 2019-12-13 13:14:08
Message-ID: 594b0e2a-6343-039a-1bac-a3ec7e74f2bf@iki.fi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2019-12-13 13:25:47 logical replication does not fire per-column triggers
Previous Message Peter Eisentraut 2019-12-13 12:51:55 automating pg_config.h.win32 maintenance