#! /bin/sh
# Generated manually by D.Colnet 
echo "Checking the 'SmartEiffel' environment variable..."
sed=${SmartEiffel:=1}
if [ ${sed} = 1 ];  then 
   echo Please set the environment Variable \'SmartEiffel\' with
   echo the absolute path of file SmartEiffel/sys/system.se
   exit 1
fi
if [ -d ${SmartEiffel} ]; then 
   echo The value of the environment variable SmartEiffel 
   echo must be the absolute path of file 
   echo SmartEiffel/sys/system.se
   exit 1
fi
SE=`dirname $SmartEiffel`
SE=`dirname $SE`
if [ -f ${SE} ]; then
   echo "'${SE}' not found."
   exit 1
fi
echo "Trying to go into the '${SE}' directory..."
cd ${SE}
if [ ! -e "install.e" ]; then
   echo "(File '${SE}/install.e' not found.)"
   echo "Unable to move to the '${SE}' directory."
   exit 1
fi
if [ ! -e "sys/system.se" ]; then
   echo "Unix" > sys/system.se
   exit 1
fi
if [ ! -f ${SmartEiffel} ]; then
   echo File ${SmartEiffel} not found.
   echo Please check the value of the environment Variable
   echo \'SmartEiffel\' wich must be the absolute path of 
   echo the file SmartEiffel/sys/system.se
   exit 1
fi
echo "Variable 'SmartEiffel' is correctly set."
echo "Installation directory is '${SE}'."
echo "Checking the 'PATH' variable..."
if [ ! -e "bin/compile" ]; then
   echo "echo compile" > bin/compile
   chmod a+x bin/compile
   dummycompile=1
fi
compilepath=`which compile`
if [ ! -x ${compilepath} ]; then
   echo "Add '${SE}/bin' to your 'PATH' variable before installation."
   exit 1
fi
echo "The 'PATH' variable is correctly set."
if [ ${dummycompile} ]; then
   /bin/rm -rf bin/compile
fi
echo "Everything is ok."
echo "For an automatic installation of SmartEiffel, just type:   make"
echo "(The compiler will bootstrap all tools and the installation may thus"
echo "take some times. If you need to debug the installation or to select"
echo "manually some settings, launch 'make interactive' instead of the"
echo "ordinary 'make' command. If you are not an expert of C compiler"
echo "options, just type 'make'.)"
echo "Also note that you can always rerun all this installation procedure."
echo "Now type 'make' to install all SmartEiffel tools."
