[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: CFLAGS default values
From: |
Matze Braun |
Subject: |
Re: CFLAGS default values |
Date: |
Sun, 30 Nov 2003 02:40:59 +0100 (CET) |
On Sat, 29 Nov 2003, Paul Eggert wrote:
> Matze Braun <address@hidden> writes:
>
> > It would be alot more apropriate to let the user choose it's default flags
> > in the configure.ac file.
>
> That's easy: just set CFLAGS.
I have workarounds myself now. But these workarounds start to "polute" the
formerly nice configure.ac files.
>
> There's no universally-acceptable default. Generally speaking, the
> old UNIX tradition (namely, no debugging and no optimization) is less
> suitable these days than the autoconf default (debugging and a
> reasonable level of optimization).
You're missing the point of my last mail. I agree that -g -O2 is a better
default. But I don't think it's a good idea that autoconf enforces this
default. The point here is usability:
As a new user I don't expect autoconf to set CFLAGS in a macro whose main
purpose is to detect the name of the compiler. Why is this macro more
complicated than it could be? Why mess with such things as compiler
defaults here?
Even after realizing what goes wrong the user has a hard time figuring out
how to work around the enforced default flags. As I described in my last
mail, these defaults aren't always what you want. The firs line won't be
clear imediately by someone new to the configure script: (that's why I
added an extra explaining comment)
# workaround autoconf setting default flags which we don't want
test ".$CFLAGS" = "." && CFLAGS=" "
AC_PROG_CC
CFLAGS=-O3 -g
AC_ARG_ENABLE([debug], [AC_HELP_STRING([--enable-debug],
[build with debugging information (default NO)])],
[test "$enableval" = "yes" && CFLAGS="-O0 -g3"])
However if autoconf wouldn't set default, the example just wouldn't
need the extra workaround, while the simple case would still be be easy to
understand at the first place:
AC_PROG_CC
CFLAGS=-O2 -g
Well, enough nitpicking. I was just a little annoyed after searching an
hour for the cause of the -O2 -g flags and was thinking that we could
avoid this trouble for future users...
Greetings,
Matze