1 From 1ad771d86728ee2ed30e202e9768d8d825f96467 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
7 When (cross) compiling for softfloat mips, __mips_hard_float will not be
8 defined and detection of OS triplet in configure.ac / configure will fail.
10 This also has to do with the custom detection of the build triplet. Trying
11 to do this in a more autoconf/autotools manner.
13 Upstream-Status: Submitted [https://github.com/python/cpython/pull/13196]
14 Signed-off-by: Matthias Schoepfer <matthias.schoepfer@ithinx.io>
16 %% original patch: 0001-bpo-36852-proper-detection-of-mips-architecture-for-.patch
18 configure.ac | 175 +++++++--------------------------------------------
19 1 file changed, 21 insertions(+), 154 deletions(-)
21 diff --git a/configure.ac b/configure.ac
22 index ede710e..bc81b0b 100644
25 @@ -710,160 +710,27 @@ fi
26 MULTIARCH=$($CC --print-multiarch 2>/dev/null)
29 -AC_MSG_CHECKING([for the platform triplet based on compiler characteristics])
30 -cat >> conftest.c <<EOF
42 -#if defined(__ANDROID__)
43 - # Android is not a multiarch system.
44 -#elif defined(__linux__)
45 -# if defined(__x86_64__) && defined(__LP64__)
47 -# elif defined(__x86_64__) && defined(__ILP32__)
49 -# elif defined(__i386__)
51 -# elif defined(__aarch64__) && defined(__AARCH64EL__)
52 -# if defined(__ILP32__)
53 - aarch64_ilp32-linux-gnu
57 -# elif defined(__aarch64__) && defined(__AARCH64EB__)
58 -# if defined(__ILP32__)
59 - aarch64_be_ilp32-linux-gnu
61 - aarch64_be-linux-gnu
63 -# elif defined(__alpha__)
65 -# elif defined(__ARM_EABI__) && defined(__ARM_PCS_VFP)
66 -# if defined(__ARMEL__)
69 - armeb-linux-gnueabihf
71 -# elif defined(__ARM_EABI__) && !defined(__ARM_PCS_VFP)
72 -# if defined(__ARMEL__)
77 -# elif defined(__hppa__)
79 -# elif defined(__ia64__)
81 -# elif defined(__m68k__) && !defined(__mcoldfire__)
83 -# elif defined(__mips_hard_float) && defined(__mips_isa_rev) && (__mips_isa_rev >=6) && defined(_MIPSEL)
84 -# if _MIPS_SIM == _ABIO32
85 - mipsisa32r6el-linux-gnu
86 -# elif _MIPS_SIM == _ABIN32
87 - mipsisa64r6el-linux-gnuabin32
88 -# elif _MIPS_SIM == _ABI64
89 - mipsisa64r6el-linux-gnuabi64
91 -# error unknown platform triplet
93 -# elif defined(__mips_hard_float) && defined(__mips_isa_rev) && (__mips_isa_rev >=6)
94 -# if _MIPS_SIM == _ABIO32
95 - mipsisa32r6-linux-gnu
96 -# elif _MIPS_SIM == _ABIN32
97 - mipsisa64r6-linux-gnuabin32
98 -# elif _MIPS_SIM == _ABI64
99 - mipsisa64r6-linux-gnuabi64
101 -# error unknown platform triplet
103 -# elif defined(__mips_hard_float) && defined(_MIPSEL)
104 -# if _MIPS_SIM == _ABIO32
106 -# elif _MIPS_SIM == _ABIN32
107 - mips64el-linux-gnuabin32
108 -# elif _MIPS_SIM == _ABI64
109 - mips64el-linux-gnuabi64
111 -# error unknown platform triplet
113 -# elif defined(__mips_hard_float)
114 -# if _MIPS_SIM == _ABIO32
116 -# elif _MIPS_SIM == _ABIN32
117 - mips64-linux-gnuabin32
118 -# elif _MIPS_SIM == _ABI64
119 - mips64-linux-gnuabi64
121 -# error unknown platform triplet
123 -# elif defined(__or1k__)
125 -# elif defined(__powerpc__) && defined(__SPE__)
126 - powerpc-linux-gnuspe
127 -# elif defined(__powerpc64__)
128 -# if defined(__LITTLE_ENDIAN__)
129 - powerpc64le-linux-gnu
131 - powerpc64-linux-gnu
133 -# elif defined(__powerpc__)
135 -# elif defined(__s390x__)
137 -# elif defined(__s390__)
139 -# elif defined(__sh__) && defined(__LITTLE_ENDIAN__)
141 -# elif defined(__sparc__) && defined(__arch64__)
143 -# elif defined(__sparc__)
145 -# elif defined(__riscv)
146 -# if __riscv_xlen == 32
148 -# elif __riscv_xlen == 64
151 -# error unknown platform triplet
154 -# error unknown platform triplet
156 -#elif defined(__FreeBSD_kernel__)
157 -# if defined(__LP64__)
158 - x86_64-kfreebsd-gnu
159 -# elif defined(__i386__)
162 -# error unknown platform triplet
164 -#elif defined(__gnu_hurd__)
166 -#elif defined(__APPLE__)
168 -#elif defined(__VXWORKS__)
171 -# error unknown platform triplet
176 -if $CPP $CPPFLAGS conftest.c >conftest.out 2>/dev/null; then
177 - PLATFORM_TRIPLET=`grep -v '^#' conftest.out | grep -v '^ *$' | tr -d ' '`
178 - AC_MSG_RESULT([$PLATFORM_TRIPLET])
180 - AC_MSG_RESULT([none])
182 -rm -f conftest.c conftest.out
184 +## Not using $target to filter out vendor
185 +## Need to handle macos, vxworks and hurd special (?) :-/
186 +case ${target_os} in
188 + PLATFORM_TRIPLET=darwin
191 + PLATFORM_TRIPLET=i386-gnu
194 + PLATFORM_TRIPLET=vxworks
197 + if test "${target_cpu}" != "i686"; then
198 + PLATFORM_TRIPLET=${target_cpu}-${target_os}
200 + PLATFORM_TRIPLET=i386-${target_os}
205 if test x$PLATFORM_TRIPLET != x && test x$MULTIARCH != x; then
206 if test x$PLATFORM_TRIPLET != x$MULTIARCH; then