From patchwork Tue Aug 14 14:35:34 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 10728 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 40A0C23E02 for ; Tue, 14 Aug 2012 14:35:41 +0000 (UTC) Received: from mail-gg0-f180.google.com (mail-gg0-f180.google.com [209.85.161.180]) by fiordland.canonical.com (Postfix) with ESMTP id D3D2CA18A0B for ; Tue, 14 Aug 2012 14:35:40 +0000 (UTC) Received: by ggmi2 with SMTP id i2so541024ggm.11 for ; Tue, 14 Aug 2012 07:35:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:x-gm-message-state; bh=wEAkhpA+h/IJ+tARgvHQ8Kvw+sml12OOUYrZle6EMjs=; b=JtImOvRZcb/qDxH7frOt5VuRXzfeuLAamkJ4Ju+RT/ac1rxLdl+Bf5of4DMnLTrVbv 8AIKfSWkZ3bJctOosYZ70axC3bn/PQkG0UPaNFgKkZLwCQfwOkhAzNUJC88YW8KJY3LU jADdBK94gQlJezpfOVL1GBUQ7tUaYHLg8ow6NyDkKiNoV7Q1UALIeZpZjeJcL7z7Iric dIEBc6xQnt7yACLL2taXXHmkpuJ5GN+NmfZXdLRF4attjzjTGXwSRWUb5A9scbPkieO0 y47pL0mmwAuV2eFzB56Gt0OHE+I6l0QQ2VDJyTisHlW+hfLv3Y9pkQlFwRvSD9AuIym5 D6VA== Received: by 10.42.86.138 with SMTP id u10mr12894755icl.32.1344954940006; Tue, 14 Aug 2012 07:35:40 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.184.200 with SMTP id ew8csp17052igc; Tue, 14 Aug 2012 07:35:38 -0700 (PDT) Received: by 10.14.175.8 with SMTP id y8mr15467409eel.8.1344954938078; Tue, 14 Aug 2012 07:35:38 -0700 (PDT) Received: from mnementh.archaic.org.uk (1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.d.1.0.0.b.8.0.1.0.0.2.ip6.arpa. [2001:8b0:1d0::1]) by mx.google.com with ESMTPS id a1si1992121eep.124.2012.08.14.07.35.36 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 14 Aug 2012 07:35:38 -0700 (PDT) Received-SPF: neutral (google.com: 2001:8b0:1d0::1 is neither permitted nor denied by best guess record for domain of pm215@archaic.org.uk) client-ip=2001:8b0:1d0::1; Authentication-Results: mx.google.com; spf=neutral (google.com: 2001:8b0:1d0::1 is neither permitted nor denied by best guess record for domain of pm215@archaic.org.uk) smtp.mail=pm215@archaic.org.uk Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.72) (envelope-from ) id 1T1IDW-0000FP-Uh; Tue, 14 Aug 2012 15:35:34 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, Alexander Graf , =?UTF-8?q?Andreas=20F=C3=A4rber?= , karl-michael.schindler@web.de Subject: [PATCH] configure: Don't override user's --cpu on MacOS and Solaris Date: Tue, 14 Aug 2012 15:35:34 +0100 Message-Id: <1344954934-928-1-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.2.5 X-Gm-Message-State: ALoCoQlNMW8WNZnFOkUnL/SlbI1QvaDa2gR7b+RVYeFDdaoRMp89shFI/TQlyx6ilaR2TBMDfWAH 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 Reviewed-by: Andreas Färber --- 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