#!/bin/sh

# ekg2-config
#
# Tool for retrieving the library/include paths EKG2 was compiled with.
#
# Useful for folks compiling their own EKG2 plugins outside the main
# source tree.
#
# Written 17.11.2005
# Based *HEAVILY* on xmms-config from the XMMS package.
#
# This work is released under the GNU GPL, version 2 or later.

prefix="/usr"
exec_prefix="/usr"
exec_prefix_set=no

data_dir="/usr/share/ekg2" # hm... $pkgdatadir

cflags_ekg2="-O2 -g -pipe -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -fomit-frame-pointer -march=i586 -mtune=generic -fasynchronous-unwind-tables -Wall -std=c99"
include_dir="/usr/include"
lib_dir_ekg2="/usr/lib"

plugin_dir="/usr/lib/ekg2/plugins"
version="20071213"

ekg2_include_dir="$include_dir/ekg2"

usage()
{
    cat <<EOF
Usage: ekg2-config [OPTIONS]
Options:
    [--prefix[=DIR]]
    [--exec-prefix[=DIR]]
    [--version]
    [--libs]
    [--cflags]
    [--data-dir]
    [--plugin-dir]

EOF
    exit $1
}

if test "$include_dir" != "/usr/include"; then
   cflags="-I$include_dir -I$ekg2_include_dir"
else
    cflags="-I$ekg2_include_dir"
fi

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
	    ;;

	--exec-prefix=*)
	    exec_prefix=$optarg
	    exec_prefix_set=yes;
	    echo $exec_prefix
	    ;;

	--exec-prefix)
	    echo $exec_prefix
	    ;;

	--version)
	    echo $version
	    ;;
# here we should just pass includedir to ekg2 headers.
	--cflags)
	    echo $cflags
	    ;;

	--cflags-ekg2)
	    echo $cflags_ekg2
	    ;;
# we don't need any kind of external linking for now ofcorz..
	--libs)
	    echo ""
	    ;;

	--libs-ekg2)
	    echo $lib_dir
	    ;;

	--data-dir)
	    echo $data_dir
	    ;;

	--plugin-dir)
	    echo $plugin_dir
	    ;;
	*)
	    usage 1 1>&2
	    ;;
    esac
  shift
done


