Skip to content

Commit 07061ca

Browse files
committed
attempt to respect CXXFLAGS as set by user
1 parent f17917d commit 07061ca

File tree

2 files changed

+42
-19
lines changed

2 files changed

+42
-19
lines changed

src/Makevars.in

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ ifeq ($(OS), Windows_NT)
77

88
MAKEFLAGS = -j1
99
MAKE = make -e
10-
MAKE_CMD = CYGWIN=nodosfilewarning CONLY="@CC@" CPLUS="@CXX11@" PIC_KEY="@CXX11PICFLAGS@" WARNING_SUPPRESS="" $(MAKE)
10+
MAKE_CMD = CYGWIN=nodosfilewarning CONLY="@CC@" CPLUS="@CXX11@" CXXFLAGS="@CXX11FLAGS@ -DTBB_NO_LEGACY=1" PIC_KEY="@CXX11PICFLAGS@" WARNING_SUPPRESS="" $(MAKE)
1111

1212
else
1313

@@ -27,15 +27,15 @@ else
2727
endif
2828

2929
MAKE += -e
30-
MAKE_CMD = CONLY="@CC@" CPLUS="@CXX11@" PIC_KEY="@CXX11PICFLAGS@" WARNING_SUPPRESS="" $(MAKE)
30+
MAKE_CMD = CONLY="@CC@" CPLUS="@CXX11@" CXXFLAGS="@CXX11FLAGS@ -DTBB_NO_LEGACY=1" PIC_KEY="@CXX11PICFLAGS@" WARNING_SUPPRESS="" $(MAKE)
3131

3232
endif
3333

3434
ifdef USE_TBB
3535

3636
PKG_CPPFLAGS += -DRCPP_PARALLEL_USE_TBB=1
3737

38-
MAKE_ARGS := CXXFLAGS=-DTBB_NO_LEGACY=1 tbb_release tbbmalloc_release tbb_build_prefix=lib
38+
MAKE_ARGS := tbb_release tbbmalloc_release tbb_build_prefix=lib
3939

4040
ifeq ($(USE_TBB), Windows)
4141

tools/config/configure.R

Lines changed: 39 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,48 @@
1-
if (Sys.info()[["sysname"]] == "Windows" && getRversion() < "3.1.0") {
2-
define(
1+
2+
# Figure out the appropriate CXX prefix for the current
3+
# version of R + configuration.
4+
cxx <- NULL
5+
candidates <- c("CXX11", "CXX1X", "CXX")
6+
for (candidate in candidates) {
7+
config <- read_r_config(candidate, envir = NULL)
8+
value <- config[[candidate]]
9+
if (!is.null(value)) {
10+
cxx <- candidate
11+
break
12+
}
13+
}
14+
15+
# define the set of flags appropriate to the current
16+
# configuration of R
17+
switch(
18+
cxx,
19+
20+
CXX11 = define(
321
CC = "$(CC)",
4-
CXX11 = "$(CXX)",
5-
CXX11STD = "-std=c++0x",
6-
CXX11PICFLAGS = "-fPIC"
7-
)
8-
} else if (getRversion() < "3.4.0") {
9-
define(
22+
CXX11 = "$(CXX11)",
23+
CXX11FLAGS = "$(CXX11FLAGS)",
24+
CXX11STD = "$(CXX11STD)",
25+
CXX11PICFLAGS = "$(CXX11PICFLAGS)"
26+
),
27+
28+
CXX1X = define(
1029
CC = "$(CC)",
1130
CXX11 = "$(CXX1X)",
31+
CXX11FLAGS = "$(CXX1XFLAGS)",
1232
CXX11STD = "$(CXX1XSTD)",
1333
CXX11PICFLAGS = "$(CXX1XPICFLAGS)"
14-
)
15-
} else {
16-
define(
34+
),
35+
36+
CXX = define(
1737
CC = "$(CC)",
18-
CXX11 = "$(CXX11)",
19-
CXX11STD = "$(CXX11STD)",
20-
CXX11PICFLAGS = "$(CXX11PICFLAGS)"
21-
)
22-
}
38+
CXX11 = "$(CXX)",
39+
CXX11FLAGS = "$(CXXFLAGS)",
40+
CXX11STD = "-std=c++0x",
41+
CXX11PICFLAGS = "-fPIC"
42+
),
43+
44+
stop("Failed to infer C / C++ compilation flags")
45+
)
2346

2447
# use c++0x for compatibility with older compilers
2548
define(STDVER = "c++0x")

0 commit comments

Comments
 (0)