automake
[Top][All Lists]
Advanced

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

Re: Disabling optimization


From: Braden McDaniel
Subject: Re: Disabling optimization
Date: Wed, 17 Nov 2004 20:01:45 -0500

On Wed, 2004-11-17 at 18:48 -0500, Jonathan wrote:
> My autoconf/automake project is optimizing by default with "-g -O2". 
> Unfortunately, we have verified that this is causing a run-time error
> by overriding CXXFLAGS in Makefile.am with just "-g".  With the "-O2"
> flag removed, everything works great.
> 
> I have been trying to find out where this "-O2" is coming from so I
> can disable it at the configure.ac level, but my attempts have been
> fruitless.

"-g -O2" is what AC_PROG_CC/AC_PROG_CXX sets CFLAGS/CXXFLAGS to if it
isn't already set to something.

> How do I disable the "-O2" flag in the most portable way possible?

I would do something like this (in configure.ac):

        if test -n "${CXXFLAGS}"; then
          user_set_cxxflags=yes
        fi
        AC_PROG_CXX
        if test X$user_set_cxxflags != Xyes; then
          CXXFLAGS="-g"
        fi

Really you should probably be a little more clever and also check to see
if the compiler in use is the one you have a problem with. But this
approach allows someone who really *wants* to use -O2 (to experiment,
perhaps) to do so.

-- 
Braden McDaniel                           e-mail: <address@hidden>
<http://endoframe.com>                    Jabber: <address@hidden>





reply via email to

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