diff --git a/bin/tools/foamConfigurePaths b/bin/tools/foamConfigurePaths index 03859f4ce7..11715dad27 100755 --- a/bin/tools/foamConfigurePaths +++ b/bin/tools/foamConfigurePaths @@ -7,7 +7,7 @@ # \\/ M anipulation | #------------------------------------------------------------------------------ # Copyright (C) 2011-2016 OpenFOAM Foundation -# Copyright (C) 2016-2020 OpenCFD Ltd. +# Copyright (C) 2016-2021 OpenCFD Ltd. #------------------------------------------------------------------------------ # License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later. @@ -55,6 +55,8 @@ Equivalent options: -scotch-path --scotchArchPath | -scotchArchPath -system-compiler -system -third-compiler -third + -openmpi-system -sys-openmpi + -openmpi-third -openmpi HELP_COMPAT exit 0 # A clean exit @@ -89,10 +91,9 @@ Compiler mpc-VERSION For ThirdParty gcc (mpc-system for system library) MPI - -mpi NAME specify 'WM_MPLIB' type (eg, INTELMPI, etc) - -openmpi VER use ThirdParty openmpi, with version for 'FOAM_MPI' - -openmpi-system use system openmpi - -openmpi-third use ThirdParty openmpi (using default version) + -mpi=NAME Specify 'WM_MPLIB' type (eg, INTELMPI, etc) + -openmpi[=VER] Use ThirdParty openmpi, with version for 'FOAM_MPI' + -sys-openmpi[=MAJ] Use system openmpi, with specified major version Components versions (ThirdParty) -adios VER specify 'adios2_version' @@ -212,12 +213,13 @@ _inlineSed() # Local filename (for reporting) localFile="$(echo "$file" | sed -e "s#^$projectDir/##")" - grep -q "$regexp" "$file" && sed -i -e "$cmd" "$file" || { \ + if grep -q "$regexp" "$file" && sed -i -e "$cmd" "$file" + then + [ -n "$msg" ] && echo " $msg ($localFile)" + else echo "Failed: ${msg:-replacement} in $localFile" return 1 - } - - [ -n "$msg" ] && echo " $msg ($localFile)" + fi return 0 } @@ -278,8 +280,8 @@ replaceEtc() local file="$1" shift - file=$(_foamEtc "$file") - replace $file "$@" + file="$(_foamEtc "$file")" + replace "$file" "$@" } @@ -289,24 +291,36 @@ replaceEtcCsh() local file="$1" shift - file=$(_foamEtc "$file") - replaceCsh $file "$@" + file="$(_foamEtc "$file")" + replaceCsh "$file" "$@" } # Get the option's value (argument), or die on missing or empty argument # $1 option # $2 value + +# Returns values via optValue, nOptArgs variables!! +optValue="" +nOptArgs=0 # The number of args to shift + getOptionValue() { - local value="$2" - [ -n "$value" ] || die "'$1' option requires an argument" + optValue="${1#*=}" + if [ "$optValue" = "$1" ] + then + # Eg, -option value + optValue="$2" + [ -n "$optValue" ] || die "'$1' option requires an argument" + nOptArgs=1 + else + # Eg, -option=value + nOptArgs=0 + fi # Remove any surrounding double quotes - value="${value%\"}" - value="${value#\"}" - - echo "$value" + optValue="${optValue%\"}" + optValue="${optValue#\"}" } @@ -366,7 +380,7 @@ removeCshMagic() #------------------------------------------------------------------------------ -unset adjusted optMpi +unset adjusted # Parse options while [ "$#" -gt 0 ] do @@ -420,26 +434,37 @@ CONFIG_CSH export FOAM_CONFIG_ETC="${1#*=}" ;; - -project-path) + -project-path=* | -project-path) # Replace WM_PROJECT_DIR=... - optionValue=$(getOptionValue "$@") - replaceEtc bashrc WM_PROJECT_DIR "\"$optionValue\"" - replaceEtcCsh cshrc WM_PROJECT_DIR "\"$optionValue\"" + getOptionValue "$@" + shift "${nOptArgs:-0}" - removeBashMagic $(_foamEtc bashrc) - removeCshMagic $(_foamEtc cshrc) + if [ -n "$optValue" ] + then + replaceEtc bashrc WM_PROJECT_DIR "\"$optValue\"" + replaceEtcCsh cshrc WM_PROJECT_DIR "\"$optValue\"" - adjusted=true - shift + removeBashMagic "$(_foamEtc bashrc)" + removeCshMagic "$(_foamEtc cshrc)" + adjusted=true + else + : "${adjusted:=empty}" + fi ;; - -version | -foamVersion | --projectVersion) + -version=* | -version | -foamVersion | --projectVersion) # Replace WM_PROJECT_VERSION=... - optionValue=$(getOptionValue "$@") - replaceEtc bashrc WM_PROJECT_VERSION "$optionValue" - replaceEtcCsh cshrc WM_PROJECT_VERSION "$optionValue" - adjusted=true - shift + getOptionValue "$@" + shift "${nOptArgs:-0}" + + if [ -n "$optValue" ] + then + replaceEtc bashrc WM_PROJECT_VERSION "$optValue" + replaceEtcCsh cshrc WM_PROJECT_VERSION "$optValue" + adjusted=true + else + : "${adjusted:=empty}" + fi ;; -sp | -SP | -float32) @@ -465,131 +490,168 @@ CONFIG_CSH -int32 | -int64) # Replace WM_LABEL_SIZE=... - optionValue="${1#-int}" - replaceEtc bashrc WM_LABEL_SIZE "$optionValue" - replaceEtcCsh cshrc WM_LABEL_SIZE "$optionValue" + optValue="${1#-int}" + replaceEtc bashrc WM_LABEL_SIZE "$optValue" + replaceEtcCsh cshrc WM_LABEL_SIZE "$optValue" adjusted=true ;; ## Compiler ## - -clang) + -clang=* | -clang) # Replace default_clang_version=... - optionValue=$(getOptionValue "$@") - replaceEtc config.sh/compiler default_clang_version "$optionValue" - replaceEtc config.csh/compiler default_clang_version "$optionValue" - adjusted=true - shift + getOptionValue "$@" + shift "${nOptArgs:-0}" + + if [ -n "$optValue" ] + then + replaceEtc config.sh/compiler default_clang_version "$optValue" + replaceEtc config.csh/compiler default_clang_version "$optValue" + adjusted=true + else + : "${adjusted:=empty}" + fi ;; - -gcc) + -gcc=* | -gcc) # Replace default_gcc_version=... - optionValue=$(getOptionValue "$@") - replaceEtc config.sh/compiler default_gcc_version "$optionValue" - replaceEtc config.csh/compiler default_gcc_version "$optionValue" - adjusted=true - shift + getOptionValue "$@" + shift "${nOptArgs:-0}" + + if [ -n "$optValue" ] + then + replaceEtc config.sh/compiler default_gcc_version "$optValue" + replaceEtc config.csh/compiler default_gcc_version "$optValue" + adjusted=true + else + : "${adjusted:=empty}" + fi ;; -system-compiler | -system) # Replace WM_COMPILER_TYPE=... and WM_COMPILER=... - optionValue=$(getOptionValue "$@") - replaceEtc bashrc \ - WM_COMPILER_TYPE system \ - WM_COMPILER "$optionValue" - replaceEtcCsh cshrc \ - WM_COMPILER_TYPE system \ - WM_COMPILER "$optionValue" - adjusted=true - shift + getOptionValue "$@" + shift "${nOptArgs:-0}" + + if [ -n "$optValue" ] + then + replaceEtc bashrc \ + WM_COMPILER_TYPE system \ + WM_COMPILER "$optValue" + replaceEtcCsh cshrc \ + WM_COMPILER_TYPE system \ + WM_COMPILER "$optValue" + adjusted=true + else + : "${adjusted:=empty}" + fi ;; -third-compiler | -third | -ThirdParty) # Replace WM_COMPILER_TYPE=... and WM_COMPILER=... - optionValue=$(getOptionValue "$@") - replaceEtc bashrc \ - WM_COMPILER_TYPE ThirdParty \ - WM_COMPILER "$optionValue" - replaceEtcCsh cshrc \ - WM_COMPILER_TYPE ThirdParty \ - WM_COMPILER "$optionValue" - adjusted=true - shift + getOptionValue "$@" + shift "${nOptArgs:-0}" + + if [ -n "$optValue" ] + then + replaceEtc bashrc \ + WM_COMPILER_TYPE ThirdParty \ + WM_COMPILER "$optValue" + replaceEtcCsh cshrc \ + WM_COMPILER_TYPE ThirdParty \ + WM_COMPILER "$optValue" + adjusted=true + else + : "${adjusted:=empty}" + fi ;; gmp-[4-9]* | gmp-system) # gcc-related package - replaceEtc config.sh/compiler default_gmp_version "$1" - replaceEtc config.csh/compiler default_gmp_version "$1" + optValue="${1#-}" + replaceEtc config.sh/compiler default_gmp_version "$optValue" + replaceEtc config.csh/compiler default_gmp_version "$optValue" adjusted=true ;; mpfr-[2-9]* | mpfr-system) # gcc-related package - replaceEtc config.sh/compiler default_mpfr_version "$1" - replaceEtc config.csh/compiler default_mpfr_version "$1" + optValue="${1#-}" + replaceEtc config.sh/compiler default_mpfr_version "$optValue" + replaceEtc config.csh/compiler default_mpfr_version "$optValue" adjusted=true ;; mpc-[0-9]* | mpc-system) # gcc-related package - replaceEtc config.sh/compiler default_mpc_version "$1" - replaceEtc config.csh/compiler default_mpc_version "$1" + optValue="${1#-}" + replaceEtc config.sh/compiler default_mpc_version "$optValue" + replaceEtc config.csh/compiler default_mpc_version "$optValue" adjusted=true ;; ## MPI ## - -mpi) + -mpi=* | -mpi) # Explicitly set WM_MPLIB=... - optionValue=$(getOptionValue "$@") - replaceEtc bashrc WM_MPLIB "$optionValue" - replaceEtcCsh cshrc WM_MPLIB "$optionValue" - optMpi=system - adjusted=true - shift + getOptionValue "$@" + shift "${nOptArgs:-0}" + + if [ -n "$optValue" ] + then + replaceEtc bashrc WM_MPLIB "$optValue" + replaceEtcCsh cshrc WM_MPLIB "$optValue" + adjusted=true + else + : "${adjusted:=empty}" + fi ;; - -openmpi) - # Replace FOAM_MPI=openmpi-.. and set to use third-party - # The edit is slightly fragile, but works - expected="openmpi-[1-9][.0-9]*" - optMpi=$(getOptionValue "$@") - - _matches "$optMpi" "$expected" || \ - die "'$1' has bad value: '$optMpi'" - - _inlineSed $(_foamEtc config.sh/mpi) \ - "FOAM_MPI=$expected" \ - "FOAM_MPI=$optMpi" \ - "Replaced 'FOAM_MPI=$expected' by 'FOAM_MPI=$optMpi'" - - _inlineSed $(_foamEtc config.csh/mpi) \ - "FOAM_MPI $expected" \ - "FOAM_MPI $optMpi" \ - "Replaced 'FOAM_MPI $expected' by 'FOAM_MPI $optMpi'" - - replaceEtc bashrc WM_MPLIB OPENMPI - replaceEtcCsh cshrc WM_MPLIB OPENMPI - adjusted=true - shift - ;; - - -openmpi-system) + -sys-openmpi=* | -sys-openmpi | -openmpi-system) + optValue="$(echo "$1" | sed -ne 's/^.*mpi=\([1-9][0-9]*\).*/\1/p')" # Explicitly set WM_MPLIB=SYSTEMOPENMPI - replaceEtc bashrc WM_MPLIB SYSTEMOPENMPI - replaceEtcCsh cshrc WM_MPLIB SYSTEMOPENMPI - optMpi=system - adjusted=true + if [ -n "$optValue" ] + then + replaceEtc bashrc WM_MPLIB SYSTEMOPENMPI"$optValue" + replaceEtcCsh cshrc WM_MPLIB SYSTEMOPENMPI"$optValue" + adjusted=true + else + : "${adjusted:=empty}" + fi ;; - -openmpi-third) - # Explicitly set WM_MPLIB=OPENMPI, using default setting for openmpi + -openmpi=* | -openmpi | -openmpi-third) + # Explicitly set WM_MPLIB=OPENMPI + # - use default setting for openmpi, or + # replace FOAM_MPI=openmpi-.. + # The edit is slightly fragile, but works + + expected="openmpi-[1-9][.0-9]*" + optValue="$(echo "$1" | sed -ne 's/^.*mpi=//p')" + if [ -n "$optValue" ] + then + if [ "${optValue#openmpi-}" = "$optValue" ] + then + optValue="openmpi-$optValue" + fi + + _matches "$optValue" "$expected" || \ + die "'${1%=*}' has bad value: '$optValue'" + + _inlineSed "$(_foamEtc config.sh/mpi)" \ + "FOAM_MPI=$expected" \ + "FOAM_MPI=$optValue" \ + "Replaced 'FOAM_MPI=$expected' by 'FOAM_MPI=$optValue'" + + _inlineSed "$(_foamEtc config.csh/mpi)" \ + "FOAM_MPI=$expected" \ + "FOAM_MPI=$optValue" \ + "Replaced 'FOAM_MPI $expected' by 'FOAM_MPI $optValue'" + fi replaceEtc bashrc WM_MPLIB OPENMPI replaceEtcCsh cshrc WM_MPLIB OPENMPI - optMpi=third adjusted=true ;; @@ -598,146 +660,242 @@ CONFIG_CSH -adios | -adios2) # Replace adios2_version=... - optionValue=$(getOptionValue "$@") - replaceEtc config.sh/adios2 adios2_version "$optionValue" - replaceEtc config.csh/adios2 adios2_version "$optionValue" - adjusted=true - shift + getOptionValue "$@" + shift "${nOptArgs:-0}" + + if [ -n "$optValue" ] + then + replaceEtc config.sh/adios2 adios2_version "$optValue" + replaceEtc config.csh/adios2 adios2_version "$optValue" + adjusted=true + else + : "${adjusted:=empty}" + fi ;; -adios-path | -adios2-path) # Replace ADIOS2_ARCH_PATH=... - optionValue=$(getOptionValue "$@") - replaceEtc config.sh/adios2 ADIOS2_ARCH_PATH "\"$optionValue\"" - replaceEtcCsh config.csh/adios2 ADIOS2_ARCH_PATH "\"$optionValue\"" - adjusted=true - shift + getOptionValue "$@" + shift "${nOptArgs:-0}" + + if [ -n "$optValue" ] + then + replaceEtc config.sh/adios2 ADIOS2_ARCH_PATH "\"$optValue\"" + replaceEtcCsh config.csh/adios2 ADIOS2_ARCH_PATH "\"$optValue\"" + adjusted=true + else + : "${adjusted:=empty}" + fi ;; -boost) # Replace boost_version=... (config is cgal or CGAL) - optionValue=$(getOptionValue "$@") + getOptionValue "$@" + shift "${nOptArgs:-0}" + cfgName=cgal; _foamEtc -q config.sh/"$cfgName" || cfgName=CGAL - replaceEtc config.sh/"$cfgName" boost_version "$optionValue" - replaceEtc config.csh/"$cfgName" boost_version "$optionValue" - adjusted=true - shift + if [ -n "$optValue" ] + then + replaceEtc config.sh/"$cfgName" boost_version "$optValue" + replaceEtc config.csh/"$cfgName" boost_version "$optValue" + adjusted=true + else + : "${adjusted:=empty}" + fi ;; -boost-path) # Replace BOOST_ARCH_PATH=... (config is cgal or CGAL) - optionValue=$(getOptionValue "$@") + getOptionValue "$@" + shift "${nOptArgs:-0}" + cfgName=cgal; _foamEtc -q config.sh/"$cfgName" || cfgName=CGAL - replaceEtc config.sh/"$cfgName" BOOST_ARCH_PATH "\"$optionValue\"" - replaceEtc config.csh/"$cfgName" BOOST_ARCH_PATH "\"$optionValue\"" - adjusted=true - shift + if [ -n "$optValue" ] + then + replaceEtc config.sh/"$cfgName" BOOST_ARCH_PATH "\"$optValue\"" + replaceEtc config.csh/"$cfgName" BOOST_ARCH_PATH "\"$optValue\"" + adjusted=true + else + : "${adjusted:=empty}" + fi ;; -cgal) # Replace cgal_version=... (config is cgal or CGAL) - optionValue=$(getOptionValue "$@") + getOptionValue "$@" + shift "${nOptArgs:-0}" + cfgName=cgal; _foamEtc -q config.sh/"$cfgName" || cfgName=CGAL - replaceEtc config.sh/"$cfgName" cgal_version "$optionValue" - replaceEtc config.csh/"$cfgName" cgal_version "$optionValue" - adjusted=true - shift + if [ -n "$optValue" ] + then + replaceEtc config.sh/"$cfgName" cgal_version "$optValue" + replaceEtc config.csh/"$cfgName" cgal_version "$optValue" + adjusted=true + else + : "${adjusted:=empty}" + fi ;; -cgal-path) # Replace CGAL_ARCH_PATH=... (config is cgal or CGAL) - optionValue=$(getOptionValue "$@") + getOptionValue "$@" + shift "${nOptArgs:-0}" + cfgName=cgal; _foamEtc -q config.sh/"$cfgName" || cfgName=CGAL - replaceEtc config.sh/"$cfgName" CGAL_ARCH_PATH "$optionValue" - replaceEtcCsh config.csh/"$cfgName" CGAL_ARCH_PATH "$optionValue" - adjusted=true - shift + if [ -n "$optValue" ] + then + replaceEtc config.sh/"$cfgName" CGAL_ARCH_PATH "$optValue" + replaceEtcCsh config.csh/"$cfgName" CGAL_ARCH_PATH "$optValue" + adjusted=true + else + : "${adjusted:=empty}" + fi ;; -fftw) # Replace fftw_version=... - optionValue=$(getOptionValue "$@") + getOptionValue "$@" + shift "${nOptArgs:-0}" + # config.sh/fftw or config.sh/FFTW cfgName=fftw; _foamEtc -q config.sh/"$cfgName" || cfgName=FFTW - replaceEtc config.sh/"$cfgName" fftw_version "$optionValue" - replaceEtc config.csh/"$cfgName" fftw_version "$optionValue" - adjusted=true - shift + if [ -n "$optValue" ] + then + replaceEtc config.sh/"$cfgName" fftw_version "$optValue" + replaceEtc config.csh/"$cfgName" fftw_version "$optValue" + adjusted=true + else + : "${adjusted:=empty}" + fi ;; -fftw-path) # Replace FFTW_ARCH_PATH=... - optionValue=$(getOptionValue "$@") + getOptionValue "$@" + shift "${nOptArgs:-0}" + # config.sh/fftw or config.sh/FFTW cfgName=fftw; _foamEtc -q config.sh/"$cfgName" || cfgName=FFTW - replaceEtc config.sh/"$cfgName" FFTW_ARCH_PATH "\"$optionValue\"" - replaceEtcCsh config.csh/"$cfgName" FFTW_ARCH_PATH "\"$optionValue\"" - adjusted=true - shift + if [ -n "$optValue" ] + then + replaceEtc config.sh/"$cfgName" FFTW_ARCH_PATH "\"$optValue\"" + replaceEtcCsh config.csh/"$cfgName" FFTW_ARCH_PATH "\"$optValue\"" + adjusted=true + else + : "${adjusted:=empty}" + fi ;; -cmake) # Replace cmake_version=... - optionValue=$(getOptionValue "$@") - replaceEtc config.sh/cmake cmake_version "$optionValue" - adjusted=true - shift + getOptionValue "$@" + shift "${nOptArgs:-0}" + + if [ -n "$optValue" ] + then + replaceEtc config.sh/cmake cmake_version "$optValue" + adjusted=true + else + : "${adjusted:=empty}" + fi ;; -cmake-path) # Replace CMAKE_ARCH_PATH=... - optionValue=$(getOptionValue "$@") - replaceEtc config.sh/cmake CMAKE_ARCH_PATH "$optionValue" - adjusted=true - shift + getOptionValue "$@" + shift "${nOptArgs:-0}" + + if [ -n "$optValue" ] + then + replaceEtc config.sh/cmake CMAKE_ARCH_PATH "$optValue" + adjusted=true + else + : "${adjusted:=empty}" + fi ;; -kahip) # Replace KAHIP_VERSION=... - optionValue=$(getOptionValue "$@") - replaceEtc config.sh/kahip KAHIP_VERSION "$optionValue" - adjusted=true - shift + getOptionValue "$@" + shift "${nOptArgs:-0}" + + if [ -n "$optValue" ] + then + replaceEtc config.sh/kahip KAHIP_VERSION "$optValue" + adjusted=true + else + : "${adjusted:=empty}" + fi ;; -kahip-path) # Replace KAHIP_ARCH_PATH=... - optionValue=$(getOptionValue "$@") - replaceEtc config.sh/kahip KAHIP_ARCH_PATH "\"$optionValue\"" - adjusted=true - shift + getOptionValue "$@" + shift "${nOptArgs:-0}" + + if [ -n "$optValue" ] + then + replaceEtc config.sh/kahip KAHIP_ARCH_PATH "\"$optValue\"" + adjusted=true + else + : "${adjusted:=empty}" + fi ;; -metis) # Replace METIS_VERSION=... - optionValue=$(getOptionValue "$@") - replaceEtc config.sh/metis METIS_VERSION "$optionValue" - adjusted=true - shift + getOptionValue "$@" + shift "${nOptArgs:-0}" + + if [ -n "$optValue" ] + then + replaceEtc config.sh/metis METIS_VERSION "$optValue" + adjusted=true + else + : "${adjusted:=empty}" + fi ;; -metis-path) # Replace METIS_ARCH_PATH=... - optionValue=$(getOptionValue "$@") - replaceEtc config.sh/metis METIS_ARCH_PATH "\"$optionValue\"" - adjusted=true - shift + getOptionValue "$@" + shift "${nOptArgs:-0}" + + if [ -n "$optValue" ] + then + replaceEtc config.sh/metis METIS_ARCH_PATH "\"$optValue\"" + adjusted=true + else + : "${adjusted:=empty}" + fi ;; -scotch | -scotchVersion | --scotchVersion) # Replace SCOTCH_VERSION=... - optionValue=$(getOptionValue "$@") - replaceEtc config.sh/scotch SCOTCH_VERSION "$optionValue" - adjusted=true - shift + getOptionValue "$@" + shift "${nOptArgs:-0}" + + if [ -n "$optValue" ] + then + replaceEtc config.sh/scotch SCOTCH_VERSION "$optValue" + adjusted=true + else + : "${adjusted:=empty}" + fi ;; -scotch-path | -scotchArchPath | --scotchArchPath) # Replace SCOTCH_ARCH_PATH=... - optionValue=$(getOptionValue "$@") - replaceEtc config.sh/scotch SCOTCH_ARCH_PATH "\"$optionValue\"" - adjusted=true - shift + getOptionValue "$@" + shift "${nOptArgs:-0}" + + if [ -n "$optValue" ] + then + replaceEtc config.sh/scotch SCOTCH_ARCH_PATH "\"$optValue\"" + adjusted=true + else + : "${adjusted:=empty}" + fi ;; @@ -746,107 +904,156 @@ CONFIG_CSH -paraview | -paraviewVersion | --paraviewVersion) # Replace ParaView_VERSION=... expected="[5-9][.0-9]*" # but also accept system - optionValue=$(getOptionValue "$@") - _matches "$optionValue" "$expected" || \ - [ "$optionValue" != "${optionValue%system}" ] || \ - die "'$1' has bad value: '$optionValue'" - replaceEtc config.sh/paraview ParaView_VERSION "$optionValue" - replaceEtc config.csh/paraview ParaView_VERSION "$optionValue" - adjusted=true - shift + getOptionValue "$@" + _matches "$optValue" "$expected" || \ + [ "$optValue" != "${optValue%system}" ] || \ + die "'${1%=*}' has bad value: '$optValue'" + + shift "${nOptArgs:-0}" + if [ -n "$optValue" ] + then + replaceEtc config.sh/paraview ParaView_VERSION "$optValue" + replaceEtc config.csh/paraview ParaView_VERSION "$optValue" + adjusted=true + else + : "${adjusted:=empty}" + fi ;; -paraview-qt) # Replace ParaView_QT=... - optionValue=$(getOptionValue "$@") - replaceEtc config.sh/paraview ParaView_QT "$optionValue" - replaceEtc config.csh/paraview ParaView_QT "$optionValue" - adjusted=true - shift + getOptionValue "$@" + shift "${nOptArgs:-0}" + + if [ -n "$optValue" ] + then + replaceEtc config.sh/paraview ParaView_QT "$optValue" + replaceEtc config.csh/paraview ParaView_QT "$optValue" + adjusted=true + else + : "${adjusted:=empty}" + fi ;; -paraview-path | -paraviewInstall | --paraviewInstall) # Replace ParaView_DIR=... - optionValue=$(getOptionValue "$@") - replaceEtc config.sh/paraview ParaView_DIR \""$optionValue\"" - replaceEtcCsh config.csh/paraview ParaView_DIR \""$optionValue\"" - adjusted=true - shift + getOptionValue "$@" + shift "${nOptArgs:-0}" + + if [ -n "$optValue" ] + then + replaceEtc config.sh/paraview ParaView_DIR \""$optValue\"" + replaceEtcCsh config.csh/paraview ParaView_DIR \""$optValue\"" + adjusted=true + else + : "${adjusted:=empty}" + fi ;; -llvm) # Replace mesa_llvm=... - optionValue=$(getOptionValue "$@") - replaceEtc config.sh/vtk mesa_llvm "$optionValue" - replaceEtc config.csh/vtk mesa_llvm "$optionValue" - adjusted=true - shift + getOptionValue "$@" + shift "${nOptArgs:-0}" + + if [ -n "$optValue" ] + then + replaceEtc config.sh/vtk mesa_llvm "$optValue" + replaceEtc config.csh/vtk mesa_llvm "$optValue" + adjusted=true + else + : "${adjusted:=empty}" + fi ;; -mesa) # Replace mesa_version=... - optionValue=$(getOptionValue "$@") - replaceEtc config.sh/vtk mesa_version "$optionValue" - replaceEtc config.csh/vtk mesa_version "$optionValue" - adjusted=true - shift + getOptionValue "$@" + shift "${nOptArgs:-0}" + + if [ -n "$optValue" ] + then + replaceEtc config.sh/vtk mesa_version "$optValue" + replaceEtc config.csh/vtk mesa_version "$optValue" + adjusted=true + else + : "${adjusted:=empty}" + fi ;; -vtk) # Replace vtk_version=... - optionValue=$(getOptionValue "$@") - replaceEtc config.sh/vtk vtk_version "$optionValue" - replaceEtc config.csh/vtk vtk_version "$optionValue" - adjusted=true - shift + getOptionValue "$@" + shift "${nOptArgs:-0}" + + if [ -n "$optValue" ] + then + replaceEtc config.sh/vtk vtk_version "$optValue" + replaceEtc config.csh/vtk vtk_version "$optValue" + adjusted=true + else + : "${adjusted:=empty}" + fi ;; -llvm-path) # Replace LLVM_ARCH_PATH=... - optionValue=$(getOptionValue "$@") - replaceEtc config.sh/vtk LLVM_ARCH_PATH \""$optionValue\"" - replaceEtcCsh config.csh/vtk LLVM_ARCH_PATH \""$optionValue\"" - adjusted=true - shift + getOptionValue "$@" + shift "${nOptArgs:-0}" + + if [ -n "$optValue" ] + then + replaceEtc config.sh/vtk LLVM_ARCH_PATH \""$optValue\"" + replaceEtcCsh config.csh/vtk LLVM_ARCH_PATH \""$optValue\"" + adjusted=true + else + : "${adjusted:=empty}" + fi ;; -mesa-path) # Replace MESA_ARCH_PATH... - optionValue=$(getOptionValue "$@") - replaceEtc config.sh/vtk MESA_ARCH_PATH \""$optionValue\"" - replaceEtcCsh config.csh/vtk MESA_ARCH_PATH \""$optionValue\"" - adjusted=true - shift + getOptionValue "$@" + shift "${nOptArgs:-0}" + + if [ -n "$optValue" ] + then + replaceEtc config.sh/vtk MESA_ARCH_PATH \""$optValue\"" + replaceEtcCsh config.csh/vtk MESA_ARCH_PATH \""$optValue\"" + adjusted=true + else + : "${adjusted:=empty}" + fi ;; -vtk-path) # Replace VTK_DIR... - optionValue=$(getOptionValue "$@") - replaceEtc config.sh/vtk VTK_DIR \""$optionValue\"" - replaceEtcCsh config.csh/vtk VTK_DIR \""$optionValue\"" - adjusted=true - shift + getOptionValue "$@" + shift "${nOptArgs:-0}" + + if [ -n "$optValue" ] + then + replaceEtc config.sh/vtk VTK_DIR \""$optValue\"" + replaceEtcCsh config.csh/vtk VTK_DIR \""$optValue\"" + adjusted=true + else + : "${adjusted:=empty}" + fi ;; ## Misc ## + # Obsolete flags -sigfpe | -no-sigfpe) echo "Enable/disable FOAM_SIGFPE now via controlDict" 1>&2 ;; - -archOption | --archOption) - # Replace WM_ARCH_OPTION=... - optionValue=$(getOptionValue "$@") - echo "Ignoring $1 option: no longer supported" 1>&2 - shift - ;; - + # Obsolete options + -archOption | --archOption | \ -foamInstall | --foamInstall | -projectName | --projectName) - # Removed for 1812 - optionValue=$(getOptionValue "$@") - echo "Ignoring $1 option: obsolete" 1>&2 - shift + echo "Ignoring obsolete option: $1" 1>&2 + getOptionValue "$@" + shift "${nOptArgs:-0}" ;; *)