Blob Blame History Raw
diff -up libdvdread-4.1.4/configure2.endian libdvdread-4.1.4/configure2
--- libdvdread-4.1.4/configure2.endian	2009-09-27 00:23:58.000000000 +0200
+++ libdvdread-4.1.4/configure2	2009-09-27 01:26:56.000000000 +0200
@@ -108,6 +108,19 @@
   ;;
 esac
 
+echo -n "Checking if we're big-endian... "
+bigendian=no
+TMPD=`mktemp -d`
+TMPC=$TMPD/endian.c
+TMPO=$TMPD/endian.o
+cat > $TMPC <<EOF
+unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E'; 
+EOF
+$cc $optimizations $cflags -c -o $TMPO $TMPC
+od -A n -t x1 $TMPO | grep -q '42 *49 *47 *45' && bigendian=yes
+rm -rf $TMPD
+echo "$bigendian"
+
 cat > config.mak << EOF
 # Automatically generated by configure, do not edit
 PREFIX=$PREFIX
@@ -136,6 +149,7 @@
 /* Automatically generated by configure, do not edit */
 #include "version.h"
 EOF
+test "$bigendian" == "yes" && echo "#define WORDS_BIGENDIAN" >> config.h || echo "#undef WORDS_BIGENDIAN" >> config.h
 
 # build tree in object directory if source path is different from current one
 if test "$source_path_used" != "no"; then