--- Makefile.orig	2009-11-17 19:12:00.000000000 -0600
+++ Makefile	2011-02-11 15:06:37.000000000 -0600
@@ -9,23 +9,16 @@
 PREFIX ?= /usr/local
 
 ifeq ($(SYSTEM), Darwin)
-	ifeq ($(shell test -e /usr/lib/libffi.dylib && echo yes), yes)
-		# Use the libffi that ships with OS X.
-		FFI_LIB = -L/usr/lib -lffi
-		FFI_INCLUDE = -I/usr/include/ffi
+	ifeq ($(shell test -e /Developer/SDKs/MacOSX10.5.sdk && echo yes), yes)
 		LEOPARD_CFLAGS = -DLEOPARD_OBJC2
 	else
-		# Use the libffi that is distributed with Nu.
-		FFI_LIB = -L./libffi -lffi
-		FFI_INCLUDE = -I./libffi/include
 		LEOPARD_CFLAGS =
 	endif
-
-else # Linux
-	FFI_LIB=-lffi
-	FFI_INCLUDE=
 endif
 
+FFI_LIB := $(shell pkg-config libffi --libs)
+FFI_INCLUDE := $(shell pkg-config libffi --cflags)
+
 INCLUDES = $(FFI_INCLUDE) -I./include
 
 ifeq ($(SYSTEM), Darwin)
