#!/bin/sh

prefix=/usr
exec_prefix=/usr
exec_prefix_set=no

usage()
{
  cat <<EOF 1>&2
Usage: lqt-config [--prefix[=DIR]] [--exec-prefix[=DIR]]
                  [--plugin-dir] [--version] [--libs | --plugin-libs] 
                  [--cflags | --plugin-cflags]

EOF
  exit 1
}

if test $# -eq 0; then
    usage
fi

the_libs="-lquicktime -lpthread -lm -lz -ldl "
the_cflags=""

echo_libs=no
echo_cflags=no

while test $# -gt 0; do
  case "$1" in
  -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
  *) optarg= ;;
  esac

  case $1 in
    --prefix=*)
      prefix=$optarg
      if test $exec_prefix_set = no ; then
        exec_prefix=$optarg
      fi
      ;;
    --prefix)
      echo $prefix
      ;;
    --exec-prefix=*)
      exec_prefix=$optarg
      exec_prefix_set=yes
      ;;
    --exec-prefix)
      echo $exec_prefix
      ;;
    --version)
      echo 1.1.3
      ;;
    --plugin-dir)
      echo /usr/lib/libquicktime
      ;;
    --cflags|--plugin-cflags)
      the_cflags="-I${prefix}/include/lqt $the_cflags"
      echo_cflags=yes
      ;;
    --libs|--plugin-libs)
      the_libs="-L${exec_prefix}/lib $the_libs"
      echo_libs=yes
      ;;
    *)
      usage
      ;;
  esac
  shift
done

if test x$echo_libs = xyes; then
  echo $the_libs
fi

if test x$echo_cflags = xyes; then
  echo $the_cflags
fi
