[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 10/18] configure: pass whole target name to probe_target_compiler
|
From: |
Paolo Bonzini |
|
Subject: |
[PULL 10/18] configure: pass whole target name to probe_target_compiler |
|
Date: |
Tue, 12 Jul 2022 14:49:48 +0200 |
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>
---
configure | 52 ++++++++++++++++++++++++++++++++--------------------
1 file changed, 32 insertions(+), 20 deletions(-)
diff --git a/configure b/configure
index 0fd2838e82..5256bc88e5 100755
--- a/configure
+++ b/configure
@@ -1875,6 +1875,17 @@ compute_target_variable() {
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 @@ probe_target_compiler() {
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 @@ probe_target_compiler() {
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 @@ probe_target_compiler() {
: ${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 @@ probe_target_compiler() {
;;
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 @@ done
# 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 @@ if test -n "$target_cc" &&
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 @@ fi
# 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 @@ tcg_tests_targets=
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 @@ for target in $target_list; do
;;
esac
+ probe_target_compiler $target
got_cross_cc=no
unset build_static
--
2.36.1
- [PULL 00/18] Misc patches for 2022-07-12, Paolo Bonzini, 2022/07/12
- [PULL 01/18] tests/vm: do not specify -bios option, Paolo Bonzini, 2022/07/12
- [PULL 02/18] scsi/lsi53c895a: fix use-after-free in lsi_do_msgout (CVE-2022-0216), Paolo Bonzini, 2022/07/12
- [PULL 07/18] configure: allow more host/target combos to use the host compiler, Paolo Bonzini, 2022/07/12
- [PULL 05/18] configure, pc-bios/s390-ccw: pass cross CFLAGS correctly, Paolo Bonzini, 2022/07/12
- [PULL 03/18] pc-bios/optionrom: use -m16 unconditionally, Paolo Bonzini, 2022/07/12
- [PULL 12/18] build: improve -fsanitize-coverage-allowlist check, Paolo Bonzini, 2022/07/12
- [PULL 14/18] audio/dbus: fix building, Paolo Bonzini, 2022/07/12
- [PULL 10/18] configure: pass whole target name to probe_target_compiler,
Paolo Bonzini <=
- [PULL 09/18] tests/tcg: compile system emulation tests as freestanding, Paolo Bonzini, 2022/07/12
- [PULL 04/18] configure, pc-bios/optionrom: pass cross CFLAGS correctly, Paolo Bonzini, 2022/07/12
- [PULL 16/18] build: Do not depend on pc-bios for config-host.mak, Paolo Bonzini, 2022/07/12
- [PULL 15/18] accel: kvm: Fix memory leak in find_stats_descriptors, Paolo Bonzini, 2022/07/12
- [PULL 06/18] configure, pc-bios/vof: pass cross CFLAGS correctly, Paolo Bonzini, 2022/07/12
- [PULL 17/18] qga: Relocate a path emitted in the help text, Paolo Bonzini, 2022/07/12
- [PULL 18/18] meson: place default firmware path under .../share, Paolo Bonzini, 2022/07/12
- [PULL 11/18] build: try both native and cross compilers, Paolo Bonzini, 2022/07/12