[PATCH 06/15] configure: remove boolean variables for targets

Paolo Bonzini posted 15 patches 2 years, 5 months ago
Maintainers: Paolo Bonzini <pbonzini@redhat.com>, "Alex Bennée" <alex.bennee@linaro.org>, Thomas Huth <thuth@redhat.com>, Richard Henderson <richard.henderson@linaro.org>, "Marc-André Lureau" <marcandre.lureau@redhat.com>, Alexandre Iooss <erdnaxe@crans.org>, Mahmoud Mandour <ma.mandourr@gmail.com>, "Daniel P. Berrangé" <berrange@redhat.com>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Jason Wang <jasowang@redhat.com>, Michael Roth <michael.roth@amd.com>, Konstantin Kostiuk <kkostiuk@redhat.com>, Kevin Wolf <kwolf@redhat.com>, Juan Quintela <quintela@redhat.com>, Peter Xu <peterx@redhat.com>, Leonardo Bras <leobras@redhat.com>, Laurent Vivier <lvivier@redhat.com>, Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
[PATCH 06/15] configure: remove boolean variables for targets
Posted by Paolo Bonzini 2 years, 5 months ago
Just use $targetos always.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure | 55 +++++++++++++------------------------------------------
 1 file changed, 13 insertions(+), 42 deletions(-)

diff --git a/configure b/configure
index 378a0de9fb6..f96f7359a83 100755
--- a/configure
+++ b/configure
@@ -374,45 +374,14 @@ fi
 
 # OS specific
 
-mingw32="no"
-bsd="no"
-linux="no"
-solaris="no"
 case $targetos in
 windows)
-  mingw32="yes"
   plugins="no"
   pie="no"
 ;;
-gnu/kfreebsd)
-  bsd="yes"
-;;
-freebsd)
-  bsd="yes"
-  # needed for kinfo_getvmmap(3) in libutil.h
-;;
-dragonfly)
-  bsd="yes"
-;;
-netbsd)
-  bsd="yes"
-;;
-openbsd)
-  bsd="yes"
-;;
-darwin)
-  bsd="yes"
-  darwin="yes"
-;;
-sunos)
-  solaris="yes"
-;;
 haiku)
   pie="no"
 ;;
-linux)
-  linux="yes"
-;;
 esac
 
 if test ! -z "$cpu" ; then
@@ -627,7 +596,7 @@ do
     fi
 done
 
-if test "$mingw32" = "yes" ; then
+if test "$targetos" = "windows" ; then
   EXESUF=".exe"
   prefix="/qemu"
   bindir=""
@@ -809,7 +778,7 @@ for opt do
   ;;
   --enable-download) download="enabled"; git_submodules_action=update;
   ;;
-  --enable-plugins) if test "$mingw32" = "yes"; then
+  --enable-plugins) if test "$targetos" = "windows"; then
                         error_exit "TCG plugins not currently supported on Windows platforms"
                     else
                         plugins="yes"
@@ -1080,7 +1049,7 @@ fi
 # by default.  Only enable by default for git builds
 if test -z "$werror" ; then
     if test -e "$source_path/.git" && \
-        { test "$linux" = "yes" || test "$mingw32" = "yes"; }; then
+        { test "$targetos" = linux || test "$targetos" = "windows"; }; then
         werror="yes"
     else
         werror="no"
@@ -1718,7 +1687,7 @@ echo all: >> $config_host_mak
 if test "$debug_tcg" = "yes" ; then
   echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak
 fi
-if test "$mingw32" = "yes" ; then
+if test "$targetos" = "windows"; then
   echo "CONFIG_WIN32=y" >> $config_host_mak
   echo "QEMU_GA_MANUFACTURER=${QEMU_GA_MANUFACTURER-QEMU}" >> $config_host_mak
   echo "QEMU_GA_DISTRO=${QEMU_GA_DISTRO-Linux}" >> $config_host_mak
@@ -1727,24 +1696,26 @@ else
   echo "CONFIG_POSIX=y" >> $config_host_mak
 fi
 
-if test "$linux" = "yes" ; then
+if test "$targetos" = "linux" ; then
   echo "CONFIG_LINUX=y" >> $config_host_mak
 fi
 
-if test "$darwin" = "yes" ; then
+if test "$targetos" = "darwin" ; then
   echo "CONFIG_DARWIN=y" >> $config_host_mak
 fi
 
