| From: | PG Bug reporting form <noreply(at)postgresql(dot)org> |
|---|---|
| To: | pgsql-bugs(at)lists(dot)postgresql(dot)org |
| Cc: | wysunxavier(at)gmail(dot)com |
| Subject: | BUG #17466: Is it possible to supplement the default compilation options of CFLAGS in configure file? |
| Date: | 2022-04-19 03:36:22 |
| Message-ID: | 17466-6ab1e589e78a166a@postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-bugs |
The following bug has been logged on the website:
Bug reference: 17466
Logged by: xavier
Email address: wysunxavier(at)gmail(dot)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.
diff --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[(at)] =~ "-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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Masahiko Sawada | 2022-04-19 06:23:37 | Re: "unexpected duplicate for tablespace" problem in logical replication |
| Previous Message | Tom Lane | 2022-04-18 15:36:51 | Re: BUG #17465: Wrong error message while trying to change system column type. |