3 if test -z "$source_path"; then
4 echo Do not invoke this
script directly. It is called
5 echo automatically by configure.
11 int main(void) { return 0; }
16 command -v "$1" >/dev
/null
2>&1
20 # Run the compiler, capturing its output to the log. First argument
21 # is compiler binary to execute.
24 if test -n "$BASH_VERSION"; then eval '
27 lines: ${BASH_LINENO[*]}"
29 echo $compiler "$@" >> config.log
30 $compiler "$@" >> config.log
2>&1 ||
return $?
35 TMPC
="${TMPDIR1}/qemu-conf.c"
36 TMPE
="${TMPDIR1}/qemu-conf.exe"
39 if test $use_containers = "yes"; then
40 if has
"docker" || has
"podman"; then
41 container
=$
($python $source_path/tests
/docker
/docker.py probe
)
45 # cross compilers defaults, can be overridden with --cross-cc-ARCH
46 : ${cross_cc_aarch64="aarch64-linux-gnu-gcc"}
47 : ${cross_cc_aarch64_be="$cross_cc_aarch64"}
48 : ${cross_cc_cflags_aarch64_be="-mbig-endian"}
49 : ${cross_cc_alpha="alpha-linux-gnu-gcc"}
50 : ${cross_cc_arm="arm-linux-gnueabihf-gcc"}
51 : ${cross_cc_cflags_armeb="-mbig-endian"}
52 : ${cross_cc_hexagon="hexagon-unknown-linux-musl-clang"}
53 : ${cross_cc_cflags_hexagon="-mv67 -O2 -static"}
54 : ${cross_cc_hppa="hppa-linux-gnu-gcc"}
55 : ${cross_cc_i386="i686-linux-gnu-gcc"}
56 : ${cross_cc_cflags_i386="-m32"}
57 : ${cross_cc_m68k="m68k-linux-gnu-gcc"}
58 : ${cross_cc_microblaze="microblaze-linux-musl-gcc"}
59 : ${cross_cc_mips64el="mips64el-linux-gnuabi64-gcc"}
60 : ${cross_cc_mips64="mips64-linux-gnuabi64-gcc"}
61 : ${cross_cc_mipsel="mipsel-linux-gnu-gcc"}
62 : ${cross_cc_mips="mips-linux-gnu-gcc"}
63 : ${cross_cc_nios2="nios2-linux-gnu-gcc"}
64 : ${cross_cc_ppc="powerpc-linux-gnu-gcc"}
65 : ${cross_cc_cflags_ppc="-m32"}
66 : ${cross_cc_ppc64="powerpc64-linux-gnu-gcc"}
67 : ${cross_cc_cflags_ppc64="-m64 -mbig-endian"}
68 : ${cross_cc_ppc64le="$cross_cc_ppc64"}
69 : ${cross_cc_cflags_ppc64le="-m64 -mlittle-endian"}
70 : ${cross_cc_riscv64="riscv64-linux-gnu-gcc"}
71 : ${cross_cc_s390x="s390x-linux-gnu-gcc"}
72 : ${cross_cc_sh4="sh4-linux-gnu-gcc"}
73 : ${cross_cc_cflags_sparc="-m32 -mv8plus -mcpu=ultrasparc"}
74 : ${cross_cc_sparc64="sparc64-linux-gnu-gcc"}
75 : ${cross_cc_cflags_sparc64="-m64 -mcpu=ultrasparc"}
76 : ${cross_cc_x86_64="x86_64-linux-gnu-gcc"}
77 : ${cross_cc_cflags_x86_64="-m64"}
79 # tricore is special as it doesn't have a compiler
80 : ${cross_as_tricore="tricore-as"}
81 : ${cross_ld_tricore="tricore-ld"}
83 for target
in $target_list; do
86 # reset all container fields
98 # We don't have any bigendian build tools so we only use this for AArch64
99 container_hosts
="x86_64 aarch64"
100 container_image
=debian-arm64-cross
101 container_cross_cc
=aarch64-linux-gnu-gcc-10
104 container_hosts
=x86_64
105 container_image
=debian-alpha-cross
106 container_cross_cc
=alpha-linux-gnu-gcc
109 # We don't have any bigendian build tools so we only use this for ARM
110 container_hosts
="x86_64 aarch64"
111 container_image
=debian-armhf-cross
112 container_cross_cc
=arm-linux-gnueabihf-gcc
115 container_hosts
=x86_64
116 container_image
=fedora-cris-cross
117 container_cross_cc
=cris-linux-gnu-gcc
120 container_hosts
=x86_64
121 container_image
=debian-hexagon-cross
122 container_cross_cc
=hexagon-unknown-linux-musl-clang
125 container_hosts
=x86_64
126 container_image
=debian-hppa-cross
127 container_cross_cc
=hppa-linux-gnu-gcc
130 container_hosts
=x86_64
131 container_image
=fedora-i386-cross
132 container_cross_cc
=gcc
136 container_hosts
=x86_64
137 container_image
=debian-m68k-cross
138 container_cross_cc
=m68k-linux-gnu-gcc
141 container_hosts
=x86_64
142 container_image
=debian-microblaze-cross
143 container_cross_cc
=microblaze-linux-musl-gcc
146 container_hosts
=x86_64
147 container_image
=debian-mips64el-cross
148 container_cross_cc
=mips64el-linux-gnuabi64-gcc
151 container_hosts
=x86_64
152 container_image
=debian-mips64-cross
153 container_cross_cc
=mips64-linux-gnuabi64-gcc
156 container_hosts
=x86_64
157 container_image
=debian-mipsel-cross
158 container_cross_cc
=mipsel-linux-gnu-gcc
161 container_hosts
=x86_64
162 container_image
=debian-mips-cross
163 container_cross_cc
=mips-linux-gnu-gcc
166 container_hosts
=x86_64
167 container_image
=debian-nios2-cross
168 container_cross_cc
=nios2-linux-gnu-gcc
171 container_hosts
=x86_64
172 container_image
=debian-powerpc-test-cross
173 container_cross_cc
=powerpc-linux-gnu-gcc-10
176 container_hosts
=x86_64
177 container_image
=debian-powerpc-test-cross
178 container_cross_cc
=${target%%-*}-linux-gnu-gcc-10
179 container_cross_cc
=powerpc
${container_cross_cc#ppc}
182 container_hosts
=x86_64
183 container_image
=debian-riscv64-test-cross
184 container_cross_cc
=riscv64-linux-gnu-gcc
187 container_hosts
=x86_64
188 container_image
=debian-s390x-cross
189 container_cross_cc
=s390x-linux-gnu-gcc
192 container_hosts
=x86_64
193 container_image
=debian-sh4-cross
194 container_cross_cc
=sh4-linux-gnu-gcc
197 container_hosts
=x86_64
198 container_image
=debian-sparc64-cross
199 container_cross_cc
=sparc64-linux-gnu-gcc
202 container_hosts
=x86_64
203 container_image
=debian-tricore-cross
204 container_cross_as
=tricore-as
205 container_cross_ld
=tricore-ld
208 container_hosts
="aarch64 ppc64el x86_64"
209 container_image
=debian-amd64-cross
210 container_cross_cc
=x86_64-linux-gnu-gcc
214 container_hosts
=x86_64
215 container_image
=debian-xtensa-cross
217 # default to the dc232b cpu
218 container_cross_cc
=/opt
/2020.07/xtensa-dc232b-elf
/bin
/xtensa-dc232b-elf-gcc
222 config_target_mak
=tests
/tcg
/config-
$target.mak
224 echo "# Automatically generated by configure - do not modify" > $config_target_mak
225 echo "TARGET_NAME=$arch" >> $config_target_mak
226 echo "target=$target" >> $config_target_mak
229 echo "CONFIG_USER_ONLY=y" >> $config_target_mak
230 echo "QEMU=$PWD/qemu-$arch" >> $config_target_mak
233 echo "CONFIG_USER_ONLY=y" >> $config_target_mak
234 echo "QEMU=$PWD/qemu-$arch" >> $config_target_mak
237 echo "CONFIG_SOFTMMU=y" >> $config_target_mak
238 echo "QEMU=$PWD/qemu-system-$arch" >> $config_target_mak
242 eval "target_compiler_cflags=\${cross_cc_cflags_$arch}"
243 echo "CROSS_CC_GUEST_CFLAGS=$target_compiler_cflags" >> $config_target_mak
247 if eval test "x\"\${cross_cc_$arch}\"" != xyes
; then
248 eval "target_compiler=\"\${cross_cc_$arch}\""
250 if has
$target_compiler; then
251 if test "$supress_clang" = yes &&
252 $target_compiler --version |
grep -qi "clang"; then
256 if ! do_compiler
"$target_compiler" $target_compiler_cflags \
257 -o $TMPE $TMPC -static ; then
258 # For host systems we might get away with building without -static
259 if do_compiler
"$target_compiler" $target_compiler_cflags \
260 -o $TMPE $TMPC ; then
262 echo "CROSS_CC_GUEST_STATIC=y" >> $config_target_mak
263 echo "CROSS_CC_GUEST=$target_compiler" >> $config_target_mak
267 echo "CROSS_CC_GUEST_STATIC=y" >> $config_target_mak
268 echo "CROSS_CC_GUEST=$target_compiler" >> $config_target_mak
273 # Special handling for assembler only tests
274 eval "target_as=\"\${cross_as_$arch}\""
275 eval "target_ld=\"\${cross_ld_$arch}\""
276 if has
$target_as && has
$target_ld; then
279 echo "CROSS_CC_GUEST=$target_as" >> $config_target_mak
280 echo "CROSS_AS_GUEST=$target_as" >> $config_target_mak
281 echo "CROSS_LD_GUEST=$target_ld" >> $config_target_mak
288 if test $got_cross_cc = yes; then
289 # Test for compiler features for optional tests. We only do this
290 # for cross compilers because ensuring the docker containers based
291 # compilers is a requirememt for adding a new test that needs a
296 if do_compiler
"$target_compiler" $target_compiler_cflags \
297 -march=armv8.1
-a+sve
-o $TMPE $TMPC; then
298 echo "CROSS_CC_HAS_SVE=y" >> $config_target_mak
300 if do_compiler
"$target_compiler" $target_compiler_cflags \
301 -march=armv8.1
-a+sve2
-o $TMPE $TMPC; then
302 echo "CROSS_CC_HAS_SVE2=y" >> $config_target_mak
304 if do_compiler
"$target_compiler" $target_compiler_cflags \
305 -march=armv8.3
-a -o $TMPE $TMPC; then
306 echo "CROSS_CC_HAS_ARMV8_3=y" >> $config_target_mak
308 if do_compiler
"$target_compiler" $target_compiler_cflags \
309 -mbranch-protection=standard
-o $TMPE $TMPC; then
310 echo "CROSS_CC_HAS_ARMV8_BTI=y" >> $config_target_mak
312 if do_compiler
"$target_compiler" $target_compiler_cflags \
313 -march=armv8.5
-a+memtag
-o $TMPE $TMPC; then
314 echo "CROSS_CC_HAS_ARMV8_MTE=y" >> $config_target_mak
318 if do_compiler
"$target_compiler" $target_compiler_cflags \
319 -mpower8-vector -o $TMPE $TMPC; then
320 echo "CROSS_CC_HAS_POWER8_VECTOR=y" >> $config_target_mak
322 if do_compiler
"$target_compiler" $target_compiler_cflags \
323 -mpower10 -o $TMPE $TMPC; then
324 echo "CROSS_CC_HAS_POWER10=y" >> $config_target_mak
328 if do_compiler
"$target_compiler" $target_compiler_cflags \
329 -Werror -fno-pie -o $TMPE $TMPC; then
330 echo "CROSS_CC_HAS_I386_NOPIE=y" >> $config_target_mak
334 elif test $got_cross_cc = no
&& test "$container" != no
&& \
335 test -n "$container_image"; then
336 for host in $container_hosts; do
337 if test "$host" = "$cpu"; then
338 echo "DOCKER_IMAGE=$container_image" >> $config_target_mak
339 echo "DOCKER_CROSS_CC_GUEST=$container_cross_cc" >> \
341 if test -n "$container_cross_as"; then
342 echo "DOCKER_CROSS_AS_GUEST=$container_cross_as" >> \
345 if test -n "$container_cross_ld"; then
346 echo "DOCKER_CROSS_LD_GUEST=$container_cross_ld" >> \
351 echo "CROSS_CC_HAS_SVE=y" >> $config_target_mak
352 echo "CROSS_CC_HAS_SVE2=y" >> $config_target_mak
353 echo "CROSS_CC_HAS_ARMV8_3=y" >> $config_target_mak
354 echo "CROSS_CC_HAS_ARMV8_BTI=y" >> $config_target_mak
355 echo "CROSS_CC_HAS_ARMV8_MTE=y" >> $config_target_mak
358 echo "CROSS_CC_HAS_POWER8_VECTOR=y" >> $config_target_mak
359 echo "CROSS_CC_HAS_POWER10=y" >> $config_target_mak
362 echo "CROSS_CC_HAS_I386_NOPIE=y" >> $config_target_mak