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>
This commit is contained in:
Paolo Bonzini 2022-07-02 15:59:02 +02:00
parent bb52a8a278
commit 52f08deaf8

52
configure vendored
View file

@ -1875,6 +1875,17 @@ compute_target_variable() {
fi 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() { probe_target_compiler() {
# reset all output variables # reset all output variables
container_image= container_image=
@ -1896,7 +1907,8 @@ probe_target_compiler() {
target_ranlib= target_ranlib=
target_strip= target_strip=
case $1 in target_arch=${1%%-*}
case $target_arch in
aarch64) container_hosts="x86_64 aarch64" ;; aarch64) container_hosts="x86_64 aarch64" ;;
alpha) container_hosts=x86_64 ;; alpha) container_hosts=x86_64 ;;
arm) container_hosts="x86_64 aarch64" ;; arm) container_hosts="x86_64 aarch64" ;;
@ -1925,7 +1937,7 @@ probe_target_compiler() {
for host in $container_hosts; do for host in $container_hosts; do
test "$container" != no || continue test "$container" != no || continue
test "$host" = "$cpu" || continue test "$host" = "$cpu" || continue
case $1 in case $target_arch in
aarch64) aarch64)
# We don't have any bigendian build tools so we only use this for AArch64 # We don't have any bigendian build tools so we only use this for AArch64
container_image=debian-arm64-cross container_image=debian-arm64-cross
@ -2041,23 +2053,23 @@ probe_target_compiler() {
: ${container_cross_strip:=${container_cross_prefix}strip} : ${container_cross_strip:=${container_cross_prefix}strip}
done done
eval "target_cflags=\${cross_cc_cflags_$1}" eval "target_cflags=\${cross_cc_cflags_$target_arch}"
if eval test -n "\"\${cross_cc_$1}\""; then if eval test -n "\"\${cross_cc_$target_arch}\""; then
if eval has "\"\${cross_cc_$1}\""; then if eval has "\"\${cross_cc_$target_arch}\""; then
eval "target_cc=\"\${cross_cc_$1}\"" eval "target_cc=\"\${cross_cc_$target_arch}\""
fi fi
else else
compute_target_variable $1 target_cc gcc compute_target_variable $target_arch target_cc gcc
fi fi
target_ccas=$target_cc target_ccas=$target_cc
compute_target_variable $1 target_ar ar compute_target_variable $target_arch target_ar ar
compute_target_variable $1 target_as as compute_target_variable $target_arch target_as as
compute_target_variable $1 target_ld ld compute_target_variable $target_arch target_ld ld
compute_target_variable $1 target_nm nm compute_target_variable $target_arch target_nm nm
compute_target_variable $1 target_objcopy objcopy compute_target_variable $target_arch target_objcopy objcopy
compute_target_variable $1 target_ranlib ranlib compute_target_variable $target_arch target_ranlib ranlib
compute_target_variable $1 target_strip strip compute_target_variable $target_arch target_strip strip
case "$1:$cpu" in case "$target_arch:$cpu" in
aarch64_be:aarch64 | \ aarch64_be:aarch64 | \
armeb:arm | \ armeb:arm | \
i386:x86_64 | \ i386:x86_64 | \
@ -2079,7 +2091,7 @@ probe_target_compiler() {
;; ;;
esac esac
if test -n "$target_cc"; then if test -n "$target_cc"; then
case $1 in case $target_arch in
i386|x86_64) i386|x86_64)
if $target_cc --version | grep -qi "clang"; then if $target_cc --version | grep -qi "clang"; then
unset target_cc unset target_cc
@ -2241,7 +2253,7 @@ done
# Mac OS X ships with a broken assembler # Mac OS X ships with a broken assembler
roms= roms=
probe_target_compiler i386 probe_target_compiler i386-softmmu
if test -n "$target_cc" && if test -n "$target_cc" &&
test "$targetos" != "darwin" && test "$targetos" != "sunos" && \ test "$targetos" != "darwin" && test "$targetos" != "sunos" && \
test "$targetos" != "haiku" && test "$softmmu" = yes ; then test "$targetos" != "haiku" && test "$softmmu" = yes ; then
@ -2264,7 +2276,7 @@ if test -n "$target_cc" &&
fi fi
fi fi
probe_target_compiler ppc probe_target_compiler ppc-softmmu
if test -n "$target_cc" && test "$softmmu" = yes; then if test -n "$target_cc" && test "$softmmu" = yes; then
roms="$roms pc-bios/vof" roms="$roms pc-bios/vof"
config_mak=pc-bios/vof/config.mak config_mak=pc-bios/vof/config.mak
@ -2275,7 +2287,7 @@ fi
# Only build s390-ccw bios if the compiler has -march=z900 or -march=z10 # Only build s390-ccw bios if the compiler has -march=z900 or -march=z10
# (which is the lowest architecture level that Clang supports) # (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 if test -n "$target_cc" && test "$softmmu" = yes; then
write_c_skeleton write_c_skeleton
do_compiler "$target_cc" $target_cc_cflags -march=z900 -o $TMPO -c $TMPC do_compiler "$target_cc" $target_cc_cflags -march=z900 -o $TMPO -c $TMPC
@ -2488,7 +2500,6 @@ tcg_tests_targets=
for target in $target_list; do for target in $target_list; do
arch=${target%%-*} arch=${target%%-*}
probe_target_compiler ${arch}
config_target_mak=tests/tcg/config-$target.mak config_target_mak=tests/tcg/config-$target.mak
echo "# Automatically generated by configure - do not modify" > $config_target_mak echo "# Automatically generated by configure - do not modify" > $config_target_mak
@ -2507,6 +2518,7 @@ for target in $target_list; do
;; ;;
esac esac
probe_target_compiler $target
got_cross_cc=no got_cross_cc=no
unset build_static unset build_static