#!/bin/sh
#
# Configure options script for re-calling ImageMagick compilation
# options required to use the ImageMagick 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.
#
prefix=/usr/X11R6
prefix_set=no
exec_prefix=${prefix}
exec_prefix_set=no

usage="\
Usage: Magick-config [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--cflags] [--cppflags] [--ldflags] [--libs]"

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=*)
      prefix=$optarg
      prefix_set=yes
      if test $exec_prefix_set = no ; then
        exec_prefix=$optarg
      fi
      ;;
    --prefix)
      echo $prefix
      ;;
    --exec-prefix=*)
      exec_prefix=$optarg
      exec_prefix_set=yes
      ;;
    --exec-prefix)
      echo $exec_prefix
      ;;
    --version)
      echo 5.1.1
      ;;
    --cflags)
      echo '-O'
      ;;
    --cppflags)
      if test $prefix_set = yes
      then
	echo "-I$prefix/include -DHAVE_CONFIG_H "'-D_REENTRANT -D_FILE_OFFSET_BITS=64 -I/usr/X11R6/include/X11 -I/usr/X11R6/include'
      else
	echo "-DHAVE_CONFIG_H -D_REENTRANT -D_FILE_OFFSET_BITS=64 -I/usr/X11R6/include/X11 -I/usr/X11R6/include"
      fi
      ;;
    --ldflags)
      if test $exec_prefix_set = yes || test $prefix_set = yes
      then
	echo "-L$exec_prefix/lib "'-L/usr/X11R6/lib -L/usr/X11R6/lib'
      else
	echo '-L/usr/X11R6/lib -L/usr/X11R6/lib'
      fi
      ;;
    --libs)
      echo '-L/usr/X11R6/lib -lMagick -ltiff -lttf -ljpeg -lpng -lXext -lXt -lX11 -lbz2 -lz -lpthread -lm'
      ;;
    *)
      echo "${usage}" 1>&2
      exit 1
      ;;
  esac
  shift
done

