Skip to content

rs274: provide Darwin long-double math constants - #4960

Open
smoe wants to merge 2 commits into
LinuxCNC:masterfrom
smoe:codex/darwin-interpreter-constants-upstream
Open

smoe wants to merge 2 commits into
LinuxCNC:masterfrom
smoe:codex/darwin-interpreter-constants-upstream

Conversation

@smoe

@smoe smoe commented Dec 4, 2026

Copy link
Copy Markdown
Collaborator

The interpreter uses M_PIl and M_PI_2l, which the macOS SDK does not expose.

This patch supplies pi and pi/2 as long double in the private interpreter header, using the SDK's own literals.
It defines each constant only when it is missing on Darwin. That constraint for the macOS/Darwin does not seem necessary, but it provides context on why these definitions are performed and more operating systems hopefully join in the not too far future.

Comment thread src/emc/rs274ngc/interp_internal.hh Resolved
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.
@smoe
smoe force-pushed the codex/darwin-interpreter-constants-upstream branch from 6ebf609 to 98fad54 Compare December 4, 2026 10:56
@smoe
smoe marked this pull request as draft December 4, 2026 11:00
Substitute Autoconf's host_os into Makefile.inc so the interpreter can
select the Darwin SDK opt-in using the host chosen by configure.
@smoe
smoe marked this pull request as ready for review December 4, 2026 11:07
@smoe

smoe commented Dec 4, 2026

Copy link
Copy Markdown
Collaborator Author

Did not like that local test of the host operating system, now forwarding it from configure. The already available "BUILD_SYS" is something else, which confused me.

@BsAtHome

BsAtHome commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

Did not like that local test of the host operating system, now forwarding it from configure.

You new version looks very clean and simple.

The already available "BUILD_SYS" is something else, which confused me.

Yeah, that denotes whether it is building the code from the tree (used often in tests not possible in installed code).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants