#######################################################################
# 
#
#	lic_setup is a file to be sourced by all scripts 
#       which need to setup the license environment for MSI
#       products
#
#######################################################################

#Set location of release specific license data
setenv MSI_LIC_INFO_DIR %MSIInstallRoot%/CHECKSUM


### License Pack setup ###

#Set location of license pack (release-independent license data)
if ($?LP_OVERRIDE) then
   setenv MSI_LIC_PACK_DIR $LP_OVERRIDE
else if (-e %MSI_License_Pack_Dir%) then
   setenv MSI_LIC_PACK_DIR %MSI_License_Pack_Dir%
endif

if ($?MSI_LIC_PACK_DIR) then
   source $MSI_LIC_PACK_DIR/msi_lic_cshrc
   goto skip
endif

### Non-license pack setup ###

#Use LM_OVERRIDE if exists otherwise set LM_LICENSE_FILE
if ($?LM_OVERRIDE) then
   setenv LM_LICENSE_FILE "$LM_OVERRIDE"
else if !($?LM_LICENSE_FILE) then
   setenv LM_LICENSE_FILE "%MSIInstallRoot%/license/msilicense.dat:%MSIInstallRoot%/license/msilicense.demo"
else
   setenv LM_LICENSE_FILE "${LM_LICENSE_FILE}:%MSIInstallRoot%/license/msilicense.dat:%MSIInstallRoot%/license/msilicense.demo"
endif

if (-e %MSIInstallRoot%/libs/libpub_lic.so) then
   set lic_ldpath  = "%MSIInstallRoot%/libs"
endif

#Set library path to find licensing dsos
if ($?LD_LIBRARY_PATH) then
   echo $LD_LIBRARY_PATH | grep ${lic_ldpath}  >& /dev/null
   if ($status) then
      setenv LD_LIBRARY_PATH "${lic_ldpath}:${LD_LIBRARY_PATH}"
   endif
else if ($lic_ldpath != "") then
   setenv LD_LIBRARY_PATH "${lic_ldpath}"
endif

### If license pack exists then above section is skipped

skip:
