Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 24 Oct 2015 04:03:33 +0000 (UTC)
From:      Bryan Drewery <bdrewery@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r289869 - head/share/mk
Message-ID:  <201510240403.t9O43XqM044724@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bdrewery
Date: Sat Oct 24 04:03:32 2015
New Revision: 289869
URL: https://svnweb.freebsd.org/changeset/base/289869

Log:
  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

Modified:
  head/share/mk/src.opts.mk

Modified: head/share/mk/src.opts.mk
==============================================================================
--- head/share/mk/src.opts.mk	Sat Oct 24 04:03:29 2015	(r289868)
+++ head/share/mk/src.opts.mk	Sat Oct 24 04:03:32 2015	(r289869)
@@ -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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201510240403.t9O43XqM044724>