#!/bin/sh
#
# Return information about the local GDGEDA library installation
#
# Modeled after pdflib-config

# installation directories
prefix=/usr
exec_prefix=/usr
libdir=/usr/lib
includedir=/usr/include
bindir=/usr/bin

usage()
{
	cat <<EOF
Print information on GDGEDA library's version, configuration, and use.
Usage: gdlib-config [options]
Options:
	--libdir          # directory where GDGEDA library is installed
	--includedir      # directory where GDGEDA library headers are installed
	--version         # complete GDGEDA library version string
	--majorversion    # GDGEDA library major version number
	--minorversion    # GDGEDA library minor version number
	--revision        # GDGEDA library revision version number
	--ldflags         # options required for linking against GDGEDA library
	--libs            # libs required for linking against GDGEDA library
	--cflags          # options required for compiling GD library apps
	--includes        # same as --cflags
	--all             # print a summary of all GDGEDA library configure options
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
    --libdir)
	echo $libdir
	;;
    --includedir)
	echo $includedir
	;;
    --version)
	echo 2.0.15
	;;
    --majorversion)
	echo 2
	;;
    --minorversion)
	echo 0
	;;
    --revision)
	echo 15
	;;
    --ldflags)
	echo  -Wl,--as-needed -Wl,--no-undefined -Wl,-z,relro -Wl,-O1 -Wl,--build-id -L/usr/lib  -L/usr/lib
	;;
    --libs)
	echo -lgdgeda -lpng -lz -lm 
	;;
    --cflags|--includes)
	echo -I/usr/include
	;;
    --all)
	echo "GDGEDA library  2.0.15"
	echo "includedir: $includedir"
	echo "cflags:     -I/usr/include"
	echo "ldflags:     -Wl,--as-needed -Wl,--no-undefined -Wl,-z,relro -Wl,-O1 -Wl,--build-id -L/usr/lib  -L/usr/lib"
	echo "libs:       -lgdgeda -lpng -lz -lm "
	echo "libdir:     $libdir"
	;;
    *)
	usage 1 1>&2
	;;
    esac
    shift
done
