From edd9e5292fe3d231bbf62461b244f9dde2f47f4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1aki=20=C3=9Acar?= Date: Thu, 23 Dec 2021 17:33:02 +0100 Subject: [PATCH] add system TBB autodetection on Unix --- src/Makevars.in | 8 +++++++- tools/config/configure.R | 20 ++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/src/Makevars.in b/src/Makevars.in index 6e6eae66..ca808454 100644 --- a/src/Makevars.in +++ b/src/Makevars.in @@ -14,7 +14,13 @@ ifdef TBB_ROOT endif -# If TBB_LIB is defined by TBB_INC is not, make a guess. +# If TBB_LIB is not defined, try to use autodetection +ifndef TBB_LIB + TBB_LIB = @TBB_LIB_AUTO@ + TBB_INC = @TBB_INC_AUTO@ +endif + +# If TBB_LIB is defined but TBB_INC is not, make a guess. ifdef TBB_LIB ifndef TBB_INC TBB_INC = $(TBB_LIB)/../include diff --git a/tools/config/configure.R b/tools/config/configure.R index 6401c61c..f8fee568 100644 --- a/tools/config/configure.R +++ b/tools/config/configure.R @@ -126,3 +126,23 @@ if (Sys.info()[["sysname"]] == "SunOS") { } } +# tbb autodetection on Unix +define(TBB_LIB_AUTO = "", TBB_INC_AUTO = "") +if (.Platform$OS.type == "unix") { + tbbLib <- Sys.glob(c( + "/usr/*/libtbb.so", + "/usr/*/*/libtbb.so", + "/usr/*/*/*/libtbb.so" + )) + tbbInc <- Sys.glob(c( + "/usr/include/tbb.h", + "/usr/include/*/tbb.h" + )) + if (length(tbbLib) && length(tbbInc)) { + define( + TBB_LIB_AUTO = dirname(tbbLib[1]), + TBB_INC_AUTO = dirname(tbbInc[1]) + ) + } +} +