diff --git a/etc/settings.csh b/etc/settings.csh
index b895263ba856bcf7ae97b5951e952e58a510d5b1..4bde0e7ee0e516c59943f3ee66bca89957abd5fc 100644
--- a/etc/settings.csh
+++ b/etc/settings.csh
@@ -137,8 +137,7 @@ case OpenFOAM:
         _foamAddPath    $gccDir/bin
 
         # 64-bit needs lib64, but 32-bit needs lib (not lib32)
-        if ( "$WM_ARCH_OPTION" = 64 ) then
-        then
+        if ($WM_ARCH_OPTION == 64) then
             _foamAddLib     $gccDir/lib$WM_COMPILER_LIB_ARCH
         else
             _foamAddLib     $gccDir/lib
@@ -150,7 +149,6 @@ case OpenFOAM:
 
         # add in mpc libraries (not need for older gcc)
         if ( $?mpc_version ) then
-        then
             _foamAddLib     $mpcDir/lib
         endif
 
@@ -209,18 +207,14 @@ case OPENMPI:
     breaksw
 
 case SYSTEMOPENMPI:
-    # This uses the installed openmpi. It needs mpicc installed!
+    # use the system installed openmpi, get library directory via mpicc
     set mpi_version=openmpi-system
-
-    # Set compilation flags here instead of in wmake/rules/../mplibSYSTEMOPENMPI
-    setenv PINC `mpicc --showme:compile`
-    setenv PLIBS `mpicc --showme:link`
-    set libDir=`echo "$PLIBS" | sed -e 's/.*-L\([^ ]*\).*/\1/'`
+    set libDir=`mpicc --showme:link | sed -e 's/.*-L\([^ ]*\).*/\1/'`
 
     if ($?FOAM_VERBOSE && $?prompt) then
-        echo "Using system installed MPI:"
-        echo "    compile flags : $PINC"
-        echo "    link flags    : $PLIBS"
+        echo "Using system installed OpenMPI:"
+        echo "    compile flags : `mpicc --showme:compile`"
+        echo "    link flags    : `mpicc --showme:link`"
         echo "    libmpi dir    : $libDir"
     endif
 
diff --git a/etc/settings.sh b/etc/settings.sh
index 37ecb1f2a10339089e644c59f9c7c0d05c0c3242..17f029539a8b020e292981c3f117a319c9c2058b 100644
--- a/etc/settings.sh
+++ b/etc/settings.sh
@@ -235,19 +235,15 @@ OPENMPI)
     ;;
 
 SYSTEMOPENMPI)
-    # This uses the installed openmpi. It needs mpicc installed!
+    # use the system installed openmpi, get library directory via mpicc
     mpi_version=openmpi-system
-
-    # Set compilation flags here instead of in wmake/rules/../mplibSYSTEMOPENMPI
-    export PINC=`mpicc --showme:compile`
-    export PLIBS=`mpicc --showme:link`
-    libDir=`echo "$PLIBS" | sed -e 's/.*-L\([^ ]*\).*/\1/'`
+    libDir=`mpicc --showme:link | sed -e 's/.*-L\([^ ]*\).*/\1/'`
 
     if [ "$FOAM_VERBOSE" -a "$PS1" ]
     then
-        echo "Using system installed MPI:"
-        echo "    compile flags : $PINC"
-        echo "    link flags    : $PLIBS"
+        echo "Using system installed OpenMPI:"
+        echo "    compile flags : `mpicc --showme:compile`"
+        echo "    link flags    : `mpicc --showme:link`"
         echo "    libmpi dir    : $libDir"
     fi
 
diff --git a/wmake/rules/General/mplibSYSTEMOPENMPI b/wmake/rules/General/mplibSYSTEMOPENMPI
index 98fa814ce323af227f6c1a585feb5c9d5f1312b2..639c8ce27798588b71921b3d12986a95c5dcc480 100644
--- a/wmake/rules/General/mplibSYSTEMOPENMPI
+++ b/wmake/rules/General/mplibSYSTEMOPENMPI
@@ -1 +1,5 @@
+# use the system installed openmpi - mpicc must be installed
+
 PFLAGS     = -DOMPI_SKIP_MPICXX
+PINC       = $(shell mpicc --showme:compile)
+PLIBS      = $(shell mpicc --showme:link)