Environment variables for zsh

Environment variables for zsh

Hi!

I just installed the Intel Fortran compiler, as a part of Intel Composer XE, and I am using the zsh shell. In the post-install notes, I am recommended to
$ source /opt/intel/bin/compilervars.sh ia32
but this returns an error in zsh, for the file /opt/intel/composerxe-2011/mkl/bin/mklvars.sh, on line 40. This file is of course written for bash.

The error just results from a slight syntax discrepancy between zsh and bash. I have posted below a corrected version of the file, which I believe does work as intended for zsh (I haven't had any errors, and have compiled a few times with it), but it may not be bulletproof. I hope it will be useful for someone. Maybe after a thorough inspection, it could be included with the compiler installation as a separate post-install command for those using zsh.

- smund Ervik

#! /bin/sh
#
# Copyright (C) 2003-2010 Intel Corporation. All rights reserved.
#
# The information and source code contained herein is the exclusive property
# of Intel Corporation and may not be disclosed, examined, or reproduced in
# whole or in part without explicit written authorization from the Company.
#

export MKLROOT=/opt/intel/composerxe-2011.0.084/mkl

CPRO_PATH=${MKLROOT/\\/mkl/}

MOD_NAME=mod

SCRIPT_NAME=$0
MKL_LP64_ILP64=
MKL_MOD=
MKL_TARGET_ARCH=
MKL_VERBOSE=

mkl_help() {
echo ""
echo "Syntax:"
echo " $SCRIPT_NAME [MKL_interface] [${MOD_NAME}]"
echo ""
echo " must be one of the following"
echo " ia32 : Set up for IA-32 target"
echo " intel64 : Set up for Intel 64 target"
echo ""
echo " ${MOD_NAME} (optional) - set path to MKL F95 modules"
echo ""
echo " MKL_interface (optional) - MKL programming interface for intel64"
echo " Not applicable without ${MOD_NAME}"
echo " lp64 : 4 bytes integer (default)"
echo " ilp64 : 8 bytes integer"
echo ""
}

if ; then
mkl_help
else

BAD_SWITCH=""
while [ $1 ]; do
if ; then MKL_TARGET_ARCH=ia32;
elif ; then MKL_TARGET_ARCH=intel64;
elif ; then MKL_LP64_ILP64=lp64;
elif ; then MKL_LP64_ILP64=ilp64;
elif ; then MKL_MOD=${MOD_NAME};
elif ; then MKL_VERBOSE=verbose;
else
BAD_SWITCH=$1
break 10
fi
shift;
done

if ; then

echo
echo "ERROR: Unknown switch '${BAD_SWITCH}'"
mkl_help

else

if ; then

echo
echo "ERROR: architecture is not defined. Accepted values: ia32, intel64"
mkl_help

else # main path

if ; then OLD_LD_LIBRARY_PATH=":${LD_LIBRARY_PATH}"; fi
export LD_LIBRARY_PATH="${CPRO_PATH}/compiler/lib/${MKL_TARGET_ARCH}:${MKLROOT}/lib/${MKL_TARGET_ARCH}${OLD_LD_LIBRARY_PATH}"

if ; then OLD_LIBRARY_PATH=":${LIBRARY_PATH}"; fi
export LIBRARY_PATH="${CPRO_PATH}/compiler/lib/${MKL_TARGET_ARCH}:${MKLROOT}/lib/${MKL_TARGET_ARCH}${OLD_LIBRARY_PATH}"

if ; then OLD_NLSPATH=":${NLSPATH}"; fi
export NLSPATH="${MKLROOT}/lib/${MKL_TARGET_ARCH}/locale/%l_%t/%N${OLD_NLSPATH}"

if ; then
export MANPATH="${CPRO_PATH}/man/en_US:`manpath`"
else
export MANPATH="${CPRO_PATH}/man/en_US:${MANPATH}"
fi

if ; then OLD_INCLUDE=":${INCLUDE}"; fi
export INCLUDE="${MKLROOT}/include${OLD_INCLUDE}"

if ; then OLD_CPATH=":${CPATH}"; fi
export CPATH="${MKLROOT}/include${OLD_CPATH}"

if ; then
if ; then
MKL_LP64_ILP64=
else
if ; then
MKL_LP64_ILP64=lp64
fi
fi
MKL_MOD=:${MKLROOT}/include/${MKL_TARGET_ARCH}/${MKL_LP64_ILP64}
fi
if ; then OLD_FPATH=":${FPATH}"; fi
export FPATH="${MKLROOT}/include${MKL_MOD}${OLD_FPATH}"

########

if ; then
echo LD_LIBRARY_PATH=${LD_LIBRARY_PATH}
echo LIBRARY_PATH=${LIBRARY_PATH}
echo NLSPATH=${NLSPATH}
echo MANPATH=${MANPATH}
echo INCLUDE=${INCLUDE}
echo FPATH=${FPATH}
echo CPATH=${CPATH}
fi
fi
fi
fi

1 post / 0 new
For more complete information about compiler optimizations, see our Optimization Notice.