qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] configure: Only add configuration for targets that are enabled


From: Juan Quintela
Subject: [PATCH] configure: Only add configuration for targets that are enabled
Date: Fri, 2 Sep 2022 18:33:12 +0200

Current code configure devices even for targets that we are not
compiling, just in case that we have configured the target
architecture.

Example that showed on my build is that I am compiling only for
x86_64-softmmu, but it insists in building roms/SLOF, that I am not
using at all.

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 configure | 120 +++++++++++++++++++++++++++++-------------------------
 1 file changed, 64 insertions(+), 56 deletions(-)

diff --git a/configure b/configure
index 72ab03f11a..a2741df05d 100755
--- a/configure
+++ b/configure
@@ -2326,62 +2326,70 @@ for f in $LINKS ; do
     fi
 done
 
-# Mac OS X ships with a broken assembler
-roms=
-probe_target_compiler i386-softmmu
-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 "$target_ld" -verbose 2>&1 | grep -q 
"^[[:space:]]*${emu}[[:space:]]*$"; then
-            ld_i386_emulation="$emu"
-            break
-        fi
-    done
-    if test -n "$ld_i386_emulation"; then
-        roms="pc-bios/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
-
-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
-    echo "# Automatically generated by configure - do not modify" > $config_mak
-    echo "SRC_DIR=$source_path/pc-bios/vof" >> $config_mak
-    write_target_makefile >> $config_mak
-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-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
-  has_z900=$?
-  if [ $has_z900 = 0 ] || do_compiler "$target_cc" $target_cc_cflags 
-march=z10 -msoft-float -Werror -o $TMPO -c $TMPC; then
-    if [ $has_z900 != 0 ]; then
-      echo "WARNING: Your compiler does not support the z900!"
-      echo "         The s390-ccw bios will only work with guest CPUs >= z10."
-    fi
-    roms="$roms pc-bios/s390-ccw"
-    config_mak=pc-bios/s390-ccw/config-host.mak
-    echo "# Automatically generated by configure - do not modify" > $config_mak
-    echo "SRC_PATH=$source_path/pc-bios/s390-ccw" >> $config_mak
-    write_target_makefile >> $config_mak
-    # SLOF is required for building the s390-ccw firmware on s390x,
-    # since it is using the libnet code from SLOF for network booting.
-    git_submodules="${git_submodules} roms/SLOF"
-  fi
-fi
+for target in $target_list; do
+    case $target in
+       i386-softmmu)
+           # Mac OS X ships with a broken assembler
+           roms=
+           probe_target_compiler i386-softmmu
+           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 "$target_ld" -verbose 2>&1 | grep -q 
"^[[:space:]]*${emu}[[:space:]]*$"; then
+                       ld_i386_emulation="$emu"
+                       break
+                   fi
+               done
+               if test -n "$ld_i386_emulation"; then
+                   roms="pc-bios/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
+           ;;
+       ppc-softmmu)
+           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
+               echo "# Automatically generated by configure - do not modify" > 
$config_mak
+               echo "SRC_DIR=$source_path/pc-bios/vof" >> $config_mak
+               write_target_makefile >> $config_mak
+           fi
+           ;;
+       s390-softmmu)
+           # 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-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
+               has_z900=$?
+               if [ $has_z900 = 0 ] || do_compiler "$target_cc" 
$target_cc_cflags -march=z10 -msoft-float -Werror -o $TMPO -c $TMPC; then
+                   if [ $has_z900 != 0 ]; then
+                       echo "WARNING: Your compiler does not support the z900!"
+                       echo "         The s390-ccw bios will only work with 
guest CPUs >= z10."
+                   fi
+                   roms="$roms pc-bios/s390-ccw"
+                   config_mak=pc-bios/s390-ccw/config-host.mak
+                   echo "# Automatically generated by configure - do not 
modify" > $config_mak
+                   echo "SRC_PATH=$source_path/pc-bios/s390-ccw" >> $config_mak
+                   write_target_makefile >> $config_mak
+                   # SLOF is required for building the s390-ccw firmware on 
s390x,
+                   # since it is using the libnet code from SLOF for network 
booting.
+                   git_submodules="${git_submodules} roms/SLOF"
+               fi
+           fi
+           ;;
+    esac
+done
 
 #######################################
 # generate config-host.mak
-- 
2.37.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]