#!/bin/sh

# Note:  use sed to strip blanks because not all systems have same version
# of diff.

# DON'T set the GCTLIB and PATH - we want to see if GCT is installed.
# if [ "x$GCTLIB" = "x" ]
# then
#  GCTLIB=`pwd`/../../../
#  PATH=.:`pwd`/../../..:$PATH
#  export PATH
# fi

# The curious construction is because it's possible on some systems
# to get the wrong shell in the makefile, and different shells have 
# different ideas about pwd in the presence of symlinks.
ROOT=`echo pwd | sh`

/bin/rm -f config/gct-ctrl includer/includer.c
sed s=ABSOLUTE=$ROOT= < gct-ctrl.src > config/gct-ctrl
sed s=ABSOLUTE=$ROOT= < includer.src > includer/includer.c
(cd config; make clean; make gct ) > /dev/null
cd config
system | sed s=$ROOT=ABSOLUTE= > system.out; diff system.out system.ref
greport MLOG | sed s=$ROOT=ABSOLUTE= > report.out; diff report.out report.ref


exit 0
