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
  [EMAIL PROTECTED]               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

               http://archives.postgresql.org

Reply via email to