summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--numpy/core/SConstruct11
-rw-r--r--numpy/core/include/numpy/numpyconfig.h.in6
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