#!/bin/sh
prefix="/usr"
exec_prefix="${prefix}"
libdir="${prefix}/lib/aarch64-linux-gnu"
includedir="${prefix}/include"
echo_cflags=no
echo_libs=no
echo_help=no
echo_tabs=no
echo_source=no
echo_lalibs=no
echo_zoom=no


yazlibs="-lyaz -lexslt -lxslt -lxml2  "
yazlalibs="-lyaz -lexslt -lxslt -lxml2  "
VERSION=1.6.5

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

if test $# -eq 0; then
    echo_help=yes
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)
	    echo $prefix
	    exit 0
	    ;;
	--version)
	    echo $VERSION
	    exit 0
	    ;;
	--cflags)
	    echo_cflags=yes
	    ;;
	--libs)
	    echo_libs=yes
	    ;;
	--tabs)
	    echo_tabs=yes
	    ;;
	--lalibs)
	    echo_lalibs=yes
	    ;;
	zoom)
	    echo_zoom=yes
	    ;;
	-*)
	    echo_help=yes
	    ;;
    esac
    shift
done

YAZPPINC="-DYAZ_POSIX_THREADS=1 -DYAZ_HAVE_XML2=1 -DYAZ_HAVE_XSLT=1 -DYAZ_HAVE_EXSLT=1 -I/usr/include/libxml2 "
YAZPPLALIB="$yazlalibs"
YAZPPLIB="$yazlibs"

if test "$echo_source" = "yes"; then
    if test "$echo_zoom" = "yes"; then
        YAZPPLIB="-L${build_root}/zoom/.libs -lzoomzpp $YAZPPLIB"
        YAZPPLALIB="${build_root}/zoom/libzoompp.la $YAZPPLALIB"
    else
        YAZPPLIB="-L${build_root}/src/.libs -lyazpp $YAZPPLIB"
        YAZPPLALIB="${build_root}/src/libyazpp.la $YAZPPLALIB"
    fi
    YAZPPINC="$YAZPPINC -I${src_root}/include"
else
    if test "$echo_zoom" = "yes"; then
	libs_short="-lzoompp"
    else
	libs_short="-lyazpp"
    fi
    if test "$prefix" = "/usr"; then
	YAZPPLIB="${libs_short} $YAZPPLIB"
    else
	YAZPPLIB="-L${libdir} ${libs_short} $YAZPPLIB"
    fi
    YAZPPLALIB="$YAZPPLIB"
    if test "$prefix" != "/usr"; then
	YAZPPINC="$YAZPPINC -I${includedir}"
    fi
fi

if test "$echo_help" = "yes"; then
    usage 1 1>&2
fi
if test "$echo_cflags" = "yes"; then
    echo $YAZPPINC
fi
if test "$echo_libs" = "yes"; then
    echo $YAZPPLIB
fi
if test "$echo_lalibs" = "yes"; then
    echo $YAZPPLALIB
fi
# Local Variables:
# mode:shell-script
# sh-indentation: 2
# sh-basic-offset: 4
# End:
