#! /bin/sh
#
#   Build script for iMatix SFL Package, for generic UNIX.
#   Requires the iMatix 'c' shell script.
#
#   Generated by Otto v2.2 from buildsfl.txt on 99/08/02, 10:01:14
#   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 the iMatix Standard Function Library'
echo 'Press [Enter] to continue, or Ctrl-C to abort.'
if test "$1" = ""; then read pause; fi
echo 'Checking for required files...'

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

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

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

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

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

#-  require sflconv.h  sflcvbs.c  sflcvdp.c  sflcvds.c  sflcvns.c
if test ! -f sflconv.h; then
    echo sflconv.h missing - aborting
    exit
fi
if test ! -f sflcvbs.c; then
    echo sflcvbs.c missing - aborting
    exit
fi
if test ! -f sflcvdp.c; then
    echo sflcvdp.c missing - aborting
    exit
fi
if test ! -f sflcvds.c; then
    echo sflcvds.c missing - aborting
    exit
fi
if test ! -f sflcvns.c; then
    echo sflcvns.c missing - aborting
    exit
fi

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

#-  library libsfl
CCLIBNAME=libsfl
export CCLIBNAME

#-  compile sflbits
./c sflbits
test $? -ne 0 && exit 1
./c -r libsfl sflbits
rm sflbits.o

#-  compile sflhttp
./c sflhttp
test $? -ne 0 && exit 1
./c -r libsfl sflhttp
rm sflhttp.o

#-  compile sflcomp
./c sflcomp
test $? -ne 0 && exit 1
./c -r libsfl sflcomp
rm sflcomp.o

#-  compile sflcons
./c sflcons
test $? -ne 0 && exit 1
./c -r libsfl sflcons
rm sflcons.o

#-  compile sflcryp
./c sflcryp
test $? -ne 0 && exit 1
./c -r libsfl sflcryp
rm sflcryp.o

#-  compile sflcvbs sflcvdp sflcvds sflcvns
./c sflcvbs
test $? -ne 0 && exit 1
./c -r libsfl sflcvbs
rm sflcvbs.o
./c sflcvdp
test $? -ne 0 && exit 1
./c -r libsfl sflcvdp
rm sflcvdp.o
./c sflcvds
test $? -ne 0 && exit 1
./c -r libsfl sflcvds
rm sflcvds.o
./c sflcvns
test $? -ne 0 && exit 1
./c -r libsfl sflcvns
rm sflcvns.o

#-  compile sflcvsb sflcvsd sflcvsn sflcvst
./c sflcvsb
test $? -ne 0 && exit 1
./c -r libsfl sflcvsb
rm sflcvsb.o
./c sflcvsd
test $? -ne 0 && exit 1
./c -r libsfl sflcvsd
rm sflcvsd.o
./c sflcvsn
test $? -ne 0 && exit 1
./c -r libsfl sflcvsn
rm sflcvsn.o
./c sflcvst
test $? -ne 0 && exit 1
./c -r libsfl sflcvst
rm sflcvst.o

#-  compile sflcvtp sflcvts sflconv
./c sflcvtp
test $? -ne 0 && exit 1
./c -r libsfl sflcvtp
rm sflcvtp.o
./c sflcvts
test $? -ne 0 && exit 1
./c -r libsfl sflcvts
rm sflcvts.o
./c sflconv
test $? -ne 0 && exit 1
./c -r libsfl sflconv
rm sflconv.o

#-  compile sfldate
./c sfldate
test $? -ne 0 && exit 1
./c -r libsfl sfldate
rm sfldate.o

#-  compile sfldir
./c sfldir
test $? -ne 0 && exit 1
./c -r libsfl sfldir
rm sfldir.o

#-  compile sflenv
./c sflenv
test $? -ne 0 && exit 1
./c -r libsfl sflenv
rm sflenv.o

#-  compile sflexdr
./c sflexdr
test $? -ne 0 && exit 1
./c -r libsfl sflexdr
rm sflexdr.o

#-  compile sflfile
./c sflfile
test $? -ne 0 && exit 1
./c -r libsfl sflfile
rm sflfile.o

#-  compile sflfind
./c sflfind
test $? -ne 0 && exit 1
./c -r libsfl sflfind
rm sflfind.o

#-  compile sflini
./c sflini
test $? -ne 0 && exit 1
./c -r libsfl sflini
rm sflini.o

#-  compile sfllang
./c sfllang
test $? -ne 0 && exit 1
./c -r libsfl sfllang
rm sfllang.o

#-  compile sfllbuf
./c sfllbuf
test $? -ne 0 && exit 1
./c -r libsfl sfllbuf
rm sfllbuf.o

