diff --git a/etc/bashrc b/etc/bashrc index db2a10e54..4baf7024e 100644 --- a/etc/bashrc +++ b/etc/bashrc @@ -268,26 +268,68 @@ Darwin) export MACOSX_DEPLOYMENT_TARGET=`sw_vers -productVersion | sed -e "s/\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\)/\1.\2/g"` - if [ "$compilerInstall" == "System" ] + which -s port >/dev/null + if [ $? -eq "0" -a -d '/opt/local/etc/macports' ] then - # Use Mac-Ports-Compiler instead of Apple-gcc-4.2 - case $WM_COMPILER in - Gcc43) - export WM_CC='gcc-mp-4.3' - export WM_CXX='g++-mp-4.3' - ;; - Gcc44) - export WM_CC='gcc-mp-4.4' - export WM_CXX='g++-mp-4.4' - ;; - Gcc45) - export WM_CC='gcc-mp-4.5' - export WM_CXX='g++-mp-4.5' - ;; - *) - export WM_COMPILER= - ;; - esac + if [ "$FOAM_VERBOSE" -a "$PS1" ] + then + echo "Using Macports binaries" + fi + + export WM_USE_MACPORT=1 + + if [ "$compilerInstall" == "System" ] + then + # Use Mac-Ports-Compiler instead of Apple-gcc-4.2 + case $WM_COMPILER in + Gcc42) + export WM_MACPORT_VERSION=4.2 + ;; + Gcc43) + export WM_MACPORT_VERSION=4.3 + ;; + Gcc44) + export WM_MACPORT_VERSION=4.4 + ;; + Gcc45) + export WM_MACPORT_VERSION=4.5 + ;; + Gcc46) + export WM_MACPORT_VERSION=4.6 + ;; + Gcc47) + export WM_MACPORT_VERSION=4.7 + ;; + Gcc48) + export WM_MACPORT_VERSION=4.8 + ;; + Gcc) + ;; + *) + echo "Unsupported MacPorts-Compiler $WM_COMPILER" + ;; + esac + if [ "$WM_COMPILER" != "Gcc" ] + then + export WM_CC="gcc-mp-$WM_MACPORT_VERSION" + export WM_CXX="g++-mp-$WM_MACPORT_VERSION" + + ruleDirBase=$WM_DIR/rules/$WM_ARCH + ruleDir=$ruleDirBase$WM_COMPILER + if [ ! -e $ruleDir ] + then + echo "Rule directory $ruleDir not existing. Linking to $ruleDirBase" + ln -s $ruleDirBase $ruleDir + fi + unset ruleDir ruleDirBase + fi + fi + fi + if [ -z "$WM_CC" ] + then + # nobody set the compiler + export WM_CC="gcc" + export WM_CXX="g++" fi ;; diff --git a/etc/settings.sh b/etc/settings.sh index e6a1bb0a3..01fe4ed2a 100644 --- a/etc/settings.sh +++ b/etc/settings.sh @@ -187,17 +187,19 @@ fi unset compilerBin compilerLib compilerInstall -case "$WM_COMPILER" in -Gcc*) - export WM_CC='gcc' - export WM_CXX='g++' - ;; -Icc) - export WM_CC='icc' - export WM_CXX='icpc' - ;; -esac - +if [ -z "$WM_CC" ] +then + case "$WM_COMPILER" in + Gcc*) + export WM_CC='gcc' + export WM_CXX='g++' + ;; + Icc) + export WM_CC='icc' + export WM_CXX='icpc' + ;; + esac +fi # Communications library # ~~~~~~~~~~~~~~~~~~~~~~ diff --git a/wmake/rules/darwinIntel64/c b/wmake/rules/darwinIntel64/c index a686d4eeb..7d81ffc19 100644 --- a/wmake/rules/darwinIntel64/c +++ b/wmake/rules/darwinIntel64/c @@ -2,7 +2,7 @@ cWARN = -Wall -cc = gcc $(WM_CXXFLAGS) +cc = $(WM_CC) $(WM_CXXFLAGS) include $(RULES)/c$(WM_COMPILE_OPTION) diff --git a/wmake/rules/darwinIntel64/c++ b/wmake/rules/darwinIntel64/c++ index 27fcb0c34..27b66c29e 100644 --- a/wmake/rules/darwinIntel64/c++ +++ b/wmake/rules/darwinIntel64/c++ @@ -2,7 +2,7 @@ c++WARN = -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -CC = g++ $(WM_CXXFLAGS) +CC = $(WM_CXX) $(WM_CXXFLAGS) include $(RULES)/c++$(WM_COMPILE_OPTION)