1From aba9392bf6bf68cfd63b1cecfdd3e96d5de2a0b7 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 | 5 ++++-
14 configure.ac    | 9 +++++++++
15 2 files changed, 13 insertions(+), 1 deletion(-)
16
17diff --git a/Makefile.pre.in b/Makefile.pre.in
18index 1a0ab0de426..1c7b38ce4f6 100644
19--- a/Makefile.pre.in
20+++ b/Makefile.pre.in
21@@ -1933,7 +1933,6 @@ LIBSUBDIRS=	asyncio \
22 		multiprocessing multiprocessing/dummy \
23 		re \
24 		site-packages \
25-		sqlite3 \
26 		tkinter \
27 		tomllib \
28 		turtledemo \
29@@ -2079,6 +2078,10 @@ TESTSUBDIRS += lib2to3/tests			\
30 	lib2to3/tests/data/fixers/myfixes
31 endif
32
33+ifeq (@SQLITE3@,yes)
34+LIBSUBDIRS += sqlite3
35+endif
36+
37 TEST_MODULES=@TEST_MODULES@
38 libinstall:	all $(srcdir)/Modules/xxmodule.c
39 	@for i in $(SCRIPTDIR) $(LIBDEST); \
40diff --git a/configure.ac b/configure.ac
41index bf91fb2f824..0013afc9aad 100644
42--- a/configure.ac
43+++ b/configure.ac
44@@ -4222,6 +4222,15 @@ AS_VAR_IF([posix_threads], [stub], [
45   AC_DEFINE([HAVE_PTHREAD_STUBS], [1], [Define if platform requires stubbed pthreads support])
46 ])
47
48+AC_SUBST(SQLITE3)
49+AC_ARG_ENABLE(sqlite3,
50+	AS_HELP_STRING([--disable-sqlite3], [disable sqlite3]),
51+	[ SQLITE3="${enableval}" ], [ SQLITE3=yes ])
52+
53+if test "$SQLITE3" = "no" ; then
54+   DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _sqlite3"
55+fi
56+
57 AC_SUBST(PYDOC)
58
59 AC_ARG_ENABLE(pydoc,
60--
612.44.0
62
63