Commit 9d56d2dce6b949293d11d0af71ec4f03cd8cb6c1

Authored by malc
1 parent 674bb261

Avoid (some) ppc cross-compilation problems

[..snip..]

A recent 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.

[..snip..]

The patch is based on Hollis's Blanchard idea.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5364 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 4 additions and 12 deletions
configure
... ... @@ -15,6 +15,7 @@ TMPC="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.c"
15 15 TMPO="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.o"
16 16 TMPE="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}"
17 17 TMPS="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.S"
  18 +TMPI="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.i"
18 19  
19 20 # default parameters
20 21 prefix=""
... ... @@ -673,17 +674,8 @@ fi
673 674  
674 675 # ppc specific hostlongbits selection
675 676 if test "$cpu" = "powerpc" ; then
676   - cat > $TMPC <<EOF
677   -int main(void){return sizeof(long);}
678   -EOF
679   -
680   - if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null; then
681   - $TMPE
682   - case $? in
683   - 4) hostlongbits="32";;
684   - 8) hostlongbits="64";;
685   - *) echo "Couldn't determine bits per long value"; exit 1;;
686   - esac
  677 + if $cc $ARCH_CFLAGS -dM -E - -o $TMPI 2>/dev/null </dev/null; then
  678 + grep -q __powerpc64__ $TMPI && hostlongbits=64
687 679 else
688 680 echo hostlongbits test failed
689 681 exit 1
... ... @@ -1604,4 +1596,4 @@ if test &quot;$source_path_used&quot; = &quot;yes&quot; ; then
1604 1596 done
1605 1597 fi
1606 1598  
1607   -rm -f $TMPO $TMPC $TMPE $TMPS
  1599 +rm -f $TMPO $TMPC $TMPE $TMPS $TMPI
... ...