]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-154136: Define _ISOC23_SOURCE to fix building the math module on FreeBSD (GH-154138)
authorSerhiy Storchaka <storchaka@gmail.com>
Mon, 20 Jul 2026 05:00:11 +0000 (08:00 +0300)
committerGitHub <noreply@github.com>
Mon, 20 Jul 2026 05:00:11 +0000 (08:00 +0300)
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Misc/NEWS.d/next/Build/2026-07-19-16-45-00.gh-issue-154136.mathpi.rst [new file with mode: 0644]
configure
configure.ac
pyconfig.h.in

diff --git a/Misc/NEWS.d/next/Build/2026-07-19-16-45-00.gh-issue-154136.mathpi.rst b/Misc/NEWS.d/next/Build/2026-07-19-16-45-00.gh-issue-154136.mathpi.rst
new file mode 100644 (file)
index 0000000..9bfa313
--- /dev/null
@@ -0,0 +1,3 @@
+Fix building the :mod:`math` module on FreeBSD.
+Define ``_ISOC23_SOURCE`` to make the C23 library declarations
+(such as ``sinpi()`` in ``math.h``) visible.
index b7ba4994b30e701147347c7d4aec90199190c82d..71fa0b435d16505463b2786fc39a35792bbead8a 100755 (executable)
--- a/configure
+++ b/configure
@@ -4809,6 +4809,13 @@ printf "%s\n" "#define _XOPEN_SOURCE_EXTENDED 1" >>confdefs.h
 
 printf "%s\n" "#define _POSIX_C_SOURCE 202405L" >>confdefs.h
 
+
+  # Defining _POSIX_C_SOURCE and _XOPEN_SOURCE hides C23 library
+  # declarations on FreeBSD (e.g. sinpi() in math.h) when compiling
+  # with -std=c11.  Defining _ISOC23_SOURCE makes them visible again.
+
+printf "%s\n" "#define _ISOC23_SOURCE 1" >>confdefs.h
+
 fi
 
 # On HP-UX mbstate_t requires _INCLUDE__STDC_A1_SOURCE
index 5e98a4f91c8d5edd529ca1c8aab88e6d1c04d7c6..5fcf406087cbe5ee9f874835b5e90baac87b0ed5 100644 (file)
@@ -935,6 +935,12 @@ then
 
   AC_DEFINE([_POSIX_C_SOURCE], [202405L],
             [Define to activate features from IEEE Std 1003.1-2024])
+
+  # Defining _POSIX_C_SOURCE and _XOPEN_SOURCE hides C23 library
+  # declarations on FreeBSD (e.g. sinpi() in math.h) when compiling
+  # with -std=c11.  Defining _ISOC23_SOURCE makes them visible again.
+  AC_DEFINE([_ISOC23_SOURCE], [1],
+            [Define to activate ISO C23 library declarations])
 fi
 
 # On HP-UX mbstate_t requires _INCLUDE__STDC_A1_SOURCE
index e259eda7439761e400471dababa08cb1cff4e025..25c4842d25e8a672b1e95d8a23d43f8a5d7fb969 100644 (file)
 /* Define to include mbstate_t for mbrtowc */
 #undef _INCLUDE__STDC_A1_SOURCE
 
+/* Define to activate ISO C23 library declarations */
+#undef _ISOC23_SOURCE
+
 /* This must be defined on some systems to enable large file support. */
 #undef _LARGEFILE_SOURCE