Re: [PATCH] Pass COPT and PROFILE to CXXFLAGS as well

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Michael Paquier <michael@paquier.xyz>
Cc: Christoph Berg <christoph.berg@credativ.de>, Andres Freund <andres@anarazel.de>, Alvaro Herrera <alvherre@2ndquadrant.com>, Peter Eisentraut <peter.eisentraut@2ndquadrant.com>, PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2019-01-31T01:18:31Z
Lists: pgsql-hackers
Michael Paquier <michael@paquier.xyz> writes:
> On Wed, Jan 30, 2019 at 02:41:01PM +0100, Christoph Berg wrote:
>> Do we still want some CXXOPT flag for the server build? I can write a
>> patch, but someone else would need to do the bikeshedding how to name
>> it, and which of the existing knobs would set CXXFLAGS along. I don't
>> think I need that feature.

> If we don't directly need it, let's not add it now but let's revisit
> the need if it proves necessary.

+1

> I propose to just commit the last
> patch you sent, and back-patch to ease integration with existing
> extensions.  Any objections?

A thought here:

 ifdef PG_CPPFLAGS
 override CPPFLAGS := $(PG_CPPFLAGS) $(CPPFLAGS)
 endif
+ifdef PG_CFLAGS
+override CFLAGS := $(PG_CFLAGS) $(CFLAGS)
+endif
+ifdef PG_CXXFLAGS
+override CXXFLAGS := $(PG_CXXFLAGS) $(CXXFLAGS)
+endif
+ifdef PG_LDFLAGS
+override LDFLAGS := $(PG_LDFLAGS) $(LDFLAGS)
+endif

This looks a bit copy-and-paste-y to me, in particular no thought
has been taken for the order of flags.  We found in configure that
it's better to add user-specified CFLAGS at the *end*, even though
injecting user-specified CPPFLAGS at the beginning is the right
thing.  This is because in, eg, "-O2 -O0" the last flag wins.
Presumably the same goes for CXXFLAGS.  I think it's right to
put user LDFLAGS first, though.  (The argument for CPPFLAGS and
LDFLAGS is that you want the user's -I and -L flags to go first.)

			regards, tom lane


Commits

  1. Add PG_CFLAGS, PG_CXXFLAGS, and PG_LDFLAGS variables to PGXS