summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--numpy/core/include/numpy/numpyconfig.h.in6
-rw-r--r--numpy/core/setup.py7
2 files changed, 13 insertions, 0 deletions
diff --git a/numpy/core/include/numpy/numpyconfig.h.in b/numpy/core/include/numpy/numpyconfig.h.in
index 573c4f73e..bdebf7078 100644
--- a/numpy/core/include/numpy/numpyconfig.h.in
+++ b/numpy/core/include/numpy/numpyconfig.h.in
@@ -16,3 +16,9 @@
@DEFINE_NPY_SIZEOF_PY_LONG_LONG@
#define NPY_USE_C99_FORMATS @USE_C99_FORMATS@
+
+/* Ugly, but we can't test this in a proper manner without requiring a C++
+ * compiler at the configuration stage of numpy ? */
+#ifndef __STDC_FORMAT_MACROS
+ #define __STDC_FORMAT_MACROS 1
+#endif
diff --git a/numpy/core/setup.py b/numpy/core/setup.py
index b390c8f91..1f4f23d82 100644
--- a/numpy/core/setup.py
+++ b/numpy/core/setup.py
@@ -204,6 +204,13 @@ def configuration(parent_package='',top_path=None):
target_f.write('#define %s\n' % (d))
else:
target_f.write('#define %s %s\n' % (d[0],d[1]))
+
+ # Define __STDC_FORMAT_MACROS
+ target_f.write("""
+#ifndef __STDC_FORMAT_MACROS
+#define __STDC_FORMAT_MACROS 1
+#endif
+""")
target_f.close()
# Dump the numpyconfig.h header to stdout