diff -r a4b66e51e0bf Lib/test/test_sysconfig.py --- a/Lib/test/test_sysconfig.py Mon Apr 13 22:11:34 2015 +0200 +++ b/Lib/test/test_sysconfig.py Wed Apr 15 02:44:28 2015 +0200 @@ -390,10 +390,19 @@ self.assertEqual(vars['SO'], vars['EXT_SUFFIX']) @unittest.skipUnless(sys.platform == 'linux', 'Linux-specific test') - def test_bitness_in_ext_suffix(self): + def test_triplet_in_ext_suffix(self): + import ctypes, platform, re + machine = platform.machine() suffix = sysconfig.get_config_var('EXT_SUFFIX') - bitness = '-32b' if sys.maxsize < 2**32 else '-64b' - self.assertTrue(suffix.endswith(bitness + '.so'), suffix) + if re.match('(aarch64|arm|mips|ppc|powerpc|s390|sparc)', machine): + self.assertTrue('linux' in suffix, suffix) + if re.match('(i[3-6]86|x86_64)$', 'x86_64'): + if ctypes.sizeof(ctypes.c_char_p()) == 4: + self.assertTrue(suffix.endswith('i386-linux-gnu.so') \ + or suffix.endswith('x86_64-linux-gnux32.so'), + suffix) + else: # 8 byte pointer size + self.assertTrue(suffix.endswith('x86_64-linux-gnu.so'), suffix) class MakefileTests(unittest.TestCase): diff -r a4b66e51e0bf Misc/NEWS --- a/Misc/NEWS Mon Apr 13 22:11:34 2015 +0200 +++ b/Misc/NEWS Wed Apr 15 02:44:28 2015 +0200 @@ -10,6 +10,10 @@ Core and Builtins ----------------- +- Issue #22980: Under Linux, GNU/KFreeBSD and the Hurd, C extensions now include + the architecture triplet in the extension name, to make it easy to test builds + for different ABIs in the same working tree. + - Issue #23731: Implement PEP 488: removal of .pyo files. - Issue #23726: Don't enable GC for user subclasses of non-GC types that @@ -357,10 +361,6 @@ Core and Builtins ----------------- -- Issue #22980: Under Linux, C extensions now include bitness in the file - name, to make it easy to test 32-bit and 64-bit builds in the same - working tree. - - Issue #23571: PyObject_Call() and PyCFunction_Call() now raise a SystemError if a function returns a result and raises an exception. The SystemError is chained to the previous exception. diff -r a4b66e51e0bf configure.ac --- a/configure.ac Mon Apr 13 22:11:34 2015 +0200 +++ b/configure.ac Wed Apr 15 02:44:28 2015 +0200 @@ -425,7 +425,7 @@ esac _PYTHON_HOST_PLATFORM="$MACHDEP${_host_cpu:+-$_host_cpu}" fi - + # Some systems cannot stand _XOPEN_SOURCE being defined at all; they # disable features if it is defined, without any means to access these # features as extensions. For these systems, we skip the definition of @@ -667,6 +667,8 @@ fi fi AC_PROG_CC +AC_PROG_CPP +AC_PROG_GREP AC_SUBST(CXX) AC_SUBST(MAINCC) @@ -724,6 +726,132 @@ fi +MULTIARCH=$($CC --print-multiarch 2>/dev/null) +AC_SUBST(MULTIARCH) + +AC_MSG_CHECKING([for the platform triplet based on compiler characteristics]) +cat >> conftest.c <conftest.out 2>/dev/null; then + PLATFORM_TRIPLET=`grep -v '^#' conftest.out | grep -v '^ *$' | tr -d ' '` + AC_MSG_RESULT([$PLATFORM_TRIPLET]) +else + AC_MSG_RESULT([none]) +fi +rm -f conftest.c conftest.out + +if test x$PLATFORM_TRIPLET != x && test x$MULTIARCH != x; then + if test x$PLATFORM_TRIPLET != x$MULTIARCH; then + AC_MSG_ERROR([internal configure error for the platform triplet, please file a bug report]) + fi +fi +PLATDIR=plat-$MACHDEP +AC_SUBST(PLATDIR) +AC_SUBST(PLATFORM_TRIPLET) + + AC_MSG_CHECKING([for -Wl,--no-as-needed]) save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -Wl,--no-as-needed" @@ -791,10 +919,6 @@ esac;; esac -MULTIARCH=$($CC --print-multiarch 2>/dev/null) -AC_SUBST(MULTIARCH) - - AC_SUBST(LIBRARY) AC_MSG_CHECKING(LIBRARY) if test -z "$LIBRARY" @@ -4173,15 +4297,7 @@ AC_MSG_CHECKING(ABIFLAGS) AC_MSG_RESULT($ABIFLAGS) AC_MSG_CHECKING(SOABI) - -case $ac_sys_system in - Linux*|GNU*) - BITNESS_SUFFIX=-$(($ac_cv_sizeof_void_p * 8))b;; - *) - BITNESS_SUFFIX=;; -esac -SOABI='cpython-'`echo $VERSION | tr -d .`${ABIFLAGS}${BITNESS_SUFFIX} - +SOABI='cpython-'`echo $VERSION | tr -d .`${ABIFLAGS}${PLATFORM_TRIPLET:+-$PLATFORM_TRIPLET} AC_MSG_RESULT($SOABI) AC_SUBST(EXT_SUFFIX)