blob: c4fae09a5b878cf55ed71c96a4df9c3ec293d76d [file] [log] [blame]
Andrew Geissler82c905d2020-04-13 13:39:40 -05001From 1ad771d86728ee2ed30e202e9768d8d825f96467 Mon Sep 17 00:00:00 2001
Brad Bishop15ae2502019-06-18 21:44:24 -04002From: Matthias Schoepfer <matthias.schoepfer@ithinx.io>
3Date: Fri, 31 May 2019 15:34:34 +0200
4Subject: [PATCH] bpo-36852: proper detection of mips architecture for soft
5 float
6
7When (cross) compiling for softfloat mips, __mips_hard_float will not be
8defined and detection of OS triplet in configure.ac / configure will fail.
9
10This also has to do with the custom detection of the build triplet. Trying
11to do this in a more autoconf/autotools manner.
12
13Upstream-Status: Submitted [https://github.com/python/cpython/pull/13196]
14Signed-off-by: Matthias Schoepfer <matthias.schoepfer@ithinx.io>
Andrew Geissler82c905d2020-04-13 13:39:40 -050015
16%% original patch: 0001-bpo-36852-proper-detection-of-mips-architecture-for-.patch
Brad Bishop15ae2502019-06-18 21:44:24 -040017---
Andrew Geissler82c905d2020-04-13 13:39:40 -050018 configure.ac | 175 +++++++--------------------------------------------
19 1 file changed, 21 insertions(+), 154 deletions(-)
Brad Bishop15ae2502019-06-18 21:44:24 -040020
21diff --git a/configure.ac b/configure.ac
Andrew Geissler82c905d2020-04-13 13:39:40 -050022index ede710e..bc81b0b 100644
Brad Bishop15ae2502019-06-18 21:44:24 -040023--- a/configure.ac
24+++ b/configure.ac
Andrew Geissler82c905d2020-04-13 13:39:40 -050025@@ -710,160 +710,27 @@ fi
Brad Bishop15ae2502019-06-18 21:44:24 -040026 MULTIARCH=$($CC --print-multiarch 2>/dev/null)
27 AC_SUBST(MULTIARCH)
28
29-AC_MSG_CHECKING([for the platform triplet based on compiler characteristics])
30-cat >> conftest.c <<EOF
31-#undef bfin
32-#undef cris
33-#undef fr30
34-#undef linux
35-#undef hppa
36-#undef hpux
37-#undef i386
38-#undef mips
39-#undef powerpc
40-#undef sparc
41-#undef unix
42-#if defined(__ANDROID__)
43- # Android is not a multiarch system.
44-#elif defined(__linux__)
45-# if defined(__x86_64__) && defined(__LP64__)
46- x86_64-linux-gnu
47-# elif defined(__x86_64__) && defined(__ILP32__)
48- x86_64-linux-gnux32
49-# elif defined(__i386__)
50- i386-linux-gnu
51-# elif defined(__aarch64__) && defined(__AARCH64EL__)
52-# if defined(__ILP32__)
53- aarch64_ilp32-linux-gnu
54-# else
55- aarch64-linux-gnu
56-# endif
57-# elif defined(__aarch64__) && defined(__AARCH64EB__)
58-# if defined(__ILP32__)
59- aarch64_be_ilp32-linux-gnu
60-# else
61- aarch64_be-linux-gnu
62-# endif
63-# elif defined(__alpha__)
64- alpha-linux-gnu
65-# elif defined(__ARM_EABI__) && defined(__ARM_PCS_VFP)
66-# if defined(__ARMEL__)
67- arm-linux-gnueabihf
68-# else
69- armeb-linux-gnueabihf
70-# endif
71-# elif defined(__ARM_EABI__) && !defined(__ARM_PCS_VFP)
72-# if defined(__ARMEL__)
73- arm-linux-gnueabi
74-# else
75- armeb-linux-gnueabi
76-# endif
77-# elif defined(__hppa__)
78- hppa-linux-gnu
79-# elif defined(__ia64__)
80- ia64-linux-gnu
81-# elif defined(__m68k__) && !defined(__mcoldfire__)
82- m68k-linux-gnu
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
90-# else
91-# error unknown platform triplet
92-# endif
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
100-# else
101-# error unknown platform triplet
102-# endif
103-# elif defined(__mips_hard_float) && defined(_MIPSEL)
104-# if _MIPS_SIM == _ABIO32
105- mipsel-linux-gnu
106-# elif _MIPS_SIM == _ABIN32
107- mips64el-linux-gnuabin32
108-# elif _MIPS_SIM == _ABI64
109- mips64el-linux-gnuabi64
110-# else
111-# error unknown platform triplet
112-# endif
113-# elif defined(__mips_hard_float)
114-# if _MIPS_SIM == _ABIO32
115- mips-linux-gnu
116-# elif _MIPS_SIM == _ABIN32
117- mips64-linux-gnuabin32
118-# elif _MIPS_SIM == _ABI64
119- mips64-linux-gnuabi64
120-# else
121-# error unknown platform triplet
122-# endif
123-# elif defined(__or1k__)
124- or1k-linux-gnu
125-# elif defined(__powerpc__) && defined(__SPE__)
126- powerpc-linux-gnuspe
127-# elif defined(__powerpc64__)
128-# if defined(__LITTLE_ENDIAN__)
129- powerpc64le-linux-gnu
130-# else
131- powerpc64-linux-gnu
132-# endif
133-# elif defined(__powerpc__)
134- powerpc-linux-gnu
135-# elif defined(__s390x__)
136- s390x-linux-gnu
137-# elif defined(__s390__)
138- s390-linux-gnu
139-# elif defined(__sh__) && defined(__LITTLE_ENDIAN__)
140- sh4-linux-gnu
141-# elif defined(__sparc__) && defined(__arch64__)
142- sparc64-linux-gnu
143-# elif defined(__sparc__)
144- sparc-linux-gnu
145-# elif defined(__riscv)
146-# if __riscv_xlen == 32
147- riscv32-linux-gnu
148-# elif __riscv_xlen == 64
149- riscv64-linux-gnu
150-# else
151-# error unknown platform triplet
152-# endif
153-# else
154-# error unknown platform triplet
155-# endif
156-#elif defined(__FreeBSD_kernel__)
157-# if defined(__LP64__)
158- x86_64-kfreebsd-gnu
159-# elif defined(__i386__)
160- i386-kfreebsd-gnu
161-# else
162-# error unknown platform triplet
163-# endif
164-#elif defined(__gnu_hurd__)
165- i386-gnu
166-#elif defined(__APPLE__)
167- darwin
Andrew Geissler82c905d2020-04-13 13:39:40 -0500168-#elif defined(__VXWORKS__)
169- vxworks
Brad Bishop15ae2502019-06-18 21:44:24 -0400170-#else
171-# error unknown platform triplet
172-#endif
173-
174-EOF
175-
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])
179-else
180- AC_MSG_RESULT([none])
181-fi
182-rm -f conftest.c conftest.out
183+AC_CANONICAL_TARGET
184+## Not using $target to filter out vendor
185+## Need to handle macos, vxworks and hurd special (?) :-/
186+case ${target_os} in
187+ darwin*)
188+ PLATFORM_TRIPLET=darwin
189+ ;;
190+ hurd*)
191+ PLATFORM_TRIPLET=i386-gnu
192+ ;;
193+ vxworks*)
194+ PLATFORM_TRIPLET=vxworks
195+ ;;
196+ *)
Andrew Geissler82c905d2020-04-13 13:39:40 -0500197+ if test "${target_cpu}" != "i686"; then
198+ PLATFORM_TRIPLET=${target_cpu}-${target_os}
199+ else
200+ PLATFORM_TRIPLET=i386-${target_os}
201+ fi
Brad Bishop15ae2502019-06-18 21:44:24 -0400202+ ;;
203+esac
204
205 if test x$PLATFORM_TRIPLET != x && test x$MULTIARCH != x; then
206 if test x$PLATFORM_TRIPLET != x$MULTIARCH; then
207--
Andrew Geissler82c905d2020-04-13 13:39:40 -05002082.24.1
Brad Bishop15ae2502019-06-18 21:44:24 -0400209