Patchwork [07/14] provide portable HOST_LONG_BITS test

login
register
mail settings
Submitter Paolo Bonzini
Date Nov. 14, 2010, 11:48 a.m.
Message ID <1289735342-8660-8-git-send-email-pbonzini@redhat.com>
Download mbox | patch
Permalink /patch/71099/
State New
Headers show

Comments

Paolo Bonzini - Nov. 14, 2010, 11:48 a.m.
Do not hardcode the list of 64-bit CPUs.  Use sizeof(void *) to
compute it.  Renaming it to HOST_LONG_BITS to HOST_POINTER_BITS
is left for later.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure |   16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)

Patch

diff --git a/configure b/configure
index 812c41c..1bc9b85 100755
--- a/configure
+++ b/configure
@@ -1077,13 +1077,15 @@  esac
 
 fi
 
-# host long bits test
-hostlongbits="32"
-case "$cpu" in
-  x86_64|alpha|ia64|sparc64|ppc64|s390x)
-    hostlongbits=64
-  ;;
-esac
+# host long bits test, actually a pointer size test
+cat > $TMPC << EOF
+int sizeof_pointer_is_8[sizeof(void *) == 8 ? 1 : -1];
+EOF
+if compile_object; then
+hostlongbits=64
+else
+hostlongbits=32
+fi
 
 
 ##########################################