#*******************************************************************************
# E.S.O. - VLT project
#
# vlt.cshrc
#
# who       when      what
# --------  --------  ----------------------------------------------
# gfilippi  16/06/94  created
# gfilippi  05/12/94  updated for NOV 94
# gfilippi  15/03/95  updated for FEB 95
# gfilippi  23/01/96  updated for DEC 95
# gfilippi  22/11/96  updated for NOV 96
# gfilippi  30/12/97  updated for NOV 97
# gfilippi  14/05/98  fixed MANPATH for RTAP (VLTSW970249)
#

#************************************************************************
#   NAME
#   vlt.cshrc - environment set up
# 
#   SYNOPSIS
#   source vlt.cshr
# 
#   DESCRIPTION
#   definition of CCS and LCC environments.
#
#   This file is a subset of the file used at ESO. It is made of 
#   three parts:
#    - general OS definitions
#    - configuration of flags 
#    - VLT environment configuration based on flags.
#
#   Once correct, this file should be source by the .cshrc of anybody
#   that wants to use the VLT Software.
#
#   CAUTION
#   This file is intended to be used at non-ESO installations.
#   ESO installation MUST be done using the stdEnv module!!!
#------------------------------------------------------------------------

#
# 1. General Operating System Configuration
#

set os = `uname`
set release = `uname -r`
switch ($os)
    case SunOS:
        set path = ( /usr/5bin /usr/ucb /usr/bin )
        switch ($release)
        case 5.*:
            set path = ( /usr/ccs/bin  $path )
            breaksw
        default:
            ;
        endsw
	breaksw
    case HP-UX:
        switch ($release)
        case B.10.20:
            if ( -r /etc/PATH ) then
                setenv PATH `cat /etc/PATH`
            else
                set path = ( /usr/bin \
                             /opt/ansic/bin \
                             /usr/ccs/bin \
                             /usr/contrib/bin \
                             /opt/nettladm/bin \
                             /opt/langtools/bin \
                             /opt/lrom/bin \
                          )
            endif
            breaksw
        default:
            set path = ( /bin /usr/bin )
            breaksw
        endsw
	breaksw
    default:
        set path = ( /bin /usr/bin )
endsw
set myname = `whoami`
if ( ! $?HOST ) setenv HOST `hostname`
if ( ! $?LOGNAME ) setenv LOGNAME `whoami`
if ( $myname == "root" ) then
    set path = ( $path /etc /usr/etc )
else
    set path = ( /usr/local/bin $path ) 
endif


switch ($os)
    case SunOS:
        setenv MANPATH /usr/local/man:/usr/man
        switch ($release)
        case 5*:
            ;
            breaksw
        default:
            ;
            breaksw
        endsw
	breaksw
    case HP-UX:
        switch ($release)
        case B.10.20:
            # default MANPATH
            setenv MANPATH /usr/share/man:/usr/contrib/man:/usr/local/man
            if ( -r /etc/MANPATH ) then
                setenv MANPATH `cat /etc/MANPATH`
            endif
            breaksw
        default:
            setenv MANPATH /usr/man:/usr/local/man
            breaksw
        endsw
       	breaksw
    default:
        echo ""
endsw

#
# 2. set up of configuration flags
#
#
# at begining flags are set to a default value
#
setenv CC gcc
set X11_ONLY_EXISTS = FALSE
set MOTIF_EXISTS = FALSE
setenv VLT_VCCBOOTTIME	300
set NEEDS_DIR_USR_ETC = FALSE
set SOFTBENCH_EXISTS = FALSE
set RTAP_EXISTS = FALSE
set STARCAT_EXISTS = FALSE

#
# for each machine that has to run the VLTSW, flags need to be
# properly seproperly set. Here follow some examples taken from
# some ESO machines. Uncomment the case you need, change the
# disk location to your installation, remove the lines you 
# do not need because you do not have the specific case.

setenv GNU_ROOT   /vlt/gnu
setenv TCLTK_ROOT /vlt/tcltk
setenv DFLOW_ROOT /vlt/dflow

setenv VLTROOT /vlt/NOV97
setenv VLTDATA /vlt/data

# If you are using INS software
#     setenv INSROOT /data/insroot

# only for HP-10.20
#     set X11_ONLY_EXISTS = TRUE

