Skip to content

Commit edd9e52

Browse files
committed
add system TBB autodetection on Unix
1 parent ad65ac4 commit edd9e52

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

src/Makevars.in

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,13 @@ ifdef TBB_ROOT
1414

1515
endif
1616

17-
# If TBB_LIB is defined by TBB_INC is not, make a guess.
17+
# If TBB_LIB is not defined, try to use autodetection
18+
ifndef TBB_LIB
19+
TBB_LIB = @TBB_LIB_AUTO@
20+
TBB_INC = @TBB_INC_AUTO@
21+
endif
22+
23+
# If TBB_LIB is defined but TBB_INC is not, make a guess.
1824
ifdef TBB_LIB
1925
ifndef TBB_INC
2026
TBB_INC = $(TBB_LIB)/../include

tools/config/configure.R

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,3 +126,23 @@ if (Sys.info()[["sysname"]] == "SunOS") {
126126
}
127127
}
128128

129+
# tbb autodetection on Unix
130+
define(TBB_LIB_AUTO = "", TBB_INC_AUTO = "")
131+
if (.Platform$OS.type == "unix") {
132+
tbbLib <- Sys.glob(c(
133+
"/usr/*/libtbb.so",
134+
"/usr/*/*/libtbb.so",
135+
"/usr/*/*/*/libtbb.so"
136+
))
137+
tbbInc <- Sys.glob(c(
138+
"/usr/include/tbb.h",
139+
"/usr/include/*/tbb.h"
140+
))
141+
if (length(tbbLib) && length(tbbInc)) {
142+
define(
143+
TBB_LIB_AUTO = dirname(tbbLib[1]),
144+
TBB_INC_AUTO = dirname(tbbInc[1])
145+
)
146+
}
147+
}
148+

0 commit comments

Comments
 (0)