#!/bin/sh

package=autogen
version=5:0:2

prefix=/usr
exec_prefix=${prefix}
exec_prefix_set=no
exeext=
libdir=${exec_prefix}/lib
datadir=${prefix}/share
includedir=${prefix}/include
top_srcdir=

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

if test $# -eq 0; then
	usage 1 1>&2
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
      if test $exec_prefix_set = no ; then
        exec_prefix=$optarg
      fi
      ;;
    --prefix)
      echo_prefix=yes
      ;;
    --exec-prefix=*)
      exec_prefix=$optarg
      exec_prefix_set=yes
      ;;
    --exec-prefix)
      echo_exec_prefix=yes
      ;;
    --top_builddir=*)
      top_builddir=$optarg
      ;;
    --top_srcdir=*)
      top_srcdir=$optarg
      ;;
    --version)
      echo $version
      exit 0
      ;;
    --autogen)
      echo_autogen=yes
      ;;
    --cflags)
      echo_cflags=yes
      ;;
    --pkgdatadir)
      pkgdatadir="$datadir/$package"
      echo_pkgdatadir=yes
      ;;
    --libs)
      echo_libs=yes
      ;;
    *)
      usage 1 1>&2
      ;;
  esac
  shift
done

if test x$echo_prefix = xyes; then
	echo $prefix
fi
if test x$echo_exec_prefix = xyes; then
	echo $exec_prefix
fi
if test x$echo_autogen = xyes; then
    if test x$top_builddir != x; then
        echo $top_builddir/src/autogen$exeext
    else
        echo $exec_prefix/bin/autogen$exeext
    fi
fi
if test x$echo_cflags = xyes; then
    if test x$top_srcdir != x; then
        includedir="$top_srcdir/autoopts"
    fi
    if test "$includedir" != /usr/include ; then
	echo -I$includedir
    fi
fi
if test x$echo_libs = xyes; then
    if test x$top_builddir != x; then
        echo "$top_builddir/autoopts/libopts.la"
    else
	echo "-L$libdir -lopts -lsnprintfv"
    fi
fi
if test "$echo_pkgdatadir" = "yes"; then
    if test x$top_srcdir != x; then
        echo "-L$top_srcdir/autoopts"
    else
	echo $pkgdatadir
    fi
fi

exit 0
