diff -Nurd mono-2.6.4/configure mono-2.6.4-new/configure
--- mono-2.6.4/configure	2010-04-22 10:53:03.000000000 -0500
+++ mono-2.6.4-new/configure	2010-04-30 22:27:50.000000000 -0500
@@ -3222,11 +3222,11 @@
 		parallel_mark="Disabled_Currently_Hangs_On_MacOSX"
 		platform_win32=no
 		platform_darwin=yes
-		CPPFLAGS="$CPPFLAGS -no-cpp-precomp -D_THREAD_SAFE -DGC_MACOSX_THREADS -DPLATFORM_MACOSX -DUSE_MMAP -DUSE_MUNMAP"
+		CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE -DGC_MACOSX_THREADS -DPLATFORM_MACOSX -DUSE_MMAP -DUSE_MUNMAP"
 		CPPFLAGS="$CPPFLAGS -DGetCurrentProcess=MonoGetCurrentProcess -DGetCurrentThread=MonoGetCurrentThread -DCreateEvent=MonoCreateEvent"
 		libmono_cflags="-D_THREAD_SAFE"
-		LDFLAGS="$LDFLAGS -pthread"
-		libmono_ldflags="-pthread"
+		LDFLAGS="$LDFLAGS"
+		libmono_ldflags=""
 		need_link_unlink=yes
 		cat >>confdefs.h <<\_ACEOF
 #define PTHREAD_POINTER_ID 1
@@ -3246,7 +3246,7 @@
 		fi
 								case "$host" in
 			i*86-*-darwin10*)
-				BROKEN_DARWIN_FLAGS="-arch i386 -D_XOPEN_SOURCE -mmacosx-version-min=10.5"
+				BROKEN_DARWIN_FLAGS="-D_XOPEN_SOURCE -mmacosx-version-min=10.5"
 				CPPFLAGS="$CPPFLAGS $BROKEN_DARWIN_FLAGS"
 				CFLAGS="$CFLAGS $BROKEN_DARWIN_FLAGS"
 				CXXFLAGS="$CXXFLAGS $BROKEN_DARWIN_FLAGS"
