[Fix] nvm should respect CC/CXX env var

- Also set CC for Freebsd, not only CXX

 - Also set CC=cc, CXX=c++ on Mac OS by default as upstream

Reference:
1bd871655a/configure (L16-L17)
Peter Dave Hello 2016-11-29 15:30:01 +08:00 committed by Jordan Harband
parent 84575cf353
commit 45771499ee
No known key found for this signature in database
GPG Key ID: 64A196AEE0916D55
1 changed files with 18 additions and 9 deletions

27
nvm.sh
View File

@ -1853,15 +1853,24 @@ nvm_install_source() {
local make
make='make'
if [ "${NVM_OS}" = 'freebsd' ]; then
make='gmake'
MAKE_CXX='CXX=c++'
elif [ "${NVM_OS}" = 'aix' ]; then
make='gmake'
fi
if nvm_has "clang++" && nvm_has "clang" && nvm_version_greater_than_or_equal_to nvm_clang_version 3.5 ; then
nvm_echo "Clang v3.5+ detected! Use Clang as c/c++ compiler!"
MAKE_CXX='CC=clang CXX=clang++'
local MAKE_CXX
case "${NVM_OS}" in
'freebsd')
make='gmake'
MAKE_CXX="CC=${CC:-cc} CXX=${CXX:-c++}"
;;
'darwin')
MAKE_CXX="CC=${CC:-cc} CXX=${CXX:-c++}"
;;
'aix')
make='gmake'
;;
esac
if nvm_has "clang++" && nvm_has "clang" && nvm_version_greater_than_or_equal_to nvm_clang_version 3.5; then
if [ -z "${CC-}" ] || [ -z "${CXX-}" ] ; then
nvm_echo "Clang v3.5+ detected! CC or CXX not specified, will use Clang as c/c++ compiler!"
MAKE_CXX="CC=${CC:-cc} CXX=${CXX:-c++}"
fi
fi
local tar_compression_flag