Slightly rework the comments and logic for default Clang/GCC.

This is because the previous version was very obscure about the fact
that despite having Clang "on by default" for architectures such as powerpc, it
does not actually build due to the GCC it uses not having C++11 support.
Using an external compiler that supports C++11 does allow this to work.
This whole block should be rethought more given "on by default" is not
really default without extra work which could actually be surprising for
why Clang is showing up when using a newer GCC.

Sponsored by:	EMC / Isilon Storage Division
This commit is contained in:
Bryan Drewery 2015-10-24 04:03:32 +00:00
parent de606f83e0
commit 8758abd5b3

View File

@ -210,21 +210,22 @@ __TT=${MACHINE}
.endif
.include <bsd.compiler.mk>
.if !${COMPILER_FEATURES:Mc++11}
# If the compiler is not C++11 capable, disable clang and use gcc instead.
__DEFAULT_YES_OPTIONS+=GCC GCC_BOOTSTRAP GNUCXX
__DEFAULT_NO_OPTIONS+=CLANG CLANG_BOOTSTRAP CLANG_FULL CLANG_IS_CC
.elif ${__T} == "aarch64" || ${__T} == "amd64" || ${__TT} == "arm" || \
${__T} == "i386"
# On x86 and arm, clang is enabled, and will be installed as the default cc.
# If the compiler is not C++11 capable, disable Clang and use GCC instead.
# This means that architectures that have GCC 4.2 as default can not
# build Clang without using an external compiler.
.if ${COMPILER_FEATURES:Mc++11} && (${__T} == "aarch64" || \
${__T} == "amd64" || ${__TT} == "arm" || ${__T} == "i386")
# Clang is enabled, and will be installed as the default /usr/bin/cc.
__DEFAULT_YES_OPTIONS+=CLANG CLANG_BOOTSTRAP CLANG_FULL CLANG_IS_CC
__DEFAULT_NO_OPTIONS+=GCC GCC_BOOTSTRAP GNUCXX
.elif ${__T:Mpowerpc*}
# On powerpc, clang is enabled, but gcc is installed as the default cc.
.elif ${COMPILER_FEATURES:Mc++11} && ${__T:Mpowerpc*}
# On powerpc, if an external compiler that supports C++11 is used as ${CC},
# then Clang is enabled, but GCC is installed as the default /usr/bin/cc.
__DEFAULT_YES_OPTIONS+=CLANG CLANG_FULL GCC GCC_BOOTSTRAP GNUCXX
__DEFAULT_NO_OPTIONS+=CLANG_BOOTSTRAP CLANG_IS_CC
.else
# Everything else disables clang, and uses gcc instead.
# Everything else disables Clang, and uses GCC instead.
__DEFAULT_YES_OPTIONS+=GCC GCC_BOOTSTRAP GNUCXX
__DEFAULT_NO_OPTIONS+=CLANG CLANG_BOOTSTRAP CLANG_FULL CLANG_IS_CC
.endif