dpa-postgres@aegee.org wrote:
> The following bug has been logged on the website:
>
> Bug reference: 14217
> Logged by: Dilian Palauzov
> Email address: dpa-postgres@aegee.org
> PostgreSQL version: 9.6beta2
> Operating system: Linux
> Description:
>
> configure generated by Autoconf loads the file $prefix/etc/config.site and
> if CFLAGS is defined there, its value is used when building the project.
>
> Because in postgresql configure.in contains on line 400 "unset CFLAGS" the
> value of $CFLAGS from config.site is discarded when building postgresql,
> contrary to $LDFLAGS from config.site.
This report is correct; we're not doing the right thing here. The
autoconf manual explicitely says:
Site files are also good places to set default values for other output
variables, such as CFLAGS, if you need to give them non-default values:
anything you would normally do, repetitively, on the command line. If
you use non-default values for prefix or exec_prefix (wherever you
locate the site file), you can set them in the site file if you specify
it with the CONFIG_SITE environment variable.
https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/Site-Defaults.html
The way it works today completely ignores settings in config.site, which is
clearly bogus per the above manual, but I doubt that blanket removal of the
"unset" is the right solution. The line was added by this commit:
commit 801427abc2924195b35be19abe4f64dbbea82263
Author: Peter Eisentraut <peter_e@gmx.net>
AuthorDate: Sat Nov 1 20:48:51 2003 +0000
CommitDate: Sat Nov 1 20:48:51 2003 +0000
Unset CFLAGS before reading template. This should be more robust.
When --enable-debug is used, then the default CFLAGS for non-GCC is just
-g without -O.
Backpatch enhancement of Autoconf inline test that detects problems with
the HP C compiler.
--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services