:
# Bourne (Korn) shell script for installation of graphics
# software distributed in this directory subsystem.
# This a hell or high-water procedure where we attempt to do as
# much as possible

# The following are tunables for local system:--------------

# Directory for executables:
BIN=/usr/local/bin

# Directory for libraries and fonts
LIB=/usr/local/lib

# Directory for header files
INCL=/usr/local/include

# Select compiler
CC=gcc
#CC=cc

# end tunables ----------------------------------------------

FONTDIR=gfonts

echo "setenv GRAPHB ${BIN}/plotter:${LIB}/${FONTDIR}/:sr:" >csh_env
echo "GRAPHB=${BIN}/plotter:${LIB}/${FONTDIR}/:sr:
export GRAPHB" >sh_env
# troff font descriptor library
font=/usr/lib/font/devGRAPH

# ensure shell to be executed by 'make' will be Bourne
if [ -f /usr/bin/sh5 ]; then # use standard shell, not ...
	SHELL=/usr/bin/sh5
else
	SHELL=/bin/sh
fi

# for some systems that have not yet gotten into the '90s
if [ ! -f /usr/include/limits.h ]; then
	echo "#define LONG_MAX 2147483647" >plotter/limits.h
fi

# set GRAPH to current path
export GRAPH
GRAPH=`pwd`

# set monitor file
echo "graphics installation on" `date`

# install plotter
cd plotter
make BIN=$BIN INCL=$INCL LIB=$LIB CC="$CC" install
if [ $? -eq 0 ];then E="OK";else E="ERROR";fi
echo `pwd` "INSTALL:" $E
cd $GRAPH

# install tests
cd tests
make BIN=$BIN INCL=$INCL LIB=$LIB CC="$CC" install
if [ $? -eq 0 ];then E="OK";else E="ERROR";fi
echo `pwd` "INSTALL:" $E
cd $GRAPH

# Install troff fonts
if [ -d $font ] ; then
	echo "test" >${font}/test
	if [ $? = 0 ] ; then
		rm ${font}/test
# Install troff fonts
		cd fonts/troff
		make BIN=$BIN INCL=$INCL SLIB=$LIB CC="$CC" install
		if [ $? -eq 0 ];then E="OK";else E="ERROR";fi
		echo `pwd` "INSTALL:" $E
		cd $GRAPH
	else
		echo "can't write to troff directory $font" | \
			tee /dev/tty
	fi
else
	echo "troff directory $font doen't exist" | \
		tee /dev/tty
fi

# install plotter fonts
cd fonts
Makefonts ${LIB}/${FONTDIR}
if [ $? -eq 0 ];then E="OK";else E="ERROR";fi
echo `pwd` "INSTALL:" $E
cd $GRAPH

echo "graphics installation complete on" `date` | tee /dev/tty
