From hin-tak.leung at cimr.cam.ac.uk  Tue May  9 18:49:29 2006
From: hin-tak.leung at cimr.cam.ac.uk (Hin-Tak Leung)
Date: Tue, 09 May 2006 17:49:29 +0100
Subject: [Rd] suppressing "global" cppflags in an individual package
In-Reply-To: <9294B498-A4DB-47B1-AE99-71C1559EABB3@stat.berkeley.edu>
References: <9294B498-A4DB-47B1-AE99-71C1559EABB3@stat.berkeley.edu>
Message-ID: <4460C819.6090407@cimr.cam.ac.uk>

Kasper Daniel Hansen wrote:
> Hi
> 
> I can use PKG_CPPFLAGS in a Makevars file to add additional flags to  
> the c++ compiler for a given package. Is it possible to remove flags  
> passed to the packages from R. Eg: say R have been compiled with -O2  
> and I want the package to be compiled with another optimization level?

Do you mean the flags passed to the c++ compiler (CXXFLAGS) or
to the C proprocessor (CPPFLAGS)? Do not confuse the two.

I think the "proper" way would be to write a full makefile.
(there are plenty of examples on CRAN).

Now, out of curiosity - why would you want to do that? The actual 
difference in CPU time usage is often small (10%?), so unless the
package triggers a compiler bug at specific optimization level and
gets mis-compiled, it is probably not worth the trouble. And if
the package is that sensitive to optimization level and can get 
mis-compiled, one of them (the package or the compiler) needs fixing.

HTL



[Rd] suppressing "global" cppflags in an individual package
Hin-Tak Leung