From: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
To: wysunxavier@gmail.com, pgsql-bugs@lists.postgresql.org, PG Bug reporting form <noreply@postgresql.org>
Subject: Re: BUG #17466: Is it possible to supplement the default compilation options of CFLAGS in configure file?
Date: Wed, 20 Apr 2022 18:21:50 +0200
Message-ID: <56b4ea59-936f-c54f-2e7c-81ac7e638849@enterprisedb.com> (raw)
In-Reply-To: <17466-6ab1e589e78a166a@postgresql.org>
References: <17466-6ab1e589e78a166a@postgresql.org>
On 19.04.22 05:36, PG Bug reporting form wrote:
> When I try to specify some compilation options in CFLAGS, such as compiling
> with macros, when I execute “./configure CFLAGS='-DUSE_TOOLS'”,it will use
> '-O0' to compile by default, which is easy to miscompile into a debug
> version. I wonder if it is possible to supplement the judgment conditions in
> the postgresql source code: If the compilation option is not specified in
> CFLAGS, '-O2' is used by default to avoid compiling the wrong debug
> version.
The use case you are describing is not without merit. But ultimately,
the handling of these compiler option variables has decades of history
behind it, and just poking at that for one specific case is going to
break someone else's use case somehow.
We generally avoid the need to add CFLAGS to the configure command line
except in cases where you actually want to override the defaults. Other
cases should have a command-line option or perhaps a spot in
pg_config_manual.h.
In your specific case you could also pass CPPFLAGS instead, which is
more correct anyway, and it doesn't have a default that you can
accidentally override.
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: pgsql-bugs@postgresql.org
Cc: peter.eisentraut@enterprisedb.com, noreply@postgresql.org
Subject: Re: BUG #17466: Is it possible to supplement the default compilation options of CFLAGS in configure file?
In-Reply-To: <56b4ea59-936f-c54f-2e7c-81ac7e638849@enterprisedb.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox