* [Qemu-devel] [PATCH] configure: Don't override user's --cpu on MacOS and Solaris
@ 2012-08-14 14:35 Peter Maydell
2012-08-14 14:51 ` Andreas Färber
2012-08-14 22:48 ` Schindler Karl-Michael
0 siblings, 2 replies; 3+ messages in thread
From: Peter Maydell @ 2012-08-14 14:35 UTC (permalink / raw)
To: qemu-devel
Cc: karl-michael.schindler, Alexander Graf, Andreas Färber,
patches
Both MacOS and Solaris have special case handling for the CPU
type, because the check_define probes will return i386 even if
the hardware is 64 bit and x86_64 would be preferable. Move
these checks earlier in the configure probing so that we can
do them only if the user didn't specify a CPU with --cpu. This
fixes a bug where the user's command line argument was being
ignored.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
The per-OS checks are broken for cross compilation, but this isn't
a change introduced by this patch -- they were broken before; I've
merely added a comment noting the fact and the workaround...
configure | 60 +++++++++++++++++++++++++++++++++++-------------------------
1 file changed, 35 insertions(+), 25 deletions(-)
diff --git a/configure b/configure
index bd62d2c..dadcd87 100755
--- a/configure
+++ b/configure
@@ -299,6 +299,41 @@ EOF
compile_object
}
+if check_define __linux__ ; then
+ targetos="Linux"
+elif check_define _WIN32 ; then
+ targetos='MINGW32'
+elif check_define __OpenBSD__ ; then
+ targetos='OpenBSD'
+elif check_define __sun__ ; then
+ targetos='SunOS'
+elif check_define __HAIKU__ ; then
+ targetos='Haiku'
+else
+ targetos=`uname -s`
+fi
+
+# Some host OSes need non-standard checks for which CPU to use.
+# Note that these checks are 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.
+case $targetos in
+Darwin)
+ # on Leopard most of the system is 32-bit, so we have to ask the kernel if we can
+ # run 64-bit userspace code.
+ # If the user didn't specify a CPU explicitly and the kernel says this is
+ # 64 bit hw, then assume x86_64. Otherwise fall through to the usual detection code.
+ if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then
+ cpu="x86_64"
+ fi
+ ;;
+SunOS)
+ # `uname -m` returns i86pc even on an x86_64 box, so default based on isainfo
+ if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then
+ cpu="x86_64"
+ fi
+esac
+
if test ! -z "$cpu" ; then
# command line argument
:
@@ -373,19 +408,6 @@ if test -z "$ARCH"; then
fi
# OS specific
-if check_define __linux__ ; then
- targetos="Linux"
-elif check_define _WIN32 ; then
- targetos='MINGW32'
-elif check_define __OpenBSD__ ; then
- targetos='OpenBSD'
-elif check_define __sun__ ; then
- targetos='SunOS'
-elif check_define __HAIKU__ ; then
- targetos='Haiku'
-else
- targetos=`uname -s`
-fi
case $targetos in
CYGWIN*)
@@ -435,12 +457,6 @@ OpenBSD)
Darwin)
bsd="yes"
darwin="yes"
- # on Leopard most of the system is 32-bit, so we have to ask the kernel it if we can
- # run 64-bit userspace code
- if [ "$cpu" = "i386" ] ; then
- is_x86_64=`sysctl -n hw.optional.x86_64`
- [ "$is_x86_64" = "1" ] && cpu=x86_64
- fi
if [ "$cpu" = "x86_64" ] ; then
QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS"
LDFLAGS="-arch x86_64 $LDFLAGS"
@@ -464,12 +480,6 @@ SunOS)
smbd="${SMBD-/usr/sfw/sbin/smbd}"
needs_libsunmath="no"
solarisrev=`uname -r | cut -f2 -d.`
- # have to select again, because `uname -m` returns i86pc
- # even on an x86_64 box.
- solariscpu=`isainfo -k`
- if test "${solariscpu}" = "amd64" ; then
- cpu="x86_64"
- fi
if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
if test "$solarisrev" -le 9 ; then
if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
--
1.7.11.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] configure: Don't override user's --cpu on MacOS and Solaris
2012-08-14 14:35 [Qemu-devel] [PATCH] configure: Don't override user's --cpu on MacOS and Solaris Peter Maydell
@ 2012-08-14 14:51 ` Andreas Färber
2012-08-14 22:48 ` Schindler Karl-Michael
1 sibling, 0 replies; 3+ messages in thread
From: Andreas Färber @ 2012-08-14 14:51 UTC (permalink / raw)
To: Peter Maydell; +Cc: Alexander Graf, qemu-devel, karl-michael.schindler, patches
Am 14.08.2012 16:35, schrieb Peter Maydell:
> Both MacOS and Solaris have special case handling for the CPU
> type, because the check_define probes will return i386 even if
> the hardware is 64 bit and x86_64 would be preferable. Move
> these checks earlier in the configure probing so that we can
> do them only if the user didn't specify a CPU with --cpu. This
> fixes a bug where the user's command line argument was being
> ignored.
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> The per-OS checks are broken for cross compilation, but this isn't
> a change introduced by this patch -- they were broken before; I've
> merely added a comment noting the fact and the workaround...
Reviewed-by: Andreas Färber <afaerber@suse.de>
Looks okay as far as I can see. We should probably do the __APPLE__ ->
Darwin dance as a followup (ignoring the iOS, which can't JIT).
Andreas
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] configure: Don't override user's --cpu on MacOS and Solaris
2012-08-14 14:35 [Qemu-devel] [PATCH] configure: Don't override user's --cpu on MacOS and Solaris Peter Maydell
2012-08-14 14:51 ` Andreas Färber
@ 2012-08-14 22:48 ` Schindler Karl-Michael
1 sibling, 0 replies; 3+ messages in thread
From: Schindler Karl-Michael @ 2012-08-14 22:48 UTC (permalink / raw)
To: Peter Maydell; +Cc: Alexander Graf, qemu-devel, Andreas Färber, patches
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Pathetic case (32bit qemu on 64bit hw under Mac OS X 10.6) tested succesfully.
Thanks for your patience and help.
Michael
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.18 (Darwin)
Comment: GPGTools - http://gpgtools.org
iQEcBAEBAgAGBQJQKtXXAAoJEHaCPVPT4dXkCmMH/3Nxqsp7aQ/QZ1rfljX4Lbzr
dNKzuyfnx/WvCQfjDAqYJ0WfYPfUQCZ9Y0nF/WbDTwbim26H6/dVN1wGunYRG+dW
8sGTsRtvVpiwzo2bcv5uxLUEUOgKu2mtYer8dlM7GQEC374eyX6vW6yu/73pRbDg
1OgsYid0kbC7c5cxfbVfUXM2MQJLiVhMbaCPJr/2eniJrBNc5FbBayojZ0A1mwth
ZU1Om2zbS5Jc/ASYGJK32TXHtvO+ZuOfROaZgCpLD2t7VXa4fW2Gi2vpfePOS+wJ
IOWZz9y4TZ5t2JBmjqY/ItGoCpljaOCNT56Ij6IDBmg+GEo11fEt5xtAMOquqyM=
=YBe7
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-08-14 22:49 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-14 14:35 [Qemu-devel] [PATCH] configure: Don't override user's --cpu on MacOS and Solaris Peter Maydell
2012-08-14 14:51 ` Andreas Färber
2012-08-14 22:48 ` Schindler Karl-Michael
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.