From a73c58ff91363a2d91ecce5b321edd510d15e5bf Mon Sep 17 00:00:00 2001 From: "Miss Islington (bot)" <31488909+miss-islington@users.noreply.github.com> Date: Sat, 11 Jul 2026 12:06:23 +0200 Subject: [PATCH] [3.13] gh-126877: Fix the configure check for Tcl/Tk with optimizing compilers (GH-153543) (GH-153555) The check assigned the addresses of Tcl_Init() and Tk_Init() to unused variables, which optimizing compilers can eliminate, so it linked even when the libraries were missing. Call the functions instead. (cherry picked from commit ff0a9ae269fa38c21f01bdea1a7ff5d439c4f681) Co-authored-by: Serhiy Storchaka Co-authored-by: Claude Opus 4.8 --- .../next/Build/2026-07-11-07-26-16.gh-issue-126877.Zt7Kq2.rst | 2 ++ configure | 4 ++-- configure.ac | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) create mode 100644 Misc/NEWS.d/next/Build/2026-07-11-07-26-16.gh-issue-126877.Zt7Kq2.rst diff --git a/Misc/NEWS.d/next/Build/2026-07-11-07-26-16.gh-issue-126877.Zt7Kq2.rst b/Misc/NEWS.d/next/Build/2026-07-11-07-26-16.gh-issue-126877.Zt7Kq2.rst new file mode 100644 index 000000000000..1d7d4fad886c --- /dev/null +++ b/Misc/NEWS.d/next/Build/2026-07-11-07-26-16.gh-issue-126877.Zt7Kq2.rst @@ -0,0 +1,2 @@ +Fix the :program:`configure` check for Tcl/Tk which could wrongly succeed +with optimizing compilers when the libraries are missing. diff --git a/configure b/configure index 476aeed494ed..4d2b7cb6375b 100755 --- a/configure +++ b/configure @@ -16268,8 +16268,8 @@ int main (void) { - void *x1 = Tcl_Init; - void *x2 = Tk_Init; + Tcl_Init(NULL); + Tk_Init(NULL); ; return 0; diff --git a/configure.ac b/configure.ac index f57d4ff57375..030547d67aaa 100644 --- a/configure.ac +++ b/configure.ac @@ -4445,8 +4445,8 @@ WITH_SAVE_ENV([ # error "Tk older than 8.5.12 not supported" #endif ], [ - void *x1 = Tcl_Init; - void *x2 = Tk_Init; + Tcl_Init(NULL); + Tk_Init(NULL); ]) ], [ have_tcltk=yes -- 2.47.3