public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: ehrhardt-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org
To: kvm-ppc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	kvm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: hollisb-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org,
	ehrhardt-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org
Subject: [PATCH 2/3] kvm-userspace: kvmppc: fix hostlonbits detection when cross compiling
Date: Tue, 16 Sep 2008 10:48:33 +0200	[thread overview]
Message-ID: <1221554914-29751-3-git-send-email-ehrhardt@linux.vnet.ibm.com> (raw)
In-Reply-To: <1221554914-29751-1-git-send-email-ehrhardt-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>

From: Christian Ehrhardt <ehrhardt-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>

The kvm merge with qemu brought code for 64bit power that broke cross
compilation. The issue is caused by configure trying to execute target
architecture binaries where configure is executed.

I tried to change that detection so that it works with&without cross
compilation with only a small change and especially without an addtional
configure command line switch. Including the bits/wordsize.h header a platform
usually can check its wordsize and by doing that configure can check the
hostlongbits without executing the binary. Instead it now stops after
preprocessing stage which resolved the __WORDSIZE constant and retrieves
that value.

I don't like that check style, but it is at least less broken than before.
Comments and other approaches welcome.

Signed-off-by: Christian Ehrhardt <ehrhardt-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
---

[diffstat]
 configure |   13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

[diff]

diff --git a/qemu/configure b/qemu/configure
--- a/qemu/configure
+++ b/qemu/configure
@@ -685,14 +685,15 @@
 # ppc specific hostlongbits selection
 if test "$cpu" = "powerpc" ; then
     cat > $TMPC <<EOF
-int main(void){return sizeof(long);}
+#include <bits/wordsize.h>
+__WORDSIZE
 EOF
 
-    if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null; then
-        $TMPE
-        case $? in
-            4) hostlongbits="32";;
-            8) hostlongbits="64";;
+    if $cc $ARCH_CFLAGS -E -o $TMPE.E $TMPC 2> /dev/null; then
+        wordsize=`tail -n 1 ${TMPE}.E`
+        case $wordsize in
+            32) hostlongbits="32";;
+            64) hostlongbits="64";;
             *) echo "Couldn't determine bits per long value"; exit 1;;
         esac
     else
--
To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2008-09-16  8:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-16  8:48 [PATCH 0/3] kvm-userspace: kvmppc: fix build for ppc ehrhardt
     [not found] ` <1221554914-29751-1-git-send-email-ehrhardt-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2008-09-16  8:48   ` [PATCH 1/3] kvm-userspace: kvmppc: fix file header in libkvm-powerpc.c ehrhardt-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8
2008-09-16  8:48   ` ehrhardt-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8 [this message]
2008-09-16  8:48 ` [PATCH] kvm-userspace: kvmppc: fix building userspace for powerpc ehrhardt
  -- strict thread matches above, loose matches on Subject: below --
2008-09-30  6:36 [PATCH 2/3] kvm-userspace: kvmppc: fix hostlonbits detection when cross compiling ehrhardt

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=1221554914-29751-3-git-send-email-ehrhardt@linux.vnet.ibm.com \
    --to=ehrhardt-23vcf4htsmix0ybbhkvfkdbpr1lh4cv8@public.gmane.org \
    --cc=hollisb-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org \
    --cc=kvm-ppc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=kvm-u79uwXL29TY76Z2rM5mHXA@public.gmane.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