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

prefix="/usr/local"
exec_prefix="${prefix}"

usage()
{
  if test -z ''; then
    fftwstatus=" (not configured)"
    fftwflags=" (fftw not configured)"
  else
    fftwflags=" and fftw"
  fi

  cat <<EOF
Usage: $0 [OPTIONS]
Options:
    [--version]      output version ("1.3.1")
    [--target]       output platform this vigra version was configured for
    [--impex-lib]    output flags for linking libvigraimpex
    [--fftw-lib]     output flags for linking libfftw$fftwstatus
    [--rfftw-lib]    output flags for linking librfftw and libfftw$fftwstatus
    [--cppflags]     output include flags for vigra$fftwflags
    [--include-path] output path to VIGRA includes
   ([--libs]         synonym for --impex-lib)
EOF
    exit $1
}

echopath()
{
    echo "$1" \
    | sed "s,\$[({]exec_prefix[})],${prefix}," \
    | sed "s,\$[({]prefix[})],/usr/local,"
}

if test $# -eq 0; then
    echo "ERROR: no parameters given!" 1>&2
    usage 1 1>&2
fi

try=false

while test $# -gt 0; do
  case $1 in
    --version)
      echo 1.3.1
      ;;
    --target|--platform)
      echo x86_64-unknown-freebsd5.4
      ;;
    --cppflags|--cxxincludes|--cxxflags|--cincludes|--cflags)
      echopath '-I$(prefix)/include '
      ;;
    --impex_lib|--impex-lib|--libs)
      echopath '-L${exec_prefix}/lib -lvigraimpex -lm  -L/usr/local/lib -ltiff -L/usr/local/lib -ljpeg -L/usr/local/lib -lpng  -lz'
      ;;
    --fftw_lib|--fftw-lib)
      if test -z ''; then
        echo "VIGRA was configured without fftw switches, libpath unknown!" 1>&2
      else
        echopath ''
      fi
      ;;
    --rfftw_lib|--rfftw-lib)
      if test -z ''; then
        echo "VIGRA was configured without fftw switches, libpath unknown!" 1>&2
      else
        echopath ''
      fi
      ;;
    --include_path|--include-path|--includepath)
      echopath '$(prefix)/include'
      ;;
    --help|-h|-?)
      usage 0 1>&2
      ;;
    --try)
      try=true
      ;;
    *)
      if $try; then
        exit 2
      else
        echo "ERROR: unknown parameter '$1'!"
        usage 2 1>&2
      fi
      ;;
  esac
  shift
done
