Re: [PATCH] Pass COPT and PROFILE to CXXFLAGS as well - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [PATCH] Pass COPT and PROFILE to CXXFLAGS as well
Date
Msg-id 17488.1548897511@sss.pgh.pa.us
Whole thread Raw
In response to Re: [PATCH] Pass COPT and PROFILE to CXXFLAGS as well  (Michael Paquier <michael@paquier.xyz>)
Responses Re: [PATCH] Pass COPT and PROFILE to CXXFLAGS as well  (Michael Paquier <michael@paquier.xyz>)
List 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


pgsql-hackers by date:

Previous
From: "Jamison, Kirk"
Date:
Subject: RE: pg_upgrade: Pass -j down to vacuumdb
Next
From: Kyotaro HORIGUCHI
Date:
Subject: Re: psql exit status with multiple -c or -f