Commit 14abf7e7 authored by Barry Warsaw's avatar Barry Warsaw
parent e723e49a
...@@ -323,8 +323,8 @@ class BuildExtTestCase(TempdirManager, ...@@ -323,8 +323,8 @@ class BuildExtTestCase(TempdirManager,
finally: finally:
os.chdir(old_wd) os.chdir(old_wd)
self.assertTrue(os.path.exists(so_file)) self.assertTrue(os.path.exists(so_file))
self.assertEquals(os.path.splitext(so_file)[-1], so_ext = sysconfig.get_config_var('SO')
sysconfig.get_config_var('SO')) self.assertTrue(so_file.endswith(so_ext))
so_dir = os.path.dirname(so_file) so_dir = os.path.dirname(so_file)
self.assertEquals(so_dir, other_tmp_dir) self.assertEquals(so_dir, other_tmp_dir)
...@@ -333,8 +333,7 @@ class BuildExtTestCase(TempdirManager, ...@@ -333,8 +333,7 @@ class BuildExtTestCase(TempdirManager,
cmd.run() cmd.run()
so_file = cmd.get_outputs()[0] so_file = cmd.get_outputs()[0]
self.assertTrue(os.path.exists(so_file)) self.assertTrue(os.path.exists(so_file))
self.assertEquals(os.path.splitext(so_file)[-1], self.assertTrue(so_file.endswith(so_ext))
sysconfig.get_config_var('SO'))
so_dir = os.path.dirname(so_file) so_dir = os.path.dirname(so_file)
self.assertEquals(so_dir, cmd.build_lib) self.assertEquals(so_dir, cmd.build_lib)
......
...@@ -35,6 +35,7 @@ LINKCC= @LINKCC@ ...@@ -35,6 +35,7 @@ LINKCC= @LINKCC@
AR= @AR@ AR= @AR@
RANLIB= @RANLIB@ RANLIB= @RANLIB@
SVNVERSION= @SVNVERSION@ SVNVERSION= @SVNVERSION@
SOABI= @SOABI@
GNULD= @GNULD@ GNULD= @GNULD@
...@@ -559,6 +560,11 @@ Modules/getpath.o: $(srcdir)/Modules/getpath.c Makefile ...@@ -559,6 +560,11 @@ Modules/getpath.o: $(srcdir)/Modules/getpath.c Makefile
Modules/python.o: $(srcdir)/Modules/python.c Modules/python.o: $(srcdir)/Modules/python.c
$(MAINCC) -c $(PY_CORE_CFLAGS) -o $@ $(srcdir)/Modules/python.c $(MAINCC) -c $(PY_CORE_CFLAGS) -o $@ $(srcdir)/Modules/python.c
Python/dynload_shlib.o: $(srcdir)/Python/dynload_shlib.c Makefile
$(CC) -c $(PY_CORE_CFLAGS) \
-DSOABI='"$(SOABI)"' \
-o $@ $(srcdir)/Python/dynload_shlib.c
$(IO_OBJS): $(IO_H) $(IO_OBJS): $(IO_H)
# Use a stamp file to prevent make -j invoking pgen twice # Use a stamp file to prevent make -j invoking pgen twice
......
...@@ -30,27 +30,34 @@ ...@@ -30,27 +30,34 @@
#define LEAD_UNDERSCORE "" #define LEAD_UNDERSCORE ""
#endif #endif
/* The .so extension module ABI tag, supplied by the Makefile via
Makefile.pre.in and configure. This is used to discriminate between
incompatible .so files so that extensions for different Python builds can
live in the same directory. E.g. foomodule.cpython-32.so
*/
const struct filedescr _PyImport_DynLoadFiletab[] = { const struct filedescr _PyImport_DynLoadFiletab[] = {
#ifdef __CYGWIN__ #ifdef __CYGWIN__
{".dll", "rb", C_EXTENSION}, {".dll", "rb", C_EXTENSION},
{"module.dll", "rb", C_EXTENSION}, {"module.dll", "rb", C_EXTENSION},
#else #else /* !__CYGWIN__ */
#if defined(PYOS_OS2) && defined(PYCC_GCC) #if defined(PYOS_OS2) && defined(PYCC_GCC)
{".pyd", "rb", C_EXTENSION}, {".pyd", "rb", C_EXTENSION},
{".dll", "rb", C_EXTENSION}, {".dll", "rb", C_EXTENSION},
#else #else /* !(defined(PYOS_OS2) && defined(PYCC_GCC)) */
#ifdef __VMS #ifdef __VMS
{".exe", "rb", C_EXTENSION}, {".exe", "rb", C_EXTENSION},
{".EXE", "rb", C_EXTENSION}, {".EXE", "rb", C_EXTENSION},
{"module.exe", "rb", C_EXTENSION}, {"module.exe", "rb", C_EXTENSION},
{"MODULE.EXE", "rb", C_EXTENSION}, {"MODULE.EXE", "rb", C_EXTENSION},
#else #else /* !__VMS */
{"." SOABI ".so", "rb", C_EXTENSION},
{".so", "rb", C_EXTENSION}, {".so", "rb", C_EXTENSION},
{"module." SOABI ".so", "rb", C_EXTENSION},
{"module.so", "rb", C_EXTENSION}, {"module.so", "rb", C_EXTENSION},
#endif #endif /* __VMS */
#endif #endif /* defined(PYOS_OS2) && defined(PYCC_GCC) */
#endif #endif /* __CYGWIN__ */
{0, 0} {0, 0}
}; };
......
This diff is collapsed.
...@@ -12,7 +12,7 @@ m4_define([version_required], ...@@ -12,7 +12,7 @@ m4_define([version_required],
[], [],
[m4_fatal([Autoconf version $1 is required for Python], 63)]) [m4_fatal([Autoconf version $1 is required for Python], 63)])
]) ])
version_required(2.65) AC_PREREQ(2.65)
AC_REVISION($Revision$) AC_REVISION($Revision$)
AC_INIT(python, PYTHON_VERSION, http://bugs.python.org/) AC_INIT(python, PYTHON_VERSION, http://bugs.python.org/)
...@@ -52,6 +52,7 @@ mv confdefs.h.new confdefs.h ...@@ -52,6 +52,7 @@ mv confdefs.h.new confdefs.h
AC_SUBST(VERSION) AC_SUBST(VERSION)
VERSION=PYTHON_VERSION VERSION=PYTHON_VERSION
# Version number or Python's own shared library file.
AC_SUBST(SOVERSION) AC_SUBST(SOVERSION)
SOVERSION=1.0 SOVERSION=1.0
...@@ -817,6 +818,9 @@ if test -z "$LN" ; then ...@@ -817,6 +818,9 @@ if test -z "$LN" ; then
esac esac
fi fi
# For calculating the .so ABI tag.
SOABI_QUALIFIERS=""
# Check for --with-pydebug # Check for --with-pydebug
AC_MSG_CHECKING(for --with-pydebug) AC_MSG_CHECKING(for --with-pydebug)
AC_ARG_WITH(pydebug, AC_ARG_WITH(pydebug,
...@@ -828,6 +832,7 @@ then ...@@ -828,6 +832,7 @@ then
[Define if you want to build an interpreter with many run-time checks.]) [Define if you want to build an interpreter with many run-time checks.])
AC_MSG_RESULT(yes); AC_MSG_RESULT(yes);
Py_DEBUG='true' Py_DEBUG='true'
SOABI_QUALIFIERS="${SOABI_QUALIFIERS}d"
else AC_MSG_RESULT(no); Py_DEBUG='false' else AC_MSG_RESULT(no); Py_DEBUG='false'
fi], fi],
[AC_MSG_RESULT(no)]) [AC_MSG_RESULT(no)])
...@@ -1649,34 +1654,6 @@ AC_SUBST(LDCXXSHARED) ...@@ -1649,34 +1654,6 @@ AC_SUBST(LDCXXSHARED)
AC_SUBST(BLDSHARED) AC_SUBST(BLDSHARED)
AC_SUBST(CCSHARED) AC_SUBST(CCSHARED)
AC_SUBST(LINKFORSHARED) AC_SUBST(LINKFORSHARED)
# SO is the extension of shared libraries `(including the dot!)
# -- usually .so, .sl on HP-UX, .dll on Cygwin
AC_MSG_CHECKING(SO)
if test -z "$SO"
then
case $ac_sys_system in
hp*|HP*)
case `uname -m` in
ia64) SO=.so;;
*) SO=.sl;;
esac
;;
CYGWIN*) SO=.dll;;
*) SO=.so;;
esac
else
# this might also be a termcap variable, see #610332
echo
echo '====================================================================='
echo '+ +'
echo '+ WARNING: You have set SO in your environment. +'
echo '+ Do you really mean to change the extension for shared libraries? +'
echo '+ Continuing in 10 seconds to let you to ponder. +'
echo '+ +'
echo '====================================================================='
sleep 10
fi
AC_MSG_RESULT($SO)
AC_DEFINE_UNQUOTED(SHLIB_EXT, "$SO", [Define this to be extension of shared libraries (including the dot!).]) AC_DEFINE_UNQUOTED(SHLIB_EXT, "$SO", [Define this to be extension of shared libraries (including the dot!).])
# LDSHARED is the ld *command* used to create shared library # LDSHARED is the ld *command* used to create shared library
...@@ -2487,7 +2464,9 @@ AC_ARG_WITH(pymalloc, ...@@ -2487,7 +2464,9 @@ AC_ARG_WITH(pymalloc,
AS_HELP_STRING([--with(out)-pymalloc], [disable/enable specialized mallocs])) AS_HELP_STRING([--with(out)-pymalloc], [disable/enable specialized mallocs]))
if test -z "$with_pymalloc" if test -z "$with_pymalloc"
then with_pymalloc="yes" then
with_pymalloc="yes"
SOABI_QUALIFIERS="${SOABI_QUALIFIERS}m"
fi fi
if test "$with_pymalloc" != "no" if test "$with_pymalloc" != "no"
then then
...@@ -3595,7 +3574,7 @@ fi ...@@ -3595,7 +3574,7 @@ fi
], ],
[ [
case "$have_ucs4_tcl" in case "$have_ucs4_tcl" in
yes) unicode_size="4" ;; yes) unicode_size="4";;
*) unicode_size="2" ;; *) unicode_size="2" ;;
esac esac
]) ])
...@@ -3603,7 +3582,10 @@ esac ...@@ -3603,7 +3582,10 @@ esac
AH_TEMPLATE(Py_UNICODE_SIZE, AH_TEMPLATE(Py_UNICODE_SIZE,
[Define as the size of the unicode type.]) [Define as the size of the unicode type.])
case "$unicode_size" in case "$unicode_size" in
4) AC_DEFINE(Py_UNICODE_SIZE, 4) ;; 4)
AC_DEFINE(Py_UNICODE_SIZE, 4)
SOABI_QUALIFIERS="${SOABI_QUALIFIERS}u"
;;
*) AC_DEFINE(Py_UNICODE_SIZE, 2) ;; *) AC_DEFINE(Py_UNICODE_SIZE, 2) ;;
esac esac
...@@ -3636,6 +3618,55 @@ AC_MSG_RESULT($PY_UNICODE_TYPE) ...@@ -3636,6 +3618,55 @@ AC_MSG_RESULT($PY_UNICODE_TYPE)
# check for endianness # check for endianness
AC_C_BIGENDIAN AC_C_BIGENDIAN
# ABI version string for Python extension modules. This appears between the
# periods in shared library file names, e.g. foo.<SOABI>.so. It is calculated
# from the following attributes which affect the ABI of this Python build (in
# this order):
#
# * The Python implementation (always 'cpython-' for us)
# * The major and minor version numbers
# * --with-pydebug (adds a 'd')
# * --with-pymalloc (adds a 'm')
# * --with-wide-unicode (adds a 'u')
#
# Thus for example, Python 3.2 built with wide unicode, pydebug, and pymalloc,
# would get a shared library ABI version tag of 'cpython-32udm' and shared
# libraries would be named 'foo.cpython-32udm.so'.
AC_SUBST(SOABI)
AC_MSG_CHECKING(SOABI)
SOABI='cpython-'`echo $VERSION | tr -d .`${SOABI_QUALIFIERS}
AC_MSG_RESULT($SOABI)
# SO is the extension of shared libraries `(including the dot!)
# -- usually .so, .sl on HP-UX, .dll on Cygwin
AC_MSG_CHECKING(SO)
if test -z "$SO"
then
case $ac_sys_system in
hp*|HP*)
case `uname -m` in
ia64) SO=.so;;
*) SO=.sl;;
esac
;;
CYGWIN*) SO=.dll;;
Linux*) SO=.${SOABI}.so;;
*) SO=.so;;
esac
else
# this might also be a termcap variable, see #610332
echo
echo '====================================================================='
echo '+ +'
echo '+ WARNING: You have set SO in your environment. +'
echo '+ Do you really mean to change the extension for shared libraries? +'
echo '+ Continuing in 10 seconds to let you to ponder. +'
echo '+ +'
echo '====================================================================='
sleep 10
fi
AC_MSG_RESULT($SO)
# Check whether right shifting a negative integer extends the sign bit # Check whether right shifting a negative integer extends the sign bit
# or fills with zeros (like the Cray J90, according to Tim Peters). # or fills with zeros (like the Cray J90, according to Tim Peters).
AC_MSG_CHECKING(whether right shift extends the sign bit) AC_MSG_CHECKING(whether right shift extends the sign bit)
......
...@@ -1040,7 +1040,7 @@ ...@@ -1040,7 +1040,7 @@
/* Define to 1 if your <sys/time.h> declares `struct tm'. */ /* Define to 1 if your <sys/time.h> declares `struct tm'. */
#undef TM_IN_SYS_TIME #undef TM_IN_SYS_TIME
/* Define to 0 if you don't want to use computed gotos in ceval.c. */ /* Define if you want to use computed gotos in ceval.c. */
#undef USE_COMPUTED_GOTOS #undef USE_COMPUTED_GOTOS
/* Define if the compiler supports the inline keyword */ /* Define if the compiler supports the inline keyword */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment