#!/bin/sh
INSTALLDIR=`grep INSTALLDIR config.h | awk -F\" '{ print $2 }'`
if test "$INSTALLDIR" = ""; then
INSTALLDIR="/usr/local"
fi
if ! test -d $INSTALLDIR/bin; then
echo "Warning: $INSTALLDIR/bin does not exist"
if ! test -d "$INSTALLDIR"; then
echo "Creating $INSTALLDIR"
mkdir "$INSTALLDIR"
fi
if ! test -d "$INSTALLDIR/lib"; then
echo "Creating $INSTALLDIR/lib"
mkdir "$INSTALLDIR/lib"
fi
if ! test -d "$INSTALLDIR/bin"; then
echo "Creating $INSTALLDIR/bin"
mkdir "$INSTALLDIR/bin"
fi
fi
if ! test -d "$INSTALLDIR/nwcc"; then
if ! mkdir "$INSTALLDIR/nwcc"; then
exit 1
fi
if ! mkdir "$INSTALLDIR/nwcc/bin"; then
exit 1
fi
if ! mkdir "$INSTALLDIR/nwcc/lib"; then
exit 1
fi
fi
if test -f "$INSTALLDIR/bin/nwcc"; then
mv "$INSTALLDIR/bin/nwcc" "$INSTALLDIR/bin/nwcc.old"
mv "$INSTALLDIR/bin/nwcc1" "$INSTALLDIR/bin/nwcc1.old"
rm "$INSTALLDIR/lib/libnwcc.o"
rm -f "$INSTALLDIR/lib/libnwcc64.o"
fi
if ! cp nwcc nwcc1 "$INSTALLDIR/nwcc/bin" \
|| ! ln -s "$INSTALLDIR/nwcc/bin/nwcc" "$INSTALLDIR/bin/nwcc" \
|| ! ln -s "$INSTALLDIR/nwcc/bin/nwcc1" "$INSTALLDIR/bin/nwcc1"; then
echo "Cannot install nwcc"
exit 1
fi
cp snake "$INSTALLDIR/nwcc/bin"
cp extlibnwcc.o "$INSTALLDIR/nwcc/lib/libnwcc.o"
if test -f extlibnwcc64.o; then
cp extlibnwcc64.o "$INSTALLDIR/nwcc/lib/libnwcc64.o"
fi
sys=`uname -s`
if test "$sys" = "IRIX" || test "$sys" = "IRIX64" ; then
ln -s "$INSTALLDIR/nwcc/lib/libnwcc.o" /usr/lib32/
else
ln -s "$INSTALLDIR/nwcc/lib/libnwcc.o" "$INSTALLDIR/lib/"
if test -f extlibnwcc64.o; then
ln -s "$INSTALLDIR/nwcc/lib/libnwcc64.o" "$INSTALLDIR/lib/"
fi
fi
echo
echo "nwcc has been installed to $INSTALLDIR/nwcc/ and $INSTALLDIR/bin/"
echo "(Do not forget to type \`rehash' if you're using csh.)"
syntax highlighted by Code2HTML, v. 0.9.1