Revision: 523 http://rpy.svn.sourceforge.net/rpy/?rev=523&view=rev Author: warnes Date: 2008-05-14 11:31:21 -0700 (Wed, 14 May 2008)
Log Message: ----------- Use the 'R CMD config LAPACK_LIBS' command to determin the appropriate link flags for lapack, instead of blindly assuming that '-L<RHOME>/lib -lRlapack' is the correct magic incantation. Modified Paths: -------------- trunk/rpy/rpy_tools.py trunk/rpy/setup.py Modified: trunk/rpy/rpy_tools.py =================================================================== --- trunk/rpy/rpy_tools.py 2008-05-14 17:51:40 UTC (rev 522) +++ trunk/rpy/rpy_tools.py 2008-05-14 18:31:21 UTC (rev 523) @@ -143,3 +143,20 @@ % PYTHON_DIR ) return PYTHON_DIR + +def get_R_LAPACK_LIB_FLAGS(RHOME=get_R_HOME()): + """ + Determine the necessary link arguments for lapack + """ + rexec = os.path.join(RHOME, 'bin', 'R') + stat, output = getstatusoutput('"%s" CMD config LAPACK_LIBS' % rexec ) + if stat or len(output)<=0: + raise RuntimeError("Couldn't execute the R interpreter" + + " `%s'.\n" % rexec ) + + LAPACK_LIB_FLAGS = output.strip() + if not LAPACK_LIB_FLAGS: + raise RuntimeError("Couldn't obtain LAPACK_LIBS information from output\n" + "of `R CMD config LAPACK_LIBS'.\n") + + return LAPACK_LIB_FLAGS Modified: trunk/rpy/setup.py =================================================================== --- trunk/rpy/setup.py 2008-05-14 17:51:40 UTC (rev 522) +++ trunk/rpy/setup.py 2008-05-14 18:31:21 UTC (rev 523) @@ -150,26 +150,22 @@ library_dirs= r_libs runtime_libs = r_libs extra_compile_args=[] - elif sys.platform=='osf1V5': - include_dirs = [ os.path.join(RHOME.strip(), 'include'), - 'src' ] - libraries=['R','Rlapack'] - library_dirs = r_libs - runtime_libs = r_libs - extra_compile_args=["-shared"] - source_files = source_files + ["src/setenv.c"] + else: # unix-like systems, this is known to work for Linux and Solaris include_dirs = [ os.path.join(RHOME.strip(), 'include'), 'src', '/usr/share/R/include' ] - # TODO: determine if Rlapack is available, if not use standard lapack - libraries=['R','Rlapack'] - library_dirs = r_libs runtime_libs = r_libs extra_compile_args=["-shared"] source_files = source_files + ["src/setenv.c"] + + libraries=['R'] + + # Ask R to tell us how to properly link against lapack + extra_compile_args += [ rpy_tools.get_R_LAPACK_LIB_FLAGS( RHOME ) ] + # Discover which array packages are present try: import numpy This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ rpy-list mailing list rpy-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rpy-list