diff --git a/Misc/NEWS.d/next/Build/2026-10-20-17-50-00.gh-issue-143632.PrCtlM.rst b/Misc/NEWS.d/next/Build/2026-10-20-17-50-00.gh-issue-143632.PrCtlM.rst new file mode 100644 index 000000000000000..5a2c7b8208cd363 --- /dev/null +++ b/Misc/NEWS.d/next/Build/2026-10-20-17-50-00.gh-issue-143632.PrCtlM.rst @@ -0,0 +1,3 @@ +Fix the check that disables ``PR_SET_VMA_ANON_NAME`` on musl libc: it tested +an unset variable, so it never had any effect and the build could fail with +a redefinition of ``struct prctl_mm_map``. diff --git a/configure b/configure index 217d8e135600e16..07299e2c3ac312b 100755 --- a/configure +++ b/configure @@ -25504,12 +25504,14 @@ printf "%s\n" "#define HAVE_UT_NAMESIZE 1" >>confdefs.h fi -# musl libc redefines struct prctl_mm_map and conflicts with linux/prctl.h -if test "$ac_cv_libc" != musl -then : - -ac_fn_check_decl "$LINENO" "PR_SET_VMA_ANON_NAME" "ac_cv_have_decl_PR_SET_VMA_ANON_NAME" "#include - #include +# musl libc redefines struct prctl_mm_map and conflicts with linux/prctl.h. +# The conftest does not reliably catch this, so skip the check on musl. +case $host in #( + *-musl*) : + ;; #( + *) : + ac_fn_check_decl "$LINENO" "PR_SET_VMA_ANON_NAME" "ac_cv_have_decl_PR_SET_VMA_ANON_NAME" "#include + #include " "$ac_c_undeclared_builtin_options" "CFLAGS" if test "x$ac_cv_have_decl_PR_SET_VMA_ANON_NAME" = xyes then : @@ -25526,8 +25528,8 @@ printf "%s\n" "#define _Py_HAVE_PR_SET_VMA_ANON_NAME 1" >>confdefs.h fi - -fi + ;; +esac # check for openpty, login_tty, and forkpty diff --git a/configure.ac b/configure.ac index ca804d6448810d2..d1f1f7a4df46964 100644 --- a/configure.ac +++ b/configure.ac @@ -6005,15 +6005,17 @@ AC_CHECK_DECLS([UT_NAMESIZE], [Define if you have the 'HAVE_UT_NAMESIZE' constant.])], [], [@%:@include ]) -# musl libc redefines struct prctl_mm_map and conflicts with linux/prctl.h -AS_IF([test "$ac_cv_libc" != musl], [ -AC_CHECK_DECLS([PR_SET_VMA_ANON_NAME], - [AC_DEFINE([_Py_HAVE_PR_SET_VMA_ANON_NAME], [1], - [Define if you have the 'PR_SET_VMA_ANON_NAME' constant.])], - [], - [@%:@include - @%:@include ]) -]) +# musl libc redefines struct prctl_mm_map and conflicts with linux/prctl.h. +# The conftest does not reliably catch this, so skip the check on musl. +AS_CASE([$host], + [*-musl*], [], + [AC_CHECK_DECLS([PR_SET_VMA_ANON_NAME], + [AC_DEFINE([_Py_HAVE_PR_SET_VMA_ANON_NAME], [1], + [Define if you have the 'PR_SET_VMA_ANON_NAME' constant.])], + [], + [@%:@include + @%:@include ])] +) # check for openpty, login_tty, and forkpty AC_CHECK_FUNCS([openpty], [],