Some functions in my package run much faster using C++11 containers, but CRAN doesn't accept my package using both $(SHLIB_OPENMP_CXXFLAGS)
and $(CXX1XSTD)
because it doesn't compile on Solaris (or other minor platforms). The recommendation from CRAN was to write a configure script, but I think this will be too time consuming for me to learn, and unnecessarily complicate my code for platforms which few people use.
At the moment, I have just commented out all C++11 code, and removed the $(CXX1XSTD)
from Makevars
for CRAN submission. This is a poor work around, and I'd much rather be able to detect CRAN in Makevars
and make accommodations, so I don't have to maintain a CRAN fork for every version.
I still test whether C++11 is available, but it's just the combination of C++11 and OpenMP flags in Makevars which is the stumbling block on Solaris with CRAN submissions. I feel there must be a trivial way around this.
Is there an environment variable I should use to test whether CRAN itself is checking my package, and which I can test for in Makevars
? I have searched the R code base and read R Internals and Writing R Extensions, although I can't say I know them off by heart, which some CRAN maintainers expect. There are environment variables which CRAN likely sets but I expect testing for something like _R_CHECK_CRAN_INCOMING_=TRUE
would raise the ire of the maintainers.
I don't think an "if solaris" test in Makevars
would be enough: it is the presence of both C++11 and OpenMP flags together which is not allowed, because they would potentially fail on platforms used even less often than Solaris.
Maybe I'm just approaching this the wrong way.