#!/bin/sh dvdread_sh_version=4.2.0 dvdread_sh_major=`echo $dvdread_sh_version | awk -F. '{print $1}'` cc=gcc make=make # find source path source_path="`dirname \"$0\"`" source_path_used="yes" if test -z "$source_path" -o "$source_path" = "." ; then source_path="`pwd`" source_path_used="no" else source_path="`cd \"$source_path\" && pwd`" echo "$source_path" | grep -q '[[:blank:]]' && die "Out of tree builds are impossible with whitespace in source path." fi show_help(){ echo "Usage: configure [options]" echo "Options: [defaults in brackets after descriptions]" echo echo "Standard options:" echo " --help print this message" echo " --prefix=PREFIX install in PREFIX [$PREFIX]" echo " --libdir=DIR install libs in DIR [PREFIX/lib]" 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]" echo " --disable-static do not build static libraries [default=no]" echo " --enable-shared build shared libraries [default=no]" echo " --disable-shared do not build shared libraries [default=yes]" echo " --enable-debug compile with debug symbols [default=yes]" echo " --disable-debug compile without debug symbols [default=no]" echo "Advanced options (experts only):" echo " --cc=CC use C compiler CC [$cc]" echo " --make=MAKE use specified make [$make]" echo " --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS" echo " --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS" echo "Developer options:" echo " --disable-strip disable stripping of executables and shared libraries" echo " --disable-opts disable compiler optimizations" exit 1 } SHARED=yes STATIC=yes PREFIX=/usr/local/ INSTALLSTRIP=-s USEDEBUG=-g optimizations="-O2" for opt do optval=`echo $opt | cut -d '=' -f 2-` case "$opt" in --enable-shared) SHARED=yes ;; --disable-shared) SHARED=no ;; --enable-static) STATIC=yes ;; --disable-static) STATIC=no ;; --prefix=*) PREFIX="$optval" ;; --libdir=*) libdir="$optval" ;; --shlibdir=*) shlibdir="$optval" ;; --incdir=*) incdir="$optval" ;; --cc=*) cc="$optval" ;; --make=*) make="$optval" ;; --extra-cflags=*) cflags="$cflags $optval" ;; --extra-ldflags=*) ldflags="$ldflags $optval" ;; --disable-strip) INSTALLSTRIP= ;; --disable-opts) optimizations="" ;; --disable-debug) USEDEBUG="" ;; --enable-debug) USEDEBUG="-g" ;; --help) show_help ;; esac done PREFIX=`cd $PREFIX && pwd` test -z "$libdir" && libdir=$PREFIX/lib test -z "$shlibdir" && shlibdir=$PREFIX/lib test -z "$incdir" && dvdread_incdir=$PREFIX/include/dvdread targetos=`uname -s` case $targetos in Darwin) SHLDFLAGS="-dynamiclib -Wl,-single_module -Wl,-read_only_relocs,suppress" ;; *) SHLDFLAGS="-shared" ;; esac echo -n "Checking if we're big-endian... " bigendian=no TMPD=`mktemp -d` TMPC=$TMPD/endian.c TMPO=$TMPD/endian.o cat > $TMPC < config.mak << EOF # Automatically generated by configure, do not edit PREFIX=$PREFIX libdir=$libdir shlibdir=$shlibdir incdir=$incdir dvdread_incdir=$dvdread_incdir BUILD_SHARED=$SHARED BUILD_STATIC=$STATIC SHLIB_VERSION=$dvdread_sh_version SHLIB_MAJOR=$dvdread_sh_major CC=$cc MAKE=$make CFLAGS=$optimizations $cflags LDFLAGS=$ldflags SHLDFLAGS=$SHLDFLAGS INSTALLSTRIP=$INSTALLSTRIP USEDEBUG=$USEDEBUG SRC_PATH="$source_path" SRC_PATH_BARE=$source_path EOF cat > config.h << EOF /* Automatically generated by configure, do not edit */ #include "version.h" EOF 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 FILES="\ Makefile \ misc \ " for f in $FILES ; do ln -sf "$source_path/$f" $f done fi [ -d obj ] || mkdir -p obj echo echo "Done, type 'make install' to build and install"