Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

[3a2808]: configure2 Maximize Restore History

Download this file

configure2    156 lines (138 with data), 4.0 kB

#!/bin/sh

dvdread_sh_version=4.1.3
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="-O3"

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

cat > 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

# 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"