#!/bin/sh
# Copyright (c) SOFNEC Co., Ltd.

AZPROLOG_VERSION=8.22
GIT_HASH='git: 521d88663a116943f5ebaeef9e4ecaf0a3a34413 - Wed May 20 23:11:04 2015 +0900'

show_usage()
{
  cat <<EOF
Usage: azprolog-config [OPTION]

  Values for OPTION are:
  --prefix[=DIR]       change prefix to DIR
  --prefix             print prefix
  --cflags             print C compiler flags
  --libs               print library information
  --version            print AZ-Prolog version
  --git-hash           print git commit hash value of AZ-Prolog source.
  --help               print this help

EOF

  exit 1
}

if test $# -eq 0; then
  show_usage
fi

prefix=@prefix@
is_set_exec_prefix=no

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

  case $1 in
    --prefix=*)
      prefix=$val
      ;;
    --prefix)
      echo $prefix
      ;;
    --cflags)
      if test ${prefix}/include != /usr/include ; then
        show_includedir=-I${prefix}/include
      fi
      echo $show_includedir
      ;;
    --libs)
      if test ${prefix} != /usr ; then
        echo -L${prefix}/lib -lazp
      else
        echo -lazp
      fi

      ;;
    --version)
      echo $AZPROLOG_VERSION
      ;;
    --git-hash)
      echo $GIT_HASH
      ;;
    *)
      show_usage
      ;;
  esac
  shift
done

# END
