From patchwork Sat Dec 24 13:07:25 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 5960 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 E421623E11 for ; Sat, 24 Dec 2011 13:07:30 +0000 (UTC) Received: from mail-ey0-f180.google.com (mail-ey0-f180.google.com [209.85.215.180]) by fiordland.canonical.com (Postfix) with ESMTP id C212FA18004 for ; Sat, 24 Dec 2011 13:07:30 +0000 (UTC) Received: by eaac11 with SMTP id c11so7778623eaa.11 for ; Sat, 24 Dec 2011 05:07:30 -0800 (PST) Received: by 10.205.141.78 with SMTP id jd14mr4814324bkc.107.1324732050339; Sat, 24 Dec 2011 05:07:30 -0800 (PST) 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.205.82.144 with SMTP id ac16cs112228bkc; Sat, 24 Dec 2011 05:07:29 -0800 (PST) Received: by 10.216.211.97 with SMTP id v75mr15442599weo.29.1324732048548; Sat, 24 Dec 2011 05:07:28 -0800 (PST) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk. [81.2.115.146]) by mx.google.com with ESMTPS id u24si7807965weq.2.2011.12.24.05.07.28 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 24 Dec 2011 05:07:28 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 81.2.115.146 as permitted sender) client-ip=81.2.115.146; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 81.2.115.146 as permitted sender) smtp.mail=pm215@archaic.org.uk Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.72) (envelope-from ) id 1ReRJt-0001RP-BU; Sat, 24 Dec 2011 13:07:25 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, qemu-trivial@nongnu.org, Stefan Weil Subject: [PATCH] configure: Fix test for supported host CPU type Date: Sat, 24 Dec 2011 13:07:25 +0000 Message-Id: <1324732045-5516-1-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.2.5 The test for whether the host CPU is supported had several problems: * the attempt to fall back to TCI was done as a duplicate test, very late (so "--cpu foo" would fail early but "--cpu unicore32" would fail late, differently, and after configure had already printed a lot of output) * a number of CPUs only supported as guests were included in the list of CPUs we would accept as valid hosts, which would result in a late compile failure on those systems rather than a configure failure or fallback to TCI * bailing out for an unsupported CPU happened before the main option parsing, so "configure --help" wouldn't work Fix these by folding the setting of ARCH into the first test for supported host CPU, removing spurious guest-only CPU names from it, and moving the "fall back to TCI" code earlier. Signed-off-by: Peter Maydell --- configure | 44 +++++++++++++++++++++----------------------- 1 files changed, 21 insertions(+), 23 deletions(-) diff --git a/configure b/configure index 640e815..a563516 100755 --- a/configure +++ b/configure @@ -300,8 +300,11 @@ else cpu=`uname -m` fi +ARCH= +# Normalise host CPU name and set ARCH. +# Note that this case should only have supported host CPUs, not guests. case "$cpu" in - alpha|cris|ia64|lm32|m68k|microblaze|ppc|ppc64|sparc64|unicore32) + ia64|ppc|ppc64|s390|s390x|sparc64) cpu="$cpu" ;; i386|i486|i586|i686|i86pc|BePC) @@ -319,20 +322,17 @@ case "$cpu" in mips*) cpu="mips" ;; - s390) - cpu="s390" - ;; - s390x) - cpu="s390x" - ;; sparc|sun4[cdmuv]) cpu="sparc" ;; *) - echo "Unsupported CPU = $cpu" - exit 1 + # This will result in either an error or falling back to TCI later + ARCH=unknown ;; esac +if test -z "$ARCH"; then + ARCH="$cpu" +fi # OS specific if check_define __linux__ ; then @@ -1080,6 +1080,18 @@ echo "NOTE: The object files are built at the place where configure is launched" exit 1 fi +# Now we have handled --enable-tcg-interpreter and know we're not just +# printing the help message, bail out if the host CPU isn't supported. +if test "$ARCH" = "unknown"; then + if test "$tcg_interpreter" = "yes" ; then + echo "Unsupported CPU = $cpu, will use TCG with TCI (experimental)" + ARCH=tci + else + echo "Unsupported CPU = $cpu, try --enable-tcg-interpreter" + exit 1 + fi +fi + # check that the C compiler works. cat > $TMPC <> $config_host_mak echo "docdir=$docdir" >> $config_host_mak echo "confdir=$confdir" >> $config_host_mak -case "$cpu" in - i386|x86_64|alpha|arm|cris|hppa|ia64|lm32|m68k|microblaze|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64|unicore32) - ARCH=$cpu - ;; - *) - if test "$tcg_interpreter" = "yes" ; then - echo "Unsupported CPU = $cpu, will use TCG with TCI (experimental)" - ARCH=tci - else - echo "Unsupported CPU = $cpu, try --enable-tcg-interpreter" - exit 1 - fi - ;; -esac echo "ARCH=$ARCH" >> $config_host_mak if test "$debug_tcg" = "yes" ; then echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak