[PATCH] fix long long endian detection when cross-compiling for little endian systems
Mike Frysinger
vapier at gentoo.org
Sun Sep 12 07:39:55 UTC 2010
The long long endian detection code does an AC_TRY_RUN() and since that
doesn't work when cross-compiling, it sets a fallback value. However,
rather than do any sort of default endian detection, the code simply sets
it to "no". This probably breaks most little endian systems out there
when cross-compiling for them. It certainly breaks Blackfin systems. So
use the common endian detection code provided by autoconf and key off of
that when cross-compiling.
before: pread(1, 0x278bf28, 3, 12884901888) ...
after: pread(1, 0x278bf28, 3, 3) ...
* configure.ac: Call AC_C_BIGENDIAN.
* acinclude.m4 (AC_LITTLE_ENDIAN_LONG_LONG): Set cross-compiling logic
based on ac_cv_c_bigendian.
Signed-off-by: Mike Frysinger <vapier at gentoo.org>
---
acinclude.m4 | 8 ++++++--
configure.ac | 1 +
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/acinclude.m4 b/acinclude.m4
index 1741ab9..708f8cc 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -287,8 +287,12 @@ int main () {
return 0;
return 1;
}
-]])],[ac_cv_have_little_endian_long_long=yes],[ac_cv_have_little_endian_long_long=no],[# Should try to guess here
-ac_cv_have_little_endian_long_long=no
+]])],[ac_cv_have_little_endian_long_long=yes],[ac_cv_have_little_endian_long_long=no],[
+if test "x$ac_cv_c_bigendian" = "xyes"; then
+ ac_cv_have_little_endian_long_long=no
+else
+ ac_cv_have_little_endian_long_long=yes
+fi
])])
AC_MSG_RESULT($ac_cv_have_little_endian_long_long)
if test "$ac_cv_have_little_endian_long_long" = yes
diff --git a/configure.ac b/configure.ac
index 96a9a66..bc4dbb1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -185,6 +185,7 @@ AC_PROG_CPP
AC_PROG_GCC_TRADITIONAL
AC_PROG_INSTALL
AC_C_CONST
+AC_C_BIGENDIAN
AC_HEADER_STDC
AC_HEADER_STDBOOL
AC_HEADER_DIRENT
--
1.7.2
More information about the Strace-devel
mailing list