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

AZPROLOG_VERSION=9.63
GIT_HASH='git: a32332f6d964e0ef82057861174a8ce22566551a - Thu Jun 29 15:54:18 2017 +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
