autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Removing -O2 from CFLAGS


From: Warren Young
Subject: Removing -O2 from CFLAGS
Date: Tue, 22 May 2001 14:40:39 -0600

It seems that autoconf always adds -O2 to its build lines.  I have a
compiler that generates bad code for a particular program when built
with -O2, so I'd like to turn that flag off.  I can use AM_CFLAGS to
_add_ flags like -O0, but that gets subbed in _before_ the default flags
so -O2 overrides my -O0.

I'd rather not completely override autoconf's CFLAGS.  I trust it to
pick good defaults mostly, I'd just like to have the ability to remove
particular subsets of its defaults.

I guess I could do some hackery like this:

MY_CFLAGS=`echo $CFLAGS | tr " " \012 | while read line
        if test x"$line" != "x-O2"
        then
                echo -n "$line "
        fi
done`
CFLAGS=$MY_CFLAGS

That's pretty ugly, but if it's the only way...

On this note, is there a standard way to get autoconf to let you build
"release" and "debug" versions of a program?  Right now I'm rolling my
own mechanism with a custom AC_ARG_ENABLE to turn on and off CFLAGS and
LFLAGS.
-- 
= Warren -- Video articles: http://www.cyberport.com/~tangent/video/
= 
= ICBM Address: 36.8274040 N, 108.0204086 W, alt. 1714m



reply via email to

[Prev in Thread] Current Thread [Next in Thread]