aboutsummaryrefslogtreecommitdiff
path: root/share/mk/src.opts.mk
diff options
context:
space:
mode:
authorBryan Drewery <bdrewery@FreeBSD.org>2015-10-24 04:03:32 +0000
committerBryan Drewery <bdrewery@FreeBSD.org>2015-10-24 04:03:32 +0000
commit8758abd5b3f031aa793ed09dc6e050985d120bce (patch)
tree720aefbc07c7a7f2933d12aa74cb60af1f9275bf /share/mk/src.opts.mk
parentde606f83e00defed267325576ffdb7abbc6eb8a4 (diff)
downloadsrc-8758abd5b3f031aa793ed09dc6e050985d120bce.tar.gz
src-8758abd5b3f031aa793ed09dc6e050985d120bce.zip
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
Notes
Notes: svn path=/head/; revision=289869
Diffstat (limited to 'share/mk/src.opts.mk')
-rw-r--r--share/mk/src.opts.mk21
1 files changed, 11 insertions, 10 deletions
diff --git a/share/mk/src.opts.mk b/share/mk/src.opts.mk
index a5e78a3d9459..7aca91435da1 100644
--- a/share/mk/src.opts.mk
+++ b/share/mk/src.opts.mk
@@ -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