pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: wysunxavier@gmail.com
Subject:  BUG #17466: Is it possible to supplement the default compilation options of CFLAGS in configure file?
Date: Tue, 19 Apr 2022 03:36:22 +0000
Message-ID: <17466-6ab1e589e78a166a@postgresql.org> (raw)

The following bug has been logged on the website:

Bug reference:      17466
Logged by:          xavier
Email address:      wysunxavier@gmail.com
PostgreSQL version: 14.2
Operating system:   CentOS 7.9
Description:        

Hello,
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.
I tried making modifications to the configure.ac of master branch.
inline patch 1: configure.ac (+4/-0 lines) download inline-1.patchdiff --git a/configure.ac b/configure.ac index 44d35e1..36e3fc5 100644 --- a/configure.ac +++ b/configure.ac @@ -427,6 +427,10 @@ else fi fi +if [[[ ! $CFLAGS[@] =~ "-O" ]]]; then + CFLAGS="$CFLAGS -O2" +fi + if test "$ac_env_CXXFLAGS_set" = set; then CXXFLAGS=$ac_env_CXXFLAGS_value elif test "${CXXFLAGS+set}" = set; then

view thread (2+ messages)  latest in thread

Message-ID: <17466-6ab1e589e78a166a@postgresql.org>
Permalink:  ../17466-6ab1e589e78a166a@postgresql.org/
Also on:    postgresql.org/message-id/17466-6ab1e589e78a166a@postgresql.org

 ·  · 

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: pgsql-bugs@postgresql.org
  Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, wysunxavier@gmail.com
  Subject: Re:  BUG #17466: Is it possible to supplement the default compilation options of CFLAGS in configure file?
  In-Reply-To: <17466-6ab1e589e78a166a@postgresql.org>

* 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