summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Taylor <juliantaylor108@gmail.com>2015-11-25 23:12:50 +0100
committerJulian Taylor <juliantaylor108@gmail.com>2015-11-25 23:12:50 +0100
commitb9a06adca048cd5884f5862c08821852b1c48da8 (patch)
tree5bf3b4c42e4c7b72ec71703a2a0e81239c065b0d
parente711c9589ea60ac6ca78096906760925a9e216e3 (diff)
parenta083c9e358d831260b100f81953b0935313c689b (diff)
downloadnumpy-b9a06adca048cd5884f5862c08821852b1c48da8.tar.gz
Merge pull request #6717 from charris/fix-gh-6675
BUG: Readd fallback CBLAS detection on linux.
-rw-r--r--numpy/distutils/system_info.py30
1 files changed, 29 insertions, 1 deletions
diff --git a/numpy/distutils/system_info.py b/numpy/distutils/system_info.py
index a0c6f44f7..7ea8b8c62 100644
--- a/numpy/distutils/system_info.py
+++ b/numpy/distutils/system_info.py
@@ -1678,9 +1678,37 @@ class blas_info(system_info):
info = self.check_libs(lib_dirs, blas_libs, [])
if info is None:
return
- info['language'] = 'f77' # XXX: is it generally true?
+ if platform.system() != 'Windows' and self.has_cblas():
+ # The check for windows is needed because has_cblas uses the
+ # same compiler that was used to compile Python and msvc is
+ # often not installed when mingw is being used. This rough
+ # treatment is not desirable, but windows is tricky.
+ info['language'] = 'c'
+ info['define_macros'] = [('HAVE_CBLAS', None)]
+ else:
+ info['language'] = 'f77' # XXX: is it generally true?
self.set_info(**info)
+ def has_cblas(self):
+ # primitive cblas check by looking for the header
+ res = False
+ c = distutils.ccompiler.new_compiler()
+ tmpdir = tempfile.mkdtemp()
+ s = """#include <cblas.h>"""
+ src = os.path.join(tmpdir, 'source.c')
+ try:
+ with open(src, 'wt') as f:
+ f.write(s)
+ try:
+ c.compile([src], output_dir=tmpdir,
+ include_dirs=self.get_include_dirs())
+ res = True
+ except distutils.ccompiler.CompileError:
+ res = False
+ finally:
+ shutil.rmtree(tmpdir)
+ return res
+
class openblas_info(blas_info):
section = 'openblas'