@@ -18249,20 +18249,14 @@
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 #include <zlib.h>
-int
-main ()
-{
 
-   void main () {
+   int main () {
    #if defined(ZLIB_VERNUM) && (ZLIB_VERNUM >= 0x1230)
+      return 0;
    }
    #else
    #error No good zlib found
    #endif
-
-  ;
-  return 0;
-}
 _ACEOF
 rm -f conftest.$ac_objext
 if { (ac_try="$ac_compile"
@@ -23692,18 +23686,11 @@
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 #include <sched.h>
-int
-main ()
-{
-
 		int main() {
             int mask = 1;
             sched_setaffinity(0, &mask);
+            return 0;
         }
-
-  ;
-  return 0;
-}
 _ACEOF
 rm -f conftest.$ac_objext
 if { (ac_try="$ac_compile"
@@ -36761,11 +36748,11 @@
 
 JIT_SUPPORTED=no
 INTERP_SUPPORTED=no
-LIBC="libc.so.6"
-INTL="libc.so.6"
-SQLITE="libsqlite.so.0"
-SQLITE3="libsqlite3.so.0"
-X11="libX11.so"
+LIBC="/usr/lib/libSystem.dylib"
+INTL="@FINKPREFIX@/lib/libintl.dylib"
+SQLITE="@FINKPREFIX@/lib/libsqlite.0.dylib"
+SQLITE3="@FINKPREFIX@/lib/libsqlite3.0.dylib"
+X11="/usr/X11R6/lib/libX11.6.dylib"
 
 sizeof_register="SIZEOF_VOID_P"
 
@@ -36796,11 +36783,9 @@
 main ()
 {
 
-		void main () {
 		#if _MIPS_SIM != _ABIN32
 		#error Not mips n32
 		#endif
-   		}
 
   ;
   return 0;
@@ -37247,11 +37232,11 @@
 case "$host" in
      *-*-darwin*)
 	libsuffix=".dylib"
-	LIBC="libc.dylib"
-	INTL="libintl.dylib"
-	SQLITE="libsqlite.0.dylib"
-	SQLITE3="libsqlite3.0.dylib"
-	X11="libX11.dylib"
+	LIBC="/usr/lib/libSystem.dylib"
+	INTL="@FINKPREFIX@/lib/libintl.dylib"
+	SQLITE="@FINKPREFIX@/lib/libsqlite.0.dylib"
+	SQLITE3="@FINKPREFIX@/lib/libsqlite3.0.dylib"
+	X11="/usr/X11R6/lib/libX11.6.dylib"
 	;;
      *-*-*netbsd*)
 	LIBC="libc.so.12"
diff -Nurd mono-2.6.4/data/config.in mono-2.6.4-new/data/config.in
--- mono-2.6.4/data/config.in	2010-04-22 10:37:47.000000000 -0500
+++ mono-2.6.4-new/data/config.in	2010-04-30 22:27:50.000000000 -0500
@@ -5,19 +5,19 @@
 	<dllmap dll="intl" name="bind_textdomain_codeset" target="@LIBC@" os="solaris"/>
 	<dllmap dll="libintl" name="bind_textdomain_codeset" target="@LIBC@" os="solaris"/>
 	<dllmap dll="libintl" target="@INTL@" os="!windows"/>
-	<dllmap dll="i:libxslt.dll" target="libxslt@libsuffix@" os="!windows"/>
-	<dllmap dll="i:odbc32.dll" target="libodbc@libsuffix@" os="!windows"/>
-	<dllmap dll="i:odbc32.dll" target="libiodbc.dylib" os="osx"/>
-	<dllmap dll="oci" target="libclntsh@libsuffix@" os="!windows"/>
-	<dllmap dll="db2cli" target="libdb2_36@libsuffix@" os="!windows"/>
-	<dllmap dll="MonoPosixHelper" target="libMonoPosixHelper@libsuffix@" os="!windows" />
+	<dllmap dll="i:libxslt.dll" target="@FINKPREFIX@/lib/libxslt.1@libsuffix@" os="!windows"/>
+	<dllmap dll="i:odbc32.dll" target="@FINKPREFIX@/lib/libodbc.1@libsuffix@" os="!windows"/>
+	<dllmap dll="i:odbc32.dll" target="/usr/lib/libiodbc.2.dylib" os="osx"/>
+	<dllmap dll="oci" target="@FINKPREFIX@/lib/libclntsh@libsuffix@" os="!windows"/>
+	<dllmap dll="db2cli" target="@FINKPREFIX@/lib/libdb2_36@libsuffix@" os="!windows"/>
+	<dllmap dll="MonoPosixHelper" target="@FINKPREFIX@/lib/libMonoPosixHelper@libsuffix@" os="!windows" />
 	<dllmap dll="i:msvcrt" target="@LIBC@" os="!windows"/>
 	<dllmap dll="i:msvcrt.dll" target="@LIBC@" os="!windows"/>
 	<dllmap dll="sqlite" target="@SQLITE@" os="!windows"/>
 	<dllmap dll="sqlite3" target="@SQLITE3@" os="!windows"/>
 	<dllmap dll="libX11" target="@X11@" os="!windows" />
-	<dllmap dll="libcairo-2.dll" target="libcairo.so.2" os="!windows"/>
-	<dllmap dll="libcups" target="libcups.so.2" os="!windows"/>
+	<dllmap dll="libcairo-2.dll" target="@FINKPREFIX@/lib/libcairo.2.dylib" os="!windows"/>
+	<dllmap dll="libcups" target="/usr/lib/libcups.2.dylib" os="!windows"/>
 	<dllmap dll="i:kernel32.dll">
 		<dllentry dll="__Internal" name="CopyMemory" target="mono_win32_compat_CopyMemory"/>
 		<dllentry dll="__Internal" name="FillMemory" target="mono_win32_compat_FillMemory"/>
diff -Nurd mono-2.6.4/libgc/darwin_stop_world.c mono-2.6.4-new/libgc/darwin_stop_world.c
--- mono-2.6.4/libgc/darwin_stop_world.c	2010-04-22 10:37:43.000000000 -0500
+++ mono-2.6.4-new/libgc/darwin_stop_world.c	2010-04-30 22:27:50.000000000 -0500
@@ -135,7 +135,7 @@
 	GC_push_one(state.ebp); 
 #endif
 #elif defined(POWERPC)
-#if defined(_STRUCT_PPC_EXCEPTION_STATE)
+#if __DARWIN_UNIX03
 	lo = (void*)(state.__r1 - PPC_RED_ZONE_SIZE);
         
 	GC_push_one(state.__r0); 
@@ -278,7 +278,7 @@
 			     (natural_t *)&info, &outCount);
 	if(r != KERN_SUCCESS) continue;
 
-#if defined(_STRUCT_PPC_EXCEPTION_STATE)
+#if __DARWIN_UNIX03
 	lo = (void*)(info.__r1 - PPC_RED_ZONE_SIZE);
 	hi = (ptr_t)FindTopOfStack(info.__r1);
 
diff -Nurd mono-2.6.4/mono/dis/Makefile.in mono-2.6.4-new/mono/dis/Makefile.in
--- mono-2.6.4/mono/dis/Makefile.in	2010-04-22 11:53:00.000000000 -0400
+++ mono-2.6.4-new/mono/dis/Makefile.in	2010-08-09 02:20:15.000000000 -0400
@@ -273,7 +273,7 @@
 top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
-INCLUDES = $(GLIB_CFLAGS) -I$(top_srcdir)
+INCLUDES = -I$(top_srcdir) $(GLIB_CFLAGS)
 @JIT_SUPPORTED_FALSE@runtime_lib = ../interpreter/libmint.la
 @JIT_SUPPORTED_TRUE@runtime_lib = ../mini/libmono.la
 noinst_LIBRARIES = libmonodis.a
diff -Nurd mono-2.6.4/mono/interpreter/interp.h mono-2.6.4-new/mono/interpreter/interp.h
--- mono-2.6.4/mono/interpreter/interp.h	2010-04-22 10:37:47.000000000 -0500
+++ mono-2.6.4-new/mono/interpreter/interp.h	2010-04-30 22:27:50.000000000 -0500
@@ -120,8 +120,8 @@
 void
 mono_interp_transform_init (void);
 
-void inline stackval_from_data (MonoType *type, stackval *result, char *data, gboolean pinvoke);
-void inline stackval_to_data (MonoType *type, stackval *val, char *data, gboolean pinvoke);
+void stackval_from_data (MonoType *type, stackval *result, char *data, gboolean pinvoke);
+void stackval_to_data (MonoType *type, stackval *val, char *data, gboolean pinvoke);
 void ves_exec_method (MonoInvocation *frame);
 
 /*
diff -Nurd mono-2.6.4/mono/io-layer/Makefile.in mono-2.6.4-new/mono/io-layer/Makefile.in
--- mono-2.6.4/mono/io-layer/Makefile.in	2010-04-22 11:53:00.000000000 -0400
+++ mono-2.6.4-new/mono/io-layer/Makefile.in	2010-08-09 02:53:05.000000000 -0400
@@ -309,10 +309,10 @@
 top_srcdir = @top_srcdir@
 noinst_LTLIBRARIES = libwapi.la
 INCLUDES = \
-	$(GLIB_CFLAGS)		\
+	-I$(top_srcdir)	\
 	$(LIBGC_CFLAGS)		\
-	-DMONO_BINDIR=\""$(bindir)"\"	\
-	-I$(top_srcdir)	
+	$(GLIB_CFLAGS)		\
+	-DMONO_BINDIR=\""$(bindir)"\"
 
 libwapiincludedir = $(includedir)/mono-$(API_VER)/mono/io-layer
 OTHER_H = \
diff -Nurd mono-2.6.4/mono/io-layer/shared.c mono-2.6.4-new/mono/io-layer/shared.c
--- mono-2.6.4/mono/io-layer/shared.c	2010-04-22 10:37:44.000000000 -0500
+++ mono-2.6.4-new/mono/io-layer/shared.c	2010-04-30 22:27:50.000000000 -0500
@@ -168,8 +168,8 @@
 		ubuf.machine[0] = '\0';
 		ubuf.sysname[0] = '\0';
 	} else {
-		g_strdelimit (ubuf.sysname, "/", '_');
-		g_strdelimit (ubuf.machine, "/", '_');
+		g_strdelimit (ubuf.sysname, NULL, '_');
+		g_strdelimit (ubuf.machine, NULL, '_');
 	}
 
 	fake_name = g_getenv ("MONO_SHARED_HOSTNAME");
diff -Nurd mono-2.6.4/mono/metadata/loader.c mono-2.6.4-new/mono/metadata/loader.c
--- mono-2.6.4/mono/metadata/loader.c	2010-04-22 10:37:44.000000000 -0500
+++ mono-2.6.4-new/mono/metadata/loader.c	2010-04-30 22:27:50.000000000 -0500
@@ -1284,6 +1284,24 @@
 
 		if (!module) {
 			void *iter = NULL;
+			while ((full_name = mono_dl_build_path ("@FINKPREFIX@/lib", file_name, &iter))) {
+				mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_DLLIMPORT,
+						"DllImport loading location: '%s'.", full_name);
+				module = cached_module_load (full_name, MONO_DL_LAZY, &error_msg);
+				if (!module) {
+					mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_DLLIMPORT,
+							"DllImport error loading library: '%s'.",
+							error_msg);
+					g_free (error_msg);
+				}
+				g_free (full_name);
+				if (module)
+					break;
+			}
+		}
+
+		if (!module) {
+			void *iter = NULL;
 			while ((full_name = mono_dl_build_path (NULL, file_name, &iter))) {
 				mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_DLLIMPORT,
 						"DllImport loading location: '%s'.", full_name);
diff -Nurd mono-2.6.4/mono/metadata/profiler.c mono-2.6.4-new/mono/metadata/profiler.c
--- mono-2.6.4/mono/metadata/profiler.c	2010-04-22 10:37:44.000000000 -0500
+++ mono-2.6.4-new/mono/metadata/profiler.c	2010-04-30 22:27:50.000000000 -0500
@@ -26,7 +26,7 @@
 #ifdef HAVE_SYS_TIME_H
 #include <sys/time.h>
 #endif
-#ifdef HAVE_BACKTRACE_SYMBOLS
+#if defined(HAVE_BACKTRACE_SYMBOLS) && defined(HAVE_EXECINFO_H)
 #include <execinfo.h>
 #endif
 
diff -Nurd mono-2.6.4/mono/mini/Makefile.in mono-2.6.4-new/mono/mini/Makefile.in
--- mono-2.6.4/mono/mini/Makefile.in	2010-04-22 11:53:01.000000000 -0400
+++ mono-2.6.4-new/mono/mini/Makefile.in	2010-08-09 00:33:42.000000000 -0400
@@ -485,7 +485,7 @@
 RUNTIME_AOTCHECK = MONO_PATH=$(CLASS):. $(top_builddir)/runtime/mono-wrapper
 MCS = $(RUNTIME) $(CLASS)/gmcs.exe -unsafe -nowarn:0162
 ILASM = $(RUNTIME) $(CLASS)/ilasm.exe
-AM_CFLAGS = \
+AM_CPPFLAGS = \
 	-I$(top_srcdir) 	\
 	$(LIBGC_CFLAGS)		\
 	$(GLIB_CFLAGS)		\
diff -Nurd mono-2.6.4/mono/mini/mini-arm.c mono-2.6.4-new/mono/mini/mini-arm.c
--- mono-2.6.4/mono/mini/mini-arm.c	2010-04-22 10:37:45.000000000 -0500
+++ mono-2.6.4-new/mono/mini/mini-arm.c	2010-04-30 22:28:15.000000000 -0500
@@ -4794,10 +4794,15 @@
 	MonoJumpInfo *patch_info;
 	int i;
 	guint8 *code;
-	const guint8* exc_throw_pos [MONO_EXC_INTRINS_NUM] = {NULL};
-	guint8 exc_throw_found [MONO_EXC_INTRINS_NUM] = {0};
+	guint8* exc_throw_pos [MONO_EXC_INTRINS_NUM];
+	guint8 exc_throw_found [MONO_EXC_INTRINS_NUM];
 	int max_epilog_size = 50;
 
+	for (i = 0; i < MONO_EXC_INTRINS_NUM; i++) {
+		exc_throw_pos [i] = NULL;
+		exc_throw_found [i] = 0;
+	}
+
 	/* count the number of exception infos */
      
 	/* 
diff -Nurd mono-2.6.4/mono/mini/mini-ppc.c mono-2.6.4-new/mono/mini/mini-ppc.c
--- mono-2.6.4/mono/mini/mini-ppc.c	2010-04-22 10:37:45.000000000 -0500
+++ mono-2.6.4-new/mono/mini/mini-ppc.c	2010-04-30 22:28:15.000000000 -0500
@@ -5365,10 +5365,15 @@
 	MonoJumpInfo *patch_info;
 	int i;
 	guint8 *code;
-	const guint8* exc_throw_pos [MONO_EXC_INTRINS_NUM] = {NULL};
-	guint8 exc_throw_found [MONO_EXC_INTRINS_NUM] = {0};
+	guint8* exc_throw_pos [MONO_EXC_INTRINS_NUM];
+	guint8 exc_throw_found [MONO_EXC_INTRINS_NUM];
 	int max_epilog_size = 50;
 
+	for (i = 0; i < MONO_EXC_INTRINS_NUM; i++) {
+		exc_throw_pos [i] = NULL;
+		exc_throw_found [i] = 0;
+	}
+
 	/* count the number of exception infos */
      
 	/* 
diff -Nurd mono-2.6.4/mono/mini/mini-ppc.h mono-2.6.4-new/mono/mini/mini-ppc.h
--- mono-2.6.4/mono/mini/mini-ppc.h	2010-04-22 10:37:45.000000000 -0500
+++ mono-2.6.4-new/mono/mini/mini-ppc.h	2010-04-30 22:27:50.000000000 -0500
@@ -277,9 +277,9 @@
 
 #if defined(__linux__)
 #define MONO_ARCH_USE_SIGACTION 1
-#elif defined (__APPLE__) && defined (_STRUCT_MCONTEXT)
+#elif defined (__APPLE__) && __DARWIN_UNIX03
 #define MONO_ARCH_USE_SIGACTION 1
-#elif defined (__APPLE__) && !defined (_STRUCT_MCONTEXT)
+#elif defined (__APPLE__) && !__DARWIN_UNIX03
 #define MONO_ARCH_USE_SIGACTION 1
 #elif defined(__NetBSD__)
 #define MONO_ARCH_USE_SIGACTION 1
diff -Nurd mono-2.6.4/support/Makefile.in mono-2.6.4-new/support/Makefile.in
--- mono-2.6.4/support/Makefile.in	2010-04-22 11:53:02.000000000 -0400
+++ mono-2.6.4-new/support/Makefile.in	2010-08-09 00:55:57.000000000 -0400
@@ -321,8 +321,7 @@
 	$(SUPPORT)
 
 INCLUDES = \
-	$(GLIB_CFLAGS)				\
-	-I$(top_srcdir)
+	-I$(top_srcdir) $(GLIB_CFLAGS)
 
 
 # Source code which helps implement the ANSI C standards, and thus *should* be
diff -Nurd mono-2.6.4/support/sys-mman.c mono-2.6.4-new/support/sys-mman.c
--- mono-2.6.4/support/sys-mman.c	2010-04-22 10:37:47.000000000 -0500
+++ mono-2.6.4-new/support/sys-mman.c	2010-04-30 22:27:50.000000000 -0500
@@ -8,6 +8,7 @@
  */
 
 #define _XOPEN_SOURCE 600
+#undef _NONSTD_SOURCE
 
 #include <sys/types.h>
 #include <sys/mman.h>
