blob: e7af88654da40b875e8d19954c1571452d55cbc8 [file] [log] [blame]
Brad Bishop15ae2502019-06-18 21:44:24 -04001From 7535c39951b9d15dd64c4669092a8582ba555466 Mon Sep 17 00:00:00 2001
2From: 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>
15---
16 configure.ac | 169 ++++++---------------------------------------------
17 1 file changed, 17 insertions(+), 152 deletions(-)
18
19diff --git a/configure.ac b/configure.ac
20index a7de901e08..a73e2de51b 100644
21--- a/configure.ac
22+++ b/configure.ac
23@@ -727,158 +727,23 @@ fi
24 MULTIARCH=$($CC --print-multiarch 2>/dev/null)
25 AC_SUBST(MULTIARCH)
26
27-AC_MSG_CHECKING([for the platform triplet based on compiler characteristics])
28-cat >> conftest.c <<EOF
29-#undef bfin
30-#undef cris
31-#undef fr30
32-#undef linux
33-#undef hppa
34-#undef hpux
35-#undef i386
36-#undef mips
37-#undef powerpc
38-#undef sparc
39-#undef unix
40-#if defined(__ANDROID__)
41- # Android is not a multiarch system.
42-#elif defined(__linux__)
43-# if defined(__x86_64__) && defined(__LP64__)
44- x86_64-linux-gnu
45-# elif defined(__x86_64__) && defined(__ILP32__)
46- x86_64-linux-gnux32
47-# elif defined(__i386__)
48- i386-linux-gnu
49-# elif defined(__aarch64__) && defined(__AARCH64EL__)
50-# if defined(__ILP32__)
51- aarch64_ilp32-linux-gnu
52-# else
53- aarch64-linux-gnu
54-# endif
55-# elif defined(__aarch64__) && defined(__AARCH64EB__)
56-# if defined(__ILP32__)
57- aarch64_be_ilp32-linux-gnu
58-# else
59- aarch64_be-linux-gnu
60-# endif
61-# elif defined(__alpha__)
62- alpha-linux-gnu
63-# elif defined(__ARM_EABI__) && defined(__ARM_PCS_VFP)
64-# if defined(__ARMEL__)
65- arm-linux-gnueabihf
66-# else
67- armeb-linux-gnueabihf
68-# endif
69-# elif defined(__ARM_EABI__) && !defined(__ARM_PCS_VFP)
70-# if defined(__ARMEL__)
71- arm-linux-gnueabi
72-# else
73- armeb-linux-gnueabi
74-# endif
75-# elif defined(__hppa__)
76- hppa-linux-gnu
77-# elif defined(__ia64__)
78- ia64-linux-gnu
79-# elif defined(__m68k__) && !defined(__mcoldfire__)
80- m68k-linux-gnu
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
88-# else
89-# error unknown platform triplet
90-# endif
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
98-# else
99-# error unknown platform triplet
100-# endif
101-# elif defined(__mips_hard_float) && defined(_MIPSEL)
102-# if _MIPS_SIM == _ABIO32
103- mipsel-linux-gnu
104-# elif _MIPS_SIM == _ABIN32
105- mips64el-linux-gnuabin32
106-# elif _MIPS_SIM == _ABI64
107- mips64el-linux-gnuabi64
108-# else
109-# error unknown platform triplet
110-# endif
111-# elif defined(__mips_hard_float)
112-# if _MIPS_SIM == _ABIO32
113- mips-linux-gnu
114-# elif _MIPS_SIM == _ABIN32
115- mips64-linux-gnuabin32
116-# elif _MIPS_SIM == _ABI64
117- mips64-linux-gnuabi64
118-# else
119-# error unknown platform triplet
120-# endif
121-# elif defined(__or1k__)
122- or1k-linux-gnu
123-# elif defined(__powerpc__) && defined(__SPE__)
124- powerpc-linux-gnuspe
125-# elif defined(__powerpc64__)
126-# if defined(__LITTLE_ENDIAN__)
127- powerpc64le-linux-gnu
128-# else
129- powerpc64-linux-gnu
130-# endif
131-# elif defined(__powerpc__)
132- powerpc-linux-gnu
133-# elif defined(__s390x__)
134- s390x-linux-gnu
135-# elif defined(__s390__)
136- s390-linux-gnu
137-# elif defined(__sh__) && defined(__LITTLE_ENDIAN__)
138- sh4-linux-gnu
139-# elif defined(__sparc__) && defined(__arch64__)
140- sparc64-linux-gnu
141-# elif defined(__sparc__)
142- sparc-linux-gnu
143-# elif defined(__riscv)
144-# if __riscv_xlen == 32
145- riscv32-linux-gnu
146-# elif __riscv_xlen == 64
147- riscv64-linux-gnu
148-# else
149-# error unknown platform triplet
150-# endif
151-# else
152-# error unknown platform triplet
153-# endif
154-#elif defined(__FreeBSD_kernel__)
155-# if defined(__LP64__)
156- x86_64-kfreebsd-gnu
157-# elif defined(__i386__)
158- i386-kfreebsd-gnu
159-# else
160-# error unknown platform triplet
161-# endif
162-#elif defined(__gnu_hurd__)
163- i386-gnu
164-#elif defined(__APPLE__)
165- darwin
166-#else
167-# error unknown platform triplet
168-#endif
169-
170-EOF
171-
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])
175-else
176- AC_MSG_RESULT([none])
177-fi
178-rm -f conftest.c conftest.out
179+AC_CANONICAL_TARGET
180+## Not using $target to filter out vendor
181+## Need to handle macos, vxworks and hurd special (?) :-/
182+case ${target_os} in
183+ darwin*)
184+ PLATFORM_TRIPLET=darwin
185+ ;;
186+ hurd*)
187+ PLATFORM_TRIPLET=i386-gnu
188+ ;;
189+ vxworks*)
190+ PLATFORM_TRIPLET=vxworks
191+ ;;
192+ *)
193+ PLATFORM_TRIPLET=${target_cpu}-${target_os}
194+ ;;
195+esac
196
197 if test x$PLATFORM_TRIPLET != x && test x$MULTIARCH != x; then
198 if test x$PLATFORM_TRIPLET != x$MULTIARCH; then
199--
2002.21.0
201