#!/bin/sh
# @configure_input@

prefix=@prefix@

gtk_libs="@GTK_LIBS@"
gtkada_libs="-L$prefix/include/gtkada -L$prefix/lib"
gtkada_cflags="-I$prefix/include/gtkada"
gtkada_lflags="-lgtkada"

usage()
{
        cat <<EOF
Usage: gtkada-config [OPTIONS]
Options:
        [--prefix]
        [--version|-v]
        [--libs]
        [--cflags]
        [--static]
        [--help|-h]
EOF
        exit $1
}

# Can have the following values:
#   0 = none
#   1 = cflags
#   2 = libs
#   4 = complete
output_type=4
while test $# -gt 0; do
  case "$1" in
  -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
  *) optarg= ;;
  esac

  case $1 in
    --help|-h)
      usage 1>&2
      exit 1
      ;;
    --static)
      gtkada_libs="$prefix/lib/libgtkada.a"
      gtkada_lflags=""
      ;;  
    --prefix)
      echo $prefix
      output_type=0
      ;;
    --version|-v)
      echo @GTKADA_VERSION@
      exit 1
      ;;
    --libs)
      output_type=2
      ;;
    --cflags)
      output_type=1
      ;;
    *)
      usage 1>&2
      exit 1
      ;;
  esac
  shift
done

case $output_type in
   1) echo $gtkada_cflags ;;
   2) echo $gtkada_libs $gtkada_lflags $gtk_libs ;;
   4) echo $gtkada_cflags -largs $gtkada_libs $gtkada_lflags $gtk_libs;;
esac
