From erika.cule05 at imperial.ac.uk  Fri Aug 17 14:07:22 2012
From: erika.cule05 at imperial.ac.uk (Cule, Erika)
Date: Fri, 17 Aug 2012 12:07:22 +0000
Subject: [Rd] R package compilation: files in src directory should be
 ignored if C library is not available
In-Reply-To: <20526.13140.317362.955544@max.nulle.part>
References: <2402B639CA718D40875055AF9BC9EE1013E50C60@icexch-m4.ic.ac.uk>
	<502E2C91.6050206@statistik.tu-dortmund.de>
	<2402B639CA718D40875055AF9BC9EE1013E514B2@icexch-m4.ic.ac.uk>
	<20526.13140.317362.955544@max.nulle.part>
Message-ID: <2402B639CA718D40875055AF9BC9EE1013E516DD@icexch-m4.ic.ac.uk>

Ah I see! Had not thought of that solution.

(This is the first time I have tried to use autoconf and configure)

Many thanks.

Erika

On 17 Aug 2012, at 13:04, Dirk Eddelbuettel wrote:

> 
> On 17 August 2012 at 11:44, Cule, Erika wrote:
> | If so, I still don't understand what happens when I compile the package if GSL is not installed on the computer, as there will still be C code in the src directory.
> 
> That is precisely the use case for autoconf et al.
> 
> You test if something (here GSL) is available (and there are macros and
> examples for in many places) and then define a header file variable such as
> I_HAVE_FOUND_GSL as 1 or 0, say.  In your C code, you then use something like
> 
>   #if I_HAVE_FOUND_GSL == 1
> 
>       some code
> 
>   #endif 
> 
> Now your code compiles in both cases.
> 
> Alternatively, you just depend on the GSL. Many packages on CRAN do, and the
> Windows build infrastructure provides it.
> 
> Dirk
> 
> -- 
> Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com  



[Rd] R package compilation: files in src directory should be ignored if C library is not available
Cule, Erika