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