pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

clang: detect if PKG_CXX is using libc++ or libstdc++ and configure accordingly



Module Name:	pkgsrc-wip
Committed By:	Tobias Nygren <tnn%NetBSD.org@localhost>
Pushed By:	tnn
Date:		Fri Feb 26 22:54:44 2016 +0100
Changeset:	0ac9bb87c71728d94c96bb91bce62130b50dcf73

Modified Files:
	clang-git/Makefile.common
	clang/Makefile.common

Log Message:
clang: detect if PKG_CXX is using libc++ or libstdc++ and configure accordingly

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=0ac9bb87c71728d94c96bb91bce62130b50dcf73

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 clang-git/Makefile.common | 7 +++++--
 clang/Makefile.common     | 7 +++++--
 2 files changed, 10 insertions(+), 4 deletions(-)

diffs:
diff --git a/clang-git/Makefile.common b/clang-git/Makefile.common
index 447865f..e3e967c 100644
--- a/clang-git/Makefile.common
+++ b/clang-git/Makefile.common
@@ -64,11 +64,14 @@ REPLACE_PYTHON+=	www/builtins.py
 
 .include "../../mk/compiler.mk"
 
+# command to check if the PKG_CXX compiler is using libc++ or libstdc++
+LIBCPP_CHECK_SH=	printf "\#include <ciso646>\n\#ifdef _LIBCPP_VERSION\nYES\n\#endif" | ${PKG_CXX} -x c++ -E - | grep YES || true
+
 # patch NetBSD::GetCXXStdlibType
-.if ${OPSYS} == "NetBSD" && !empty(PKGSRC_COMPILER:Mgcc)
+.if ${OPSYS} == "NetBSD" && (!empty(PKGSRC_COMPILER:Mgcc) || empty(LIBCPP_CHECK_SH:sh:MYES))
 SUBST_CLASSES+=			libcxx
 SUBST_STAGE.libcxx=		pre-configure
-SUBST_MESSAGE.libcxx=		Patching toolchain to use libstdc++ as we're using GCC
+SUBST_MESSAGE.libcxx=		Patching toolchain to use libstdc++ (matching the host compiler)
 SUBST_FILES.libcxx=		lib/Driver/ToolChains.cpp
 SUBST_FILES.libcxx+=		lib/Driver/Tools.cpp
 SUBST_SED.libcxx=		-e 's,(Major >= 7 || Major == 0),(false),'
diff --git a/clang/Makefile.common b/clang/Makefile.common
index 99b4d3e..bf425d5 100644
--- a/clang/Makefile.common
+++ b/clang/Makefile.common
@@ -64,11 +64,14 @@ REPLACE_PYTHON+=	www/builtins.py
 
 .include "../../mk/compiler.mk"
 
+# command to check if the PKG_CXX compiler is using libc++ or libstdc++
+LIBCPP_CHECK_SH=	printf "\#include <ciso646>\n\#ifdef _LIBCPP_VERSION\nYES\n\#endif" | ${PKG_CXX} -x c++ -E - | grep YES || true
+
 # patch NetBSD::GetCXXStdlibType
-.if ${OPSYS} == "NetBSD" && !empty(PKGSRC_COMPILER:Mgcc)
+.if ${OPSYS} == "NetBSD" && (!empty(PKGSRC_COMPILER:Mgcc) || empty(LIBCPP_CHECK_SH:sh:MYES))
 SUBST_CLASSES+=			libcxx
 SUBST_STAGE.libcxx=		pre-configure
-SUBST_MESSAGE.libcxx=		Patching toolchain to use libstdc++ as we're using GCC
+SUBST_MESSAGE.libcxx=		Patching toolchain to use libstdc++ (matching the host compiler)
 SUBST_FILES.libcxx=		lib/Driver/ToolChains.cpp
 SUBST_FILES.libcxx+=		lib/Driver/Tools.cpp
 SUBST_SED.libcxx=		-e 's,(Major >= 7 || (Major == 6 && Minor == 99 && Micro >= 49) || Major == 0),(false),'


Home | Main Index | Thread Index | Old Index