diff --git Python-2.6.4/Lib/distutils/command/build_ext.py Python-2.6.4/Lib/distutils/command/build_ext.py
--- Python-2.6.4/Lib/distutils/command/build_ext.py
+++ Python-2.6.4/Lib/distutils/command/build_ext.py
@@ -636,6 +636,8 @@
modpath = fullname.split('.')
filename = self.get_ext_filename(ext_name)
filename = os.path.split(filename)[-1]
+ if sys.maxint != 2147483647L:
+ filename = os.path.join("64", filename)
if not self.inplace:
# no further work needed
@@ -677,7 +679,13 @@
so_ext = get_config_var('SO')
if os.name == 'nt' and self.debug:
return os.path.join(*ext_path) + '_d' + so_ext
- return os.path.join(*ext_path) + so_ext
+ # .so extensions are word-size specific
+ path = apply(os.path.join, ext_path)
+ if sys.maxint == 2147483647L:
+ return path + so_ext
+ dirname = os.path.dirname(path);
+ basename = os.path.basename(path);
+ return os.path.join(dirname, "64", basename + so_ext)
def get_export_symbols (self, ext):
"""Return the list of symbols that a shared extension has to
diff --git Python-2.6.4/Makefile.pre.in Python-2.6.4/Makefile.pre.in
--- Python-2.6.4/Makefile.pre.in
+++ Python-2.6.4/Makefile.pre.in
@@ -94,11 +94,11 @@
SCRIPTDIR= $(prefix)/lib
# Detailed destination directories
-BINLIBDEST= $(LIBDIR)/python$(VERSION)
-LIBDEST= $(SCRIPTDIR)/python$(VERSION)
-INCLUDEPY= $(INCLUDEDIR)/python$(VERSION)
-CONFINCLUDEPY= $(CONFINCLUDEDIR)/python$(VERSION)
-LIBP= $(LIBDIR)/python$(VERSION)
+BINLIBDEST= $(exec_prefix)/lib/python$(VERSION)
+LIBDEST= $(SCRIPTDIR)/python$(VERSION)
+INCLUDEPY= $(INCLUDEDIR)/python$(VERSION)
+CONFINCLUDEPY= $(CONFINCLUDEDIR)/python$(VERSION)
+LIBP= $(exec_prefix)/lib/python$(VERSION)
# Symbols used for using shared libraries
SO= @SO@
diff --git Python-2.6.4/Python/import.c Python-2.6.4/Python/import.c
--- Python-2.6.4/Python/import.c
+++ Python-2.6.4/Python/import.c
@@ -1193,6 +1193,57 @@
static int find_init_module(char *); /* Forward */
static struct filedescr importhookdescr = {"", "", IMP_HOOK};
+#ifdef HAVE_STAT
+static char *
+insert_64dir(char *buf, size_t buflen)
+{
+ char *base;
+ char *cp;
+ size_t blen;
+
+ if ((blen = strlen(buf)) == 0)
+ return (NULL);
+
+ cp = &buf[blen - 1];
+ while (cp != buf && *cp != SEP)
+ cp--;
+
+ if (cp != buf)
+ cp++;
+
+ if (blen + strlen("64/") + 1 >= buflen)
+ return NULL;
+
+ base = strdup(cp);
+ sprintf(cp, "64%c%s", SEP, base);
+ free(base);
+
+ return buf;
+}
+
+/*
+ * If we're on a 64-bit platform, modify lookups for shared object files.
+ */
+static size_t modify_path(struct filedescr *fdp, char *buf, size_t buflen)
+{
+ struct stat statbuf;
+
+ if (sizeof(void *) != 8)
+ return 0;
+
+ if (stat(buf, &statbuf) == 0 && S_ISDIR(statbuf.st_mode))
+ return 0;
+
+ if (fdp->type != C_EXTENSION)
+ return 0;
+
+ if (insert_64dir(buf, buflen) == NULL)
+ return 0;
+
+ return strlen("64/");
+}
+#endif
+
static struct filedescr *
find_module(char *fullname, char *subname, PyObject *path, char *buf,
size_t buflen, FILE **p_fp, PyObject **p_loader)
@@ -1210,11 +1261,10 @@
static struct filedescr fd_builtin = {"", "", C_BUILTIN};
static struct filedescr fd_package = {"", "", PKG_DIRECTORY};
char name[MAXPATHLEN+1];
-#if defined(PYOS_OS2)
size_t saved_len;
size_t saved_namelen;
char *saved_buf = NULL;
-#endif
+
if (p_loader != NULL)
*p_loader = NULL;
@@ -1433,15 +1483,18 @@
}
#endif
#endif
-#if defined(PYOS_OS2)
+
/* take a snapshot of the module spec for restoration
* after the 8 character DLL hackery
*/
saved_buf = strdup(buf);
saved_len = len;
saved_namelen = namelen;
-#endif /* PYOS_OS2 */
+
for (fdp = _PyImport_Filetab; fdp->suffix != NULL; fdp++) {
+#ifdef HAVE_STAT
+ len += modify_path(fdp, buf, buflen);
+#endif
#if defined(PYOS_OS2) && defined(HAVE_DYNAMIC_LOADING)
/* OS/2 limits DLLs to 8 character names (w/o
extension)
@@ -1482,21 +1535,18 @@
fp = NULL;
}
}
-#if defined(PYOS_OS2)
+
/* restore the saved snapshot */
strcpy(buf, saved_buf);
len = saved_len;
namelen = saved_namelen;
-#endif
}
-#if defined(PYOS_OS2)
/* don't need/want the module name snapshot anymore */
if (saved_buf)
{
free(saved_buf);
saved_buf = NULL;
}
-#endif
Py_XDECREF(copy);
if (fp != NULL)
break;
diff --git Python-2.6.4/Python/importdl.h Python-2.6.4/Python/importdl.h
--- Python-2.6.4/Python/importdl.h
+++ Python-2.6.4/Python/importdl.h
@@ -31,8 +31,9 @@
extern PyObject *_PyImport_LoadDynamicModule(char *name, char *pathname,
FILE *);
-/* Max length of module suffix searched for -- accommodates "module.slb" */
-#define MAXSUFFIXSIZE 12
+/* Max length of module suffix searched for -- accommodates "module.slb"
+ and "64/" */
+#define MAXSUFFIXSIZE 15
#ifdef MS_WINDOWS
#include <windows.h>
diff --git Python-2.6.4/configure.in Python-2.6.4/configure.in
--- Python-2.6.4/configure.in
+++ Python-2.6.4/configure.in
@@ -17,8 +17,44 @@
AH_TOP([
#ifndef Py_PYCONFIG_H
#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 */
@@ -65,6 +101,26 @@
define_xopen_source=yes
+# AC_CHECK_SIZEOF without the AC_DEFINE_UNQUOTED
+AC_DEFUN([PY_CHECK_SIZEOF],
+[AS_LITERAL_IF([$1], [],
+ [AC_FATAL([$0: requires literal arguments])])dnl
+AC_CHECK_TYPE([$1], [], [], [$3])
+AC_CACHE_CHECK([size of $1], AS_TR_SH([ac_cv_sizeof_$1]),
+[if test "$AS_TR_SH([ac_cv_type_$1])" = yes; then
+ # The cast to unsigned long works around a bug in the HP C Compiler
+ # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+ # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+ # This bug is HP SR number 8606223364.
+ _AC_COMPUTE_INT([(long) (sizeof ($1))],
+ [AS_TR_SH([ac_cv_sizeof_$1])],
+ [AC_INCLUDES_DEFAULT([$3])],
+ [AC_MSG_FAILURE([cannot compute sizeof ($1), 77])])
+else
+ AS_TR_SH([ac_cv_sizeof_$1])=0
+fi])dnl
+])# PY_CHECK_SIZEOF
+
# Arguments passed to configure.
AC_SUBST(CONFIG_ARGS)
CONFIG_ARGS="$ac_configure_args"
@@ -1436,14 +1492,10 @@
# 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)
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)
+AC_CHECK_SIZEOF(short)
AC_CHECK_SIZEOF(pid_t, 4)
AC_MSG_CHECKING(for long long support)
@@ -1453,9 +1505,6 @@
have_long_long=yes
])
AC_MSG_RESULT($have_long_long)
-if test "$have_long_long" = yes ; then
-AC_CHECK_SIZEOF(long long, 8)
-fi
AC_MSG_CHECKING(for long double support)
have_long_double=no
@@ -1463,10 +1512,6 @@
AC_DEFINE(HAVE_LONG_DOUBLE, 1, [Define this if you have the type long double.])
have_long_double=yes
])
-AC_MSG_RESULT($have_long_double)
-if test "$have_long_double" = yes ; then
-AC_CHECK_SIZEOF(long double, 12)
-fi
AC_MSG_CHECKING(for _Bool support)
have_c99_bool=no
@@ -1480,106 +1525,25 @@
fi
AC_CHECK_TYPES(uintptr_t,
- [AC_CHECK_SIZEOF(uintptr_t, 4)],
+ [],
[], [#ifdef HAVE_STDINT_H
#include <stdint.h>
#endif])
-# Hmph. AC_CHECK_SIZEOF() doesn't include <sys/types.h>.
-AC_MSG_CHECKING(size of off_t)
-AC_CACHE_VAL(ac_cv_sizeof_off_t,
-[AC_TRY_RUN([#include <stdio.h>
+PY_CHECK_SIZEOF(off_t,4,[
+#include <stdio.h>
+#include <stdlib.h>
#include <sys/types.h>
-main()
-{
- FILE *f=fopen("conftestval", "w");
- if (!f) exit(1);
- fprintf(f, "%d\n", sizeof(off_t));
- exit(0);
-}],
-ac_cv_sizeof_off_t=`cat conftestval`,
-ac_cv_sizeof_off_t=0,
-ac_cv_sizeof_off_t=4)
-])
-AC_MSG_RESULT($ac_cv_sizeof_off_t)
-AC_DEFINE_UNQUOTED(SIZEOF_OFF_T, $ac_cv_sizeof_off_t,
-[The number of bytes in an off_t.])
-
-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
- 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
- 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)
-else
- AC_MSG_RESULT(no)
-fi
-else
- AC_MSG_RESULT(no)
-fi
-
-# AC_CHECK_SIZEOF() doesn't include <time.h>.
-AC_MSG_CHECKING(size of time_t)
-AC_CACHE_VAL(ac_cv_sizeof_time_t,
-[AC_TRY_RUN([#include <stdio.h>
-#include <time.h>
-main()
-{
- FILE *f=fopen("conftestval", "w");
- if (!f) exit(1);
- fprintf(f, "%d\n", sizeof(time_t));
- exit(0);
-}],
-ac_cv_sizeof_time_t=`cat conftestval`,
-ac_cv_sizeof_time_t=0,
-ac_cv_sizeof_time_t=4)
])
-AC_MSG_RESULT($ac_cv_sizeof_time_t)
-AC_DEFINE_UNQUOTED(SIZEOF_TIME_T, $ac_cv_sizeof_time_t,
-[The number of bytes in a time_t.])
-
-# if have pthread_t then define SIZEOF_PTHREAD_T
-ac_save_cc="$CC"
-if test "$ac_cv_kpthread" = "yes"
-then CC="$CC -Kpthread"
-elif test "$ac_cv_kthread" = "yes"
-then CC="$CC -Kthread"
-elif test "$ac_cv_pthread" = "yes"
-then CC="$CC -pthread"
-fi
-AC_MSG_CHECKING(for pthread_t)
-have_pthread_t=no
-AC_TRY_COMPILE([#include <pthread.h>], [pthread_t x; x = *(pthread_t*)0;], have_pthread_t=yes)
-AC_MSG_RESULT($have_pthread_t)
-if test "$have_pthread_t" = yes ; then
- # AC_CHECK_SIZEOF() doesn't include <pthread.h>.
- AC_MSG_CHECKING(size of pthread_t)
- AC_CACHE_VAL(ac_cv_sizeof_pthread_t,
- [AC_TRY_RUN([#include <stdio.h>
-#include <pthread.h>
- main()
- {
- FILE *f=fopen("conftestval", "w");
- if (!f) exit(1);
- fprintf(f, "%d\n", sizeof(pthread_t));
- exit(0);
- }],
- ac_cv_sizeof_pthread_t=`cat conftestval`,
- ac_cv_sizeof_pthread_t=0,
- ac_cv_sizeof_pthread_t=4)
- ])
- AC_MSG_RESULT($ac_cv_sizeof_pthread_t)
- AC_DEFINE_UNQUOTED(SIZEOF_PTHREAD_T, $ac_cv_sizeof_pthread_t,
- [The number of bytes in a pthread_t.])
-fi
-CC="$ac_save_cc"
+AC_MSG_CHECKING(whether to enable large file support)
+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
+ 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)
AC_MSG_CHECKING(for --enable-toolbox-glue)
AC_ARG_ENABLE(toolbox-glue,
@@ -1873,12 +1837,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";