#!/bin/csh -f
#==============================================================
#
#  Abs:  Setup for the Pentek 4284 DSP EPICS 
#
#  Name: dspSetup   (Development system) 
#
#  Rem: The following should be executed for
#       each shell logging into an epics host 
#       that wants to build DSP code
#
#  Side: You will need to create your own personel
#        configuration directory for storing SwiftNet
#        node configurations. This can be done in your
#        local directory $HOME/config or in a common
#        project area.
#
#        In addition, SwiftTools will create a separate
#        directory for each user-created project. The
#        parent directory inwhich these project directories
#        are created is specified by the environment variable
#
#             SWIFTTOOLS_PROJ
#
#        The direcctory swiftttols-x.x/project is created during
#        SwiftTools installation, but an alternative directory
#        may also be specified.
#
#  Side:  Add the following line to the .login or .cshrc
#         file in your $HOME directory BEORE any SwiftTools
#         paths, if you wish to use SwiftTools.
#
#         source /afs/slac/package/pentek/dspSetup
#
#
#  Facility:  SLAC Controls Group (ESD)
#
#  Auth: 12-Jan-2001, Kristi Luchini     (LUCHINI)
#  Rev:  dd-mmm-yyyy, Reviewer's Name    (USERNAME)
#
#--------------------------------------------------------------
#  Mod:
#       29-Mar-2002, Kristi Luchini (LUCHINI):
#          Search path,LD_LIBRARY_PATH to see if 
#          directory that we want to add is already in the path
#          Added error message of default config directory
#          cannot be found.
#       26-Jan-2001, Kristi Luchini (LUCHINI):
#          Double entry for swifttools/swiftnet path removed
#       22-Jan-2001, Linda Hendrickson (LJH):
#          swiftnet path should go before swifttools 
#          Change in case LD_LIBRARY_PATH not defined.
#          need titools bin in path, need lib and include in C_DIR and A_DIR.
#
#==============================================================
#
# Setup SwiftTools and SwiftNet
if (! $?PENTEK) then
  setenv PENTEK  /afs/slac/package/pentek
  setenv SWIFTTOOLS_HOME ${PENTEK}/swifttools-2.5.8
  setenv SWIFTTOOLS_MACR ${SWIFTTOOLS_HOME}/macro
  setenv SWIFTNET_HOME   ${PENTEK}/swiftnet-3.5.1

# Add swiftnet help to path
  if (! $?MANPATH) setenv MANPATH
  env | grep MANPATH | grep $SWIFTNET_HOME/man >& /dev/null
  if ( $? != 0 )  setenv MANPATH   ${MANPATH}:${SWIFTNET_HOME}/man

# Add swiftnet binaries to path
  expr " $path " : ".* ${SWIFTNET_HOME}/solaris/bin .*" >& /dev/null \
    || set path=($path ${SWIFTNET_HOME}/solaris/bin)

# Add swifttools binaries to path
  expr " $path " : ".* ${SWIFTTOOLS_HOME}/solaris/bin .*" >& /dev/null \
    || set path=($path ${SWIFTTOOLS_HOME}/solaris/bin)
endif

# Add Swiftnet libraries to path
if  (! $?LD_LIBRARY_PATH) then
  setenv LD_LIBRARY_PATH ${SWIFTNET_HOME}/solaris/libn
else
  env | grep LD_LIBRARY_PATH | grep ${SWIFTNET_HOME}/solaris/libn >& /dev/null
  if ( $? != 0 ) then
    setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:${SWIFTNET_HOME}/solaris/libn
  endif
endif

setenv WASNT_PEN
#
# Setup the projects directory if an alternative 
# has not been created.
#   ljh use the examples given if user has not set up their own project
if (! $?SWIFTTOOLS_PROJ) then
  setenv SWIFTTOOLS_PROJ ${SWIFTNET_HOME}/examples
endif
#
# Setup configuration directory. Should be setup in
# local directory or in a common project directoy.
if (! $?SWIFTNET_CONFIG) then
  if (-e $HOME/config) then
    setenv SWIFTNET_CONFIG  ${HOME}/config
  else
    echo ' Unable find ${HOME}/config - needed as default to set SWIFTNET_CONFIG'
  endif
endif
#
# If you wish to use SwiftTools and the TI compiler
# with SwiftNet you must also set the following
# environment variable.
if (! $?DSPTOOLS) then
  setenv DSPTOOLS  /afs/slac/package/titools

  expr " $path " : ".* ${DSPTOOLS} .*" >& /dev/null \
    || set path=($path ${DSPTOOLS})

  expr " $path " : ".* ${DSPTOOLS}/bin .*" >& /dev/null \
    || set path=($path ${DSPTOOLS}/bin)

  setenv C_dir ${DSPTOOLS}/lib:${DSPTOOLS}/include
  setenv A_dir ${DSPTOOLS}/lib
endif
