From patchwork Tue Aug 21 17:05:36 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 179104 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 0D6F92C00AC for ; Wed, 22 Aug 2012 03:06:37 +1000 (EST) Received: from localhost ([::1]:39721 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T3ruU-0006rD-On for incoming@patchwork.ozlabs.org; Tue, 21 Aug 2012 13:06:34 -0400 Received: from eggs.gnu.org ([208.118.235.92]:45273) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T3ruK-0006qO-Gr for qemu-devel@nongnu.org; Tue, 21 Aug 2012 13:06:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T3ruJ-0002fd-4y for qemu-devel@nongnu.org; Tue, 21 Aug 2012 13:06:24 -0400 Received: from mail-iy0-f173.google.com ([209.85.210.173]:45337) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T3ruJ-0002ef-05 for qemu-devel@nongnu.org; Tue, 21 Aug 2012 13:06:23 -0400 Received: by mail-iy0-f173.google.com with SMTP id x26so15891iak.4 for ; Tue, 21 Aug 2012 10:06:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=L4fottWZath5VDrOvzxWFon6gG70NL6FgsaQCx5Y7O8=; b=dxN9YU2l+PegW6iv+kbifVpzhhYAv37wVP7uNFGJA2xDwOQIGtQUD7WAS+yk2O8E9d QO3fRyE9ebutqf1cTl1gSxuy6Pa9BWwVLP4S8clqhZ0Akro9Ot2CKkCsfSBHnB/QXmdR x3GpqJxaeGB5NQHX5aOMdIBZyQ0WNtmy5aLwAl7cZNanI8wA8NroLODv6E0A79Q7zkZ6 CJLe59v7/FAY92hB72TGGHxY4OCW7I4cKiI7BW+6hjvtE7osI20Pen/lu0IfIwGKs/Pz r6knTtIkmdVIf0xc14cDenRoMzvLukjKp7lmQzF/ItiRYJ/amiCmhECGzq8p/Df2dulK hVWw== Received: by 10.42.155.200 with SMTP id v8mr14384740icw.12.1345568782812; Tue, 21 Aug 2012 10:06:22 -0700 (PDT) Received: from loki.morrigu.org (cpe-72-179-62-111.austin.res.rr.com. [72.179.62.111]) by mx.google.com with ESMTPS id xm2sm3717964igb.3.2012.08.21.10.06.21 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 21 Aug 2012 10:06:22 -0700 (PDT) From: Michael Roth To: qemu-devel@nongnu.org Date: Tue, 21 Aug 2012 12:05:36 -0500 Message-Id: <1345568757-14365-3-git-send-email-mdroth@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1345568757-14365-1-git-send-email-mdroth@linux.vnet.ibm.com> References: <1345568757-14365-1-git-send-email-mdroth@linux.vnet.ibm.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.210.173 Cc: aliguori@us.ibm.com Subject: [Qemu-devel] [PATCH 02/23] configure: Don't override user's --cpu on MacOS and Solaris X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: 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. Reviewed-by: Andreas F=E4rber Signed-off-by: Peter Maydell Signed-off-by: Anthony Liguori (cherry picked from commit bbea4050802a2e7e0296a21823c0925782c02b93) Signed-off-by: Michael Roth --- configure | 60 +++++++++++++++++++++++++++++++++++------------------------- 1 file changed, 35 insertions(+), 25 deletions(-) diff --git a/configure b/configure index 72d16a4..df29c2f 100755 --- a/configure +++ b/configure @@ -275,6 +275,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 : @@ -349,19 +384,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*) @@ -411,12 +433,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" @@ -437,12 +453,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