enabling libc++ by default when building with clang

Brooks Davis brooks at freebsd.org
Mon Sep 17 19:10:31 UTC 2012


Now that we have the COMPILER_TYPE variable I'm following up on an idea
by theraven@ that we should enable libc++ by default when we are
building world with a compiler that supports it.  The following patch
implements this:

http://people.freebsd.org/~brooks/patches/libc%2b%2b-default.diff

One key question is, when do we want to throw this switch?  Do we do it
now so people using clang start using it sooner or do we wait until
we've switched the default compiler and things have settled a bit?

I suspect that we'll want to wait, but I'm curious what others think.

-- Brooks

Index: share/mk/bsd.own.mk
===================================================================
--- share/mk/bsd.own.mk	(revision 240466)
+++ share/mk/bsd.own.mk	(working copy)
@@ -432,7 +432,6 @@
     ICONV \
     IDEA \
     INSTALL_AS_USER \
-    LIBCPLUSPLUS \
     NAND \
     OFED \
     SHARED_TOOLCHAIN
@@ -642,6 +641,33 @@
 .endif
 .endfor
 
+#
+# MK_* options that default to on if the compiler is clang.
+#
+.include <bsd.compiler.mk>
+.for var in \
+    LIBCPLUSPLUS
+.if defined(WITH_${var}) && defined(WITHOUT_${var})
+.error WITH_${var} and WITHOUT_${var} can't both be set.
+.endif
+.if defined(MK_${var})
+.error MK_${var} can't be set by a user.
+.endif
+.if ${COMPILER_TYPE} == "clang"
+.if defined(WITHOUT_${var})
+MK_${var}:=	no
+.else
+MK_${var}:=	yes
+.endif
+.else
+.if defined(WITH_${var})
+MK_${var}:=	yes
+.else
+MK_${var}:=	no
+.endif
+.endif
+.endfor
+
 .if ${MK_CTF} != "no"
 CTFCONVERT_CMD=	${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
 .elif defined(MAKE_VERSION) && ${MAKE_VERSION} >= 5201111300
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 188 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-toolchain/attachments/20120917/c35163b6/attachment.pgp


More information about the freebsd-toolchain mailing list