:
# @(#)install	4.8 93/11/10 GIE REL"
if [ $# -lt 5 ] ; then
	echo "usage: $0 system bin lib include lib_name"
	echo "where: system is known system key"
	echo "       bin is directory for executables"
	echo "       lib is directory for libraries""
	echo "       lib_name is directory name under lib for reference files"
	echo "       inc is directory for includes""
	echo "typical usage:"
	echo "install dell /usr/local/bin /usr/local/lib proj /usr/local/include"
fi
bin=$2
lib=$3
libname=$4
inc=$5
for x in $bin $lib $inc
do
	if [ ! -d $x -o ! -w $x ] ; then
		echo "$x either not writable or not directory"
		exit 1
	fi
done
cd src
case $1 in
sun4.1)
	make install LIB=$lib LIB_NAME=$libname CC=gcc \
		COMP='-O -DFILENAME_MAX=1024 -DNO_STRERRNO'
	;;
dec)
	make install CC=gcc LIB=$lib LIB_NAME=$libname STRTOD='$L(strtod.o)'
	;;
DG)
	make install LIB=$lib LIB_NAME=$libname  COMP='-O -ansi'
	;;
plain )
	make install LIB=$lib LIB_NAME=$libname 
	;;
*)
	echo "machine $1 not known"
	exit 1
	;;
esac
if [ $? -ne 0 ] ; then
	echo "make failed"
	exit 1
fi
if [ ! -d ${lib}/proj ] ; then
	mkdir ${lib}/proj
	if [ $? -ne 0 ] ; then
		echo "failed to make directory ${lib}/proj"
		exit 1
	fi
fi
cp proj $bin/proj
ln ${bin}/proj ${bin}/invproj
cp geod $bin
cp nad2nad $bin
cp libproj.a $lib
cp projects.h $inc
cd ../nad
./install $lib/$libname
echo "Installation of proj system complete"
exit 0
