#!/bin/csh -f
setenv XMSUPPORT
if ($1 != "") then
  setenv PATH ${1}/bin:${PATH}
	echo $PATH
  setenv XMSUPPORT "AFSP=$1 XML=$1"
endif

echo set XMSUPPORT var

setenv MKINSDIR
if ($2 != "") then
  setenv INSTALL "install INSTALLDIR=$2"
  setenv MKINSDIR "mkdir -p $2/include/xm $2/lib $2/bin"
endif

echo start install
$MKINSDIR
test -d newsrc || tar xjvf XM.tbz
cd newsrc
cvs login
cvs update

# do this for the XMGUI
echo make INSTALLDIR=$2 DEBUG=n USEXML=n DISABLEAUDIO=y DISABLEMDS=y installlib
make INSTALLDIR=$2 DEBUG=n USEXML=n DISABLEAUDIO=y DISABLEMDS=y installlib
make sleepclean

# do this for the normal XM installation
echo make $INSTALL $XMSUPPORT
make $INSTALL $XMSUPPORT

