#!/bin/sh

#VERSION=0.7.1		# Get this from configure
THE_COMPILER=GCC	# Get this from configure
THE_OS=LINUX		# Get this from configure
#BASEDIR=/usr/local	# Get this from configure
BASEDIR=/usr/local
LIBDIR=${BASEDIR}/lib
INCDIR=${BASEDIR}/include
SYSDIR=${BASEDIR}/etc
IDFDIR=${BASEDIR}/share/edma/idf
DOCDIR=${BASEDIR}/share/edma/doc
SHAREDIR=${BASEDIR}/share/edma


# Main code for edma-config script

usage()
{
#    exit_code=$1

echo $THISVERSION
echo
    cat <<EOF
Usage: edma-config [OPTION]...

Generic options
  --version	output edma version information
  --help	display this help and exit

Compilation support options
  --cflags-exe      print pre-processor and compiler flags for executables
  --cflags-class    print pre-processor and compiler flags for EDMA classes
  --libs-exe	    print library linking information for executables
  --libs-exe1	    print library linking information for executables 1
  --libs-class      print library linking information for EDMA classes

Installation support options
  --dir-impl        print directory for installing class implementation
  --dir-int         print directory for installing class interface
  --dir-doc	    print directory for installing class documentation
  --dir-share       print directory for installing shared files
EOF

}

THISVERSION="0.15.7-7"

if test $# -eq 0; then
    usage 
fi

while test $# -gt 0; do
    case "$1" in
    -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
    *) optarg= ;;
    esac

    case $1 in
    --version)
	echo "GNU EDMA $THISVERSION"
	exit 0
	;;
    --help)
	usage
	exit 0
	;;
    --cflags-exe)
	echo "-D$THE_COMPILER -D$THE_OS -fPIC -rdynamic -I$INCDIR"
	exit 0
	;;
    --cflags-class)
	echo "-D$THE_COMPILER -D$THE_OS -fPIC -I$INCDIR -c "
	exit 0
	;;
    --libs-exe)
	echo "-lEDMA -ldl -lm -L$LIBDIR"
	exit 0
	;;
    --libs-class)
	#echo "$LIBDIR/dynlink.o $LIBDIR/cdlink.o"
	exit 0
	;;
    --dir-impl)
	echo "$LIBDIR"
	exit 0
	;;
    --dir-doc)
	echo "$DOCDIR"
	exit 0
	;;
    --dir-share)
	echo "$SHAREDIR"
	exit 0
	;;
    --dir-int)
	echo "$IDFDIR"
	;;
    esac
    shift
done
