[R-pkg-devel] Using the correct R binary in configure script

Dirk Eddelbuettel edd at debian.org
Sat Sep 26 17:43:51 CEST 2015

On 26 September 2015 at 10:27, Jack Wasey wrote:
| Having just read section 1.2 in Writing R extensions, a fragment of a
| configure script is offered in order to determine the correct compiler
| options. It starts by setting R_HOME with:
| : ${R_HOME=`R RHOME`}
| `R` is called, even if, as in my case, `Rdevel` is the command used to
| invoke package compilation. This can be overridden by setting R_HOME
| in the call to `Rdevel`, but this seems to be undesirable, since the
| whole point of a configure script is that it sets up the package given
| the constraints of the compiling environment.

| Am I doing something wrong?

R_HOME is set to the result of the command R RHOME if and only it is unset.

And it usually is unset.  This scheme generally works, I use it in a few
packages on CRAN which had it for years -- and it was initially suggested to
my by Kurt to make precisely _this_ work:  you set a different $PATH, or call
a different R engine.  And the right thing happens:

  edd at max:~$ R RHOME            # default installation
  edd at max:~$ RD RHOME           # alternate R-devel with a short-hand wrapper
  edd at max:~$ which RD
  edd at max:~$ 

The (nice) idea of calling R-devel just 'RD' appears due to Winston.  It
works the same way if I just call R-devel-sh as I had for years:

  edd at max:~$ R-devel.sh RHOME
  edd at max:~$ 

So if you still think it fails for you, compare to e.g. the packages


all of which use this scheme.


http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org

More information about the R-package-devel mailing list