#!/bin/sh
prefix=/usr
libs="-L/usr/lib -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -Wl,--export-dynamic -lgmodule-2.0 -pthread -lglib-2.0 -lgtkada"
cflags="-aI/usr/include/gtkada -aO/usr/lib/gtkada"

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

show_cflags=1
show_libs=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= ;;
  *) optarg= ;;
  esac

  case $1 in
    --help|-h)
      usage 1>&2
      exit 1
      ;;
    --static)
	  echo "No static library supported" 1>&2
      exit 1
      ;;
    --prefix)
      echo $prefix
      exit 0
      ;;
    --version|-v)
      echo 3.25.0
      exit 0
      ;;
    --libs)
      show_libs=1
      show_cflags=0
      ;;
    --cflags)
      show_libs=0
      show_cflags=1
      ;;
    *)
      usage 1>&2
      exit 1
      ;;
  esac
  shift
done

result=""

if [ $show_cflags = 1 ]; then
   result="$cflags"

   if [ $show_libs = 1 ]; then
     result="$result -largs "
   fi
fi

if [ $show_libs = 1 ]; then
   result="${result}${libs}"
fi

echo $result
