Re: BUG #14217: Respect $CFLAGS from /usr/local/etc/config.site

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: dpa-postgres(at)aegee(dot)org
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #14217: Respect $CFLAGS from /usr/local/etc/config.site
Date: 2016-06-28 15:33:09
Message-ID: 20160628153309.GA23675@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

dpa-postgres(at)aegee(dot)org wrote:
> The following bug has been logged on the website:
>
> Bug reference: 14217
> Logged by: Dilian Palauzov
> Email address: dpa-postgres(at)aegee(dot)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(at)gmx(dot)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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2016-06-28 16:05:43 Re: BUG #14217: Respect $CFLAGS from /usr/local/etc/config.site
Previous Message dpa-postgres 2016-06-28 09:04:14 BUG #14217: Respect $CFLAGS from /usr/local/etc/config.site