diff options
author | Pauli Virtanen <pav@iki.fi> | 2010-10-06 01:15:15 +0200 |
---|---|---|
committer | Pauli Virtanen <pav@iki.fi> | 2010-10-06 21:11:15 +0200 |
commit | 5a0ab023d8f81ccf83fe6adf7983d7631021cb62 (patch) | |
tree | a3f14bd68f0daca98b5018d84b98e436f0eb6eb1 /numpy | |
parent | 8b0d65986dad4b4d17a51ea272bf17afc5dd7031 (diff) | |
download | numpy-5a0ab023d8f81ccf83fe6adf7983d7631021cb62.tar.gz |
BUG: core: use #if check instead of #ifdef in checking HAVE_DECL_ISFINITE (ticket #1625)
Python #defines HAVE_DECL_ISFINITE 0 when the function is not available,
so the proper check to do is #if.
Diffstat (limited to 'numpy')
-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, |