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