git: 8f02234dbd1d - stable/13 - Don't build sanitizer runtimes under WITHOUT_CXX

From: Ed Maste <emaste_at_FreeBSD.org>
Date: Mon, 29 Nov 2021 15:11:25 UTC
The branch stable/13 has been updated by emaste:

URL: https://cgit.FreeBSD.org/src/commit/?id=8f02234dbd1d578740b08afb4a0d6b877432adc9

commit 8f02234dbd1d578740b08afb4a0d6b877432adc9
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2021-10-29 00:49:12 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2021-11-29 15:10:53 +0000

    Don't build sanitizer runtimes under WITHOUT_CXX
    
    In the past we built the sanitizer runtimes when building Clang
    (and using Clang as the compiler) but 7676b388adbc changed this to
    be conditional only on using Clang, to make the runtimes available
    for external Clang.
    
    They fail to build when WITHOUT_CXX is set though, so add MK_CXX
    as part of the condition.
    
    Reported by:    Michael Dexter, Build Option Survey
    Reviewed by:    imp, jrtc27
    Fixes:          7676b388adbc ("Always build the sanitizer runtimes...")
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D32731
    
    (cherry picked from commit ad09e2c8cfbc2cf6f2b8826c121d6de8b3bfe96d)
---
 lib/Makefile | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/lib/Makefile b/lib/Makefile
index 3c218415d9ca..f42909ec0b09 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -172,10 +172,9 @@ SUBDIR.${MK_KERBEROS_SUPPORT}+=	libcom_err
 SUBDIR.${MK_LDNS}+=	libldns
 SUBDIR.${MK_STATS}+=	libstats
 
-# The libraries under libclang_rt can only be built by clang, and only make
-# sense to build when clang is enabled at all.  Furthermore, they can only be
-# built for certain architectures.
-.if ${COMPILER_TYPE} == "clang" && \
+# The libraries under libclang_rt can only be built by clang and when we enable
+# C++ support.  Furthermore, they can only be built for certain architectures.
+.if ${COMPILER_TYPE} == "clang" && ${MK_CXX} != "no" && \
     (${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "amd64" || \
     ${MACHINE_CPUARCH} == "arm" || ${MACHINE_CPUARCH} == "i386" || \
     ${MACHINE_CPUARCH} == "powerpc")