Since clang 3.5.0 and later must be built by a compiler with C++11

support, make this explicit in src.opts.mk, by updating the default
settings.

The defaults become as follows:
* If the host compiler is not C++11 capable, use gcc and disable clang.
* On x86, enable clang, make it the default cc, and disable gcc.
* On little-endian ARM, enable clang, but not the full build, make it
  the default cc, and disable gcc.
* On PowerPC, enable clang, but enable gcc and make that the default cc.
* On everything else, use gcc, and disable clang.

This can be amended later, if we get e.g. sparc64 or big-endian ARM
working with clang.

Reviewed by:	imp, brooks
Differential Revision: https://reviews.freebsd.org/D1294
This commit is contained in:
Dimitry Andric 2014-12-10 22:33:57 +00:00
parent 377af4f123
commit 0104753b7d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/projects/clang350-import/; revision=275691

View File

@ -191,25 +191,29 @@ __TT=${TARGET}
.else
__TT=${MACHINE}
.endif
# Clang is only for x86, powerpc and little-endian arm right now, by default.
.if ${__T} == "amd64" || ${__T} == "i386" || ${__T:Mpowerpc*}
__DEFAULT_YES_OPTIONS+=CLANG CLANG_FULL CLANG_BOOTSTRAP
.elif ${__TT} == "arm" && ${__T:Marm*eb*} == ""
__DEFAULT_YES_OPTIONS+=CLANG CLANG_BOOTSTRAP
# GCC is unable to build the full clang on arm, disable it by default.
__DEFAULT_NO_OPTIONS+=CLANG_FULL
.else
__DEFAULT_NO_OPTIONS+=CLANG CLANG_FULL CLANG_BOOTSTRAP
.endif
# Clang the default system compiler only on little-endian arm and x86.
.if ${__T} == "amd64" || (${__TT} == "arm" && ${__T:Marm*eb*} == "") || \
${__T} == "i386"
__DEFAULT_YES_OPTIONS+=CLANG_IS_CC
__DEFAULT_NO_OPTIONS+=GCC GCC_BOOTSTRAP GNUCXX
.else
# If clang is not cc, then build gcc by default
__DEFAULT_NO_OPTIONS+=CLANG_IS_CC CLANG CLANG_BOOTSTRAP
.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} == "amd64" || ${__T} == "i386"
# On x86, clang is enabled, and will be installed as the default cc.
__DEFAULT_YES_OPTIONS+=CLANG CLANG_BOOTSTRAP CLANG_FULL CLANG_IS_CC
__DEFAULT_NO_OPTIONS+=GCC GCC_BOOTSTRAP GNUCXX
.elif ${__TT} == "arm" && ${__T:Marm*eb*} == ""
# On little-endian arm, clang is enabled, and it is installed as the default
# cc, but since gcc is unable to build the full clang, disable it by default.
__DEFAULT_YES_OPTIONS+=CLANG CLANG_BOOTSTRAP CLANG_IS_CC
__DEFAULT_NO_OPTIONS+=CLANG_FULL GCC GCC_BOOTSTRAP GNUCXX
.elif ${__T:Mpowerpc*}
# On powerpc, clang is enabled, but gcc is installed as the default 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.
__DEFAULT_YES_OPTIONS+=GCC GCC_BOOTSTRAP GNUCXX
__DEFAULT_NO_OPTIONS+=CLANG CLANG_BOOTSTRAP CLANG_FULL CLANG_IS_CC
.endif
.include <bsd.mkopt.mk>
@ -217,7 +221,6 @@ __DEFAULT_YES_OPTIONS+=GCC GCC_BOOTSTRAP GNUCXX
#
# MK_* options that default to "yes" if the compiler is a C++11 compiler.
#
.include <bsd.compiler.mk>
.for var in \
LIBCPLUSPLUS
.if !defined(MK_${var})