#!/bin/sh

# OpenVAS
# $Id$
# Description: Configuration script for openvas-libraries
#
# Authors:
# Renaud Deraison <deraison@nessus.org> (Original pre-fork development)
#
# Copyright:
# Based on work Copyright (C) 1998 - 2007 Tenable Network Security, Inc.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Library General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2,
# as published by the Free Software Foundation

# these two are necessary to suffice the replacements
# for libdir and includedir
prefix=/usr
exec_prefix=/usr

LIBDIR=/usr/lib64
INCLUDEDIR=/usr/include
VERSION=3.1.4
EXTRA="-lutil -lnsl -luuid -lpcap -lgnutls -lresolv -lgcrypt "
EGDPATH=""
NASLLIBS="-lgcrypt -lgpgme "
HAVE_WMI="NO"

usage()
{
 echo "Usage : libopenvas-config [ --cflags | --libs | --version | --egd ]"
 exit $1
}


test $# -gt 0 || usage 1


# check whether we have echo -n, depending
# on the current shell, used
case `echo -n` in
\-n)	Xn=   ; Xc='\c' ;;
*)	Xn=-n ; Xc=
esac

while test $# -gt 0; do
 case "$1" in
	--version)
		echo $VERSION
		exit 0
		;;
	--libs)
		if [ $HAVE_WMI = "NO" ]; then
			echo $Xn "-L$LIBDIR -lopenvas_misc -lopenvas_hg -lopenvas_base $EXTRA -lopenvas_nasl -lopenvas_omp $NASLLIBS $Xc"
		else
			echo $Xn "-L$LIBDIR -lopenvas_misc -lopenvas_hg -lopenvas_base -lwmiclient $EXTRA -lopenvas_nasl -lopenvas_omp $NASLLIBS $Xc"
		fi
		;;
	--cflags)
		echo $Xn "$DEFS -I$INCLUDEDIR -I$INCLUDEDIR/openvas $Xc"
		;;
	--egd)
		echo $Xn "$EGDPATH" $Xc
		;;
	--help | -h)
		usage 0
		;;
	*)
		usage 1
		;;
 esac
 shift
done

echo
