#ISSM_DIR and ISSM_ARCH should have been defined already in your shell settings file (.bashrc, .cshrc, etc ...)
source $ISSM_DIR/etc/environment_variables.sh

#Do we have any command line arguments? (such as MATLAB_DIR=otherdirthandefault), source them before exporting the variables 
#to environment.
for i in $@
do
	eval $i
done

#CRON utilities
PATH="$PATH:$ISSM_DIR/cron"

#scripts
PATH="$PATH:$ISSM_DIR/scripts"

#MATLAB
export MATLAB_DIR
PATH="$PATH:$MATLAB_DIR/bin"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$MATLAB_DIR/lib"
export LD_RUN_PATH="$LD_RUN_PATH:$MATLAB_DIR/lib"

#MPI
export MPI_DIR
PATH="$PATH:$MPI_DIR/bin"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$MPI_DIR/lib"
export LD_RUN_PATH="$LD_RUN_PATH:$MPI_DIR/lib"
export MANPATH="$MANPATH:$MPI_DIR/man"
export MPIRUN_NPROCS=8

#PETSC
export PETSC_DIR
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$PETSC_DIR/lib/$ISSM_ARCH"
export LD_RUN_PATH="$LD_RUN_PATH:$PETSC_DIR/lib/$ISSM_ARCH"

#SLEPC
export SLEPC_DIR
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$SLEPC_DIR/lib/$ISSM_ARCH"
export LD_RUN_PATH="$LD_RUN_PATH:$SLEPC_DIR/lib/$ISSM_ARCH"

#Dakota
export DAKOTA_DIR
PATH="$PATH:$DAKOTA_DIR/bin"
export MANPATH="$MANPATH:$MPI_DIR/man:$DAKOTA_DIR/docs/man:$DAKOTA_DIR/docs/man-ref"

#Qhull
export QHULL_DIR
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$QHULL_DIR/lib"
export LD_RUN_PATH="$LD_RUN_PATH:$QHULL_DIR/lib"

#Doxygen
export DOXYGEN_DIR
MANPATH="$MANPATH:$DOXYGEN_DIR/man"
PATH="$PATH:$DOXYGEN_DIR/bin"

#MTOC
export MTOC_DIR
PATH="$PATH:$MTOC_DIR"

#MATLAB
export MATLAB_DIR
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$MATLAB_DIR/bin/glnxa64"
export LD_RUN_PATH="$LD_RUN_PATH:$MATLAB_DIR/bin/glnxa64"
PATH="$PATH:$MATLAB_DIR/bin"

#TRIANGLE
export TRIANGLE_DIR

#METIS
export METIS_DIR
	
#BLAS
export BLAS_DIR

#LAPACK
export LAPACK_DIR

#SCALAPACK
export SCALAPACK_DIR

#PLAPACK
export PLAPACK_DIR

#BLACS
export BLACS_DIR

#YAMS
export YAMS_DIR
PATH="$PATH:$YAMS_DIR"

#BAMG
export BAMG_DIR
PATH="$PATH:$BAMG_DIR"

#TEX2IM
export TEX2IM_DIR
PATH="$PATH:$TEX2IM_DIR"

#SOWING
export SOWING_DIR
PATH="$PATH:$SOWING_DIR/bin"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$SOWING_DIR/lib"
export LD_RUN_PATH="$LD_RUN_PATH:$SOWING_DIR/lib"
export MANPATH="$MANPATH:$SOWING_DIR/man"

#LATEX2RTF
export RTFPATH="$ISSM_DIR/externalpackages/latex2rtf/cfg"

#AUTOCONF
export AUTOCONF_DIR
PATH="$PATH:$AUTOCONF_DIR/bin"

#AUTOMAKE
export AUTOMAKE_DIR
PATH="$PATH:$AUTOMAKE_DIR/bin"

#BORLAND
export BORLAND_DIR
PATH="$PATH:$BORLAND_DIR/Bin"

#INTEL
#export INTEL_DIR
#PATH="$PATH:$INTEL_DIR"
#source $ISSM_DIR/externalpackages/intel/intel.sh

#SDK
export SDK_DIR
PATH="$PATH:$SDK_DIR"

#SSH
export SSH_DIR
PATH="$PATH:$SSH_DIR"

#VALGRIND
export VALGRIND_DIR
PATH="$PATH:$VALGRIND_DIR"

#GRAPHVIZ
export GRAPHVIZ_DIR
PATH="$PATH:$GRAPHVIZ_DIR"

#CPPCHECK
export CPPCHECK_DIR
PATH="$PATH:$CPPCHECK_DIR"
