summaryrefslogtreecommitdiff
path: root/numpy/distutils/misc_util.py
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/distutils/misc_util.py')
-rw-r--r--numpy/distutils/misc_util.py17
1 files changed, 14 insertions, 3 deletions
diff --git a/numpy/distutils/misc_util.py b/numpy/distutils/misc_util.py
index 30a5014aa..96311b311 100644
--- a/numpy/distutils/misc_util.py
+++ b/numpy/distutils/misc_util.py
@@ -114,9 +114,20 @@ def njoin(*path):
def get_mathlibs(path=None):
"""Return the MATHLIB line from numpyconfig.h
"""
- if path is None:
- path = os.path.join(get_numpy_include_dirs()[0], 'numpy')
- config_file = os.path.join(path,'numpyconfig.h')
+ if path is not None:
+ config_file = os.path.join(path,'numpyconfig.h')
+ else:
+ # Look for the file in each of the numpy include directories.
+ dirs = get_numpy_include_dirs()
+ for path in dirs:
+ fn = os.path.join(path,'numpyconfig.h')
+ if os.path.exists(fn):
+ config_file = fn
+ break
+ else:
+ raise DistutilsError('numpyconfig.h not found in numpy include '
+ 'dirs %r' % (dirs,))
+
fid = open(config_file)
mathlibs = []
s = '#define MATHLIB'