components/python/python27/patches/00-bits.patch
author Mike Sullivan <Mike.Sullivan@Oracle.COM>
Mon, 11 Mar 2013 10:38:09 -0700
branchs11-update
changeset 2520 ceec631e74d1
parent 885 2af25a1da825
child 1246 164605dfef4e
child 3367 ed5024e47b53
permissions -rw-r--r--
Close of build 10.

#
# 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
@@ -5,7 +5,7 @@
 # Set VERSION so we only need to edit in one place (i.e., here)
 m4_define(PYTHON_VERSION, 2.7)
 
-AC_PREREQ(2.65)
+AC_PREREQ(2.68)
 
 AC_REVISION($Revision$)
 AC_INIT(python, PYTHON_VERSION, http://bugs.python.org/)
@@ -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 */
@@ -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)
@@ -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
@@ -1517,7 +1552,7 @@
 fi
 
 AC_CHECK_TYPES(uintptr_t, 
-   [AC_CHECK_SIZEOF(uintptr_t, 4)], 
+   [],
    [], [#ifdef HAVE_STDINT_H
         #include <stdint.h>
         #endif
@@ -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
@@ -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"
@@ -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";