From a12bf2d75314c2e3032b017f41e0785e0ed733d9 Mon Sep 17 00:00:00 2001 From: Jim Blandy Date: Wed, 29 Jul 2020 16:14:51 -0700 Subject: [PATCH] Fancier TBB (Threaded Building Blocks) detection. Update documentation to mention that it's needed. --- profiler/build/unix/build.mk | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/profiler/build/unix/build.mk b/profiler/build/unix/build.mk index 101141f6..865c41a0 100644 --- a/profiler/build/unix/build.mk +++ b/profiler/build/unix/build.mk @@ -25,8 +25,14 @@ else LIBS += $(shell pkg-config --libs gtk+-2.0) -lGL endif -TBB := $(shell ld -ltbb -o /dev/null 2>/dev/null; echo $$?) -ifeq ($(TBB),0) +# Tracy does not use TBB directly, but the implementation of parallel algorithms +# in some versions of libstdc++ depends on TBB. When it does, you must +# explicitly link against -ltbb. +# +# Some distributions have pgk-config files for TBB, others don't. +ifeq (0,$(shell pkg-config --libs tbb >/dev/null 2>&1; echo $$?)) + LIBS += $(shell pkg-config --libs tbb) +else ifeq (0,$(shell ld -ltbb -o /dev/null 2>/dev/null; echo $$?)) LIBS += -ltbb endif