From 98fad546e68f8d8664f0fe0d8f5727bc62587169 Mon Sep 17 00:00:00 2001 From: Steffen Moeller Date: Wed, 21 Oct 2026 18:15:48 +0200 Subject: [PATCH 1/2] rs274: use the Darwin SDK long-double math constants The interpreter uses M_PIl and M_PI_2l, which the macOS SDK leaves undefined by default. Pass -D__MATH_LONG_DOUBLE_CONSTANTS to interpreter compilation on Darwin so the SDK supplies both values on the first inclusion of math.h, including through another header. --- src/emc/rs274ngc/Submakefile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/emc/rs274ngc/Submakefile b/src/emc/rs274ngc/Submakefile index 8e601076224..b9356df023d 100644 --- a/src/emc/rs274ngc/Submakefile +++ b/src/emc/rs274ngc/Submakefile @@ -38,6 +38,12 @@ USERSRCS += $(LIBRS274SRCS) $(call TOOBJSDEPS, $(LIBRS274SRCS)) : EXTRAFLAGS+=-fPIC $(BOOST_DEBUG_FLAGS) $(call TOOBJSDEPS, emc/rs274ngc/pyinterp1.cc emc/rs274ngc/pyparamclass.cc emc/rs274ngc/pyinterp1.cc emc/rs274ngc/pyblock.cc emc/rs274ngc/pyarrays.cc emc/rs274ngc/interpmodule.cc): EXTRAFLAGS += $(SILENCE_BOOST_INTERNAL_DIAGNOSTICS_FLAGS) +# Opt in before any header pulls in the Darwin SDK's . +RS274_CXX_TARGET := $(shell $(CXX) $(CXXFLAGS) $(CPPFLAGS) -dumpmachine) +ifneq ($(filter darwin% macos%,$(subst -, ,$(RS274_CXX_TARGET))),) +$(call TOOBJSDEPS, $(LIBRS274SRCS)) : EXTRAFLAGS += -D__MATH_LONG_DOUBLE_CONSTANTS +endif + TARGETS += ../lib/librs274.so ../lib/librs274.so.0 ../lib/librs274.so.0: $(patsubst %.cc,objects/%.o,$(LIBRS274SRCS)) \ From 21d676b08fb428eb01f7cd6a240b508b43ef5461 Mon Sep 17 00:00:00 2001 From: Steffen Moeller Date: Fri, 4 Dec 2026 12:02:42 +0100 Subject: [PATCH 2/2] rs274: select Darwin math flags using the configured host Substitute Autoconf's host_os into Makefile.inc so the interpreter can select the Darwin SDK opt-in using the host chosen by configure. --- src/Makefile.inc.in | 1 + src/emc/rs274ngc/Submakefile | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Makefile.inc.in b/src/Makefile.inc.in index 9b63996e75a..35ba5b11e6e 100644 --- a/src/Makefile.inc.in +++ b/src/Makefile.inc.in @@ -80,6 +80,7 @@ RTFLAGS := -I. -I@RTDIR@/include $(RTFLAGS) -DRTAPI -D_GNU_SOURCE -Drealtime ULFLAGS = -Wall -g -I. -I@RTDIR@/include -DULAPI -D_GNU_SOURCE -O2 -DLOCALE_DIR=\"$(localedir)\" -DPACKAGE=\"$(package)\" MODULE_EXT = @MODEXT@ BUILD_SYS = @BUILD_SYS@ +HOST_OS = @host_os@ BUILD_GUI = @BUILD_GUI@ CC = @CC@ MANDB = @MANDB@ diff --git a/src/emc/rs274ngc/Submakefile b/src/emc/rs274ngc/Submakefile index b9356df023d..b94baaf63ad 100644 --- a/src/emc/rs274ngc/Submakefile +++ b/src/emc/rs274ngc/Submakefile @@ -39,8 +39,7 @@ $(call TOOBJSDEPS, $(LIBRS274SRCS)) : EXTRAFLAGS+=-fPIC $(BOOST_DEBUG_FLAGS) $(call TOOBJSDEPS, emc/rs274ngc/pyinterp1.cc emc/rs274ngc/pyparamclass.cc emc/rs274ngc/pyinterp1.cc emc/rs274ngc/pyblock.cc emc/rs274ngc/pyarrays.cc emc/rs274ngc/interpmodule.cc): EXTRAFLAGS += $(SILENCE_BOOST_INTERNAL_DIAGNOSTICS_FLAGS) # Opt in before any header pulls in the Darwin SDK's . -RS274_CXX_TARGET := $(shell $(CXX) $(CXXFLAGS) $(CPPFLAGS) -dumpmachine) -ifneq ($(filter darwin% macos%,$(subst -, ,$(RS274_CXX_TARGET))),) +ifneq ($(filter darwin% macos%,$(HOST_OS)),) $(call TOOBJSDEPS, $(LIBRS274SRCS)) : EXTRAFLAGS += -D__MATH_LONG_DOUBLE_CONSTANTS endif