From hadley at rice.edu  Mon Jun 13 23:57:45 2011
From: hadley at rice.edu (Hadley Wickham)
Date: Mon, 13 Jun 2011 16:57:45 -0500
Subject: [Rd] Detecting development environment
In-Reply-To: <0D1AAABC-17B9-43A1-879D-3DA1BE7F4B51@r-project.org>
References: <BANLkTi=+=sr5Xa=_L9cFSj_fP0XiHgohsA@mail.gmail.com>
	<0D1AAABC-17B9-43A1-879D-3DA1BE7F4B51@r-project.org>
Message-ID: <BANLkTinZSLr2uJXr63hA0ZRCkWstp5-wzA@mail.gmail.com>

>> Is there a straight-forward, cross-platform way of determining if a
>> user has all the tools needed to develop R packages (i.e. gcc etc)?
>> It doesn't need to be 100%, but should give a rough idea. ?One idea I
>> had was simply to see if system("R CMD install --help") worked.
>>
>
> That's not really checking pretty much anything (even if you used INSTALL ;)) since all it does is to run R.

Well I guess it checks that you have your path set up right.  But this
is why I asked ;)

> More reasonable quick check may be R CMD SHLIB, though, since that involves both make and gcc:
>
> echo 'void foo(int *bar) { *bar=1; }' > foo.c && R CMD SHLIB foo.c
>
> And you could even check feasibility with something like
>
> dyn.load(paste("foo",.Platform$dynlib.ext,sep=''))
> stopifnot(.C("foo",0L)[[1]] == 1L)

Perfect - thanks!

Hadley

-- 
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/



[Rd] Detecting development environment
Hadley Wickham