Skip to content

Commit aaf085f

Browse files
gh-154136: Define _ISOC23_SOURCE to fix building the math module on FreeBSD
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 1530b38 commit aaf085f

4 files changed

Lines changed: 19 additions & 0 deletions

File tree

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Fix building the :mod:`math` module on FreeBSD.
2+
Define ``_ISOC23_SOURCE`` to make the C23 library declarations
3+
(such as ``sinpi()`` in ``math.h``) visible.

configure

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

configure.ac

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -935,6 +935,12 @@ then
935935

936936
AC_DEFINE([_POSIX_C_SOURCE], [202405L],
937937
[Define to activate features from IEEE Std 1003.1-2024])
938+
939+
# Defining _POSIX_C_SOURCE and _XOPEN_SOURCE hides C23 library
940+
# declarations on FreeBSD (e.g. sinpi() in math.h) when compiling
941+
# with -std=c11. Defining _ISOC23_SOURCE makes them visible again.
942+
AC_DEFINE([_ISOC23_SOURCE], [1],
943+
[Define to activate ISO C23 library declarations])
938944
fi
939945

940946
# On HP-UX mbstate_t requires _INCLUDE__STDC_A1_SOURCE

pyconfig.h.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2143,6 +2143,9 @@
21432143
/* Define to include mbstate_t for mbrtowc */
21442144
#undef _INCLUDE__STDC_A1_SOURCE
21452145

2146+
/* Define to activate ISO C23 library declarations */
2147+
#undef _ISOC23_SOURCE
2148+
21462149
/* This must be defined on some systems to enable large file support. */
21472150
#undef _LARGEFILE_SOURCE
21482151

0 commit comments

Comments
 (0)