#! /bin/sh

#####################################################
# 
# Configuration script for MahJongg Solitaire 3D
# by Reto Schoelly (reto.schoelly@web.de)
# 
# Project homepage: www.reto-schoelly.de/mahjongg3d
# 
#####################################################

clear

if  test -z $QTDIR ; then
echo "Please enter the path to your QT installation"
echo "(for example /usr/lib/qt)"
echo
echo "Also, make sure you installed the QT development package (f.e. qt-dev)"
echo
echo "Refer to your distribution's docs to find out where it is"
read -p "Path to QT:" QTDIR
fi

echo "Where do you want mahjongg3d to be installed?"
echo "----------------------------------------------"
echo
echo "Please enter the destination path (for example /usr), or"
read -p "just press enter to select your home directory [$HOME]: " TEMP

if test -z $TEMP ; then
CUSTOM_PREFIX=~
else
CUSTOM_PREFIX=$TEMP
fi

if [ -w $CUSTOM_PREFIX ] ; then
echo "Installing to " $CUSTOM_PREFIX
#else
#echo
#echo "You do not have write permission to" $CUSTOM_PREFIX " or used the home directory tilde ~"
#echo
#echo "To install the game to" $CUSTOM_PREFIX ", enter root mode with \"su\" and try again."
#echo
#exit 1
fi

echo
echo
echo
echo "Where do you want your game data to be installed?"
echo "--------------------------------------------------"
echo
echo "Please enter the destination path, or"
read -p "just press enter to select installation directory [$CUSTOM_PREFIX]: " TEMP

if test -z $TEMP ; then
CUSTOM_GAMEDATA_PREFIX=$CUSTOM_PREFIX
else
CUSTOM_GAMEDATA_PREFIX=$TEMP
fi

echo "all:" > Makefile
echo "	make -f Makefile.doit PREFIX=$CUSTOM_PREFIX GAMEDATA_PREFIX=$CUSTOM_GAMEDATA_PREFIX" >> Makefile
echo "" >> Makefile
echo "install:" >> Makefile
echo "	make -f Makefile.doit PREFIX=$CUSTOM_PREFIX GAMEDATA_PREFIX=$CUSTOM_GAMEDATA_PREFIX install" >> echo "" >> Makefile
echo "clean:" >> Makefile
echo "	make -f Makefile.doit PREFIX=$CUSTOM_PREFIX GAMEDATA_PREFIX=$CUSTOM_GAMEDATA_PREFIX distclean" >> Makefile

echo
echo
echo
echo "You can now compile the game by typing \"make\""
echo
echo "To install the game, type \"make install\""
echo "When installing the game into a directory other than your home directories,"
echo "please make sure you are root"
echo
echo "HAVE A LOT OF FUN!"
