[R] minus I and minus L flags
Dirk Eddelbuettel
edd at debian.org
Sun Feb 20 18:58:22 CET 2005
On 20 February 2005 at 11:12, Charles Geyer wrote:
| I have been RTFM/doc/www, but I'm still lost.
|
| How does one tell R CMD INSTALL and R CMD check (both) that libraries
| are installed in non-usual places and so -I/APPS/include (or whatever)
| is necessary in CPPFLAGS and -L/APPS/lib (similarly) is necessary
| in LDFLAGS?
|
| I know I can hardwire them in pkg/src/Makevars, but this requires hand
| editing of that file by each installer (yuck!)
|
| rgentlem suggested some tricks with configure, but after a lot of grovelling
| in autoconf manuals and books, I still don't get it.
|
| Surely this is a pre-solved problem (I hopefully assert). Is there a standard
| solution, and if so where is the example I follow?
FWIW, I have followed other packages when I crafted this for RQuantLib.
i) src/Makevars.in is a stanza that gets filled by Autoconf:
edd at chibud:~/src/debian/QuantLib/RQuantLib-0.1.11> cat src/Makevars.in
PKG_CXXFLAGS=@pkg_cxxflags@
PKG_LIBS=@pkg_libs@
ii) The actual work is done by configure at package built time. That is the
single best method. You can snoop tricks from dozens of CRAN packages
that do the same:
I crafted a reasonably short file:
edd at chibud:~/src/debian/QuantLib/RQuantLib-0.1.11> wc -l configure.in
149 configure.in
that tests for both QuantLib and Boost headers and libraries. Personally, I
find going by working example the easiest, with the documentation (for
autoconf) at my side.
That said, I also benefited from tips by Kurt who wears a black belt
in autoconf magic.
edd at chibud:~/src/debian/QuantLib/RQuantLib-0.1.11> head -8 configure.in
# RQuantLib configure.in by Dirk Eddelbuettel <edd at debian.org>
# Borrowed pieces from RPgSQL, GNU Gretl, GNU R and QuantLib
#
# Greatly simplified thanks to quantlib-config
# Another contribution by Kurt Hornik gratefully acknowledged
#
# $Id: configure.in,v 1.1 2004/12/22 04:07:57 edd Exp $
The fact that this credits RPgSQL is probably a reflection of the point in
time when I first wrote this several years ago -- CRAN was considerably
smaller at the time.
Hope this helps. Dirk
--
Better to have an approximate answer to the right question than a precise
answer to the wrong question. -- John Tukey as quoted by John Chambers
More information about the R-help
mailing list