#! /bin/sh

# tput clear

ONYX_HOME=`pwd`
export ONYX_HOME

> .config.h
> .config.make
> .config.sh

[ ! -x Config/Configure ] && chmod u+x Config/Configure
[ ! -x Config/Check ] && chmod u+x Config/Check

[ ! -f Config/Sys.`uname -s` ] && {
	echo
	echo This system is not directly supported so look closer to it.
	echo
	cp Config/Sys.Generic Config/Sys.`uname -s`
	}
Config/Configure Config/Sys.`uname -s` 

[ ! -f Config/Site.`uname -n` ] && {
	cp Config/Site.Generic Config/Site.`uname -n`
	[ -f Config/Readme.`uname -s` ] && cat Config/Readme.`uname -s`
	}
Config/Configure Config/Site.`uname -n`

. .config.sh

ENGINES=

[ "$USE_SHQL" != "" ] && {
	Config/Configure Config/Engine.shql
	ENGINES="$ENGINES SqlShql.o"
	}
[ "$USE_GAWK" != "" ] && {
	Config/Configure Config/Engine.gawk
	ENGINES="$ENGINES SqlGawk.o"
	}
[ "$USE_INGRES" != "" ] && {
	Config/Configure Config/Engine.ingres
	ENGINES="$ENGINES SqlIngres.o"
	
	echo "LQ=-lq" >>.config.make
	}
[ "$USE_INFORMIX" != "" ] && {
	Config/Configure Config/Engine.informix
	ENGINES="$ENGINES SqlInformix.o"
	}

Config/Check || {
	echo check aborted fatal
	echo try reconfiguring
	exit -1
	}

echo "ENGINES=$ENGINES" >>.config.make
echo "CFLAGS=$CF $TERM -nostdinc -I$INC_PATH -I$INC_ORG -L$LIB_PATH" >>.config.make

exit 0
