#!/bin/sh
# xmlada-config.  Generated from xmlada-config.in by configure.

prefix=/usr

exec_prefix=${prefix}
libdir=${prefix}/lib/x86_64-linux-gnu
ali_dir=${prefix}/lib/x86_64-linux-gnu/ada/adalib/xmlada
includedir=/usr/share/ada/adainclude/xmlada

cflags="-I${includedir}"
mflags_relocatable="-aI${includedir} -aO${ali_dir}"
mflags_static="-aI${includedir} -aO${ali_dir}"
libs_relocatable="-L${libdir} -lxmlada"
libs_static="${libdir}/libxmlada.a"

show_cflags=0
show_mflags=1
show_libs=1
libtype=relocatable

usage()
{
   cat <<EOF
Usage: xmlada-config [OPTIONS]
Options:
        No option:
            Output all the flags (compiler and linker) required
            to compiler your program
        [--prefix]
            Output the directory in which XML/Ada is installed
        [--version|-v]
            Output the version of XML/Ada
        [--libs]
            Output the linker flags to use for XML/Ada
        [--cflags]
            Output the compiler flags to use for XML/Ada
        [--static]
            Output all the flags (compiler and linker) required to
            compile a static version of your program
        [--shared]
            Output flags to link with a shared library
EOF
}

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

result=""

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

if [ $show_mflags = 1 ]; then
   if [ $libtype = static ]; then
      result="$mflags_static"
   else
      result="$mflags_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

