qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
To: qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
	Anthony Liguori <aliguori@us.ibm.com>,
	Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Subject: [Qemu-devel] [PATCH 5/9] configure: Fix test for supported host CPU type
Date: Fri,  6 Jan 2012 15:51:24 +0000	[thread overview]
Message-ID: <1325865088-23897-6-git-send-email-stefanha@linux.vnet.ibm.com> (raw)
In-Reply-To: <1325865088-23897-1-git-send-email-stefanha@linux.vnet.ibm.com>

From: Peter Maydell <peter.maydell@linaro.org>

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 <peter.maydell@linaro.org>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
---
 configure |   44 +++++++++++++++++++++-----------------------
 1 files changed, 21 insertions(+), 23 deletions(-)

diff --git a/configure b/configure
index af19391..a1394eb 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 <<EOF
 int main(void) { return 0; }
@@ -2903,20 +2915,6 @@ echo "sysconfdir=$sysconfdir" >> $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
-- 
1.7.7.3

  parent reply	other threads:[~2012-01-06 15:52 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-06 15:51 [Qemu-devel] [PULL 0/9] Trivial patches for 20 December 2011 to 6 January 2012 Stefan Hajnoczi
2012-01-06 15:51 ` [Qemu-devel] [PATCH 1/9] qemu-options.hx: fix tls-channel help text Stefan Hajnoczi
2012-01-06 15:51 ` [Qemu-devel] [PATCH 2/9] Strip trailing '\n' from error_report()'s first argument (again) Stefan Hajnoczi
2012-01-06 15:51 ` [Qemu-devel] [PATCH 3/9] scsi virtio-blk usb-msd: Clean up device init error messages Stefan Hajnoczi
2012-01-06 15:51 ` [Qemu-devel] [PATCH 4/9] configure: CONFIG_QEMU_INTERP_PREFIX only for user mode Stefan Hajnoczi
2012-01-06 15:51 ` Stefan Hajnoczi [this message]
2012-01-06 15:51 ` [Qemu-devel] [PATCH 6/9] gdbstub: Fix fd leak in gdbserver_open() error path Stefan Hajnoczi
2012-01-06 15:51 ` [Qemu-devel] [PATCH 7/9] net/socket.c: Fix fd leak in net_socket_listen_init() error paths Stefan Hajnoczi
2012-01-06 15:51 ` [Qemu-devel] [PATCH 8/9] Make python mandatory Stefan Hajnoczi
2012-01-06 15:51 ` [Qemu-devel] [PATCH 9/9] qemu-nbd: drop loop which can never loop Stefan Hajnoczi
2012-01-09 14:51 ` [Qemu-devel] [PULL 0/9] Trivial patches for 20 December 2011 to 6 January 2012 Anthony Liguori

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1325865088-23897-6-git-send-email-stefanha@linux.vnet.ibm.com \
    --to=stefanha@linux.vnet.ibm.com \
    --cc=aliguori@us.ibm.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).