bpo-20210: Support the *disabled* marker in Setup files (GH-132)

Extension modules listed after the *disabled* marker are not built at all,
neither by the Makefile nor by setup.py.
diff --git a/Modules/Setup.dist b/Modules/Setup.dist
index 8b87fc8..6b4c217 100644
--- a/Modules/Setup.dist
+++ b/Modules/Setup.dist
@@ -11,8 +11,17 @@
 # directory.)
 
 # Each line in this file describes one or more optional modules.
-# Modules enabled here will not be compiled by the setup.py script,
+# Modules configured here will not be compiled by the setup.py script,
 # so the file can be used to override setup.py's behavior.
+# Tag lines containing just the word "*static*", "*shared*" or "*disabled*"
+# (without the quotes but with the stars) are used to tag the following module
+# descriptions. Tag lines may alternate throughout this file.  Modules are
+# built statically when they are preceded by a "*static*" tag line or when
+# there is no tag line between the start of the file and the module
+# description.  Modules are built as a shared library when they are preceded by
+# a "*shared*" tag line.  Modules are not built at all, not by the Makefile,
+# nor by the setup.py script, when they are preceded by a "*disabled*" tag
+# line.
 
 # Lines have the following structure:
 #
@@ -34,9 +43,7 @@
 #
 # which defines a Make variable definition inserted into Makefile.in
 #
-# Finally, if a line contains just the word "*shared*" (without the
-# quotes but with the stars), then the following modules will not be
-# built statically.  The build process works like this:
+# The build process works like this:
 #
 # 1. Build all modules that are declared as static in Modules/Setup,
 #    combine them into libpythonxy.a, combine that into python.
@@ -57,10 +64,6 @@
 # toplevel "make install" target.)  (For compatibility,
 # *noconfig* has the same effect as *shared*.)
 #
-# In addition, *static* explicitly declares the following modules to
-# be static.  Lines containing "*static*" and "*shared*" may thus
-# alternate throughout this file.
-
 # NOTE: As a standard policy, as many modules as can be supported by a
 # platform should be present.  The distribution comes with all modules
 # enabled that are supported by most platforms and don't require you
@@ -152,7 +155,7 @@
 
 # Uncommenting the following line tells makesetup that all following
 # modules are to be built as shared libraries (see above for more
-# detail; also note that *static* reverses this effect):
+# detail; also note that *static* or *disabled* cancels this effect):
 
 #*shared*
 
@@ -394,3 +397,11 @@
 
 # Another example -- the 'xxsubtype' module shows C-level subtyping in action
 xxsubtype xxsubtype.c
+
+# Uncommenting the following line tells makesetup that all following modules
+# are not built (see above for more detail).
+#
+#*disabled*
+#
+#_sqlite3 _tkinter _curses pyexpat
+#_codecs_jp _codecs_kr _codecs_tw unicodedata
diff --git a/Modules/makesetup b/Modules/makesetup
index d6f766e..31faf86 100755
--- a/Modules/makesetup
+++ b/Modules/makesetup
@@ -29,7 +29,9 @@
 #
 # Copying Makefile.pre to Makefile:
 # - insert an identifying comment at the start
-# - replace _MODNAMES_ by the list of modules from Setup
+# - replace _MODBUILT_NAMES_ by the list of *static* and *shared* modules
+#   from Setup
+# - replace _MODDISABLED_NAMES_ by the list of *disabled* modules from Setup
 # - replace _MODOBJS_ by the list of objects from Setup (except for
 #   Setup files after a -n option)
 # - replace _MODLIBS_ by the list of libraries from Setup
@@ -111,7 +113,8 @@
 # Rules appended by makedepend
 " >$rulesf
 	DEFS=
-	NAMES=
+	BUILT=
+	DISABLED=
 	MODS=
 	SHAREDMODS=
 	OBJS=
@@ -143,6 +146,7 @@
 		'*static*')	doconfig=yes; continue;;
 		'*noconfig*')	doconfig=no; continue;;
 		'*shared*')	doconfig=no; continue;;
+		'*disabled*')	doconfig=disabled; continue;;
 		esac
 		srcs=
 		cpps=
@@ -183,7 +187,7 @@
 			*.*)		echo 1>&2 "bad word $arg in $line"
 					exit 1;;
 			-u)		skip=libs; libs="$libs -u";;
-			[a-zA-Z_]*)	NAMES="$NAMES $arg"; mods="$mods $arg";;
+			[a-zA-Z_]*)	mods="$mods $arg";;
 			*)		echo 1>&2 "bad word $arg in $line"
 					exit 1;;
 			esac
@@ -192,6 +196,14 @@
 		yes)
 			LIBS="$LIBS $libs"
 			MODS="$MODS $mods"
+			BUILT="$BUILT $mods"
+			;;
+		no)
+			BUILT="$BUILT $mods"
+			;;
+		disabled)
+			DISABLED="$DISABLED $mods"
+			continue
 			;;
 		esac
 		case $noobjects in
@@ -282,7 +294,8 @@
 		echo "1i\\" >$sedf
 		str="# Generated automatically from $makepre by makesetup."
 		echo "$str" >>$sedf
-		echo "s%_MODNAMES_%$NAMES%" >>$sedf
+		echo "s%_MODBUILT_NAMES_%$BUILT%" >>$sedf
+		echo "s%_MODDISABLED_NAMES_%$DISABLED%" >>$sedf
 		echo "s%_MODOBJS_%$OBJS%" >>$sedf
 		echo "s%_MODLIBS_%$LIBS%" >>$sedf
 		echo "/Definitions added by makesetup/a$NL$NL$DEFS" >>$sedf