
get_platform(){
ARCH=`uname -m`
case $ARCH in
	i?86) ARCH=ix86 ;;
esac

PLATFORM=`uname -s`-$ARCH
echo $PLATFORM
}

get_choices_dir(){
# Get choices path
if [[ $CHOICESPATH == '' ]] ; then
	CHOICES_DIR=$HOME/Choices/$APP_NAME
else
	# Get the first directory in CHOICESPATH
	CHOICESPATH=${CHOICESPATH:-$HOME/Choices:usr/local/share/Choices:/usr/share/Choices}
	CHOICES_DIR=`echo $CHOICESPATH | sed s/:.*//`
fi
}

standard_compile() {
if [ ! -d "$APP_DIR/src" ] ; then
	echo "ERROR from $0:" >&2
	echo "Cannot compile - source code is missing!" >&2
	echo Press Return... >&2
	read WAIT
	exit 1
fi
echo "Compiling $APP_DIR... please wait..." >&2
if [ ! -x "$APP_DIR/src/configure" ]; then
	echo "No 'configure' script! Trying to run autoconf..."
	(cd "$APP_DIR/src"; autoconf)
fi
rm -f "$APP_DIR/src/config.cache"
# Note: this will not work well with programs that need to 
# hard-code certain paths at compile time.
cd "$APP_DIR/src" && $APP_DIR/src/configure --prefix=${APP_DIR} && make clean && make \
				&& make prefix=${APP_DIR} bindir=${BIN_DIR} install \
				&& make clean && echo Done >&2 && exit 0
echo Compile failed >&2
echo Press Return... >&2
read WAIT
exit 1	
}
