components/python/python27/patches/00-bits.patch
changeset 458 2edc011b559e
child 698 7144bcdfe7dd
equal deleted inserted replaced
457:aa27b836c528 458:2edc011b559e
       
     1 #
       
     2 # This patch makes the pyconfig.h header file 32/64 bit friendly.
       
     3 #
       
     4 --- Python-2.7.1/configure.in.orig	Tue Jul 12 14:46:56 2011
       
     5 +++ Python-2.7.1/configure.in	Tue Jul 12 14:47:05 2011
       
     6 @@ -12,7 +12,7 @@
       
     7         [],
       
     8         [m4_fatal([Autoconf version $1 is required for Python], 63)])
       
     9  ])
       
    10 -version_required(2.65)
       
    11 +version_required(2.63)
       
    12  
       
    13  AC_REVISION($Revision: 86076 $)
       
    14  AC_INIT(python, PYTHON_VERSION, http://bugs.python.org/)
       
    15 @@ -35,6 +35,41 @@
       
    16  #define Py_PYCONFIG_H
       
    17  ])
       
    18  AH_BOTTOM([
       
    19 +
       
    20 +#include <sys/isa_defs.h>
       
    21 +
       
    22 +/*
       
    23 + * Python originally defined these statically, which prevents a 32-64 python
       
    24 + * from working at all.
       
    25 + */
       
    26 +
       
    27 +#define SIZEOF_SHORT 2
       
    28 +#define SIZEOF_INT 4
       
    29 +#define SIZEOF_LONG_LONG 8
       
    30 +#define SIZEOF_FPOS_T 8
       
    31 +#define SIZEOF_OFF_T 8
       
    32 +#define SIZEOF_PTHREAD_T 4
       
    33 +
       
    34 +#ifdef _LP64
       
    35 +#define SIZEOF_LONG 8
       
    36 +#define SIZEOF_UINTPTR_T 8
       
    37 +#define SIZEOF_VOID_P 8
       
    38 +#define SIZEOF_TIME_T 8
       
    39 +#define SIZEOF_SIZE_T 8
       
    40 +#define SIZEOF_LONG_DOUBLE 16
       
    41 +#else
       
    42 +#define SIZEOF_LONG 4
       
    43 +#define SIZEOF_UINTPTR_T 4
       
    44 +#define SIZEOF_VOID_P 4
       
    45 +#define SIZEOF_TIME_T 4
       
    46 +#define SIZEOF_SIZE_T 4
       
    47 +#if defined(__i386)
       
    48 +#define SIZEOF_LONG_DOUBLE 12
       
    49 +#else
       
    50 +#define SIZEOF_LONG_DOUBLE 16
       
    51 +#endif
       
    52 +#endif
       
    53 +
       
    54  /* Define the macros needed if on a UnixWare 7.x system. */
       
    55  #if defined(__USLC__) && defined(__SCO_VERSION__)
       
    56  #define STRICT_SYSV_CURSES /* Don't use ncurses extensions */
       
    57 @@ -1474,13 +1509,13 @@
       
    58  # Sizes of various common basic types
       
    59  # ANSI C requires sizeof(char) == 1, so no need to check it
       
    60  AC_CHECK_SIZEOF(int, 4)
       
    61 -AC_CHECK_SIZEOF(long, 4)
       
    62 -AC_CHECK_SIZEOF(void *, 4)
       
    63 +dnl AC_CHECK_SIZEOF(long, 4)
       
    64 +dnl AC_CHECK_SIZEOF(void *, 4)
       
    65  AC_CHECK_SIZEOF(short, 2)
       
    66  AC_CHECK_SIZEOF(float, 4)
       
    67  AC_CHECK_SIZEOF(double, 8)
       
    68  AC_CHECK_SIZEOF(fpos_t, 4)
       
    69 -AC_CHECK_SIZEOF(size_t, 4)
       
    70 +dnl AC_CHECK_SIZEOF(size_t, 4)
       
    71  AC_CHECK_SIZEOF(pid_t, 4)
       
    72  
       
    73  AC_MSG_CHECKING(for long long support)
       
    74 @@ -1501,9 +1536,9 @@
       
    75    have_long_double=yes
       
    76  ],[])
       
    77  AC_MSG_RESULT($have_long_double)
       
    78 -if test "$have_long_double" = yes ; then
       
    79 -AC_CHECK_SIZEOF(long double, 12)
       
    80 -fi
       
    81 +dnl if test "$have_long_double" = yes ; then
       
    82 +dnl AC_CHECK_SIZEOF(long double, 12)
       
    83 +dnl fi
       
    84  
       
    85  AC_MSG_CHECKING(for _Bool support)
       
    86  have_c99_bool=no
       
    87 @@ -1517,7 +1552,7 @@
       
    88  fi
       
    89  
       
    90  AC_CHECK_TYPES(uintptr_t, 
       
    91 -   [AC_CHECK_SIZEOF(uintptr_t, 4)], 
       
    92 +   [],
       
    93     [], [#ifdef HAVE_STDINT_H
       
    94          #include <stdint.h>
       
    95          #endif
       
    96 @@ -1534,8 +1569,8 @@
       
    97  AC_MSG_CHECKING(whether to enable large file support)
       
    98  if test "$have_long_long" = yes
       
    99  then
       
   100 -if test "$ac_cv_sizeof_off_t" -gt "$ac_cv_sizeof_long" -a \
       
   101 -	"$ac_cv_sizeof_long_long" -ge "$ac_cv_sizeof_off_t"; then
       
   102 +dnl if test "$ac_cv_sizeof_off_t" -gt "$ac_cv_sizeof_long" -a \
       
   103 +dnl	"$ac_cv_sizeof_long_long" -ge "$ac_cv_sizeof_off_t"; then
       
   104    AC_DEFINE(HAVE_LARGEFILE_SUPPORT, 1, 
       
   105    [Defined to enable large file support when an off_t is bigger than a long
       
   106     and long long is available and at least as big as an off_t. You may need
       
   107 @@ -1542,21 +1577,21 @@
       
   108     to add some flags for configuration and compilation to enable this mode.
       
   109     (For Solaris and Linux, the necessary defines are already defined.)])
       
   110    AC_MSG_RESULT(yes)
       
   111 +dnl else
       
   112 +dnl   AC_MSG_RESULT(no)
       
   113 +dnl fi
       
   114  else
       
   115    AC_MSG_RESULT(no)
       
   116  fi
       
   117 -else
       
   118 -  AC_MSG_RESULT(no)
       
   119 -fi
       
   120  
       
   121 -AC_CHECK_SIZEOF(time_t, [], [
       
   122 -#ifdef HAVE_SYS_TYPES_H
       
   123 -#include <sys/types.h>
       
   124 -#endif
       
   125 -#ifdef HAVE_TIME_H
       
   126 -#include <time.h>
       
   127 -#endif
       
   128 -])
       
   129 +dnl AC_CHECK_SIZEOF(time_t, [], [
       
   130 +dnl #ifdef HAVE_SYS_TYPES_H
       
   131 +dnl #include <sys/types.h>
       
   132 +dnl #endif
       
   133 +dnl #ifdef HAVE_TIME_H
       
   134 +dnl #include <time.h>
       
   135 +dnl #endif
       
   136 +dnl ])
       
   137  
       
   138  # if have pthread_t then define SIZEOF_PTHREAD_T
       
   139  ac_save_cc="$CC"
       
   140 @@ -1906,12 +1941,6 @@
       
   141  if test -z "$CCSHARED"
       
   142  then
       
   143  	case $ac_sys_system/$ac_sys_release in
       
   144 -	SunOS*) if test "$GCC" = yes;
       
   145 -		then CCSHARED="-fPIC";
       
   146 -		elif test `uname -p` = sparc;
       
   147 -		then CCSHARED="-xcode=pic32";
       
   148 -		else CCSHARED="-Kpic";
       
   149 -		fi;;
       
   150  	hp*|HP*) if test "$GCC" = yes;
       
   151  		 then CCSHARED="-fPIC";
       
   152  		 else CCSHARED="+z";