--- Imaging-1.1.4/libImaging/Makefile.in.orig	Fri Dec 13 05:50:30 2002
+++ Imaging-1.1.4/libImaging/Makefile.in	Fri Dec 13 05:51:31 2002
@@ -24,7 +24,7 @@
 
 DEFS=		@DEFS@
 
-LIBS=		@LIBS@ @LIBM@
+LIBS=		$(LDFLAGS) @LIBS@ @LIBM@
 
 # --------------------------------------------------------------------
 # Other things that are customizable but not by configure
--- Imaging/PIL/Image.py.orig	Wed May  7 06:59:10 2003
+++ Imaging/PIL/Image.py	Wed May  7 07:00:16 2003
@@ -1716,7 +1716,7 @@
         format = "BMP"
         if not command:
             command = "start"
-    elif os.environ.get("OSTYPE") == "darwin":
+    elif sys.platform == "darwin":
         format = "JPEG"
         if not command:
             command = "open -a /Applications/Preview.app"
@@ -1742,7 +1742,7 @@
     if os.name == "nt":
         os.system("%s %s" % (command, file))
         # FIXME: this leaves temporary files around...
-    elif os.environ.get("OSTYPE") == "darwin":
+    elif sys.platform == "darwin":
         # on darwin open returns immediately resulting in the temp
         # file removal while app is opening
         os.system("(%s %s; sleep 20; rm -f %s)&" % (command, file, file))
--- Imaging-1.1.4/setup.py.orig	Fri Dec 13 06:06:28 2002
+++ Imaging-1.1.4/setup.py	Fri Dec 13 06:09:38 2002
@@ -30,7 +30,7 @@
 # on Windows, the following is used to control how and where to search
 # for Tcl/Tk files.  None enables automatic searching; to override, set
 # this to a directory name.
-TCLROOT = None
+TCLROOT = "@PREFIX@"
 
 from PIL.Image import VERSION
 
@@ -46,10 +46,10 @@
 LIBRARIES = ["Imaging"]
 
 # Add some standard search spots for MacOSX/darwin
-if os.path.exists('/sw/include'):
-    INCLUDE_DIRS.append('/sw/include')
-if os.path.exists('/sw/lib'):
-    LIBRARY_DIRS.append('/sw/lib')
+if os.path.exists('@PREFIX@/include'):
+    INCLUDE_DIRS.append('@PREFIX@/include')
+if os.path.exists('@PREFIX@/lib'):
+    LIBRARY_DIRS.append('@PREFIX@/lib')
 
 HAVE_LIBJPEG = 0
 HAVE_LIBTIFF = 0
@@ -63,6 +63,8 @@
         lib = m.group(1)
         if lib == "JPEG":
             HAVE_LIBJPEG = 1
+            INCLUDE_DIRS.append("@PREFIX@/include")
+            LIBRARY_DIRS.append("@PREFIX@/lib")
             if sys.platform == "win32":
                 LIBRARIES.append("jpeg")
                 INCLUDE_DIRS.append(JPEGDIR)
@@ -71,6 +73,8 @@
                 LIBRARIES.append("jpeg")
         elif lib == "TIFF":
             HAVE_LIBTIFF = 1
+            INCLUDE_DIRS.append("@PREFIX@/include")
+            LIBRARY_DIRS.append("@PREFIX@/lib")
             LIBRARIES.append("tiff")
         elif lib == "Z":
             HAVE_LIBZ = 1
@@ -204,10 +208,15 @@
                 EXTRA_LINK_ARGS = frameworks
                 HAVE_TCLTK = 1
 
+        tk_framework_found = 0
         if not tk_framework_found:
             # assume the libraries are installed in the default location
             LIBRARIES.extend(["tk" + TCL_VERSION, "tcl" + TCL_VERSION])
             HAVE_TCLTK = 1
+            INCLUDE_DIRS.append(os.path.join(TCLROOT, "include"))
+            LIBRARY_DIRS.append(os.path.join(TCLROOT, "lib"))
+            INCLUDE_DIRS.append("/usr/X11R6/include")
+            LIBRARY_DIRS.append("/usr/X11R6/lib")
 
     if HAVE_TCLTK:
         MODULES.append(
@@ -260,18 +269,13 @@
     if FILES:
         INCLUDE_DIRS.append(os.path.join(FREETYPEDIR, "include"))
         INCLUDE_DIRS.append(os.path.join(FREETYPEDIR, "src"))
-    elif os.path.isdir("/usr/include/freetype2"):
-        # assume that the freetype library is installed in a
-        # standard location
-        # FIXME: search for libraries
-        LIBRARIES.append("freetype")
-        INCLUDE_DIRS.append("/usr/include/freetype2")
-    elif os.path.isdir("/sw/include/freetype2"):
+    elif os.path.isdir("/usr/X11R6/include/freetype2"):
         # assume that the freetype library is installed in a
         # standard location
         # FIXME: search for libraries
         LIBRARIES.append("freetype")
-        INCLUDE_DIRS.append("/sw/include/freetype2")
-        LIBRARY_DIRS.append("/sw/lib")
+        INCLUDE_DIRS.append("/usr/X11R6/include/freetype2")
+        INCLUDE_DIRS.append("/usr/X11R6/include")
+        LIBRARY_DIRS.append("/usr/X11R6/lib")
     else:
         have_freetype = 0

--- Imaging-1.1.4/_imagingft.c.orig
+++ Imaging-1.1.4/_imagingft.c
@@ -17,7 +17,8 @@
 #include "Python.h"
 #include "Imaging.h"

-#include <freetype/freetype.h>
+#include <ft2build.h>
+#include FT_FREETYPE_H

 #if defined(PY_VERSION_HEX) && PY_VERSION_HEX < 0x01060000
 #define PyObject_DEL(op) PyMem_DEL((op))
 
