#! /bin/sh
#
#   Build script for iMatix SMT Package, for generic UNIX.
#   Requires the 'c' shell script.
#
#   Generated by Otto v2.11 from buildsmt.txt on 98/02/01, 12:43:07
#   For more info see Otto documentation at http://www.imatix.com.
#   Bug reports & questions to <ph@imatix.com>
#   ---------------------------------------------------------------
#
test -f c && chmod +x c
echo Building SMT kernel version 2.30
echo You must already have built the SFL package and installed the
echo SFL library.  If not, Ctrl-C now and get your hands on the SFL.
read pause
echo Checking for required files...

#-  require $LIB libsfl
if test ! -f libsfl.a; then
    echo libsfl.a missing - aborting
    exit
fi

#-  require smtlog.c  smtlog.l  smtlog.d  smtlog.i
if test ! -f smtlog.c; then
    echo smtlog.c missing - aborting
    exit
fi
if test ! -f smtlog.l; then
    echo smtlog.l missing - aborting
    exit
fi
if test ! -f smtlog.d; then
    echo smtlog.d missing - aborting
    exit
fi
if test ! -f smtlog.i; then
    echo smtlog.i missing - aborting
    exit
fi

#-  require smtecho.c smtecho.l smtecho.d smtecho.i
if test ! -f smtecho.c; then
    echo smtecho.c missing - aborting
    exit
fi
if test ! -f smtecho.l; then
    echo smtecho.l missing - aborting
    exit
fi
if test ! -f smtecho.d; then
    echo smtecho.d missing - aborting
    exit
fi
if test ! -f smtecho.i; then
    echo smtecho.i missing - aborting
    exit
fi

#-  require smthttp.c smthttp.l smthttp.d smthttp.i
if test ! -f smthttp.c; then
    echo smthttp.c missing - aborting
    exit
fi
if test ! -f smthttp.l; then
    echo smthttp.l missing - aborting
    exit
fi
if test ! -f smthttp.d; then
    echo smthttp.d missing - aborting
    exit
fi
if test ! -f smthttp.i; then
    echo smthttp.i missing - aborting
    exit
fi

#-  require smtoper.c smtoper.l smtoper.d smtoper.i
if test ! -f smtoper.c; then
    echo smtoper.c missing - aborting
    exit
fi
if test ! -f smtoper.l; then
    echo smtoper.l missing - aborting
    exit
fi
if test ! -f smtoper.d; then
    echo smtoper.d missing - aborting
    exit
fi
if test ! -f smtoper.i; then
    echo smtoper.i missing - aborting
    exit
fi

#-  require smtsock.c smtsock.l smtsock.d smtsock.i
if test ! -f smtsock.c; then
    echo smtsock.c missing - aborting
    exit
fi
if test ! -f smtsock.l; then
    echo smtsock.l missing - aborting
    exit
fi
if test ! -f smtsock.d; then
    echo smtsock.d missing - aborting
    exit
fi
if test ! -f smtsock.i; then
    echo smtsock.i missing - aborting
    exit
fi

#-  require smtslot.c smtslot.l smtslot.d smtslot.i
if test ! -f smtslot.c; then
    echo smtslot.c missing - aborting
    exit
fi
if test ! -f smtslot.l; then
    echo smtslot.l missing - aborting
    exit
fi
if test ! -f smtslot.d; then
    echo smtslot.d missing - aborting
    exit
fi
if test ! -f smtslot.i; then
    echo smtslot.i missing - aborting
    exit
fi

#-  require smtsimu.c smtsimu.l smtsimu.d smtsimu.i
if test ! -f smtsimu.c; then
    echo smtsimu.c missing - aborting
    exit
fi
if test ! -f smtsimu.l; then
    echo smtsimu.l missing - aborting
    exit
fi
if test ! -f smtsimu.d; then
    echo smtsimu.d missing - aborting
    exit
fi
if test ! -f smtsimu.i; then
    echo smtsimu.i missing - aborting
    exit
fi

#-  require smttime.c smttime.l smttime.d smttime.i
if test ! -f smttime.c; then
    echo smttime.c missing - aborting
    exit
