Re: [Rd] Detecting development environment

2011-06-13 Thread Hadley Wickham
>> 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/

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Detecting development environment

2011-06-13 Thread Ted Byers
One option would be to use autoconf and automake, and related tools.  That
is exactly what they're designed for, in the simplest case.  In more
advanced cases, I have seen them used to verify not only the existance of
selected tools and libraries, but also whether or not the implementation of
selected functions is buggy (as you may be aware, some implementations of
the standard C library leave a bit to be desired, at least for some
functions).  But you do have a little work to do to write some of the input
files they need; and you can make them flexible in terms of supporting
telling them were certain resources are located.  That said, the
documentation for them is pretty good relative to the norm for unix like
platforms.

As for being cross platform, I know they're available (or can be built) for
unix like platforms, and on Windows via cygwin (which I suppose counts as
unix-like).  I don't know about other platforms, and I don't know if you can
get them to work on Windows without cygwin (maybe as an addition to
RTools?).

As for being "straight-forward", I had directed a student to begin studying
autoconf/automake upon finishing a study of Gnu make, and the first day he
did so, he met with success and asked me, " was it supposed to be this
straightforward?"  This, from a guy that has only begun studying
programming!  BTW: he told me he planned to study R once he had mastered C++
and QuantLib.  He has a strong interest in quantitative finance, and so
would be looking at those R packages related to quantitative finance.

I suppose whether or not it is 100% depends on the quality of inputs you
provide.

HTH

Ted

> -Original Message-
> From: r-devel-boun...@r-project.org [mailto:r-devel-bounces@r-
> project.org] On Behalf Of Hadley Wickham
> Sent: June-13-11 10:21 AM
> To: r-devel@r-project.org
> Subject: [Rd] Detecting development environment
> 
> Hi all,
> 
> 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.
> 
> Hadley
> 
> --
> Assistant Professor / Dobelman Family Junior Chair Department of
Statistics /
> Rice University http://had.co.nz/
> 
> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Detecting development environment

2011-06-13 Thread Simon Urbanek

On Jun 13, 2011, at 10:21 AM, Hadley Wickham wrote:

> Hi all,
> 
> 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.

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)

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Detecting development environment

2011-06-13 Thread Mike Marchywka





> From: had...@rice.edu
> Date: Mon, 13 Jun 2011 09:21:07 -0500
> To: r-devel@r-project.org
> Subject: [Rd] Detecting development environment
>
> Hi all,
>
> 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.


You could copy a configure script from just about anywhere and
adapt it. Not sure what you would do on 'dohs but the script
should be  able to support cygwin pretty easily.



>
> Hadley
>
> --
> Assistant Professor / Dobelman Family Junior Chair
> Department of Statistics / Rice University
> http://had.co.nz/
>
> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel 
>   
__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] Detecting development environment

2011-06-13 Thread Hadley Wickham
Hi all,

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.

Hadley

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

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel