#!/bin/sh

prefix=/usr
exec_prefix=/usr
exec_prefix_set=no
libdir=/usr/lib64
includedir=/usr/include

usage()
{
  cat <<EOF
Usage: itpp-config [OPTION]

Known values for OPTION are:

  --prefix        print libitpp installation prefix
  --exec-prefix   print libitpp installation exec prefix
  --libs          print library linking information
  --libs-opt      print optimised library linking information
  --libs-debug    print debug library linking information
  --cflags        print pre-processor and compiler flags
  --cflags-opt    print optimised pre-processor and compiler flags
  --cflags-debug  print debug pre-processor and compiler flags
  --help          display this help and exit
  --version       output version information
EOF
  exit $1
}

if test $# -eq 0; then
  usage 1
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
      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 3.10.12
      ;;
    --help)
      usage 0
      ;;
    --cflags)
      echo -I${includedir}
      ;;
    --cflags-opt)
      echo -I${includedir} -O2 -g -pipe -m64
      ;;
    --cflags-debug)
      echo -I${includedir} 
      ;;
    --libs)
      echo -L${libdir} -litpp -L/usr/lib/atlas 
      ;;
    --libs-opt)
      echo -L${libdir} -litpp -L/usr/lib/atlas 
      ;;
    --libs-debug)
      echo -L${libdir} -litpp -L/usr/lib/atlas 
      ;;
    *)
      echo "${usage}" 1>&2
      exit 1
      ;;
  esac
  shift
done
