configure: pass whole target name to probe_target_compiler
Let probe_target_compiler know if it is looking for a compiler for a
softmmu (freestanding) or a linux-user (hosted) environment. The
detection for the compiler has to be done differently in the two
cases.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
diff --git a/configure b/configure
index 0fd2838..5256bc8 100755
--- a/configure
+++ b/configure
@@ -1875,6 +1875,17 @@
fi
}
+# probe_target_compiler TARGET
+#
+# Look for a compiler for the given target, either native or cross.
+# Set variables target_* if a compiler is found, and container_cross_*
+# if a Docker-based cross-compiler image is known for the target.
+# Set got_cross_cc to yes/no depending on whether a non-container-based
+# compiler was found.
+#
+# If TARGET is a user-mode emulation target, also set build_static to
+# "y" if static linking is possible.
+#
probe_target_compiler() {
# reset all output variables
container_image=
@@ -1896,7 +1907,8 @@
target_ranlib=
target_strip=
- case $1 in
+ target_arch=${1%%-*}
+ case $target_arch in
aarch64) container_hosts="x86_64 aarch64" ;;
alpha) container_hosts=x86_64 ;;
arm) container_hosts="x86_64 aarch64" ;;
@@ -1925,7 +1937,7 @@
for host in $container_hosts; do
test "$container" != no || continue
test "$host" = "$cpu" || continue
- case $1 in
+ case $target_arch in
aarch64)
# We don't have any bigendian build tools so we only use this for AArch64
container_image=debian-arm64-cross
@@ -2041,23 +2053,23 @@
: ${container_cross_strip:=${container_cross_prefix}strip}
done
- eval "target_cflags=\${cross_cc_cflags_$1}"
- if eval test -n "\"\${cross_cc_$1}\""; then
- if eval has "\"\${cross_cc_$1}\""; then
- eval "target_cc=\"\${cross_cc_$1}\""
+ eval "target_cflags=\${cross_cc_cflags_$target_arch}"
+ if eval test -n "\"\${cross_cc_$target_arch}\""; then
+ if eval has "\"\${cross_cc_$target_arch}\""; then
+ eval "target_cc=\"\${cross_cc_$target_arch}\""
fi
else
- compute_target_variable $1 target_cc gcc
+ compute_target_variable $target_arch target_cc gcc
fi
target_ccas=$target_cc
- compute_target_variable $1 target_ar ar
- compute_target_variable $1 target_as as
- compute_target_variable $1 target_ld ld
- compute_target_variable $1 target_nm nm
- compute_target_variable $1 target_objcopy objcopy
- compute_target_variable $1 target_ranlib ranlib
- compute_target_variable $1 target_strip strip
- case "$1:$cpu" in
+ compute_target_variable $target_arch target_ar ar
+ compute_target_variable $target_arch target_as as
+ compute_target_variable $target_arch target_ld ld
+ compute_target_variable $target_arch target_nm nm
+ compute_target_variable $target_arch target_objcopy objcopy
+ compute_target_variable $target_arch target_ranlib ranlib
+ compute_target_variable $target_arch target_strip strip
+ case "$target_arch:$cpu" in
aarch64_be:aarch64 | \
armeb:arm | \
i386:x86_64 | \
@@ -2079,7 +2091,7 @@
;;
esac
if test -n "$target_cc"; then
- case $1 in
+ case $target_arch in
i386|x86_64)
if $target_cc --version | grep -qi "clang"; then
unset target_cc
@@ -2241,7 +2253,7 @@
# Mac OS X ships with a broken assembler
roms=
-probe_target_compiler i386
+probe_target_compiler i386-softmmu
if test -n "$target_cc" &&
test "$targetos" != "darwin" && test "$targetos" != "sunos" && \
test "$targetos" != "haiku" && test "$softmmu" = yes ; then
@@ -2264,7 +2276,7 @@
fi
fi
-probe_target_compiler ppc
+probe_target_compiler ppc-softmmu
if test -n "$target_cc" && test "$softmmu" = yes; then
roms="$roms pc-bios/vof"
config_mak=pc-bios/vof/config.mak
@@ -2275,7 +2287,7 @@
# Only build s390-ccw bios if the compiler has -march=z900 or -march=z10
# (which is the lowest architecture level that Clang supports)
-probe_target_compiler s390x
+probe_target_compiler s390x-softmmu
if test -n "$target_cc" && test "$softmmu" = yes; then
write_c_skeleton
do_compiler "$target_cc" $target_cc_cflags -march=z900 -o $TMPO -c $TMPC
@@ -2488,7 +2500,6 @@
for target in $target_list; do
arch=${target%%-*}
- probe_target_compiler ${arch}
config_target_mak=tests/tcg/config-$target.mak
echo "# Automatically generated by configure - do not modify" > $config_target_mak
@@ -2507,6 +2518,7 @@
;;
esac
+ probe_target_compiler $target
got_cross_cc=no
unset build_static