]> granicus.if.org Git - strace/commitdiff
Fix long long little endian detection when cross-compiling
authorMike Frysinger <vapier@gentoo.org>
Sun, 12 Sep 2010 07:39:55 +0000 (03:39 -0400)
committerDmitry V. Levin <ldv@altlinux.org>
Wed, 15 Sep 2010 15:36:00 +0000 (15:36 +0000)
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.

* configure.ac: Call AC_C_BIGENDIAN.
* m4/long_long.m4 (AC_LITTLE_ENDIAN_LONG_LONG): Set cross-compiling
logic based on ac_cv_c_bigendian.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
configure.ac
m4/long_long.m4

index 483694c136082d055fd9a5ece972b90296bad82e..e9df438d2f747b66a67601d1f8864d0b36df39c3 100644 (file)
@@ -184,6 +184,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
index 98ca3707eedd0d0a543c625b02e2e4b0d3cf4a41..5c5c80aec1de4862399fb3ebb0293fd48c82094e 100644 (file)
@@ -57,8 +57,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