[rkward-cvs] SF.net SVN: rkward:[2503] trunk/rkward/rkward/rbackend/FindR.cmake

tfry at users.sourceforge.net tfry at users.sourceforge.net
Tue May 26 19:42:30 UTC 2009


Revision: 2503
          http://rkward.svn.sourceforge.net/rkward/?rev=2503&view=rev
Author:   tfry
Date:     2009-05-26 19:42:29 +0000 (Tue, 26 May 2009)

Log Message:
-----------
Second attempt at making (most of) FindR.cmake platform independent

Modified Paths:
--------------
    trunk/rkward/rkward/rbackend/FindR.cmake

Modified: trunk/rkward/rkward/rbackend/FindR.cmake
===================================================================
--- trunk/rkward/rkward/rbackend/FindR.cmake	2009-05-26 12:42:35 UTC (rev 2502)
+++ trunk/rkward/rkward/rbackend/FindR.cmake	2009-05-26 19:42:29 UTC (rev 2503)
@@ -16,8 +16,9 @@
 
 MESSAGE(STATUS "Looking for R_HOME")
 IF(NOT R_HOME)
-	EXEC_PROGRAM(${R_EXECUTABLE}
-		ARGS CMD sh -c 'echo $R_HOME'
+	EXECUTE_PROCESS(
+		COMMAND echo "cat(R.home())"
+		COMMAND ${R_EXECUTABLE} "--slave" "--no-save"
 		OUTPUT_VARIABLE R_HOME)
 ELSE(NOT R_HOME)
 	MESSAGE(STATUS "Specified by user")
@@ -32,8 +33,9 @@
 
 MESSAGE(STATUS "Looking for R include files")
 IF(NOT R_INCLUDEDIR)
-	EXEC_PROGRAM(${R_EXECUTABLE}
-		ARGS CMD sh -c 'echo $R_INCLUDE_DIR'
+	EXECUTE_PROCESS(
+		COMMAND echo "cat(R.home('include'))"
+		COMMAND ${R_EXECUTABLE} "--slave" "--no-save"
 		OUTPUT_VARIABLE R_INCLUDEDIR)
 ELSE(NOT R_INCLUDEDIR)
 	MESSAGE(STATUS "Location specified by user")
@@ -59,10 +61,10 @@
 
 # check for existence of libR.so
 
-MESSAGE(STATUS "Checking for existence of libR.so")
-FIND_FILE(LIBR_SO
-	libR.so
-	PATHS ${R_HOME}/lib ${R_SHAREDLIBDIR}
+MESSAGE(STATUS "Checking for existence of R shared library")
+FIND_LIBRARY(LIBR_SO
+	R
+	PATHS ${R_HOME}/lib ${R_SHAREDLIBDIR} ${R_HOME}/bin
 	NO_DEFAULT_PATH)
 IF(NOT LIBR_SO)
 	MESSAGE(FATAL_ERROR "Not found. Make sure the location of R was detected correctly, above, and R was compiled with the --enable-shlib option")
@@ -74,39 +76,39 @@
 ENDIF(NOT LIBR_SO)
 
 # for at least some versions of R, we seem to have to link against -lRlapack. Else loading some
-# R packages will fail due to unresolved symbols. However, we can't do this unconditionally,
+# R packages will fail due to unresolved symbols, or we can't link against -lR.
+# However, we can't do this unconditionally,
 # as this is not available in some configurations of R
 
-MESSAGE(STATUS "Checking whether we should link against libRlapack.so")
-FIND_FILE(LIBR_LAPACK
-	libRlapack.so
+MESSAGE(STATUS "Checking whether we should link against Rlapack library")
+FIND_LIBRARY(LIBR_LAPACK
+	Rlapack
 	PATHS ${R_SHAREDLIBDIR}
 	NO_DEFAULT_PATH)
 IF(NOT LIBR_LAPACK)
-	MESSAGE(STATUS "No, ${R_SHAREDLIBDIR}/libRlapack.so does not exist")
+	MESSAGE(STATUS "No, it does not exist in ${R_SHAREDLIBDIR}")
 ELSE(NOT LIBR_LAPACK)
 	MESSAGE(STATUS "Yes, ${LIBR_LAPACK} exists")
 	SET(R_USED_LIBS ${R_USED_LIBS} Rlapack gfortran)
 ENDIF(NOT LIBR_LAPACK)
 
-# for at least some versions of R, we seem to have to link against -lRblas. Else loading some
-# R packages will fail due to unresolved symbols. However, we can't do this unconditionally,
+# for at least some versions of R, we seem to have to link against -lRlapack. Else loading some
+# R packages will fail due to unresolved symbols, or we can't link against -lR.
+# However, we can't do this unconditionally,
 # as this is not available in some configurations of R
 
-MESSAGE(STATUS "Checking whether we should link against libRblas.so")
-FIND_FILE(LIBR_BLAS
-	libRblas.so
+MESSAGE(STATUS "Checking whether we should link against Rblas library")
+FIND_LIBRARY(LIBR_BLAS
+	Rblas
 	PATHS ${R_SHAREDLIBDIR}
 	NO_DEFAULT_PATH)
 IF(NOT LIBR_BLAS)
-	MESSAGE(STATUS "No, ${R_SHAREDLIBDIR}/libRblas.so does not exist")
+	MESSAGE(STATUS "No, it does not exist in ${R_SHAREDLIBDIR}")
 ELSE(NOT LIBR_BLAS)
 	MESSAGE(STATUS "Yes, ${LIBR_BLAS} exists")
 	SET(R_USED_LIBS ${R_USED_LIBS} Rblas)
 ENDIF(NOT LIBR_BLAS)
 
-
-
 # find R package library location
 
 MESSAGE(STATUS "Checking for R package library location to use")


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the rkward-tracker mailing list