#!/bin/sh
#
### BEGIN csound-config -- loosely based on wx-config and fltk-config

PACKAGE="csound"
VERSION="4.23f13gbs.0"
prefix=/usr
exec_prefix=${prefix}
exec_prefix_set=no
bindir=${exec_prefix}/bin
includedir=${prefix}/include
libdir=${exec_prefix}/lib

CFLAGS=""
CXXFLAGS=""
LDFLAGS=""
LDLIBS="-lasound -lX11 -Wl,-rpath,/usr/lib -lfltk -lXinerama -lpthread -ldl -lm -lXext -lX11 -lstdc++ -lpthread -ldl -lm "
CC="gcc"
CXX="g++"
static_flag=no
inplace_flag=no
inplace_libdir=`dirname "$0"`
inplace_includedir="$inplace_libdir/.."

usage ()
{
    cat <<\EOF
Usage: csound-config [options]
Options:
  --prefix[=DIR]        Show or set the prefix
  --exec-prefix[=DIR]   Show or set the exec-prefix
  --basename            Show the package base name
  --version             Show the version
  --cflags              Show the flags to compile C with Csound
  --cxxflags            Show the flags to compile C++ with Csound
  --ldflags             Show the flags to link with Csound
  --libs                Show the library flags to link with Csound
  --static              When displaying libraries, show the static ones
  --cc                  Show C compiler used to build Csound
  --cxx                 Show C++ compiler used to build Csound
  --inplace             Use the build directory instead the install directories
EOF
    exit $1
}

cppflags()
{
    if test "$includedir" != /usr/include; then
	includes=-I$includedir
    else
	includes=
    fi
    echo $CXXFLAGS $includes
}

libs()
{
    if test "$static_flag" = yes; then
	echo $libdir/libcsound.a $LDLIBS
    else
	if test "$libdir" != /usr/lib -a "$libdir" != /usr/lib32; then
	    libs="-L$libdir"
	else
	    libs=
	fi
	echo $libs -lcsound $LDLIBS
    fi
}

if test $# -eq 0; then
    usage 1 1>&2
fi

# Parse command line options
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
	    ;;
	--exec-prefix)
	    echo $exec_prefix
	    ;;
	--basename)
	    echo $PACKAGE
	    ;;
	--version)
	    echo $VERSION
	    ;;
	--cflags)
	    cppflags
	    ;;
	--cxxflags)
	    cppflags
	    ;;
	--ldflags)
	    echo $LDFLAGS
	    ;;
	--libs)
	    libs
	    ;;
	--static)
	    static_flag=yes
	    ;;
	--cc)
	    echo $CC
	    ;;
	--cxx)
	    echo $CXX
	    ;;
	--inplace)
	    inplace_flag=yes
	    includedir="$inplace_includedir"
	    libdir="$inplace_libdir/.libs"
	    ;;
	*)
	    usage 1 1>&2
	    ;;
    esac
    shift
done

#
# End of csound-config.in
#
