--- configure2.orig	2010-09-06 11:36:58.000000000 +0000
+++ configure2	2010-09-07 13:01:25.216794661 +0000
@@ -26,6 +26,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/libdvdread]"
   echo "  --enable-static          build static libraries [default=yes]"
@@ -67,6 +68,8 @@
   ;;
   --libdir=*) libdir="$optval"
   ;;
+  --libdatadir=*) libdatadir="$optval"
+  ;;
   --shlibdir=*) shlibdir="$optval"
   ;;
   --incdir=*) incdir="$optval"
@@ -92,11 +95,12 @@
   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" && dvdread_incdir=$PREFIX/include/dvdread
+test -z "$incdir" && incdir=$PREFIX/include/dvdread
 
 targetos=`uname -s`
 case $targetos in
@@ -110,7 +114,7 @@
 
 echo -n "Checking if we're big-endian... "
 bigendian=no
-TMPD=`mktemp -d`
+TMPD=`mktemp -d temp.XXXX`
 TMPC=$TMPD/endian.c
 TMPO=$TMPD/endian.o
 cat > $TMPC <<EOF
@@ -125,9 +129,9 @@
 # Automatically generated by configure, do not edit
 PREFIX=$PREFIX
 libdir=$libdir
+libdatadir=$libdatadir
 shlibdir=$shlibdir
 incdir=$incdir
-dvdread_incdir=$dvdread_incdir
 BUILD_SHARED=$SHARED
 BUILD_STATIC=$STATIC
 SHLIB_VERSION=$dvdread_sh_version
@@ -149,7 +153,7 @@
 /* Automatically generated by configure, do not edit */
 #include "version.h"
 EOF
-test "$bigendian" == "yes" && echo "#define WORDS_BIGENDIAN" || echo "#undef WORDS_BIGENDIAN" >> config.h
+test "$bigendian" = "yes" && echo "#define WORDS_BIGENDIAN" || 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
