[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 16/32] configure: detect endian via compile test
From: |
Michael Roth |
Subject: |
[Qemu-devel] [PATCH 16/32] configure: detect endian via compile test |
Date: |
Wed, 4 Dec 2013 08:34:23 -0600 |
From: Mike Frysinger <address@hidden>
This avoids needing to execute a program and keeping an (incomplete)
list when cross-compiling.
Signed-off-by: Mike Frysinger <address@hidden>
Reviewed-by: Richard Henderson <address@hidden>
Tested-by: James Hogan <address@hidden> [mips]
Message-id: address@hidden
Signed-off-by: Anthony Liguori <address@hidden>
(cherry picked from commit 61cc919f73ea7ca134c0ac41b748981ad63a253b)
Signed-off-by: Michael Roth <address@hidden>
---
configure | 40 ++++++++++++++--------------------------
1 file changed, 14 insertions(+), 26 deletions(-)
diff --git a/configure b/configure
index 4cf672d..1399de2 100755
--- a/configure
+++ b/configure
@@ -1394,39 +1394,27 @@ feature_not_found() {
"configure was not able to find it"
}
-if test -z "$cross_prefix" ; then
-
# ---
# big/little endian test
cat > $TMPC << EOF
-#include <inttypes.h>
-int main(void) {
- volatile uint32_t i=0x01234567;
- return (*((uint8_t*)(&i))) == 0x67;
+short big_endian[] = { 0x4269, 0x4765, 0x4e64, 0x4961, 0x4e00, 0, };
+short little_endian[] = { 0x694c, 0x7454, 0x654c, 0x6e45, 0x6944, 0x6e41, 0, };
+extern int foo(short *, short *);
+int main(int argc, char *argv[]) {
+ return foo(big_endian, little_endian);
}
EOF
-if compile_prog "" "" ; then
-$TMPE && bigendian="yes"
-else
-echo big/little test failed
-fi
-
-else
-
-# if cross compiling, cannot launch a program, so make a static guess
-case "$cpu" in
- arm)
- # ARM can be either way; ask the compiler which one we are
- if check_define __ARMEB__; then
- bigendian=yes
+if compile_object ; then
+ if grep -q BiGeNdIaN $TMPO ; then
+ bigendian="yes"
+ elif grep -q LiTtLeEnDiAn $TMPO ; then
+ bigendian="no"
+ else
+ echo big/little test failed
fi
- ;;
- hppa|m68k|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64)
- bigendian=yes
- ;;
-esac
-
+else
+ echo big/little test failed
fi
##########################################
--
1.7.9.5
- [Qemu-devel] [PATCH 24/32] qcow2: count_contiguous_clusters and compression, (continued)
- [Qemu-devel] [PATCH 24/32] qcow2: count_contiguous_clusters and compression, Michael Roth, 2013/12/04
- [Qemu-devel] [PATCH 25/32] qcow2: fix possible corruption when reading multiple clusters, Michael Roth, 2013/12/04
- [Qemu-devel] [PATCH 20/32] linux-user: Fix stat64 syscall for SPARC64, Michael Roth, 2013/12/04
- [Qemu-devel] [PATCH 14/32] memory: fix 128 arithmetic in info mtree, Michael Roth, 2013/12/04
- [Qemu-devel] [PATCH 19/32] configure: Explicitly set ARFLAGS so we can build with GNU Make 4.0, Michael Roth, 2013/12/04
- [Qemu-devel] [PATCH 17/32] qapi: fix memleak by adding implict struct functions in dealloc visitor, Michael Roth, 2013/12/04
- [Qemu-devel] [PATCH 11/32] vmdk: Fix vmdk_parse_extents, Michael Roth, 2013/12/04
- [Qemu-devel] [PATCH 15/32] Adjust qapi-visit for python-2.4.3, Michael Roth, 2013/12/04
- [Qemu-devel] [PATCH 18/32] tests: fix memleak in error path test for input visitor, Michael Roth, 2013/12/04
- [Qemu-devel] [PATCH 23/32] Fix pc migration from qemu <= 1.5, Michael Roth, 2013/12/04
- [Qemu-devel] [PATCH 16/32] configure: detect endian via compile test,
Michael Roth <=
- [Qemu-devel] [PATCH 22/32] exec: fix breakpoint_invalidate when pc may not be translated, Michael Roth, 2013/12/04
- Re: [Qemu-devel] Patch Round-up for stable 1.6.2, freeze on 2013-12-06, Paolo Bonzini, 2013/12/05