diff --git a/Misc/NEWS.d/next/Build/2026-07-20-20-30-00.gh-issue-154271.solxopen.rst b/Misc/NEWS.d/next/Build/2026-07-20-20-30-00.gh-issue-154271.solxopen.rst new file mode 100644 index 00000000000000..7f1744b797015a --- /dev/null +++ b/Misc/NEWS.d/next/Build/2026-07-20-20-30-00.gh-issue-154271.solxopen.rst @@ -0,0 +1,4 @@ +Define ``_XOPEN_SOURCE=600`` on Solaris and illumos, so that on illumos the +socket module is built with :meth:`~socket.socket.sendmsg`, +:meth:`~socket.socket.recvmsg` and the ``CMSG_*`` helpers. This also +enables the ``forkserver`` :mod:`multiprocessing` start method. diff --git a/configure b/configure index 58f3dfc119ec13..7e729832a8e76c 100755 --- a/configure +++ b/configure @@ -4742,11 +4742,8 @@ printf "%s\n" "#define _BSD_SOURCE 1" >>confdefs.h # Marc Recht NetBSD/1.5 | NetBSD/1.5.* | NetBSD/1.6 | NetBSD/1.6.* | NetBSD/1.6[A-S]) define_xopen_source=no;; - # From the perspective of Solaris, _XOPEN_SOURCE is not so much a - # request to enable features supported by the standard as a request - # to disable features not supported by the standard. The best way - # for Python to use Solaris is simply to leave _XOPEN_SOURCE out - # entirely and define __EXTENSIONS__ instead. + # On Solaris, _XOPEN_SOURCE=800 hides platform specific features. + # A lower level is defined below. SunOS/*) define_xopen_source=no;; # On UnixWare 7, u_long is never defined with _XOPEN_SOURCE, @@ -4816,6 +4813,15 @@ printf "%s\n" "#define _POSIX_C_SOURCE 202405L" >>confdefs.h printf "%s\n" "#define _ISOC23_SOURCE 1" >>confdefs.h +elif test "$ac_sys_system" = "SunOS" +then + # On illumos the socket ancillary-data API (CMSG_*, sendmsg(), recvmsg()) + # is declared only with _XOPEN_SOURCE >= 600; Solaris declares it anyway. + # __EXTENSIONS__ keeps the platform specific features which _XOPEN_SOURCE + # would otherwise hide. See gh-57208. + +printf "%s\n" "#define _XOPEN_SOURCE 600" >>confdefs.h + fi # On HP-UX mbstate_t requires _INCLUDE__STDC_A1_SOURCE diff --git a/configure.ac b/configure.ac index 273a64814f9a1f..d41223aff51565 100644 --- a/configure.ac +++ b/configure.ac @@ -871,11 +871,8 @@ case $ac_sys_system/$ac_sys_release in # Marc Recht NetBSD/1.5 | NetBSD/1.5.* | NetBSD/1.6 | NetBSD/1.6.* | NetBSD/1.6@<:@A-S@:>@) define_xopen_source=no;; - # From the perspective of Solaris, _XOPEN_SOURCE is not so much a - # request to enable features supported by the standard as a request - # to disable features not supported by the standard. The best way - # for Python to use Solaris is simply to leave _XOPEN_SOURCE out - # entirely and define __EXTENSIONS__ instead. + # On Solaris, _XOPEN_SOURCE=800 hides platform specific features. + # A lower level is defined below. SunOS/*) define_xopen_source=no;; # On UnixWare 7, u_long is never defined with _XOPEN_SOURCE, @@ -941,6 +938,14 @@ then # with -std=c11. Defining _ISOC23_SOURCE makes them visible again. AC_DEFINE([_ISOC23_SOURCE], [1], [Define to activate ISO C23 library declarations]) +elif test "$ac_sys_system" = "SunOS" +then + # On illumos the socket ancillary-data API (CMSG_*, sendmsg(), recvmsg()) + # is declared only with _XOPEN_SOURCE >= 600; Solaris declares it anyway. + # __EXTENSIONS__ keeps the platform specific features which _XOPEN_SOURCE + # would otherwise hide. See gh-57208. + AC_DEFINE([_XOPEN_SOURCE], [600], + [Define to the level of X/Open that your system supports]) fi # On HP-UX mbstate_t requires _INCLUDE__STDC_A1_SOURCE