#!/usr/bin/sh
# src/tools/gtkada-config.  Generated from gtkada-config.in by configure.

case `uname --hardware-platform` in
   x86_64|ppc64|s390x|sparc64|alpha|ia64)
      lib=lib64
      ;;
   *)
      lib=lib
      ;;
esac

prefix=/usr
exec_prefix=/usr
bindir=/usr/bin
includedir=/usr/include/gtkada
libdir=${prefix}/${lib}
libdir_static=${libdir}/
libdir_shared=${libdir}/
alidir_static=${libdir}/gtkada
alidir_shared=${libdir}/gtkada
gtk_libs="-Wl,--as-needed -lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lpangoft2-1.0 -lpango-1.0 -lfontconfig -lfreetype "

# OS Specific relocatable settings
if [ "$OS" = "Windows_NT" ]; then
    os_reloc="-L${bindir} -lgtkada-2.24"
else
    os_reloc="-L${libdir_shared} -lgtkada"
fi

cflags_static="-aI${includedir} -aO${alidir_static}"
cflags_relocatable="-aI${includedir} -aO${alidir_shared}"
libs_relocatable="${os_reloc} ${gtk_libs}"
libs_static="-L${libdir_static} -lgtkada ${gtk_libs}"

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

show_cflags=1
show_libs=1
libtype=relocatable

# 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)
      libtype=static
      ;;  
    --prefix)
      echo $prefix
      exit 0
      ;;
    --version|-v)
      echo 2.24.2
      exit 0
      ;;
    --libs)
      show_libs=1
      show_cflags=0
      ;;
    --cflags)
      show_libs=0
      show_cflags=1
      ;;
    *)
      usage 1>&2
      exit 1
      ;;
  esac
  shift
done

## Force static if relocatable was not installed
if [ -d ${libdir_shared} ]; then
   :
else
   libtype=static
fi

result=""

if [ $show_cflags = 1 ]; then
   if [ $libtype = static ]; then
      result="$cflags_static"
   else
      result="$cflags_relocatable"
   fi

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

if [ $show_libs = 1 ]; then
   if [ $libtype = static ]; then
     result="${result}${libs_static}"
   else
     result="${result}${libs_relocatable}"
   fi
fi

echo $result
