#!/bin/sh
#
# VFlib2-config
#     a script to obtain installation information
#  

version=2.25.2
prefix=/usr/local
exec_prefix=${prefix}
exec_prefix_set=no
datadir=${prefix}/share
datadir_set=no



usage()
{
	cat << __EOF__
Usage: VFlib2-config [Options]
Options:
	[--prefix[=DIR]]
	[--exec-prefix[=DIR]]
	[--datadir[=DIR]]
	[--version]
	[--cflags]
	[--lib-vflib]
	[--lib-opt]
	[--libs]  (same as --lib-vflib --lib-opt)
	[--runtime-dir]
	[--vfontcap]
	[--help]
__EOF__
	exit $1
}


if test $# -eq 0;
then
	usage 1  1>&2
fi

S=""

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
    if test $exec_prefix_set = no ; then
      exec_prefix=$optarg
    fi
    if test datadir_set = no ; then
      datadir=$optarg/share
    fi
    ;;
  --prefix)
    echo_prefix=yes 
    ;;
  --exec-prefix=*)
    exec_prefix=$optarg
    exec_prefix_set=yes
    ;;
  --exec-prefix)
    echo_exec_prefix=yes
    ;;
  --datadir=*)
    datadir=$optarg
    datadir_set=yes
    ;;
  --datadir)
    echo_datadir=yes
    ;;
  --version)
    echo_version=yes
    ;;
  --cflags)
    echo_cflags=yes
    ;;
  --libs)
    echo_lib_vflib=yes
    echo_lib_opt=yes
    ;;
  --lib-vflib)
    echo_lib_vflib=yes
    ;;
  --lib-opt)
    echo_lib_opt=yes
    ;;
  --runtime-dir)
    echo_runtime_dir=yes
    ;;
  --vfontcap)
    echo_vfontcap=yes
    ;;
  --help|*)
    usage 1 1>&2
    ;;
  esac
  shift
done


S=""

if test "$echo_prefix" = "yes"; then
  S="$S $prefix"
fi

if test "$echo_exec_prefix" = "yes"; then
  S="$S $exec_prefix"
fi

if test "$echo_datadir" = "yes"; then
  S="$S $datadir"
fi

if test "$echo_version" = "yes"; then
  S="$S $version"
fi

if test "$echo_cflags" = "yes"; then
  S="$S -I$prefix/include"
fi

L=""
if test "$echo_lib_vflib" = "yes"; then
  L="$L -L${exec_prefix}/lib -lVFlib2"
fi
if test "$echo_lib_opt" = "yes"; then
  L="$L -L/usr/X11R6/lib -lttf "
fi
if test -n "$L"; then
  for f in $L
  do
    case "$f" in
    -L*)
      v=`echo $f | sed 's/^-L/L/' | sed 's/[!@#$%^&*-+=./|:;{}]/_/g'`
      w=`echo $v | sed 's/^\(.*\)$/${\1}/'`
      x=`eval "echo $w"`
      if test x"$x" != x"yes"; then
        eval "$v=yes"
        S="$S $f"
      fi   
      ;;
    *)
      S="$S $f"
      ;;
    esac
  done
fi

if test "$echo_runtime_dir" = "yes"; then
  S="$S $datadir/VFlib/$version"
fi

if test "$echo_vfontcap" = "yes"; then
  S="$S $datadir/VFlib/$version/vfontcap"
fi

echo $S


#EOF
