1From 61535b58452a18d6654a02fd25bfbc562bbbdbea Mon Sep 17 00:00:00 2001
2From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
3Date: Wed, 22 Feb 2017 17:23:42 -0800
4Subject: [PATCH] Add an option to disable the tk module
5
6Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
7Signed-off-by: Samuel Martin <s.martin49@gmail.com>
8[ Andrey Smirnov: ported to Python 3.6 ]
9Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
10[ Adam Duskett: ported to Python 3.10.0 ]
11Signed-off-by: Adam Duskett <aduskett@gmail.com>
12[ Bernd Kuhls: ported to Python 3.11.4]
13Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
14---
15 Makefile.pre.in | 11 +++++++----
16 configure.ac    |  9 +++++++++
17 2 files changed, 16 insertions(+), 4 deletions(-)
18
19diff --git a/Makefile.pre.in b/Makefile.pre.in
20index 1c7b38ce4f6..6ab184fe5f8 100644
21--- a/Makefile.pre.in
22+++ b/Makefile.pre.in
23@@ -1933,7 +1933,6 @@ LIBSUBDIRS=	asyncio \
24 		multiprocessing multiprocessing/dummy \
25 		re \
26 		site-packages \
27-		tkinter \
28 		tomllib \
29 		turtledemo \
30 		unittest \
31@@ -2060,9 +2059,6 @@ TESTSUBDIRS=	ctypes/test \
32 		test/xmltestdata \
33 		test/xmltestdata/c14n-20 \
34 		test/ziptestdata \
35-		tkinter/test \
36-		tkinter/test/test_tkinter \
37-		tkinter/test/test_ttk \
38 		unittest/test \
39 		unittest/test/testmock
40
41@@ -2082,6 +2078,13 @@ ifeq (@SQLITE3@,yes)
42 LIBSUBDIRS += sqlite3
43 endif
44
45+ifeq (@TK@,yes)
46+LIBSUBDIRS += tkinter
47+TESTSUBDIRS += tkinter/test tkinter/test/test_tkinter \
48+	tkinter/test/test_ttk
49+endif
50+
51+
52 TEST_MODULES=@TEST_MODULES@
53 libinstall:	all $(srcdir)/Modules/xxmodule.c
54 	@for i in $(SCRIPTDIR) $(LIBDEST); \
55diff --git a/configure.ac b/configure.ac
56index 0013afc9aad..342b295bcdd 100644
57--- a/configure.ac
58+++ b/configure.ac
59@@ -4231,6 +4231,15 @@ if test "$SQLITE3" = "no" ; then
60    DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _sqlite3"
61 fi
62
63+AC_SUBST(TK)
64+AC_ARG_ENABLE(tk,
65+	AS_HELP_STRING([--disable-tk], [disable tk]),
66+	[ TK="${enableval}" ], [ TK=yes ])
67+
68+if test "$TK" = "no"; then
69+   DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _tkinter"
70+fi
71+
72 AC_SUBST(PYDOC)
73
74 AC_ARG_ENABLE(pydoc,
75--
762.44.0
77
78