#!/bin/bash

echo "\n\
This installation is not bulletproof.  We've tested it on several\
different Unix environments, and modified the code and makefiles to\
minimize problems, but it may still fail to compile in environments\
where we did not test it.\
\
Note that it is normal to get warnings during compilations and while\
using the code.  These warnings do not mean the software is broken.\
They result from using unmodified code from the 80's and early 90's\
under modern Unix environments.\
\
If you get errors and it fails to compile, please do your best to\
debug and fix simple problems yourself.  If you can't get it working,\
contact the TAs by email or during their office hours.  Also, feel free
to ask friends for help installing the software.\
\
Hit <RETURN> to continue.\
"
read -e wait

echo 
echo "making unixstat utilities"
echo ""
cd unixstat/src
make clean
make
if [ $? -ne 0 ]; then
    echo "****ERROR****: Some or all of the unixstat utilities could not be \
compiled. (But maybe the ones you need worked)"
    echo "Hit <RETURN> to continue."
    read -e wait
fi
cd ../..
cp -fp ./unixstat/bin/* ./bin
echo "\
The unixstat executables are in cs578.hw1/bin"
echo "Hit <RETURN> to continue.\
"
read -e wait

echo "making IND decision tree package"
echo ""
cd ind/IND
make clean
make install
if [ $? -ne 0 ]; then
    echo "****ERROR****: Some or all of the IND decision tree package could \
not be compiled. (But maybe the part you need worked)"
    echo "Hit <RETURN> to continue."
    read -e wait
fi
cd ../..
chmod u+x ./bin/*
echo "\
The IND executables also are in cs578.hw1/bin"
echo "Hit <RETURN> to continue.\
"
read -e wait

cat ./README.setenv
