Re: Add EXTRA_CFLAGS to configure - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Add EXTRA_CFLAGS to configure
Date
Msg-id 22440.1446046948@sss.pgh.pa.us
Whole thread Raw
In response to Re: Add EXTRA_CFLAGS to configure  (Andres Freund <andres@anarazel.de>)
Responses Re: Add EXTRA_CFLAGS to configure  (Andres Freund <andres@anarazel.de>)
List pgsql-hackers
Andres Freund <andres@anarazel.de> writes:
> On 2015-10-28 09:36:39 -0400, Tom Lane wrote:
>> Andres Freund <andres@anarazel.de> writes:
>>> 1) ./configure CFLAGS=... essentially breaks --enable-debug and related
>>> options, overwrites -O2 as the default and such. That's imo pretty
>>> confusing.
>>> 2) I like to be able to pass -Werror or something to configure without
>>> breaking a bunch of configure tests that won't work with Werror.

>> I would be rather surprised if such a switch didn't affect the flags used
>> by configure itself, so your point (2) seems like it would require nasty
>> inconsistency.

> Hm, I don't find it that inconsistent to say that configure itself uses
> CFLAGS but not EXTRA_CFLAGS (or whatever).

Well, it is.  In particular, you could easily shoot yourself in the foot
this way, for example by passing some semantically relevant switch like
"-m64" in the wrong set of flags.

In view of your point (1), I'd be okay with inventing an EXTRA_CFLAGS
argument that is added to, rather than replacing, the automatically
computed flags.  But I think that configure must include such flags
for its own compile runs, else it is not testing the true build
environment and might get wrong answers.

Is -Werror the only practical case where we need configure to *not* see
a flag that should otherwise be applied?  If so, maybe we should just
attack that problem directly and narrowly.  I can think of at least
two ways:

1. Invent a "--with-werror" configure switch that causes -Werror to be
added to the CFLAGS, but not while running tests that it'd break.

2. Explicitly filter -Werror out of the user-provided CFLAGS while running
tests that it'd break.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [PROPOSAL] Max recursion depth in WITH Queries (Common Table Expressions)
Next
From: Andres Freund
Date:
Subject: Re: Add EXTRA_CFLAGS to configure