aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Somers <asomers@FreeBSD.org>2021-02-21 20:56:57 +0000
committerAlan Somers <asomers@FreeBSD.org>2021-02-22 05:23:12 +0000
commit9c59d753373189f83b4447fe6a5456573451e014 (patch)
tree280c7b4892ccf7def7f5d5a35dea7f467e80589f
parent72b20d2aa973daa897256cdcf9c86d6f81f0e813 (diff)
downloadsrc-9c59d753373189f83b4447fe6a5456573451e014.tar.gz
src-9c59d753373189f83b4447fe6a5456573451e014.zip
libpmc: fix linking with C programs
Revision r334749 Added some C++ code to libpmc. It didn't change the ABI, but it did introduce a dependency on libc++. Nobody noticed because every program that in the base system that uses libpmc is also C++. Reported-by: Dom Dwyer <dom@itsallbroken.com> Reviewed By: vangyzen Differential Revision: https://reviews.freebsd.org/D28550 (cherry picked from commit 04e34c0202ea50cea67d5779f54bc612c74e6532)
-rw-r--r--lib/libpmc/Makefile6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/libpmc/Makefile b/lib/libpmc/Makefile
index 35bacb26bd11..1e204e13fdb2 100644
--- a/lib/libpmc/Makefile
+++ b/lib/libpmc/Makefile
@@ -8,6 +8,12 @@ INCS= pmc.h pmclog.h pmcformat.h
CFLAGS+= -I${.CURDIR}
CWARNFLAGS.gcc+= -Wno-shadow -Wno-cast-align
+.include <bsd.compiler.mk>
+.if ${COMPILER_TYPE} == "gcc"
+LDADD+= -lstdc++
+.else
+LDADD+= -lc++
+.endif
.if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386"