components/python/python27/patches/00-bits.patch
changeset 458 2edc011b559e
child 698 7144bcdfe7dd
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/python/python27/patches/00-bits.patch	Thu Aug 04 19:59:04 2011 -0700
@@ -0,0 +1,152 @@
+#
+# This patch makes the pyconfig.h header file 32/64 bit friendly.
+#
+--- Python-2.7.1/configure.in.orig	Tue Jul 12 14:46:56 2011
++++ Python-2.7.1/configure.in	Tue Jul 12 14:47:05 2011
[email protected]@ -12,7 +12,7 @@
+        [],
+        [m4_fatal([Autoconf version $1 is required for Python], 63)])
+ ])
+-version_required(2.65)
++version_required(2.63)
+ 
+ AC_REVISION($Revision: 86076 $)
+ AC_INIT(python, PYTHON_VERSION, http://bugs.python.org/)
[email protected]@ -35,6 +35,41 @@
+ #define Py_PYCONFIG_H
+ ])
+ AH_BOTTOM([
++
++#include <sys/isa_defs.h>
++
++/*
++ * Python originally defined these statically, which prevents a 32-64 python
++ * from working at all.
++ */
++
++#define SIZEOF_SHORT 2
++#define SIZEOF_INT 4
++#define SIZEOF_LONG_LONG 8
++#define SIZEOF_FPOS_T 8
++#define SIZEOF_OFF_T 8
++#define SIZEOF_PTHREAD_T 4
++
++#ifdef _LP64
++#define SIZEOF_LONG 8
++#define SIZEOF_UINTPTR_T 8
++#define SIZEOF_VOID_P 8
++#define SIZEOF_TIME_T 8
++#define SIZEOF_SIZE_T 8
++#define SIZEOF_LONG_DOUBLE 16
++#else
++#define SIZEOF_LONG 4
++#define SIZEOF_UINTPTR_T 4
++#define SIZEOF_VOID_P 4
++#define SIZEOF_TIME_T 4
++#define SIZEOF_SIZE_T 4
++#if defined(__i386)
++#define SIZEOF_LONG_DOUBLE 12
++#else
++#define SIZEOF_LONG_DOUBLE 16
++#endif
++#endif
++
+ /* Define the macros needed if on a UnixWare 7.x system. */
+ #if defined(__USLC__) && defined(__SCO_VERSION__)
+ #define STRICT_SYSV_CURSES /* Don't use ncurses extensions */
[email protected]@ -1474,13 +1509,13 @@
+ # Sizes of various common basic types
+ # ANSI C requires sizeof(char) == 1, so no need to check it
+ AC_CHECK_SIZEOF(int, 4)
+-AC_CHECK_SIZEOF(long, 4)
+-AC_CHECK_SIZEOF(void *, 4)
++dnl AC_CHECK_SIZEOF(long, 4)
++dnl AC_CHECK_SIZEOF(void *, 4)
+ AC_CHECK_SIZEOF(short, 2)
+ AC_CHECK_SIZEOF(float, 4)
+ AC_CHECK_SIZEOF(double, 8)
+ AC_CHECK_SIZEOF(fpos_t, 4)
+-AC_CHECK_SIZEOF(size_t, 4)
++dnl AC_CHECK_SIZEOF(size_t, 4)
+ AC_CHECK_SIZEOF(pid_t, 4)
+ 
+ AC_MSG_CHECKING(for long long support)
[email protected]@ -1501,9 +1536,9 @@
+   have_long_double=yes
+ ],[])
+ AC_MSG_RESULT($have_long_double)
+-if test "$have_long_double" = yes ; then
+-AC_CHECK_SIZEOF(long double, 12)
+-fi
++dnl if test "$have_long_double" = yes ; then
++dnl AC_CHECK_SIZEOF(long double, 12)
++dnl fi
+ 
+ AC_MSG_CHECKING(for _Bool support)
+ have_c99_bool=no
[email protected]@ -1517,7 +1552,7 @@
+ fi
+ 
+ AC_CHECK_TYPES(uintptr_t, 
+-   [AC_CHECK_SIZEOF(uintptr_t, 4)], 
++   [],
+    [], [#ifdef HAVE_STDINT_H
+         #include <stdint.h>
+         #endif
[email protected]@ -1534,8 +1569,8 @@
+ AC_MSG_CHECKING(whether to enable large file support)
+ if test "$have_long_long" = yes
+ then
+-if test "$ac_cv_sizeof_off_t" -gt "$ac_cv_sizeof_long" -a \
+-	"$ac_cv_sizeof_long_long" -ge "$ac_cv_sizeof_off_t"; then
++dnl if test "$ac_cv_sizeof_off_t" -gt "$ac_cv_sizeof_long" -a \
++dnl	"$ac_cv_sizeof_long_long" -ge "$ac_cv_sizeof_off_t"; then
+   AC_DEFINE(HAVE_LARGEFILE_SUPPORT, 1, 
+   [Defined to enable large file support when an off_t is bigger than a long
+    and long long is available and at least as big as an off_t. You may need
[email protected]@ -1542,21 +1577,21 @@
+    to add some flags for configuration and compilation to enable this mode.
+    (For Solaris and Linux, the necessary defines are already defined.)])
+   AC_MSG_RESULT(yes)
++dnl else
++dnl   AC_MSG_RESULT(no)
++dnl fi
+ else
+   AC_MSG_RESULT(no)
+ fi
+-else
+-  AC_MSG_RESULT(no)
+-fi
+ 
+-AC_CHECK_SIZEOF(time_t, [], [
+-#ifdef HAVE_SYS_TYPES_H
+-#include <sys/types.h>
+-#endif
+-#ifdef HAVE_TIME_H
+-#include <time.h>
+-#endif
+-])
++dnl AC_CHECK_SIZEOF(time_t, [], [
++dnl #ifdef HAVE_SYS_TYPES_H
++dnl #include <sys/types.h>
++dnl #endif
++dnl #ifdef HAVE_TIME_H
++dnl #include <time.h>
++dnl #endif
++dnl ])
+ 
+ # if have pthread_t then define SIZEOF_PTHREAD_T
+ ac_save_cc="$CC"
[email protected]@ -1906,12 +1941,6 @@
+ if test -z "$CCSHARED"
+ then
+ 	case $ac_sys_system/$ac_sys_release in
+-	SunOS*) if test "$GCC" = yes;
+-		then CCSHARED="-fPIC";
+-		elif test `uname -p` = sparc;
+-		then CCSHARED="-xcode=pic32";
+-		else CCSHARED="-Kpic";
+-		fi;;
+ 	hp*|HP*) if test "$GCC" = yes;
+ 		 then CCSHARED="-fPIC";
+ 		 else CCSHARED="+z";