--- setup.py.orig	2008-10-16 12:58:19.000000000 -0600
+++ setup.py	2009-06-07 20:55:17.000000000 -0600
@@ -609,7 +609,7 @@
         # a release.  Most open source OSes come with one or more
         # versions of BerkeleyDB already installed.
 
-        max_db_ver = (4, 5)
+        max_db_ver = (4, 6)
         # NOTE: while the _bsddb.c code links against BerkeleyDB 4.6.x
         # we leave that version disabled by default as it has proven to be
         # quite a buggy library release on many platforms.
@@ -636,6 +636,7 @@
             db_inc_paths.append('/usr/local/include/db4%d' % x)
             db_inc_paths.append('/pkg/db-4.%d/include' % x)
             db_inc_paths.append('/opt/db-4.%d/include' % x)
+            db_inc_paths.append('__PREFIX__/include/db4%d' % x)
         # 3.x minor number specific paths
         for x in (3,):
             db_inc_paths.append('/usr/include/db3%d' % x)
@@ -711,6 +712,7 @@
 
                 # check lib directories parallel to the location of the header
                 db_dirs_to_check = [
+                    os.path.join('__PREFIX__', 'lib', 'db46'),
                     os.path.join(db_incdir, '..', 'lib64'),
                     os.path.join(db_incdir, '..', 'lib'),
                     os.path.join(db_incdir, '..', '..', 'lib64'),
@@ -1212,13 +1214,7 @@
     def detect_tkinter(self, inc_dirs, lib_dirs):
         # The _tkinter module.
 
-        # 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.
         platform = self.get_platform()
-        if (platform == 'darwin' and
-            self.detect_tkinter_darwin(inc_dirs, lib_dirs)):
-            return
 
         # Assume we haven't found any of the libraries or include files
         # The versions with dots are used on Unix, and the versions without
--- setup.py.orig	2009-09-10 19:41:32.000000000 +1000
+++ setup.py	2009-09-10 19:48:30.000000000 +1000
@@ -1197,7 +1197,7 @@
         # For 8.4a2, the X11 headers are not included. Rather than include a
         # complicated search, this is a hard-coded path. It could bail out
         # if X11 libs are not found...
-        include_dirs.append('/usr/X11R6/include')
+        #include_dirs.append('/usr/X11R6/include')
         frameworks = ['-framework', 'Tcl', '-framework', 'Tk']
 
         ext = Extension('_tkinter', ['_tkinter.c', 'tkappinit.c'],
@@ -1262,17 +1262,17 @@
         if platform == 'sunos5':
             include_dirs.append('/usr/openwin/include')
             added_lib_dirs.append('/usr/openwin/lib')
-        elif os.path.exists('/usr/X11R6/include'):
-            include_dirs.append('/usr/X11R6/include')
-            added_lib_dirs.append('/usr/X11R6/lib64')
-            added_lib_dirs.append('/usr/X11R6/lib')
-        elif os.path.exists('/usr/X11R5/include'):
-            include_dirs.append('/usr/X11R5/include')
-            added_lib_dirs.append('/usr/X11R5/lib')
-        else:
+        #elif os.path.exists('/usr/X11R6/include'):
+        #    include_dirs.append('/usr/X11R6/include')
+        #    added_lib_dirs.append('/usr/X11R6/lib64')
+        #    added_lib_dirs.append('/usr/X11R6/lib')
+        #elif os.path.exists('/usr/X11R5/include'):
+        #    include_dirs.append('/usr/X11R5/include')
+        #    added_lib_dirs.append('/usr/X11R5/lib')
+        #else:
             # Assume default location for X11
-            include_dirs.append('/usr/X11/include')
-            added_lib_dirs.append('/usr/X11/lib')
+        #    include_dirs.append('/usr/X11/include')
+        #    added_lib_dirs.append('/usr/X11/lib')
 
         # If Cygwin, then verify that X is installed before proceeding
         if platform == 'cygwin':