fi
if test ! -f smttime.l; then
    echo smttime.l missing - aborting
    exit
fi
if test ! -f smttime.d; then
    echo smttime.d missing - aborting
    exit
fi
if test ! -f smttime.i; then
    echo smttime.i missing - aborting
    exit
fi

#-  require smttran.c smttran.l smttran.d smttran.i
if test ! -f smttran.c; then
    echo smttran.c missing - aborting
    exit
fi
if test ! -f smttran.l; then
    echo smttran.l missing - aborting
    exit
fi
if test ! -f smttran.d; then
    echo smttran.d missing - aborting
    exit
fi
if test ! -f smttran.i; then
    echo smttran.i missing - aborting
    exit
fi

#-  require smtupmc.c smtupmc.l smtupmc.d smtupmc.i
if test ! -f smtupmc.c; then
    echo smtupmc.c missing - aborting
    exit
fi
if test ! -f smtupmc.l; then
    echo smtupmc.l missing - aborting
    exit
fi
if test ! -f smtupmc.d; then
    echo smtupmc.d missing - aborting
    exit
fi
if test ! -f smtupmc.i; then
    echo smtupmc.i missing - aborting
    exit
fi

#-  require smtupmd.c smtupmd.l smtupmd.d smtupmd.i
if test ! -f smtupmd.c; then
    echo smtupmd.c missing - aborting
    exit
fi
if test ! -f smtupmd.l; then
    echo smtupmd.l missing - aborting
    exit
fi
if test ! -f smtupmd.d; then
    echo smtupmd.d missing - aborting
    exit
fi
if test ! -f smtupmd.i; then
    echo smtupmd.i missing - aborting
    exit
fi

#-  require smttst1.c smttst1.l smttst1.d smttst1.i
if test ! -f smttst1.c; then
    echo smttst1.c missing - aborting
    exit
fi
if test ! -f smttst1.l; then
    echo smttst1.l missing - aborting
    exit
fi
if test ! -f smttst1.d; then
    echo smttst1.d missing - aborting
    exit
fi
if test ! -f smttst1.i; then
    echo smttst1.i missing - aborting
    exit
fi

#-  require smttst2.c smttst2.l smttst2.d smttst2.i
if test ! -f smttst2.c; then
    echo smttst2.c missing - aborting
    exit
fi
if test ! -f smttst2.l; then
    echo smttst2.l missing - aborting
    exit
fi
if test ! -f smttst2.d; then
    echo smttst2.d missing - aborting
    exit
fi
if test ! -f smttst2.i; then
    echo smttst2.i missing - aborting
    exit
fi

#-  require smttst3.c smttst3.l smttst3.d smttst3.i
if test ! -f smttst3.c; then
    echo smttst3.c missing - aborting
    exit
fi
if test ! -f smttst3.l; then
    echo smttst3.l missing - aborting
    exit
fi
if test ! -f smttst3.d; then
    echo smttst3.d missing - aborting
    exit
fi
if test ! -f smttst3.i; then
    echo smttst3.i missing - aborting
    exit
fi

#-  require smtftpc.c smtftpc.l smtftpc.d smtftpc.i
if test ! -f smtftpc.c; then
    echo smtftpc.c missing - aborting
    exit
fi
if test ! -f smtftpc.l; then
    echo smtftpc.l missing - aborting
    exit
fi
if test ! -f smtftpc.d; then
    echo smtftpc.d missing - aborting
    exit
fi
if test ! -f smtftpc.i; then
    echo smtftpc.i missing - aborting
    exit
fi

#-  require smtftpd.c smtftpd.l smtftpd.d smtftpd.i
if test ! -f smtftpd.c; then
    echo smtftpd.c missing - aborting
    exit
fi
if test ! -f smtftpd.l; then
    echo smtftpd.l missing - aborting
    exit
fi
if test ! -f smtftpd.d; then
    echo smtftpd.d missing - aborting
    exit
fi
if test ! -f smtftpd.i; then
    echo smtftpd.i missing - aborting
    exit
fi

#-  require smtrdns.c smtrdns.l smtrdns.d smtrdns.i
if test ! -f smtrdns.c; then
    echo smtrdns.c missing - aborting
    exit
