[Rd] Can configure.ac detect 64 bit R?

Prof Brian Ripley ripley at stats.ox.ac.uk
Wed Jun 6 15:05:25 CEST 2007


On Tue, 5 Jun 2007, jhallman at frb.gov wrote:

> My fame package has to link to the libchli.so that comes with FAME.
> However, FAME is now supplying both 32 and 64 bit versions of the
> library. The 32-bit version is $FAME/hli/libchli.so while the 64-bit
> version is $FAME/hli/64/libchli.so.  To set the right flags, it seems
> that I need to know, from within configure.ac, whether the R
> installation is 32 bit or 64 bit.  Is there a way to detect this?

That sort of differentiation is highly OS-specific.  If FAME is indeed 
doing this on all OSes it will cause considerable confusion.  It is more 
normal to have the 'standard' version in .../lib and the others in 
.../lib/32 or .../lib/sparcv9, or to use lib and lib64 or ....

And I will assume from now on that you mean a Unix-alike.

Next, on any decent OS you don't need to know, as it will choose the 
appropriate DSO from those it can find of that name.  So just having
-L$FAME/hli/64 -L$FAME/hli should suffice.

However, if despite all that you want to know, yes of course configure.ac 
can detect it. Several possibilities include:

-  Ensure that you can compiling in exactly the same way as R way built, 
and test a C program outputting sizeof(void *) == 8.

-  ${R_HOME}/bin/Rscript -e 'cat(.Machine$sizeof.pointer)'
gives the pointer size in bytes.

- file ${R_HOME}/bin/exec/${r_arch}R will have '64-bit' in on a 64-bit 
build on all OSes I know of.

Of these the second is most direct (and the slowest and needs R >= 2.5.0).

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-devel mailing list