fix endian check when cross-compiling
authorMåns Rullgård <mans@mansr.com>
Wed, 22 Aug 2007 20:42:25 +0000 (20:42 +0000)
committerMåns Rullgård <mans@mansr.com>
Wed, 22 Aug 2007 20:42:25 +0000 (20:42 +0000)
Originally committed as revision 10187 to svn://svn.ffmpeg.org/ffmpeg/trunk

configure

index 0db02da..a9a4fd7 100755 (executable)
--- a/configure
+++ b/configure
@@ -1519,20 +1519,10 @@ EOF
 
 # ---
 # big/little-endian test
-if ! enabled cross_compile; then
-    check_ld <<EOF || die "endian test failed" && $TMPE && bigendian="yes"
-#include <inttypes.h>
-int main(int argc, char ** argv){
-        volatile uint32_t i=0x01234567;
-        return (*((uint8_t*)(&i))) == 0x67;
-}
+check_cc <<EOF || die "endian test failed"
+unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
 EOF
-else
-    # programs cannot be launched if cross compiling, so make a static guess
-    if test "$arch" = "powerpc" -o "$arch" = "mips" ; then
-        bigendian="yes"
-    fi
-fi
+strings $TMPO | grep -q BIGE && enable bigendian
 
 # ---
 # check availability of some header files