diff options
-rw-r--r-- | numpy/core/setup.py | 7 | ||||
-rw-r--r-- | numpy/distutils/command/config.py | 16 |
2 files changed, 21 insertions, 2 deletions
diff --git a/numpy/core/setup.py b/numpy/core/setup.py index ad8d5cb3b..f71ec108a 100644 --- a/numpy/core/setup.py +++ b/numpy/core/setup.py @@ -215,10 +215,13 @@ def check_ieee_macros(config): _macros = ["isnan", "isinf", "signbit", "isfinite"] if sys.version_info[:2] >= (2, 6): for f in _macros: - already_declared = config.check_decl(fname2def("decl_%s" % f), + py_symbol = fname2def("decl_%s" % f) + already_declared = config.check_decl(py_symbol, headers=["Python.h", "math.h"]) if already_declared: - pub.append('NPY_%s' % fname2def("decl_%s" % f)) + if config.check_macro_true(py_symbol, + headers=["Python.h", "math.h"]): + pub.append('NPY_%s' % fname2def("decl_%s" % f)) else: macros.append(f) else: diff --git a/numpy/distutils/command/config.py b/numpy/distutils/command/config.py index dafc7002f..85a86990f 100644 --- a/numpy/distutils/command/config.py +++ b/numpy/distutils/command/config.py @@ -169,6 +169,22 @@ int main() return self.try_compile(body, headers, include_dirs) + def check_macro_true(self, symbol, + headers=None, include_dirs=None): + self._check_compiler() + body = """ +int main() +{ +#if %s +#else +#error false or undefined macro +#endif + ; + return 0; +}""" % (symbol,) + + return self.try_compile(body, headers, include_dirs) + def check_type(self, type_name, headers=None, include_dirs=None, library_dirs=None): """Check type availability. Return True if the type can be compiled, |