#!@SHELL@
#---------------------------------------------------------
#	Check $DISPLAY variable
#---------------------------------------------------------
if [ $DISPLAY ]
then
	echo "Display is $DISPLAY"
else
	echo ""
	echo "DISPLAY environment variable is not defined !"
	echo "Please, enter your DISPLAY name."
	read answer
	if [ $answer ]
	then
#		get the end of string to know if ":0" has been set
		start=`expr $answer : '.*:' \| $answer`
		echo "$start "
		if [ $start = $answer ]
		then
			DISPLAY=$answer:0
		else
			DISPLAY=$answer
		fi
		export DISPLAY
		echo "Starting astor on $DISPLAY"
	else
		echo "DISPLAY is not defined ! Astor cannot start !"
		exit
	fi
fi

#---------------------------------------------------------
#	Add Doc path to $PATH (depends on OS used)
#---------------------------------------------------------
TANGO_HOME=@CMAKE_INSTALL_PREFIX@;		export TANGO_HOME
MY_OS=`uname`
export MY_OS

CPP_DOC=@DOXYGEN@

#---------------------------------------------------------
#	Set the Home Source Path
#---------------------------------------------------------
SRC_PATH=../generated
export SRC_PATH

#---------------------------------------------------------
#	Set the Class Path for Tango and pogo usage
#---------------------------------------------------------
APP_DIR=@CMAKE_INSTALL_PREFIX@/share/java;			export APP_DIR
PREF_DIR=@CMAKE_INSTALL_PREFIX@/share/pogo/preferences;   export PREF_DIR

POGO_CLASS=$APP_DIR/Pogo.jar;		export POGO_CLASS

CLASSPATH=$PREF_DIR:$POGO_CLASS;    export CLASSPATH

LOGBACK=${TANGO_LOGBACK:-@CMAKE_INSTALL_PREFIX@/share/tango/logback.xml}

#---------------------------------------------------------
#	Start the Pogo process
#---------------------------------------------------------
echo "Starting Pogo Appli under $MY_OS.  "
#

@TSD_JAVA_EXEC@ -DCPP_DOC_PATH=$CPP_DOC		\
		-DIN_LANG=$POGO_LANG		\
		-DEDITOR=$POGO_EDITOR 		\
		-Dfile.encoding=UTF-8 	\
		-Dlogback.configurationFile="$LOGBACK" \
		org.tango.pogo.gui.Pogo \
		"$@"
