diff options
author | doko@ubuntu.com <doko@ubuntu.com> | 2015-04-15 18:23:14 (GMT) |
---|---|---|
committer | doko@ubuntu.com <doko@ubuntu.com> | 2015-04-15 18:23:14 (GMT) |
commit | d3899c1a962f4f06f52199d1e5e4b921843e587b (patch) | |
tree | 4e5ecaa46fda3b224516a58f7c639239a5cba2af /configure.ac | |
parent | 7a80389ce5b2687137884e423d3bda27ff5d3acc (diff) | |
download | cpython-d3899c1a962f4f06f52199d1e5e4b921843e587b.zip cpython-d3899c1a962f4f06f52199d1e5e4b921843e587b.tar.gz cpython-d3899c1a962f4f06f52199d1e5e4b921843e587b.tar.bz2 |
- 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.
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 144 |
1 files changed, 130 insertions, 14 deletions
diff --git a/configure.ac b/configure.ac index d15f264..e22918a 100644 --- a/configure.ac +++ b/configure.ac @@ -425,7 +425,7 @@ if test "$cross_compiling" = yes; then 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 @@ then fi fi AC_PROG_CC +AC_PROG_CPP +AC_PROG_GREP AC_SUBST(CXX) AC_SUBST(MAINCC) @@ -724,6 +726,132 @@ then 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 <<EOF +#undef linux +#undef i386 +#undef unix +#if defined(__linux__) +# if defined(__x86_64__) && defined(__LP64__) + x86_64-linux-gnu +# elif defined(__x86_64__) && defined(__ILP32__) + x86_64-linux-gnux32 +# elif defined(__i386__) + i386-linux-gnu +# elif defined(__aarch64__) && defined(__AARCH64EL__) +# if defined(__ILP32__) + aarch64_ilp32-linux-gnu +# else + aarch64-linux-gnu +# endif +# elif defined(__aarch64__) && defined(__AARCH64EB__) +# if defined(__ILP32__) + aarch64_be_ilp32-linux-gnu +# else + aarch64_be-linux-gnu +# endif +# elif defined(__alpha__) + alpha-linux-gnu +# elif defined(__ARM_EABI__) && defined(__ARM_PCS_VFP) +# if defined(__ARMEL__) + arm-linux-gnueabihf +# else + armeb-linux-gnueabihf +# endif +# elif defined(__ARM_EABI__) && !defined(__ARM_PCS_VFP) +# if defined(__ARMEL__) + arm-linux-gnueabi +# else + armeb-linux-gnueabi +# endif +# elif defined(__hppa__) + hppa-linux-gnu +# elif defined(__ia64__) + ia64-linux-gnu +# elif defined(__m68k__) && !defined(__mcoldfire__) + m68k-linux-gnu +# elif defined(__mips_hard_float) && defined(_MIPSEL) +# if _MIPS_SIM == _ABIO32 + mipsel-linux-gnu +# elif _MIPS_SIM == _ABIN32 + mips64el-linux-gnuabin32 +# elif _MIPS_SIM == _ABI64 + mips64el-linux-gnuabi64 +# else +# error unknown platform triplet +# endif +# elif defined(__mips_hard_float) +# if _MIPS_SIM == _ABIO32 + mips-linux-gnu +# elif _MIPS_SIM == _ABIN32 + mips64-linux-gnuabin32 +# elif _MIPS_SIM == _ABI64 + mips64-linux-gnuabi64 +# else +# error unknown platform triplet +# endif +# elif defined(__or1k__) + or1k-linux-gnu +# elif defined(__powerpc__) && defined(__SPE__) + powerpc-linux-gnuspe +# elif defined(__powerpc64__) +# if defined(__LITTLE_ENDIAN__) + powerpc64le-linux-gnu +# else + powerpc64-linux-gnu +# endif +# elif defined(__powerpc__) + powerpc-linux-gnu +# elif defined(__s390x__) + s390x-linux-gnu +# elif defined(__s390__) + s390-linux-gnu +# elif defined(__sh__) && defined(__LITTLE_ENDIAN__) + sh4-linux-gnu +# elif defined(__sparc__) && defined(__arch64__) + sparc64-linux-gnu +# elif defined(__sparc__) + sparc-linux-gnu +# else +# error unknown platform triplet +# endif +#elif defined(__FreeBSD_kernel__) +# if defined(__LP64__) + x86_64-kfreebsd-gnu +# elif defined(__i386__) + i386-kfreebsd-gnu +# else +# error unknown platform triplet +# endif +#elif defined(__gnu_hurd__) + i386-gnu +#else +# error unknown platform triplet +#endif + +EOF + +if $CPP 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 @@ hp*|HP*) esac;; esac -MULTIARCH=$($CC --print-multiarch 2>/dev/null) -AC_SUBST(MULTIARCH) - - AC_SUBST(LIBRARY) AC_MSG_CHECKING(LIBRARY) if test -z "$LIBRARY" @@ -4183,15 +4307,7 @@ AC_SUBST(SOABI) 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) |