]> granicus.if.org Git - libx264/commitdiff
configure test for endianness
authorLoren Merritt <pengvado@videolan.org>
Sun, 27 Jan 2008 09:11:01 +0000 (09:11 +0000)
committerLoren Merritt <pengvado@videolan.org>
Sun, 27 Jan 2008 09:11:01 +0000 (09:11 +0000)
git-svn-id: svn://svn.videolan.org/x264/trunk@722 df754926-b1dd-0310-bc7b-ec298dee348c

configure

index aff77e9a990d17a478227d19f9cf0945298f05aa..6f82da2f4229dfc7be4d7f160b82dd65220ca311 100755 (executable)
--- a/configure
+++ b/configure
@@ -25,27 +25,23 @@ exit 1
 fi
 
 cc_check() {
-    rm -f conftest*
     cat > conftest.c << EOF
 #include <$1>
 int main () { $3 return 0; }
 EOF
     $CC conftest.c $CFLAGS $LDFLAGS $2 -o conftest 2>$DEVNULL
     TMP="$?"
-    rm -f conftest*
     return $TMP
 }
 
 as_check() {
-    rm -f conftest*
     echo "$1" > conftest.asm
     $AS conftest.asm $ASFLAGS $2 -o conftest.o 2>$DEVNULL
     TMP="$?"
-    rm -f conftest*
     return $TMP
 }
 
-rm -f config.h config.mak x264.pc
+rm -f config.h config.mak x264.pc conftest*
 
 prefix='/usr/local'
 exec_prefix='${prefix}'
@@ -335,6 +331,10 @@ fi
 
 CFLAGS="$CFLAGS -DARCH_$ARCH -DSYS_$SYS"
 
+echo "unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';" > conftest.c
+$CC $CFLAGS conftest.c -c -o conftest.o 2>$DEVNULL || die "endian test failed"
+grep -q BIGE conftest.o && CFLAGS="$CFLAGS -DWORDS_BIGENDIAN"
+
 # autodetect options that weren't forced nor disabled
 
 libpthread=""
@@ -418,6 +418,8 @@ elif cc_check "stdio.h" "" "fseeko64(stdin,0,0);" ; then
     echo "#define ftell ftello64" >> config.h
 fi
 
+rm -f conftest*
+
 # generate config files
 
 cat > config.mak << EOF