diff --git a/inst/include/cpp11/R.hpp b/inst/include/cpp11/R.hpp index 60044bc..574ae5b 100644 --- a/inst/include/cpp11/R.hpp +++ b/inst/include/cpp11/R.hpp @@ -10,8 +10,12 @@ #endif #endif +#ifndef R_NO_REMAP #define R_NO_REMAP +#endif +#ifndef STRICT_R_HEADERS #define STRICT_R_HEADERS +#endif #include "Rinternals.h" // clang-format off diff --git a/src/Makevars b/src/Makevars index 69b324b..b878e15 100644 --- a/src/Makevars +++ b/src/Makevars @@ -9,10 +9,13 @@ else DLL := .so endif -CC_VERSION := $(shell $(CXX) -dumpfullversion -dumpversion 2>&1) +R_CC := $(shell $(R_HOME)/bin$(R_ARCH_BIN)/R CMD config CC) +R_CXX := $(shell $(R_HOME)/bin$(R_ARCH_BIN)/R CMD config CXX) + +CC_VERSION := $(shell $(R_CXX) -dumpfullversion -dumpversion 2>&1) CC_MAJOR := $(word 1,$(subst ., ,$(CC_VERSION))) -CLANG_CHECK := $(shell echo | $(CXX) -dM -E - | grep -i __clang__) +CLANG_CHECK := $(shell echo | $(R_CC) -dM -E - | grep -i __clang__) # Older versions of gcc and clang don't provide the stdatomic.h header ifneq (,$(CLANG_CHECK)) @@ -21,7 +24,7 @@ ifneq (,$(CLANG_CHECK)) endif # Clang on armel needs libatomic ifeq ($(shell uname -m), armv7l) - CC_TARGET := $(shell $(CXX) -v 2>&1 | grep Target | cut -d ' ' -f 2) + CC_TARGET := $(shell $(R_CXX) -v 2>&1 | grep Target | cut -d ' ' -f 2) ifeq ($(findstring gnueabihf,$(CC_TARGET)),) PKG_LIBS += -latomic endif @@ -64,7 +67,7 @@ build-static: $(QUICKJS_OBJECTS) $(AR) -rs ../inst/lib/$(R_ARCH)/libquickjs.a $(QUICKJS_OBJECTS) $(QUICKJS_OBJECTS): quickjs/%.o : quickjs/%.c - $(CC) $(ALL_CPPFLAGS) $(ALL_CFLAGS) -DFALSE=0 -DTRUE=1 -DSTRICT_R_HEADERS -funsigned-char -fwrapv -std=gnu11 -c $< -o $@ + $(R_CC) $(ALL_CPPFLAGS) $(ALL_CFLAGS) -DFALSE=0 -DTRUE=1 -DSTRICT_R_HEADERS -funsigned-char -fwrapv -std=gnu11 -c $< -o $@ clean: $(RM) $(QUICKJS_OBJECTS) $(OBJECTS) ../inst/VERSION QuickJSR$(DLL)