75810a5
Revision: 523
75810a5
          http://rpy.svn.sourceforge.net/rpy/?rev=523&view=rev
75810a5
Author:   warnes
75810a5
Date:     2008-05-14 11:31:21 -0700 (Wed, 14 May 2008)
75810a5
75810a5
Log Message:
75810a5
-----------
75810a5
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.
75810a5
75810a5
Modified Paths:
75810a5
--------------
75810a5
    trunk/rpy/rpy_tools.py
75810a5
    trunk/rpy/setup.py
75810a5
75810a5
Modified: trunk/rpy/rpy_tools.py
75810a5
===================================================================
75810a5
--- trunk/rpy/rpy_tools.py	2008-05-14 17:51:40 UTC (rev 522)
75810a5
+++ trunk/rpy/rpy_tools.py	2008-05-14 18:31:21 UTC (rev 523)
75810a5
@@ -143,3 +143,20 @@
75810a5
                        % PYTHON_DIR )
75810a5
     
75810a5
   return PYTHON_DIR
75810a5
+
75810a5
+def get_R_LAPACK_LIB_FLAGS(RHOME=get_R_HOME()):
75810a5
+  """
75810a5
+  Determine the necessary link arguments for lapack 
75810a5
+  """
75810a5
+  rexec = os.path.join(RHOME, 'bin', 'R')
75810a5
+  stat, output = getstatusoutput('"%s" CMD config LAPACK_LIBS' % rexec )
75810a5
+  if stat or len(output)<=0:
75810a5
+    raise RuntimeError("Couldn't execute the R interpreter" +
75810a5
+                       " `%s'.\n" % rexec )
75810a5
+  
75810a5
+  LAPACK_LIB_FLAGS = output.strip()
75810a5
+  if not LAPACK_LIB_FLAGS:
75810a5
+    raise RuntimeError("Couldn't obtain LAPACK_LIBS information from output\n"
75810a5
+                       "of `R CMD config LAPACK_LIBS'.\n")
75810a5
+  
75810a5
+  return LAPACK_LIB_FLAGS
75810a5
75810a5
Modified: trunk/rpy/setup.py
75810a5
===================================================================
75810a5
--- trunk/rpy/setup.py	2008-05-14 17:51:40 UTC (rev 522)
75810a5
+++ trunk/rpy/setup.py	2008-05-14 18:31:21 UTC (rev 523)
75810a5
@@ -150,23 +150,20 @@
75810a5
         library_dirs= r_libs
75810a5
         runtime_libs = r_libs
75810a5
         extra_compile_args=[]
75810a5
-    elif sys.platform=='osf1V5':
75810a5
-        include_dirs = [ os.path.join(RHOME.strip(), 'include'), 
75810a5
-                         'src' ]
75810a5
-        libraries=['R','Rlapack']
75810a5
-        library_dirs = r_libs
75810a5
-        runtime_libs = r_libs
75810a5
-        extra_compile_args=["-shared"]
75810a5
-        source_files = source_files + ["src/setenv.c"]
75810a5
+
75810a5
     else: # unix-like systems, this is known to work for Linux and Solaris
75810a5
         include_dirs = [ os.path.join(RHOME.strip(), 'include'),
75810a5
                          'src', '/usr/share/R/include', "/usr/include/R"]
75810a5
-        libraries=['R','Rlapack']
75810a5
         library_dirs = r_libs
75810a5
         runtime_libs = r_libs
75810a5
         extra_compile_args=["-shared"]
75810a5
         source_files = source_files + ["src/setenv.c"]
75810a5
 
75810a5
+        libraries=['R']
75810a5
+
75810a5
+        # Ask R to tell us how to properly link against lapack
75810a5
+        extra_compile_args += [ rpy_tools.get_R_LAPACK_LIB_FLAGS( RHOME ) ]
75810a5
+
75810a5
     # Discover which array packages are present
75810a5
     try: 
75810a5
         import numpy