[Rd] R package compilation: files in src directory should be ignored if C library is not available
edd at debian.org
Fri Aug 17 14:04:36 CEST 2012
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
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 Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com
More information about the R-devel