#!/bin/sh

#
#   A script for retrieving the latest KVIrc IRC Client build configuration
#   Mainly used for building plugins out of the source tree
#   The idea is "stolen" from the gtk-config and xmms-config scripts :)
#
#   09-04-2000 Szymon Stefanek (Initial release)
#   31-01-2002 Szymon Stefanek (Revised for KVIrc 3.0.0)
#
#   This program is FREE software. You can redistribute it and/or
#   modify it under the terms of the GNU General Public License
#   as published by the Free Software Foundation; either version 2
#   of the License, or (at your opinion) any later version.
#
#   This program 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 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. ,59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#

set -e

prefix="/usr/X11R6"
exec_prefix="/usr/X11R6"
pluglibdir="${exec_prefix}/share/kvirc/3.0.0-beta1/modules"
bindir="/usr/X11R6/bin"
libdir="/usr/X11R6/lib"
helpdir="${exec_prefix}/share/kvirc/3.0.0-beta1/help/en"
includedir="/usr/X11R6/include"

SS_CPPFLAGS =  -D_REENTRANT -DREENTRANT
SS_INCDIRS = -I/usr/X11R6/include/qt -I/usr/X11R6/include
SS_LDFLAGS = 
SS_LIBDIRS = -L/home/users/builder/rpm/BUILD/kvirc-3.0.0-beta1/src/kvilib/build/ -L/usr/X11R6/lib -L/usr/X11R6/lib
SS_LIBLINK = -lqt-mt -lXext -lX11 -lpthread -lssl -lcrypto -lesd -laudiofile -lm -ldl
SS_MSGFMT = /usr/bin/msgfmt
SS_QT_MOC = /usr/X11R6/bin/moc
SS_RPATH = -rpath /usr/X11R6/lib -rpath /usr/X11R6/lib -rpath /usr/X11R6/lib
SS_TOPSRCDIR = /home/users/builder/rpm/BUILD/kvirc-3.0.0-beta1

SS_QT_INCLUDE_DIR="@SS_QT_INCLUDE_DIR@"
SS_QT_LIBRARY_DIR="@SS_QT_LIBRARY_DIR@"
SS_X_INCLUDE_DIR="@SS_X_INCLUDE_DIR@"
SS_X_LIBRARY_DIR="@SS_X_LIBRARY_DIR@"
SS_QT_MOC="/usr/X11R6/bin/moc"

SS_FLAGS_RPATH="@SS_FLAGS_RPATH@"
SS_FLAGS_INCDIRS="@SS_FLAGS_INCDIRS@"
SS_FLAGS_LIBDIRS="@SS_FLAGS_LIBDIRS@"
SS_FLAGS_LIBLINK="@SS_FLAGS_LIBLINK@"

print_syntax()
{
	echo "kvirc-config (KVIrc 3.0.0-beta1)"
	echo "	A script for retrieving the latest KVIrc build configuration"
	echo ""
	echo "Syntax : kvirc-config [OPTIONS]"
	echo "  options:"
	echo "    --prefix          : Intallation prefix"
	echo "    --include_dir     : KVIrc include directory"
	echo "    --exec_prefix     : Binaries installation prefix"
	echo "    --rpath_flags     : Rpath flags used in the KVIrc compilation"
	echo "    --cpp_flags       : CPP flags used in the KVIrc compilation"
	echo "    --ld_flags        : Linker flags used in the KVirc compilation"
	echo "    --libadd_flags    : External libraries that KVIrc has been linked to"
	echo "    --qt_library_dir  : Qt library dir that KVIrc has been linked to"
	echo "    --qt_include_dir  : Qt headers dir used in the KVIrc compilation"
	echo "    --qt_moc_path     : Qt meta object compiler path"
	echo "    --x_library_dir   : X libraries dir that KVIrc has been linked to"
	echo "    --x_include_dir   : X headers dir used in the KVIrc compilation"
	echo "    --plugin_dir      : KVIrc plugin dir"
	echo "    --bin_dir         : KVIrc binaries installation directory"
	echo "    --lib_dir         : KVIrc libraries installation directory"
	echo "    --help_dir        : KVIrc help files installation directory"
    exit 0
}

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

SS_STUFF_TO_ECHO=""

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

    case $1 in
	--prefix)
	    SS_STUFF_TO_ECHO="$SS_STUFF_TO_ECHO $prefix"
	    ;;
	--exec_prefix)
	    SS_STUFF_TO_ECHO="$SS_STUFF_TO_ECHO $exec_prefix"
	    ;;
	--include_dir)
		SS_STUFF_TO_ECHO="$SS_STUFF_TO_ECHO $includedir"
		;;
	--rpath_flags)
		SS_STUFF_TO_ECHO="$SS_STUFF_TO_ECHO $SS_FLAGS_RPATH"
		;;
	--qt_library_dir)
		SS_STUFF_TO_ECHO="$SS_STUFF_TO_ECHO $SS_QT_LIBRARY_DIR"
		;;
	--qt_include_dir)
		SS_STUFF_TO_ECHO="$SS_STUFF_TO_ECHO $SS_QT_INCLUDE_DIR"
		;;
	--x_library_dir)
		SS_STUFF_TO_ECHO="$SS_STUFF_TO_ECHO $SS_X_LIBRARY_DIR"
		;;
	--x_include_dir)
		SS_STUFF_TO_ECHO="$SS_STUFF_TO_ECHO $SS_X_INCLUDE_DIR"
		;;
	--qt_moc_path)
		SS_STUFF_TO_ECHO="$SS_STUFF_TO_ECHO $SS_QT_MOC"
		;;
	--cpp_flags)
		SS_STUFF_TO_ECHO="$SS_STUFF_TO_ECHO $SS_FLAGS_INCDIRS"
		;;
	--ld_flags)
		SS_STUFF_TO_ECHO="$SS_STUFF_TO_ECHO $SS_FLAGS_LIBDIRS"
		;;
	--libadd_flags)
		SS_STUFF_TO_ECHO="$SS_STUFF_TO_ECHO $SS_FLAGS_LIBLINK"
		;;
	--plugin_dir)
		SS_STUFF_TO_ECHO="$SS_STUFF_TO_ECHO $pluglibdir"
		;;
	--bin_dir)
		SS_STUFF_TO_ECHO="$SS_STUFF_TO_ECHO $bindir"
		;;
	--lib_dir)
		SS_STUFF_TO_ECHO="$SS_STUFF_TO_ECHO $libdir"
		;;
	--help_dir)
		SS_STUFF_TO_ECHO="$SS_STUFF_TO_ECHO $helpdir"
		;;
	*)
	    print_syntax 1 1>&2
	    ;;
    esac
  shift
done

if test -n "$SS_STUFF_TO_ECHO"; then
	echo $SS_STUFF_TO_ECHO
fi
