diff --git a/sit b/sit index 2f6e92e..d40a8f4 100755 --- a/sit +++ b/sit @@ -20,7 +20,7 @@ source "$SIT_PATH/functions.sh" # compiler to use # (gnu|intel|pgi) -COMPILER=${COMPILER:=gnu} +COMPILER=${COMPILER:=system} # use specific compiler version COMPILER_VERSION=${COMPILER_VERSION:=} @@ -29,19 +29,25 @@ COMPILER_VERSION=${COMPILER_VERSION:=} PACKAGE_DESCRIPTOR=${PACKAGE_DESCRIPTOR:+-$PACKAGE_DESCRIPTOR} - # Compiler specifications -if [ -z "$COMPILER_VERSION" ] ; then - COMPILER_MODULE=compiler/${COMPILER} -else - COMPILER_MODULE=compiler/${COMPILER}/${COMPILER_VERSION} +if [ "$COMPILER" == "system" ] ; then + echo "Using system default compiler" +else + if [ -z "$COMPILER_VERSION" ] ; then + COMPILER_MODULE=compiler/${COMPILER} + else + COMPILER_MODULE=compiler/${COMPILER}/${COMPILER_VERSION} + fi + + echo "Loading compiler module ${COMPILER_MODULE}" + module load ${COMPILER_MODULE} fi -echo "Loading compiler module ${COMPILER_MODULE}" -module load ${COMPILER_MODULE} - case ${COMPILER} in + system) + COMPILER="" # prevent any compiler specs in the prefix + ;; gnu) COMPILER_OPTS="CC=gcc CXX=g++ FC=gfortran F77=gfortran" if [ "x${COMPILER_VERSION}" == "x" ] ; then @@ -64,8 +70,11 @@ case ${COMPILER} in echo "Unknown compiler ${COMPILER}." ;; esac + # make the compiler variables CC, CXX, FC and F77 available -export ${COMPILER_OPTS} +if [ ! -z $COMPILER_OPTS ] ; then + export ${COMPILER_OPTS} +fi if [ ! -z "$MPI" ] ; then MPI_MODULE="mpi/$MPI"