Re: [PATCH 2/3][RESEND] kvm-userspace: kvmppc: fix hostlonbits detection when cross compiling

2008-09-29 Thread Hollis Blanchard
On Mon, 2008-09-29 at 14:50 +0200, [EMAIL PROTECTED] wrote:
> From: Christian Ehrhardt <[EMAIL PROTECTED]>
> 
> 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.

This needs to be CCed to [EMAIL PROTECTED] and applied upstream.

I don't know if bits/wordsize.h is too Linux-specific (or if that even
matters in the configure script).

-- 
Hollis Blanchard
IBM Linux Technology Center

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/3][RESEND] kvm-userspace: kvmppc: fix hostlonbits detection when cross compiling

2008-09-29 Thread ehrhardt
From: Christian Ehrhardt <[EMAIL PROTECTED]>

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 <[EMAIL PROTECTED]>
---

[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 <
+__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" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html