1 From 7cfa712eecf02edaefaf0e51f3c8a31933b88db1 Mon Sep 17 00:00:00 2001
2 From: Matthias Schoepfer <matthias.schoepfer@ithinx.io>
3 Date: Fri, 31 May 2019 15:34:34 +0200
4 Subject: [PATCH] bpo-36852: proper detection of mips architecture for soft
8 When (cross) compiling for softfloat mips, __mips_hard_float will not be
9 defined and detection of OS triplet in configure.ac / configure will fail.
11 This also has to do with the custom detection of the build triplet. Trying
12 to do this in a more autoconf/autotools manner.
14 Upstream-Status: Submitted [https://github.com/python/cpython/pull/13196]
15 Signed-off-by: Matthias Schoepfer <matthias.schoepfer@ithinx.io>
19 configure.ac | 175 +++++++--------------------------------------------
20 1 file changed, 21 insertions(+), 154 deletions(-)
22 diff --git a/configure.ac b/configure.ac
23 index 299786b..d0db062 100644
26 @@ -718,160 +718,27 @@ then
30 -AC_MSG_CHECKING([for the platform triplet based on compiler characteristics])
31 -cat >> conftest.c <<EOF
43 -#if defined(__ANDROID__)
44 - # Android is not a multiarch system.
45 -#elif defined(__linux__)
46 -# if defined(__x86_64__) && defined(__LP64__)
48 -# elif defined(__x86_64__) && defined(__ILP32__)
50 -# elif defined(__i386__)
52 -# elif defined(__aarch64__) && defined(__AARCH64EL__)
53 -# if defined(__ILP32__)
54 - aarch64_ilp32-linux-gnu
58 -# elif defined(__aarch64__) && defined(__AARCH64EB__)
59 -# if defined(__ILP32__)
60 - aarch64_be_ilp32-linux-gnu
62 - aarch64_be-linux-gnu
64 -# elif defined(__alpha__)
66 -# elif defined(__ARM_EABI__) && defined(__ARM_PCS_VFP)
67 -# if defined(__ARMEL__)
70 - armeb-linux-gnueabihf
72 -# elif defined(__ARM_EABI__) && !defined(__ARM_PCS_VFP)
73 -# if defined(__ARMEL__)
78 -# elif defined(__hppa__)
80 -# elif defined(__ia64__)
82 -# elif defined(__m68k__) && !defined(__mcoldfire__)
84 -# elif defined(__mips_hard_float) && defined(__mips_isa_rev) && (__mips_isa_rev >=6) && defined(_MIPSEL)
85 -# if _MIPS_SIM == _ABIO32
86 - mipsisa32r6el-linux-gnu
87 -# elif _MIPS_SIM == _ABIN32
88 - mipsisa64r6el-linux-gnuabin32
89 -# elif _MIPS_SIM == _ABI64
90 - mipsisa64r6el-linux-gnuabi64
92 -# error unknown platform triplet
94 -# elif defined(__mips_hard_float) && defined(__mips_isa_rev) && (__mips_isa_rev >=6)
95 -# if _MIPS_SIM == _ABIO32
96 - mipsisa32r6-linux-gnu
97 -# elif _MIPS_SIM == _ABIN32
98 - mipsisa64r6-linux-gnuabin32
99 -# elif _MIPS_SIM == _ABI64
100 - mipsisa64r6-linux-gnuabi64
102 -# error unknown platform triplet
104 -# elif defined(__mips_hard_float) && defined(_MIPSEL)
105 -# if _MIPS_SIM == _ABIO32
107 -# elif _MIPS_SIM == _ABIN32
108 - mips64el-linux-gnuabin32
109 -# elif _MIPS_SIM == _ABI64
110 - mips64el-linux-gnuabi64
112 -# error unknown platform triplet
114 -# elif defined(__mips_hard_float)
115 -# if _MIPS_SIM == _ABIO32
117 -# elif _MIPS_SIM == _ABIN32
118 - mips64-linux-gnuabin32
119 -# elif _MIPS_SIM == _ABI64
120 - mips64-linux-gnuabi64
122 -# error unknown platform triplet
124 -# elif defined(__or1k__)
126 -# elif defined(__powerpc__) && defined(__SPE__)
127 - powerpc-linux-gnuspe
128 -# elif defined(__powerpc64__)
129 -# if defined(__LITTLE_ENDIAN__)
130 - powerpc64le-linux-gnu
132 - powerpc64-linux-gnu
134 -# elif defined(__powerpc__)
136 -# elif defined(__s390x__)
138 -# elif defined(__s390__)
140 -# elif defined(__sh__) && defined(__LITTLE_ENDIAN__)
142 -# elif defined(__sparc__) && defined(__arch64__)
144 -# elif defined(__sparc__)
146 -# elif defined(__riscv)
147 -# if __riscv_xlen == 32
149 -# elif __riscv_xlen == 64
152 -# error unknown platform triplet
155 -# error unknown platform triplet
157 -#elif defined(__FreeBSD_kernel__)
158 -# if defined(__LP64__)
159 - x86_64-kfreebsd-gnu
160 -# elif defined(__i386__)
163 -# error unknown platform triplet
165 -#elif defined(__gnu_hurd__)
167 -#elif defined(__APPLE__)
169 -#elif defined(__VXWORKS__)
172 -# error unknown platform triplet
177 -if $CPP $CPPFLAGS conftest.c >conftest.out 2>/dev/null; then
178 - PLATFORM_TRIPLET=`grep -v '^#' conftest.out | grep -v '^ *$' | tr -d ' '`
179 - AC_MSG_RESULT([$PLATFORM_TRIPLET])
181 - AC_MSG_RESULT([none])
183 -rm -f conftest.c conftest.out
185 +## Not using $target to filter out vendor
186 +## Need to handle macos, vxworks and hurd special (?) :-/
187 +case ${target_os} in
189 + PLATFORM_TRIPLET=darwin
192 + PLATFORM_TRIPLET=i386-gnu
195 + PLATFORM_TRIPLET=vxworks
198 + if test "${target_cpu}" != "i686"; then
199 + PLATFORM_TRIPLET=${target_cpu}-${target_os}
201 + PLATFORM_TRIPLET=i386-${target_os}
206 if test x$PLATFORM_TRIPLET != xdarwin; then
207 MULTIARCH=$($CC --print-multiarch 2>/dev/null)