#-  compile sfllist
./c sfllist
test $? -ne 0 && exit 1
./c -r libsfl sfllist
rm sfllist.o

#-  compile sflmail
./c sflmail
test $? -ne 0 && exit 1
./c -r libsfl sflmail
rm sflmail.o

#-  compile sflmath
./c sflmath
test $? -ne 0 && exit 1
./c -r libsfl sflmath
rm sflmath.o

#-  compile sflmem
./c sflmem
test $? -ne 0 && exit 1
./c -r libsfl sflmem
rm sflmem.o

#-  compile sflmesg
./c sflmesg
test $? -ne 0 && exit 1
./c -r libsfl sflmesg
rm sflmesg.o

#-  compile sflmime
./c sflmime
test $? -ne 0 && exit 1
./c -r libsfl sflmime
rm sflmime.o

#-  compile sflnode
./c sflnode
test $? -ne 0 && exit 1
./c -r libsfl sflnode
rm sflnode.o

#-  compile sflproc
./c sflproc
test $? -ne 0 && exit 1
./c -r libsfl sflproc
rm sflproc.o

#-  compile sflslot
./c sflslot
test $? -ne 0 && exit 1
./c -r libsfl sflslot
rm sflslot.o

#-  compile sflsock
./c sflsock
test $? -ne 0 && exit 1
./c -r libsfl sflsock
rm sflsock.o

#-  compile sflstr
./c sflstr
test $? -ne 0 && exit 1
./c -r libsfl sflstr
rm sflstr.o

#-  compile sflsymb
./c sflsymb
test $? -ne 0 && exit 1
./c -r libsfl sflsymb
rm sflsymb.o

#-  compile sflsyst
./c sflsyst
test $? -ne 0 && exit 1
./c -r libsfl sflsyst
rm sflsyst.o

#-  compile sfltok
./c sfltok
test $? -ne 0 && exit 1
./c -r libsfl sfltok
rm sfltok.o

#-  compile sfltree
./c sfltree
test $? -ne 0 && exit 1
./c -r libsfl sfltree
rm sfltree.o

#-  compile sfltron
./c sfltron
test $? -ne 0 && exit 1
./c -r libsfl sfltron
rm sfltron.o

#-  compile sfluid
./c sfluid
test $? -ne 0 && exit 1
./c -r libsfl sfluid
rm sfluid.o

#-  compile sflxml
./c sflxml
test $? -ne 0 && exit 1
./c -r libsfl sflxml
rm sflxml.o

#-  compile sflxmll
./c sflxmll
test $? -ne 0 && exit 1
./c -r libsfl sflxmll
rm sflxmll.o

#-  call buildh
test -f buildh && chmod +x buildh
./buildh 

#-  library

#-  compile testall  testbits testcomp testconv testcryp testdate testdes
./c testall
test $? -ne 0 && exit 1
./c testbits
test $? -ne 0 && exit 1
./c testcomp
test $? -ne 0 && exit 1
./c testconv
test $? -ne 0 && exit 1
./c testcryp
test $? -ne 0 && exit 1
./c testdate
test $? -ne 0 && exit 1
./c testdes
test $? -ne 0 && exit 1

#-  compile testexdr testfind testmem  testmime testsym  testtree testuid
./c testexdr
test $? -ne 0 && exit 1
./c testfind
test $? -ne 0 && exit 1
./c testmem
test $? -ne 0 && exit 1
./c testmime
test $? -ne 0 && exit 1
./c testsym
test $? -ne 0 && exit 1
./c testtree
test $? -ne 0 && exit 1
./c testuid
test $? -ne 0 && exit 1

#-  link    testall  testbits testcomp testconv testcryp testdate testdes
./c -L testall
./c -L testbits
./c -L testcomp
./c -L testconv
./c -L testcryp
./c -L testdate
./c -L testdes

#-  link    testexdr testfind testmem  testmime testsym  testtree testuid
./c -L testexdr
./c -L testfind
./c -L testmem
./c -L testmime
./c -L testsym
./c -L testtree
./c -L testuid

#-  compile testcgi  testdir  teststr  testxml  testtron
./c testcgi
test $? -ne 0 && exit 1
./c testdir
test $? -ne 0 && exit 1
./c teststr
test $? -ne 0 && exit 1
./c testxml
test $? -ne 0 && exit 1
./c testtron
test $? -ne 0 && exit 1

#-  link    testcgi  testdir  teststr  testxml  testtron
./c -L testcgi
./c -L testdir
./c -L teststr
./c -L testxml
./c -L testtron
echo 'SFL built successfully.'

# -- end script without errors
exit 0
