--- Makefile.orig	2011-08-12 10:26:11.000000000 -0500
+++ Makefile	2011-10-18 02:06:08.000000000 -0500
@@ -194,9 +194,9 @@
 ifeq ("$(MACOSX)","Darwin")
 KERNELVERSION=$(shell uname -r | cut -f1 -d.)
 ifeq ("$(KERNELVERSION)","9")
-MACOSxlink=-L/usr/lib/gcc/i686-apple-darwin9/4.2.1 -lm -lc -lgcc
+MACOSxlink=-L@PREFIX@/lib -lm -lc -lgcc
 else
-MACOSxlink=-lc -lm
+MACOSxlink=-L@PREFIX@/lib -lc -lm
 MACOSxFopt=-m64
 endif
 endif
@@ -216,43 +216,43 @@
 
 CURSES_macosx_ppc=yes
 CC_macosx_ppc=gcc
-LD_macosx_ppc=libtool -syslibroot /Developer/SDKs/MacOSX10.5.sdk -arch_only ppc
+LD_macosx_ppc=libtool -arch_only ppc
 LDOPTIONS_macosx_ppc=-dynamic
 PIC_macosx_ppc=
-COPTIONS_macosx_ppc=-isysroot/Developer/SDKs/MacOSX10.5.sdk -arch ppc -D__ppc__ -D__MACH__ -D__APPLE__ -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -O2
-COPTIONSld_macosx_ppc=-arch ppc -isysroot/Developer/SDKs/MacOSX10.5.sdk
+COPTIONS_macosx_ppc=-I@PREFIX@/include -D__ppc__ -D__MACH__ -D__APPLE__ -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -O2
+COPTIONSld_macosx_ppc=-I@PREFIX@/include
 FOPTIONS_macosx_ppc=-w
 FOPTIONSld_macosx_ppc=
-CURSESLIB_macosx_ppc=-lcurses
-SYSLIBSexe_macosx_ppc=-L/Developer/SDKs/MacOSX10.5.sdk/usr/lib -L/usr/lib/gcc/powerpc-apple-darwin9/4.0.1 -lm -lc -lgcc 
-SYSLIBSshr_macosx_ppc=-L/Developer/SDKs/MacOSX10.5.sdk/usr/lib -L/usr/lib/gcc/powerpc-apple-darwin9/4.0.1 -lm -lc -lgcc
+CURSESLIB_macosx_ppc=-lncurses
+SYSLIBSexe_macosx_ppc=-L@PREFIX@/lib -lm -lc -lgcc
+SYSLIBSshr_macosx_ppc=-L@PREFIX@/lib -lm -lc -lgcc
 
 CURSES_macosx_ppc64=yes
 CC_macosx_ppc64=gcc
-LD_macosx_ppc64=libtool -syslibroot /Developer/SDKs/MacOSX10.5.sdk -arch_only ppc64
+LD_macosx_ppc64=libtool -arch_only ppc64
 LDOPTIONS_macosx_ppc64=-dynamic
 PIC_macosx_ppc64=
-COPTIONS_macosx_ppc64=-isysroot/Developer/SDKs/MacOSX10.5.sdk -arch ppc64 -m64 -DMACOSX64 -D__ppc__ -D__MACH__ -D__APPLE__ -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -O2
-COPTIONSld_macosx_ppc64=-arch ppc64 -isysroot/Developer/SDKs/MacOSX10.5.sdk
+COPTIONS_macosx_ppc64=-I@PREFIX@/include -m64 -DMACOSX64 -D__ppc__ -D__MACH__ -D__APPLE__ -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -O2
+COPTIONSld_macosx_ppc64=-I@PREFIX@/include
 FOPTIONS_macosx_ppc64=-w
 FOPTIONSld_macosx_ppc64=
-CURSESLIB_macosx_ppc64=-lcurses
-SYSLIBSexe_macosx_ppc64=-L/Developer/SDKs/MacOSX10.5.sdk/usr/lib -L/usr/lib/gcc/powerpc-apple-darwin9/4.0.1/ppc64 -lm -lc -lgcc
-SYSLIBSshr_macosx_ppc64=-L/Developer/SDKs/MacOSX10.5.sdk/usr/lib -L/usr/lib/gcc/powerpc-apple-darwin9/4.0.1/ppc64 -lm -lc -lgcc
+CURSESLIB_macosx_ppc64=-lncurses
+SYSLIBSexe_macosx_ppc64=-L@PREFIX@/lib -lm -lc -lgcc
+SYSLIBSshr_macosx_ppc64=-L@PREFIX@/lib -lm -lc -lgcc
 
 CURSES_macosx_i386=yes
 CC_macosx_i386=gcc
 LD_macosx_i386=libtool -arch_only i386
 LDOPTIONS_macosx_i386=-dynamic
 PIC_macosx_i386=
-COPTIONS_macosx_i386=-mmacosx-version-min=10.4 -arch i386 -Di386 -D__MACH__ -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -O2
-COPTIONSld_macosx_i386=-mmacosx-version-min=10.4 -arch i386
+COPTIONS_macosx_i386=-I@PREFIX@/include -Di386 -D__MACH__ -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -O2
+COPTIONSld_macosx_i386=-I@PREFIX@/include
 FOPTIONS_macosx_i386=-w
 FOPTIONSld_macosx_i386=
-CURSESLIB_macosx_i386=-lcurses
-# SYSLIBSexe_macosx_i386=-L/usr/lib/gcc/i686-apple-darwin10/4.2.1 -lm -lc -lgcc 
+CURSESLIB_macosx_i386=-lncurses
+# SYSLIBSexe_macosx_i386=-L@PREFIX@/lib -lm -lc -lgcc
 SYSLIBSexe_macosx_i386=$(MACOSxlink)
-# SYSLIBSshr_macosx_i386=-L/usr/lib/gcc/i686-apple-darwin10/4.2.1 -lm -lc -lgcc
+# SYSLIBSshr_macosx_i386=-L@PREFIX@/lib -lm -lc -lgcc
 SYSLIBSshr_macosx_i386=$(MACOSxlink)
 
 CURSES_macosx_x86_64=yes
@@ -260,13 +260,13 @@
 LD_macosx_x86_64=libtool -arch_only x86_64 
 LDOPTIONS_macosx_x86_64=-dynamic
 PIC_macosx_x86_64=
-COPTIONS_macosx_x86_64=-mmacosx-version-min=10.4 -arch x86_64 -Di386 -D__MACH__ -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -O2
-COPTIONSld_macosx_x86_64=-mmacosx-version-min=10.4 -arch x86_64 
+COPTIONS_macosx_x86_64=-I@PREFIX@/include -Di386 -D__MACH__ -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -O2
+COPTIONSld_macosx_x86_64=-I@PREFIX@/include
 FOPTIONS_macosx_x86_64=-w -m64
 FOPTIONSld_macosx_x86_64=-m64
-CURSESLIB_macosx_x86_64=-lcurses
-SYSLIBSexe_macosx_x86_64=-lc -lm
-SYSLIBSshr_macosx_x86_64=-lc -lm
+CURSESLIB_macosx_x86_64=-lncurses
+SYSLIBSexe_macosx_x86_64=-L@PREFIX@/lib -lc -lm
+SYSLIBSshr_macosx_x86_64=-L@PREFIX@/lib -lc -lm
 
 #------------------------------------------------------------------------------
 # Macros for OSF (Digital UNIX).