fi
if test ! -f smtrdns.l; then
    echo smtrdns.l missing - aborting
    exit
fi
if test ! -f smtrdns.d; then
    echo smtrdns.d missing - aborting
    exit
fi
if test ! -f smtrdns.i; then
    echo smtrdns.i missing - aborting
    exit
fi

#-  require smthlog.c smthlog.l smthlog.d smthlog.i
if test ! -f smthlog.c; then
    echo smthlog.c missing - aborting
    exit
fi
if test ! -f smthlog.l; then
    echo smthlog.l missing - aborting
    exit
fi
if test ! -f smthlog.d; then
    echo smthlog.d missing - aborting
    exit
fi
if test ! -f smthlog.i; then
    echo smthlog.i missing - aborting
    exit
fi

#-  require smthttpl.c smthttpl.h
if test ! -f smthttpl.c; then
    echo smthttpl.c missing - aborting
    exit
fi
if test ! -f smthttpl.h; then
    echo smthttpl.h missing - aborting
    exit
fi

#-  require smtrdnsl.c smtrdnsl.h
if test ! -f smtrdnsl.c; then
    echo smtrdnsl.c missing - aborting
    exit
fi
if test ! -f smtrdnsl.h; then
    echo smtrdnsl.h missing - aborting
    exit
fi

#-  require smtmsg.c  smtmsg.h
if test ! -f smtmsg.c; then
    echo smtmsg.c missing - aborting
    exit
fi
if test ! -f smtmsg.h; then
    echo smtmsg.h missing - aborting
    exit
fi

#-  require smtlib.c  smtlib.h
if test ! -f smtlib.c; then
    echo smtlib.c missing - aborting
    exit
fi
if test ! -f smtlib.h; then
    echo smtlib.h missing - aborting
    exit
fi

#-  require smtftpl.c smtftpl.h
if test ! -f smtftpl.c; then
    echo smtftpl.c missing - aborting
    exit
fi
if test ! -f smtftpl.h; then
    echo smtftpl.h missing - aborting
    exit
fi

#-  require xitami.c  xiadm00.c formio.h
if test ! -f xitami.c; then
    echo xitami.c missing - aborting
    exit
fi
if test ! -f xiadm00.c; then
    echo xiadm00.c missing - aborting
    exit
fi
if test ! -f formio.h; then
    echo formio.h missing - aborting
    exit
fi

#-  require xiadm01.h xiadm02.h xiadm03.h xiadm04.h xiadm05.h
if test ! -f xiadm01.h; then
    echo xiadm01.h missing - aborting
    exit
fi
if test ! -f xiadm02.h; then
    echo xiadm02.h missing - aborting
    exit
fi
if test ! -f xiadm03.h; then
    echo xiadm03.h missing - aborting
    exit
fi
if test ! -f xiadm04.h; then
    echo xiadm04.h missing - aborting
    exit
fi
if test ! -f xiadm05.h; then
    echo xiadm05.h missing - aborting
    exit
fi

#-  require xiadm06.h xiadm07.h xiadm08.h xiadm09.h xiadm10.h
if test ! -f xiadm06.h; then
    echo xiadm06.h missing - aborting
    exit
fi
if test ! -f xiadm07.h; then
    echo xiadm07.h missing - aborting
    exit
fi
if test ! -f xiadm08.h; then
    echo xiadm08.h missing - aborting
    exit
fi
if test ! -f xiadm09.h; then
    echo xiadm09.h missing - aborting
    exit
fi
if test ! -f xiadm10.h; then
    echo xiadm10.h missing - aborting
    exit
fi

#-  require xiadm11.h xiadm12.h xiadm13.h xiadm14.h xiadm15.h
if test ! -f xiadm11.h; then
    echo xiadm11.h missing - aborting
    exit
fi
if test ! -f xiadm12.h; then
    echo xiadm12.h missing - aborting
    exit
fi
if test ! -f xiadm13.h; then
    echo xiadm13.h missing - aborting
    exit
fi
if test ! -f xiadm14.h; then
    echo xiadm14.h missing - aborting
    exit
fi
if test ! -f xiadm15.h; then
    echo xiadm15.h missing - aborting
    exit
