Skip to content

Commit 9a6b24e

Browse files
authored
Merge pull request #178 from Enchufa2/feature/autodetection
add system TBB autodetection on Unix
2 parents 9dcfa62 + edd9e52 commit 9a6b24e

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
@@ -132,3 +132,23 @@ if (Sys.info()[["sysname"]] == "SunOS") {
132132
}
133133
}
134134

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

0 commit comments

Comments
 (0)