#! /bin/tcsh -ef

#
# tcl_setup
#
# Setup for apps using Tcl/Tk/Tix/BLT package included with Freesurfer
#
# Original Author: Nick Schmansky
# CVS Revision Info:
#    $Author: nicks $
#    $Date: 2007/05/01 21:53:42 $
#    $Revision: 1.4 $
#
# Copyright (C) 2002-2007,
# The General Hospital Corporation (Boston, MA).
# All rights reserved.
#
# Distribution, usage and copying of this software is covered under the
# terms found in the License Agreement file named 'COPYING' found in the
# FreeSurfer source code root directory, and duplicated here:
# https://surfer.nmr.mgh.harvard.edu/fswiki/FreeSurferOpenSourceLicense
#
# General inquiries: freesurfer@nmr.mgh.harvard.edu
# Bug reports: analysis-bugs@nmr.mgh.harvard.edu
#


### --  use NMR Center Tcl/Tk/Tix/BLT package -- ####

if ( $?FREESURFER_HOME ) then
  if ( -e $FREESURFER_HOME/lib/tcltktixblt ) then
    set FS_TCL_HOME=$FREESURFER_HOME/lib/tcltktixblt
  else if ( -e /usr/pubsw/packages/tcltktixblt/current ) then
    set FS_TCL_HOME=/usr/pubsw/packages/tcltktixblt/current
  endif
else if ( -e /usr/pubsw/packages/tcltktixblt/current ) then
  set FS_TCL_HOME=/usr/pubsw/packages/tcltktixblt/current
endif

if ( $?FS_TCL_HOME ) then

  if ( -e $FS_TCL_HOME/bin ) then
    setenv PATH "$FS_TCL_HOME/bin":"$PATH"
  endif

  if ( -e $FS_TCL_HOME/lib ) then
    setenv TCLLIBPATH $FS_TCL_HOME/lib
    if ( -e $TCLLIBPATH/tcl8.3 ) setenv TCL_LIBRARY $TCLLIBPATH/tcl8.3
    if ( -e $TCLLIBPATH/tcl8.4 ) setenv TCL_LIBRARY $TCLLIBPATH/tcl8.4
    if ( -e $TCLLIBPATH/tk8.3 ) setenv TK_LIBRARY $TCLLIBPATH/tk8.3
    if ( -e $TCLLIBPATH/tk8.4 ) setenv TK_LIBRARY $TCLLIBPATH/tk8.4
    setenv TIX_LIBRARY $TCLLIBPATH/tix8.1
    setenv BLT_LIBRARY $TCLLIBPATH/blt2.4
    if(! $?LD_LIBRARY_PATH ) then
      setenv LD_LIBRARY_PATH $TCLLIBPATH
    else
      setenv LD_LIBRARY_PATH "$TCLLIBPATH":"$LD_LIBRARY_PATH"
    endif
    if(! $?DYLD_LIBRARY_PATH ) then
      setenv DYLD_LIBRARY_PATH $TCLLIBPATH
    else
      setenv DYLD_LIBRARY_PATH "$TCLLIBPATH":"$DYLD_LIBRARY_PATH"
    endif
  endif

  # default: assume platform has Tcl/Tk/Tix/BLT libs installed somewhere
endif
