#!/bin/sh
# This shell script installs m4 Mathomatic with trig functions that use degree units.
# If this is a source distribution, you should change directory to its root,
# and compile Mathomatic and "sudo make m4install-degrees" to install everything.
# If this is a binary distribution, you should type "sudo ./matho-install-degrees"
# from this directory to install the program files only.

BINDIR=${1-/usr/local/bin}
MATHOMATIC=mathomatic
if [ ! -x "$MATHOMATIC" ]
then
	MATHOMATIC="../$MATHOMATIC"
fi
if [ ! -x "$MATHOMATIC" ]
then
	echo mathomatic executable not found.
	exit
fi

echo Installing "$MATHOMATIC" to "$BINDIR"
cp "$MATHOMATIC" functions.m4 matho rmath "$BINDIR" &&
cat degrees.m4 >>"$BINDIR"/functions.m4 && echo Done! && exit
echo
echo Usage: sudo $0 [ install_directory ]
