Re: [RFC] building postgres with meson - autogenerated headers

From: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>, pgsql-hackers(at)postgresql(dot)org, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: [RFC] building postgres with meson - autogenerated headers
Date: 2022-02-08 13:19:59
Message-ID: 8ba72a3a-57c2-ac47-9a77-3b720c539adf@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 07.02.22 20:24, Andres Freund wrote:
> To be honest, I do not really understand the logic behind when autoconf ends
> up with #defines that define a macro to 0/1 and when a macro ends defined/or
> not and when we end up with a macro defined to 1 or not defined at all.

The default is to define to 1 or not at all. The reason for this is
presumably that originally, autoconf (or its predecessor practices) just
populated the command line with a few -DHAVE_THIS options. Creating a
header file came later. And -DFOO is equivalent to #define FOO 1.
Also, this behavior allows code to use both the #ifdef HAVE_THIS and the
#if HAVE_THIS style.

The cases that deviate from this have a special reason for this. One
issue to consider is that depending on how the configure script is set
up or structured, a test might not run at all. But for example, if you
have a check for a declaration of a function, and the test doesn't run
in a particular configuration, the fallback in your own code would
normally be to then manually declare the function yourself. But if you
didn't even run the test, then adding a declaration of a function you
didn't want in the first place might be bad. In that case, you can
check with #ifdef whether the test was run, and then check the value of
the macro for the test outcome.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2022-02-08 13:45:53 Re: [PATCH v2] use has_privs_for_role for predefined roles
Previous Message Amit Kapila 2022-02-08 13:10:08 Re: row filtering for logical replication