Boost logo

Boost :

From: Markus Schöpflin (markus.schoepflin_at_[hidden])
Date: 2004-08-31 10:56:36


David Abrahams wrote:

> I'm willing to try any change you think is appropriate.

Attached is a patch which fixes the problem on my system. Given the
complexity of the matter, I can make no promises for other systems. Maybe
we could check it in and see what happens with the regression tests?

Markus

Index: wrap_python.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/python/detail/wrap_python.hpp,v
retrieving revision 1.18
diff -u -r1.18 wrap_python.hpp
--- wrap_python.hpp 26 Jul 2004 00:32:07 -0000 1.18
+++ wrap_python.hpp 31 Aug 2004 15:52:05 -0000
@@ -21,6 +21,23 @@
 // 01 Mar 01 define PyObject_INIT() for Python 1.x (Dave Abrahams)
 
 //
+// Get ahold of Python's version number
+//
+#include <patchlevel.h>
+
+//
+// Include the python config file. This has to be done before including any
+// system headers because it defines macros which might collide with default
+// definitions. Namely these are _OSF_SOURCE, _POSIX_C_SOURCE, and
+// _XOPEN_SOURCE.
+//
+#if PY_MAJOR_VERSION < 2 || PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION < 2
+# include <config.h>
+#else
+# include <pyconfig.h>
+#endif
+
+//
 // Python's LongObject.h helpfully #defines ULONGLONG_MAX for us,
 // which confuses Boost's config
 //
@@ -35,11 +52,6 @@
 # define BOOST_PYTHON_ULONGLONG_MAX_UNDEFINED
 #endif
 
-//
-// Get ahold of Python's version number
-//
-#include <patchlevel.h>
-
 #ifdef _DEBUG
 # ifndef BOOST_DEBUG_PYTHON
 # undef _DEBUG // Don't let Python force the debug library just because we're debugging.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk