Browse Source

Fix HAVE_LOCKF in dtoolbase.h for python headers that don't define it.

kestred 12 years ago
parent
commit
f4bf740362
1 changed files with 15 additions and 4 deletions
  1. 15 4
      dtool/src/dtoolbase/dtoolbase.h

+ 15 - 4
dtool/src/dtoolbase/dtoolbase.h

@@ -104,10 +104,21 @@
 #endif
 
 #ifdef HAVE_PYTHON
-#undef _POSIX_C_SOURCE
-#undef _XOPEN_SOURCE
-#undef HAVE_LOCKF
-#include "pyconfig.h"
+#  undef _POSIX_C_SOURCE
+#  undef _XOPEN_SOURCE
+// Some versions of python also define HAVE_LOCKF
+#  ifdef HAVE_LOCKF
+#    define PANDA_HAVE_LOCKF
+#    undef HAVE_LOCKF
+#  endif
+#  include "pyconfig.h"
+// Restore our HAVE_LOCKF if python didn't define it
+#  ifdef PANDA_HAVE_LOCKF
+#    undef PANDA_HAVE_LOCKF
+#    ifndef HAVE_LOCKF
+#      define HAVE_LOCKF 1
+#    endif
+#  endif
 #endif
 
 #ifndef HAVE_EIGEN