[Rcpp-commits] r1110 - pkg/Rcpp/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Apr 22 12:58:33 CEST 2010


Author: romain
Date: 2010-04-22 12:58:33 +0200 (Thu, 22 Apr 2010)
New Revision: 1110

Modified:
   pkg/Rcpp/R/RcppLdpath.R
Log:
RcppLdFlags and LdFlags uses the same default value for static, which is calculated by the 'staticLinking' function

Modified: pkg/Rcpp/R/RcppLdpath.R
===================================================================
--- pkg/Rcpp/R/RcppLdpath.R	2010-04-22 10:29:09 UTC (rev 1109)
+++ pkg/Rcpp/R/RcppLdpath.R	2010-04-22 10:58:33 UTC (rev 1110)
@@ -4,6 +4,13 @@
 	tools:::file_path_as_absolute( base:::system.file( ... ) )
 }
 
+## identifies if the default linking on the platform should be static 
+## or dynamic. Currently only linux uses dynamic linking by default
+## although it works fine on mac osx as well
+staticLinking <- function(){
+	! grepl( "^linux", R.version$os ) 
+}
+
 ## Use R's internal knowledge of path settings to find the lib/ directory
 ## plus optinally an arch-specific directory on system building multi-arch
 RcppLdPath <- function() {
@@ -22,7 +29,7 @@
 ## Updated Jan 2010:  We now default to static linking but allow the use
 ##                    of rpath on Linux if static==FALSE has been chosen
 ##                    Note that this is probably being called from LdFlags()
-RcppLdFlags <- function(static=TRUE) {
+RcppLdFlags <- function(static=staticLinking()) {
     rcppdir <- RcppLdPath()
     if (static) {                               # static is default on Windows and OS X
         flags <- paste(rcppdir, "/libRcpp.a", sep="")
@@ -58,7 +65,7 @@
     cat(RcppCxxFlags(cxx0x=cxx0x))
 }
 ## LdFlags defaults to static linking on the non-Linux platforms Windows and OS X
-LdFlags <- function(static=ifelse(length(grep("^linux",R.version$os))==0, TRUE, FALSE)) {
+LdFlags <- function(static=staticLinking()) {
     cat(RcppLdFlags(static=static))
 }
 



More information about the Rcpp-commits mailing list