#!/bin/csh
#  Name : sqlsetenv.csh
#
#  Purpose: Create application development environment for ESQLFLEX
#
#  Requirements: 
#
#     Before running this utility set the following environment variable:
#         setenv SQLDIR  ??
# 

set SYS=`uname -a`

setenv ISMACH ISUNIX
if ( "$SYS[1]" == "sysname=XENIX") then
    echo "SCO XENIX being used"
    setenv SQLMACH sco
    setenv RANLIB	"ranlib "
else if ( "$SYS[2]" ==  "scosysv" ) then
    echo "SCO UNIX being used"
    setenv SQLMACH unix86
    setenv ISMACH ISSCO
    setenv RANLIB	"echo "
else if ( "$SYS[1]" ==  "UNIX_SV" ) then
    echo "UnixWare UNIX being used"
    setenv SQLMACH unixware
    setenv RANLIB	echo
else if ( "$SYS[1]" ==  "uniflex" ) then
    echo "UniFLEX being used"
    setenv SQLMACH uniflex
    setenv RANLIB	"echo "
else if ( "$SYS[1]" ==  "OSF1" ) then
    echo "ALPHA OSF1 being used"
    setenv SQLMACH alpha
    setenv RANLIB	"echo ranlib"
else if ( "$SYS[4]" ==  "COHERENT" ) then
    echo "COHERENT UNIX being used"
    setenv SQLMACH coherent
    setenv RANLIB	"ranlib "
else if ( "$SYS[1]" == "Linux" ) then
    echo "LINUX being used"
    setenv SQLMACH linux
    setenv ISMACH ISLNX
    setenv RANLIB	"ranlib "
else if ( "$SYS[1]" ==  "FreeBSD" ) then
    echo "FreeBSD being used"
    setenv SQLMACH freebsd
    setenv RANLIB	ranlib
else if ( "$SYS[1]" ==  "AIX" ) then
    echo "IBM AIX being used"
    setenv SQLMACH ibmaix
    setenv RANLIB	"echo "
else if ( "$SYS[2]" ==  "AIX" ) then
    echo "IBM AIX being used"
    setenv SQLMACH ibmaix
    setenv RANLIB	"echo "
else if ( "$SYS[1]" ==  "XENIX386" ) then
    echo "ALTOS 386 with XENIX being used"
    setenv SQLMACH alto2086
    setenv RANLIB	"ranlib "
else if ( "$SYS[1]" ==  "SunOS" ) then
    echo "SunOS $SYS[3] being used"
    switch( $SYS[3])
	case 4*:
	    setenv SQLMACH sunos
	    setenv RANLIB ranlib
	    breaksw
	case 5*:
	    setenv SQLMACH sunsolaris
	    setenv RANLIB echo
	    breaksw
    endsw
else if ( "$SYS[1]" ==  "ULTRIX" ) then
    echo "DEC ULTRIX being used"
    setenv SQLMACH ultrix
    setenv RANLIB	"ranlib "
else if ( "$SYS[1]" ==  "IRIX" ) then
    echo "SGI IRIX being used"
    setenv SQLMACH sgi
    setenv RANLIB echo
else if ( "$SYS[5]" ==  "386/1000" ) then
    echo "ALTOS 1000,2000, or 3000 with UNIX being used"
    setenv SQLMACH alto386
    setenv RANLIB	"echo "
else if ( "$SYS[5]" ==  "386/2000" ) then
    echo "ALTOS 1000,2000, or 3000 with UNIX being used"
    setenv SQLMACH alto386
    setenv RANLIB	"echo "
else if ( "$SYS[5]" ==  "iAPX386" ) then
    echo "UNISYS 6000 series computer ($SYS[5) with UNIX being used"
    setenv SQLMACH uni6000
    setenv RANLIB	"echo "
else if ( "$SYS[5]" ==  "UNISYS" ) then
    echo "UNISYS 5000 series computer ($SYS[5) with UNIX being used"
    setenv SQLMACH uni5000
    setenv RANLIB	"echo "
else if ( "$SYS[1]" == "HP-UX" ) then
    switch ( "$SYS[5]" )
    	case 9000/[78]*:
	    echo "HP 9000-800 series Computer being used"
	    setenv SQLMACH hp9800
	    setenv RANLIB	"echo "
	    breaksw
    	case 9000/3*:
	    echo "HP 9000-300 series Computer being used"
	    setenv SQLMACH hp9300
	    setenv RANLIB	"echo "
	    breaksw
    endsw
else if ( "$SYS[5]" == "3B2" ) then
    echo "AT&T 3B2 with UNIX being used"
    setenv SQLMACH att3b2
    setenv RANLIB	"echo "
else if ( "$SYS[5]" == "machine=i80386" ) then
    echo "Default UNIX for 80x86 chip being used"
    setenv SQLMACH unix86
    setenv RANLIB	"echo "
else if ( "$SYS[2]" ==  "bsimmons" ) then
    echo "AT&T UNIX being used"
    setenv SQLMACH att3200
    setenv RANLIB	"echo "
else if ( "$SYS[5]" == "i386" ) then
#   AT&T UNIX
    echo "Default UNIX for 80x86 chip being used"
    setenv SQLMACH unix86
    setenv ISMACH ISSCO
    setenv RANLIB	"echo "
else 
    echo "Default UNIX for 68000 chip being used"
    setenv SQLMACH unix68
    setenv RANLIB	"echo "
endif

set SQLMACHDIR=($SQLDIR/unx/$SQLMACH $SQLDIR/unx)
setenv ISAMBUFS		16
setenv SQLINC		$SQLDIR/include
setenv SQLLIB		$SQLDIR/src/lib

setenv SQLSRC	$SQLDIR/src/sql

if ( "$TESTINSTALL" == 1 ) then
    set path=($SQLMACHDIR $SQLDIR/bin $path)
else 
    set path=($path $SQLMACHDIR $SQLDIR/bin)
endif

if ( $?FXDIR == 0 ) then
    setenv FXDIR $SQLDIR
endif