# only for Solaris 
#     set X11_ONLY_EXISTS = TRUE
#     set MOTIF_EXISTS = TRUE
#     set NEEDS_DIR_USR_ETC = TRUE
#     setenv MOTIFHOME /opt/SUNWmotif
#     setenv OPENWINHOME /usr/openwin
#     setenv LD_LIBRARY_PATH $MOTIFHOME/lib:$OPENWINHOME/lib:/usr/lib/X11:/vlt/local/lib:/usr/ucblib:/usr/ccs/lib
#     setenv PATH ${PATH}:$MOTIFHOME/bin:$MOTIFHOME/demo

# If you have VxWorks-Tornado you need: (TYPE must match your machine)
#     setenv VX_HOST_TYPE hp9700
#     setenv WIND_BASE /vlt/vw5.3
#     setenv WIND_HOST_TYPE parisc-hpux10

# If you have RTAP you need:
#     set RTAP_EXISTS = TRUE
#     setenv RTAPENV   <yourEnvironment>

# define the ACC database host
#     setenv ACC_HOST te13

# If you have Midas you need:
#     setenv MIDASHOME /midas
#     setenv MIDVERS 97NOV

# If you have a NOCCS installation you need:
#     setenv NOCCS defined

# If you intend to use the star catalogue library you need:
#     set STARCAT_EXISTS = TRUE

# Example: the following is an HP configured for CCS:
#     setenv TAPE /dev/rmt/0m
#     set X11_ONLY_EXISTS = TRUE
#     setenv VLTROOT /vlt/NOV97
#     setenv VLTDATA /vlt/data
#     setenv INSROOT /data/insroot
#     setenv VX_HOST_TYPE hp9700
#     setenv WIND_BASE /vlt/vw5.3
#     setenv WIND_HOST_TYPE parisc-hpux10
#     set RTAP_EXISTS = TRUE
#     setenv RTAPENV `hostname`
#     setenv ACC_HOST wt1tcs
#     setenv MIDASHOME /midas
#     setenv MIDVERS 97NOV
#     set STARCAT_EXISTS = TRUE

#
# 3. According to flags, the proper setup is created.
#
switch ($os)
    case SunOS:
        ;        # use the default built-in list: /lib /usr/lib /usr/local/lib.
	breaksw
    case HP-UX:
        switch ($release)
        case B.10.20:
            setenv LPATH      /usr/local/lib:/usr/lib:/usr/ccs/lib
            setenv SHLIB_PATH /usr/local/lib:/usr/lib:/usr/ccs/lib
            breaksw
        default:
            setenv LPATH /lib:/usr/lib:/usr/local/lib
            breaksw
        endsw
	breaksw
    default:
        ;
	breaksw
endsw
if ( $myname != "root" ) then
    umask 022           
else
    umask 002           
endif
if ($X11_ONLY_EXISTS == "TRUE") then
    switch ($os)
        case SunOS:
            switch ($release)
            case 5*:
                set path    = ( $path  /usr/bin/X11 /usr/openwin/bin )   
                setenv MANPATH ${MANPATH}
                ;
                breaksw
            default:
                ;
                breaksw
            endsw
	    breaksw
        case HP-UX:
            switch ($release)
            case B.10.20:
                set path    = ( $path  /usr/bin/X11 /usr/contrib/bin/X11 )   
                ;
                breaksw
            default:
                set path    = ( $path  /usr/bin/X11 /usr/local/bin/X11 )   
                breaksw
            endsw
            breaksw
        default:
    endsw
endif
if ($MOTIF_EXISTS == "TRUE") then
    switch ($os)
        case SunOS:
            switch ($release)
            case 5*:
                set path    = ( $path  /usr/bin/X11 /usr/openwin/bin )   
                setenv MANPATH ${MANPATH}:/usr/openwin/man:/usr/openwin/share/man
                ;
                breaksw
            default:
                ;
                breaksw
            endsw
	    breaksw
        case HP-UX:
            switch ($release)
            case B.10.20:
                set path    = ( $path  /usr/bin/X11 /usr/contrib/bin/X11 )   
                ;
                breaksw
            default:
                set path    = ( $path  /usr/bin/X11 /usr/local/bin/X11 )   
                breaksw
            endsw
            breaksw
        default:
    endsw
