diff options
author | Julian Taylor <jtaylor.debian@googlemail.com> | 2014-08-24 20:10:37 +0200 |
---|---|---|
committer | Julian Taylor <jtaylor.debian@googlemail.com> | 2014-09-04 22:02:23 +0200 |
commit | 75a27ce988d64a31d26c96af9e4fea06ec64f14b (patch) | |
tree | deb1b5f1d4a0dd8182779f7355d01148dcdb08e1 /numpy/distutils/system_info.py | |
parent | 8f03863f97d892e89c61a52c1d242906466a33cd (diff) | |
download | numpy-75a27ce988d64a31d26c96af9e4fea06ec64f14b.tar.gz |
BLD: check for CBLAS header in "unoptimized" blas
Allows building against system installed blas library that might be
optimized.
Diffstat (limited to 'numpy/distutils/system_info.py')
-rw-r--r-- | numpy/distutils/system_info.py | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/numpy/distutils/system_info.py b/numpy/distutils/system_info.py index 75c2c0ea5..ddb1513c4 100644 --- a/numpy/distutils/system_info.py +++ b/numpy/distutils/system_info.py @@ -1560,9 +1560,33 @@ 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 self.has_cblas(): + 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' |