#!/usr/bin/sh

prefix=/usr

PKGLIBDIR=/usr/lib64/c_icap/
LIBDIR=/usr/lib64/
CONFIGDIR=/etc/c-icap/
DATADIR=/usr/share/c_icap/
#LOGDIR=
SOCKDIR=/var/run/c-icap

INCDIR=/usr/include
INCDIR2=/usr/include/c_icap

VERSION=0.6.3
CICAPCFLAGS="-D_REENTRANT -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer   -Wall -D_FILE_OFFSET_BITS=64"
CICAPLDFLAGS=
CICAPLIBS=
CFLAGS="-fvisibility=hidden -DCI_BUILD_MODULE -D_REENTRANT -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer   -Wall -D_FILE_OFFSET_BITS=64"
LIBS=""
LDFLAGS=""


usage()
{
   cat <<EOTXT
Usage: c-icap-config [OPTIONS]

Where OPTION one of the following:
   --prefix             print c-icap instalation base directory
   --cflags		print preprocessor and compiler flags
   --libs		print linker flags
   --datarootdir	print the c-icap data directory
   --configdir		print the c-icap configuration directory
   --modulesdir		print the c-icap modules/plugins directory
   --version		print the c-icap server version
   --config		print the c-icap server compile configuration
EOTXT
}


case $1 in
    '--prefix')
        echo $prefix;
        ;;
    '--cflags')
        echo $CFLAGS" -I"$INCDIR" -I"$INCDIR2;
        ;;
    '--libs')
       test -n "$LIBS" && echo "-L"$LIBDIR $LIBS  || echo ""
       ;;
    '--datarootdir')
       echo $DATADIR;
       ;;
    '--configdir')
       echo $CONFIGDIR;
       ;;
    '--modulesdir')
       echo $PKGLIBDIR;
       ;;
    '--version')
       echo $VERSION;
       ;;
    '--config')
        echo "c-icap configuration";
	echo "c-icap version: "$VERSION;
        echo "c-icap installation prefix: "$prefix
	echo "c-icap configuration directory: "$CONFIGDIR;
	echo "c-icap modules/plugins directory: "$PKGLIBDIR;
	echo "c-icap shared data directory: "$DATADIR;
	echo ;
        echo "c-icap cflags for modules: "$CFLAGS;
        echo "c-icap libs for modules: "$LIBS;
       ;;
    *)
        usage
esac;
