Browse code

better big/little endian test

Originally committed as revision 830 to svn://svn.ffmpeg.org/ffmpeg/trunk

Michael Niedermayer authored on 2002/07/29 00:02:47
Showing 1 changed files
... ...
@@ -187,16 +187,27 @@ if test "$win32" = "yes" ; then
187 187
     network="no"
188 188
 fi
189 189
 
190
-# endianness : guess with cpu type. Should also use prefix
191
-if test "$cpu" = "powerpc"; then
192
-    bigendian="yes"
193
-fi
194
-
195 190
 cc="${cross_prefix}${cc}"
196 191
 ar="${cross_prefix}${ar}"
197 192
 strip="${cross_prefix}${strip}"
198 193
 
199 194
 # ---
195
+# big/little endian test
196
+cat > $TMPC << EOF
197
+#include <inttypes.h>
198
+int main(int argc, char ** argv){
199
+	volatile uint32_t i=0x01234567;
200
+	return (*((uint8_t*)(&i))) == 0x67;
201
+}
202
+EOF
203
+
204
+if $cc -o $TMPO $TMPC 2>/dev/null ; then
205
+$TMPO && bigendian="yes"
206
+else
207
+echo big/little test failed
208
+fi
209
+
210
+# ---
200 211
 # check availability of some header files
201 212
 
202 213
 cat > $TMPC << EOF