Re: [RFC] building postgres with meson - autogenerated headers - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: [RFC] building postgres with meson - autogenerated headers
Date
Msg-id 8ba72a3a-57c2-ac47-9a77-3b720c539adf@enterprisedb.com
Whole thread Raw
In response to Re: [RFC] building postgres with meson - autogenerated headers  (Andres Freund <andres@anarazel.de>)
List 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.



pgsql-hackers by date:

Previous
From: Amit Kapila
Date:
Subject: Re: row filtering for logical replication
Next
From: Robert Haas
Date:
Subject: Re: [PATCH v2] use has_privs_for_role for predefined roles