Hi Ed,

* Ed Hartnett wrote on Fri, Nov 04, 2005 at 06:15:29PM CET:
> Ralf Wildenhues <[EMAIL PROTECTED]> writes:
> > * Ed Hartnett wrote on Fri, Nov 04, 2005 at 02:57:44PM CET:
> >> 
> >> I find myself setting AM_CFLAGS=-g in many subdirectories.
> >
> > Why not just put
> >
> >   AC_SUBST([AM_CFLAGS], [-g])
> >
> > in configure.ac?

> > Note though that many compilers cannot mix -g and optimization options;
> > you should allow the user the override with CFLAGS without breaking this.
> 
> How exactly would I be sure to allow that?

The best thing would be to look at the Autoconf macro _AC_PROG_CC_G,
defined in autoconf/lib/autoconf/c.m4 (installed path may be similar to
$prefix/share/autoconf/autoconf/c.m4).  Unfortunately, it's not
published interface.

> How does everyone else handle this? Is it usual to turn on -g
> everywhere?

I just would not mumble with AM_CFLAGS at all, unless necessary.  If the
user hasn't specified CFLAGS, the configure script will try to enable
one or both of "-O2" and "-g" (both if they work together).  As a user,
I can override it by setting CFLAGS appropriately.  As a package author,
I'd only override it in case there are compilation errors without or
with a certain option.  However, even in that case there are good
arguments _against_ doing so:  you (as a package author) have no idea
when a certain compiler bug for example may be fixed.  Also, there is a
plethora of different compilers and systems out there.

Cheers,
Ralf


Reply via email to