Re: Still a few flaws in configure's default CFLAGS selection - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: Still a few flaws in configure's default CFLAGS selection
Date
Msg-id 200310160122.h9G1MhX13040@candle.pha.pa.us
Whole thread Raw
In response to Still a few flaws in configure's default CFLAGS selection  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Tom Lane wrote:
> While fooling with adding -fno-strict-aliasing to configure, I realized
> that there are still some oddities about its selection of CFLAGS.  The
> problems stem from the fact that autoconf will always select a default
> value of CFLAGS that includes "-g", if the compiler accepts "-g" at all.
> This has a couple of consequences:
> 
> 1. --enable-debug is nearly useless, since unless you've manually
> specified CFLAGS, what you're going to get will include -g anyway.
> 
> 2. The code Bruce put in to default to "-O" on non-gcc compilers
> will never actually fire.

I see that now. I saw in configure:if test "$ac_test_CFLAGS" = set; then  CFLAGS=$ac_save_CFLAGSelif test
$ac_cv_prog_cc_g= yes; then  if test "$GCC" = yes; then    CFLAGS="-g -O2"  else    CFLAGS="-g"  fielse  if test "$GCC"
=yes; then    CFLAGS="-O2"  else    CFLAGS=  fifi
 

and assumed the CFLAGS= line was the default, and thought the
$ac_cv_prog_cc_g = yes test was for debug enabled.  Now I see it just
checks if -g works and uses it unconditionally.  That is bizarre.  I
was never even fond of configure defaulting to -O2.  It is a fine
default, but the CFLAGS default should be our decision, not configure.

> It would be fairly easy to override autoconf's behavior, but I wonder
> whether that will surprise people who are used to the "standard"
> behavior of autoconf scripts.  Personally I've always felt that
> defaulting to -g was a bizarre and unwise choice on the part of the
> autoconf developers, but maybe someone out there wants to defend it?

Agreed.  What does autoconf know about our project?  Nothing.  We should
not default to their compile flages.

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
359-1001+  If your life is a hard drive,     |  13 Roberts Road +  Christ can be your backup.        |  Newtown Square,
Pennsylvania19073
 


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: postgres --help-config
Next
From: Alvaro Herrera
Date:
Subject: Re: postgres --help-config