--- configure2.orig	2014-05-05 07:23:08.000000000 +0200
+++ configure2	2014-05-05 07:23:19.000000000 +0200
@@ -27,6 +27,7 @@
   echo "  --help                   print this message"
   echo "  --prefix=PREFIX          install in PREFIX [$PREFIX]"
   echo "  --libdir=DIR             install libs in DIR [PREFIX/lib]"
+  echo "  --libdatadir=DIR         install pkgconfig files in DIR [PREFIX/lib/pkgconfig]"
   echo "  --shlibdir=DIR           install shared libs in DIR [PREFIX/lib]"
   echo "  --incdir=DIR             install includes in DIR [PREFIX/include/dvdnav]"
   echo "  --enable-static          build static libraries [default=yes]"
@@ -76,6 +77,8 @@
   ;;
   --libdir=*) libdir="$optval"
   ;;
+  --libdatadir=*) libdatadir="$optval"
+  ;;
   --shlibdir=*) shlibdir="$optval"
   ;;
   --incdir=*) incdir="$optval"
@@ -101,9 +104,10 @@
   esac
 done
 
-PREFIX=`cd $PREFIX && pwd`
+#PREFIX=`cd $PREFIX && pwd`
 
 test -z "$libdir" && libdir=$PREFIX/lib
+test -z "$libdatadir" && libdir=$PREFIX/lib/pkgconfig
 test -z "$shlibdir" && shlibdir=$PREFIX/lib
 test -z "$incdir" && incdir=$PREFIX/include/dvdnav
 
@@ -113,10 +117,6 @@
   $DVDREAD_CONFIG --exists >> /dev/null 2>&1 && dvdread=yes
 fi
 if test "$dvdread" != "yes" ; then
-  DVDREAD_CONFIG=dvdread-config
-  $DVDREAD_CONFIG --prefix >> /dev/null 2>&1 && dvdread=yes
-fi
-if test "$dvdread" != "yes" ; then
   echo "$DVDREAD_CONFIG returned an error. Can't proceed"
   exit 1
 fi
@@ -133,10 +133,24 @@
   ;;
 esac
 
+echo -n "Checking if we're big-endian... "
+bigendian=no
+TMPD=`mktemp -d temp.XXXX`
+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
 libdir=$libdir
+libdatadir=$libdatadir
 shlibdir=$shlibdir
 incdir=$incdir
 THREADLIB=$threadlib
@@ -163,6 +177,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
