From Kurt.Hornik at wu-wien.ac.at  Thu Feb 10 08:17:29 2005
From: Kurt.Hornik at wu-wien.ac.at (Kurt Hornik)
Date: Thu Feb 10 08:27:52 2005
Subject: [Rd] Re: Compiler-specific flags with PKG_CFLAGS
In-Reply-To: <Pine.OSF.4.58.0502091453330.46967@odin.mdacc.tmc.edu>
References: <16905.17345.633888.927174@mithrandir.hornik.net> <Pine.OSF.4.58.
	0502091008490.35024@odin.mdacc.tmc.edu>
	<16906.15874.681788.789761@mithrandi r.hornik.net>
	<Pine.OSF.4.58.0502091102280.35024@odin.mdacc.tmc.edu>
	<16906.22133.310061.960069@mithrandir.hornik.net>
	<Pine.OSF.4.58.0502091453330.46967@odin.mdacc.tmc.edu>
Message-ID: <16907.2697.496058.230009@mithrandir.hornik.net>

>>>>> Paul Roebuck writes:

> On Wed, 9 Feb 2005, Kurt Hornik wrote:
>> >>>>> Paul Roebuck writes:
>> 
>> > On Wed, 9 Feb 2005, Kurt Hornik wrote:
>> >> >>>>> Paul Roebuck writes:
>> >>
>> >> > On Tue, 8 Feb 2005, Kurt Hornik wrote:
>> >> >> This concerns the packages...
>> >> >> for which current versions of r-devel now report problems with
>> >> >> non-portable compilation flags in Makevars[.in] files:
>> >> >>
>> >> >> Problems in package 'rwt':
>> >> >> Non-portable flags in variable 'PKG_CFLAGS':
>> >> >> -Wall -ansi -pedantic
>> >> >>
>> >> >> These flags are mostly GCC specific and not portable.
>> >> >> (Do not assume that any -Ox will work.)
>> >> >>
>> >> >> Can you please fix these problems, and provide an update of your
>> >> >> package?
>> >>
>> >> > It has been on my todo list since Ripley brought it up
>> >> > several weeks ago in r-devel but hadn't exactly figured
>> >> > out how to package it as such. Someone have an example
>> >> > of how to add compiler flags for GCC when it is being
>> >> > used and otherwise not? I'm assuming Makevars isn't being
>> >> > passed through cpp and I can't just use #ifdef. In this case,
>> >> > I could just leave them out but I hate to lose the warnings
>> >> > for development. Using 'configure' is probably the only
>> >> > option but really didn't want to use it for just stricter
>> >> > error checking during compilation.
>> >>
>> >> I think the simplest way to achieve this is to configure R
>> >> locally (for yourself) with CFLAGS="-O2 -Wall -pedantic" but
>> >> leave the corresponding PKG_CFLAGS etc variables in package
>> >> src/Makevars alone.
>> 
>> > I can do that for workstations which I have admin priviledges
>> > and have a private version of R; how about the ones I don't?
>> 
>> It depends: R-exts says
>> 
>> Flags which are set in file `etc/Makeconf' can be overridden by
>> the environment variable `MAKEFLAGS' (at least for systems using
>> GNU `make'), as in (Bourne shell syntax)
>> 
>> MAKEFLAGS="CFLAGS=-O3" R CMD SHLIB *.c
>> 
>> or by using a `Makefile'.
>> 
>> so if you have GNU Make, you can actually set MAKEFLAGS accordingly in
>> your R_ENVIRON file.
>> 
>> What you can also try is to have a make (Sys.getenv("MAKE")) script in
>> your PATH which does something like
>> 
>> /path/to/real/make $* CFLAGS=-O3
>> 
>> (but I am never sure whether command line vars override the ones in
>> files?)

> Thanks for the suggestions. Setting the environment prior to running
> R CMD is not practical for me, typing-wise. I guess if made my
> .Renviron file architecture-specific it might work, but that seems
> overkill.

Also, I forgot that it does not work, because R CMD only sources
R_HOME/etc/Renviron, but not the user level Renviron file.

This is really why we need the new mechanism ...

-k


[Rd] Re: Compiler-specific flags with PKG_CFLAGS
Kurt Hornik