endif

if ( $?GNU_ROOT ) then 
    switch ($os)
        case SunOS:
            switch ($release)
            case 5*:
                setenv PATH        ${GNU_ROOT}/bin:${PATH}   
                setenv MANPATH     ${GNU_ROOT}/man:${MANPATH}
                setenv LD_LIBRARY_PATH  ${GNU_ROOT}/lib:${LD_LIBRARY_PATH}
                ;
                breaksw
            default:
                ;
                breaksw
            endsw
	    breaksw
        case HP-UX:
            switch ($release)
            case B.10.20:
                setenv PATH        ${GNU_ROOT}/bin:${PATH}   
                setenv MANPATH     ${GNU_ROOT}/man:${MANPATH}
                setenv LPATH       ${GNU_ROOT}/lib:${LPATH}
                setenv SHLIB_PATH  ${GNU_ROOT}/lib:${SHLIB_PATH}
                ;
                breaksw
            default:
                breaksw
            endsw
            breaksw
        default:
    endsw
endif

if ( $?TCLTK_ROOT ) then 
    switch ($os)
        case SunOS:
            switch ($release)
            case 5*:
                setenv PATH        ${TCLTK_ROOT}/bin:${PATH}   
                setenv MANPATH     ${TCLTK_ROOT}/man:${MANPATH}
                setenv LD_LIBRARY_PATH  ${TCLTK_ROOT}/lib:${LD_LIBRARY_PATH}
                ;
                breaksw
            default:
                ;
                breaksw
            endsw
	    breaksw
        case HP-UX:
            switch ($release)
            case B.10.20:
                setenv PATH        ${TCLTK_ROOT}/bin:${PATH}   
                setenv MANPATH     ${TCLTK_ROOT}/man:${MANPATH}
                setenv LPATH       ${TCLTK_ROOT}/lib:${LPATH}
                setenv SHLIB_PATH  ${TCLTK_ROOT}/lib:${SHLIB_PATH}
                ;
                breaksw
            default:
                breaksw
            endsw
            breaksw
        default:
    endsw
endif

if ( $?DFLOW_ROOT ) then 
    switch ($os)
        case SunOS:
            switch ($release)
            case 5*:
                setenv PATH        ${DFLOW_ROOT}/bin:${PATH}   
                setenv MANPATH     ${DFLOW_ROOT}/man:${MANPATH}
                setenv LD_LIBRARY_PATH  ${DFLOW_ROOT}/lib:${LD_LIBRARY_PATH}
                ;
                breaksw
            default:
                ;
                breaksw
            endsw
	    breaksw
        case HP-UX:
            switch ($release)
            case B.10.20:
                setenv PATH        ${DFLOW_ROOT}/bin:${PATH}   
                setenv MANPATH     ${DFLOW_ROOT}/man:${MANPATH}
                setenv LPATH       ${DFLOW_ROOT}/lib:${LPATH}
                setenv SHLIB_PATH  ${DFLOW_ROOT}/lib:${SHLIB_PATH}
                ;
                breaksw
            default:
                breaksw
            endsw
            breaksw
        default:
    endsw
endif


if ($os == "HP-UX")  then
   set path = ( /usr/vue/bin $path )
endif

if ($NEEDS_DIR_USR_ETC == "TRUE") then 
    set path = ( $path /usr/etc )
endif

if ( $?WIND_BASE ) then 
    # empty: it uses the WIND_REGISTRY path
    setenv WIND_LMHOST ""
    # empty: by default the current host
    setenv WIND_REGISTRY `hostname`
    setenv PATH ${PATH}:${WIND_BASE}/host/${WIND_HOST_TYPE}/bin
    setenv GCC_EXEC_PREFIX  ${WIND_BASE}/host/${WIND_HOST_TYPE}/lib/gcc-lib/
    # ONLY FOR SOLARIS2:
    if ($os == "SunOS") then
       setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:/usr/dt/lib:/usr/openwin/lib
    endif
    setenv VX_CPU_FAMILY 68k 
    setenv VXROOT     ${WIND_BASE}/target
    setenv VX_VW_BASE ${WIND_BASE}/target  
    setenv MANPATH ${MANPATH}:$VXROOT/man 
    setenv MANPATH ${MANPATH}:$VXROOT/GNU/$VX_HOST_TYPE.$VX_CPU_FAMILY/man
    setenv VX_HSP_BASE  $VXROOT
    setenv VX_BSP_BASE  $VXROOT
    setenv VX_VW_BASE   $VXROOT
    setenv CPU MC68040