-if test "$solaris" = "yes" ; then
+if test "$targetos" = "sunos" ; then
   echo "CONFIG_SOLARIS=y" >> $config_host_mak
 fi
 echo "SRC_PATH=$source_path" >> $config_host_mak
 echo "TARGET_DIRS=$target_list" >> $config_host_mak
 
 # XXX: suppress that
-if [ "$bsd" = "yes" ] ; then
-  echo "CONFIG_BSD=y" >> $config_host_mak
-fi
+case $targetos in
+  gnu/kfreebsd | freebsd | dragonfly | netbsd | openbsd | darwin)
+    echo "CONFIG_BSD=y" >> $config_host_mak
+    ;;
+esac
 
 if test "$plugins" = "yes" ; then
     echo "CONFIG_PLUGIN=y" >> $config_host_mak
@@ -1774,7 +1745,7 @@ echo "CC=$cc" >> $config_host_mak
 echo "EXESUF=$EXESUF" >> $config_host_mak
 
 # use included Linux headers for KVM architectures
-if test "$linux" = "yes" && test -n "$linux_arch"; then
+if test "$targetos" = "linux" && test -n "$linux_arch"; then
   symlink "$source_path/linux-headers/asm-$linux_arch" linux-headers/asm
 fi
 
-- 
2.41.0
Re: [PATCH 06/15] configure: remove boolean variables for targets
Posted by Thomas Huth 2 years, 5 months ago
On 02/09/2023 14.59, Paolo Bonzini wrote:
> Just use $targetos always.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>   configure | 55 +++++++++++++------------------------------------------
>   1 file changed, 13 insertions(+), 42 deletions(-)
...
> @@ -1718,7 +1687,7 @@ echo all: >> $config_host_mak
>   if test "$debug_tcg" = "yes" ; then
>     echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak
>   fi
> -if test "$mingw32" = "yes" ; then
> +if test "$targetos" = "windows"; then
>     echo "CONFIG_WIN32=y" >> $config_host_mak
>     echo "QEMU_GA_MANUFACTURER=${QEMU_GA_MANUFACTURER-QEMU}" >> $config_host_mak
>     echo "QEMU_GA_DISTRO=${QEMU_GA_DISTRO-Linux}" >> $config_host_mak
> @@ -1727,24 +1696,26 @@ else
>     echo "CONFIG_POSIX=y" >> $config_host_mak
>   fi
>   
> -if test "$linux" = "yes" ; then
> +if test "$targetos" = "linux" ; then
>     echo "CONFIG_LINUX=y" >> $config_host_mak
>   fi
>   
> -if test "$darwin" = "yes" ; then
> +if test "$targetos" = "darwin" ; then
>     echo "CONFIG_DARWIN=y" >> $config_host_mak
>   fi
>   
> -if test "$solaris" = "yes" ; then
> +if test "$targetos" = "sunos" ; then
>     echo "CONFIG_SOLARIS=y" >> $config_host_mak
>   fi
>   echo "SRC_PATH=$source_path" >> $config_host_mak
>   echo "TARGET_DIRS=$target_list" >> $config_host_mak
>   
>   # XXX: suppress that
> -if [ "$bsd" = "yes" ] ; then
> -  echo "CONFIG_BSD=y" >> $config_host_mak
> -fi
> +case $targetos in
> +  gnu/kfreebsd | freebsd | dragonfly | netbsd | openbsd | darwin)
> +    echo "CONFIG_BSD=y" >> $config_host_mak
> +    ;;
> +esac

It might look nicer to put the linux and solaris parts from above as 
separate entries in the new case-esac statement.

Anyway:
Reviewed-by: Thomas Huth <thuth@redhat.com>
Re: [PATCH 06/15] configure: remove boolean variables for targets
Posted by Paolo Bonzini 2 years, 5 months ago
Il lun 4 set 2023, 10:15 Thomas Huth <thuth@redhat.com> ha scritto:

> It might look nicer to put the linux and solaris parts from above as
> separate entries in the new case-esac statement.
>

True but it all disappears by the end of the series.

Paolo


> Anyway:
> Reviewed-by: Thomas Huth <thuth@redhat.com>
>
>
Re: [PATCH 06/15] configure: remove boolean variables for targets
Posted by Richard Henderson 2 years, 5 months ago
On 9/2/23 05:59, Paolo Bonzini wrote:
> Just use $targetos always.
> 
> Signed-off-by: Paolo Bonzini<pbonzini@redhat.com>
> ---
>   configure | 55 +++++++++++++------------------------------------------
>   1 file changed, 13 insertions(+), 42 deletions(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~