:
# SCCSID @(#)install	1.2 93/08/26 GIE REL
#
# Installation script all PROJ.4 system reference files.
#
# This script must be executed after compilation of proj library.
#
# Execute as:
#
#	install <library_path>/<lib_name>
#
# where <library_path> is the same as that defined by LIB in the
# the file ../src/Makefile or on its execution line.  Typical
# name is /usr/local/lib.  <lib_name> is the directory name
# defined by LIB_NAME in ../src/Makefile---typically proj.
#
# ------------------------------------------------------------
# Check if argument
if [ $# -ne 1 ] ; then
	echo "no path argument given"
	exit 1
fi
lib=${1}
# Check if directory exists, else try to create
if [ ! -d ${lib} ] ; then
	mkdir $lib
	if [ $? -ne 0 ] ; then
		echo "cannot create directory $lib"
		exit 1
	fi
fi
# Copy in init files
for x in proj_def.dat nad27 nad83 world GL27
do
	cp $x ${lib}/$x
	if [ $? -ne 0 ] ; then
		echo "init copy failed for file $x"
	else
		echo "$x installed"
	fi
done
lib=${lib}/nad2783
# Check if nad2nad directory exists, else try to create
if [ ! -d ${lib} ] ; then
	mkdir ${lib}
	if [ $? -ne 0 ] ; then
		echo "cannot create directory $lib"
		exit 1
	fi
fi
# Process ascii grid into nad2nad compatible files.
for x in *.lla.Z ; do
	dest=`expr $x : '\(.*\)\.lla\.Z'`
	uncompress < $x | ../src/nad2bin ${lib}/${dest}
	if [ $? -ne 0 ] ; then
		echo "nad2nad install failed on file ${lib}/${dest}"
		exit 1
	fi
	echo "${lib}/${dest} installed"
done
echo "normal completion"
exit 0