fi

#-  require xiadm16.h xiadm17.h xiadm18.h xiadm18.h xiadm19.h
if test ! -f xiadm16.h; then
    echo xiadm16.h missing - aborting
    exit
fi
if test ! -f xiadm17.h; then
    echo xiadm17.h missing - aborting
    exit
fi
if test ! -f xiadm18.h; then
    echo xiadm18.h missing - aborting
    exit
fi
if test ! -f xiadm18.h; then
    echo xiadm18.h missing - aborting
    exit
fi
if test ! -f xiadm19.h; then
    echo xiadm19.h missing - aborting
    exit
fi

#-  require xiadm20.h xiadm21.h xiadm22.h xiadm23.h xiadm24.h
if test ! -f xiadm20.h; then
    echo xiadm20.h missing - aborting
    exit
fi
if test ! -f xiadm21.h; then
    echo xiadm21.h missing - aborting
    exit
fi
if test ! -f xiadm22.h; then
    echo xiadm22.h missing - aborting
    exit
fi
if test ! -f xiadm23.h; then
    echo xiadm23.h missing - aborting
    exit
fi
if test ! -f xiadm24.h; then
    echo xiadm24.h missing - aborting
    exit
fi

#-  require xiadm25.h xiadm26.h
if test ! -f xiadm25.h; then
    echo xiadm25.h missing - aborting
    exit
fi
if test ! -f xiadm26.h; then
    echo xiadm26.h missing - aborting
    exit
fi

#-  require xiadmin.c xiadmin.l xiadmin.d xiadmin.i
if test ! -f xiadmin.c; then
    echo xiadmin.c missing - aborting
    exit
fi
if test ! -f xiadmin.l; then
    echo xiadmin.l missing - aborting
    exit
fi
if test ! -f xiadmin.d; then
    echo xiadmin.d missing - aborting
    exit
fi
if test ! -f xiadmin.i; then
    echo xiadmin.i missing - aborting
    exit
fi

#-  require xierror.c xierror.l xierror.d xierror.i
if test ! -f xierror.c; then
    echo xierror.c missing - aborting
    exit
fi
if test ! -f xierror.l; then
    echo xierror.l missing - aborting
    exit
fi
if test ! -f xierror.d; then
    echo xierror.d missing - aborting
    exit
fi
if test ! -f xierror.i; then
    echo xierror.i missing - aborting
    exit
fi

#-  require xilrwp.c  xilrwp.l  xilrwp.d  xilrwp.i
if test ! -f xilrwp.c; then
    echo xilrwp.c missing - aborting
    exit
fi
if test ! -f xilrwp.l; then
    echo xilrwp.l missing - aborting
    exit
fi
if test ! -f xilrwp.d; then
    echo xilrwp.d missing - aborting
    exit
fi
if test ! -f xilrwp.i; then
    echo xilrwp.i missing - aborting
    exit
fi

#-  require echocli.c echod.c   tsttime.c tstslot.c tstrdns.c
if test ! -f echocli.c; then
    echo echocli.c missing - aborting
    exit
fi
if test ! -f echod.c; then
    echo echod.c missing - aborting
    exit
fi
if test ! -f tsttime.c; then
    echo tsttime.c missing - aborting
    exit
fi
if test ! -f tstslot.c; then
    echo tstslot.c missing - aborting
    exit
fi
if test ! -f tstrdns.c; then
    echo tstrdns.c missing - aborting
    exit
fi

#-  require xixlat.c
if test ! -f xixlat.c; then
    echo xixlat.c missing - aborting
    exit
fi

#-  require upmc.c upmd.c
if test ! -f upmc.c; then
    echo upmc.c missing - aborting
    exit
fi
if test ! -f upmd.c; then
    echo upmd.c missing - aborting
    exit
fi

#-  require sfl.h smtupm.h
if test ! -f sfl.h; then
    echo sfl.h missing - aborting
    exit
fi
if test ! -f smtupm.h; then
    echo smtupm.h missing - aborting
    exit
fi

#-  require smtschm.c xitami.aut ftpusers.aut ftpdirs.aut xitami.cfg
if test ! -f smtschm.c; then
    echo smtschm.c missing - aborting
    exit
