public inbox for [email protected]  
help / color / mirror / Atom feed
From: Peter Eisentraut <[email protected]>
To: Andres Freund <[email protected]>
To: [email protected]
To: Tom Lane <[email protected]>
Subject: Re: [RFC] building postgres with meson - autogenerated headers
Date: Tue, 8 Feb 2022 14:19:59 +0100
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
	<[email protected]>

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.






view thread (2+ messages)

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: [RFC] building postgres with meson - autogenerated headers
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox