From: Hollis Blanchard Date: Tue, 30 Sep 2008 14:13:59 +0000 Subject: Re: [PATCH 2/3] kvm-userspace: kvmppc: fix hostlonbits detection Message-Id: <1222784039.4796.18.camel@localhost.localdomain> List-Id: References: <1222765817-26552-1-git-send-email-ehrhardt@linux.vnet.ibm.com> In-Reply-To: <1222765817-26552-1-git-send-email-ehrhardt@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: ehrhardt@linux.vnet.ibm.com Cc: kvm-ppc@vger.kernel.org, kvm@vger.kernel.org, avi@qumranet.com, qemu-devel@nongnu.org On Tue, 2008-09-30 at 11:10 +0200, ehrhardt@linux.vnet.ibm.com wrote: > 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 < -int main(void){return sizeof(long);} > +#include > +__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 $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 Yeah, trying to execute target-specific code is simply incompatible with cross-compiling, so clearly this needs to be changed. might be too Linux-specific, not sure. Also, I worry about the preprocessor being allowed to insert all the whitespace it wants, so I'm not sure if you can assume that __WORDSIZE will be on the last output line. Instead you could use this: $cc -E -dM - < /dev/null | grep __powerpc64__ -- Hollis Blanchard IBM Linux Technology Center