[Numpy-svn] r4281 - branches/numpy.scons/numpy/distutils/scons

numpy-svn@scip... numpy-svn@scip...
Thu Oct 25 00:38:13 CDT 2007


Author: cdavid
Date: 2007-10-25 00:38:10 -0500 (Thu, 25 Oct 2007)
New Revision: 4281

Modified:
   branches/numpy.scons/numpy/distutils/scons/custom_checkers.py
Log:
Use 'vars in comment's source' hack for custom checkers

Modified: branches/numpy.scons/numpy/distutils/scons/custom_checkers.py
===================================================================
--- branches/numpy.scons/numpy/distutils/scons/custom_checkers.py	2007-10-25 05:20:24 UTC (rev 4280)
+++ branches/numpy.scons/numpy/distutils/scons/custom_checkers.py	2007-10-25 05:38:10 UTC (rev 4281)
@@ -32,7 +32,11 @@
     oldCPPPATH = (env.has_key('CPPPATH') and deepcopy(env['CPPPATH'])) or []
     env.Append(CPPPATH = cpppath)
     # XXX: handle context
-    src = '\n'.join(headers)
+    hcode = ['#include <%s>' % h for h in headers]
+    # HACK: we add cpppath in the command of the source, to add dependency of
+    # the check on the cpppath.
+    hcode.extend(['#if 0', '%s' % cpppath, '#endif'])
+    src = '\n'.join(hcode)
 
     ret = context.TryCompile(src, '.c')
     if not ret:
@@ -48,7 +52,10 @@
     env.Append(LIBS = libs)
     env.Append(RPATH = libpath)
 
-    ret = context.TryLink(run_src, '.c')
+    # HACK: we add libpath and libs at the end of the source as a comment, to
+    # add dependency of the check on those.
+    src = '\n'.join([run_src, '#if 0', '%s' % libpath, '%s' % libs, '#endif'])
+    ret = context.TryLink(src, '.c')
     if not ret:
         env.Replace(LIBS = oldLIBS)
         env.Replace(LIBPATH = oldLIBPATH)
@@ -59,3 +66,13 @@
     context.Result(ret)
     return ret
      
+def CheckMKL(context, mkl_dir, nb):
+    """mkl_lib is the root path of MKL (the one which contains include, lib,
+    etc...). nb is 32, 64, emt, etc..."""
+
+    libs = ['mkl']
+    cpppath = os.path.join(mkl_dir, 'include')
+    libpath = os.path.join(mkl_dir, 'lib', nb)
+
+    return _check_include_and_run(context, 'MKL', cpppath, ['mkl.h'],
+                                  cblas_src, libs, libpath)



More information about the Numpy-svn mailing list