[Numpy-svn] r4437 - in branches/numpy.scons/numpy/distutils/scons: . checkers

numpy-svn@scip... numpy-svn@scip...
Mon Nov 12 04:00:03 CST 2007


Author: cdavid
Date: 2007-11-12 03:59:51 -0600 (Mon, 12 Nov 2007)
New Revision: 4437

Modified:
   branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py
   branches/numpy.scons/numpy/distutils/scons/fortran.py
Log:
Fortran-based checkers + LAPACK checker works on windows with g77 / MS Visual combo

Modified: branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py
===================================================================
--- branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py	2007-11-12 08:42:18 UTC (rev 4436)
+++ branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py	2007-11-12 09:59:51 UTC (rev 4437)
@@ -4,15 +4,16 @@
 # Module for custom, common checkers for numpy (and scipy)
 import sys
 import os.path
+from copy import deepcopy
 from distutils.util import get_platform
 
 from numpy.distutils.scons.core.libinfo import get_config_from_section, get_config
 from numpy.distutils.scons.testcode_snippets import cblas_sgemm as cblas_src, \
         c_sgemm as sunperf_src, lapack_sgesv
-
 from numpy.distutils.scons.fortran_scons import CheckF77Mangling, CheckF77Clib
-
 from numpy.distutils.scons.configuration import add_info
+from numpy.distutils.scons.core.utils import rsplit
+from numpy.distutils.scons.core.extension_scons import built_with_mstools, built_with_mingw
 
 from perflib import CheckMKL, CheckATLAS, CheckSunperf, CheckAccelerate
 from support import check_include_and_run, ConfigOpts, ConfigRes
@@ -115,8 +116,11 @@
     siteconfig, cfgfiles = get_config()
     (cpppath, libs, libpath), found = get_config_from_section(siteconfig, section)
     if found:
+	# XXX: handle def library names correctly
+	if len(libs) == 1 and len(libs[0]) == 0:
+	    libs = ['lapack', 'blas']
         cfg = ConfigOpts(cpppath = cpppath, libs = libs, libpath = libpath,
-                         rpath = libpath)
+                         rpath = deepcopy(libpath))
 
         if not env.has_key('F77_NAME_MANGLER'):
             if not CheckF77Mangling(context):
@@ -129,17 +133,25 @@
         sgesv_string = env['F77_NAME_MANGLER']('sgesv')
         test_src = lapack_sgesv % sgesv_string
 
-        st = check_include_and_run(context, 'LAPACK (from site.cfg) ', cfg,
+	# fortrancfg is used to merge info from fortran checks and site.cfg
+	fortrancfg = deepcopy(cfg)
+	if not built_with_mstools(env):
+		fortrancfg['linkflags'].append(env['F77_LDFLAGS'])
+	else:
+	    # XXX: do this the right way (abstract a minimal posix -> MS flags
+	    # convertor)
+	    for i in env['F77_LDFLAGS'].split(' '):
+		if i.startswith('-L'):
+		    fortrancfg['libpath'].append(i[2:])
+		elif i.startswith('-l'):
+		    fortrancfg['linkflags'].append('lib%s.a' % i[2:])
+
+        st = check_include_and_run(context, 'LAPACK (from site.cfg) ', fortrancfg,
                                   [], test_src, autoadd)
         if st:
             add_info(env, 'lapack', ConfigRes('lapack', cfg, found))
         return st
     else:
-        if sys.platform == 'nt':
-            import warnings
-            warning.warn('FIXME: LAPACK checks not implemented yet on win32')
-            return 0
-
         if sys.platform == 'darwin':
             st, opts = CheckAccelerate(context, autoadd)
             if st:

Modified: branches/numpy.scons/numpy/distutils/scons/fortran.py
===================================================================
--- branches/numpy.scons/numpy/distutils/scons/fortran.py	2007-11-12 08:42:18 UTC (rev 4436)
+++ branches/numpy.scons/numpy/distutils/scons/fortran.py	2007-11-12 09:59:51 UTC (rev 4437)
@@ -7,6 +7,7 @@
 
 import sys
 import re
+import os
 
 GCC_DRIVER_LINE = re.compile('^Driving:')
 POSIX_STATIC_EXT = re.compile('\S+\.a')
@@ -14,8 +15,14 @@
 MERGE_SPACE_R1 = re.compile('^-[LRuYz]$')
 
 # linkflags which match those are ignored
-LINKFLAGS_IGNORED = [r'-lang*', r'-lcrt[a-zA-Z0-9]*\.o', r'-lc', r'-lgcc*',
-                     r'-lSystem', r'-libmil', r'-LIST:*', r'-LNO:*', r'-lfrt*', r'-luser32', r'-lkernel32', r'-ladvapi32', r'-lmsvcrt', r'-lshell32', r'-lmingw', r'-lmoldname']
+LINKFLAGS_IGNORED = [r'-lang*', r'-lcrt[a-zA-Z0-9]*\.o', r'-lc', r'-lSystem', r'-libmil', r'-LIST:*', r'-LNO:*']
+if os.name == 'nt':
+    LINKFLAGS_IGNORED.extend([r'-lfrt*', r'-luser32',
+	    r'-lkernel32', r'-ladvapi32', r'-lmsvcrt',
+	    r'-lshell32', r'-lmingw', r'-lmoldname'])
+else:
+    LINKFLAGS_IGNORED.append(r'-lgcc*')
+
 RLINKFLAGS_IGNORED = [re.compile(i) for i in LINKFLAGS_IGNORED]
 
 # linkflags which match those are the one we are interested in



More information about the Numpy-svn mailing list