endif

if ($RTAP_EXISTS == "TRUE") then
    switch ($os)
        case SunOS:
            switch ($release)
            case 5*:
                setenv RTAPROOT /usr/rtap
                set path = ( $path $RTAPROOT/bin $RTAPROOT/script $RTAPROOT/contrib/bin) 
                # for NetLS 2.X 
                set path = ( $path /usr/lib/netls/bin )
                setenv MANPATH ${MANPATH}:${RTAPROOT}/man 
                setenv LD_LIBRARY_PATH ${RTAPROOT}/lib:${LD_LIBRARY_PATH}:/usr/opt/lib
                ;
                breaksw
            default:
                ;
                breaksw
            endsw
	    breaksw
        case HP-UX:
            switch ($release)
            case B.10.20:
                setenv RTAPROOT /opt/rtap/A.06.70
                set path=($path $RTAPROOT/bin)
                setenv MANPATH ${MANPATH}:$RTAPROOT/share/man
                setenv LPATH ${RTAPROOT}/lib:${LPATH} 

                setenv CRTOOLS_ROOT /opt/crTools/C.01.60
                setenv LPATH ${CRTOOLS_ROOT}/shlib:${LPATH}
                setenv SHLIB_PATH ${SHLIB_PATH}:/opt/crTools/C.01.60/shlib:/opt/rtap/A.06.70/shlib

                breaksw
            default:
                setenv RTAPROOT /usr/rtap
                set path = ( $path $RTAPROOT/bin $RTAPROOT/script $RTAPROOT/contrib/bin) 
                # for NetLS 2.X 
                set path = ( $path /usr/lib/netls/bin )
                setenv MANPATH ${MANPATH}:${RTAPROOT}/man 
                setenv LPATH ${RTAPROOT}/lib:${LPATH}
                breaksw
            endsw
            breaksw
        default:
    endsw
    if ( $?RTAPENV == 0 ) then
        setenv RTAPENV w${HOST}
    endif
endif

if ( $?VLTROOT ) then 
    setenv VLT_CDT_ROOT     $VLTROOT/CDT
    setenv VLT_ERROR_ROOT   $VLTROOT/ERRORS
    setenv VLT_ALARM_ROOT   $VLTROOT/ALARMS
    if ( ! $?VLT_LOG_FILES ) setenv VLT_LOG_FILES	${VLTDATA}/tmp
    if ( ! $?VLT_LOG_ROOT )  setenv VLT_LOG_ROOT	${VLTDATA}/config
    set path = ( $VLTROOT/bin $path )  
    setenv MANPATH ${VLTROOT}/man:${VLTROOT}/vw/man:${MANPATH}
    switch ($os)
        case SunOS:
            switch ($release)
            case 5*:
	        setenv LD_LIBRARY_PATH      ${VLTROOT}/lib:${LD_LIBRARY_PATH}
                breaksw
            default:
                ;
                breaksw
            endsw
	    breaksw
        case HP-UX:
            switch ($release)
            case B.10.20:
	        setenv LPATH      ${VLTROOT}/lib:${LPATH}
                setenv SHLIB_PATH ${VLTROOT}/lib:${SHLIB_PATH}
                breaksw
            default:
                ;
                breaksw
            endsw
            breaksw
        default:
            ;
    endsw
endif

if ($STARCAT_EXISTS == "TRUE") then
    setenv SKYCATDIR /vlt/dflow
endif

if ( $?MIDASHOME ) then 
    setenv MANPATH ${MANPATH}:$MIDASHOME/$MIDVERS/system/unix
    setenv PATH ${PATH}:$MIDASHOME/$MIDVERS/system/unix
    if ( "$os" == "SunOS" ) then
	setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:$MIDASHOME/$MIDVERS/lib
    endif
endif

if ( $myname != "root" ) set path = ( . $path)
unset	myname
unset	os
# ___oOo___
