[PATCH 03/30] configure: remove useless test

Paolo Bonzini posted 30 patches 3 years ago
Maintainers: Kevin Wolf <kwolf@redhat.com>, Hanna Reitz <hreitz@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>, "Alex Bennée" <alex.bennee@linaro.org>, Thomas Huth <thuth@redhat.com>, Alexandre Iooss <erdnaxe@crans.org>, Mahmoud Mandour <ma.mandourr@gmail.com>, "Daniel P. Berrangé" <berrange@redhat.com>, "Marc-André Lureau" <marcandre.lureau@redhat.com>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Michael Roth <michael.roth@amd.com>, Konstantin Kostiuk <kkostiuk@redhat.com>, John Snow <jsnow@redhat.com>, Cleber Rosa <crosa@redhat.com>, Richard Henderson <richard.henderson@linaro.org>
[PATCH 03/30] configure: remove useless test
Posted by Paolo Bonzini 3 years ago
$cpu is derived from preprocessor defines rather than uname these days,
so do not bother using isainfo on Solaris.  Likewise do not recognize
BeOS's uname -m output.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/configure b/configure
index 543fd5a48bf0..db2b45740449 100755
--- a/configure
+++ b/configure
@@ -337,9 +337,6 @@ for opt do
   ;;
   esac
 done
-# OS specific
-# Using uname is really, really broken.  Once we have the right set of checks
-# we can eliminate its usage altogether.
 
 # Preferred compiler:
 #  ${CC} (if set)
@@ -489,13 +486,6 @@ sunos)
   QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS"
 # needed for TIOCWIN* defines in termios.h
   QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS"
-  # $(uname -m) returns i86pc even on an x86_64 box, so default based on isainfo
-  # Note that this check is broken for cross-compilation: if you're
-  # cross-compiling to one of these OSes then you'll need to specify
-  # the correct CPU with the --cpu option.
-  if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then
-    cpu="x86_64"
-  fi
 ;;
 haiku)
   pie="no"
@@ -559,7 +549,7 @@ case "$cpu" in
   armv*b|armv*l|arm)
     cpu="arm" ;;
 
-  i386|i486|i586|i686|i86pc|BePC)
+  i386|i486|i586|i686)
     cpu="i386"
     CPU_CFLAGS="-m32" ;;
   x32)
-- 
2.38.1
Re: [PATCH 03/30] configure: remove useless test
Posted by Daniel P. Berrangé 3 years ago
On Fri, Dec 09, 2022 at 12:23:42PM +0100, Paolo Bonzini wrote:
> $cpu is derived from preprocessor defines rather than uname these days,
> so do not bother using isainfo on Solaris.  Likewise do not recognize
> BeOS's uname -m output.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  configure | 12 +-----------
>  1 file changed, 1 insertion(+), 11 deletions(-)

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|


Re: [PATCH 03/30] configure: remove useless test
Posted by Peter Maydell 3 years ago
On Fri, 9 Dec 2022 at 11:25, Paolo Bonzini <pbonzini@redhat.com> wrote:
>
> $cpu is derived from preprocessor defines rather than uname these days,
> so do not bother using isainfo on Solaris.  Likewise do not recognize
> BeOS's uname -m output.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  configure | 12 +-----------
>  1 file changed, 1 insertion(+), 11 deletions(-)
>
> diff --git a/configure b/configure
> index 543fd5a48bf0..db2b45740449 100755
> --- a/configure
> +++ b/configure
> @@ -337,9 +337,6 @@ for opt do
>    ;;
>    esac
>  done
> -# OS specific
> -# Using uname is really, really broken.  Once we have the right set of checks
> -# we can eliminate its usage altogether.

I note that the fallback if we match no #defines is still "use uname".
We can only get rid of that if we're willing to say "must be a
known host architecture, even if using TCI", though. Or we could
force the 1 person using that setup to specify --cpu manually, perhaps.

>  # Preferred compiler:
>  #  ${CC} (if set)
> @@ -489,13 +486,6 @@ sunos)
>    QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS"
>  # needed for TIOCWIN* defines in termios.h
>    QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS"
> -  # $(uname -m) returns i86pc even on an x86_64 box, so default based on isainfo
> -  # Note that this check is broken for cross-compilation: if you're
> -  # cross-compiling to one of these OSes then you'll need to specify
> -  # the correct CPU with the --cpu option.
> -  if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then
> -    cpu="x86_64"
> -  fi

I found a random stackoverflow answer that says the Solaris
compiler does define the __x86_64__ macro that we check for, so
this should be OK.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM
Re: [PATCH 03/30] configure: remove useless test
Posted by Paolo Bonzini 3 years ago
On 12/9/22 12:34, Peter Maydell wrote:
>> -# Using uname is really, really broken.  Once we have the right set of checks
>> -# we can eliminate its usage altogether.
> I note that the fallback if we match no #defines is still "use uname".
> We can only get rid of that if we're willing to say "must be a
> known host architecture, even if using TCI", though. Or we could
> force the 1 person using that setup to specify --cpu manually, perhaps.

Ok I'll change a bit the comments, and add a warning in configure as 
well if the #define checks fail to detect the CPU architecture.

Paolo