aboutsummaryrefslogtreecommitdiff
path: root/configure
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2022-05-27 16:35:55 +0100
committerAlex Bennée <alex.bennee@linaro.org>2022-06-01 15:47:43 +0100
commit33ab4787422b04a3f4c94bbded6b05021d08b27d (patch)
treec02ec7a90235588817aeeb9a6fbf186f50b60ed1 /configure
parent9ffed42614585026834fd63cdf586b78b1f72c66 (diff)
configure: enable cross-compilation of optionrom
While container-based cross compilers are not supported, this already makes it possible to build x86 optionroms on any machine that has an installation of GCC and binutils for 32- or 64-bit x86. Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Message-Id: <20220517092616.1272238-15-pbonzini@redhat.com> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20220527153603.887929-26-alex.bennee@linaro.org>
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure30
1 files changed, 22 insertions, 8 deletions
diff --git a/configure b/configure
index f509bce304..1ae5c950f0 100755
--- a/configure
+++ b/configure
@@ -2082,6 +2082,13 @@ probe_target_compiler() {
fi
}
+probe_target_compilers() {
+ for i; do
+ probe_target_compiler $i
+ test -n "$target_cc" && return 0
+ done
+}
+
write_target_makefile() {
if test -n "$target_cc"; then
echo "CC=$target_cc"
@@ -2190,6 +2197,10 @@ if test "$QEMU_GA_VERSION" = ""; then
QEMU_GA_VERSION=$(cat $source_path/VERSION)
fi
+
+#######################################
+# cross-compiled firmware targets
+
# Set up build tree symlinks that point back into the source tree
# (these can be both files and directories).
# Caution: avoid adding files or directories here using wildcards. This
@@ -2216,19 +2227,27 @@ done
# Mac OS X ships with a broken assembler
roms=
-if { test "$cpu" = "i386" || test "$cpu" = "x86_64"; } && \
+probe_target_compilers i386 x86_64
+if test -n "$target_cc" &&
test "$targetos" != "darwin" && test "$targetos" != "sunos" && \
test "$targetos" != "haiku" && test "$softmmu" = yes ; then
# Different host OS linkers have different ideas about the name of the ELF
# emulation. Linux and OpenBSD/amd64 use 'elf_i386'; FreeBSD uses the _fbsd
# variant; OpenBSD/i386 uses the _obsd variant; and Windows uses i386pe.
for emu in elf_i386 elf_i386_fbsd elf_i386_obsd i386pe; do
- if "$ld" -verbose 2>&1 | grep -q "^[[:space:]]*$emu[[:space:]]*$"; then
+ if "$target_ld" -verbose 2>&1 | grep -q "^[[:space:]]*$emu[[:space:]]*$"; then
ld_i386_emulation="$emu"
- roms="optionrom"
break
fi
done
+ if test -n "$ld_i386_emulation"; then
+ roms="optionrom"
+ config_mak=pc-bios/optionrom/config.mak
+ echo "# Automatically generated by configure - do not modify" > $config_mak
+ echo "TOPSRC_DIR=$source_path" >> $config_mak
+ echo "LD_I386_EMULATION=$ld_i386_emulation" >> $config_mak
+ write_target_makefile >> $config_mak
+ fi
fi
# Only build s390-ccw bios if the compiler has -march=z900 or -march=z10
@@ -2381,7 +2400,6 @@ echo "GLIB_LIBS=$glib_libs" >> $config_host_mak
echo "GLIB_BINDIR=$glib_bindir" >> $config_host_mak
echo "GLIB_VERSION=$(pkg-config --modversion glib-2.0)" >> $config_host_mak
echo "QEMU_LDFLAGS=$QEMU_LDFLAGS" >> $config_host_mak
-echo "LD_I386_EMULATION=$ld_i386_emulation" >> $config_host_mak
echo "STRIP=$strip" >> $config_host_mak
echo "EXESUF=$EXESUF" >> $config_host_mak
@@ -2571,10 +2589,6 @@ for target in $target_list; do
done
echo "TCG_TESTS_TARGETS=$tcg_tests_targets" >> $makefile)
-config_mak=pc-bios/optionrom/config.mak
-echo "# Automatically generated by configure - do not modify" > $config_mak
-echo "TOPSRC_DIR=$source_path" >> $config_mak
-
if test "$skip_meson" = no; then
cross="config-meson.cross.new"
meson_quote() {