#!/bin/bash
APPDIR=`dirname $0`
APPDIR=`cd $APPDIR;pwd`
export APPDIR

case $1 in
"--compile")
	echo Running $APPDIR/configure --prefix=$APPDIR --enable-appdir
	cd $APPDIR
	./configure --prefix=$APPDIR --enable-appdir
	echo Compiling and installing.
	make install
	;;
*)
	if [ -x $APPDIR/bin/xtheater ]; then
		 $APPDIR/bin/xtheater "$@"
	else
		echo "Binary not found, compiling..."
		xterm -e $APPDIR/AppRun --compile
	fi
;;
esac
