diff options
author | David Cournapeau <cournape@gmail.com> | 2008-01-21 05:52:58 +0000 |
---|---|---|
committer | David Cournapeau <cournape@gmail.com> | 2008-01-21 05:52:58 +0000 |
commit | d3e6c0cd3c50e9309215c09579030e11c7f77f7b (patch) | |
tree | 10a6fa496a74b2fae042586dc20156371cc92657 | |
parent | 41ca4b191c3d0cbcd48f3f3cd5456c2982339a3a (diff) | |
download | numpy-d3e6c0cd3c50e9309215c09579030e11c7f77f7b.tar.gz |
Fixes for config and numpyconfig header generation:
- Replace #ifdef PY_LONG_LONG logic in numpyconfig.h by a declaration check in
scons, and uses the result directly in the generated header.
-rw-r--r-- | numpy/core/SConstruct | 11 | ||||
-rw-r--r-- | numpy/core/include/numpy/numpyconfig.h.in | 6 |
2 files changed, 12 insertions, 5 deletions
diff --git a/numpy/core/SConstruct b/numpy/core/SConstruct index 1be5bf6c9..61ef2cd80 100644 --- a/numpy/core/SConstruct +++ b/numpy/core/SConstruct @@ -50,9 +50,18 @@ def check_type(type, include = None): for type in ('short', 'int', 'long', 'float', 'double', 'long double'): check_type(type) -for type in ('Py_intptr_t', 'PY_LONG_LONG'): +for type in ('Py_intptr_t',): check_type(type, include = "#include <Python.h>\n") +# We check declaration AND type because that's how distutils does it. +if config.CheckDeclaration('PY_LONG_LONG', includes = '#include <Python.h>\n'): + st = config.CheckTypeSize('PY_LONG_LONG', includes = '#include <Python.h>\n') + assert not st == 0 + numpyconfig_sym.append(('DEFINE_NPY_SIZEOF_LONGLONG', '#define NPY_SIZEOF_LONGLONG %d' % st)) + numpyconfig_sym.append(('DEFINE_NPY_SIZEOF_PY_LONG_LONG', '#define NPY_SIZEOF_PY_LONG_LONG %d' % st)) +else: + numpyconfig_sym.append(('DEFINE_NPY_SIZEOF_LONGLONG', '')) + numpyconfig_sym.append(('DEFINE_NPY_SIZEOF_PY_LONG_LONG', '')) #---------------------- # Checking signal stuff #---------------------- diff --git a/numpy/core/include/numpy/numpyconfig.h.in b/numpy/core/include/numpy/numpyconfig.h.in index 48c3a7b25..5d9bb66a7 100644 --- a/numpy/core/include/numpy/numpyconfig.h.in +++ b/numpy/core/include/numpy/numpyconfig.h.in @@ -13,10 +13,8 @@ #define NPY_MATHLIB @MATHLIB@ /* XXX: this has to be done outside config files !!!! */ -#ifdef PY_LONG_LONG - #define NPY_SIZEOF_LONGLONG @SIZEOF_PY_LONG_LONG@ - #define NPY_SIZEOF_PY_LONG_LONG @SIZEOF_PY_LONG_LONG@ -#endif +@DEFINE_NPY_SIZEOF_LONGLONG@ +@DEFINE_NPY_SIZEOF_PY_LONG_LONG@ #ifndef CHAR_BIT #error Configuration for undefined CHAR_BIT is not supported, contact the maintainter |