#!/bin/sh
#
#

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

usage()
{
	cat <<EOF
Usage: poslib-config [OPTIONS] [LIBRARIES]
Options:
  [--version]      Print version info
  [--libs]         Print linker flags
  [--cflags]       Print compiler flags
  [--server]       Use the Poslib server library
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
    --version)
      echo 1.0.6
      ;;
    --cflags)
      echo_cflags=yes
      ;;
    --libs)
      echo_libs=yes
      ;;
    --server)
      echo_server=yes
      ;;
    *)
      usage 1 1>&2
      ;;
  esac
  shift
done

CMD=

if test "$echo_cflags" = "yes"; then
      CMD="$CMD -I${prefix}/include/poslib-1.0.6 -I${exec_prefix}/lib/poslib-1.0.6/include/ -funsigned-char -D_THREAD_SAFE"
fi

if test "$echo_libs" = "yes"; then
      CMD="$CMD -L${exec_prefix}/lib -lposlib -pthread"
  if test "$echo_server" = "yes"; then
      CMD="$CMD -lposserver"
  fi
fi

if test "x$CMD" != "x" ; then
  echo $CMD
fi
