1From dd2722dec08eb9c72c36313e93661eeca3ad64d8 Mon Sep 17 00:00:00 2001
2From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
3Date: Wed, 22 Feb 2017 17:20:45 -0800
4Subject: [PATCH] Add option to disable the sqlite3 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---
13 Makefile.pre.in | 7 +++++--
14 configure.ac    | 9 +++++++++
15 2 files changed, 14 insertions(+), 2 deletions(-)
16
17diff --git a/Makefile.pre.in b/Makefile.pre.in
18index 5847029..5628860 100644
19--- a/Makefile.pre.in
20+++ b/Makefile.pre.in
21@@ -1446,7 +1446,6 @@ LIBSUBDIRS=	asyncio \
22 		logging \
23 		multiprocessing multiprocessing/dummy \
24 		site-packages \
25-		sqlite3 \
26 		tkinter \
27 		turtledemo \
28 		unittest \
29@@ -1459,7 +1458,6 @@ LIBSUBDIRS=	asyncio \
30 TESTSUBDIRS=	ctypes/test \
31 		distutils/tests \
32 		idlelib/idle_test \
33-		sqlite3/test \
34 		test test/audiodata \
35 		test/capath test/cjkencodings \
36 		test/data test/decimaltestdata \
37@@ -1540,6 +1538,11 @@ TESTSUBDIRS += lib2to3/tests			\
38 	lib2to3/tests/data/fixers/myfixes
39 endif
40
41+ifeq (@SQLITE3@,yes)
42+LIBSUBDIRS += sqlite3
43+TESTSUBDIRS += sqlite3/test
44+endif
45+
46 TEST_MODULES=@TEST_MODULES@
47 libinstall:	build_all $(srcdir)/Modules/xxmodule.c
48 	@for i in $(SCRIPTDIR) $(LIBDEST); \
49diff --git a/configure.ac b/configure.ac
50index 34c2ba9..dfee472 100644
51--- a/configure.ac
52+++ b/configure.ac
53@@ -3373,6 +3373,15 @@ if test "$posix_threads" = "yes"; then
54       AC_CHECK_FUNCS(pthread_getcpuclockid)
55 fi
56
57+AC_SUBST(SQLITE3)
58+AC_ARG_ENABLE(sqlite3,
59+	AS_HELP_STRING([--disable-sqlite3], [disable sqlite3]),
60+	[ SQLITE3="${enableval}" ], [ SQLITE3=yes ])
61+
62+if test "$SQLITE3" = "no" ; then
63+   DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _sqlite3"
64+fi
65+
66 AC_SUBST(PYDOC)
67
68 AC_ARG_ENABLE(pydoc,
69--
702.30.2
71
72