Re: Add EXTRA_CFLAGS to configure

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Add EXTRA_CFLAGS to configure
Date: 2015-10-28 15:42:28
Message-ID: 22440.1446046948@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Andres Freund <andres(at)anarazel(dot)de> writes:
> On 2015-10-28 09:36:39 -0400, Tom Lane wrote:
>> Andres Freund <andres(at)anarazel(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2015-10-28 15:56:54 Re: Add EXTRA_CFLAGS to configure
Previous Message Tom Lane 2015-10-28 15:07:34 Re: [PROPOSAL] Max recursion depth in WITH Queries (Common Table Expressions)