#!/bin/sh

prefix=/usr/local
exec_prefix=${prefix}

usage()
{
	cat <<EOF
Usage: dotconf-config [OPTIONS]
Options:
	[--prefix[=DIR]]
	[--version]
	[--cflags]
	[--libs]
	[--pool]
EOF
	exit $1
}

if test $# -eq 0; then
	usage 1 1>&2
fi

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
      ;;
    --prefix)
      echo_prefix=yes
      ;;
    --version)
      echo 1.1.0
      ;;
    --cflags)
      echo_cflags=yes
      ;;
    --libs)
      echo_libs=yes
      ;;
    --pool)
      echo_pool=yes
      ;;
    *)
      usage 1 1>&2
      ;;
  esac
  shift
done

if test "$echo_prefix" = "yes"; then
	echo $prefix
fi

if test "$echo_cflags" = "yes"; then
      if test ${prefix}/include != /usr/include ; then
        includes=-I${prefix}/include
      fi
      echo $includes $dotconf_cflags
fi

if test "$echo_libs" = "yes"; then
      libdirs=-L${exec_prefix}/lib
      echo $libdirs -ldotconf
fi

if test "$echo_pool" = "yes"; then
	echo ${exec_prefix}/lib/libpool.a
fi

