#!/bin/sh
#
# Configure options script for re-calling AnImaL compilation
# options required to use the AnImaL library.
#
# Concept derived from gtk-config in the Gtk package except that Autoconf-style
# configuration information is presented instead so that it may be used more
# effictively in configure scripts.
#
# Initial script was taken from ImageMagick, then merged with ideas
# from gtk-config's source
#

prefix=/usr
exec_prefix=/usr
exec_prefix_set=no

usage()
{
   cat <<EOF
Usage: animal-config [OPTIONS] [LIBRARIES]
Options:
	[--cflags]
	[--cppflags]
	[--libs]
	[--ldflags]
	[--prefix[=DIR]]
	[--exec-prefix[=DIR]]
	[--version]
EOF
   exit $1
}

if test $# -eq 0; then
      echo "${usage}" 1>&2
      exit 1
fi


while test $# -gt 0; do
  case "$1" in
  -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
  *) optarg= ;;
  esac

  case $1 in
     --prefix=*)  # dummy rule (doesn't work yet)
      prefix=$optarg
      if test $exec_prefix_set = no; then
         exec_prefix=$prefix
      fi
      ;;
    --prefix)
      echo $prefix
      ;;
    --exec-prefix=*)
      exec_prefix=$optarg
      ;;
    --exec-prefix)
      echo $exec_prefix
      ;;
    --version)
      echo 0.14.0
      ;;
    --cflags)
      echo '-g -Wall -O2 -W -Wall -Wno-implicit-int'
      ;;
    --cppflags)
      echo "-I/usr/include -I/usr/include  -I/usr/include"
      ;;
    --ldflags)
      echo '-L/usr/lib -L/usr/lib -L/usr/X11R6/lib -lfreetype -lz -L/usr/lib -L/usr/lib/atlas -L/usr/lib -L/usr/X11R6/lib -lfreetype -lz -L/usr/lib'
      ;;
    --libs)
      LIBS="-lanimal -lMagick -llcms -ltiff -lfreetype -ljasper -ljpeg -lpng -ldpstk -ldps -lXext -lXt -lSM -lICE -lX11 -lbz2 -lxml2 -lz -lpthread -lm -lpthread -lMagick -llcms -ltiff -lfreetype -ljasper -ljpeg -lpng -ldpstk -ldps -lXext -lXt -lSM -lICE -lX11 -lbz2 -lxml2 -lz -lpthread -lm -lpthread -lm "
      echo "$LIBS"
      ;;
    *)
      usage 1 1>&2
      ;;
  esac
  shift
done
