#!/bin/sh

echo "starting DQS 3.1.8 installation"
echo " The first step is to identify the system "
echo " which will be used for this installation"
echo " "
echo  " "
cd SRC
rm -f config.cache
echo    "if a GNU cc compiler is present it will be used "
echo -n "by default. Do you wish to use gcc?    (Y or n) "
read ans

if test -z "$ans"
then
ans="Y"
fi


if [ $ans = Y ]
then
   ./configure
elif [ $ans = y ]
then
   ./configure
elif [ $ans = N ]
then
   CC=cc ./configure
elif [ $ans = n ]
then
   CC=cc ./configure
else
   echo "please answer y/n"
   exit -1
fi

if [ $? -ne 0 ]
then
echo "GNU configuration failed, exiting INSTALL"
exit 1
fi

echo " "
cd ../CONFIG
make clean
make

if [ $? -ne 0 ]
then
echo "The attempt to make DQS config failed, exiting INSTALL"
exit 1
fi

echo "****************0"

echo " "
./config

echo ">$?<"

if [ $? -ne 0 ]
then
echo "DQS config failed, exiting"
exit 1
fi

echo "****************1"


cd ..
echo " "
make dirs
echo ">$?<"
if [ $? -gt 1 ]
then
echo "Make Directories failed, exiting"
exit 1
fi

echo "****************2"


make
if [ $? -ne 0 ]
then
echo "Make operation for DQS source failed, exiting"
exit 1
fi

echo "****************3"

echo " "
echo "we're done with basic installation "
echo " "
make installbin

if [ $? -ne 0 ]
then
echo "Installation of binaries failed, exiting"
exit 1
fi

echo "****************4"

make installconf

if [ $? -ne 0 ]
then
echo "Installation of configuration files failed, exiting"
exit 1
fi
echo " "
echo " INSTALL complete"
echo " To complete installation make the designated changes "
echo "    in the /etc/services  directory  "
echo "    see CONFIG/addservice.sh"







