--- matplotlib/setupext.py.orig	2006-01-14 10:51:44.000000000 -0700
+++ matplotlib/setupext.py	2006-01-14 10:53:23.000000000 -0700
@@ -48,8 +48,7 @@
     'linux2' : ['/usr/local', '/usr',],
     'linux'  : ['/usr/local', '/usr',],
     'cygwin' : ['/usr/local', '/usr',],
-    'darwin' : ['/sw/lib/freetype2', '/sw/lib/freetype219', '/usr/local',
-                '/usr', '/sw'], 
+    'darwin' : ['@PREFIX@/lib/freetype219', '/usr/local', '/usr', '@PREFIX@'],
     'freebsd4' : ['/usr/local', '/usr'],
     'freebsd5' : ['/usr/local', '/usr'],
     'freebsd6' : ['/usr/local', '/usr'],    
@@ -333,44 +332,11 @@
         print "Tcl/Tk v8.3 or later required\n"
         sys.exit(1)
     o = FoundTclTk()
-    try:
-        tk=Tkinter.Tk()	
-    except Tkinter.TclError:
-        print "Using default library and include directories for Tcl and Tk because a"
-        print "Tk window failed to open.  You may need to define DISPLAY for Tk to work"
-        print "so that setup can determine where your libraries are located."
-        o.tcl_lib = "/usr/local/lib"
-        o.tcl_inc = "/usr/local/include"
-        o.tk_lib = "/usr/local/lib"
-        o.tk_inc = "/usr/local/include"
-        o.tkv = ""
-    else:
-        tk.withdraw()
-        o.tcl_lib = os.path.join((tk.getvar('tcl_library')), '../')
-        o.tk_lib = os.path.join(str(tk.getvar('tk_library')), '../')
-        o.tkv = str(Tkinter.TkVersion)[:3]
-        o.tcl_inc = os.path.join((tk.getvar('tcl_library')), 
-                    '../../include/tcl'+o.tkv)
-        if not os.path.exists(o.tcl_inc):
-            o.tcl_inc = os.path.join((tk.getvar('tcl_library')), 
-                        '../../include')
-        o.tk_inc = os.path.join((tk.getvar('tk_library')), 
-                    '../../include/tk'+o.tkv)        
-        if not os.path.exists(o.tk_inc):
-            o.tk_inc = os.path.join((tk.getvar('tk_library')), 
-                        '../../include')
-
-        if not os.path.exists(o.tcl_inc):            
-            # this is a hack for suse linux, which is broken
-            if (sys.platform.startswith('linux') and
-                os.path.exists('/usr/include/tcl.h') and
-                os.path.exists('/usr/include/tk.h')):
-                o.tcl_inc = '/usr/include/'
-                o.tk_inc = '/usr/include/'
-                
-        if not os.path.exists(o.tcl_inc):
-            print 'cannot find tcl/tk headers. giving up.'
-            sys.exit()
+    o.tcl_lib = "@PREFIX@/lib"
+    o.tcl_inc = "@PREFIX@/include"
+    o.tk_lib = "@PREFIX@/lib"
+    o.tk_inc = "@PREFIX@/include"
+    o.tkv = ""
     return o
 
 
--- matplotlib/setup.py.orig	2006-01-14 10:57:11.000000000 -0700
+++ matplotlib/setup.py	2006-01-14 11:00:55.000000000 -0700
@@ -28,21 +28,21 @@
 # it.  It makes very nice antialiased output and also supports alpha
 # blending
 BUILD_AGG          = 1
-BUILD_GTKAGG       = 'auto'
-BUILD_GTK          = 'auto'
+BUILD_GTKAGG       = 1
+BUILD_GTK          = 1
 
 # build TK GUI with Agg renderer ; requires Tkinter Python extension
 # and Tk includes
 # Use False or 0 if you don't want to build
-BUILD_TKAGG        = 'auto'
+BUILD_TKAGG        = 1
 
 # build wxPython GUI with Agg renderer ; requires wxPython package
-BUILD_WXAGG        = 'auto'
+BUILD_WXAGG        = 0
 
 
 # build a small extension to manage the focus on win32 platforms.
-#BUILD_WINDOWING        = 0
-BUILD_WINDOWING        = 'auto'
+BUILD_WINDOWING        = 0
+#BUILD_WINDOWING        = 'auto'
 
 
 VERBOSE = False # insert lots of diagnostic prints in extension code
@@ -185,22 +185,10 @@
 build_enthought(ext_modules, packages)
 
 if BUILD_GTK:
-    try:
-        import gtk
-    except ImportError:
-        print 'GTK requires pygtk'
-        BUILD_GTK=0
-    except RuntimeError:
-        print 'pygtk present but import failed'
-
-if BUILD_GTK:
         build_gdk(ext_modules, packages, NUMERIX)
         rc['backend'] = 'GTK'
 
 if BUILD_TKAGG:
-    try: import Tkinter
-    except ImportError: print 'TKAgg requires TkInter'
-    else:
         BUILD_AGG = 1
         build_tkagg(ext_modules, packages, NUMERIX)
         rc['backend'] = 'TkAgg'
@@ -219,15 +207,6 @@
         rc['backend'] = 'WXAgg'
 
 if BUILD_GTKAGG:
-    try:
-        import gtk
-    except ImportError:
-        print 'GTKAgg requires pygtk'
-        BUILD_GTKAGG=0
-    except RuntimeError:
-        print 'pygtk present but import failed'
-
-if BUILD_GTKAGG:
     BUILD_AGG = 1
     build_gtkagg(ext_modules, packages, NUMERIX)
     rc['backend'] = 'GTKAgg'
@@ -253,7 +232,8 @@
 for mod in ext_modules:
     if VERBOSE:
         mod.extra_compile_args.append('-DVERBOSE')
-
+    mod.include_dirs.append('@PREFIX@/include')
+    mod.library_dirs.append('@PREFIX@/lib')
 
 
 # packagers: set rc['numerix'] and rc['backend'] here to override the auto
