#!/bin/sh
#
# This gets filtered at configure-time to create
# ${PACKAGE_NAME}-config.

usage() {
    cat <<EOF 1>&2

$0: shows information useful for configuring/building s11n
client applications.

Usage:
$0 [options]

Options:
--libs        : prints linker information about what libs clients should link to
--includes    : prints INCLUDES information
--prefix      : prints the library's installation prefix
--version     : prints the library's version
--toc-make    : prints a makefile snippet suitable for use with toc makefiles
--toc-config  : prints info suitable for use in a toc configure script
EOF
}

foo=$1
test "x" = "x$1" && {
    usage
    exit 1;
}

version="0.8.7"
ldadd="-L/usr/lib -ls11n -ldl -export-dynamic -lz -lbz2"
includes="-I/usr/include"
prefix="/usr"

for arg in "$@"; do

    case $arg in
        --help|-?|-h)
            usage
        ;;
        --libs)
            echo $ldadd
        ;;
        --includes)
            echo $includes
        ;;
        --prefix)
            echo $prefix
        ;;
        --version)
            echo $version
        ;;
        --toc-make)
            cat <<EOF
LIBS11N_CLIENT_LDADD=$ldadd
LIBS11N_CLIENT_INCLUDES=$includes
LIBS11N_LIBRARY_VERSION=$version
EOF
        ;;
        --toc-config)
            cat <<EOF
toc_export LIBS11N_CLIENT_LDADD="$ldadd"
toc_export LIBS11N_CLIENT_INCLUDES="$includes"
toc_export LIBS11N_LIBRARY_VERSION="$version"
EOF
        ;;
        *)
            echo "Unrecognized option: $arg"
            exit 2
       ;;
    esac
done
