diff --git Lib/cgi.py Lib/cgi.py
index 77ab703..bfe1e7a 100755
--- Lib/cgi.py
+++ Lib/cgi.py
@@ -1,13 +1,6 @@
-#! /usr/local/bin/python
-
-# NOTE: the above "/usr/local/bin/python" is NOT a mistake.  It is
-# intentionally NOT "/usr/bin/env python".  On many systems
-# (e.g. Solaris), /usr/local/bin is not in $PATH as passed to CGI
-# scripts, and /usr/local/bin is the default directory where Python is
-# installed, so /usr/bin/env would be unable to find python.  Granted,
-# binary installations by Linux vendors often install Python in
-# /usr/bin.  So let those vendors patch cgi.py to match their choice
-# of installation.
+#! /opt/local/bin/python3.9
+
+# NOTE: /usr/local/bin/python patched for MacPorts installation
 
 """Support module for CGI (Common Gateway Interface) scripts.
 
diff --git Lib/ctypes/macholib/dyld.py Lib/ctypes/macholib/dyld.py
index 1c3f8fd..cac41e6 100644
--- Lib/ctypes/macholib/dyld.py
+++ Lib/ctypes/macholib/dyld.py
@@ -28,7 +28,7 @@ DEFAULT_FRAMEWORK_FALLBACK = [
 
 DEFAULT_LIBRARY_FALLBACK = [
     os.path.expanduser("~/lib"),
-    "/usr/local/lib",
+    "/opt/local/lib",
     "/lib",
     "/usr/lib",
 ]
diff --git Makefile.pre.in Makefile.pre.in
index f128444..85bde2b 100644
--- Makefile.pre.in
+++ Makefile.pre.in
@@ -629,10 +629,10 @@ sharedmods: $(BUILDPYTHON) pybuilddir.txt Modules/_math.o
 	esac; \
 	echo "$(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \
 		_TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \
-		$(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build"; \
+		$(PYTHON_FOR_BUILD) $(srcdir)/setup.py --no-user-cfg $$quiet build"; \
 	$(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \
 		_TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \
-		$(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build
+		$(PYTHON_FOR_BUILD) $(srcdir)/setup.py --no-user-cfg $$quiet build
 
 
 # Build static library
@@ -1673,7 +1673,7 @@ libainstall:	@DEF_MAKE_RULE@ python-config
 # Install the dynamically loadable modules
 # This goes into $(exec_prefix)
 sharedinstall: sharedmods
-	$(RUNSHARED) $(PYTHON_FOR_BUILD) $(srcdir)/setup.py install \
+	$(RUNSHARED) $(PYTHON_FOR_BUILD) $(srcdir)/setup.py --no-user-cfg install \
 	   	--prefix=$(prefix) \
 		--install-scripts=$(BINDIR) \
 		--install-platlib=$(DESTSHARED) \
diff --git Modules/readline.c Modules/readline.c
index 12d6cc7..c1932da 100644
--- Modules/readline.c
+++ Modules/readline.c
@@ -28,8 +28,7 @@
 
 /* GNU readline definitions */
 #undef HAVE_CONFIG_H /* Else readline/chardefs.h includes strings.h */
-#include <readline/readline.h>
-#include <readline/history.h>
+#include <editline/readline.h>
 
 #ifdef HAVE_RL_COMPLETION_MATCHES
 #define completion_matches(x, y) \
diff --git configure configure
index 2d379fe..d88fe6d 100755
--- configure
+++ configure
@@ -3222,6 +3222,8 @@ if test "${enable_framework+set}" = set; then :
 			;;
 		esac
 
+		FRAMEWORKINSTALLAPPSPREFIX="/Applications/MacPorts"
+
 		prefix=$PYTHONFRAMEWORKINSTALLDIR/Versions/$VERSION
 
 		# Add files for Mac specific code to the list of output
@@ -7467,18 +7469,18 @@ $as_echo "$CC" >&6; }
         then
             case "$UNIVERSAL_ARCHS" in
             32-bit)
-               UNIVERSAL_ARCH_FLAGS="-arch ppc -arch i386"
+               UNIVERSAL_ARCH_FLAGS="-arch arm64 -arch x86_64"
                LIPO_32BIT_FLAGS=""
                ARCH_RUN_32BIT=""
                ;;
             64-bit)
-               UNIVERSAL_ARCH_FLAGS="-arch ppc64 -arch x86_64"
+               UNIVERSAL_ARCH_FLAGS="-arch arm64 -arch x86_64"
                LIPO_32BIT_FLAGS=""
                ARCH_RUN_32BIT="true"
                ;;
             all)
-               UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch ppc64 -arch x86_64"
-               LIPO_32BIT_FLAGS="-extract ppc7400 -extract i386"
+               UNIVERSAL_ARCH_FLAGS="-arch arm64 -arch x86_64"
+               LIPO_32BIT_FLAGS=""
                ARCH_RUN_32BIT="/usr/bin/arch -i386 -ppc"
                ;;
             universal2)
@@ -7487,23 +7489,23 @@ $as_echo "$CC" >&6; }
                ARCH_RUN_32BIT="true"
 		;;
             intel)
-               UNIVERSAL_ARCH_FLAGS="-arch i386 -arch x86_64"
-               LIPO_32BIT_FLAGS="-extract i386"
+               UNIVERSAL_ARCH_FLAGS="-arch arm64 -arch x86_64"
+               LIPO_32BIT_FLAGS=""
                ARCH_RUN_32BIT="/usr/bin/arch -i386"
                ;;
             intel-32)
-               UNIVERSAL_ARCH_FLAGS="-arch i386"
+               UNIVERSAL_ARCH_FLAGS="-arch arm64 -arch x86_64"
                LIPO_32BIT_FLAGS=""
                ARCH_RUN_32BIT=""
                ;;
             intel-64)
-               UNIVERSAL_ARCH_FLAGS="-arch x86_64"
+               UNIVERSAL_ARCH_FLAGS="-arch arm64 -arch x86_64"
                LIPO_32BIT_FLAGS=""
                ARCH_RUN_32BIT="true"
                ;;
             3-way)
-               UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch x86_64"
-               LIPO_32BIT_FLAGS="-extract ppc7400 -extract i386"
+               UNIVERSAL_ARCH_FLAGS="-arch arm64 -arch x86_64"
+               LIPO_32BIT_FLAGS=""
                ARCH_RUN_32BIT="/usr/bin/arch -i386 -ppc"
                ;;
             *)
@@ -11072,10 +11074,10 @@ else
       main() {
         pthread_attr_t attr;
         pthread_t id;
-        if (pthread_attr_init(&attr)) exit(-1);
-        if (pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM)) exit(-1);
-        if (pthread_create(&id, &attr, foo, NULL)) exit(-1);
-        exit(0);
+        if (pthread_attr_init(&attr)) return (-1);
+        if (pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM)) return (-1);
+        if (pthread_create(&id, &attr, foo, NULL)) return (-1);
+        return (0);
       }
 _ACEOF
 if ac_fn_c_try_run "$LINENO"; then :
@@ -15083,7 +15085,7 @@ else
   int main()
   {
 	/* Success: exit code 0 */
-        exit((((wchar_t) -1) < ((wchar_t) 0)) ? 0 : 1);
+        return ((((wchar_t) -1) < ((wchar_t) 0)) ? 0 : 1);
   }
 
 _ACEOF
@@ -15464,7 +15466,7 @@ else
 
 int main()
 {
-	exit(((-1)>>3 == -1) ? 0 : 1);
+	return (((-1)>>3 == -1) ? 0 : 1);
 }
 
 _ACEOF
@@ -15541,9 +15543,9 @@ py_cv_lib_readline=no
 $as_echo_n "checking how to link readline libs... " >&6; }
 for py_libtermcap in "" tinfo ncursesw ncurses curses termcap; do
   if test -z "$py_libtermcap"; then
-    READLINE_LIBS="-lreadline"
+    READLINE_LIBS="-ledit"
   else
-    READLINE_LIBS="-lreadline -l$py_libtermcap"
+    READLINE_LIBS="-ledit -l$py_libtermcap"
   fi
   LIBS="$READLINE_LIBS $LIBS_no_readline"
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -15589,7 +15591,7 @@ fi
 # check for readline 2.2
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <readline/readline.h>
+#include <editline/readline.h>
 _ACEOF
 if ac_fn_c_try_cpp "$LINENO"; then :
   have_readline=yes
@@ -15602,7 +15604,7 @@ if test $have_readline = yes
 then
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <readline/readline.h>
+#include <editline/readline.h>
 
 _ACEOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
@@ -15615,7 +15617,7 @@ rm -f conftest*
 
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <readline/readline.h>
+#include <editline/readline.h>
 
 _ACEOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
@@ -15629,13 +15631,13 @@ rm -f conftest*
 fi
 
 # check for readline 4.0
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_pre_input_hook in -lreadline" >&5
-$as_echo_n "checking for rl_pre_input_hook in -lreadline... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_pre_input_hook in -ledit" >&5
+$as_echo_n "checking for rl_pre_input_hook in -ledit... " >&6; }
 if ${ac_cv_lib_readline_rl_pre_input_hook+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lreadline $READLINE_LIBS $LIBS"
+LIBS="-ledit $READLINE_LIBS $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -15673,13 +15675,13 @@ fi
 
 
 # also in 4.0
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_completion_display_matches_hook in -lreadline" >&5
-$as_echo_n "checking for rl_completion_display_matches_hook in -lreadline... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_completion_display_matches_hook in -ledit" >&5
+$as_echo_n "checking for rl_completion_display_matches_hook in -ledit... " >&6; }
 if ${ac_cv_lib_readline_rl_completion_display_matches_hook+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lreadline $READLINE_LIBS $LIBS"
+LIBS="-ledit $READLINE_LIBS $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -15717,13 +15719,13 @@ fi
 
 
 # also in 4.0, but not in editline
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_resize_terminal in -lreadline" >&5
-$as_echo_n "checking for rl_resize_terminal in -lreadline... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_resize_terminal in -ledit" >&5
+$as_echo_n "checking for rl_resize_terminal in -ledit... " >&6; }
 if ${ac_cv_lib_readline_rl_resize_terminal+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lreadline $READLINE_LIBS $LIBS"
+LIBS="-ledit $READLINE_LIBS $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -15761,13 +15763,13 @@ fi
 
 
 # check for readline 4.2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_completion_matches in -lreadline" >&5
-$as_echo_n "checking for rl_completion_matches in -lreadline... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_completion_matches in -ledit" >&5
+$as_echo_n "checking for rl_completion_matches in -ledit... " >&6; }
 if ${ac_cv_lib_readline_rl_completion_matches+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lreadline $READLINE_LIBS $LIBS"
+LIBS="-ledit $READLINE_LIBS $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -15807,7 +15809,7 @@ fi
 # also in readline 4.2
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <readline/readline.h>
+#include <editline/readline.h>
 _ACEOF
 if ac_fn_c_try_cpp "$LINENO"; then :
   have_readline=yes
@@ -15820,7 +15822,7 @@ if test $have_readline = yes
 then
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <readline/readline.h>
+#include <editline/readline.h>
 
 _ACEOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
@@ -15833,13 +15835,13 @@ rm -f conftest*
 
 fi
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for append_history in -lreadline" >&5
-$as_echo_n "checking for append_history in -lreadline... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for append_history in -ledit" >&5
+$as_echo_n "checking for append_history in -ledit... " >&6; }
 if ${ac_cv_lib_readline_append_history+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lreadline $READLINE_LIBS $LIBS"
+LIBS="-ledit $READLINE_LIBS $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -15934,6 +15936,7 @@ else
 /* end confdefs.h.  */
 
 #include <poll.h>
+#include <unistd.h>
 
 int main()
 {
@@ -17063,6 +17066,24 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
     volatile int val = 1;
     int main() {
       __atomic_load_n(&val, __ATOMIC_SEQ_CST);
+
+      /* https://bugs.python.org/issue24844 */
+      #define VERSION_CHECK(cc_major, cc_minor, req_major, req_minor) \
+          ((cc_major) > (req_major) || \
+          (cc_major) == (req_major) && (cc_minor) >= (req_minor))
+      #if defined(__clang__)
+          #if defined(__apple_build_version__)
+              // either one test or the other should work
+              // #if __apple_build_version__ < 5000000
+              #if !VERSION_CHECK(__clang_major__, __clang_minor__, 5, 0)
+                  #error
+              #endif
+          // not sure if this is 3.3 or 3.4
+          #elif !VERSION_CHECK(__clang_major__, __clang_minor__, 3, 3)
+              #error
+          #endif
+      #endif
+
       return 0;
     }
 
diff --git setup.py setup.py
index bd5f736..3bee673 100644
--- setup.py
+++ setup.py
@@ -44,7 +44,7 @@ from distutils.spawn import find_executable
 TEST_EXTENSIONS = True
 
 # This global variable is used to hold the list of modules to be disabled.
-DISABLED_MODULE_LIST = []
+DISABLED_MODULE_LIST = ['_tkinter', '_gdbm']
 
 
 def get_platform():
@@ -728,9 +728,6 @@ class PyBuildExt(build_ext):
         # Ensure that /usr/local is always used, but the local build
         # directories (i.e. '.' and 'Include') must be first.  See issue
         # 10520.
-        if not CROSS_COMPILING:
-            add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
-            add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
         # only change this for cross builds for 3.3, issues on Mageia
         if CROSS_COMPILING:
             self.add_cross_compiling_paths()
@@ -963,7 +960,7 @@ class PyBuildExt(build_ext):
 
     def detect_readline_curses(self):
         # readline
-        do_readline = self.compiler.find_library_file(self.lib_dirs, 'readline')
+        do_readline = self.compiler.find_library_file(self.lib_dirs, 'edit')
         readline_termcap_library = ""
         curses_library = ""
         # Cannot use os.popen here in py3k.
@@ -1033,7 +1030,7 @@ class PyBuildExt(build_ext):
             else:
                 readline_extra_link_args = ()
 
-            readline_libs = ['readline']
+            readline_libs = ['edit']
             if readline_termcap_library:
                 pass # Issue 7384: Already linked against curses or tinfo.
             elif curses_library:
@@ -1981,8 +1978,8 @@ class PyBuildExt(build_ext):
         # Rather than complicate the code below, detecting and building
         # AquaTk is a separate method. Only one Tkinter will be built on
         # Darwin - either AquaTk, if it is found, or X11 based Tk.
-        if (MACOS and self.detect_tkinter_darwin()):
-            return True
+        self.announce("INFO: Not using Tcl/Tk", 2)
+        return False
 
         # Assume we haven't found any of the libraries or include files
         # The versions with dots are used on Unix, and the versions without
