Skip to content

Commit 69d50f6

Browse files
committed
enforce passage of -std flag (#227)
1 parent b478b62 commit 69d50f6

File tree

2 files changed

+22
-18
lines changed

2 files changed

+22
-18
lines changed

src/Makevars.in

+12-11
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,15 @@ ifeq ($(OS), Windows_NT)
3838

3939
MAKE = make
4040
MAKEFLAGS = -e -j1
41-
MAKE_CMD = \
42-
MSYS2_ARG_CONV_EXCL="*" \
43-
CYGWIN=nodosfilewarning \
44-
CONLY="@WINDOWS_CC@" \
45-
CPLUS="@WINDOWS_CXX11@" \
46-
CXXFLAGS="$(TBB_CXXFLAGS)" \
47-
PIC_KEY="@CXX11PICFLAGS@" \
48-
WARNING_SUPPRESS="" \
49-
WINARM64_CLANG="$(WINARM64_CLANG)" \
41+
MAKE_CMD = \
42+
MSYS2_ARG_CONV_EXCL="*" \
43+
CYGWIN=nodosfilewarning \
44+
CONLY="@WINDOWS_CC@" \
45+
CPLUS="@WINDOWS_CXX11@" \
46+
CXXFLAGS="$(TBB_CXXFLAGS)" \
47+
PIC_KEY="@CXX11PICFLAGS@" \
48+
WARNING_SUPPRESS="" \
49+
WINARM64_CLANG="$(WINARM64_CLANG)" \
5050
$(MAKE)
5151

5252
else
@@ -71,7 +71,7 @@ else
7171
endif
7272

7373
MAKEFLAGS += -e
74-
MAKE_CMD = \
74+
MAKE_CMD = \
7575
CONLY="@CC@ $(PKG_CPPFLAGS) @CPPFLAGS@" \
7676
CPLUS="@CXX11@ $(PKG_CPPFLAGS) @CPPFLAGS@" \
7777
CXXFLAGS="@CXX11FLAGS@ -DTBB_NO_LEGACY=1" \
@@ -93,6 +93,7 @@ ifeq ($(USE_TBB), Windows)
9393
# rtools: turn on hacks to compensate for make and shell differences rtools<=>MinGW
9494
# compiler: overwrite default (which is cl = MS compiler)
9595
MAKE_ARGS += rtools=true compiler=gcc
96+
9697
# TBB configure will detect mingw runtime with unknown arch on WINARM64_CLANG but not an
9798
# issue as we are using compiler built-ins instead of arch-specific code
9899
ifneq ($(WINARM64_CLANG), true)
@@ -160,7 +161,7 @@ else
160161
@mkdir -p ../inst/include
161162
@cp -R tbb/include/* ../inst/include/
162163
@(cd tbb/src && $(MAKE_CMD) $(MAKE_ARGS) info)
163-
@(cd tbb/src && $(MAKE_CMD) @STDVER@ $(MAKE_ARGS) $(MAKE_TARGETS) $(MAKE_LOG))
164+
@(cd tbb/src && $(MAKE_CMD) $(MAKE_ARGS) $(MAKE_TARGETS) $(MAKE_LOG))
164165
endif
165166

166167
# NOTE: we do not want to clean ../inst/lib or ../inst/libs here,

tools/config/configure.R

+10-7
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,16 @@ broken <-
5050
if (broken)
5151
cxxflags <- gsub("-Werror=format-security", "-Wformat -Werror=format-security", cxxflags)
5252

53+
# add C++ standard if not set
54+
if (!grepl("-std=", cxxflags, fixed = TRUE)) {
55+
stdflag <- if (getRversion() < "4.0") {
56+
"-std=c++0x"
57+
} else {
58+
"$(CXX11STD)"
59+
}
60+
cxxflags <- paste(stdflag, cxxflags)
61+
}
62+
5363
# avoid including /usr/local/include, as this can cause
5464
# RcppParallel to find and use a version of libtbb installed
5565
# there as opposed to the bundled version
@@ -115,13 +125,6 @@ if (info[["sysname"]] == "Windows") {
115125

116126
}
117127

118-
# use c++0x for compatibility with older compilers
119-
if (getRversion() < "4.0") {
120-
define(STDVER = "stdver=c++0x")
121-
} else {
122-
define(STDVER = "")
123-
}
124-
125128
# on Solaris, check if we're using gcc or g++
126129
if (Sys.info()[["sysname"]] == "SunOS") {
127130
cxx <- r_cmd_config("CXX")

0 commit comments

Comments
 (0)