From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Still a few flaws in configure's default CFLAGS selection |
Date: | 2003-10-16 01:22:43 |
Message-ID: | 200310160122.h9G1MhX13040@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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_CFLAGS
elif test $ac_cv_prog_cc_g = yes; then
if test "$GCC" = yes; then
CFLAGS="-g -O2"
else
CFLAGS="-g"
fi
else
if test "$GCC" = yes; then
CFLAGS="-O2"
else
CFLAGS=
fi
fi
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(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
From | Date | Subject | |
---|---|---|---|
Next Message | Alvaro Herrera | 2003-10-16 02:10:18 | Re: postgres --help-config |
Previous Message | Bruce Momjian | 2003-10-16 01:13:51 | Re: postgres --help-config |