Skip to content

Commit 0d2ad78

Browse files
committed
warn if users set PKG_ flags in their Makevars
1 parent 5c09266 commit 0d2ad78

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

tools/config/configure.R

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,27 @@
11

2+
# check whether user has Makevars file that might cause trouble
3+
makevars <- Sys.getenv("R_MAKEVARS_USER", unset = "~/.R/Makevars")
4+
if (file.exists(makevars)) {
5+
contents <- readLines(makevars, warn = FALSE)
6+
pattern <- "^(PKG_CPPFLAGS|PKG_CXXFLAGS)\\s*="
7+
bad <- grep(pattern, contents, perl = TRUE, value = TRUE)
8+
if (length(bad)) {
9+
10+
text <- c(
11+
"",
12+
sprintf("NOTE: '%s' contains variable declarations incompatible with RcppParallel:", makevars),
13+
"",
14+
paste0("\t", bad),
15+
"",
16+
"Makevars variables prefixed with 'PKG_' should be considered reserved for use by R packages.",
17+
""
18+
)
19+
20+
writeLines(text, con = stdout())
21+
22+
}
23+
}
24+
225
# Figure out the appropriate CXX prefix for the current
326
# version of R + configuration.
427
cxx <- NULL

0 commit comments

Comments
 (0)