[prev in list] [next in list] [prev in thread] [next in thread] 

List:       autoconf
Subject:    Removing -O2 from CFLAGS
From:       Warren Young <warren () etr-usa ! com>
Date:       2001-05-22 20:40:39
Message-ID: 3B0ACEC7.1C62BE59 () etr-usa ! com
[Download RAW message or body]

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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic