1 From 7535c39951b9d15dd64c4669092a8582ba555466 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 configure.ac | 169 ++++++---------------------------------------------
17 1 file changed, 17 insertions(+), 152 deletions(-)
19 diff --git a/configure.ac b/configure.ac
20 index a7de901e08..a73e2de51b 100644
23 @@ -727,158 +727,23 @@ fi
24 MULTIARCH=$($CC --print-multiarch 2>/dev/null)
27 -AC_MSG_CHECKING([for the platform triplet based on compiler characteristics])
28 -cat >> conftest.c <<EOF
40 -#if defined(__ANDROID__)
41 - # Android is not a multiarch system.
42 -#elif defined(__linux__)
43 -# if defined(__x86_64__) && defined(__LP64__)
45 -# elif defined(__x86_64__) && defined(__ILP32__)
47 -# elif defined(__i386__)
49 -# elif defined(__aarch64__) && defined(__AARCH64EL__)
50 -# if defined(__ILP32__)
51 - aarch64_ilp32-linux-gnu
55 -# elif defined(__aarch64__) && defined(__AARCH64EB__)
56 -# if defined(__ILP32__)
57 - aarch64_be_ilp32-linux-gnu
59 - aarch64_be-linux-gnu
61 -# elif defined(__alpha__)
63 -# elif defined(__ARM_EABI__) && defined(__ARM_PCS_VFP)
64 -# if defined(__ARMEL__)
67 - armeb-linux-gnueabihf
69 -# elif defined(__ARM_EABI__) && !defined(__ARM_PCS_VFP)
70 -# if defined(__ARMEL__)
75 -# elif defined(__hppa__)
77 -# elif defined(__ia64__)
79 -# elif defined(__m68k__) && !defined(__mcoldfire__)
81 -# elif defined(__mips_hard_float) && defined(__mips_isa_rev) && (__mips_isa_rev >=6) && defined(_MIPSEL)
82 -# if _MIPS_SIM == _ABIO32
83 - mipsisa32r6el-linux-gnu
84 -# elif _MIPS_SIM == _ABIN32
85 - mipsisa64r6el-linux-gnuabin32
86 -# elif _MIPS_SIM == _ABI64
87 - mipsisa64r6el-linux-gnuabi64
89 -# error unknown platform triplet
91 -# elif defined(__mips_hard_float) && defined(__mips_isa_rev) && (__mips_isa_rev >=6)
92 -# if _MIPS_SIM == _ABIO32
93 - mipsisa32r6-linux-gnu
94 -# elif _MIPS_SIM == _ABIN32
95 - mipsisa64r6-linux-gnuabin32
96 -# elif _MIPS_SIM == _ABI64
97 - mipsisa64r6-linux-gnuabi64
99 -# error unknown platform triplet
101 -# elif defined(__mips_hard_float) && defined(_MIPSEL)
102 -# if _MIPS_SIM == _ABIO32
104 -# elif _MIPS_SIM == _ABIN32
105 - mips64el-linux-gnuabin32
106 -# elif _MIPS_SIM == _ABI64
107 - mips64el-linux-gnuabi64
109 -# error unknown platform triplet
111 -# elif defined(__mips_hard_float)
112 -# if _MIPS_SIM == _ABIO32
114 -# elif _MIPS_SIM == _ABIN32
115 - mips64-linux-gnuabin32
116 -# elif _MIPS_SIM == _ABI64
117 - mips64-linux-gnuabi64
119 -# error unknown platform triplet
121 -# elif defined(__or1k__)
123 -# elif defined(__powerpc__) && defined(__SPE__)
124 - powerpc-linux-gnuspe
125 -# elif defined(__powerpc64__)
126 -# if defined(__LITTLE_ENDIAN__)
127 - powerpc64le-linux-gnu
129 - powerpc64-linux-gnu
131 -# elif defined(__powerpc__)
133 -# elif defined(__s390x__)
135 -# elif defined(__s390__)
137 -# elif defined(__sh__) && defined(__LITTLE_ENDIAN__)
139 -# elif defined(__sparc__) && defined(__arch64__)
141 -# elif defined(__sparc__)
143 -# elif defined(__riscv)
144 -# if __riscv_xlen == 32
146 -# elif __riscv_xlen == 64
149 -# error unknown platform triplet
152 -# error unknown platform triplet
154 -#elif defined(__FreeBSD_kernel__)
155 -# if defined(__LP64__)
156 - x86_64-kfreebsd-gnu
157 -# elif defined(__i386__)
160 -# error unknown platform triplet
162 -#elif defined(__gnu_hurd__)
164 -#elif defined(__APPLE__)
167 -# error unknown platform triplet
172 -if $CPP $CPPFLAGS conftest.c >conftest.out 2>/dev/null; then
173 - PLATFORM_TRIPLET=`grep -v '^#' conftest.out | grep -v '^ *$' | tr -d ' '`
174 - AC_MSG_RESULT([$PLATFORM_TRIPLET])
176 - AC_MSG_RESULT([none])
178 -rm -f conftest.c conftest.out
180 +## Not using $target to filter out vendor
181 +## Need to handle macos, vxworks and hurd special (?) :-/
182 +case ${target_os} in
184 + PLATFORM_TRIPLET=darwin
187 + PLATFORM_TRIPLET=i386-gnu
190 + PLATFORM_TRIPLET=vxworks
193 + PLATFORM_TRIPLET=${target_cpu}-${target_os}
197 if test x$PLATFORM_TRIPLET != x && test x$MULTIARCH != x; then
198 if test x$PLATFORM_TRIPLET != x$MULTIARCH; then