From bc0b02c65187b84083378743dd228b1ba5daec12 Mon Sep 17 00:00:00 2001
From: Mark Olesen <Mark.Olesen@esi-group.com>
Date: Tue, 17 Dec 2019 11:48:25 +0100
Subject: [PATCH] CONFIG: permit an empty value for WM_COMPILE_OPTION,
 WM_COMPILER_TYPE

- an empty WM_COMPILE_OPTION is treated internally (in make rules)
  like "Opt"

- an empty WM_COMPILER_TYPE is treated like "system" (system compiler)
---
 Allwmake                | 4 ++--
 etc/config.csh/settings | 5 +++--
 etc/config.sh/settings  | 5 ++---
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/Allwmake b/Allwmake
index c2af53bf4b8..d46c7c6e575 100755
--- a/Allwmake
+++ b/Allwmake
@@ -32,7 +32,7 @@ echo
 echo "========================================"
 date "+%Y-%m-%d %H:%M:%S %z" 2>/dev/null || echo "date is unknown"
 echo "Starting compile ${WM_PROJECT_DIR##*/} ${0##*/}"
-echo "  $WM_COMPILER $WM_COMPILER_TYPE compiler"
+echo "  $WM_COMPILER ${WM_COMPILER_TYPE:-system} compiler"
 echo "  ${WM_OPTIONS}, with ${WM_MPLIB} ${FOAM_MPI}"
 echo "========================================"
 echo
@@ -79,7 +79,7 @@ echo
 date "+%Y-%m-%d %H:%M:%S %z" 2>/dev/null || echo "date is unknown"
 echo "========================================"
 echo "  ${WM_PROJECT_DIR##*/}"
-echo "  $WM_COMPILER $WM_COMPILER_TYPE compiler"
+echo "  $WM_COMPILER ${WM_COMPILER_TYPE:-system} compiler"
 echo "  ${WM_OPTIONS}, with ${WM_MPLIB} ${FOAM_MPI}"
 echo
 echo "  api   = $(foamEtcFile -show-api 2>/dev/null)"
diff --git a/etc/config.csh/settings b/etc/config.csh/settings
index 8f6677e4ef2..206846e18ff 100644
--- a/etc/config.csh/settings
+++ b/etc/config.csh/settings
@@ -21,7 +21,6 @@
 #
 #------------------------------------------------------------------------------
 setenv WM_ARCH `uname -s`                   # System name
-if (! $?WM_COMPILE_OPTION ) setenv WM_COMPILE_OPTION Opt  # Default: Optimize
 
 set archOption=64
 if ($?WM_ARCH_OPTION) then
@@ -31,6 +30,7 @@ endif
 unsetenv WM_ARCH_OPTION     # Compiling 32-bit on 64-bit system
 setenv WM_COMPILER_ARCH     # Host compiler type (when different than target)
 setenv WM_COMPILER_LIB_ARCH # Additional ending for lib directories
+if (! $?WM_COMPILE_OPTION ) setenv WM_COMPILE_OPTION
 
 # Adjust according to system and architecture
 switch ($WM_ARCH)
@@ -299,9 +299,10 @@ CLANG_NOT_FOUND
     endif
     breaksw
 
+case -*:
 case system-*:
 case ThirdParty-*:
-    # Using system compiler or other ThirdParty compiler
+    # Using empty (system), system compiler or other ThirdParty compiler
     breaksw
 
 default:
diff --git a/etc/config.sh/settings b/etc/config.sh/settings
index f208a7b3510..8b3ba1248fc 100644
--- a/etc/config.sh/settings
+++ b/etc/config.sh/settings
@@ -21,7 +21,6 @@
 #
 #------------------------------------------------------------------------------
 export WM_ARCH="$(uname -s)"                # System name
-: ${WM_COMPILE_OPTION:=Opt}; export WM_COMPILE_OPTION  # Default: Optimize
 
 archOption="${WM_ARCH_OPTION:-64}"
 unset WM_ARCH_OPTION        # Compiling 32-bit on 64-bit system
@@ -290,8 +289,8 @@ CLANG_NOT_FOUND
     fi
     ;;
 
-system-* | ThirdParty-*)
-    # Using system compiler or other ThirdParty compiler
+-* | system-* | ThirdParty-*)
+    # Using empty (system), system compiler or other ThirdParty compiler
     ;;
 
 *)
-- 
GitLab