fi
if test ! -f xitami.aut; then
    echo xitami.aut missing - aborting
    exit
fi
if test ! -f ftpusers.aut; then
    echo ftpusers.aut missing - aborting
    exit
fi
if test ! -f ftpdirs.aut; then
    echo ftpdirs.aut missing - aborting
    exit
fi
if test ! -f xitami.cfg; then
    echo xitami.cfg missing - aborting
    exit
fi

#-  delete $lib libsmt
rm -f libsmt.a

#-  library libsmt
CCLIBNAME=libsmt
export CCLIBNAME

#-  compile smtlog  smtmsg  smtecho smthttp smtoper smtsock
./c smtlog
test $? -ne 0 && exit 1
rm smtlog.o
./c smtmsg
test $? -ne 0 && exit 1
rm smtmsg.o
./c smtecho
test $? -ne 0 && exit 1
rm smtecho.o
./c smthttp
test $? -ne 0 && exit 1
rm smthttp.o
./c smtoper
test $? -ne 0 && exit 1
rm smtoper.o
./c smtsock
test $? -ne 0 && exit 1
rm smtsock.o

#-  compile smtslot smtsimu smtupmd smtupmc smttran smttime
./c smtslot
test $? -ne 0 && exit 1
rm smtslot.o
./c smtsimu
test $? -ne 0 && exit 1
rm smtsimu.o
./c smtupmd
test $? -ne 0 && exit 1
rm smtupmd.o
./c smtupmc
test $? -ne 0 && exit 1
rm smtupmc.o
./c smttran
test $? -ne 0 && exit 1
rm smttran.o
./c smttime
test $? -ne 0 && exit 1
rm smttime.o

#-  compile smtftpc smtftpd smtlib  smtrdns smthlog
./c smtftpc
test $? -ne 0 && exit 1
rm smtftpc.o
./c smtftpd
test $? -ne 0 && exit 1
rm smtftpd.o
./c smtlib
test $? -ne 0 && exit 1
rm smtlib.o
./c smtrdns
test $? -ne 0 && exit 1
rm smtrdns.o
./c smthlog
test $? -ne 0 && exit 1
rm smthlog.o

#-  compile smthttpl smtftpl smtrdnsl
./c smthttpl
test $? -ne 0 && exit 1
rm smthttpl.o
./c smtftpl
test $? -ne 0 && exit 1
rm smtftpl.o
./c smtrdnsl
test $? -ne 0 && exit 1
rm smtrdnsl.o

#-  compile xiadmin xiadm00 xierror xilrwp
./c xiadmin
test $? -ne 0 && exit 1
rm xiadmin.o
./c xiadm00
test $? -ne 0 && exit 1
rm xiadm00.o
./c xierror
test $? -ne 0 && exit 1
rm xierror.o
./c xilrwp
test $? -ne 0 && exit 1
rm xilrwp.o

#-  compile smttst1 smttst2 smttst3
./c smttst1
test $? -ne 0 && exit 1
rm smttst1.o
./c smttst2
test $? -ne 0 && exit 1
rm smttst2.o
./c smttst3
test $? -ne 0 && exit 1
rm smttst3.o

#-  library

#-  compile xitami xixlat
./c xitami
test $? -ne 0 && exit 1
./c xixlat
test $? -ne 0 && exit 1

#-  link    xitami xixlat
./c -L xitami
./c -L xixlat

#-  compile echocli echod tsttime tstslot tstrdns upmc upmd
./c echocli
test $? -ne 0 && exit 1
./c echod
test $? -ne 0 && exit 1
./c tsttime
test $? -ne 0 && exit 1
./c tstslot
test $? -ne 0 && exit 1
./c tstrdns
test $? -ne 0 && exit 1
./c upmc
test $? -ne 0 && exit 1
./c upmd
test $? -ne 0 && exit 1

#-  link    echocli echod tsttime tstslot tstrdns upmc upmd
./c -L echocli
./c -L echod
./c -L tsttime
./c -L tstslot
./c -L tstrdns
./c -L upmc
./c -L upmd

# -- end script without errors
exit 0
