1 From 2581ebe3cd9686089aed223651e1b8bf0b862b48 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>
17 configure.ac | 171 +++++----------------------------------------------
18 1 file changed, 17 insertions(+), 154 deletions(-)
20 diff --git a/configure.ac b/configure.ac
21 index 0f85486..0ca7e24 100644
24 @@ -704,160 +704,23 @@ fi
25 MULTIARCH=$($CC --print-multiarch 2>/dev/null)
28 -AC_MSG_CHECKING([for the platform triplet based on compiler characteristics])
29 -cat >> conftest.c <<EOF
41 -#if defined(__ANDROID__)
42 - # Android is not a multiarch system.
43 -#elif defined(__linux__)
44 -# if defined(__x86_64__) && defined(__LP64__)
46 -# elif defined(__x86_64__) && defined(__ILP32__)
48 -# elif defined(__i386__)
50 -# elif defined(__aarch64__) && defined(__AARCH64EL__)
51 -# if defined(__ILP32__)
52 - aarch64_ilp32-linux-gnu
56 -# elif defined(__aarch64__) && defined(__AARCH64EB__)
57 -# if defined(__ILP32__)
58 - aarch64_be_ilp32-linux-gnu
60 - aarch64_be-linux-gnu
62 -# elif defined(__alpha__)
64 -# elif defined(__ARM_EABI__) && defined(__ARM_PCS_VFP)
65 -# if defined(__ARMEL__)
68 - armeb-linux-gnueabihf
70 -# elif defined(__ARM_EABI__) && !defined(__ARM_PCS_VFP)
71 -# if defined(__ARMEL__)
76 -# elif defined(__hppa__)
78 -# elif defined(__ia64__)
80 -# elif defined(__m68k__) && !defined(__mcoldfire__)
82 -# elif defined(__mips_hard_float) && defined(__mips_isa_rev) && (__mips_isa_rev >=6) && defined(_MIPSEL)
83 -# if _MIPS_SIM == _ABIO32
84 - mipsisa32r6el-linux-gnu
85 -# elif _MIPS_SIM == _ABIN32
86 - mipsisa64r6el-linux-gnuabin32
87 -# elif _MIPS_SIM == _ABI64
88 - mipsisa64r6el-linux-gnuabi64
90 -# error unknown platform triplet
92 -# elif defined(__mips_hard_float) && defined(__mips_isa_rev) && (__mips_isa_rev >=6)
93 -# if _MIPS_SIM == _ABIO32
94 - mipsisa32r6-linux-gnu
95 -# elif _MIPS_SIM == _ABIN32
96 - mipsisa64r6-linux-gnuabin32
97 -# elif _MIPS_SIM == _ABI64
98 - mipsisa64r6-linux-gnuabi64
100 -# error unknown platform triplet
102 -# elif defined(__mips_hard_float) && defined(_MIPSEL)
103 -# if _MIPS_SIM == _ABIO32
105 -# elif _MIPS_SIM == _ABIN32
106 - mips64el-linux-gnuabin32
107 -# elif _MIPS_SIM == _ABI64
108 - mips64el-linux-gnuabi64
110 -# error unknown platform triplet
112 -# elif defined(__mips_hard_float)
113 -# if _MIPS_SIM == _ABIO32
115 -# elif _MIPS_SIM == _ABIN32
116 - mips64-linux-gnuabin32
117 -# elif _MIPS_SIM == _ABI64
118 - mips64-linux-gnuabi64
120 -# error unknown platform triplet
122 -# elif defined(__or1k__)
124 -# elif defined(__powerpc__) && defined(__SPE__)
125 - powerpc-linux-gnuspe
126 -# elif defined(__powerpc64__)
127 -# if defined(__LITTLE_ENDIAN__)
128 - powerpc64le-linux-gnu
130 - powerpc64-linux-gnu
132 -# elif defined(__powerpc__)
134 -# elif defined(__s390x__)
136 -# elif defined(__s390__)
138 -# elif defined(__sh__) && defined(__LITTLE_ENDIAN__)
140 -# elif defined(__sparc__) && defined(__arch64__)
142 -# elif defined(__sparc__)
144 -# elif defined(__riscv)
145 -# if __riscv_xlen == 32
147 -# elif __riscv_xlen == 64
150 -# error unknown platform triplet
153 -# error unknown platform triplet
155 -#elif defined(__FreeBSD_kernel__)
156 -# if defined(__LP64__)
157 - x86_64-kfreebsd-gnu
158 -# elif defined(__i386__)
161 -# error unknown platform triplet
163 -#elif defined(__gnu_hurd__)
165 -#elif defined(__APPLE__)
167 -#elif defined(__VXWORKS__)
170 -# error unknown platform triplet
175 -if $CPP $CPPFLAGS conftest.c >conftest.out 2>/dev/null; then
176 - PLATFORM_TRIPLET=`grep -v '^#' conftest.out | grep -v '^ *$' | tr -d ' '`
177 - AC_MSG_RESULT([$PLATFORM_TRIPLET])
179 - AC_MSG_RESULT([none])
181 -rm -f conftest.c conftest.out
183 +## Not using $target to filter out vendor
184 +## Need to handle macos, vxworks and hurd special (?) :-/
185 +case ${target_os} in
187 + PLATFORM_TRIPLET=darwin
190 + PLATFORM_TRIPLET=i386-gnu
193 + PLATFORM_TRIPLET=vxworks
196 + PLATFORM_TRIPLET=${target_cpu}-${target_os}
200 if test x$PLATFORM_TRIPLET != x && test x$MULTIARCH != x; then
201 if test x$PLATFORM_TRIPLET != x$MULTIARCH; then