#
# Setup script for the ESO Scisoft scientific software collection
#
# November 2000, this script written by K Maguire
#   
#  any problems: e-mail scihelp@eso.org
#
# This file should be sourced using the csh/tcsh "source" command
#        source /scisoft/bin/Setup.csh
# by all users of the software. They should need to do nothing else.
# 
# This script should work in identical form on all 3 supported
#  architectures.
#
# Before doing anything check the shell
#
if ($?shell) then
    if ( `basename $shell` != 'tcsh'  && `basename $shell` != 'csh' ) then
	echo "Please start a csh/tcsh shell before setting up scisoft"
	exit -1
    endif
endif
#
# Find out which arch we are running on
#
set sciarch=`uname -s`
if ( ${sciarch} != 'SunOS' && ${sciarch} != 'HP-UX' && ${sciarch} != 'Linux' ) then
   echo "Unsupported Architecture"
   exit -1
endif
#
# Add the main scisoft binaries to the path
#
if ($?PATH) then
    setenv PATH /scisoft/bin:${PATH}
else
    setenv PATH /scisoft/bin
endif
#
# Needed for VLT on HP
#
if ( ${sciarch} == "HP-UX" ) then
   setenv PATH /vlt/gnu/bin:${PATH}
endif
#
# Iraf related definitions
#
if (-d /scisoft/iraf) then
    setenv iraf /scisoft/iraf/iraf/
    setenv stsdas /scisoft/iraf/extern/stsdas/
    setenv tables /scisoft/iraf/extern/tables/
    if (-f ${iraf}/unix/hlib/irafuser.csh) then
	source ${iraf}/unix/hlib/irafuser.csh
    else
	echo "Iraf is not available in the standard location"
    endif
    if ( ${sciarch} == "HP-UX" ) then
	setenv IRAFARCH hp700
    else if ( ${sciarch} == "SunOS" ) then
	setenv IRAFARCH ssun
    else if ( ${sciarch} == "Linux" ) then
	setenv IRAFARCH redhat
    endif
endif
#
# IDL related definitions
#
if ( -d /scisoft/idl ) then
    setenv IDL_DIR /scisoft/idl/idl
    setenv IDL_PATH +/scisoft/idl/atv:+/scisoft/idl/astron/pro:+/scisoft/idl/idl/lib:+/scisoft/idl/jhuapl:/scisoft/idl/starfinder
endif
#
# Eclipse
#
if ( -d /scisoft/eclipse ) then
    setenv E_PATH /scisoft/eclipse/eclipse
    setenv E_VERBOSE 1
    setenv E_MAXMEM  64
    setenv E_MAXSWAP 128
    setenv E_TMPDIR  .
    unsetenv E_DEBUG
    setenv PATH ${PATH}:${E_PATH}/bin
    if ( ! $?MANPATH ) then
	if ( ${sciarch} == "HP-UX" ) then
	    setenv MANPATH /usr/share/man:/usr/contrib/man:/usr/local/man:${E_PATH}/man
	else if ( ${sciarch} == "SunOS" ) then
	    setenv MANPATH /usr/share/man:${E_PATH}/man
	else if ( ${sciarch} == "Linux" ) then
	    setenv MANPATH /usr/man:/usr/X11R6/man:/usr/local/man:${E_PATH}/man
	endif
    else
	setenv MANPATH ${MANPATH}:${E_PATH}/man
    endif
endif
#
# Tiny Tim HST psf software
#
if ( -d /scisoft/tinytim ) then
    setenv TINYTIM /scisoft/tinytim
#kcm    alias tiny1 ${TINYTIM}/tiny1
#kcm    alias tiny2 ${TINYTIM}/tiny2
endif
#
# PGPLOT graphics software
#
setenv PGPLOT_DIR /scisoft/pgplot
setenv PGPLOT_DEV /xwin
#
# ESO-MIDAS
#
if ( -d /scisoft/midas ) then
    setenv MIDASHOME /scisoft/midas
    setenv MIDVERS 02FEB
    if ( ${sciarch} == "HP-UX" ) then
	if ( $?SHLIB_PATH ) then
	    setenv SHLIB_PATH ${MIDASHOME}/${MIDVERS}/lib:${SHLIB_PATH}
	else
	    setenv SHLIB_PATH ${MIDASHOME}/${MIDVERS}/lib
	endif
    else
	if ( $?LD_LIBRARY_PATH ) then
	    setenv LD_LIBRARY_PATH ${MIDASHOME}/${MIDVERS}/lib:${LD_LIBRARY_PATH}
	else
	    setenv LD_LIBRARY_PATH ${MIDASHOME}/${MIDVERS}/lib
	endif
    endif
#kcm    alias inmidas   ${MIDASHOME}/${MIDVERS}/system/unix/inmidas
#kcm    alias gomidas   ${MIDASHOME}/${MIDVERS}/system/unix/gomidas
#kcm    alias helpmidas ${MIDASHOME}/${MIDVERS}/system/unix/helpmidas
endif
#
# SAORD - including saotng
if ( -d /scisoft/saord/ ) then
    setenv SAORD_ROOT /scisoft/saord
    setenv PATH ${PATH}:${SAORD_ROOT}/bin
endif
# Gildas - just add to the path
if ( -d /scisoft/gildas ) then
    setenv PATH /scisoft/gildas/exe/bin:${PATH}
endif
#
# Setup a search path for Latex to include astronomical journals
#
if ($?TEXINPUTS) then
   setenv TEXINPUTS ${TEXINPUTS}:/scisoft/latex-style-files
else
   setenv TEXINPUTS :/scisoft/latex-style-files
endif
#
# Python
#
if ( -d /scisoft/python ) then
    if ($?PYTHONPATH ) then
        setenv PYTHONPATH ~/PythonModules:${PYTHONPATH}
    else
        setenv PYTHONPATH ~/PythonModules
    endif
    if ( ${sciarch} == "HP-UX" ) then
	if ( $?SHLIB_PATH ) then
	    setenv SHLIB_PATH /scisoft/lib:${SHLIB_PATH}
	else
	    setenv SHLIB_PATH /scisoft/lib
	endif
    else
	if ( $?LD_LIBRARY_PATH ) then
	    setenv LD_LIBRARY_PATH /scisoft/lib:${LD_LIBRARY_PATH}
	else
	    setenv LD_LIBRARY_PATH /scisoft/lib
	endif
    endif
endif
#
# Check whether there is a /scilocal available and if so execute
# its Setup.csh file
#
if ( -f /scilocal/bin/Setup.csh ) then
   source /scilocal/bin/Setup.csh
endif
#
#
setenv SCISOFT_VERSION APR2002
#
# The End
