[Pkg-mono-svn-commits] [SCM] mono branch, master-experimental, updated. debian/2.10.5-1-4-g8f93e42

Mirco Bauer meebey at meebey.net
Mon Dec 26 07:38:25 UTC 2011


The following commit has been merged in the master-experimental branch:
commit b35dd9807f10fb8e82615a881de32526937b536e
Author: Mirco Bauer <meebey at meebey.net>
Date:   Mon Dec 26 07:25:11 2011 +0100

    Imported Upstream version 2.10.8.1

diff --git a/ChangeLog b/ChangeLog
index 5591c3f..e0db801 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,34 @@
+2011-12-16  Duncan Mak  <duncan.mak at xamarin.com>
+
+	Bump version number to 2.10.8.1.
+
+2011-12-14  Duncan Mak  <duncan.mak at xamarin.com>
+
+	Bump version number to 2.10.8
+
+2011-12-02  Duncan Mak  <duncan.mak at xamarin.com>
+
+	Bump to 2.10.7
+
+2011-04-21  Zoltan Varga  <vargaz at gmail.com>
+
+	Don't allow compiling with stock LLVM versions, only the Mono LLVM
+	repo at https://github.com/mono/llvm is supported.
+
+2011-10-24  Miguel de Icaza  <miguel at gnome.org>
+
+	Remove the exit code so that we can get a little bit further on
+	MacOS X
+
+2011-09-13  Alex Corrado  <alexc at xamarin.com>
+
+	2.10.6
+
+2011-08-29  Hin-Tak Leung  <htl10 at users.sourceforge.net>
+
+	Fix mingw32 cross-build on a git no-branch checkout. Fixes
+	#698446.
+
 2011-08-22  Alex Corrado  <alexc at xamarin.com>
 
 	2.10.5
diff --git a/build-mingw32.sh b/build-mingw32.sh
index d751b2e..16fc66f 100755
--- a/build-mingw32.sh
+++ b/build-mingw32.sh
@@ -57,11 +57,11 @@ function setup ()
     CROSS_DLL_DIR="$CROSS_DIR/bin"
     PATH=$CROSS_BIN_DIR:$PATH
 
-    MONO_VERSION=`grep AM_INIT_AUTOMAKE configure.in | cut -d ',' -f 2|tr -d '\)'`
+    MONO_VERSION=`grep AM_INIT_AUTOMAKE configure.in | cut -d ',' -f 2|tr -d '\)'|tr -d '\('`
     
     if [ -d ./.git ]; then
 	MONO_GIT_COMMIT="`git log -1 --format=format:%t`"
-	MONO_GIT_BRANCH="`git branch|grep '\*'|cut -d ' ' -f 2`"
+	MONO_GIT_BRANCH="`git branch|grep '\*'|cut -d ' ' -f 2|tr -d '\)'|tr -d '\('`"
 	MONO_RELEASE="$MONO_VERSION-$MONO_GIT_BRANCH-$MONO_GIT_COMMIT"
     else
 	MONO_RELEASE="$MONO_VERSION"
diff --git a/config.guess b/config.guess
index 396482d..666c5ad 100755
--- a/config.guess
+++ b/config.guess
@@ -1,10 +1,10 @@
 #! /bin/sh
 # Attempt to guess a canonical system name.
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-#   2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
-#   Inc.
+#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+#   Free Software Foundation, Inc.
 
-timestamp='2006-07-02'
+timestamp='2009-11-20'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -27,16 +27,16 @@ timestamp='2006-07-02'
 # the same distribution terms that you use for the rest of that program.
 
 
-# Originally written by Per Bothner <per at bothner.com>.
-# Please send patches to <config-patches at gnu.org>.  Submit a context
-# diff and a properly formatted ChangeLog entry.
+# Originally written by Per Bothner.  Please send patches (context
+# diff format) to <config-patches at gnu.org> and include a ChangeLog
+# entry.
 #
 # This script attempts to guess a canonical system name similar to
 # config.sub.  If it succeeds, it prints the system name on stdout, and
 # exits with 0.  Otherwise, it exits with 1.
 #
-# The plan is that this can be called by configure scripts if you
-# don't specify an explicit build system type.
+# You can get the latest version of this script from:
+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
 
 me=`echo "$0" | sed -e 's,.*/,,'`
 
@@ -56,8 +56,8 @@ version="\
 GNU config.guess ($timestamp)
 
 Originally written by Per Bothner.
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
-Free Software Foundation, Inc.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
+2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -139,6 +139,16 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
 UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
 UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
 
+case "${UNAME_MACHINE}" in
+    i?86)
+	test -z "$VENDOR" && VENDOR=pc
+	;;
+    *)
+	test -z "$VENDOR" && VENDOR=unknown
+	;;
+esac
+test -f /etc/SuSE-release -o -f /.buildenv && VENDOR=suse
+
 # Note: order is significant - the case branches are not exclusive.
 
 case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
@@ -161,6 +171,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 	    arm*) machine=arm-unknown ;;
 	    sh3el) machine=shl-unknown ;;
 	    sh3eb) machine=sh-unknown ;;
+	    sh5el) machine=sh5le-unknown ;;
 	    *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
 	esac
 	# The Operating System including object format, if it has switched
@@ -169,7 +180,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
 		eval $set_cc_for_build
 		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
-			| grep __ELF__ >/dev/null
+			| grep -q __ELF__
 		then
 		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
 		    # Return netbsd for either.  FIX?
@@ -202,19 +213,19 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 	exit ;;
     *:OpenBSD:*:*)
 	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
-	echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
+	echo ${UNAME_MACHINE_ARCH}-${VENDOR}-openbsd${UNAME_RELEASE}
 	exit ;;
     *:ekkoBSD:*:*)
-	echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
+	echo ${UNAME_MACHINE}-${VENDOR}-ekkobsd${UNAME_RELEASE}
 	exit ;;
     *:SolidBSD:*:*)
-	echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
+	echo ${UNAME_MACHINE}-${VENDOR}-solidbsd${UNAME_RELEASE}
 	exit ;;
     macppc:MirBSD:*:*)
-	echo powerpc-unknown-mirbsd${UNAME_RELEASE}
+	echo powerpc-${VENDOR}-mirbsd${UNAME_RELEASE}
 	exit ;;
     *:MirBSD:*:*)
-	echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
+	echo ${UNAME_MACHINE}-${VENDOR}-mirbsd${UNAME_RELEASE}
 	exit ;;
     alpha:OSF1:*:*)
 	case $UNAME_RELEASE in
@@ -279,13 +290,13 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 	echo alpha-dec-winnt3.5
 	exit ;;
     Amiga*:UNIX_System_V:4.0:*)
-	echo m68k-unknown-sysv4
+	echo m68k-${VENDOR}-sysv4
 	exit ;;
     *:[Aa]miga[Oo][Ss]:*:*)
-	echo ${UNAME_MACHINE}-unknown-amigaos
+	echo ${UNAME_MACHINE}-${VENDOR}-amigaos
 	exit ;;
     *:[Mm]orph[Oo][Ss]:*:*)
-	echo ${UNAME_MACHINE}-unknown-morphos
+	echo ${UNAME_MACHINE}-${VENDOR}-morphos
 	exit ;;
     *:OS/390:*:*)
 	echo i370-ibm-openedition
@@ -300,7 +311,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 	echo arm-acorn-riscix${UNAME_RELEASE}
 	exit ;;
     arm:riscos:*:*|arm:RISCOS:*:*)
-	echo arm-unknown-riscos
+	echo arm-${VENDOR}-riscos
 	exit ;;
     SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
 	echo hppa1.1-hitachi-hiuxmpp
@@ -323,14 +334,33 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 	case `/usr/bin/uname -p` in
 	    sparc) echo sparc-icl-nx7; exit ;;
 	esac ;;
+    s390x:SunOS:*:*)
+	echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
     sun4H:SunOS:5.*:*)
 	echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
 	exit ;;
     sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
 	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
 	exit ;;
-    i86pc:SunOS:5.*:*)
-	echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+    i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
+	echo i386-pc-auroraux${UNAME_RELEASE}
+	exit ;;
+    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
+	eval $set_cc_for_build
+	SUN_ARCH="i386"
+	# If there is a compiler, see if it is configured for 64-bit objects.
+	# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
+	# This test works for both compilers.
+	if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+	    if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
+		(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+		grep IS_64BIT_ARCH >/dev/null
+	    then
+		SUN_ARCH="x86_64"
+	    fi
+	fi
+	echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
 	exit ;;
     sun4*:SunOS:6*:*)
 	# According to config.sub, this is the proper way to canonicalize
@@ -389,7 +419,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
         echo m68k-hades-mint${UNAME_RELEASE}
         exit ;;
     *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
-        echo m68k-unknown-mint${UNAME_RELEASE}
+        echo m68k-${VENDOR}-mint${UNAME_RELEASE}
         exit ;;
     m68k:machten:*:*)
 	echo m68k-apple-machten${UNAME_RELEASE}
@@ -531,7 +561,7 @@ EOF
 		echo rs6000-ibm-aix3.2
 	fi
 	exit ;;
-    *:AIX:*:[45])
+    *:AIX:*:[456])
 	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
 	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
 		IBM_ARCH=rs6000
@@ -639,7 +669,7 @@ EOF
 	    # => hppa64-hp-hpux11.23
 
 	    if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
-		grep __LP64__ >/dev/null
+		grep -q __LP64__
 	    then
 		HP_ARCH="hppa2.0w"
 	    else
@@ -700,9 +730,9 @@ EOF
 	exit ;;
     i*86:OSF1:*:*)
 	if [ -x /usr/sbin/sysversion ] ; then
-	    echo ${UNAME_MACHINE}-unknown-osf1mk
+	    echo ${UNAME_MACHINE}-${VENDOR}-osf1mk
 	else
-	    echo ${UNAME_MACHINE}-unknown-osf1
+	    echo ${UNAME_MACHINE}-${VENDOR}-osf1
 	fi
 	exit ;;
     parisc*:Lites*:*:*)
@@ -762,25 +792,25 @@ EOF
 	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
 	exit ;;
     sparc*:BSD/OS:*:*)
-	echo sparc-unknown-bsdi${UNAME_RELEASE}
+	echo sparc-${VENDOR}-bsdi${UNAME_RELEASE}
 	exit ;;
     *:BSD/OS:*:*)
-	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+	echo ${UNAME_MACHINE}-${VENDOR}-bsdi${UNAME_RELEASE}
 	exit ;;
     *:FreeBSD:*:*)
 	case ${UNAME_MACHINE} in
 	    pc98)
-		echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+		echo i386-${VENDOR}-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
 	    amd64)
-		echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+		echo x86_64-${VENDOR}-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
 	    *)
-		echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+		echo ${UNAME_MACHINE}-${VENDOR}-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
 	esac
 	exit ;;
     i*:CYGWIN*:*)
 	echo ${UNAME_MACHINE}-pc-cygwin
 	exit ;;
-    i*:MINGW*:*)
+    *:MINGW*:*)
 	echo ${UNAME_MACHINE}-pc-mingw32
 	exit ;;
     i*:windows32*:*)
@@ -790,15 +820,24 @@ EOF
     i*:PW*:*)
 	echo ${UNAME_MACHINE}-pc-pw32
 	exit ;;
-    x86:Interix*:[3456]*)
-	echo i586-pc-interix${UNAME_RELEASE}
-	exit ;;
-    EM64T:Interix*:[3456]*)
-	echo x86_64-unknown-interix${UNAME_RELEASE}
-	exit ;;
+    *:Interix*:*)
+    	case ${UNAME_MACHINE} in
+	    x86)
+		echo i586-pc-interix${UNAME_RELEASE}
+		exit ;;
+	    authenticamd | genuineintel | EM64T)
+		echo x86_64-${VENDOR}-interix${UNAME_RELEASE}
+		exit ;;
+	    IA64)
+		echo ia64-${VENDOR}-interix${UNAME_RELEASE}
+		exit ;;
+	esac ;;
     [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
 	echo i${UNAME_MACHINE}-pc-mks
 	exit ;;
+    8664:Windows_NT:*)
+	echo x86_64-pc-mks
+	exit ;;
     i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
 	# How do we know it's Interix rather than the generic POSIX subsystem?
 	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
@@ -809,30 +848,51 @@ EOF
 	echo ${UNAME_MACHINE}-pc-uwin
 	exit ;;
     amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
-	echo x86_64-unknown-cygwin
+	echo x86_64-${VENDOR}-cygwin
 	exit ;;
     p*:CYGWIN*:*)
-	echo powerpcle-unknown-cygwin
+	echo powerpcle-${VENDOR}-cygwin
 	exit ;;
     prep*:SunOS:5.*:*)
-	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	echo powerpcle-${VENDOR}-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
 	exit ;;
     *:GNU:*:*)
 	# the GNU system
-	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-${VENDOR}-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
 	exit ;;
     *:GNU/*:*:*)
 	# other systems with GNU libc and userland
-	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
+	echo ${UNAME_MACHINE}-${VENDOR}-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
 	exit ;;
     i*86:Minix:*:*)
 	echo ${UNAME_MACHINE}-pc-minix
 	exit ;;
+    alpha:Linux:*:*)
+	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+	  EV5)   UNAME_MACHINE=alphaev5 ;;
+	  EV56)  UNAME_MACHINE=alphaev56 ;;
+	  PCA56) UNAME_MACHINE=alphapca56 ;;
+	  PCA57) UNAME_MACHINE=alphapca56 ;;
+	  EV6)   UNAME_MACHINE=alphaev6 ;;
+	  EV67)  UNAME_MACHINE=alphaev67 ;;
+	  EV68*) UNAME_MACHINE=alphaev68 ;;
+        esac
+	objdump --private-headers /bin/sh | grep -q ld.so.1
+	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
+	echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu${LIBC}
+	exit ;;
     arm*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	eval $set_cc_for_build
+	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
+	    | grep -q __ARM_EABI__
+	then
+	    echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu
+	else
+	    echo ${UNAME_MACHINE}-${VENDOR}-linux-gnueabi
+	fi
 	exit ;;
     avr32*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu
 	exit ;;
     cris:Linux:*:*)
 	echo cris-axis-linux-gnu
@@ -841,178 +901,91 @@ EOF
 	echo crisv32-axis-linux-gnu
 	exit ;;
     frv:Linux:*:*)
-    	echo frv-unknown-linux-gnu
+    	echo frv-${VENDOR}-linux-gnu
+	exit ;;
+    i*86:Linux:*:*)
+	LIBC=gnu
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#ifdef __dietlibc__
+	LIBC=dietlibc
+	#endif
+EOF
+	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
+	echo "${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}"
 	exit ;;
     ia64:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu
 	exit ;;
     m32r*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu
 	exit ;;
     m68*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu
 	exit ;;
-    mips:Linux:*:*)
-	eval $set_cc_for_build
-	sed 's/^	//' << EOF >$dummy.c
-	#undef CPU
-	#undef mips
-	#undef mipsel
-	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
-	CPU=mipsel
-	#else
-	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
-	CPU=mips
-	#else
-	CPU=
-	#endif
-	#endif
-EOF
-	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
-	    /^CPU/{
-		s: ::g
-		p
-	    }'`"
-	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
-	;;
-    mips64:Linux:*:*)
+    mips:Linux:*:* | mips64:Linux:*:*)
 	eval $set_cc_for_build
 	sed 's/^	//' << EOF >$dummy.c
 	#undef CPU
-	#undef mips64
-	#undef mips64el
+	#undef ${UNAME_MACHINE}
+	#undef ${UNAME_MACHINE}el
 	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
-	CPU=mips64el
+	CPU=${UNAME_MACHINE}el
 	#else
 	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
-	CPU=mips64
+	CPU=${UNAME_MACHINE}
 	#else
 	CPU=
 	#endif
 	#endif
 EOF
-	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
-	    /^CPU/{
-		s: ::g
-		p
-	    }'`"
-	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
+	test x"${CPU}" != x && { echo "${CPU}-${VENDOR}-linux-gnu"; exit; }
 	;;
     or32:Linux:*:*)
-	echo or32-unknown-linux-gnu
+	echo or32-${VENDOR}-linux-gnu
 	exit ;;
-    ppc:Linux:*:*)
-	echo powerpc-unknown-linux-gnu
+    padre:Linux:*:*)
+	echo sparc-${VENDOR}-linux-gnu
 	exit ;;
-    ppc64:Linux:*:*)
-	echo powerpc64-unknown-linux-gnu
-	exit ;;
-    alpha:Linux:*:*)
-	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
-	  EV5)   UNAME_MACHINE=alphaev5 ;;
-	  EV56)  UNAME_MACHINE=alphaev56 ;;
-	  PCA56) UNAME_MACHINE=alphapca56 ;;
-	  PCA57) UNAME_MACHINE=alphapca56 ;;
-	  EV6)   UNAME_MACHINE=alphaev6 ;;
-	  EV67)  UNAME_MACHINE=alphaev67 ;;
-	  EV68*) UNAME_MACHINE=alphaev68 ;;
-        esac
-	objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
-	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
-	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+    parisc64:Linux:*:* | hppa64:Linux:*:*)
+	echo hppa64-${VENDOR}-linux-gnu
 	exit ;;
     parisc:Linux:*:* | hppa:Linux:*:*)
 	# Look for CPU level
 	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
-	  PA7*) echo hppa1.1-unknown-linux-gnu ;;
-	  PA8*) echo hppa2.0-unknown-linux-gnu ;;
-	  *)    echo hppa-unknown-linux-gnu ;;
+	  PA7*) echo hppa1.1-${VENDOR}-linux-gnu ;;
+	  PA8*) echo hppa2.0-${VENDOR}-linux-gnu ;;
+	  *)    echo hppa-${VENDOR}-linux-gnu ;;
 	esac
 	exit ;;
-    parisc64:Linux:*:* | hppa64:Linux:*:*)
-	echo hppa64-unknown-linux-gnu
+    ppc64:Linux:*:*)
+	echo powerpc64-${VENDOR}-linux-gnu
+	exit ;;
+    ppc:Linux:*:*)
+	echo powerpc-${VENDOR}-linux-gnu
 	exit ;;
     s390:Linux:*:* | s390x:Linux:*:*)
 	echo ${UNAME_MACHINE}-ibm-linux
 	exit ;;
     sh64*:Linux:*:*)
-    	echo ${UNAME_MACHINE}-unknown-linux-gnu
+    	echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu
 	exit ;;
     sh*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu
 	exit ;;
     sparc:Linux:*:* | sparc64:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu
 	exit ;;
     vax:Linux:*:*)
 	echo ${UNAME_MACHINE}-dec-linux-gnu
 	exit ;;
     x86_64:Linux:*:*)
-	echo x86_64-unknown-linux-gnu
+	echo x86_64-${VENDOR}-linux-gnu
+	exit ;;
+    xtensa*:Linux:*:*)
+    	echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu
 	exit ;;
-    i*86:Linux:*:*)
-	# The BFD linker knows what the default object file format is, so
-	# first see if it will tell us. cd to the root directory to prevent
-	# problems with other programs or directories called `ld' in the path.
-	# Set LC_ALL=C to ensure ld outputs messages in English.
-	ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
-			 | sed -ne '/supported targets:/!d
-				    s/[ 	][ 	]*/ /g
-				    s/.*supported targets: *//
-				    s/ .*//
-				    p'`
-        case "$ld_supported_targets" in
-	  elf32-i386)
-		TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
-		;;
-	  a.out-i386-linux)
-		echo "${UNAME_MACHINE}-pc-linux-gnuaout"
-		exit ;;
-	  coff-i386)
-		echo "${UNAME_MACHINE}-pc-linux-gnucoff"
-		exit ;;
-	  "")
-		# Either a pre-BFD a.out linker (linux-gnuoldld) or
-		# one that does not give us useful --help.
-		echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
-		exit ;;
-	esac
-	# Determine whether the default compiler is a.out or elf
-	eval $set_cc_for_build
-	sed 's/^	//' << EOF >$dummy.c
-	#include <features.h>
-	#ifdef __ELF__
-	# ifdef __GLIBC__
-	#  if __GLIBC__ >= 2
-	LIBC=gnu
-	#  else
-	LIBC=gnulibc1
-	#  endif
-	# else
-	LIBC=gnulibc1
-	# endif
-	#else
-	#if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
-	LIBC=gnu
-	#else
-	LIBC=gnuaout
-	#endif
-	#endif
-	#ifdef __dietlibc__
-	LIBC=dietlibc
-	#endif
-EOF
-	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
-	    /^LIBC/{
-		s: ::g
-		p
-	    }'`"
-	test x"${LIBC}" != x && {
-		echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
-		exit
-	}
-	test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
-	;;
     i*86:DYNIX/ptx:4*:*)
 	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
 	# earlier versions are messed up and put the nodename in both
@@ -1033,16 +1006,16 @@ EOF
 	echo ${UNAME_MACHINE}-pc-os2-emx
 	exit ;;
     i*86:XTS-300:*:STOP)
-	echo ${UNAME_MACHINE}-unknown-stop
+	echo ${UNAME_MACHINE}-${VENDOR}-stop
 	exit ;;
     i*86:atheos:*:*)
-	echo ${UNAME_MACHINE}-unknown-atheos
+	echo ${UNAME_MACHINE}-${VENDOR}-atheos
 	exit ;;
     i*86:syllable:*:*)
 	echo ${UNAME_MACHINE}-pc-syllable
 	exit ;;
-    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
-	echo i386-unknown-lynxos${UNAME_RELEASE}
+    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
+	echo i386-${VENDOR}-lynxos${UNAME_RELEASE}
 	exit ;;
     i*86:*DOS:*:*)
 	echo ${UNAME_MACHINE}-pc-msdosdjgpp
@@ -1062,7 +1035,7 @@ EOF
 	    *Pentium)	     UNAME_MACHINE=i586 ;;
 	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
 	esac
-	echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
+	echo ${UNAME_MACHINE}-${VENDOR}-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
 	exit ;;
     i*86:*:3.2:*)
 	if test -f /usr/options/cb.name; then
@@ -1085,8 +1058,11 @@ EOF
     pc:*:*:*)
 	# Left here for compatibility:
         # uname -m prints for DJGPP always 'pc', but it prints nothing about
-        # the processor, so we play safe by assuming i386.
-	echo i386-pc-msdosdjgpp
+        # the processor, so we play safe by assuming i586.
+	# Note: whatever this is, it MUST be the same as what config.sub
+	# prints for the "djgpp" host, or else GDB configury will decide that
+	# this is a cross-build.
+	echo i586-pc-msdosdjgpp
         exit ;;
     Intel:Mach:3*:*)
 	echo i386-pc-mach3
@@ -1098,7 +1074,7 @@ EOF
 	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
 	  echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
 	else # Add other i860-SVR4 vendors below as they are discovered.
-	  echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
+	  echo i860-${VENDOR}-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
 	fi
 	exit ;;
     mini*:CTIX:SYS*5:*)
@@ -1124,20 +1100,30 @@ EOF
     3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
         /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
           && { echo i486-ncr-sysv4; exit; } ;;
+    NCR*:*:4.2:* | MPRAS*:*:4.2:*)
+	OS_REL='.3'
+	test -r /etc/.relid \
+	    && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+	    && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
+	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+	    && { echo i586-ncr-sysv4.3${OS_REL}; exit; }
+	/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
+	    && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
     m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
-	echo m68k-unknown-lynxos${UNAME_RELEASE}
+	echo m68k-${VENDOR}-lynxos${UNAME_RELEASE}
 	exit ;;
     mc68030:UNIX_System_V:4.*:*)
 	echo m68k-atari-sysv4
 	exit ;;
     TSUNAMI:LynxOS:2.*:*)
-	echo sparc-unknown-lynxos${UNAME_RELEASE}
+	echo sparc-${VENDOR}-lynxos${UNAME_RELEASE}
 	exit ;;
     rs6000:LynxOS:2.*:*)
-	echo rs6000-unknown-lynxos${UNAME_RELEASE}
+	echo rs6000-${VENDOR}-lynxos${UNAME_RELEASE}
 	exit ;;
-    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
-	echo powerpc-unknown-lynxos${UNAME_RELEASE}
+    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
+	echo powerpc-${VENDOR}-lynxos${UNAME_RELEASE}
 	exit ;;
     SM[BE]S:UNIX_SV:*:*)
 	echo mips-dde-sysv${UNAME_RELEASE}
@@ -1187,7 +1173,7 @@ EOF
 	if [ -d /usr/nec ]; then
 	        echo mips-nec-sysv${UNAME_RELEASE}
 	else
-	        echo mips-unknown-sysv${UNAME_RELEASE}
+	        echo mips-${VENDOR}-sysv${UNAME_RELEASE}
 	fi
         exit ;;
     BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
@@ -1199,6 +1185,9 @@ EOF
     BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
 	echo i586-pc-beos
 	exit ;;
+    BePC:Haiku:*:*)	# Haiku running on Intel PC compatible.
+	echo i586-pc-haiku
+	exit ;;
     SX-4:SUPER-UX:*:*)
 	echo sx4-nec-superux${UNAME_RELEASE}
 	exit ;;
@@ -1208,6 +1197,15 @@ EOF
     SX-6:SUPER-UX:*:*)
 	echo sx6-nec-superux${UNAME_RELEASE}
 	exit ;;
+    SX-7:SUPER-UX:*:*)
+	echo sx7-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-8:SUPER-UX:*:*)
+	echo sx8-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-8R:SUPER-UX:*:*)
+	echo sx8r-nec-superux${UNAME_RELEASE}
+	exit ;;
     Power*:Rhapsody:*:*)
 	echo powerpc-apple-rhapsody${UNAME_RELEASE}
 	exit ;;
@@ -1217,6 +1215,16 @@ EOF
     *:Darwin:*:*)
 	UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
 	case $UNAME_PROCESSOR in
+	    i386)
+		eval $set_cc_for_build
+		if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+		  if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
+		      (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+		      grep IS_64BIT_ARCH >/dev/null
+		  then
+		      UNAME_PROCESSOR="x86_64"
+		  fi
+		fi ;;
 	    unknown) UNAME_PROCESSOR=powerpc ;;
 	esac
 	echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
@@ -1256,13 +1264,13 @@ EOF
 	else
 	    UNAME_MACHINE="$cputype"
 	fi
-	echo ${UNAME_MACHINE}-unknown-plan9
+	echo ${UNAME_MACHINE}-${VENDOR}-plan9
 	exit ;;
     *:TOPS-10:*:*)
-	echo pdp10-unknown-tops10
+	echo pdp10-${VENDOR}-tops10
 	exit ;;
     *:TENEX:*:*)
-	echo pdp10-unknown-tenex
+	echo pdp10-${VENDOR}-tenex
 	exit ;;
     KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
 	echo pdp10-dec-tops20
@@ -1271,16 +1279,16 @@ EOF
 	echo pdp10-xkl-tops20
 	exit ;;
     *:TOPS-20:*:*)
-	echo pdp10-unknown-tops20
+	echo pdp10-${VENDOR}-tops20
 	exit ;;
     *:ITS:*:*)
-	echo pdp10-unknown-its
+	echo pdp10-${VENDOR}-its
 	exit ;;
     SEI:*:*:SEIUX)
         echo mips-sei-seiux${UNAME_RELEASE}
 	exit ;;
     *:DragonFly:*:*)
-	echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+	echo ${UNAME_MACHINE}-${VENDOR}-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
 	exit ;;
     *:*VMS:*:*)
     	UNAME_MACHINE=`(uname -p) 2>/dev/null`
@@ -1298,6 +1306,9 @@ EOF
     i*86:rdos:*:*)
 	echo ${UNAME_MACHINE}-pc-rdos
 	exit ;;
+    i*86:AROS:*:*)
+	echo ${UNAME_MACHINE}-pc-aros
+	exit ;;
 esac
 
 #echo '(No uname command or uname output not recognized.)' 1>&2
@@ -1458,9 +1469,9 @@ This script, last modified $timestamp, has failed to recognize
 the operating system you are using. It is advised that you
 download the most up to date version of the config scripts from
 
-  http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess
+  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
 and
-  http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub
+  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
 
 If the version you run ($0) is already up to date, please
 send the following data and any information you think might be
diff --git a/config.sub b/config.sub
index fab0aa3..2a55a50 100755
--- a/config.sub
+++ b/config.sub
@@ -1,10 +1,10 @@
 #! /bin/sh
 # Configuration validation subroutine script.
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-#   2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
-#   Inc.
+#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+#   Free Software Foundation, Inc.
 
-timestamp='2006-09-20'
+timestamp='2009-11-20'
 
 # This file is (in principle) common to ALL GNU software.
 # The presence of a machine in this file suggests that SOME GNU software
@@ -32,13 +32,16 @@ timestamp='2006-09-20'
 
 
 # Please send patches to <config-patches at gnu.org>.  Submit a context
-# diff and a properly formatted ChangeLog entry.
+# diff and a properly formatted GNU ChangeLog entry.
 #
 # Configuration subroutine to validate and canonicalize a configuration type.
 # Supply the specified configuration type as an argument.
 # If it is invalid, we print an error message on stderr and exit with code 1.
 # Otherwise, we print the canonical config type on stdout and succeed.
 
+# You can get the latest version of this script from:
+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
+
 # This file is supposed to be the same for all GNU packages
 # and recognize all the CPU types, system types and aliases
 # that are meaningful with *any* GNU software.
@@ -72,8 +75,8 @@ Report bugs and patches to <config-patches at gnu.org>."
 version="\
 GNU config.sub ($timestamp)
 
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
-Free Software Foundation, Inc.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
+2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -122,6 +125,7 @@ maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
 case $maybe_os in
   nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
   uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
+  kopensolaris*-gnu* | \
   storm-chaos* | os2-emx* | rtmk-nova*)
     os=-$maybe_os
     basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
@@ -148,10 +152,13 @@ case $os in
 	-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
 	-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
 	-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
-	-apple | -axis | -knuth | -cray)
+	-apple | -axis | -knuth | -cray | -microblaze)
 		os=
 		basic_machine=$1
 		;;
+        -bluegene*)
+	        os=-cnk
+		;;
 	-sim | -cisco | -oki | -wec | -winbond)
 		os=
 		basic_machine=$1
@@ -245,17 +252,20 @@ case $basic_machine in
 	| bfin \
 	| c4x | clipper \
 	| d10v | d30v | dlx | dsp16xx \
-	| fr30 | frv \
+	| fido | fr30 | frv \
 	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
 	| i370 | i860 | i960 | ia64 \
 	| ip2k | iq2000 \
+	| lm32 \
 	| m32c | m32r | m32rle | m68000 | m68k | m88k \
-	| maxq | mb | microblaze | mcore \
+	| maxq | mb | microblaze | mcore | mep | metag \
 	| mips | mipsbe | mipseb | mipsel | mipsle \
 	| mips16 \
 	| mips64 | mips64el \
-	| mips64vr | mips64vrel \
+	| mips64octeon | mips64octeonel \
 	| mips64orion | mips64orionel \
+	| mips64r5900 | mips64r5900el \
+	| mips64vr | mips64vrel \
 	| mips64vr4100 | mips64vr4100el \
 	| mips64vr4300 | mips64vr4300el \
 	| mips64vr5000 | mips64vr5000el \
@@ -268,6 +278,7 @@ case $basic_machine in
 	| mipsisa64sr71k | mipsisa64sr71kel \
 	| mipstx39 | mipstx39el \
 	| mn10200 | mn10300 \
+	| moxie \
 	| mt \
 	| msp430 \
 	| nios | nios2 \
@@ -276,20 +287,22 @@ case $basic_machine in
 	| pdp10 | pdp11 | pj | pjl \
 	| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
 	| pyramid \
+	| rx \
 	| score \
-	| sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
+	| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
 	| sh64 | sh64le \
 	| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
 	| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
 	| spu | strongarm \
 	| tahoe | thumb | tic4x | tic80 | tron \
+	| ubicom32 \
 	| v850 | v850e \
 	| we32k \
 	| x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
-	| z8k)
+	| z8k | z80)
 		basic_machine=$basic_machine-unknown
 		;;
-	m6811 | m68hc11 | m6812 | m68hc12)
+	m6811 | m68hc11 | m6812 | m68hc12 | picochip)
 		# Motorola 68HC11/12.
 		basic_machine=$basic_machine-unknown
 		os=-none
@@ -324,19 +337,22 @@ case $basic_machine in
 	| clipper-* | craynv-* | cydra-* \
 	| d10v-* | d30v-* | dlx-* \
 	| elxsi-* \
-	| f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
+	| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
 	| h8300-* | h8500-* \
 	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
 	| i*86-* | i860-* | i960-* | ia64-* \
 	| ip2k-* | iq2000-* \
+	| lm32-* \
 	| m32c-* | m32r-* | m32rle-* \
 	| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
-	| m88110-* | m88k-* | maxq-* | mcore-* \
+	| m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \
 	| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
 	| mips16-* \
 	| mips64-* | mips64el-* \
-	| mips64vr-* | mips64vrel-* \
+	| mips64octeon-* | mips64octeonel-* \
 	| mips64orion-* | mips64orionel-* \
+	| mips64r5900-* | mips64r5900el-* \
+	| mips64vr-* | mips64vrel-* \
 	| mips64vr4100-* | mips64vr4100el-* \
 	| mips64vr4300-* | mips64vr4300el-* \
 	| mips64vr5000-* | mips64vr5000el-* \
@@ -357,21 +373,26 @@ case $basic_machine in
 	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
 	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
 	| pyramid-* \
-	| romp-* | rs6000-* \
-	| sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
+	| romp-* | rs6000-* | rx-* \
+	| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
 	| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
 	| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
 	| sparclite-* \
 	| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
 	| tahoe-* | thumb-* \
-	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
+	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \
 	| tron-* \
+	| ubicom32-* \
 	| v850-* | v850e-* | vax-* \
 	| we32k-* \
 	| x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
-	| xstormy16-* | xtensa-* \
+	| xstormy16-* | xtensa*-* \
 	| ymp-* \
-	| z8k-*)
+	| z8k-* | z80-*)
+		;;
+	# Recognize the basic CPU types without company name, with glob match.
+	xtensa*)
+		basic_machine=$basic_machine-unknown
 		;;
 	# Recognize the various machine names and aliases which stand
 	# for a CPU type and a company and sometimes even an OS.
@@ -435,6 +456,10 @@ case $basic_machine in
 		basic_machine=m68k-apollo
 		os=-bsd
 		;;
+	aros)
+		basic_machine=i386-pc
+		os=-aros
+		;;
 	aux)
 		basic_machine=m68k-apple
 		os=-aux
@@ -443,10 +468,26 @@ case $basic_machine in
 		basic_machine=ns32k-sequent
 		os=-dynix
 		;;
+	blackfin)
+		basic_machine=bfin-unknown
+		os=-linux
+		;;
+	blackfin-*)
+		basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
+		os=-linux
+		;;
+	bluegene*)
+		basic_machine=powerpc-ibm
+		os=-cnk
+		;;
 	c90)
 		basic_machine=c90-cray
 		os=-unicos
 		;;
+        cegcc)
+		basic_machine=arm-unknown
+		os=-cegcc
+		;;
 	convex-c1)
 		basic_machine=c1-convex
 		os=-bsd
@@ -475,8 +516,8 @@ case $basic_machine in
 		basic_machine=craynv-cray
 		os=-unicosmp
 		;;
-	cr16c)
-		basic_machine=cr16c-unknown
+	cr16)
+		basic_machine=cr16-unknown
 		os=-elf
 		;;
 	crds | unos)
@@ -514,6 +555,10 @@ case $basic_machine in
 		basic_machine=m88k-motorola
 		os=-sysv3
 		;;
+	dicos)
+		basic_machine=i686-pc
+		os=-dicos
+		;;
 	djgpp)
 		basic_machine=i586-pc
 		os=-msdosdjgpp
@@ -668,6 +713,14 @@ case $basic_machine in
 		basic_machine=m68k-isi
 		os=-sysv
 		;;
+	m68knommu)
+		basic_machine=m68k-unknown
+		os=-linux
+		;;
+	m68knommu-*)
+		basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
+		os=-linux
+		;;
 	m88k-omron*)
 		basic_machine=m88k-omron
 		;;
@@ -679,10 +732,17 @@ case $basic_machine in
 		basic_machine=ns32k-utek
 		os=-sysv
 		;;
+        microblaze)
+		basic_machine=microblaze-xilinx
+		;;
 	mingw32)
 		basic_machine=i386-pc
 		os=-mingw32
 		;;
+	mingw32ce)
+		basic_machine=arm-unknown
+		os=-mingw32ce
+		;;
 	miniframe)
 		basic_machine=m68000-convergent
 		;;
@@ -809,6 +869,14 @@ case $basic_machine in
 		basic_machine=i860-intel
 		os=-osf
 		;;
+	parisc)
+		basic_machine=hppa-unknown
+		os=-linux
+		;;
+	parisc-*)
+		basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
+		os=-linux
+		;;
 	pbd)
 		basic_machine=sparc-tti
 		;;
@@ -925,6 +993,9 @@ case $basic_machine in
 		basic_machine=sh-hitachi
 		os=-hms
 		;;
+	sh5el)
+		basic_machine=sh5le-unknown
+		;;
 	sh64)
 		basic_machine=sh64-unknown
 		;;
@@ -1014,6 +1085,10 @@ case $basic_machine in
 		basic_machine=tic6x-unknown
 		os=-coff
 		;;
+	tile*)
+		basic_machine=tile-unknown
+		os=-linux-gnu
+		;;
 	tx39)
 		basic_machine=mipstx39-unknown
 		;;
@@ -1089,6 +1164,10 @@ case $basic_machine in
 		basic_machine=z8k-unknown
 		os=-sim
 		;;
+	z80-*-coff)
+		basic_machine=z80-unknown
+		os=-sim
+		;;
 	none)
 		basic_machine=none-none
 		os=-none
@@ -1127,7 +1206,7 @@ case $basic_machine in
 	we32k)
 		basic_machine=we32k-att
 		;;
-	sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
+	sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
 		basic_machine=sh-unknown
 		;;
 	sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
@@ -1177,6 +1256,9 @@ case $os in
         # First match some system type aliases
         # that might get confused with valid system types.
 	# -solaris* is a basic system type, with this one exception.
+        -auroraux)
+	        os=-auroraux
+		;;
 	-solaris1 | -solaris1.*)
 		os=`echo $os | sed -e 's|solaris1|sunos4|'`
 		;;
@@ -1197,10 +1279,11 @@ case $os in
 	# Each alternative MUST END IN A *, to match a version number.
 	# -sysv* is not here because it comes later, after sysvr4.
 	-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
-	      | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
-	      | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
+	      | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
+	      | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
+	      | -sym* | -kopensolaris* \
 	      | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
-	      | -aos* \
+	      | -aos* | -aros* \
 	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
 	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
 	      | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
@@ -1209,7 +1292,7 @@ case $os in
 	      | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
 	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
 	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
-	      | -chorusos* | -chorusrdb* \
+	      | -chorusos* | -chorusrdb* | -cegcc* \
 	      | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
 	      | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
 	      | -uxpv* | -beos* | -mpeix* | -udk* \
@@ -1219,7 +1302,7 @@ case $os in
 	      | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
 	      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
 	      | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
-	      | -skyos* | -haiku* | -rdos* | -toppers*)
+	      | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*)
 	# Remember, each alternative MUST END IN *, to match a version number.
 		;;
 	-qnx*)
@@ -1349,6 +1432,9 @@ case $os in
 	-zvmoe)
 		os=-zvmoe
 		;;
+	-dicos*)
+		os=-dicos
+		;;
 	-none)
 		;;
 	*)
@@ -1414,6 +1500,9 @@ case $basic_machine in
 	m68*-cisco)
 		os=-aout
 		;;
+        mep-*)
+		os=-elf
+		;;
 	mips*-cisco)
 		os=-elf
 		;;
@@ -1543,7 +1632,7 @@ case $basic_machine in
 			-sunos*)
 				vendor=sun
 				;;
-			-aix*)
+			-cnk*|-aix*)
 				vendor=ibm
 				;;
 			-beos*)
diff --git a/configure b/configure
index 8443698..136178f 100755
--- a/configure
+++ b/configure
@@ -3598,7 +3598,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE=mono
- VERSION=2.10.5
+ VERSION=2.10.8.1
 
 
 cat >>confdefs.h <<_ACEOF
@@ -22754,11 +22754,17 @@ fi
    llvm_version=`$LLVM_CONFIG --version`
    major_version=`echo $llvm_version | cut -c 1`
    minor_version=`echo $llvm_version | cut -c 3`
+   { $as_echo "$as_me:${as_lineno-$LINENO}: checking LLVM version" >&5
+$as_echo_n "checking LLVM version... " >&6; }
+   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $llvm_version" >&5
+$as_echo "$llvm_version" >&6; }
    if echo $llvm_version | grep -q 'mono'; then
 
 $as_echo "#define LLVM_MONO_BRANCH 1" >>confdefs.h
 
 	  LLVM_CXXFLAGS="$LLVM_CXXFLAGS -DLLVM_MONO_BRANCH"
+   else
+	  as_fn_error $? "Compiling with stock LLVM is not supported, please use the Mono LLVM repo at https://github.com/mono/llvm, with the GIT branch which matches this version of mono, i.e. 'mono-2-10' for Mono 2.10." "$LINENO" 5
    fi
 
 
diff --git a/configure.in b/configure.in
index 3343683..7f3664e 100644
--- a/configure.in
+++ b/configure.in
@@ -6,7 +6,7 @@ AC_CANONICAL_SYSTEM
 m4_ifdef([_A][M_PROG_TAR],[_A][M_SET_OPTION([tar-ustar])])
 
 AM_CONFIG_HEADER(config.h)
-AM_INIT_AUTOMAKE(mono,2.10.5)
+AM_INIT_AUTOMAKE(mono,2.10.8.1)
 AM_MAINTAINER_MODE
 
 API_VER=2.0
@@ -2105,9 +2105,13 @@ if test "x$enable_llvm" = "xyes"; then
    llvm_version=`$LLVM_CONFIG --version`
    major_version=`echo $llvm_version | cut -c 1`
    minor_version=`echo $llvm_version | cut -c 3`
+   AC_MSG_CHECKING(LLVM version)
+   AC_MSG_RESULT($llvm_version)
    if echo $llvm_version | grep -q 'mono'; then
    	  AC_DEFINE(LLVM_MONO_BRANCH, 1, [Whenever we are using the mono branch of LLVM])
 	  LLVM_CXXFLAGS="$LLVM_CXXFLAGS -DLLVM_MONO_BRANCH"	  
+   else
+	  AC_MSG_ERROR([Compiling with stock LLVM is not supported, please use the Mono LLVM repo at https://github.com/mono/llvm, with the GIT branch which matches this version of mono, i.e. 'mono-2-10' for Mono 2.10.])
    fi
 
    AC_DEFINE_UNQUOTED(LLVM_MAJOR_VERSION, $major_version, [Major version of LLVM libraries])
diff --git a/data/Makefile.in b/data/Makefile.in
index 06a568f..def24df 100644
--- a/data/Makefile.in
+++ b/data/Makefile.in
@@ -373,9 +373,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign data/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu data/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign data/Makefile
+	  $(AUTOMAKE) --gnu data/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
diff --git a/data/net_2_0/Browsers/Makefile.in b/data/net_2_0/Browsers/Makefile.in
index 5f6006a..cbfb79e 100644
--- a/data/net_2_0/Browsers/Makefile.in
+++ b/data/net_2_0/Browsers/Makefile.in
@@ -285,9 +285,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign data/net_2_0/Browsers/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu data/net_2_0/Browsers/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign data/net_2_0/Browsers/Makefile
+	  $(AUTOMAKE) --gnu data/net_2_0/Browsers/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
diff --git a/data/net_2_0/Makefile.in b/data/net_2_0/Makefile.in
index c0055bc..4f6ff60 100644
--- a/data/net_2_0/Makefile.in
+++ b/data/net_2_0/Makefile.in
@@ -334,9 +334,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign data/net_2_0/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu data/net_2_0/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign data/net_2_0/Makefile
+	  $(AUTOMAKE) --gnu data/net_2_0/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
diff --git a/data/net_4_0/Makefile.in b/data/net_4_0/Makefile.in
index a284b19..17291d6 100644
--- a/data/net_4_0/Makefile.in
+++ b/data/net_4_0/Makefile.in
@@ -334,9 +334,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign data/net_4_0/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu data/net_4_0/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign data/net_4_0/Makefile
+	  $(AUTOMAKE) --gnu data/net_4_0/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
diff --git a/depcomp b/depcomp
index ca5ea4e..df8eea7 100755
--- a/depcomp
+++ b/depcomp
@@ -1,10 +1,10 @@
 #! /bin/sh
 # depcomp - compile a program generating dependencies as side-effects
 
-scriptversion=2006-10-15.18
+scriptversion=2009-04-28.21; # UTC
 
-# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006 Free Software
-# Foundation, Inc.
+# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 Free
+# Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -17,9 +17,7 @@ scriptversion=2006-10-15.18
 # GNU General Public License for more details.
 
 # You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # As a special exception to the GNU General Public License, if you
 # distribute this file as part of a program that contains a
@@ -87,6 +85,15 @@ if test "$depmode" = dashXmstdout; then
    depmode=dashmstdout
 fi
 
+cygpath_u="cygpath -u -f -"
+if test "$depmode" = msvcmsys; then
+   # This is just like msvisualcpp but w/o cygpath translation.
+   # Just convert the backslash-escaped backslashes to single forward
+   # slashes to satisfy depend.m4
+   cygpath_u="sed s,\\\\\\\\,/,g"
+   depmode=msvisualcpp
+fi
+
 case "$depmode" in
 gcc3)
 ## gcc 3 implements dependency tracking that does exactly what
@@ -192,14 +199,14 @@ sgi)
 ' < "$tmpdepfile" \
     | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
     tr '
-' ' ' >> $depfile
-    echo >> $depfile
+' ' ' >> "$depfile"
+    echo >> "$depfile"
 
     # The second pass generates a dummy entry for each header file.
     tr ' ' '
 ' < "$tmpdepfile" \
    | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
-   >> $depfile
+   >> "$depfile"
   else
     # The sourcefile does not contain any dependencies, so just
     # store a dummy comment line, to avoid errors with the Makefile
@@ -215,34 +222,39 @@ aix)
   # current directory.  Also, the AIX compiler puts `$object:' at the
   # start of each line; $object doesn't have directory information.
   # Version 6 uses the directory in both cases.
-  stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
-  tmpdepfile="$stripped.u"
+  dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
+  test "x$dir" = "x$object" && dir=
+  base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
   if test "$libtool" = yes; then
+    tmpdepfile1=$dir$base.u
+    tmpdepfile2=$base.u
+    tmpdepfile3=$dir.libs/$base.u
     "$@" -Wc,-M
   else
+    tmpdepfile1=$dir$base.u
+    tmpdepfile2=$dir$base.u
+    tmpdepfile3=$dir$base.u
     "$@" -M
   fi
   stat=$?
 
-  if test -f "$tmpdepfile"; then :
-  else
-    stripped=`echo "$stripped" | sed 's,^.*/,,'`
-    tmpdepfile="$stripped.u"
-  fi
-
   if test $stat -eq 0; then :
   else
-    rm -f "$tmpdepfile"
+    rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
     exit $stat
   fi
 
+  for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
+  do
+    test -f "$tmpdepfile" && break
+  done
   if test -f "$tmpdepfile"; then
-    outname="$stripped.o"
     # Each line is of the form `foo.o: dependent.h'.
     # Do two passes, one to just change these to
     # `$object: dependent.h' and one to simply `dependent.h:'.
-    sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
-    sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
+    sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
+    # That's a tab and a space in the [].
+    sed -e 's,^.*\.[a-z]*:[	 ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
   else
     # The sourcefile does not contain any dependencies, so just
     # store a dummy comment line, to avoid errors with the Makefile
@@ -323,7 +335,12 @@ hp2)
   if test -f "$tmpdepfile"; then
     sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
     # Add `dependent.h:' lines.
-    sed -ne '2,${; s/^ *//; s/ \\*$//; s/$/:/; p;}' "$tmpdepfile" >> "$depfile"
+    sed -ne '2,${
+	       s/^ *//
+	       s/ \\*$//
+	       s/$/:/
+	       p
+	     }' "$tmpdepfile" >> "$depfile"
   else
     echo "#dummy" > "$depfile"
   fi
@@ -399,7 +416,7 @@ dashmstdout)
 
   # Remove the call to Libtool.
   if test "$libtool" = yes; then
-    while test $1 != '--mode=compile'; do
+    while test "X$1" != 'X--mode=compile'; do
       shift
     done
     shift
@@ -450,32 +467,39 @@ makedepend)
   "$@" || exit $?
   # Remove any Libtool call
   if test "$libtool" = yes; then
-    while test $1 != '--mode=compile'; do
+    while test "X$1" != 'X--mode=compile'; do
       shift
     done
     shift
   fi
   # X makedepend
   shift
-  cleared=no
-  for arg in "$@"; do
+  cleared=no eat=no
+  for arg
+  do
     case $cleared in
     no)
       set ""; shift
       cleared=yes ;;
     esac
+    if test $eat = yes; then
+      eat=no
+      continue
+    fi
     case "$arg" in
     -D*|-I*)
       set fnord "$@" "$arg"; shift ;;
     # Strip any option that makedepend may not understand.  Remove
     # the object too, otherwise makedepend will parse it as a source file.
+    -arch)
+      eat=yes ;;
     -*|$object)
       ;;
     *)
       set fnord "$@" "$arg"; shift ;;
     esac
   done
-  obj_suffix="`echo $object | sed 's/^.*\././'`"
+  obj_suffix=`echo "$object" | sed 's/^.*\././'`
   touch "$tmpdepfile"
   ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
   rm -f "$depfile"
@@ -495,7 +519,7 @@ cpp)
 
   # Remove the call to Libtool.
   if test "$libtool" = yes; then
-    while test $1 != '--mode=compile'; do
+    while test "X$1" != 'X--mode=compile'; do
       shift
     done
     shift
@@ -533,13 +557,27 @@ cpp)
 
 msvisualcpp)
   # Important note: in order to support this mode, a compiler *must*
-  # always write the preprocessed file to stdout, regardless of -o,
-  # because we must use -o when running libtool.
+  # always write the preprocessed file to stdout.
   "$@" || exit $?
+
+  # Remove the call to Libtool.
+  if test "$libtool" = yes; then
+    while test "X$1" != 'X--mode=compile'; do
+      shift
+    done
+    shift
+  fi
+
   IFS=" "
   for arg
   do
     case "$arg" in
+    -o)
+      shift
+      ;;
+    $object)
+      shift
+      ;;
     "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
 	set fnord "$@"
 	shift
@@ -552,16 +590,23 @@ msvisualcpp)
 	;;
     esac
   done
-  "$@" -E |
-  sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
+  "$@" -E 2>/dev/null |
+  sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
   rm -f "$depfile"
   echo "$object : \\" > "$depfile"
-  . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::	\1 \\:p' >> "$depfile"
+  sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::	\1 \\:p' >> "$depfile"
   echo "	" >> "$depfile"
-  . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
+  sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
   rm -f "$tmpdepfile"
   ;;
 
+msvcmsys)
+  # This case exists only to let depend.m4 do its work.  It works by
+  # looking at the text of this script.  This case will never be run,
+  # since it is checked for above.
+  exit 1
+  ;;
+
 none)
   exec "$@"
   ;;
@@ -580,5 +625,6 @@ exit 0
 # eval: (add-hook 'write-file-hooks 'time-stamp)
 # time-stamp-start: "scriptversion="
 # time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-end: "$"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
 # End:
diff --git a/docs/Makefile.in b/docs/Makefile.in
index a803ed9..b04d7af 100644
--- a/docs/Makefile.in
+++ b/docs/Makefile.in
@@ -348,9 +348,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign docs/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu docs/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign docs/Makefile
+	  $(AUTOMAKE) --gnu docs/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
diff --git a/docs/api-style.css b/docs/deploy/api-style.css
similarity index 100%
copy from docs/api-style.css
copy to docs/deploy/api-style.css
diff --git a/docs/deploy/mono-api-assembly.html b/docs/deploy/mono-api-assembly.html
new file mode 100644
index 0000000..78d66f4
--- /dev/null
+++ b/docs/deploy/mono-api-assembly.html
@@ -0,0 +1,337 @@
+<?xml version="1.0" encoding="utf-8"?><span>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+   <title>mono-api-assembly.html</title>
+   <style type="text/css">
+
+
+   h3 { 
+       font-size: 18px;
+       padding-bottom: 4pt;
+       border-bottom: 2px solid #dddddd;
+   }
+       
+   .api {
+     border: 1px solid;
+     padding: 10pt;
+     margin: 10pt;
+   } 
+
+   .api-entry { 
+       border-bottom: none;
+       font-size: 18px;
+   }
+
+   .prototype {
+     border: 1px solid;
+     background-color: #f2f2f2;
+     padding: 5pt;
+     margin-top: 5pt;
+     margin-bottom: 5pt;  
+   } 
+
+   .header {
+     border: 1px solid;
+     padding: 0 0 5pt 5pt;
+     margin: 10pt;
+     white-space: pre;
+       font-family: monospace;
+   }
+    
+   .code {
+     border: 1px solid;
+     padding: 0 0 5pt 5pt;
+     margin: 10pt;
+     white-space: pre;
+       font-family: monospace;
+   }
+   
+
+</style>
+</head>
+<body>
+<h2>Assemblies</h2>
+
+<h3>Synopsis</h3>
+
+	<div class="header">
+#include <metadata/assembly.h>
+
+typedef struct _MonoImage MonoImage;
+typedef struct _MonoAssembly MonoAssembly;
+
+MonoAssembly*          <a href="#api:mono_assembly_open">mono_assembly_open</a>           (const char *filename, 
+                                                     MonoImageOpenStatus *status);
+void                   <a href="#api:mono_assembly_close">mono_assembly_close</a>          (MonoAssembly *assembly);
+MonoAssembly*          <a href="#api:mono_assembly_load">mono_assembly_load</a>           (MonoAssemblyName *aname, 
+                                                     const char *basedir, 
+                                                     MonoImageOpenStatus *status);
+MonoAssembly*          <a href="#api:mono_assembly_load_full">mono_assembly_load_full</a>      (MonoAssemblyName *aname, 
+                                                     const char *basedir, 
+                                                     MonoImageOpenStatus *status, 
+                                                     gboolean refonly);
+MonoAssembly*          <a href="#api:mono_assembly_loaded">mono_assembly_loaded</a>         (MonoAssemblyName *aname);
+                       <a href="#api:mono_assembly_get_object"></a>                             
+MonoImage*             <a href="#api:mono_assembly_get_image">mono_assembly_get_image</a>      (MonoAssembly *assembly);
+MonoAssembly*          <a href="#api:mono_assembly_get_main">mono_assembly_get_main</a>       (void);
+G_CONST_RETURN gchar * <a href="#api:mono_assembly_getrootdir">mono_assembly_getrootdir</a>     (void);
+void                   <a href="#api:mono_assembly_name_free">mono_assembly_name_free</a>      (MonoAssemblyName *aname);
+char*                  <a href="#api:mono_stringify_assembly_name">mono_stringify_assembly_name</a> (MonoAssemblyName *aname);
+gboolean               <a href="#api:mono_assembly_names_equal">mono_assembly_names_equal</a>    (MonoAssemblyName *l, 
+                                                     MonoAssemblyName *r);
+                       <a href="#api:mono_module_file_get_object"></a>                             
+                       <a href="#api:mono_module_get_object"></a>                             
+
+	
+	</div>
+
+<a name="cil_assembly_load"></a>
+<h3>Assembly Loading</h3>
+
+ <a name="api:mono_assembly_open"></a>
+ <div class="api">
+    <div class="api-entry">mono_assembly_open</div>
+
+    <div class="prototype">MonoAssembly*
+mono_assembly_open (const char *filename, MonoImageOpenStatus *status)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>filename:</i></dt><dd> Opens the assembly pointed out by this name</dd><dt><i>status:</i></dt><dd> where a status code can be returned</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  a pointer to the MonoAssembly if <i>filename</i> contains a valid
+
+	 assembly or NULL on error.  Details about the error are stored in the
+	 <i>status</i> variable.</blockquote>
+<b>Remarks</b>
+<p />	 
+	 mono_assembly_open opens the PE-image pointed by <i>filename</i>, and
+	 loads any external assemblies referenced by it.
+	
+
+</div> <a name="api:mono_assembly_close"></a>
+ <div class="api">
+    <div class="api-entry">mono_assembly_close</div>
+
+    <div class="prototype">void
+mono_assembly_close (MonoAssembly *assembly)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>assembly:</i></dt><dd> the assembly to release.</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 This method releases a reference to the <i>assembly</i>.  The assembly is
+	 only released when all the outstanding references to it are released.
+
+</div> <a name="api:mono_assembly_load"></a>
+ <div class="api">
+    <div class="api-entry">mono_assembly_load</div>
+
+    <div class="prototype">MonoAssembly*
+mono_assembly_load (MonoAssemblyName *aname, const char *basedir, MonoImageOpenStatus *status)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>aname:</i></dt><dd> A MonoAssemblyName with the assembly name to load.</dd><dt><i>basedir:</i></dt><dd> A directory to look up the assembly at.</dd><dt><i>status:</i></dt><dd> a pointer to a MonoImageOpenStatus to return the status of the load operation</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  the assembly referenced by <i>aname</i> loaded or NULL on error.   On error the
+
+	 value pointed by status is updated with an error code.</blockquote>
+<b>Remarks</b>
+<p />	 
+	 Loads the assembly referenced by <i>aname</i>, if the value of <i>basedir</i> is not NULL, it
+	 attempts to load the assembly from that directory before probing the standard locations.
+	
+
+</div> <a name="api:mono_assembly_load_full"></a>
+ <div class="api">
+    <div class="api-entry">mono_assembly_load_full</div>
+
+    <div class="prototype">MonoAssembly*
+mono_assembly_load_full (MonoAssemblyName *aname, const char *basedir, MonoImageOpenStatus *status, gboolean refonly)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>aname:</i></dt><dd> A MonoAssemblyName with the assembly name to load.</dd><dt><i>basedir:</i></dt><dd> A directory to look up the assembly at.</dd><dt><i>status:</i></dt><dd> a pointer to a MonoImageOpenStatus to return the status of the load operation</dd><dt><i>refonly:</i></dt><dd> Whether this assembly is being opened in "reflection-only" mode.</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  the assembly referenced by <i>aname</i> loaded or NULL on error.   On error the
+
+	 value pointed by status is updated with an error code.</blockquote>
+<b>Remarks</b>
+<p />	 
+	 Loads the assembly referenced by <i>aname</i>, if the value of <i>basedir</i> is not NULL, it
+	 attempts to load the assembly from that directory before probing the standard locations.
+	
+	 If the assembly is being opened in reflection-only mode (<i>refonly</i> set to TRUE) then no 
+	 assembly binding takes place.
+	
+
+</div> <a name="api:mono_assembly_loaded"></a>
+ <div class="api">
+    <div class="api-entry">mono_assembly_loaded</div>
+
+    <div class="prototype">MonoAssembly*
+mono_assembly_loaded (MonoAssemblyName *aname)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>aname:</i></dt><dd> an assembly to look for.</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  NULL If the given <i>aname</i> assembly has not been loaded, or a pointer to
+
+	 a MonoAssembly that matches the MonoAssemblyName specified.</blockquote>
+
+</div> <a name="api:mono_assembly_get_object"></a>
+ <div class="api">
+    <div class="api-entry">mono_assembly_get_object</div>
+
+    <div class="prototype">Prototype: mono_assembly_get_object</div>
+<p />
+
+
+</div><h3>Working with Assemblies</h3>
+
+ <a name="api:mono_assembly_get_image"></a>
+ <div class="api">
+    <div class="api-entry">mono_assembly_get_image</div>
+
+    <div class="prototype">MonoImage*
+mono_assembly_get_image (MonoAssembly *assembly)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>assembly:</i></dt><dd> The assembly to retrieve the image from</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  the MonoImage associated with this assembly.
+</blockquote>
+
+</div> <a name="api:mono_assembly_get_main"></a>
+ <div class="api">
+    <div class="api-entry">mono_assembly_get_main</div>
+
+    <div class="prototype">MonoAssembly*
+mono_assembly_get_main (void)
+
+</div>
+<p />
+<b>Returns</b>
+<blockquote>	  the assembly for the application, the first assembly that is loaded by the VM
+</blockquote>
+
+</div> <a name="api:mono_assembly_getrootdir"></a>
+ <div class="api">
+    <div class="api-entry">mono_assembly_getrootdir</div>
+
+    <div class="prototype">G_CONST_RETURN gchar *
+mono_assembly_getrootdir (void)
+
+</div>
+<p />
+<b>Returns</b>
+<blockquote>	  a string with the directory, this string should not be freed.
+</blockquote>
+<b>Remarks</b>
+<p />	 <p />
+
+	 Obtains the root directory used for looking up assemblies.
+	
+
+
+</div><h3>Assembly Names</h3>
+
+	<p />The MonoAssemblyName contains the full identity of an
+	assembly (name, culture, public key, public key token,
+	version and any other flags).
+
+	<p />These unmanaged objects represent the <a href="http://www.mono-project.com/monodoc/T:System.Reflection.AssemblyName">System.Reflection.AssemblyName</a>
+	managed type.
+
+ <a name="api:mono_assembly_name_free"></a>
+ <div class="api">
+    <div class="api-entry">mono_assembly_name_free</div>
+
+    <div class="prototype">void
+mono_assembly_name_free (MonoAssemblyName *aname)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>aname:</i></dt><dd> assembly name to free</dd></blockquote>
+<b>Remarks</b>
+<p />	 <p />
+
+	 Frees the provided assembly name object.
+	 (it does not frees the object itself, only the name members).
+
+</div> <a name="api:mono_stringify_assembly_name"></a>
+ <div class="api">
+    <div class="api-entry">mono_stringify_assembly_name</div>
+
+    <div class="prototype">char*
+mono_stringify_assembly_name (MonoAssemblyName *aname)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>aname:</i></dt><dd> the assembly name.</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  a newly allocated string with a string representation of
+
+	 the assembly name.</blockquote>
+<b>Remarks</b>
+<p />	 
+	 Convert <i>aname</i> into its string format. The returned string is dynamically
+	 allocated and should be freed by the caller.
+	
+
+</div> <a name="api:mono_assembly_names_equal"></a>
+ <div class="api">
+    <div class="api-entry">mono_assembly_names_equal</div>
+
+    <div class="prototype">gboolean
+mono_assembly_names_equal (MonoAssemblyName *l, MonoAssemblyName *r)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>l:</i></dt><dd> first assembly</dd><dt><i>r:</i></dt><dd> second assembly.</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  TRUE if both assembly names are equal.
+</blockquote>
+<b>Remarks</b>
+<p />	 
+	 Compares two MonoAssemblyNames and returns whether they are equal.
+	
+	 This compares the names, the cultures, the release version and their
+	 public tokens.
+	
+
+
+</div><h3>Modules</h3>
+
+	<p />An assembly is made up of one or more modules.
+
+ <a name="api:mono_module_file_get_object"></a>
+ <div class="api">
+    <div class="api-entry">mono_module_file_get_object</div>
+
+    <div class="prototype">Prototype: mono_module_file_get_object</div>
+<p />
+
+</div> <a name="api:mono_module_get_object"></a>
+ <div class="api">
+    <div class="api-entry">mono_module_get_object</div>
+
+    <div class="prototype">Prototype: mono_module_get_object</div>
+<p />
+
+</div></body>
+</html>
+</span>
\ No newline at end of file
diff --git a/docs/deploy/mono-api-class.html b/docs/deploy/mono-api-class.html
new file mode 100644
index 0000000..bd3d0f8
--- /dev/null
+++ b/docs/deploy/mono-api-class.html
@@ -0,0 +1,797 @@
+<?xml version="1.0" encoding="utf-8"?><span>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+   <title>mono-api-class.html</title>
+   <style type="text/css">
+
+
+   h3 { 
+       font-size: 18px;
+       padding-bottom: 4pt;
+       border-bottom: 2px solid #dddddd;
+   }
+       
+   .api {
+     border: 1px solid;
+     padding: 10pt;
+     margin: 10pt;
+   } 
+
+   .api-entry { 
+       border-bottom: none;
+       font-size: 18px;
+   }
+
+   .prototype {
+     border: 1px solid;
+     background-color: #f2f2f2;
+     padding: 5pt;
+     margin-top: 5pt;
+     margin-bottom: 5pt;  
+   } 
+
+   .header {
+     border: 1px solid;
+     padding: 0 0 5pt 5pt;
+     margin: 10pt;
+     white-space: pre;
+       font-family: monospace;
+   }
+    
+   .code {
+     border: 1px solid;
+     padding: 0 0 5pt 5pt;
+     margin: 10pt;
+     white-space: pre;
+       font-family: monospace;
+   }
+   
+
+</style>
+</head>
+<body>
+<h2>Class Operations</h2>
+
+ <a name="api:mono_class_array_element_size"></a>
+ <div class="api">
+    <div class="api-entry">mono_class_array_element_size</div>
+
+    <div class="prototype">gint32
+mono_class_array_element_size (MonoClass *klass)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>klass:</i></dt><dd> </dd></blockquote>
+<b>Returns</b>
+<blockquote>	  the number of bytes an element of type <i>klass</i>
+
+	 uses when stored into an array.</blockquote>
+
+</div> <a name="api:mono_class_data_size"></a>
+ <div class="api">
+    <div class="api-entry">mono_class_data_size</div>
+
+    <div class="prototype">gint32
+mono_class_data_size (MonoClass *klass)
+	
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>klass:</i></dt><dd> a class </dd></blockquote>
+<b>Returns</b>
+<blockquote>	  the size of the static class data
+</blockquote>
+<b>Remarks</b>
+<p />	 <p />
+
+
+</div> <a name="api:mono_class_enum_basetype"></a>
+ <div class="api">
+    <div class="api-entry">mono_class_enum_basetype</div>
+
+    <div class="prototype">MonoType*
+mono_class_enum_basetype (MonoClass *klass)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>klass:</i></dt><dd> the MonoClass to act on</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  the underlying type representation for an enumeration.
+</blockquote>
+
+</div> <a name="api:mono_class_from_generic_parameter"></a>
+ <div class="api">
+    <div class="api-entry">mono_class_from_generic_parameter</div>
+
+    <div class="prototype">Prototype: mono_class_from_generic_parameter</div>
+<p />
+
+</div> <a name="api:mono_class_from_mono_type"></a>
+ <div class="api">
+    <div class="api-entry">mono_class_from_mono_type</div>
+
+    <div class="prototype">Prototype: mono_class_from_mono_type</div>
+<p />
+
+</div> <a name="api:mono_class_from_name_case"></a>
+ <div class="api">
+    <div class="api-entry">mono_class_from_name_case</div>
+
+    <div class="prototype">MonoClass*
+mono_class_from_name_case (MonoImage *image, const char* name_space, const char *name)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>image:</i></dt><dd> The MonoImage where the type is looked up in</dd><dt><i>name_space:</i></dt><dd> the type namespace</dd><dt><i>name:</i></dt><dd> the type short name.</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 Obtains a MonoClass with a given namespace and a given name which
+	 is located in the given MonoImage.   The namespace and name
+	 lookups are case insensitive.
+
+</div> <a name="api:mono_class_from_name"></a>
+ <div class="api">
+    <div class="api-entry">mono_class_from_name</div>
+
+    <div class="prototype">MonoClass*
+mono_class_from_name (MonoImage *image, const char* name_space, const char *name)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>image:</i></dt><dd> The MonoImage where the type is looked up in</dd><dt><i>name_space:</i></dt><dd> the type namespace</dd><dt><i>name:</i></dt><dd> the type short name.</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 Obtains a MonoClass with a given namespace and a given name which
+	 is located in the given MonoImage.   
+
+</div> <a name="api:mono_class_from_typeref"></a>
+ <div class="api">
+    <div class="api-entry">mono_class_from_typeref</div>
+
+    <div class="prototype">Prototype: mono_class_from_typeref</div>
+<p />
+
+</div> <a name="api:mono_class_get_byref_type"></a>
+ <div class="api">
+    <div class="api-entry">mono_class_get_byref_type</div>
+
+    <div class="prototype">MonoType*
+mono_class_get_byref_type (MonoClass *klass)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>klass:</i></dt><dd> the MonoClass to act on</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	
+<p />
+
+</div> <a name="api:mono_class_get_element_class"></a>
+ <div class="api">
+    <div class="api-entry">mono_class_get_element_class</div>
+
+    <div class="prototype">MonoClass*
+mono_class_get_element_class (MonoClass *klass)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>klass:</i></dt><dd> the MonoClass to act on</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  the element class of an array or an enumeration.
+</blockquote>
+
+</div> <a name="api:mono_class_get_events"></a>
+ <div class="api">
+    <div class="api-entry">mono_class_get_events</div>
+
+    <div class="prototype">MonoEvent*
+mono_class_get_events (MonoClass* klass, gpointer *iter)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>klass:</i></dt><dd> the MonoClass to act on</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  a <i>MonoEvent</i>* on each invocation, or NULL when no more are available.
+</blockquote>
+<b>Remarks</b>
+<p />	 
+	 This routine is an iterator routine for retrieving the properties in a class.
+	
+	 You must pass a gpointer that points to zero and is treated as an opaque handle to
+	 iterate over all of the elements.  When no more values are
+	 available, the return value is NULL.
+	
+
+</div> <a name="api:mono_class_get_event_token"></a>
+ <div class="api">
+    <div class="api-entry">mono_class_get_event_token</div>
+
+    <div class="prototype">Prototype: mono_class_get_event_token</div>
+<p />
+
+</div> <a name="api:mono_class_get_field_from_name"></a>
+ <div class="api">
+    <div class="api-entry">mono_class_get_field_from_name</div>
+
+    <div class="prototype">MonoClassField*
+mono_class_get_field_from_name (MonoClass *klass, const char *name)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>klass:</i></dt><dd> the class to lookup the field.</dd><dt><i>name:</i></dt><dd> the field name</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  the MonoClassField pointer of the named field or NULL
+</blockquote>
+<b>Remarks</b>
+<p />	 
+	 Search the class <i>klass</i> and it's parents for a field with the name <i>name</i>.
+	
+<p />
+
+</div> <a name="api:mono_class_get_field"></a>
+ <div class="api">
+    <div class="api-entry">mono_class_get_field</div>
+
+    <div class="prototype">MonoClassField*
+mono_class_get_field (MonoClass *class, guint32 field_token)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>class:</i></dt><dd> the class to lookup the field.</dd><dt><i>field_token:</i></dt><dd> the field token</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  A MonoClassField representing the type and offset of
+
+	 the field, or a NULL value if the field does not belong to this
+	 class.</blockquote>
+
+</div> <a name="api:mono_class_get_fields"></a>
+ <div class="api">
+    <div class="api-entry">mono_class_get_fields</div>
+
+    <div class="prototype">MonoClassField*
+mono_class_get_fields (MonoClass* klass, gpointer *iter)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>klass:</i></dt><dd> the MonoClass to act on</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  a <i>MonoClassField</i>* on each iteration, or NULL when no more fields are available.
+</blockquote>
+<b>Remarks</b>
+<p />	 
+	 This routine is an iterator routine for retrieving the fields in a class.
+	
+	 You must pass a gpointer that points to zero and is treated as an opaque handle to
+	 iterate over all of the elements.  When no more values are
+	 available, the return value is NULL.
+	
+
+</div> <a name="api:mono_class_get_field_token"></a>
+ <div class="api">
+    <div class="api-entry">mono_class_get_field_token</div>
+
+    <div class="prototype">guint32
+mono_class_get_field_token (MonoClassField *field)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>field:</i></dt><dd> the field we need the token of</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  the token representing the field in the image it was loaded from.
+</blockquote>
+<b>Remarks</b>
+<p />	 
+	 Get the token of a field. Note that the tokesn is only valid for the image
+	 the field was loaded from. Don't use this function for fields in dynamic types.
+	
+<p />
+
+</div> <a name="api:mono_class_get_flags"></a>
+ <div class="api">
+    <div class="api-entry">mono_class_get_flags</div>
+
+    <div class="prototype">guint32
+mono_class_get_flags (MonoClass *klass)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>klass:</i></dt><dd> the MonoClass to act on</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  the flags from the TypeDef table.
+</blockquote>
+<b>Remarks</b>
+<p />	 
+	 The type flags from the TypeDef table from the metadata.
+	 see the TYPE_ATTRIBUTE_* definitions on tabledefs.h for the
+	 different values.
+	
+
+</div> <a name="api:mono_class_get_full"></a>
+ <div class="api">
+    <div class="api-entry">mono_class_get_full</div>
+
+    <div class="prototype">MonoClass*
+mono_class_get_full (MonoImage *image, guint32 type_token, MonoGenericContext *context)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>image:</i></dt><dd> the image where the class resides</dd><dt><i>type_token:</i></dt><dd> the token for the class</dd><dt><i>context:</i></dt><dd> the generic context used to evaluate generic instantiations in</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  the MonoClass that represents <i>type_token</i> in <i>image</i>
+</blockquote>
+
+</div> <a name="api:mono_class_get_image"></a>
+ <div class="api">
+    <div class="api-entry">mono_class_get_image</div>
+
+    <div class="prototype">Prototype: mono_class_get_image</div>
+<p />
+
+</div> <a name="api:mono_class_get_interfaces"></a>
+ <div class="api">
+    <div class="api-entry">mono_class_get_interfaces</div>
+
+    <div class="prototype">MonoClass*
+mono_class_get_interfaces (MonoClass* klass, gpointer *iter)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>klass:</i></dt><dd> the MonoClass to act on</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  a <i>Monoclass</i>* on each invocation, or NULL when no more are available.
+</blockquote>
+<b>Remarks</b>
+<p />	 
+	 This routine is an iterator routine for retrieving the interfaces implemented by this class.
+	
+	 You must pass a gpointer that points to zero and is treated as an opaque handle to
+	 iterate over all of the elements.  When no more values are
+	 available, the return value is NULL.
+	
+
+</div> <a name="api:mono_class_get_method_from_name"></a>
+ <div class="api">
+    <div class="api-entry">mono_class_get_method_from_name</div>
+
+    <div class="prototype">MonoMethod*
+mono_class_get_method_from_name (MonoClass *klass, const char *name, int param_count)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>klass:</i></dt><dd> where to look for the method</dd><dt><i>name_space:</i></dt><dd> name of the method</dd><dt><i>param_count:</i></dt><dd> number of parameters. -1 for any number.</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 Obtains a MonoMethod with a given name and number of parameters.
+	 It only works if there are no multiple signatures for any given method name.
+
+</div> <a name="api:mono_class_get_methods"></a>
+ <div class="api">
+    <div class="api-entry">mono_class_get_methods</div>
+
+    <div class="prototype">MonoMethod*
+mono_class_get_methods (MonoClass* klass, gpointer *iter)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>klass:</i></dt><dd> the MonoClass to act on</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  a MonoMethod on each iteration or NULL when no more methods are available.
+</blockquote>
+<b>Remarks</b>
+<p />	 
+	 This routine is an iterator routine for retrieving the fields in a class.
+	
+	 You must pass a gpointer that points to zero and is treated as an opaque handle to
+	 iterate over all of the elements.  When no more values are
+	 available, the return value is NULL.
+	
+
+</div> <a name="api:mono_class_get"></a>
+ <div class="api">
+    <div class="api-entry">mono_class_get</div>
+
+    <div class="prototype">Prototype: mono_class_get</div>
+<p />
+
+</div> <a name="api:mono_class_get_name"></a>
+ <div class="api">
+    <div class="api-entry">mono_class_get_name</div>
+
+    <div class="prototype">const char*
+mono_class_get_name (MonoClass *klass)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>klass:</i></dt><dd> the MonoClass to act on</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  the name of the class.
+</blockquote>
+
+</div> <a name="api:mono_class_get_namespace"></a>
+ <div class="api">
+    <div class="api-entry">mono_class_get_namespace</div>
+
+    <div class="prototype">const char*
+mono_class_get_namespace (MonoClass *klass)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>klass:</i></dt><dd> the MonoClass to act on</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  the namespace of the class.
+</blockquote>
+
+</div> <a name="api:mono_class_get_nested_types"></a>
+ <div class="api">
+    <div class="api-entry">mono_class_get_nested_types</div>
+
+    <div class="prototype">MonoClass*
+mono_class_get_nested_types (MonoClass* klass, gpointer *iter)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>klass:</i></dt><dd> the MonoClass to act on</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  a <i>Monoclass</i>* on each invocation, or NULL when no more are available.
+</blockquote>
+<b>Remarks</b>
+<p />	 
+	 This routine is an iterator routine for retrieving the nested types of a class.
+	 This works only if <i>klass</i> is non-generic, or a generic type definition.
+	
+	 You must pass a gpointer that points to zero and is treated as an opaque handle to
+	 iterate over all of the elements.  When no more values are
+	 available, the return value is NULL.
+	
+
+</div> <a name="api:mono_class_get_nesting_type"></a>
+ <div class="api">
+    <div class="api-entry">mono_class_get_nesting_type</div>
+
+    <div class="prototype">Prototype: mono_class_get_nesting_type</div>
+<p />
+
+</div> <a name="api:mono_class_get_parent"></a>
+ <div class="api">
+    <div class="api-entry">mono_class_get_parent</div>
+
+    <div class="prototype">MonoClass*
+mono_class_get_parent (MonoClass *klass)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>klass:</i></dt><dd> the MonoClass to act on</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  the parent class for this class.
+</blockquote>
+
+</div> <a name="api:mono_class_get_properties"></a>
+ <div class="api">
+    <div class="api-entry">mono_class_get_properties</div>
+
+    <div class="prototype">MonoProperty*
+mono_class_get_properties (MonoClass* klass, gpointer *iter)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>klass:</i></dt><dd> the MonoClass to act on</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  a <i>MonoProperty</i>* on each invocation, or NULL when no more are available.
+</blockquote>
+<b>Remarks</b>
+<p />	 
+	 This routine is an iterator routine for retrieving the properties in a class.
+	
+	 You must pass a gpointer that points to zero and is treated as an opaque handle to
+	 iterate over all of the elements.  When no more values are
+	 available, the return value is NULL.
+	
+
+</div> <a name="api:mono_class_get_property_from_name"></a>
+ <div class="api">
+    <div class="api-entry">mono_class_get_property_from_name</div>
+
+    <div class="prototype">Prototype: mono_class_get_property_from_name</div>
+<p />
+
+</div> <a name="api:mono_class_get_property_token"></a>
+ <div class="api">
+    <div class="api-entry">mono_class_get_property_token</div>
+
+    <div class="prototype">Prototype: mono_class_get_property_token</div>
+<p />
+
+</div> <a name="api:mono_class_get_rank"></a>
+ <div class="api">
+    <div class="api-entry">mono_class_get_rank</div>
+
+    <div class="prototype">int
+mono_class_get_rank (MonoClass *klass)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>klass:</i></dt><dd> the MonoClass to act on</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  the rank for the array (the number of dimensions).
+</blockquote>
+
+</div> <a name="api:mono_class_get_type"></a>
+ <div class="api">
+    <div class="api-entry">mono_class_get_type</div>
+
+    <div class="prototype">MonoType*
+mono_class_get_type (MonoClass *klass)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>klass:</i></dt><dd> the MonoClass to act on</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  the MonoType from the class.
+</blockquote>
+<b>Remarks</b>
+<p />	 
+	 This method returns the internal Type representation for the class.
+	
+
+</div> <a name="api:mono_class_inflate_generic_method"></a>
+ <div class="api">
+    <div class="api-entry">mono_class_inflate_generic_method</div>
+
+    <div class="prototype">Prototype: mono_class_inflate_generic_method</div>
+<p />
+
+</div> <a name="api:mono_class_inflate_generic_type"></a>
+ <div class="api">
+    <div class="api-entry">mono_class_inflate_generic_type</div>
+
+    <div class="prototype">Prototype: mono_class_inflate_generic_type</div>
+<p />
+
+</div> <a name="api:mono_class_init"></a>
+ <div class="api">
+    <div class="api-entry">mono_class_init</div>
+
+    <div class="prototype">gboolean
+mono_class_init (MonoClass *class)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>class:</i></dt><dd> the class to initialize</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	   Compute the instance_size, class_size and other infos that cannot be 
+	 computed at mono_class_get() time. Also compute vtable_size if possible. 
+	 Returns TRUE on success or FALSE if there was a problem in loading
+	 the type (incorrect assemblies, missing assemblies, methods, etc). 
+	
+	 LOCKING: Acquires the loader lock.
+
+</div> <a name="api:mono_class_instance_size"></a>
+ <div class="api">
+    <div class="api-entry">mono_class_instance_size</div>
+
+    <div class="prototype">gint32
+mono_class_instance_size (MonoClass *klass)
+	
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>klass:</i></dt><dd> a class </dd></blockquote>
+<b>Returns</b>
+<blockquote>	  the size of an object instance
+</blockquote>
+<b>Remarks</b>
+<p />	 <p />
+
+
+</div> <a name="api:mono_class_is_assignable_from"></a>
+ <div class="api">
+    <div class="api-entry">mono_class_is_assignable_from</div>
+
+    <div class="prototype">gboolean
+mono_class_is_assignable_from (MonoClass *klass, MonoClass *oklass)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>klass:</i></dt><dd> the class to be assigned to</dd><dt><i>oklass:</i></dt><dd> the source class</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  true if an instance of object oklass can be assigned to an
+
+	 instance of object <i>klass</i></blockquote>
+
+</div> <a name="api:mono_class_is_enum"></a>
+ <div class="api">
+    <div class="api-entry">mono_class_is_enum</div>
+
+    <div class="prototype">gboolean
+mono_class_is_enum (MonoClass *klass)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>klass:</i></dt><dd> the MonoClass to act on</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  true if the MonoClass represents an enumeration.
+</blockquote>
+
+</div> <a name="api:mono_class_is_subclass_of"></a>
+ <div class="api">
+    <div class="api-entry">mono_class_is_subclass_of</div>
+
+    <div class="prototype">Prototype: mono_class_is_subclass_of</div>
+<p />
+
+</div> <a name="api:mono_class_is_valuetype"></a>
+ <div class="api">
+    <div class="api-entry">mono_class_is_valuetype</div>
+
+    <div class="prototype">gboolean
+mono_class_is_valuetype (MonoClass *klass)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>klass:</i></dt><dd> the MonoClass to act on</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  true if the MonoClass represents a ValueType.
+</blockquote>
+
+</div> <a name="api:mono_class_min_align"></a>
+ <div class="api">
+    <div class="api-entry">mono_class_min_align</div>
+
+    <div class="prototype">gint32
+mono_class_min_align (MonoClass *klass)
+	
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>klass:</i></dt><dd> a class </dd></blockquote>
+<b>Returns</b>
+<blockquote>	  minimm alignment requirements 
+</blockquote>
+<b>Remarks</b>
+<p />	 <p />
+
+
+</div> <a name="api:mono_class_num_events"></a>
+ <div class="api">
+    <div class="api-entry">mono_class_num_events</div>
+
+    <div class="prototype">int
+mono_class_num_events (MonoClass *klass)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>klass:</i></dt><dd> the MonoClass to act on</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  the number of events in the class.
+</blockquote>
+
+</div> <a name="api:mono_class_num_fields"></a>
+ <div class="api">
+    <div class="api-entry">mono_class_num_fields</div>
+
+    <div class="prototype">int
+mono_class_num_fields (MonoClass *klass)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>klass:</i></dt><dd> the MonoClass to act on</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  the number of static and instance fields in the class.
+</blockquote>
+
+</div> <a name="api:mono_class_num_methods"></a>
+ <div class="api">
+    <div class="api-entry">mono_class_num_methods</div>
+
+    <div class="prototype">int
+mono_class_num_methods (MonoClass *klass)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>klass:</i></dt><dd> the MonoClass to act on</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  the number of methods in the class.
+</blockquote>
+
+</div> <a name="api:mono_class_num_properties"></a>
+ <div class="api">
+    <div class="api-entry">mono_class_num_properties</div>
+
+    <div class="prototype">int
+mono_class_num_properties (MonoClass *klass)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>klass:</i></dt><dd> the MonoClass to act on</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  the number of properties in the class.
+</blockquote>
+
+</div> <a name="api:mono_class_value_size"></a>
+ <div class="api">
+    <div class="api-entry">mono_class_value_size</div>
+
+    <div class="prototype">gint32
+mono_class_value_size      (MonoClass *klass, guint32 *align)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>klass:</i></dt><dd> a class </dd></blockquote>
+<b>Returns</b>
+<blockquote>	  the size of a value of kind <i>klass</i>
+</blockquote>
+<b>Remarks</b>
+<p />	 
+	 This function is used for value types, and return the
+	 space and the alignment to store that kind of value object.
+	
+
+</div> <a name="api:mono_class_vtable"></a>
+ <div class="api">
+    <div class="api-entry">mono_class_vtable</div>
+
+    <div class="prototype">MonoVTable*
+mono_class_vtable (MonoDomain *domain, MonoClass *class)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>domain:</i></dt><dd> the application domain</dd><dt><i>class:</i></dt><dd> the class to initialize</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 VTables are domain specific because we create domain specific code, and 
+	 they contain the domain specific static class data.
+	 On failure, NULL is returned, and class->exception_type is set.
+
+</div> <a name="api:mono_class_get_method_from_name_flags"></a>
+ <div class="api">
+    <div class="api-entry">mono_class_get_method_from_name_flags</div>
+
+    <div class="prototype">MonoMethod*
+mono_class_get_method_from_name_flags (MonoClass *klass, const char *name, int param_count, int flags)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>klass:</i></dt><dd> where to look for the method</dd><dt><i>name_space:</i></dt><dd> name of the method</dd><dt><i>param_count:</i></dt><dd> number of parameters. -1 for any number.</dd><dt><i>flags:</i></dt><dd> flags which must be set in the method</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 Obtains a MonoMethod with a given name and number of parameters.
+	 It only works if there are no multiple signatures for any given method name.
+
+</div></body>
+</html>
+</span>
\ No newline at end of file
diff --git a/docs/deploy/mono-api-codegen.html b/docs/deploy/mono-api-codegen.html
new file mode 100644
index 0000000..ef2db8f
--- /dev/null
+++ b/docs/deploy/mono-api-codegen.html
@@ -0,0 +1,162 @@
+<?xml version="1.0" encoding="utf-8"?><span>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+   <title>mono-api-codegen.html</title>
+   <style type="text/css">
+
+
+   h3 { 
+       font-size: 18px;
+       padding-bottom: 4pt;
+       border-bottom: 2px solid #dddddd;
+   }
+       
+   .api {
+     border: 1px solid;
+     padding: 10pt;
+     margin: 10pt;
+   } 
+
+   .api-entry { 
+       border-bottom: none;
+       font-size: 18px;
+   }
+
+   .prototype {
+     border: 1px solid;
+     background-color: #f2f2f2;
+     padding: 5pt;
+     margin-top: 5pt;
+     margin-bottom: 5pt;  
+   } 
+
+   .header {
+     border: 1px solid;
+     padding: 0 0 5pt 5pt;
+     margin: 10pt;
+     white-space: pre;
+       font-family: monospace;
+   }
+    
+   .code {
+     border: 1px solid;
+     padding: 0 0 5pt 5pt;
+     margin: 10pt;
+     white-space: pre;
+       font-family: monospace;
+   }
+   
+
+</style>
+</head>
+<body>
+<h3>Code manager</h3>
+
+ <a name="api:mono_code_manager_commit"></a>
+ <div class="api">
+    <div class="api-entry">mono_code_manager_commit</div>
+
+    <div class="prototype">void
+mono_code_manager_commit (MonoCodeManager *cman, void *data, int size, int newsize)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>cman:</i></dt><dd> a code manager</dd><dt><i>data:</i></dt><dd> the pointer returned by mono_code_manager_reserve ()</dd><dt><i>size:</i></dt><dd> the size requested in the call to mono_code_manager_reserve ()</dd><dt><i>newsize:</i></dt><dd> the new size to reserve</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 If we reserved too much room for a method and we didn't allocate
+	 already from the code manager, we can get back the excess allocation
+	 for later use in the code manager.
+
+</div> <a name="api:mono_code_manager_destroy"></a>
+ <div class="api">
+    <div class="api-entry">mono_code_manager_destroy</div>
+
+    <div class="prototype">void
+mono_code_manager_destroy (MonoCodeManager *cman)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>cman:</i></dt><dd> a code manager</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 Free all the memory associated with the code manager <i>cman</i>.
+
+</div> <a name="api:mono_code_manager_foreach"></a>
+ <div class="api">
+    <div class="api-entry">mono_code_manager_foreach</div>
+
+    <div class="prototype">void
+mono_code_manager_foreach (MonoCodeManager *cman, MonoCodeManagerFunc func, void *user_data)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>cman:</i></dt><dd> a code manager</dd><dt><i>func:</i></dt><dd> a callback function pointer</dd><dt><i>user_data:</i></dt><dd> additional data to pass to <i>func</i></dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 Invokes the callback <i>func</i> for each different chunk of memory allocated
+	 in the code manager <i>cman</i>.
+
+</div> <a name="api:mono_code_manager_invalidate"></a>
+ <div class="api">
+    <div class="api-entry">mono_code_manager_invalidate</div>
+
+    <div class="prototype">void             
+mono_code_manager_invalidate (MonoCodeManager *cman)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>cman:</i></dt><dd> a code manager</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 Fill all the memory with an invalid native code value
+	 so that any attempt to execute code allocated in the code
+	 manager <i>cman</i> will fail. This is used for debugging purposes.
+
+</div> <a name="api:mono_code_manager_new_dynamic"></a>
+ <div class="api">
+    <div class="api-entry">mono_code_manager_new_dynamic</div>
+
+    <div class="prototype">MonoCodeManager* 
+mono_code_manager_new_dynamic (void)
+
+</div>
+<p />
+<b>Returns</b>
+<blockquote>	  the new code manager
+</blockquote>
+<b>Remarks</b>
+<p />	 
+	 Creates a new code manager suitable for holding native code that can be
+	 used for single or small methods that need to be deallocated independently
+	 of other native code.
+	
+
+</div> <a name="api:mono_code_manager_new"></a>
+ <div class="api">
+    <div class="api-entry">mono_code_manager_new</div>
+
+    <div class="prototype">MonoCodeManager* 
+mono_code_manager_new (void)
+
+</div>
+<p />
+<b>Returns</b>
+<blockquote>	  the new code manager
+</blockquote>
+<b>Remarks</b>
+<p />	 
+	 Creates a new code manager. A code manager can be used to allocate memory
+	 suitable for storing native code that can be later executed.
+	 A code manager allocates memory from the operating system in large chunks
+	 (typically 64KB in size) so that many methods can be allocated inside them
+	 close together, improving cache locality.
+	
+
+</div></body>
+</html>
+</span>
\ No newline at end of file
diff --git a/docs/deploy/mono-api-counters.html b/docs/deploy/mono-api-counters.html
new file mode 100644
index 0000000..886c38a
--- /dev/null
+++ b/docs/deploy/mono-api-counters.html
@@ -0,0 +1,126 @@
+<?xml version="1.0" encoding="utf-8"?><span>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+   <title>mono-api-counters.html</title>
+   <style type="text/css">
+
+
+   h3 { 
+       font-size: 18px;
+       padding-bottom: 4pt;
+       border-bottom: 2px solid #dddddd;
+   }
+       
+   .api {
+     border: 1px solid;
+     padding: 10pt;
+     margin: 10pt;
+   } 
+
+   .api-entry { 
+       border-bottom: none;
+       font-size: 18px;
+   }
+
+   .prototype {
+     border: 1px solid;
+     background-color: #f2f2f2;
+     padding: 5pt;
+     margin-top: 5pt;
+     margin-bottom: 5pt;  
+   } 
+
+   .header {
+     border: 1px solid;
+     padding: 0 0 5pt 5pt;
+     margin: 10pt;
+     white-space: pre;
+       font-family: monospace;
+   }
+    
+   .code {
+     border: 1px solid;
+     padding: 0 0 5pt 5pt;
+     margin: 10pt;
+     white-space: pre;
+       font-family: monospace;
+   }
+   
+
+</style>
+</head>
+<body>
+<h2>Counters</h2>
+	
+	<p />Counters is a Mono API for flexible statistics collection
+	and is used to track different events inside the JIT.
+
+        <p />You would typically register an address with the
+        <tt>mono_counters_register</tt> routine and increment the
+        counters from your application as you go.   At the end of the
+        program you would call mono_counters_dump which will display
+        all the registered counters.
+
+	<p />If you need more complicated counter computation, a
+        function can be provided instead of an address.  In that case
+        the <tt>MONO_COUNTER_CALLBACK</tt> flag must be ored in the
+        type request. 
+
+	<p />The types that can be rendered are:
+		
+<pre>
+       MONO_COUNTER_INT
+       MONO_COUNTER_UINT
+       MONO_COUNTER_WORD
+       MONO_COUNTER_LONG
+       MONO_COUNTER_ULONG
+       MONO_COUNTER_DOUBLE
+       MONO_COUNTER_STRING
+</pre>
+	
+	<p />To organize the output, you register also a section where
+	the counter will be displayed, or one of the following values
+	when you register your counter:
+
+<pre>
+
+       MONO_COUNTER_JIT
+       MONO_COUNTER_GC
+       MONO_COUNTER_METADATA
+       MONO_COUNTER_GENERICS
+       MONO_COUNTER_SECURITY
+</pre>
+	
+ <a name="api:mono_counters_dump"></a>
+ <div class="api">
+    <div class="api-entry">mono_counters_dump</div>
+
+    <div class="prototype">void
+mono_counters_dump (int section_mask, FILE *outfile)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>section_mask:</i></dt><dd> The sections to dump counters for</dd><dt><i>outfile:</i></dt><dd> a FILE to dump the results to</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 Displays the counts of all the enabled counters registered. 
+
+</div> <a name="api:mono_counters_enable"></a>
+ <div class="api">
+    <div class="api-entry">mono_counters_enable</div>
+
+    <div class="prototype">void
+mono_counters_enable (int section_mask)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>section_mask:</i></dt><dd> a mask listing the sections that will be displayed</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 This is used to track which counters will be displayed.
+
+</div></body>
+</html>
+</span>
\ No newline at end of file
diff --git a/docs/deploy/mono-api-debug.html b/docs/deploy/mono-api-debug.html
new file mode 100644
index 0000000..78b31a3
--- /dev/null
+++ b/docs/deploy/mono-api-debug.html
@@ -0,0 +1,180 @@
+<?xml version="1.0" encoding="utf-8"?><span>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+   <title>mono-api-debug.html</title>
+   <style type="text/css">
+
+
+   h3 { 
+       font-size: 18px;
+       padding-bottom: 4pt;
+       border-bottom: 2px solid #dddddd;
+   }
+       
+   .api {
+     border: 1px solid;
+     padding: 10pt;
+     margin: 10pt;
+   } 
+
+   .api-entry { 
+       border-bottom: none;
+       font-size: 18px;
+   }
+
+   .prototype {
+     border: 1px solid;
+     background-color: #f2f2f2;
+     padding: 5pt;
+     margin-top: 5pt;
+     margin-bottom: 5pt;  
+   } 
+
+   .header {
+     border: 1px solid;
+     padding: 0 0 5pt 5pt;
+     margin: 10pt;
+     white-space: pre;
+       font-family: monospace;
+   }
+    
+   .code {
+     border: 1px solid;
+     padding: 0 0 5pt 5pt;
+     margin: 10pt;
+     white-space: pre;
+       font-family: monospace;
+   }
+   
+
+</style>
+</head>
+<body>
+ <a name="api:mono_debug_il_offset_from_address"></a>
+ <div class="api">
+    <div class="api-entry">mono_debug_il_offset_from_address</div>
+
+    <div class="prototype">gint32
+mono_debug_il_offset_from_address (MonoMethod *method, MonoDomain *domain, guint32 native_offset)
+
+</div>
+<p />
+<b>Remarks</b>
+<p />	 
+	   Compute the IL offset corresponding to NATIVE_OFFSET inside the native
+	 code of METHOD in DOMAIN.
+
+</div> <a name="api:mono_debug_add_method"></a>
+ <div class="api">
+    <div class="api-entry">mono_debug_add_method</div>
+
+    <div class="prototype">Prototype: mono_debug_add_method</div>
+<p />
+
+</div> <a name="api:mono_debug_close_mono_symbol_file"></a>
+ <div class="api">
+    <div class="api-entry">mono_debug_close_mono_symbol_file</div>
+
+    <div class="prototype">Prototype: mono_debug_close_mono_symbol_file</div>
+<p />
+
+</div> <a name="api:mono_debug_find_method"></a>
+ <div class="api">
+    <div class="api-entry">mono_debug_find_method</div>
+
+    <div class="prototype">Prototype: mono_debug_find_method</div>
+<p />
+
+</div> <a name="api:mono_debug_using_mono_debugger"></a>
+ <div class="api">
+    <div class="api-entry">mono_debug_using_mono_debugger</div>
+
+    <div class="prototype">Prototype: mono_debug_using_mono_debugger</div>
+<p />
+
+
+</div><h3>Mono Debugger Interface</h3>
+
+	<p />These are methods that are invoked by the debugger at
+	runtime.
+	
+ <a name="api:mono_debugger_breakpoint_callback"></a>
+ <div class="api">
+    <div class="api-entry">mono_debugger_breakpoint_callback</div>
+
+    <div class="prototype">Prototype: mono_debugger_breakpoint_callback</div>
+<p />
+
+</div> <a name="api:mono_debugger_check_runtime_version"></a>
+ <div class="api">
+    <div class="api-entry">mono_debugger_check_runtime_version</div>
+
+    <div class="prototype">Prototype: mono_debugger_check_runtime_version</div>
+<p />
+
+</div> <a name="api:mono_debugger_event"></a>
+ <div class="api">
+    <div class="api-entry">mono_debugger_event</div>
+
+    <div class="prototype">Prototype: mono_debugger_event</div>
+<p />
+
+</div> <a name="api:mono_debugger_handle_exception"></a>
+ <div class="api">
+    <div class="api-entry">mono_debugger_handle_exception</div>
+
+    <div class="prototype">Prototype: mono_debugger_handle_exception</div>
+<p />
+
+</div> <a name="api:mono_debugger_insert_breakpoint_full"></a>
+ <div class="api">
+    <div class="api-entry">mono_debugger_insert_breakpoint_full</div>
+
+    <div class="prototype">Prototype: mono_debugger_insert_breakpoint_full</div>
+<p />
+
+</div> <a name="api:mono_debugger_insert_breakpoint"></a>
+ <div class="api">
+    <div class="api-entry">mono_debugger_insert_breakpoint</div>
+
+    <div class="prototype">Prototype: mono_debugger_insert_breakpoint</div>
+<p />
+
+</div> <a name="api:mono_debugger_lock"></a>
+ <div class="api">
+    <div class="api-entry">mono_debugger_lock</div>
+
+    <div class="prototype">Prototype: mono_debugger_lock</div>
+<p />
+
+</div> <a name="api:mono_debugger_method_has_breakpoint"></a>
+ <div class="api">
+    <div class="api-entry">mono_debugger_method_has_breakpoint</div>
+
+    <div class="prototype">Prototype: mono_debugger_method_has_breakpoint</div>
+<p />
+
+</div> <a name="api:mono_debugger_remove_breakpoint"></a>
+ <div class="api">
+    <div class="api-entry">mono_debugger_remove_breakpoint</div>
+
+    <div class="prototype">Prototype: mono_debugger_remove_breakpoint</div>
+<p />
+
+</div> <a name="api:mono_debugger_runtime_invoke"></a>
+ <div class="api">
+    <div class="api-entry">mono_debugger_runtime_invoke</div>
+
+    <div class="prototype">Prototype: mono_debugger_runtime_invoke</div>
+<p />
+
+</div> <a name="api:mono_debugger_unlock"></a>
+ <div class="api">
+    <div class="api-entry">mono_debugger_unlock</div>
+
+    <div class="prototype">Prototype: mono_debugger_unlock</div>
+<p />
+
+</div></body>
+</html>
+</span>
\ No newline at end of file
diff --git a/docs/deploy/mono-api-domains.html b/docs/deploy/mono-api-domains.html
new file mode 100644
index 0000000..3966740
--- /dev/null
+++ b/docs/deploy/mono-api-domains.html
@@ -0,0 +1,307 @@
+<?xml version="1.0" encoding="utf-8"?><span>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+   <title>mono-api-domains.html</title>
+   <style type="text/css">
+
+
+   h3 { 
+       font-size: 18px;
+       padding-bottom: 4pt;
+       border-bottom: 2px solid #dddddd;
+   }
+       
+   .api {
+     border: 1px solid;
+     padding: 10pt;
+     margin: 10pt;
+   } 
+
+   .api-entry { 
+       border-bottom: none;
+       font-size: 18px;
+   }
+
+   .prototype {
+     border: 1px solid;
+     background-color: #f2f2f2;
+     padding: 5pt;
+     margin-top: 5pt;
+     margin-bottom: 5pt;  
+   } 
+
+   .header {
+     border: 1px solid;
+     padding: 0 0 5pt 5pt;
+     margin: 10pt;
+     white-space: pre;
+       font-family: monospace;
+   }
+    
+   .code {
+     border: 1px solid;
+     padding: 0 0 5pt 5pt;
+     margin: 10pt;
+     white-space: pre;
+       font-family: monospace;
+   }
+   
+
+</style>
+</head>
+<body>
+<h2>Application Domains</h2>
+
+<h3>Synopsis</h3>
+
+<div class="header">
+#include <metadata/appdomain.h>
+
+/* Managed AppDomain */
+typedef struct _MonoAppDomain MonoAppDomain;
+
+/* Unmanaged representation */
+typedef struct _MonoDomain MonoDomain;
+
+/* Represents System.Runtime.Remoting.Contexts.Context */
+typedef struct _MonoAppContext MonoAppContext
+MonoAssembly*           <a href="#api:mono_domain_assembly_open">mono_domain_assembly_open</a>    (MonoDomain *domain, 
+                                                      const char *name);
+                        <a href="#api:mono_domain_create"></a>                             
+gboolean                <a href="#api:mono_domain_finalize">mono_domain_finalize</a>         (MonoDomain *domain, 
+                                                      guint32 timeout) ;
+                        <a href="#api:mono_domain_foreach"></a>                             
+                        <a href="#api:mono_domain_free"></a>                             
+                        <a href="#api:mono_domain_get_by_id"></a>                             
+MonoDomain*             <a href="#api:mono_domain_get_id">mono_domain_get_by_id</a>        (gint32 domainid) ;
+MonoDomain*             <a href="#api:mono_domain_get">mono_domain_get</a>              ();
+gboolean                <a href="#api:mono_domain_has_type_resolve">mono_domain_has_type_resolve</a> (MonoDomain *domain);
+                        <a href="#api:mono_domain_is_unloading"></a>                             
+void                    <a href="#api:mono_domain_set_internal">mono_domain_set_internal</a>     (MonoDomain *domain);
+gboolean                <a href="#api:mono_domain_set">mono_domain_set</a>              (MonoDomain *domain, 
+                                                      gboolean force);
+MonoReflectionAssembly* <a href="#api:mono_domain_try_type_resolve">mono_domain_try_type_resolve</a> (MonoDomain *domain, 
+                                                      char *name, 
+                                                      MonoObject *tb);
+gboolean                <a href="#api:mono_domain_owns_vtable_slot">mono_domain_owns_vtable_slot</a> (MonoDomain *domain, 
+                                                      gpointer vtable_slot);
+                        <a href="#api:mono_context_get"></a>                             
+                        <a href="#api:mono_context_set"></a>                             
+
+</div>
+
+	<p />Application domains are used to isolate multiple
+	applications on a single Mono virtual machine.  They are
+	conceptually similiar to processes, the difference is that
+	processes are managed by the operating system, while
+	application domains are managed by the Mono virtual machine.
+
+	<p />For more information on applications domains see the <a href="http://www.gotdotnet.com/team/clr/AppdomainFAQ.aspx">AppDomain FAQ</a>.
+		
+	<p />The <tt>MonoDomain</tt> is the unmanaged representation of
+	the <a href="http://www.mono-project.com/monodoc/T:System.AppDomain">System.AppDomain</a>
+	managed type, while the <tt>MonoAppDomain</tt> type represents
+	the managed version (<tt>MonoAppDomain</tt> has a pointer to
+	a <tt>MonoDomain</tt>).
+
+ <a name="api:mono_domain_assembly_open"></a>
+ <div class="api">
+    <div class="api-entry">mono_domain_assembly_open</div>
+
+    <div class="prototype">MonoAssembly*
+mono_domain_assembly_open (MonoDomain *domain, const char *name)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>domain:</i></dt><dd> the application domain</dd><dt><i>name:</i></dt><dd> file name of the assembly</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 fixme: maybe we should integrate this with mono_assembly_open ??
+
+</div> <a name="api:mono_domain_create"></a>
+ <div class="api">
+    <div class="api-entry">mono_domain_create</div>
+
+    <div class="prototype">Prototype: mono_domain_create</div>
+<p />
+
+</div> <a name="api:mono_domain_finalize"></a>
+ <div class="api">
+    <div class="api-entry">mono_domain_finalize</div>
+
+    <div class="prototype">
+gboolean
+mono_domain_finalize (MonoDomain *domain, guint32 timeout) 
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>domain:</i></dt><dd> the domain to finalize</dd><dt><i>timeout:</i></dt><dd> msects to wait for the finalization to complete, -1 to wait indefinitely</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  TRUE if succeeded, FALSE if there was a timeout
+</blockquote>
+<b>Remarks</b>
+<p />	 
+	  Request finalization of all finalizable objects inside <i>domain</i>. Wait
+	 <i>timeout</i> msecs for the finalization to complete.
+	
+
+</div> <a name="api:mono_domain_foreach"></a>
+ <div class="api">
+    <div class="api-entry">mono_domain_foreach</div>
+
+    <div class="prototype">Prototype: mono_domain_foreach</div>
+<p />
+
+</div> <a name="api:mono_domain_free"></a>
+ <div class="api">
+    <div class="api-entry">mono_domain_free</div>
+
+    <div class="prototype">Prototype: mono_domain_free</div>
+<p />
+
+</div> <a name="api:mono_domain_get_by_id"></a>
+ <div class="api">
+    <div class="api-entry">mono_domain_get_by_id</div>
+
+    <div class="prototype">Prototype: mono_domain_get_by_id</div>
+<p />
+
+</div> <a name="api:mono_domain_get_id"></a>
+ <div class="api">
+    <div class="api-entry">mono_domain_get_id</div>
+
+    <div class="prototype">MonoDomain* 
+mono_domain_get_by_id (gint32 domainid) 
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>domainid:</i></dt><dd> the ID</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  the a domain for a specific domain id.
+</blockquote>
+
+</div> <a name="api:mono_domain_get"></a>
+ <div class="api">
+    <div class="api-entry">mono_domain_get</div>
+
+    <div class="prototype">MonoDomain*
+mono_domain_get ()
+
+</div>
+<p />
+<b>Returns</b>
+<blockquote>	  the current domain, to obtain the root domain use
+
+	 mono_get_root_domain().</blockquote>
+
+</div> <a name="api:mono_domain_has_type_resolve"></a>
+ <div class="api">
+    <div class="api-entry">mono_domain_has_type_resolve</div>
+
+    <div class="prototype">gboolean
+mono_domain_has_type_resolve (MonoDomain *domain)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>domain:</i></dt><dd> application domains being looked up</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 Returns true if the AppDomain.TypeResolve field has been
+	 set.
+
+</div> <a name="api:mono_domain_is_unloading"></a>
+ <div class="api">
+    <div class="api-entry">mono_domain_is_unloading</div>
+
+    <div class="prototype">Prototype: mono_domain_is_unloading</div>
+<p />
+
+</div> <a name="api:mono_domain_set_internal"></a>
+ <div class="api">
+    <div class="api-entry">mono_domain_set_internal</div>
+
+    <div class="prototype">void
+mono_domain_set_internal (MonoDomain *domain)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>domain:</i></dt><dd> the new domain</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 Sets the current domain to <i>domain</i>.
+
+</div> <a name="api:mono_domain_set"></a>
+ <div class="api">
+    <div class="api-entry">mono_domain_set</div>
+
+    <div class="prototype">gboolean
+mono_domain_set (MonoDomain *domain, gboolean force)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>domain:</i></dt><dd> domain</dd><dt><i>force:</i></dt><dd> force setting.</dd></blockquote>
+<b>Returns</b>
+<blockquote>	 
+
+	   TRUE on success;
+	   FALSE if the domain is unloaded</blockquote>
+<b>Remarks</b>
+<p />	 
+	 Set the current appdomain to <i>domain</i>. If <i>force</i> is set, set it even
+	 if it is being unloaded.
+	
+
+</div> <a name="api:mono_domain_try_type_resolve"></a>
+ <div class="api">
+    <div class="api-entry">mono_domain_try_type_resolve</div>
+
+    <div class="prototype">MonoReflectionAssembly*
+mono_domain_try_type_resolve (MonoDomain *domain, char *name, MonoObject *tb)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>domain:</i></dt><dd> application domainwhere the name where the type is going to be resolved</dd><dt><i>name:</i></dt><dd> the name of the type to resolve or NULL.</dd><dt><i>tb:</i></dt><dd> A System.Reflection.Emit.TypeBuilder, used if name is NULL.</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  A MonoReflectionAssembly or NULL if not found
+</blockquote>
+<b>Remarks</b>
+<p />	 
+	 This routine invokes the internal System.AppDomain.DoTypeResolve and returns
+	 the assembly that matches name.
+	
+	 If <i>name</i> is null, the value of ((TypeBuilder)tb).FullName is used instead
+	
+
+</div> <a name="api:mono_domain_owns_vtable_slot"></a>
+ <div class="api">
+    <div class="api-entry">mono_domain_owns_vtable_slot</div>
+
+    <div class="prototype">gboolean
+mono_domain_owns_vtable_slot (MonoDomain *domain, gpointer vtable_slot)
+
+</div>
+<p />
+<b>Remarks</b>
+<p />	 
+	  Returns whenever VTABLE_SLOT is inside a vtable which belongs to DOMAIN.
+
+
+</div><h3>Contexts</h3>
+
+ <a name="api:mono_context_get"></a>
+ <div class="api">
+    <div class="api-entry">mono_context_get</div>
+
+    <div class="prototype">Prototype: mono_context_get</div>
+<p />
+
+</div></body>
+</html>
+</span>
\ No newline at end of file
diff --git a/docs/deploy/mono-api-dynamic-codegen.html b/docs/deploy/mono-api-dynamic-codegen.html
new file mode 100644
index 0000000..e97ef81
--- /dev/null
+++ b/docs/deploy/mono-api-dynamic-codegen.html
@@ -0,0 +1,362 @@
+<?xml version="1.0" encoding="utf-8"?><span>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+   <title>mono-api-dynamic-codegen.html</title>
+   <style type="text/css">
+
+
+   h3 { 
+       font-size: 18px;
+       padding-bottom: 4pt;
+       border-bottom: 2px solid #dddddd;
+   }
+       
+   .api {
+     border: 1px solid;
+     padding: 10pt;
+     margin: 10pt;
+   } 
+
+   .api-entry { 
+       border-bottom: none;
+       font-size: 18px;
+   }
+
+   .prototype {
+     border: 1px solid;
+     background-color: #f2f2f2;
+     padding: 5pt;
+     margin-top: 5pt;
+     margin-bottom: 5pt;  
+   } 
+
+   .header {
+     border: 1px solid;
+     padding: 0 0 5pt 5pt;
+     margin: 10pt;
+     white-space: pre;
+       font-family: monospace;
+   }
+    
+   .code {
+     border: 1px solid;
+     padding: 0 0 5pt 5pt;
+     margin: 10pt;
+     white-space: pre;
+       font-family: monospace;
+   }
+   
+
+</style>
+</head>
+<body>
+<h2>Dynamic Code Generation</h2>
+
+	<p />The dynamic code generation interface inside the Mono
+	runtime is similar to the API exposed by
+	System.Reflection.Emit.
+
+	<p />This interface is used by Mono internally to generate code
+	on the flight in a cross-platform fashion.  For example,
+	P/Invoke marshalling in Mono is implemented in terms of this
+	interface, but it is also used in various other parts of the
+	runtime.
+
+	<p />Unlike Reflection.Emit, the dynamic code generation
+	interface does not start with an assembly builder.   The code
+	generation interface starts directly at the method level,
+	which is represented by a pointer to the MonoMethodBuilder
+	structure.
+
+	<p />To JIT this method, the process is this:
+
+	<ul>
+		<li>Create a <tt>MonoMethodBuilder</tt> object using
+		the <tt>mono_mb_new</tt> method.  The method's class
+		is specified as the first argument.
+
+		<li>Create the method signature, using
+		<tt>mono_metadata_signature_alloc</tt>.  The call
+		takes the number of arguments that the method takes.
+		Then you must initialize the types for each one of the
+		parameters.
+
+		<li>Emit the CIL code, using one of the
+		<tt>mono_mb_emit_*</tt> functions.   There are some
+		helper routines that you can use.
+
+		<li>Create the <tt>MonoMethod</tt> from the
+		<tt>MethodBuilder</tt> using
+		<tt>mono_mb_create_method</tt>.
+
+		<li>Release the <tt>MonoMethodBuilder</tt> resources
+		using mono_mb_free. 
+	</li></li></li></li></li></ul>
+
+	<p />The result of this process is a <tt>MonoMethod</tt> which
+	can be called using <tt><a href="api:mono_create_jit_trampoline">mono_create_jit_trampoline</a></tt>
+	routine or can be passed to any other functions that require
+	the MonoMethod.
+
+	<p />Example:
+
+	<pre>
+MonoMethod *adder ()
+{
+    MonoMethodBuilder *mb;
+    MonoMethodSignature *sig;
+    MonoMethod *method;
+    
+    mb = mono_mb_new (mono_defaults.object_class, "adder", MONO_WRAPPER_NONE);
+
+    /* Setup method signature */
+    sig = mono_metadata_signature_alloc (2);
+    sig->ret = &mono_get_int32_class ()->byval_arg;
+    sig->params [0] = &mono_get_int32_class ()->byval_arg;
+    sig->params [1] = &mono_defaults.int32_class->byval_arg;
+
+    /* Emit CIL code */
+    mono_mb_emit_ldarg (mb, 0);
+    mono_mb_emit_ldarg (mb, 1);
+    mono_mb_emit_byte (mb, CEE_ADD);
+    mono_mb_emit_byte (mb, CEE_RET);
+
+    /* Get the method */
+    method = mono_mb_create_method (mb, sig, max_stack);
+    
+    /* Cleanup */
+    mono_mb-free (mb);
+    return method;
+}
+	</pre>
+	
+ <a name="api:mono_mb_new"></a>
+ <div class="api">
+    <div class="api-entry">mono_mb_new</div>
+
+    <div class="prototype">Prototype: mono_mb_new</div>
+<p />
+
+
+	<p />The possible values for the <i>type</i> argument are:
+
+<pre>
+        MONO_WRAPPER_NONE
+        MONO_WRAPPER_DELEGATE_INVOKE
+        MONO_WRAPPER_DELEGATE_BEGIN_INVOKE
+        MONO_WRAPPER_DELEGATE_END_INVOKE
+        MONO_WRAPPER_RUNTIME_INVOKE
+        MONO_WRAPPER_NATIVE_TO_MANAGED
+        MONO_WRAPPER_MANAGED_TO_NATIVE
+        MONO_WRAPPER_REMOTING_INVOKE
+        MONO_WRAPPER_REMOTING_INVOKE_WITH_CHECK
+        MONO_WRAPPER_XDOMAIN_INVOKE
+        MONO_WRAPPER_XDOMAIN_DISPATCH
+        MONO_WRAPPER_LDFLD
+        MONO_WRAPPER_STFLD
+        MONO_WRAPPER_LDFLD_REMOTE
+        MONO_WRAPPER_STFLD_REMOTE
+        MONO_WRAPPER_SYNCHRONIZED
+        MONO_WRAPPER_DYNAMIC_METHOD
+        MONO_WRAPPER_ISINST
+        MONO_WRAPPER_CASTCLASS
+        MONO_WRAPPER_PROXY_ISINST
+        MONO_WRAPPER_STELEMREF
+        MONO_WRAPPER_UNBOX
+        MONO_WRAPPER_LDFLDA
+        MONO_WRAPPER_UNKNOWN
+</pre>
+
+</div><h3>Emitting IL</h3>
+
+	<p />Functions that can be used to generate IL on the flight,
+	similar in spirit to System.Reflection.Emit.ILGenerator.
+	
+ <a name="api:mono_mb_emit_add_to_local"></a>
+ <div class="api">
+    <div class="api-entry">mono_mb_emit_add_to_local</div>
+
+    <div class="prototype">Prototype: mono_mb_emit_add_to_local</div>
+<p />
+
+</div> <a name="api:mono_mb_emit_branch"></a>
+ <div class="api">
+    <div class="api-entry">mono_mb_emit_branch</div>
+
+    <div class="prototype">Prototype: mono_mb_emit_branch</div>
+<p />
+
+</div> <a name="api:mono_mb_emit_byte"></a>
+ <div class="api">
+    <div class="api-entry">mono_mb_emit_byte</div>
+
+    <div class="prototype">Prototype: mono_mb_emit_byte</div>
+<p />
+
+</div> <a name="api:mono_mb_emit_exception"></a>
+ <div class="api">
+    <div class="api-entry">mono_mb_emit_exception</div>
+
+    <div class="prototype">Prototype: mono_mb_emit_exception</div>
+<p />
+
+</div> <a name="api:mono_mb_emit_i2"></a>
+ <div class="api">
+    <div class="api-entry">mono_mb_emit_i2</div>
+
+    <div class="prototype">Prototype: mono_mb_emit_i2</div>
+<p />
+
+</div> <a name="api:mono_mb_emit_i4"></a>
+ <div class="api">
+    <div class="api-entry">mono_mb_emit_i4</div>
+
+    <div class="prototype">Prototype: mono_mb_emit_i4</div>
+<p />
+
+</div> <a name="api:mono_mb_emit_icon"></a>
+ <div class="api">
+    <div class="api-entry">mono_mb_emit_icon</div>
+
+    <div class="prototype">Prototype: mono_mb_emit_icon</div>
+<p />
+
+</div> <a name="api:mono_mb_emit_ldarg_addr"></a>
+ <div class="api">
+    <div class="api-entry">mono_mb_emit_ldarg_addr</div>
+
+    <div class="prototype">Prototype: mono_mb_emit_ldarg_addr</div>
+<p />
+
+</div> <a name="api:mono_mb_emit_ldarg"></a>
+ <div class="api">
+    <div class="api-entry">mono_mb_emit_ldarg</div>
+
+    <div class="prototype">Prototype: mono_mb_emit_ldarg</div>
+<p />
+
+</div> <a name="api:mono_mb_emit_ldflda"></a>
+ <div class="api">
+    <div class="api-entry">mono_mb_emit_ldflda</div>
+
+    <div class="prototype">Prototype: mono_mb_emit_ldflda</div>
+<p />
+
+</div> <a name="api:mono_mb_emit_ldloc_addr"></a>
+ <div class="api">
+    <div class="api-entry">mono_mb_emit_ldloc_addr</div>
+
+    <div class="prototype">Prototype: mono_mb_emit_ldloc_addr</div>
+<p />
+
+</div> <a name="api:mono_mb_emit_ldloc"></a>
+ <div class="api">
+    <div class="api-entry">mono_mb_emit_ldloc</div>
+
+    <div class="prototype">Prototype: mono_mb_emit_ldloc</div>
+<p />
+
+</div> <a name="api:mono_mb_emit_ldstr"></a>
+ <div class="api">
+    <div class="api-entry">mono_mb_emit_ldstr</div>
+
+    <div class="prototype">Prototype: mono_mb_emit_ldstr</div>
+<p />
+
+</div> <a name="api:mono_mb_emit_managed_call"></a>
+ <div class="api">
+    <div class="api-entry">mono_mb_emit_managed_call</div>
+
+    <div class="prototype">Prototype: mono_mb_emit_managed_call</div>
+<p />
+
+</div> <a name="api:mono_mb_emit_native_call"></a>
+ <div class="api">
+    <div class="api-entry">mono_mb_emit_native_call</div>
+
+    <div class="prototype">Prototype: mono_mb_emit_native_call</div>
+<p />
+
+</div> <a name="api:mono_mb_emit_stloc"></a>
+ <div class="api">
+    <div class="api-entry">mono_mb_emit_stloc</div>
+
+    <div class="prototype">Prototype: mono_mb_emit_stloc</div>
+<p />
+
+
+</div><h3>Local variables and Methods</h3>
+ <a name="api:mono_mb_create_method"></a>
+ <div class="api">
+    <div class="api-entry">mono_mb_create_method</div>
+
+    <div class="prototype">MonoMethod*
+mono_mb_create_method (MonoMethodBuilder *mb, MonoMethodSignature *signature, int max_stack)
+
+</div>
+<p />
+<b>Returns</b>
+<blockquote>	  the newly created method.
+
+	
+	 LOCKING: Takes the loader lock.</blockquote>
+<b>Remarks</b>
+<p />	 
+	 Create a MonoMethod from this method builder.
+
+</div> <a name="api:mono_mb_add_data"></a>
+ <div class="api">
+    <div class="api-entry">mono_mb_add_data</div>
+
+    <div class="prototype">Prototype: mono_mb_add_data</div>
+<p />
+
+</div> <a name="api:mono_mb_add_local"></a>
+ <div class="api">
+    <div class="api-entry">mono_mb_add_local</div>
+
+    <div class="prototype">Prototype: mono_mb_add_local</div>
+<p />
+
+</div> <a name="api:mono_mb_free"></a>
+ <div class="api">
+    <div class="api-entry">mono_mb_free</div>
+
+    <div class="prototype">Prototype: mono_mb_free</div>
+<p />
+
+
+</div><h3>Patching Addresses</h3>
+ <a name="api:mono_mb_patch_addr"></a>
+ <div class="api">
+    <div class="api-entry">mono_mb_patch_addr</div>
+
+    <div class="prototype">Prototype: mono_mb_patch_addr</div>
+<p />
+
+</div> <a name="api:mono_mb_patch_addr_s"></a>
+ <div class="api">
+    <div class="api-entry">mono_mb_patch_addr_s</div>
+
+    <div class="prototype">Prototype: mono_mb_patch_addr_s</div>
+<p />
+
+
+</div><h3>Method Signatures</h3>
+ <a name="api:mono_metadata_signature_alloc"></a>
+ <div class="api">
+    <div class="api-entry">mono_metadata_signature_alloc</div>
+
+    <div class="prototype">Prototype: mono_metadata_signature_alloc</div>
+<p />
+
+</div> <a name="api:mono_metadata_signature_dup"></a>
+ <div class="api">
+    <div class="api-entry">mono_metadata_signature_dup</div>
+
+    <div class="prototype">Prototype: mono_metadata_signature_dup</div>
+<p />
+
+</div></body>
+</html>
+</span>
\ No newline at end of file
diff --git a/docs/deploy/mono-api-embedding.html b/docs/deploy/mono-api-embedding.html
new file mode 100644
index 0000000..1c4cef5
--- /dev/null
+++ b/docs/deploy/mono-api-embedding.html
@@ -0,0 +1,428 @@
+<?xml version="1.0" encoding="utf-8"?><span>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+   <title>mono-api-embedding.html</title>
+   <style type="text/css">
+
+
+   h3 { 
+       font-size: 18px;
+       padding-bottom: 4pt;
+       border-bottom: 2px solid #dddddd;
+   }
+       
+   .api {
+     border: 1px solid;
+     padding: 10pt;
+     margin: 10pt;
+   } 
+
+   .api-entry { 
+       border-bottom: none;
+       font-size: 18px;
+   }
+
+   .prototype {
+     border: 1px solid;
+     background-color: #f2f2f2;
+     padding: 5pt;
+     margin-top: 5pt;
+     margin-bottom: 5pt;  
+   } 
+
+   .header {
+     border: 1px solid;
+     padding: 0 0 5pt 5pt;
+     margin: 10pt;
+     white-space: pre;
+       font-family: monospace;
+   }
+    
+   .code {
+     border: 1px solid;
+     padding: 0 0 5pt 5pt;
+     margin: 10pt;
+     white-space: pre;
+       font-family: monospace;
+   }
+   
+
+</style>
+</head>
+<body>
+<h2>Embedding Mono</h2>
+
+	<p />The simplest way of embedding Mono is illustrated here:
+<pre>
+int main (int argc, char *argv)
+{
+	/*
+	 * Load the default Mono configuration file, this is needed
+	 * if you are planning on using the dllmaps defined on the
+	 * system configuration
+	 */
+	mono_config_parse (NULL);
+
+	/*
+	 * mono_jit_init() creates a domain: each assembly is
+	 * loaded and run in a MonoDomain.
+	 */
+	MonoDomain *domain = mono_jit_init ("startup.exe");
+
+	/*
+	 * Optionally, add an internal call that your startup.exe
+	 * code can call, this will bridge startup.exe to Mono
+	 */
+	mono_add_internal_call ("Sample::GetMessage", getMessage);
+
+	/*
+	 * Open the executable, and run the Main method declared
+	 * in the executable
+	 */
+	MonoAssembly *assembly = mono_domain_assembly_open (domain, "startup.exe");
+
+	if (!assembly)
+		exit (2);
+	/*
+	 * mono_jit_exec() will run the Main() method in the assembly.
+	 * The return value needs to be looked up from
+	 * System.Environment.ExitCode.
+	 */
+	mono_jit_exec (domain, assembly, argc, argv);
+}
+
+/* The C# signature for this method is: string GetMessage () in class Sample */
+MonoString*
+getMessage ()
+{
+	return mono_string_new (mono_domain_get (), "Hello, world");
+}
+</pre>
+
+ <a name="api:mono_jit_init"></a>
+ <div class="api">
+    <div class="api-entry">mono_jit_init</div>
+
+    <div class="prototype">Prototype: mono_jit_init</div>
+<p />
+
+</div> <a name="api:mono_jit_exec"></a>
+ <div class="api">
+    <div class="api-entry">mono_jit_exec</div>
+
+    <div class="prototype">int 
+mono_jit_exec (MonoDomain *domain, MonoAssembly *assembly, int argc, char *argv[])
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>assembly:</i></dt><dd> reference to an assembly</dd><dt><i>argc:</i></dt><dd> argument count</dd><dt><i>argv:</i></dt><dd> argument vector</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 Start execution of a program.
+
+</div> <a name="api:mono_set_dirs"></a>
+ <div class="api">
+    <div class="api-entry">mono_set_dirs</div>
+
+    <div class="prototype">void
+mono_set_dirs (const char *assembly_dir, const char *config_dir)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>assembly_dir:</i></dt><dd> the base directory for assemblies</dd><dt><i>config_dir:</i></dt><dd> the base directory for configuration files</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 This routine is used internally and by developers embedding
+	 the runtime into their own applications.
+	
+	 There are a number of cases to consider: Mono as a system-installed
+	 package that is available on the location preconfigured or Mono in
+	 a relocated location.
+	
+	 If you are using a system-installed Mono, you can pass NULL
+	 to both parameters.  If you are not, you should compute both
+	 directory values and call this routine.
+	
+	 The values for a given PREFIX are:
+	
+	    assembly_dir: PREFIX/lib
+	    config_dir:   PREFIX/etc
+	
+	 Notice that embedders that use Mono in a relocated way must
+	 compute the location at runtime, as they will be in control
+	 of where Mono is installed.
+
+</div> <a name="api:mono_main"></a>
+ <div class="api">
+    <div class="api-entry">mono_main</div>
+
+    <div class="prototype">int
+mono_main (int argc, char* argv[])
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>argc:</i></dt><dd> number of arguments in the argv array</dd><dt><i>argv:</i></dt><dd> array of strings containing the startup arguments</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 Launches the Mono JIT engine and parses all the command line options
+	 in the same way that the mono command line VM would.
+
+</div> <a name="api:mono_parse_default_optimizations"></a>
+ <div class="api">
+    <div class="api-entry">mono_parse_default_optimizations</div>
+
+    <div class="prototype">Prototype: mono_parse_default_optimizations</div>
+<p />
+
+
+</div> <a name="api:mono_jit_cleanup"></a>
+ <div class="api">
+    <div class="api-entry">mono_jit_cleanup</div>
+
+    <div class="prototype">Prototype: mono_jit_cleanup</div>
+<p />
+
+</div> <a name="api:mono_set_defaults"></a>
+ <div class="api">
+    <div class="api-entry">mono_set_defaults</div>
+
+    <div class="prototype">Prototype: mono_set_defaults</div>
+<p />
+
+
+</div><h3>Internal Calls</h3>
+
+	<p />The Mono runtime provides two mechanisms to expose C code
+	to the CIL universe: internal calls and native C
+	code. Internal calls are tightly integrated with the runtime,
+	and have the least overhead, as they use the same data types
+	that the runtime uses.
+
+	<p />The other option is to use the Platform Invoke (P/Invoke)
+	to call C code from the CIL universe, using the standard
+	<a href="http://www.mono-project.com/Interop_with_Native_Libraries">P/Invoke</a>
+	mechanisms.
+
+	<p />To register an internal call, use this call you use the
+	<a href="#api:mono_add_internal_call"><tt>mono_add_internal_call</tt>
+	routine.
+
+ <a name="api:mono_add_internal_call"></a>
+ <div class="api">
+    <div class="api-entry">mono_add_internal_call</div>
+
+    <div class="prototype">Prototype: mono_add_internal_call</div>
+<p />
+
+
+</div><h3>P/Invoke with embedded applications</h3>
+
+	<p />Unlike internal calls, Platform/Invoke is easier to use and
+	more portable.  It allows you to share code with Windows and
+	.NET that have a different setup for internal calls to their
+	own runtime.
+
+	<p />Usually P/Invoke declarations reference external libraries
+	like:
+
+	<pre>
+	[DllImport ("opengl")]
+	void glBegin (GLEnum mode)
+	</pre>
+
+	<p />Mono extends P/Invoke to support looking up symbols not in
+	an external library, but looking up those symbols into the
+	same address space as your program, to do this, use the
+	special library name "__Internal".   This will direct Mono to
+	lookup the method in your own process.
+
+	<p />There are situations where the host operating system does
+	not support looking up symbols on the process address space.
+	For situations like this you can use
+	the <a href="#api:mono_dl_register_library">mono_dl_register_library</a>. 
+
+<h4><a name="api:mono_dl_register_library">mono_dl_register_library</a></h4>
+	
+<h3>Data Marshalling</h3>
+
+	<p />Managed objects are represented as <tt>MonoObject*</tt>
+	types.  Those objects that the runtime consumes directly have
+	more specific C definitions (for example strings are of type
+	<tt>MonoString *</tt>, delegates are of type
+	<tt>MonoDelegate*</tt> but they are still <tt>MonoObject
+	*</tt>s).
+
+	<p />As of Mono 1.2.x types defined in mscorlib.dll do not have
+	their fields reordered in any way.   But other libraries might
+	have their fields reordered.   In these cases, Managed
+	structures and objects have the same layout in the C# code as
+	they do in the unmanaged world.
+
+	<p />Structures defined outside corlib must have a specific
+	StructLayout definition, and have it set as sequential if you
+	plan on accessing these fields directly from C code.
+
+	<p /><b>Important</b> Internal calls do not provide support for
+	marshalling structures.  This means that any API calls that
+	take a structure (excluding the system types like int32,
+	int64, etc) must be passed as a pointer, in C# this means
+	passing the value as a "ref" or "out" parameter.
+
+<h3>Mono Runtime Configuration</h3>
+
+	<p />Certain features of the Mono runtime, like DLL mapping, are
+	available through a configuration file that is loaded at
+	runtime.   The default Mono implementation loads the
+	configuration file from <tt>$sysconfig/mono/config</tt>
+	(typically this is <tt>/etc/mono/config</tt>).
+
+	<p />See the <tt>mono-config(5)</tt> man page for more details
+	on what goes in this file.
+
+	<p />The following APIs expose this functionality:
+	
+ <a name="api:mono_config_parse"></a>
+ <div class="api">
+    <div class="api-entry">mono_config_parse</div>
+
+    <div class="prototype">void
+mono_config_parse (const char *filename)
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>filename:</i></dt><dd> the filename to load the configuration variables from.</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 Pass a NULL filename to parse the default config files
+	 (or the file in the MONO_CONFIG env var).
+
+</div> <a name="api:mono_config_parse_memory"></a>
+ <div class="api">
+    <div class="api-entry">mono_config_parse_memory</div>
+
+    <div class="prototype">void
+mono_config_parse_memory (const char *buffer)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>buffer:</i></dt><dd> a pointer to an string XML representation of the configuration</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 Parses the configuration from a buffer
+
+</div> <a name="api:mono_get_config_dir"></a>
+ <div class="api">
+    <div class="api-entry">mono_get_config_dir</div>
+
+    <div class="prototype">Prototype: mono_get_config_dir</div>
+<p />
+
+
+</div><h3>Function Pointers</h3>
+
+	<p />To wrap a function pointer into something that the Mono
+	runtime can consume, you should use the mono_create_ftnptr.
+	This is only important if you plan on running on the IA64
+	architecture.   Otherwise you can just use the function
+	pointer address.
+	
+ <a name="api:mono_create_ftnptr"></a>
+ <div class="api">
+    <div class="api-entry">mono_create_ftnptr</div>
+
+    <div class="prototype">Prototype: mono_create_ftnptr</div>
+<p />
+
+
+</div><h3>Advanced Execution Setups</h3>
+
+	<p />These are not recommended ways of initializing Mono, they
+	are done internally by mono_jit_init, but are here to explain
+	what happens internally.
+	
+ <a name="api:mono_runtime_exec_managed_code"></a>
+ <div class="api">
+    <div class="api-entry">mono_runtime_exec_managed_code</div>
+
+    <div class="prototype">void
+mono_runtime_exec_managed_code (MonoDomain *domain,
+				MonoMainThreadFunc main_func,
+				gpointer main_args)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>domain:</i></dt><dd> Application domain</dd><dt><i>main_func:</i></dt><dd> function to invoke from the execution thread</dd><dt><i>main_args:</i></dt><dd> parameter to the main_func</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 Launch a new thread to execute a function
+	
+	 main_func is called back from the thread with main_args as the
+	 parameter.  The callback function is expected to start Main()
+	 eventually.  This function then waits for all managed threads to
+	 finish.
+	 It is not necesseray anymore to execute managed code in a subthread,
+	 so this function should not be used anymore by default: just
+	 execute the code and then call mono_thread_manage ().
+
+</div> <a name="api:mono_runtime_exec_main"></a>
+ <div class="api">
+    <div class="api-entry">mono_runtime_exec_main</div>
+
+    <div class="prototype">Prototype: mono_runtime_exec_main</div>
+<p />
+
+</div> <a name="api:mono_init_from_assembly"></a>
+ <div class="api">
+    <div class="api-entry">mono_init_from_assembly</div>
+
+    <div class="prototype">MonoDomain*
+mono_init_from_assembly (const char *domain_name, const char *filename)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>domain_name:</i></dt><dd> name to give to the initial domain</dd><dt><i>filename:</i></dt><dd> filename to load on startup</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  the initial domain.
+</blockquote>
+<b>Remarks</b>
+<p />	 
+	 Used by the runtime, users should use mono_jit_init instead.
+	
+	 Creates the initial application domain and initializes the mono_defaults
+	 structure.
+	 This function is guaranteed to not run any IL code.
+	 The runtime is initialized using the runtime version required by the
+	 provided executable. The version is determined by looking at the exe 
+	 configuration file and the version PE field)
+	
+
+</div> <a name="api:mono_init"></a>
+ <div class="api">
+    <div class="api-entry">mono_init</div>
+
+    <div class="prototype">MonoDomain*
+mono_init (const char *domain_name)
+
+</div>
+<p />
+<b>Returns</b>
+<blockquote>	  the initial domain.
+</blockquote>
+<b>Remarks</b>
+<p />	 <p />
+
+	 Creates the initial application domain and initializes the mono_defaults
+	 structure.
+	 This function is guaranteed to not run any IL code.
+	 The runtime is initialized using the default runtime version.
+	
+
+</div></a></body>
+</html>
+</span>
\ No newline at end of file
diff --git a/docs/deploy/mono-api-exc.html b/docs/deploy/mono-api-exc.html
new file mode 100644
index 0000000..774a8a6
--- /dev/null
+++ b/docs/deploy/mono-api-exc.html
@@ -0,0 +1,694 @@
+<?xml version="1.0" encoding="utf-8"?><span>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+   <title>mono-api-exc.html</title>
+   <style type="text/css">
+
+
+   h3 { 
+       font-size: 18px;
+       padding-bottom: 4pt;
+       border-bottom: 2px solid #dddddd;
+   }
+       
+   .api {
+     border: 1px solid;
+     padding: 10pt;
+     margin: 10pt;
+   } 
+
+   .api-entry { 
+       border-bottom: none;
+       font-size: 18px;
+   }
+
+   .prototype {
+     border: 1px solid;
+     background-color: #f2f2f2;
+     padding: 5pt;
+     margin-top: 5pt;
+     margin-bottom: 5pt;  
+   } 
+
+   .header {
+     border: 1px solid;
+     padding: 0 0 5pt 5pt;
+     margin: 10pt;
+     white-space: pre;
+       font-family: monospace;
+   }
+    
+   .code {
+     border: 1px solid;
+     padding: 0 0 5pt 5pt;
+     margin: 10pt;
+     white-space: pre;
+       font-family: monospace;
+   }
+   
+
+</style>
+</head>
+<body>
+<h2>Exception Handling</h2>
+
+<div class="header">
+void           <a href="#api:mono_raise_exception">mono_raise_exception</a>                       (MonoException *ex) ;
+void           <a href="#api:mono_unhandled_exception">mono_unhandled_exception</a>                   (MonoObject *exc);
+void           <a href="#api:mono_print_unhandled_exception">mono_print_unhandled_exception</a>             (MonoObject *exc);
+MonoException* <a href="#api:mono_exception_from_name_domain">mono_exception_from_name_domain</a>            (MonoDomain *domain, 
+                                                           MonoImage *image, 
+                                                           ;
+MonoException* <a href="#api:mono_exception_from_name">mono_exception_from_name</a>                   (MonoImage *image, 
+                                                           const char *name_space;
+MonoException* <a href="#api:mono_exception_from_name_msg">mono_exception_from_name_msg</a>               (MonoImage *image, 
+                                                           const char *name_space;
+MonoException* <a href="#api:mono_exception_from_name_two_strings">mono_exception_from_name_two_strings</a>       (MonoImage *image, 
+                                                           const char *name_space;
+MonoException* <a href="#api:mono_get_exception_appdomain_unloaded">mono_get_exception_appdomain_unloaded</a>      (void);
+MonoException* <a href="#api:mono_get_exception_argument">mono_get_exception_argument</a>                (const char *arg, 
+                                                           const char *msg);
+MonoException* <a href="#api:mono_get_exception_argument_null">mono_get_exception_argument_null</a>           (const char *arg);
+MonoException* <a href="#api:mono_get_exception_argument_out_of_range">mono_get_exception_argument_out_of_range</a>   (const char *arg);
+MonoException* <a href="#api:mono_get_exception_arithmetic">mono_get_exception_arithmetic</a>              ();
+MonoException* <a href="#api:mono_get_exception_array_type_mismatch">mono_get_exception_array_type_mismatch</a>     ();
+MonoException* <a href="#api:mono_get_exception_bad_image_format">mono_get_exception_bad_image_format</a>        (const char *msg);
+MonoException* <a href="#api:mono_get_exception_cannot_unload_appdomain">mono_get_exception_cannot_unload_appdomain</a> (const char *msg);
+               <a href="#api:mono_get_exception_class"></a>                                           
+MonoException* <a href="#api:mono_get_exception_divide_by_zero">mono_get_exception_divide_by_zero</a>          ();
+MonoException* <a href="#api:mono_get_exception_execution_engine">mono_get_exception_execution_engine</a>        (const char *msg);
+MonoException* <a href="#api:mono_get_exception_file_not_found2">mono_get_exception_file_not_found2</a>         (const char *msg, 
+                                                           MonoString *fname);
+MonoException* <a href="#api:mono_get_exception_file_not_found">mono_get_exception_file_not_found</a>          (MonoString *fname);
+MonoException* <a href="#api:mono_get_exception_index_out_of_range">mono_get_exception_index_out_of_range</a>      ();
+MonoException* <a href="#api:mono_get_exception_invalid_cast">mono_get_exception_invalid_cast</a>            ();
+MonoException* <a href="#api:mono_get_exception_io">mono_get_exception_io</a>                      (const char *msg);
+MonoException* <a href="#api:mono_get_exception_missing_method">mono_get_exception_missing_method</a>          (const char *class_name, 
+                                                           const char *member_name);
+MonoException* <a href="#api:mono_get_exception_not_implemented">mono_get_exception_not_implemented</a>         (const char *msg);
+MonoException* <a href="#api:mono_get_exception_null_reference">mono_get_exception_null_reference</a>          ();
+MonoException* <a href="#api:mono_get_exception_overflow">mono_get_exception_overflow</a>                ();
+MonoException* <a href="#api:mono_get_exception_security">mono_get_exception_security</a>                ();
+MonoException* <a href="#api:mono_get_exception_serialization">mono_get_exception_serialization</a>           (const char *msg);
+MonoException* <a href="#api:mono_get_exception_stack_overflow">mono_get_exception_stack_overflow</a>          (void);
+MonoException* <a href="#api:mono_get_exception_synchronization_lock">mono_get_exception_synchronization_lock</a>    (const char *msg);
+MonoException* <a href="#api:mono_get_exception_thread_abort">mono_get_exception_thread_abort</a>            ();
+MonoException* <a href="#api:mono_get_exception_thread_state">mono_get_exception_thread_state</a>            (const char *msg);
+MonoException* <a href="#api:mono_get_exception_type_initialization">mono_get_exception_type_initialization</a>     (const gchar *type_name, 
+                                                           MonoException *inner);
+MonoException* <a href="#api:mono_get_exception_type_load">mono_get_exception_type_load</a>               (MonoString *class_name, 
+                                                           char *assembly_name);
+MonoException* <a href="#api:mono_get_exception_invalid_operation">mono_get_exception_invalid_operation</a>       (const char *msg);
+MonoException* <a href="#api:mono_get_exception_missing_field">mono_get_exception_missing_field</a>           (const char *class_name, 
+                                                           const char *member_name);
+MonoException* <a href="#api:mono_get_exception_not_supported">mono_get_exception_not_supported</a>           (const char *msg);
+MonoException* <a href="#api:mono_get_exception_reflection_type_load">mono_get_exception_reflection_type_load</a>    (MonoArray *types, 
+                                                           MonoArray *exceptions);
+
+</div>
+
+<h3>Raising and Catching exceptions</h3>
+
+ <a name="api:mono_raise_exception"></a>
+ <div class="api">
+    <div class="api-entry">mono_raise_exception</div>
+
+    <div class="prototype">void
+mono_raise_exception (MonoException *ex) 
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>ex:</i></dt><dd> exception object</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 Signal the runtime that the exception <i>ex</i> has been raised in unmanaged code.
+
+</div> <a name="api:mono_unhandled_exception"></a>
+ <div class="api">
+    <div class="api-entry">mono_unhandled_exception</div>
+
+    <div class="prototype">void
+mono_unhandled_exception (MonoObject *exc)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>exc:</i></dt><dd> exception thrown</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 This is a VM internal routine.
+	
+	 We call this function when we detect an unhandled exception
+	 in the default domain.
+	
+	 It invokes the * UnhandledException event in AppDomain or prints
+	 a warning to the console 
+
+</div> <a name="api:mono_print_unhandled_exception"></a>
+ <div class="api">
+    <div class="api-entry">mono_print_unhandled_exception</div>
+
+    <div class="prototype">void
+mono_print_unhandled_exception (MonoObject *exc)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>exc:</i></dt><dd> The exception</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 Prints the unhandled exception.
+
+
+
+</div><h3>Exception Types: General API</h3>
+
+ <a name="api:mono_exception_from_name_domain"></a>
+ <div class="api">
+    <div class="api-entry">mono_exception_from_name_domain</div>
+
+    <div class="prototype">MonoException*
+mono_exception_from_name_domain (MonoDomain *domain, MonoImage *image, 
+				 const char* name_space, const char *name)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>domain:</i></dt><dd> Domain where the return object will be created.</dd><dt><i>image:</i></dt><dd> the Mono image where to look for the class</dd><dt><i>name_space:</i></dt><dd> the namespace for the class</dd><dt><i>name:</i></dt><dd> class name</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  the initialized exception instance.
+</blockquote>
+<b>Remarks</b>
+<p />	 
+	 Creates an exception object of the given namespace/name class on
+	 the given domain.
+	
+
+</div> <a name="api:mono_exception_from_name"></a>
+ <div class="api">
+    <div class="api-entry">mono_exception_from_name</div>
+
+    <div class="prototype">MonoException*
+mono_exception_from_name (MonoImage *image, const char *name_space,
+			  const char *name)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>image:</i></dt><dd> the Mono image where to look for the class</dd><dt><i>name_space:</i></dt><dd> the namespace for the class</dd><dt><i>name:</i></dt><dd> class name</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  the initialized exception instance.
+</blockquote>
+<b>Remarks</b>
+<p />	 
+	 Creates an exception of the given namespace/name class in the
+	 current domain.
+	
+
+</div> <a name="api:mono_exception_from_name_msg"></a>
+ <div class="api">
+    <div class="api-entry">mono_exception_from_name_msg</div>
+
+    <div class="prototype">MonoException*
+mono_exception_from_name_msg (MonoImage *image, const char *name_space,
+			      const char *name, const char *msg)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>image:</i></dt><dd> the Mono image where to look for the class</dd><dt><i>name_space:</i></dt><dd> the namespace for the class</dd><dt><i>name:</i></dt><dd> class name</dd><dt><i>msg:</i></dt><dd> the message to embed inside the exception</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  the initialized exception instance.
+</blockquote>
+<b>Remarks</b>
+<p />	 
+	 Creates an exception and initializes its message field.
+	
+
+</div> <a name="api:mono_exception_from_name_two_strings"></a>
+ <div class="api">
+    <div class="api-entry">mono_exception_from_name_two_strings</div>
+
+    <div class="prototype">MonoException*
+mono_exception_from_name_two_strings (MonoImage *image, const char *name_space,
+				      const char *name, MonoString *a1, MonoString *a2)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>image:</i></dt><dd> the Mono image where to look for the class</dd><dt><i>name_space:</i></dt><dd> the namespace for the class</dd><dt><i>name:</i></dt><dd> class name</dd><dt><i>a1:</i></dt><dd> first string argument to pass</dd><dt><i>a2:</i></dt><dd> second string argument to pass</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  the initialized exception instance.
+</blockquote>
+<b>Remarks</b>
+<p />	 
+	 Creates an exception from a constructor that takes two string
+	 arguments.
+	
+
+
+</div><h3>Obtaining Common Exceptions</h3>
+
+	<p />There are a number of common exceptions that are used by
+	the runtime, use the routines in this section to get a copy of
+	those exceptions.
+	
+ <a name="api:mono_get_exception_appdomain_unloaded"></a>
+ <div class="api">
+    <div class="api-entry">mono_get_exception_appdomain_unloaded</div>
+
+    <div class="prototype">MonoException*
+mono_get_exception_appdomain_unloaded (void)
+
+</div>
+<p />
+<b>Returns</b>
+<blockquote>	  a new instance of the System.AppDomainUnloadedException
+</blockquote>
+
+</div> <a name="api:mono_get_exception_argument"></a>
+ <div class="api">
+    <div class="api-entry">mono_get_exception_argument</div>
+
+    <div class="prototype">MonoException*
+mono_get_exception_argument (const char *arg, const char *msg)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>arg:</i></dt><dd> the name of the invalid argument.</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  a new instance of the System.ArgumentException
+</blockquote>
+
+</div> <a name="api:mono_get_exception_argument_null"></a>
+ <div class="api">
+    <div class="api-entry">mono_get_exception_argument_null</div>
+
+    <div class="prototype">MonoException*
+mono_get_exception_argument_null (const char *arg)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>arg:</i></dt><dd> the name of the argument that is null</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  a new instance of the System.ArgumentNullException
+</blockquote>
+
+</div> <a name="api:mono_get_exception_argument_out_of_range"></a>
+ <div class="api">
+    <div class="api-entry">mono_get_exception_argument_out_of_range</div>
+
+    <div class="prototype">MonoException*
+mono_get_exception_argument_out_of_range (const char *arg)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>arg:</i></dt><dd> the name of the out of range argument.</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  a new instance of the System.ArgumentOutOfRangeException
+</blockquote>
+
+</div> <a name="api:mono_get_exception_arithmetic"></a>
+ <div class="api">
+    <div class="api-entry">mono_get_exception_arithmetic</div>
+
+    <div class="prototype">MonoException*
+mono_get_exception_arithmetic ()
+
+</div>
+<p />
+<b>Returns</b>
+<blockquote>	  a new instance of the System.ArithmeticException.
+</blockquote>
+
+</div> <a name="api:mono_get_exception_array_type_mismatch"></a>
+ <div class="api">
+    <div class="api-entry">mono_get_exception_array_type_mismatch</div>
+
+    <div class="prototype">MonoException*
+mono_get_exception_array_type_mismatch ()
+
+</div>
+<p />
+<b>Returns</b>
+<blockquote>	  a new instance of the System.ArrayTypeMismatchException
+</blockquote>
+
+</div> <a name="api:mono_get_exception_bad_image_format"></a>
+ <div class="api">
+    <div class="api-entry">mono_get_exception_bad_image_format</div>
+
+    <div class="prototype">MonoException*
+mono_get_exception_bad_image_format (const char *msg)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>msg:</i></dt><dd> an informative message for the user.</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  a new instance of the System.BadImageFormatException
+</blockquote>
+
+</div> <a name="api:mono_get_exception_cannot_unload_appdomain"></a>
+ <div class="api">
+    <div class="api-entry">mono_get_exception_cannot_unload_appdomain</div>
+
+    <div class="prototype">MonoException*
+mono_get_exception_cannot_unload_appdomain (const char *msg)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>inner:</i></dt><dd> the inner exception.</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  a new instance of the System.CannotUnloadAppDomainException
+</blockquote>
+
+</div> <a name="api:mono_get_exception_class"></a>
+ <div class="api">
+    <div class="api-entry">mono_get_exception_class</div>
+
+    <div class="prototype">Prototype: mono_get_exception_class</div>
+<p />
+
+</div> <a name="api:mono_get_exception_divide_by_zero"></a>
+ <div class="api">
+    <div class="api-entry">mono_get_exception_divide_by_zero</div>
+
+    <div class="prototype">MonoException*
+mono_get_exception_divide_by_zero ()
+
+</div>
+<p />
+<b>Returns</b>
+<blockquote>	  a new instance of the System.DivideByZeroException
+</blockquote>
+
+</div> <a name="api:mono_get_exception_execution_engine"></a>
+ <div class="api">
+    <div class="api-entry">mono_get_exception_execution_engine</div>
+
+    <div class="prototype">MonoException*
+mono_get_exception_execution_engine (const char *msg)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>msg:</i></dt><dd> the message to pass to the user</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  a new instance of the System.ExecutionEngineException
+</blockquote>
+
+</div> <a name="api:mono_get_exception_file_not_found2"></a>
+ <div class="api">
+    <div class="api-entry">mono_get_exception_file_not_found2</div>
+
+    <div class="prototype">MonoException*
+mono_get_exception_file_not_found2 (const char *msg, MonoString *fname)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>msg:</i></dt><dd> an informative message for the user.</dd><dt><i>fname:</i></dt><dd> the name of the file not found.</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  a new instance of the System.IO.FileNotFoundException
+</blockquote>
+
+</div> <a name="api:mono_get_exception_file_not_found"></a>
+ <div class="api">
+    <div class="api-entry">mono_get_exception_file_not_found</div>
+
+    <div class="prototype">MonoException*
+mono_get_exception_file_not_found (MonoString *fname)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>fname:</i></dt><dd> the name of the file not found.</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  a new instance of the System.IO.FileNotFoundException
+</blockquote>
+
+</div> <a name="api:mono_get_exception_index_out_of_range"></a>
+ <div class="api">
+    <div class="api-entry">mono_get_exception_index_out_of_range</div>
+
+    <div class="prototype">MonoException*
+mono_get_exception_index_out_of_range ()
+
+</div>
+<p />
+<b>Returns</b>
+<blockquote>	  a new instance of the System.IndexOutOfRangeException
+</blockquote>
+
+</div> <a name="api:mono_get_exception_invalid_cast"></a>
+ <div class="api">
+    <div class="api-entry">mono_get_exception_invalid_cast</div>
+
+    <div class="prototype">MonoException*
+mono_get_exception_invalid_cast ()
+
+</div>
+<p />
+<b>Returns</b>
+<blockquote>	  a new instance of the System.InvalidCastException
+</blockquote>
+
+</div> <a name="api:mono_get_exception_io"></a>
+ <div class="api">
+    <div class="api-entry">mono_get_exception_io</div>
+
+    <div class="prototype">MonoException*
+mono_get_exception_io (const char *msg)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>msg:</i></dt><dd> the message to present to the user</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  a new instance of the System.IO.IOException
+</blockquote>
+
+</div> <a name="api:mono_get_exception_missing_method"></a>
+ <div class="api">
+    <div class="api-entry">mono_get_exception_missing_method</div>
+
+    <div class="prototype">MonoException*
+mono_get_exception_missing_method (const char *class_name, const char *member_name)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>class_name:</i></dt><dd> the class where the lookup was performed.</dd><dt><i>member_name:</i></dt><dd> the name of the missing method.</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  a new instance of the System.MissingMethodException
+</blockquote>
+
+</div> <a name="api:mono_get_exception_not_implemented"></a>
+ <div class="api">
+    <div class="api-entry">mono_get_exception_not_implemented</div>
+
+    <div class="prototype">MonoException*
+mono_get_exception_not_implemented (const char *msg)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>msg:</i></dt><dd> the message to pass to the user</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  a new instance of the System.NotImplementedException
+</blockquote>
+
+</div> <a name="api:mono_get_exception_null_reference"></a>
+ <div class="api">
+    <div class="api-entry">mono_get_exception_null_reference</div>
+
+    <div class="prototype">MonoException*
+mono_get_exception_null_reference ()
+
+</div>
+<p />
+<b>Returns</b>
+<blockquote>	  a new instance of the System.NullReferenceException
+</blockquote>
+
+</div> <a name="api:mono_get_exception_overflow"></a>
+ <div class="api">
+    <div class="api-entry">mono_get_exception_overflow</div>
+
+    <div class="prototype">MonoException*
+mono_get_exception_overflow ()
+
+</div>
+<p />
+<b>Returns</b>
+<blockquote>	  a new instance of the System.OverflowException
+</blockquote>
+
+</div> <a name="api:mono_get_exception_security"></a>
+ <div class="api">
+    <div class="api-entry">mono_get_exception_security</div>
+
+    <div class="prototype">MonoException*
+mono_get_exception_security ()
+
+</div>
+<p />
+<b>Returns</b>
+<blockquote>	  a new instance of the System.Security.SecurityException
+</blockquote>
+
+</div> <a name="api:mono_get_exception_serialization"></a>
+ <div class="api">
+    <div class="api-entry">mono_get_exception_serialization</div>
+
+    <div class="prototype">MonoException*
+mono_get_exception_serialization (const char *msg)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>msg:</i></dt><dd> the message to pass to the user</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  a new instance of the System.Runtime.Serialization.SerializationException
+</blockquote>
+
+</div> <a name="api:mono_get_exception_stack_overflow"></a>
+ <div class="api">
+    <div class="api-entry">mono_get_exception_stack_overflow</div>
+
+    <div class="prototype">MonoException*
+mono_get_exception_stack_overflow (void)
+
+</div>
+<p />
+<b>Returns</b>
+<blockquote>	  a new instance of the System.StackOverflowException
+</blockquote>
+
+</div> <a name="api:mono_get_exception_synchronization_lock"></a>
+ <div class="api">
+    <div class="api-entry">mono_get_exception_synchronization_lock</div>
+
+    <div class="prototype">MonoException*
+mono_get_exception_synchronization_lock (const char *msg)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>inner:</i></dt><dd> the inner exception.</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  a new instance of the System.SynchronizationLockException
+</blockquote>
+
+</div> <a name="api:mono_get_exception_thread_abort"></a>
+ <div class="api">
+    <div class="api-entry">mono_get_exception_thread_abort</div>
+
+    <div class="prototype">MonoException*
+mono_get_exception_thread_abort ()
+
+</div>
+<p />
+<b>Returns</b>
+<blockquote>	  a new instance of the System.Threading.ThreadAbortException.
+</blockquote>
+
+</div> <a name="api:mono_get_exception_thread_state"></a>
+ <div class="api">
+    <div class="api-entry">mono_get_exception_thread_state</div>
+
+    <div class="prototype">MonoException*
+mono_get_exception_thread_state (const char *msg)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>msg:</i></dt><dd> the message to present to the user</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  a new instance of the System.Threading.ThreadStateException
+</blockquote>
+
+</div> <a name="api:mono_get_exception_type_initialization"></a>
+ <div class="api">
+    <div class="api-entry">mono_get_exception_type_initialization</div>
+
+    <div class="prototype">MonoException*
+mono_get_exception_type_initialization (const gchar *type_name, MonoException *inner)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>type_name:</i></dt><dd> the name of the type that failed to initialize.</dd><dt><i>inner:</i></dt><dd> the inner exception.</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  a new instance of the System.TypeInitializationException
+</blockquote>
+
+</div> <a name="api:mono_get_exception_type_load"></a>
+ <div class="api">
+    <div class="api-entry">mono_get_exception_type_load</div>
+
+    <div class="prototype">MonoException*
+mono_get_exception_type_load (MonoString *class_name, char *assembly_name)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>class_name:</i></dt><dd> the name of the class that could not be loaded</dd><dt><i>assembly_name:</i></dt><dd> the assembly where the class was looked up.</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  a new instance of the System.TypeLoadException.
+</blockquote>
+
+</div> <a name="api:mono_get_exception_invalid_operation"></a>
+ <div class="api">
+    <div class="api-entry">mono_get_exception_invalid_operation</div>
+
+    <div class="prototype">MonoException*
+mono_get_exception_invalid_operation (const char *msg)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>msg:</i></dt><dd> the message to pass to the user</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  a new instance of the System.InvalidOperationException
+</blockquote>
+
+</div> <a name="api:mono_get_exception_missing_field"></a>
+ <div class="api">
+    <div class="api-entry">mono_get_exception_missing_field</div>
+
+    <div class="prototype">MonoException*
+mono_get_exception_missing_field (const char *class_name, const char *member_name)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>class_name:</i></dt><dd> the class where the lookup was performed</dd><dt><i>member_name:</i></dt><dd> the name of the missing method.</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  a new instance of the System.MissingFieldException
+</blockquote>
+
+</div> <a name="api:mono_get_exception_not_supported"></a>
+ <div class="api">
+    <div class="api-entry">mono_get_exception_not_supported</div>
+
+    <div class="prototype">MonoException*
+mono_get_exception_not_supported (const char *msg)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>msg:</i></dt><dd> the message to pass to the user</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  a new instance of the System.NotSupportedException
+</blockquote>
+
+</div></body>
+</html>
+</span>
\ No newline at end of file
diff --git a/docs/deploy/mono-api-gc.html b/docs/deploy/mono-api-gc.html
new file mode 100644
index 0000000..047b6cf
--- /dev/null
+++ b/docs/deploy/mono-api-gc.html
@@ -0,0 +1,119 @@
+<?xml version="1.0" encoding="utf-8"?><span>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+   <title>mono-api-gc.html</title>
+   <style type="text/css">
+
+
+   h3 { 
+       font-size: 18px;
+       padding-bottom: 4pt;
+       border-bottom: 2px solid #dddddd;
+   }
+       
+   .api {
+     border: 1px solid;
+     padding: 10pt;
+     margin: 10pt;
+   } 
+
+   .api-entry { 
+       border-bottom: none;
+       font-size: 18px;
+   }
+
+   .prototype {
+     border: 1px solid;
+     background-color: #f2f2f2;
+     padding: 5pt;
+     margin-top: 5pt;
+     margin-bottom: 5pt;  
+   } 
+
+   .header {
+     border: 1px solid;
+     padding: 0 0 5pt 5pt;
+     margin: 10pt;
+     white-space: pre;
+       font-family: monospace;
+   }
+    
+   .code {
+     border: 1px solid;
+     padding: 0 0 5pt 5pt;
+     margin: 10pt;
+     white-space: pre;
+       font-family: monospace;
+   }
+   
+
+</style>
+</head>
+<body>
+<h1>Garbage Collector Interface</h1>
+
+<h1>Public Interface</h1>
+
+	<p />The public interface of the Mono GC is fairly limited, and
+	its the only one that embedders should be using:
+	
+ <a name="api:mono_gc_collect"></a>
+ <div class="api">
+    <div class="api-entry">mono_gc_collect</div>
+
+    <div class="prototype">void
+mono_gc_collect (int generation)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>generation:</i></dt><dd> GC generation identifier</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 Perform a garbage collection for the given generation, higher numbers
+	 mean usually older objects. Collecting a high-numbered generation
+	 implies collecting also the lower-numbered generations.
+	 The maximum value for <i>generation</i> can be retrieved with a call to
+	 mono_gc_max_generation(), so this function is usually called as:
+	
+	 	mono_gc_collect (mono_gc_max_generation ());
+
+</div> <a name="api:mono_gc_max_generation"></a>
+ <div class="api">
+    <div class="api-entry">mono_gc_max_generation</div>
+
+    <div class="prototype">int
+mono_gc_max_generation (void)
+
+</div>
+<p />
+<b>Returns</b>
+<blockquote>	  the maximum generation number.
+</blockquote>
+<b>Remarks</b>
+<p />	 
+	 Get the maximum generation number used by the current garbage
+	 collector. The value will be 0 for the Boehm collector, 1 or more
+	 for the generational collectors.
+	
+
+</div> <a name="api:mono_gc_get_heap_size"></a>
+ <div class="api">
+    <div class="api-entry">mono_gc_get_heap_size</div>
+
+    <div class="prototype">int64_t
+mono_gc_get_heap_size (void)
+
+</div>
+<p />
+<b>Returns</b>
+<blockquote>	  the size of the heap in bytes
+</blockquote>
+<b>Remarks</b>
+<p />	 
+	 Get the amount of memory used by the garbage collector.
+	
+
+</div></body>
+</html>
+</span>
\ No newline at end of file
diff --git a/docs/deploy/mono-api-gchandle.html b/docs/deploy/mono-api-gchandle.html
new file mode 100644
index 0000000..84b9fc2
--- /dev/null
+++ b/docs/deploy/mono-api-gchandle.html
@@ -0,0 +1,228 @@
+<?xml version="1.0" encoding="utf-8"?><span>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+   <title>mono-api-gchandle.html</title>
+   <style type="text/css">
+
+
+   h3 { 
+       font-size: 18px;
+       padding-bottom: 4pt;
+       border-bottom: 2px solid #dddddd;
+   }
+       
+   .api {
+     border: 1px solid;
+     padding: 10pt;
+     margin: 10pt;
+   } 
+
+   .api-entry { 
+       border-bottom: none;
+       font-size: 18px;
+   }
+
+   .prototype {
+     border: 1px solid;
+     background-color: #f2f2f2;
+     padding: 5pt;
+     margin-top: 5pt;
+     margin-bottom: 5pt;  
+   } 
+
+   .header {
+     border: 1px solid;
+     padding: 0 0 5pt 5pt;
+     margin: 10pt;
+     white-space: pre;
+       font-family: monospace;
+   }
+    
+   .code {
+     border: 1px solid;
+     padding: 0 0 5pt 5pt;
+     margin: 10pt;
+     white-space: pre;
+       font-family: monospace;
+   }
+   
+
+</style>
+</head>
+<body>
+<h1>GC Handles</h1>
+
+<h3>Synopsys</h3>
+
+	<div class="header">
+guint32     <a href="#api:mono_gchandle_new">mono_gchandle_new</a>         (MonoObject *obj, 
+                                       gboolean pinned);
+guint32     <a href="#api:mono_gchandle_new_weakref">mono_gchandle_new_weakref</a> (MonoObject *obj, 
+                                       gboolean track_resurrection);
+MonoObject* <a href="#api:mono_gchandle_get_target">mono_gchandle_get_target</a>  (guint32 gchandle);
+void        <a href="#api:mono_gchandle_free">mono_gchandle_free</a>        (guint32 gchandle);
+
+	</div>
+	
+	<p />GC handles are wrappers that are used to keep references to
+	managed objects in the unmanaged space and preventing the
+	object from being disposed.
+	
+	<p />These are the C equivalents of the <tt>System.GCHandle</tt>
+	structure.
+
+	<p />There are two kinds of GCHandles that can be created:
+
+	<ul>
+		<li>Handles to objects (use <tt><a href="#api:mono_gchandle_new">mono_gchandle_new</a></tt>). 
+
+		<li>Weak handles to objects (use <tt><a href="#api:mono_gchandle_new_weakref">mono_gchandle_new_weakref</a></tt>).
+		Weak handles can have the objects reclaimed by the
+		garbage collector. 
+		
+	</li></li></ul>
+
+	<p />To retrieve the target address of an object pointed to by a
+	<tt>GCHandle</tt> you should use
+	<tt>mono_gchandle_get_target</tt>.
+
+	<p />For example, consider the following C code:
+<div class="code">
+static MonoObject* o = NULL;
+</div>
+
+	<p />The object in `o' will *NOT* be scanned.
+
+	<p />If you need to store an object in a C variable and prevent
+	it from being collected, you need to acquire a GC handle for
+	it.
+
+<div class="code">
+        guint32 handle = mono_gchandle_new (my_object, TRUE);
+</div>
+
+	<p />TRUE means the object will be pinned, so it won't move in
+	memory when we'll use a moving GC. You can access the
+	MonoObject* referenced by a handle with:
+
+<div class="code">
+        MonoObject* obj = mono_gchandle_get_target (handle);
+</div>
+
+	<p />When you don't need the handle anymore you need to call:
+
+<div class="code">
+        mono_gchandle_free (handle);
+</div>
+
+	<p />Note that if you assign a new object to the C var, you need
+	to get a new handle, it's not enough to store a new object in
+	the C var.
+
+	<p />So code that looked like this:
+
+<div class="code">
+        static MonoObject* o = NULL;
+        ...
+        o = mono_object_new (...);
+        /* use o */
+        ...
+        /* when done to allow the GC to collect o */
+        o = NULL;
+</div>
+
+	<p />should now be changed to:
+
+<div class="code">
+        static guint32 o_handle;
+        ...
+        MonoObject *o = mono_object_new (...);
+        o_handle = mono_gchandle_new (o, TRUE);
+        /* use o or mono_gchandle_get_target (o_handle) */
+        ...
+        /* when done to allow the GC to collect o */
+        mono_gchandle_free (o_handle);
+</div>
+		
+ <a name="api:mono_gchandle_new"></a>
+ <div class="api">
+    <div class="api-entry">mono_gchandle_new</div>
+
+    <div class="prototype">guint32
+mono_gchandle_new (MonoObject *obj, gboolean pinned)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>obj:</i></dt><dd> managed object to get a handle for</dd><dt><i>pinned:</i></dt><dd> whether the object should be pinned</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  a handle that can be used to access the object from
+
+	 unmanaged code.</blockquote>
+<b>Remarks</b>
+<p />	 
+	 This returns a handle that wraps the object, this is used to keep a
+	 reference to a managed object from the unmanaged world and preventing the
+	 object from being disposed.
+	
+<p />
+	 If <i>pinned</i> is false the address of the object can not be obtained, if it is
+	 true the address of the object can be obtained.  This will also pin the
+	 object so it will not be possible by a moving garbage collector to move the
+	 object. 
+	
+<p />
+
+</div> <a name="api:mono_gchandle_new_weakref"></a>
+ <div class="api">
+    <div class="api-entry">mono_gchandle_new_weakref</div>
+
+    <div class="prototype">guint32
+mono_gchandle_new_weakref (MonoObject *obj, gboolean track_resurrection)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>obj:</i></dt><dd> managed object to get a handle for</dd><dt><i>pinned:</i></dt><dd> whether the object should be pinned</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  a handle that can be used to access the object from
+
+	 unmanaged code.</blockquote>
+<b>Remarks</b>
+<p />	 
+	 This returns a weak handle that wraps the object, this is used to
+	 keep a reference to a managed object from the unmanaged world.
+	 Unlike the mono_gchandle_new the object can be reclaimed by the
+	 garbage collector.  In this case the value of the GCHandle will be
+	 set to zero.
+	
+<p />
+	 If <i>pinned</i> is false the address of the object can not be obtained, if it is
+	 true the address of the object can be obtained.  This will also pin the
+	 object so it will not be possible by a moving garbage collector to move the
+	 object. 
+	
+<p />
+
+</div> <a name="api:mono_gchandle_get_target"></a>
+ <div class="api">
+    <div class="api-entry">mono_gchandle_get_target</div>
+
+    <div class="prototype">MonoObject*
+mono_gchandle_get_target (guint32 gchandle)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>gchandle:</i></dt><dd> a GCHandle's handle.</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 The handle was previously created by calling mono_gchandle_new or
+	 mono_gchandle_new_weakref. 
+	
+	 Returns a pointer to the MonoObject represented by the handle or
+	 NULL for a collected object if using a weakref handle.
+
+</div></body>
+</html>
+</span>
\ No newline at end of file
diff --git a/docs/deploy/mono-api-image.html b/docs/deploy/mono-api-image.html
new file mode 100644
index 0000000..cbb8f2d
--- /dev/null
+++ b/docs/deploy/mono-api-image.html
@@ -0,0 +1,517 @@
+<?xml version="1.0" encoding="utf-8"?><span>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+   <title>mono-api-image.html</title>
+   <style type="text/css">
+
+
+   h3 { 
+       font-size: 18px;
+       padding-bottom: 4pt;
+       border-bottom: 2px solid #dddddd;
+   }
+       
+   .api {
+     border: 1px solid;
+     padding: 10pt;
+     margin: 10pt;
+   } 
+
+   .api-entry { 
+       border-bottom: none;
+       font-size: 18px;
+   }
+
+   .prototype {
+     border: 1px solid;
+     background-color: #f2f2f2;
+     padding: 5pt;
+     margin-top: 5pt;
+     margin-bottom: 5pt;  
+   } 
+
+   .header {
+     border: 1px solid;
+     padding: 0 0 5pt 5pt;
+     margin: 10pt;
+     white-space: pre;
+       font-family: monospace;
+   }
+    
+   .code {
+     border: 1px solid;
+     padding: 0 0 5pt 5pt;
+     margin: 10pt;
+     white-space: pre;
+       font-family: monospace;
+   }
+   
+
+</style>
+</head>
+<body>
+<h2>Image Manipulation</h2>
+
+	<p />Images are the component of assemblies that actually hold
+	the CIL code and <a href="mono-api-metadata.html">metadata</a>
+	in the extended PE/COFF file.
+
+<h3>Synopsis</h3>
+
+	<div class="header">
+#include <metadata/image.h>
+
+typedef struct _MonoImage MonoImage;
+typedef enum {
+        MONO_IMAGE_OK,
+        MONO_IMAGE_ERROR_ERRNO,
+        MONO_IMAGE_MISSING_ASSEMBLYREF,
+        MONO_IMAGE_IMAGE_INVALID
+} MonoImageOpenStatus;
+
+MonoImage*     <a href="#api:mono_image_open">mono_image_open</a>                   (const char *fname, 
+                                                  MonoImageOpenStatus *status);
+               <a href="#api:mono_image_open_full"></a>                                  
+               <a href="#api:mono_image_open_from_data"></a>                                  
+               <a href="#api:mono_image_open_from_data_full"></a>                                  
+void           <a href="#api:mono_image_close">mono_image_close</a>                  (MonoImage *image);
+void           <a href="#api:mono_image_addref">mono_image_addref</a>                 (MonoImage *image);
+               <a href="#api:mono_image_load_file_for_image"></a>                                  
+               <a href="#api:mono_image_get_guid"></a>                                  
+MonoAssembly*  <a href="#api:mono_image_get_assembly">mono_image_get_assembly</a>           (MonoImage *image);
+guint32        <a href="#api:mono_image_get_entry_point">mono_image_get_entry_point</a>        (MonoImage *image);
+const char*    <a href="#api:mono_image_get_filename">mono_image_get_filename</a>           (MonoImage *image);
+const char*    <a href="#api:mono_image_get_name">mono_image_get_name</a>               (MonoImage *image);
+const char*    <a href="#api:mono_image_get_resource">mono_image_get_resource</a>           (MonoImage *image, 
+                                                  guint32 offset, 
+                                                  guint32 *size);
+               <a href="#api:mono_image_get_table_info"></a>                                  
+               <a href="#api:mono_image_get_table_rows"></a>                                  
+gboolean       <a href="#api:mono_image_is_dynamic">mono_image_is_dynamic</a>             (MonoImage *image);
+               <a href="#api:mono_image_loaded_by_guid"></a>                                  
+MonoImage*     <a href="#api:mono_image_loaded">mono_image_loaded</a>                 (const char *name);
+gpointer       <a href="#api:mono_image_lookup_resource">mono_image_lookup_resource</a>        (MonoImage *image, 
+                                                  guint32 res_id, 
+                                                  guint32 lang_id, 
+                                                  gunichar2 *name);
+const char *   <a href="#api:mono_image_strerror">mono_image_strerror</a>               (MonoImageOpenStatus status);
+guint32        <a href="#api:mono_image_strong_name_position">mono_image_strong_name_position</a>   (MonoImage *image, 
+                                                  guint32 *size);
+const char*    <a href="#api:mono_image_get_public_key">mono_image_get_public_key</a>         (MonoImage *image, 
+                                                  guint32 *size);
+const char*    <a href="#api:mono_image_get_strong_name">mono_image_get_strong_name</a>        (MonoImage *image, 
+                                                  guint32 *size);
+gboolean       <a href="#api:mono_image_has_authenticode_entry">mono_image_has_authenticode_entry</a> (MonoImage *image);
+               <a href="#api:mono_image_rva_map"></a>                                  
+int            <a href="#api:mono_image_ensure_section_idx">mono_image_ensure_section_idx</a>     (MonoImage *image, 
+                                                  int section);
+int            <a href="#api:mono_image_ensure_section">mono_image_ensure_section</a>         (MonoImage *image, 
+                                                  const char *section);
+
+	</div>
+
+<h3>Image APIs</h3>
+
+	<p />Images are the actual elements in the runtime that contain
+	the actual code being executed. 
+
+<a name="cil_image_open"></a>
+<h3>Opening and closing MonoImages</h3>
+
+ <a name="api:mono_image_open"></a>
+ <div class="api">
+    <div class="api-entry">mono_image_open</div>
+
+    <div class="prototype">MonoImage*
+mono_image_open (const char *fname, MonoImageOpenStatus *status)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>fname:</i></dt><dd> filename that points to the module we want to open</dd><dt><i>status:</i></dt><dd> An error condition is returned in this field</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  An open image of type %MonoImage or NULL on error. 
+
+	 The caller holds a temporary reference to the returned image which should be cleared 
+	 when no longer needed by calling mono_image_close ().
+	 if NULL, then check the value of <i>status</i> for details on the error</blockquote>
+
+</div> <a name="api:mono_image_open_full"></a>
+ <div class="api">
+    <div class="api-entry">mono_image_open_full</div>
+
+    <div class="prototype">Prototype: mono_image_open_full</div>
+<p />
+
+</div> <a name="api:mono_image_open_from_data"></a>
+ <div class="api">
+    <div class="api-entry">mono_image_open_from_data</div>
+
+    <div class="prototype">Prototype: mono_image_open_from_data</div>
+<p />
+
+</div> <a name="api:mono_image_open_from_data_full"></a>
+ <div class="api">
+    <div class="api-entry">mono_image_open_from_data_full</div>
+
+    <div class="prototype">Prototype: mono_image_open_from_data_full</div>
+<p />
+
+</div> <a name="api:mono_image_close"></a>
+ <div class="api">
+    <div class="api-entry">mono_image_close</div>
+
+    <div class="prototype">void
+mono_image_close (MonoImage *image)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>image:</i></dt><dd> The image file we wish to close</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 Closes an image file, deallocates all memory consumed and
+	 unmaps all possible sections of the file
+
+</div> <a name="api:mono_image_addref"></a>
+ <div class="api">
+    <div class="api-entry">mono_image_addref</div>
+
+    <div class="prototype">void
+mono_image_addref (MonoImage *image)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>image:</i></dt><dd> The image file we wish to add a reference to</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	  Increases the reference count of an image.
+
+</div> <a name="api:mono_image_load_file_for_image"></a>
+ <div class="api">
+    <div class="api-entry">mono_image_load_file_for_image</div>
+
+    <div class="prototype">Prototype: mono_image_load_file_for_image</div>
+<p />
+
+
+</div><h3>Image Information</h3>
+
+ <a name="api:mono_image_get_guid"></a>
+ <div class="api">
+    <div class="api-entry">mono_image_get_guid</div>
+
+    <div class="prototype">Prototype: mono_image_get_guid</div>
+<p />
+
+</div> <a name="api:mono_image_get_assembly"></a>
+ <div class="api">
+    <div class="api-entry">mono_image_get_assembly</div>
+
+    <div class="prototype">MonoAssembly* 
+mono_image_get_assembly (MonoImage *image)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>image:</i></dt><dd> the MonoImage.</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  the assembly that holds this image.
+</blockquote>
+<b>Remarks</b>
+<p />	 
+	 Use this routine to get the assembly that owns this image.
+	
+
+</div> <a name="api:mono_image_get_entry_point"></a>
+ <div class="api">
+    <div class="api-entry">mono_image_get_entry_point</div>
+
+    <div class="prototype">guint32
+mono_image_get_entry_point (MonoImage *image)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>image:</i></dt><dd> the image where the entry point will be looked up.</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  the token for the entry point method in the image
+</blockquote>
+<b>Remarks</b>
+<p />	 
+	 Use this routine to determine the metadata token for method that
+	 has been flagged as the entry point.
+	
+
+</div> <a name="api:mono_image_get_filename"></a>
+ <div class="api">
+    <div class="api-entry">mono_image_get_filename</div>
+
+    <div class="prototype">const char*
+mono_image_get_filename (MonoImage *image)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>image:</i></dt><dd> a MonoImage</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  the filename.
+</blockquote>
+<b>Remarks</b>
+<p />	 
+	 Used to get the filename that hold the actual MonoImage
+	
+
+</div> <a name="api:mono_image_get_name"></a>
+ <div class="api">
+    <div class="api-entry">mono_image_get_name</div>
+
+    <div class="prototype">const char*
+mono_image_get_name (MonoImage *image)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>name:</i></dt><dd> a MonoImage</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  the name of the assembly.
+</blockquote>
+
+</div> <a name="api:mono_image_get_resource"></a>
+ <div class="api">
+    <div class="api-entry">mono_image_get_resource</div>
+
+    <div class="prototype">const char*
+mono_image_get_resource (MonoImage *image, guint32 offset, guint32 *size)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>image:</i></dt><dd> the image where the resource will be looked up.</dd><dt><i>offset:</i></dt><dd> The offset to add to the resource</dd><dt><i>size:</i></dt><dd> a pointer to an int where the size of the resource will be stored</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  the pointer to the resource whose offset is <i>offset</i>.
+</blockquote>
+<b>Remarks</b>
+<p />	 
+	 This is a low-level routine that fetches a resource from the
+	 metadata that starts at a given <i>offset</i>.  The <i>size</i> parameter is
+	 filled with the data field as encoded in the metadata.
+	
+
+</div> <a name="api:mono_image_get_table_info"></a>
+ <div class="api">
+    <div class="api-entry">mono_image_get_table_info</div>
+
+    <div class="prototype">Prototype: mono_image_get_table_info</div>
+<p />
+
+</div> <a name="api:mono_image_get_table_rows"></a>
+ <div class="api">
+    <div class="api-entry">mono_image_get_table_rows</div>
+
+    <div class="prototype">Prototype: mono_image_get_table_rows</div>
+<p />
+
+</div> <a name="api:mono_image_is_dynamic"></a>
+ <div class="api">
+    <div class="api-entry">mono_image_is_dynamic</div>
+
+    <div class="prototype">gboolean
+mono_image_is_dynamic (MonoImage *image)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>image:</i></dt><dd> the MonoImage</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  TRUE if the image was created dynamically, FALSE if not.
+</blockquote>
+<b>Remarks</b>
+<p />	 
+	 Determines if the given image was created dynamically through the
+	 System.Reflection.Emit API
+	
+
+</div> <a name="api:mono_image_loaded_by_guid"></a>
+ <div class="api">
+    <div class="api-entry">mono_image_loaded_by_guid</div>
+
+    <div class="prototype">Prototype: mono_image_loaded_by_guid</div>
+<p />
+
+</div> <a name="api:mono_image_loaded"></a>
+ <div class="api">
+    <div class="api-entry">mono_image_loaded</div>
+
+    <div class="prototype">MonoImage*
+mono_image_loaded (const char *name)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>name:</i></dt><dd> name of the image to load</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  the loaded MonoImage, or NULL on failure.
+</blockquote>
+<b>Remarks</b>
+<p />	 
+	 This routine ensures that the given image is loaded.
+	
+
+</div> <a name="api:mono_image_lookup_resource"></a>
+ <div class="api">
+    <div class="api-entry">mono_image_lookup_resource</div>
+
+    <div class="prototype">gpointer
+mono_image_lookup_resource (MonoImage *image, guint32 res_id, guint32 lang_id, gunichar2 *name)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>image:</i></dt><dd> the image to look up the resource in</dd><dt><i>res_id:</i></dt><dd> A MONO_PE_RESOURCE_ID_ that represents the resource ID to lookup.</dd><dt><i>lang_id:</i></dt><dd> The language id.</dd><dt><i>name:</i></dt><dd> the resource name to lookup.</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  NULL if not found, otherwise a pointer to the in-memory representation
+
+	 of the given resource. The caller should free it using g_free () when no longer
+	 needed.</blockquote>
+
+</div> <a name="api:mono_image_strerror"></a>
+ <div class="api">
+    <div class="api-entry">mono_image_strerror</div>
+
+    <div class="prototype">const char *
+mono_image_strerror (MonoImageOpenStatus status)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>status:</i></dt><dd> an code indicating the result from a recent operation</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  a string describing the error
+</blockquote>
+
+
+</div><h3>Public Keys, Strong Names and Certificates</h3>
+
+ <a name="api:mono_image_strong_name_position"></a>
+ <div class="api">
+    <div class="api-entry">mono_image_strong_name_position</div>
+
+    <div class="prototype">guint32
+mono_image_strong_name_position (MonoImage *image, guint32 *size)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>image:</i></dt><dd> a MonoImage</dd><dt><i>size:</i></dt><dd> a guint32 pointer, or NULL.</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  the position within the image file where the strong name
+
+	 is stored.</blockquote>
+<b>Remarks</b>
+<p />	 
+	 If the image has a strong name, and <i>size</i> is not NULL, the value
+	 pointed to by size will have the size of the strong name.
+	
+
+</div> <a name="api:mono_image_get_public_key"></a>
+ <div class="api">
+    <div class="api-entry">mono_image_get_public_key</div>
+
+    <div class="prototype">const char*
+mono_image_get_public_key (MonoImage *image, guint32 *size)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>image:</i></dt><dd> a MonoImage</dd><dt><i>size:</i></dt><dd> a guint32 pointer, or NULL.</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  NULL if the image does not have a public key, or a pointer
+
+	 to the public key.</blockquote>
+<b>Remarks</b>
+<p />	 
+	 This is used to obtain the public key in the <i>image</i>.
+	
+<p />
+	 If the image has a public key, and <i>size</i> is not NULL, the value
+	 pointed to by size will have the size of the public key.
+	
+<p />
+
+</div> <a name="api:mono_image_get_strong_name"></a>
+ <div class="api">
+    <div class="api-entry">mono_image_get_strong_name</div>
+
+    <div class="prototype">const char*
+mono_image_get_strong_name (MonoImage *image, guint32 *size)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>image:</i></dt><dd> a MonoImage</dd><dt><i>size:</i></dt><dd> a guint32 pointer, or NULL.</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  NULL if the image does not have a strong name, or a
+
+	 pointer to the public key.</blockquote>
+<b>Remarks</b>
+<p />	 
+	 If the image has a strong name, and <i>size</i> is not NULL, the value
+	 pointed to by size will have the size of the strong name.
+	
+
+</div> <a name="api:mono_image_has_authenticode_entry"></a>
+ <div class="api">
+    <div class="api-entry">mono_image_has_authenticode_entry</div>
+
+    <div class="prototype">gboolean
+mono_image_has_authenticode_entry (MonoImage *image)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>image:</i></dt><dd> the MonoImage</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  TRUE if the image contains an authenticode entry in the PE
+
+	 directory.</blockquote>
+<b>Remarks</b>
+<p />	 
+	 Use this routine to determine if the image has a Authenticode
+	 Certificate Table.
+	
+
+
+</div><h3>Low-level features</h3>
+
+ <a name="api:mono_image_rva_map"></a>
+ <div class="api">
+    <div class="api-entry">mono_image_rva_map</div>
+
+    <div class="prototype">Prototype: mono_image_rva_map</div>
+<p />
+
+</div> <a name="api:mono_image_ensure_section_idx"></a>
+ <div class="api">
+    <div class="api-entry">mono_image_ensure_section_idx</div>
+
+    <div class="prototype">int
+mono_image_ensure_section_idx (MonoImage *image, int section)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>image:</i></dt><dd> The image we are operating on</dd><dt><i>section:</i></dt><dd> section number that we will load/map into memory</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  TRUE on success
+</blockquote>
+<b>Remarks</b>
+<p />	 
+	 This routine makes sure that we have an in-memory copy of
+	 an image section (.text, .rsrc, .data).
+	
+
+</div></body>
+</html>
+</span>
\ No newline at end of file
diff --git a/docs/deploy/mono-api-internal.html b/docs/deploy/mono-api-internal.html
new file mode 100644
index 0000000..eb3b612
--- /dev/null
+++ b/docs/deploy/mono-api-internal.html
@@ -0,0 +1,584 @@
+<?xml version="1.0" encoding="utf-8"?><span>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+   <title>mono-api-internal.html</title>
+   <style type="text/css">
+
+
+   h3 { 
+       font-size: 18px;
+       padding-bottom: 4pt;
+       border-bottom: 2px solid #dddddd;
+   }
+       
+   .api {
+     border: 1px solid;
+     padding: 10pt;
+     margin: 10pt;
+   } 
+
+   .api-entry { 
+       border-bottom: none;
+       font-size: 18px;
+   }
+
+   .prototype {
+     border: 1px solid;
+     background-color: #f2f2f2;
+     padding: 5pt;
+     margin-top: 5pt;
+     margin-bottom: 5pt;  
+   } 
+
+   .header {
+     border: 1px solid;
+     padding: 0 0 5pt 5pt;
+     margin: 10pt;
+     white-space: pre;
+       font-family: monospace;
+   }
+    
+   .code {
+     border: 1px solid;
+     padding: 0 0 5pt 5pt;
+     margin: 10pt;
+     white-space: pre;
+       font-family: monospace;
+   }
+   
+
+</style>
+</head>
+<body>
+<h1>Mono Internals</h1>
+
+	<p />This section documents some of the internal APIs used
+	inside Mono that developers extending or altering Mono might
+	want to use.
+
+<h2>Marshalling functions</h2>
+
+ <a name="api:mono_marshal_alloc"></a>
+ <div class="api">
+    <div class="api-entry">mono_marshal_alloc</div>
+
+    <div class="prototype">Prototype: mono_marshal_alloc</div>
+<p />
+
+</div> <a name="api:mono_marshal_asany"></a>
+ <div class="api">
+    <div class="api-entry">mono_marshal_asany</div>
+
+    <div class="prototype">Prototype: mono_marshal_asany</div>
+<p />
+
+</div> <a name="api:mono_marshal_free_array"></a>
+ <div class="api">
+    <div class="api-entry">mono_marshal_free_array</div>
+
+    <div class="prototype">Prototype: mono_marshal_free_array</div>
+<p />
+
+</div> <a name="api:mono_marshal_free_asany"></a>
+ <div class="api">
+    <div class="api-entry">mono_marshal_free_asany</div>
+
+    <div class="prototype">Prototype: mono_marshal_free_asany</div>
+<p />
+
+</div> <a name="api:mono_marshal_free"></a>
+ <div class="api">
+    <div class="api-entry">mono_marshal_free</div>
+
+    <div class="prototype">Prototype: mono_marshal_free</div>
+<p />
+
+</div> <a name="api:mono_marshal_get_castclass"></a>
+ <div class="api">
+    <div class="api-entry">mono_marshal_get_castclass</div>
+
+    <div class="prototype">Prototype: mono_marshal_get_castclass</div>
+<p />
+
+</div> <a name="api:mono_marshal_get_delegate_begin_invoke"></a>
+ <div class="api">
+    <div class="api-entry">mono_marshal_get_delegate_begin_invoke</div>
+
+    <div class="prototype">Prototype: mono_marshal_get_delegate_begin_invoke</div>
+<p />
+
+</div> <a name="api:mono_marshal_get_delegate_end_invoke"></a>
+ <div class="api">
+    <div class="api-entry">mono_marshal_get_delegate_end_invoke</div>
+
+    <div class="prototype">Prototype: mono_marshal_get_delegate_end_invoke</div>
+<p />
+
+</div> <a name="api:mono_marshal_get_delegate_invoke"></a>
+ <div class="api">
+    <div class="api-entry">mono_marshal_get_delegate_invoke</div>
+
+    <div class="prototype">Prototype: mono_marshal_get_delegate_invoke</div>
+<p />
+
+</div> <a name="api:mono_marshal_get_icall_wrapper"></a>
+ <div class="api">
+    <div class="api-entry">mono_marshal_get_icall_wrapper</div>
+
+    <div class="prototype">Prototype: mono_marshal_get_icall_wrapper</div>
+<p />
+
+</div> <a name="api:mono_marshal_get_isinst"></a>
+ <div class="api">
+    <div class="api-entry">mono_marshal_get_isinst</div>
+
+    <div class="prototype">Prototype: mono_marshal_get_isinst</div>
+<p />
+
+</div> <a name="api:mono_marshal_get_ldfld_remote_wrapper"></a>
+ <div class="api">
+    <div class="api-entry">mono_marshal_get_ldfld_remote_wrapper</div>
+
+    <div class="prototype">Prototype: mono_marshal_get_ldfld_remote_wrapper</div>
+<p />
+
+</div> <a name="api:mono_marshal_get_ldfld_wrapper"></a>
+ <div class="api">
+    <div class="api-entry">mono_marshal_get_ldfld_wrapper</div>
+
+    <div class="prototype">Prototype: mono_marshal_get_ldfld_wrapper</div>
+<p />
+
+</div> <a name="api:mono_marshal_get_managed_wrapper"></a>
+ <div class="api">
+    <div class="api-entry">mono_marshal_get_managed_wrapper</div>
+
+    <div class="prototype">Prototype: mono_marshal_get_managed_wrapper</div>
+<p />
+
+</div> <a name="api:mono_marshal_get_native_wrapper"></a>
+ <div class="api">
+    <div class="api-entry">mono_marshal_get_native_wrapper</div>
+
+    <div class="prototype">MonoMethod*
+mono_marshal_get_native_wrapper (MonoMethod *method, gboolean check_exceptions, gboolean aot)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>method:</i></dt><dd> The MonoMethod to wrap.</dd><dt><i>check_exceptions:</i></dt><dd> Whenever to check for pending exceptions</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 generates IL code for the pinvoke wrapper (the generated method
+	 calls the unmanaged code in piinfo->addr)
+
+</div> <a name="api:mono_marshal_get_proxy_cancast"></a>
+ <div class="api">
+    <div class="api-entry">mono_marshal_get_proxy_cancast</div>
+
+    <div class="prototype">Prototype: mono_marshal_get_proxy_cancast</div>
+<p />
+
+</div> <a name="api:mono_marshal_get_ptr_to_struct"></a>
+ <div class="api">
+    <div class="api-entry">mono_marshal_get_ptr_to_struct</div>
+
+    <div class="prototype">MonoMethod*
+mono_marshal_get_ptr_to_struct (MonoClass *klass)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>klass:</i></dt><dd></dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 generates IL code for PtrToStructure (IntPtr src, object structure)
+
+</div> <a name="api:mono_marshal_get_remoting_invoke_for_target"></a>
+ <div class="api">
+    <div class="api-entry">mono_marshal_get_remoting_invoke_for_target</div>
+
+    <div class="prototype">Prototype: mono_marshal_get_remoting_invoke_for_target</div>
+<p />
+
+</div> <a name="api:mono_marshal_get_remoting_invoke"></a>
+ <div class="api">
+    <div class="api-entry">mono_marshal_get_remoting_invoke</div>
+
+    <div class="prototype">Prototype: mono_marshal_get_remoting_invoke</div>
+<p />
+
+</div> <a name="api:mono_marshal_get_remoting_invoke_with_check"></a>
+ <div class="api">
+    <div class="api-entry">mono_marshal_get_remoting_invoke_with_check</div>
+
+    <div class="prototype">Prototype: mono_marshal_get_remoting_invoke_with_check</div>
+<p />
+
+</div> <a name="api:mono_marshal_get_runtime_invoke"></a>
+ <div class="api">
+    <div class="api-entry">mono_marshal_get_runtime_invoke</div>
+
+    <div class="prototype">Prototype: mono_marshal_get_runtime_invoke</div>
+<p />
+
+</div> <a name="api:mono_marshal_get_stelemref"></a>
+ <div class="api">
+    <div class="api-entry">mono_marshal_get_stelemref</div>
+
+    <div class="prototype">Prototype: mono_marshal_get_stelemref</div>
+<p />
+
+</div> <a name="api:mono_marshal_get_stfld_remote_wrapper"></a>
+ <div class="api">
+    <div class="api-entry">mono_marshal_get_stfld_remote_wrapper</div>
+
+    <div class="prototype">Prototype: mono_marshal_get_stfld_remote_wrapper</div>
+<p />
+
+</div> <a name="api:mono_marshal_get_stfld_wrapper"></a>
+ <div class="api">
+    <div class="api-entry">mono_marshal_get_stfld_wrapper</div>
+
+    <div class="prototype">Prototype: mono_marshal_get_stfld_wrapper</div>
+<p />
+
+</div> <a name="api:mono_marshal_get_struct_to_ptr"></a>
+ <div class="api">
+    <div class="api-entry">mono_marshal_get_struct_to_ptr</div>
+
+    <div class="prototype">MonoMethod*
+mono_marshal_get_struct_to_ptr (MonoClass *klass)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>klass:</i></dt><dd></dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 generates IL code for StructureToPtr (object structure, IntPtr ptr, bool fDeleteOld)
+
+</div> <a name="api:mono_marshal_get_synchronized_wrapper"></a>
+ <div class="api">
+    <div class="api-entry">mono_marshal_get_synchronized_wrapper</div>
+
+    <div class="prototype">Prototype: mono_marshal_get_synchronized_wrapper</div>
+<p />
+
+</div> <a name="api:mono_marshal_get_unbox_wrapper"></a>
+ <div class="api">
+    <div class="api-entry">mono_marshal_get_unbox_wrapper</div>
+
+    <div class="prototype">Prototype: mono_marshal_get_unbox_wrapper</div>
+<p />
+
+</div> <a name="api:mono_marshal_get_xappdomain_invoke"></a>
+ <div class="api">
+    <div class="api-entry">mono_marshal_get_xappdomain_invoke</div>
+
+    <div class="prototype">Prototype: mono_marshal_get_xappdomain_invoke</div>
+<p />
+
+</div> <a name="api:mono_marshal_load_type_info"></a>
+ <div class="api">
+    <div class="api-entry">mono_marshal_load_type_info</div>
+
+    <div class="prototype">MonoMarshalType*
+mono_marshal_load_type_info (MonoClass* klass)
+
+</div>
+<p />
+<b>Remarks</b>
+<p />	 
+	  Initialize klass->marshal_info using information from metadata. This function can
+	 recursively call itself, and the caller is responsible to avoid that by calling 
+	 mono_marshal_is_loading_type_info () beforehand.
+	
+	 LOCKING: Acquires the loader lock.
+
+</div> <a name="api:mono_marshal_method_from_wrapper"></a>
+ <div class="api">
+    <div class="api-entry">mono_marshal_method_from_wrapper</div>
+
+    <div class="prototype">Prototype: mono_marshal_method_from_wrapper</div>
+<p />
+
+</div> <a name="api:mono_marshal_realloc"></a>
+ <div class="api">
+    <div class="api-entry">mono_marshal_realloc</div>
+
+    <div class="prototype">Prototype: mono_marshal_realloc</div>
+<p />
+
+</div> <a name="api:mono_marshal_set_last_error"></a>
+ <div class="api">
+    <div class="api-entry">mono_marshal_set_last_error</div>
+
+    <div class="prototype">void
+mono_marshal_set_last_error (void)
+
+</div>
+<p />
+<b>Remarks</b>
+<p />	 
+	 This function is invoked to set the last error value from a P/Invoke call
+	 which has SetLastError set.
+
+</div> <a name="api:mono_marshal_type_size"></a>
+ <div class="api">
+    <div class="api-entry">mono_marshal_type_size</div>
+
+    <div class="prototype">Prototype: mono_marshal_type_size</div>
+<p />
+
+
+</div><h2>Metadata Loading Errors</h2>
+
+	<p />The routines in this section are used to cope with errors
+	during metadata loading.  Errors in metadata handling can
+	happen for many reason, and these include (this is not an
+	exhaustive list).
+
+	<ul>
+		<li>An assembly referenced is missing.
+		<li>Fields referenced are missing.
+		<li>Methods referenced are missing.
+	</li></li></li></ul>
+
+	<p />The <tt>mono_loader_set_*</tt> routines are invoked during
+	metadata loading to flag that an error has happened.  The
+	class loading errros are flagged in a per-thread basis.
+
+	<p />In various spots in the runtime the
+	<tt>mono_loader_get_last_error</tt> routine is called to check
+	if there was a problem, and then errors are propagated upwards
+	on the stack until we reach a point where an exception can be
+	raised and no runtime locks are held.
+
+	<p />The <tt>mono_loader_error_prepare_exception</tt> takes a
+	<tt>MonoLoaderError</tt> structure (the value returned from
+	<tt>mono_loader_get_last_error</tt>), turns that into an
+	exception and clears the error condition from the current
+	thread. 
+	
+ <a name="api:mono_loader_set_error_field_load"></a>
+ <div class="api">
+    <div class="api-entry">mono_loader_set_error_field_load</div>
+
+    <div class="prototype">Prototype: mono_loader_set_error_field_load</div>
+<p />
+
+</div> <a name="api:mono_loader_set_error_method_load"></a>
+ <div class="api">
+    <div class="api-entry">mono_loader_set_error_method_load</div>
+
+    <div class="prototype">Prototype: mono_loader_set_error_method_load</div>
+<p />
+
+</div> <a name="api:mono_loader_set_error_type_load"></a>
+ <div class="api">
+    <div class="api-entry">mono_loader_set_error_type_load</div>
+
+    <div class="prototype">void
+mono_loader_set_error_type_load (const char *class_name, const char *assembly_name)
+
+</div>
+<p />
+<b>Remarks</b>
+<p />	 
+	 Set the loader error for this thread. 
+
+
+</div> <a name="api:mono_loader_get_last_error"></a>
+ <div class="api">
+    <div class="api-entry">mono_loader_get_last_error</div>
+
+    <div class="prototype">Prototype: mono_loader_get_last_error</div>
+<p />
+
+</div> <a name="api:mono_loader_clear_error"></a>
+ <div class="api">
+    <div class="api-entry">mono_loader_clear_error</div>
+
+    <div class="prototype">void
+mono_loader_clear_error (void)
+
+</div>
+<p />
+<b>Remarks</b>
+<p />	 
+	 Disposes any loader error messages on this thread
+
+</div> <a name="api:mono_loader_error_prepare_exception"></a>
+ <div class="api">
+    <div class="api-entry">mono_loader_error_prepare_exception</div>
+
+    <div class="prototype">MonoException*
+mono_loader_error_prepare_exception (MonoLoaderError *error)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>error:</i></dt><dd> The MonoLoaderError to turn into an exception</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 This turns a MonoLoaderError into an exception that can be thrown
+	 and resets the Mono Loader Error state during this process.
+	
+
+
+</div><h2>Metadata Loader Locking: Internals</h2>
+
+	<p />The locking functions here are used by code in class.c and
+	metadata.c to lock access to the shared hashtables inside the
+	MonoImage.
+	
+ <a name="api:mono_loader_lock"></a>
+ <div class="api">
+    <div class="api-entry">mono_loader_lock</div>
+
+    <div class="prototype">void
+mono_loader_lock (void)
+
+</div>
+<p />
+<b>Remarks</b>
+<p />	 
+	 See docs/thread-safety.txt for the locking strategy.
+
+</div> <a name="api:mono_loader_unlock"></a>
+ <div class="api">
+    <div class="api-entry">mono_loader_unlock</div>
+
+    <div class="prototype">Prototype: mono_loader_unlock</div>
+<p />
+
+
+</div><h2>Garbage Collector Internal Interface</h2>
+
+	<p />The internal interface of the Mono GC is the interface used
+	between the runtime engine and the garbage collector.
+	
+ <a name="api:mono_gc_disable"></a>
+ <div class="api">
+    <div class="api-entry">mono_gc_disable</div>
+
+    <div class="prototype">Prototype: mono_gc_disable</div>
+<p />
+
+</div> <a name="api:mono_gc_enable"></a>
+ <div class="api">
+    <div class="api-entry">mono_gc_enable</div>
+
+    <div class="prototype">Prototype: mono_gc_enable</div>
+<p />
+
+</div> <a name="api:mono_gc_is_finalizer_thread"></a>
+ <div class="api">
+    <div class="api-entry">mono_gc_is_finalizer_thread</div>
+
+    <div class="prototype">gboolean
+mono_gc_is_finalizer_thread (MonoThread *thread)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>thread:</i></dt><dd> the thread to test.</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 In Mono objects are finalized asynchronously on a separate thread.
+	 This routine tests whether the <i>thread</i> argument represents the
+	 finalization thread.
+	
+<p />
+	 Returns true if <i>thread</i> is the finalization thread.
+
+</div> <a name="api:mono_gc_out_of_memory"></a>
+ <div class="api">
+    <div class="api-entry">mono_gc_out_of_memory</div>
+
+    <div class="prototype">Prototype: mono_gc_out_of_memory</div>
+<p />
+
+</div> <a name="api:mono_gc_start_world"></a>
+ <div class="api">
+    <div class="api-entry">mono_gc_start_world</div>
+
+    <div class="prototype">Prototype: mono_gc_start_world</div>
+<p />
+
+</div> <a name="api:mono_gc_stop_world"></a>
+ <div class="api">
+    <div class="api-entry">mono_gc_stop_world</div>
+
+    <div class="prototype">Prototype: mono_gc_stop_world</div>
+<p />
+
+</div> <a name="api:mono_gc_alloc_fixed"></a>
+ <div class="api">
+    <div class="api-entry">mono_gc_alloc_fixed</div>
+
+    <div class="prototype">Prototype: mono_gc_alloc_fixed</div>
+<p />
+
+</div> <a name="api:mono_gc_enable_events"></a>
+ <div class="api">
+    <div class="api-entry">mono_gc_enable_events</div>
+
+    <div class="prototype">Prototype: mono_gc_enable_events</div>
+<p />
+
+</div> <a name="api:mono_gc_free_fixed"></a>
+ <div class="api">
+    <div class="api-entry">mono_gc_free_fixed</div>
+
+    <div class="prototype">Prototype: mono_gc_free_fixed</div>
+<p />
+
+</div> <a name="api:mono_gc_make_descr_from_bitmap"></a>
+ <div class="api">
+    <div class="api-entry">mono_gc_make_descr_from_bitmap</div>
+
+    <div class="prototype">Prototype: mono_gc_make_descr_from_bitmap</div>
+<p />
+
+
+
+</div> <a name="api:mono_gc_base_init"></a>
+ <div class="api">
+    <div class="api-entry">mono_gc_base_init</div>
+
+    <div class="prototype">Prototype: mono_gc_base_init</div>
+<p />
+
+</div> <a name="api:mono_gc_invoke_finalizers"></a>
+ <div class="api">
+    <div class="api-entry">mono_gc_invoke_finalizers</div>
+
+    <div class="prototype">Prototype: mono_gc_invoke_finalizers</div>
+<p />
+
+</div> <a name="api:mono_gc_is_gc_thread"></a>
+ <div class="api">
+    <div class="api-entry">mono_gc_is_gc_thread</div>
+
+    <div class="prototype">Prototype: mono_gc_is_gc_thread</div>
+<p />
+
+</div> <a name="api:mono_gc_pending_finalizers"></a>
+ <div class="api">
+    <div class="api-entry">mono_gc_pending_finalizers</div>
+
+    <div class="prototype">Prototype: mono_gc_pending_finalizers</div>
+<p />
+
+</div> <a name="api:mono_gc_register_thread"></a>
+ <div class="api">
+    <div class="api-entry">mono_gc_register_thread</div>
+
+    <div class="prototype">Prototype: mono_gc_register_thread</div>
+<p />
+
+</div></body>
+</html>
+</span>
\ No newline at end of file
diff --git a/docs/deploy/mono-api-jit.html b/docs/deploy/mono-api-jit.html
new file mode 100644
index 0000000..471c46c
--- /dev/null
+++ b/docs/deploy/mono-api-jit.html
@@ -0,0 +1,141 @@
+<?xml version="1.0" encoding="utf-8"?><span>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+   <title>mono-api-jit.html</title>
+   <style type="text/css">
+
+
+   h3 { 
+       font-size: 18px;
+       padding-bottom: 4pt;
+       border-bottom: 2px solid #dddddd;
+   }
+       
+   .api {
+     border: 1px solid;
+     padding: 10pt;
+     margin: 10pt;
+   } 
+
+   .api-entry { 
+       border-bottom: none;
+       font-size: 18px;
+   }
+
+   .prototype {
+     border: 1px solid;
+     background-color: #f2f2f2;
+     padding: 5pt;
+     margin-top: 5pt;
+     margin-bottom: 5pt;  
+   } 
+
+   .header {
+     border: 1px solid;
+     padding: 0 0 5pt 5pt;
+     margin: 10pt;
+     white-space: pre;
+       font-family: monospace;
+   }
+    
+   .code {
+     border: 1px solid;
+     padding: 0 0 5pt 5pt;
+     margin: 10pt;
+     white-space: pre;
+       font-family: monospace;
+   }
+   
+
+</style>
+</head>
+<body>
+<h2>Synopsis</h2>
+
+<div class="header">
+G_GNUC_UNUSED char * <a href="#api:mono_pmip">mono_pmip</a>                        (void *ip);
+void                 <a href="#api:mono_print_method_from_ip">mono_print_method_from_ip</a>        (void *ip);
+                     <a href="#api:mono_print_thread_dump"></a>                                 
+void                 <a href="#api:mono_threads_request_thread_dump">mono_threads_request_thread_dump</a> (void);
+                     <a href="#api:mono_inst_name"></a>                                 
+
+</div>
+
+<h3>Useful Debugging Functions</h3>
+
+	<p />These functions are useful when running the Mono VM inside
+	a debugger.
+
+ <a name="api:mono_pmip"></a>
+ <div class="api">
+    <div class="api-entry">mono_pmip</div>
+
+    <div class="prototype">G_GNUC_UNUSED char *
+mono_pmip (void *ip)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>ip:</i></dt><dd> an instruction pointer address</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  the name of the method at address <i>ip</i>.
+</blockquote>
+<b>Remarks</b>
+<p />	 
+	 This method is used from a debugger to get the name of the
+	 method at address <i>ip</i>.   This routine is typically invoked from
+	 a debugger like this:
+	
+	 (gdb) print mono_pmip ($pc)
+	
+
+</div> <a name="api:mono_print_method_from_ip"></a>
+ <div class="api">
+    <div class="api-entry">mono_print_method_from_ip</div>
+
+    <div class="prototype">#ifdef __GNUC__
+/* Prevent the linker from optimizing this away in embedding setups to help debugging */
+ __attribute__((used))
+#endif
+void
+mono_print_method_from_ip (void *ip)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>ip:</i></dt><dd> an instruction pointer address</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 This method is used from a debugger to get the name of the
+	 method at address <i>ip</i>.
+	
+	 This prints the name of the method at address <i>ip</i> in the standard
+	 output.  Unlike mono_pmip which returns a string, this routine
+	 prints the value on the standard output. 
+
+</div> <a name="api:mono_print_thread_dump"></a>
+ <div class="api">
+    <div class="api-entry">mono_print_thread_dump</div>
+
+    <div class="prototype">Prototype: mono_print_thread_dump</div>
+<p />
+
+</div> <a name="api:mono_threads_request_thread_dump"></a>
+ <div class="api">
+    <div class="api-entry">mono_threads_request_thread_dump</div>
+
+    <div class="prototype">void
+mono_threads_request_thread_dump (void)
+
+</div>
+<p />
+<b>Remarks</b>
+<p />	 
+	   Ask all threads except the current to print their stacktrace to stdout.
+
+
+</div><h3>Helper Tools For Native Ports</h3>
+
+</body>
+</html>
+</span>
\ No newline at end of file
diff --git a/docs/deploy/mono-api-jitinternal.html b/docs/deploy/mono-api-jitinternal.html
new file mode 100644
index 0000000..476c9d7
--- /dev/null
+++ b/docs/deploy/mono-api-jitinternal.html
@@ -0,0 +1,247 @@
+<?xml version="1.0" encoding="utf-8"?><span>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+   <title>mono-api-jitinternal.html</title>
+   <style type="text/css">
+
+
+   h3 { 
+       font-size: 18px;
+       padding-bottom: 4pt;
+       border-bottom: 2px solid #dddddd;
+   }
+       
+   .api {
+     border: 1px solid;
+     padding: 10pt;
+     margin: 10pt;
+   } 
+
+   .api-entry { 
+       border-bottom: none;
+       font-size: 18px;
+   }
+
+   .prototype {
+     border: 1px solid;
+     background-color: #f2f2f2;
+     padding: 5pt;
+     margin-top: 5pt;
+     margin-bottom: 5pt;  
+   } 
+
+   .header {
+     border: 1px solid;
+     padding: 0 0 5pt 5pt;
+     margin: 10pt;
+     white-space: pre;
+       font-family: monospace;
+   }
+    
+   .code {
+     border: 1px solid;
+     padding: 0 0 5pt 5pt;
+     margin: 10pt;
+     white-space: pre;
+       font-family: monospace;
+   }
+   
+
+</style>
+</head>
+<body>
+<h1>Notification Interface</h1>
+
+	<p />This is an internal profiler interface.   In general, users
+	would not be using this interface, but would be using the
+	profiler interface. 
+
+	<p />These methods must be called to notify the profiler of an
+	event that must be recorded.   Mono's JIT engine currently
+	calls these routines, but if you are extending Mono in some
+	way these are the methods that you might invoke to notify the
+	profiler of an event.
+
+ <a name="api:mono_profiler_load"></a>
+ <div class="api">
+    <div class="api-entry">mono_profiler_load</div>
+
+    <div class="prototype">void 
+mono_profiler_load (const char *desc)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>desc:</i></dt><dd> arguments to configure the profiler</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 Invoke this method to initialize the profiler.   This will drive the
+	 loading of the internal ("default") or any external profilers.
+	
+	 This routine is invoked by Mono's driver, but must be called manually
+	 if you embed Mono into your application.
+
+</div> <a name="api:mono_profiler_allocation"></a>
+ <div class="api">
+    <div class="api-entry">mono_profiler_allocation</div>
+
+    <div class="prototype">Prototype: mono_profiler_allocation</div>
+<p />
+
+</div> <a name="api:mono_profiler_stat_hit"></a>
+ <div class="api">
+    <div class="api-entry">mono_profiler_stat_hit</div>
+
+    <div class="prototype">Prototype: mono_profiler_stat_hit</div>
+<p />
+
+</div> <a name="api:mono_profiler_thread_start"></a>
+ <div class="api">
+    <div class="api-entry">mono_profiler_thread_start</div>
+
+    <div class="prototype">Prototype: mono_profiler_thread_start</div>
+<p />
+
+</div> <a name="api:mono_profiler_thread_end"></a>
+ <div class="api">
+    <div class="api-entry">mono_profiler_thread_end</div>
+
+    <div class="prototype">Prototype: mono_profiler_thread_end</div>
+<p />
+
+</div> <a name="api:mono_profiler_appdomain_event"></a>
+ <div class="api">
+    <div class="api-entry">mono_profiler_appdomain_event</div>
+
+    <div class="prototype">Prototype: mono_profiler_appdomain_event</div>
+<p />
+
+</div> <a name="api:mono_profiler_appdomain_loaded"></a>
+ <div class="api">
+    <div class="api-entry">mono_profiler_appdomain_loaded</div>
+
+    <div class="prototype">Prototype: mono_profiler_appdomain_loaded</div>
+<p />
+
+</div> <a name="api:mono_profiler_assembly_event"></a>
+ <div class="api">
+    <div class="api-entry">mono_profiler_assembly_event</div>
+
+    <div class="prototype">Prototype: mono_profiler_assembly_event</div>
+<p />
+
+</div> <a name="api:mono_profiler_assembly_loaded"></a>
+ <div class="api">
+    <div class="api-entry">mono_profiler_assembly_loaded</div>
+
+    <div class="prototype">Prototype: mono_profiler_assembly_loaded</div>
+<p />
+
+</div> <a name="api:mono_profiler_class_event"></a>
+ <div class="api">
+    <div class="api-entry">mono_profiler_class_event</div>
+
+    <div class="prototype">Prototype: mono_profiler_class_event</div>
+<p />
+
+</div> <a name="api:mono_profiler_class_loaded"></a>
+ <div class="api">
+    <div class="api-entry">mono_profiler_class_loaded</div>
+
+    <div class="prototype">Prototype: mono_profiler_class_loaded</div>
+<p />
+
+</div> <a name="api:mono_profiler_code_transition"></a>
+ <div class="api">
+    <div class="api-entry">mono_profiler_code_transition</div>
+
+    <div class="prototype">Prototype: mono_profiler_code_transition</div>
+<p />
+
+</div> <a name="api:mono_profiler_method_end_jit"></a>
+ <div class="api">
+    <div class="api-entry">mono_profiler_method_end_jit</div>
+
+    <div class="prototype">Prototype: mono_profiler_method_end_jit</div>
+<p />
+
+</div> <a name="api:mono_profiler_method_enter"></a>
+ <div class="api">
+    <div class="api-entry">mono_profiler_method_enter</div>
+
+    <div class="prototype">Prototype: mono_profiler_method_enter</div>
+<p />
+
+</div> <a name="api:mono_profiler_method_jit"></a>
+ <div class="api">
+    <div class="api-entry">mono_profiler_method_jit</div>
+
+    <div class="prototype">Prototype: mono_profiler_method_jit</div>
+<p />
+
+</div> <a name="api:mono_profiler_method_leave"></a>
+ <div class="api">
+    <div class="api-entry">mono_profiler_method_leave</div>
+
+    <div class="prototype">Prototype: mono_profiler_method_leave</div>
+<p />
+
+</div> <a name="api:mono_profiler_module_event"></a>
+ <div class="api">
+    <div class="api-entry">mono_profiler_module_event</div>
+
+    <div class="prototype">Prototype: mono_profiler_module_event</div>
+<p />
+
+</div> <a name="api:mono_profiler_module_loaded"></a>
+ <div class="api">
+    <div class="api-entry">mono_profiler_module_loaded</div>
+
+    <div class="prototype">Prototype: mono_profiler_module_loaded</div>
+<p />
+
+</div> <a name="api:mono_profiler_shutdown"></a>
+ <div class="api">
+    <div class="api-entry">mono_profiler_shutdown</div>
+
+    <div class="prototype">Prototype: mono_profiler_shutdown</div>
+<p />
+
+</div> <a name="api:mono_profiler_startup"></a>
+ <div class="api">
+    <div class="api-entry">mono_profiler_startup</div>
+
+    <div class="prototype">Prototype: mono_profiler_startup</div>
+<p />
+
+</div> <a name="api:mono_profiler_gc_event"></a>
+ <div class="api">
+    <div class="api-entry">mono_profiler_gc_event</div>
+
+    <div class="prototype">Prototype: mono_profiler_gc_event</div>
+<p />
+
+</div> <a name="api:mono_profiler_gc_heap_resize"></a>
+ <div class="api">
+    <div class="api-entry">mono_profiler_gc_heap_resize</div>
+
+    <div class="prototype">Prototype: mono_profiler_gc_heap_resize</div>
+<p />
+
+</div> <a name="api:mono_profiler_gc_event"></a>
+ <div class="api">
+    <div class="api-entry">mono_profiler_gc_event</div>
+
+    <div class="prototype">Prototype: mono_profiler_gc_event</div>
+<p />
+
+</div> <a name="api:mono_profiler_gc_heap_resize"></a>
+ <div class="api">
+    <div class="api-entry">mono_profiler_gc_heap_resize</div>
+
+    <div class="prototype">Prototype: mono_profiler_gc_heap_resize</div>
+<p />
+
+</div></body>
+</html>
+</span>
\ No newline at end of file
diff --git a/docs/deploy/mono-api-marshal.html b/docs/deploy/mono-api-marshal.html
new file mode 100644
index 0000000..22d1b8f
--- /dev/null
+++ b/docs/deploy/mono-api-marshal.html
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="utf-8"?><span>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+   <title>mono-api-marshal.html</title>
+   <style type="text/css">
+
+
+   h3 { 
+       font-size: 18px;
+       padding-bottom: 4pt;
+       border-bottom: 2px solid #dddddd;
+   }
+       
+   .api {
+     border: 1px solid;
+     padding: 10pt;
+     margin: 10pt;
+   } 
+
+   .api-entry { 
+       border-bottom: none;
+       font-size: 18px;
+   }
+
+   .prototype {
+     border: 1px solid;
+     background-color: #f2f2f2;
+     padding: 5pt;
+     margin-top: 5pt;
+     margin-bottom: 5pt;  
+   } 
+
+   .header {
+     border: 1px solid;
+     padding: 0 0 5pt 5pt;
+     margin: 10pt;
+     white-space: pre;
+       font-family: monospace;
+   }
+    
+   .code {
+     border: 1px solid;
+     padding: 0 0 5pt 5pt;
+     margin: 10pt;
+     white-space: pre;
+       font-family: monospace;
+   }
+   
+
+</style>
+</head>
+<body>
+
+
+ <a name="api:mono_delegate_free_ftnptr"></a>
+ <div class="api">
+    <div class="api-entry">mono_delegate_free_ftnptr</div>
+
+    <div class="prototype">Prototype: mono_delegate_free_ftnptr</div>
+<p />
+
+</div> <a name="api:mono_delegate_to_ftnptr"></a>
+ <div class="api">
+    <div class="api-entry">mono_delegate_to_ftnptr</div>
+
+    <div class="prototype">Prototype: mono_delegate_to_ftnptr</div>
+<p />
+
+</div> <a name="api:mono_ftnptr_to_delegate"></a>
+ <div class="api">
+    <div class="api-entry">mono_ftnptr_to_delegate</div>
+
+    <div class="prototype">Prototype: mono_ftnptr_to_delegate</div>
+<p />
+
+</div></body>
+</html>
+</span>
\ No newline at end of file
diff --git a/docs/deploy/mono-api-metadata.html b/docs/deploy/mono-api-metadata.html
new file mode 100644
index 0000000..39d59d5
--- /dev/null
+++ b/docs/deploy/mono-api-metadata.html
@@ -0,0 +1,1313 @@
+<?xml version="1.0" encoding="utf-8"?><span>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+   <title>mono-api-metadata.html</title>
+   <style type="text/css">
+
+
+   h3 { 
+       font-size: 18px;
+       padding-bottom: 4pt;
+       border-bottom: 2px solid #dddddd;
+   }
+       
+   .api {
+     border: 1px solid;
+     padding: 10pt;
+     margin: 10pt;
+   } 
+
+   .api-entry { 
+       border-bottom: none;
+       font-size: 18px;
+   }
+
+   .prototype {
+     border: 1px solid;
+     background-color: #f2f2f2;
+     padding: 5pt;
+     margin-top: 5pt;
+     margin-bottom: 5pt;  
+   } 
+
+   .header {
+     border: 1px solid;
+     padding: 0 0 5pt 5pt;
+     margin: 10pt;
+     white-space: pre;
+       font-family: monospace;
+   }
+    
+   .code {
+     border: 1px solid;
+     padding: 0 0 5pt 5pt;
+     margin: 10pt;
+     white-space: pre;
+       font-family: monospace;
+   }
+   
+
+</style>
+</head>
+<body>
+<h1>Metadata Reading</h1>
+
+	<p />The Metadata API gives developers low-level access to the
+	information encoded in CLI modules: type and
+	methods definitions encoded in metadata as well as access to
+	the CIL code and embedded resources.
+
+	<p />Managed developers access this information using either the
+	System.Reflection API or a library
+	like <a href="http://www.mono-project.com/Cecil">Cecil</a>.
+
+	<p />To start using the Metadata API it is necessary
+	to <a href="mono-api-assembly.html#cil_assembly_load">open an
+	assembly</a> or a CIL image (a .dll or .exe file) using one of
+	the
+	<a href="mono-api-image.html#cil_image_open">CIL image
+	opening</a> API calls.
+
+<h2>Metadata Heaps</h2>
+
+	<p />ECMA CLI images contain four heaps that store different
+	kinds of information, these are:
+
+	<ul>
+		<li>GUID heap (called #GUID) contains 128-bit GUIDs,
+		you can get pointer to a GUID value by
+		calling <a href="#api:mono_metadata_guid_heap">mono_metadata_guid_heap</a>.
+
+		<li>User string heap (called #US), it contains user
+		visible strings, you can fetch a string from this heap
+		by calling
+		<a href="#api:mono_metadata_user_string">mono_metadata_user_string</a>.
+
+		<li>Blob heap (called #blob), it contains binary
+		blobs of data, you can get a blob
+		by <a href="#api:mono_metadata_blob_heap">mono_metadata_blob_heap</a>.
+		You can determine the size of the blob using
+		the <a href="#api:mono_metadata_decode_blob_size">mono_metadata_decode_blob_size</a>. 
+	
+	</li></li></li></ul>
+
+	<p />The ECMA file format also has an extra section called the
+	"#~" stream, this stream is the one that holds the metadata
+	tables.   There is a high-level API to get access to the
+	contents of this API, described in the
+	section <a href="#metadata-tables">Metadata Tables</a>.
+	
+ <a name="api:mono_metadata_guid_heap"></a>
+ <div class="api">
+    <div class="api-entry">mono_metadata_guid_heap</div>
+
+    <div class="prototype">const char *
+mono_metadata_guid_heap (MonoImage *meta, guint32 index)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>meta:</i></dt><dd> metadata context</dd><dt><i>index:</i></dt><dd> index into the guid heap.</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  an in-memory pointer to the <i>index</i> in the guid heap.
+</blockquote>
+
+</div> <a name="api:mono_metadata_string_heap"></a>
+ <div class="api">
+    <div class="api-entry">mono_metadata_string_heap</div>
+
+    <div class="prototype">const char *
+mono_metadata_string_heap (MonoImage *meta, guint32 index)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>meta:</i></dt><dd> metadata context</dd><dt><i>index:</i></dt><dd> index into the string heap.</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  an in-memory pointer to the <i>index</i> in the string heap.
+</blockquote>
+
+</div> <a name="api:mono_metadata_blob_heap"></a>
+ <div class="api">
+    <div class="api-entry">mono_metadata_blob_heap</div>
+
+    <div class="prototype">const char *
+mono_metadata_blob_heap (MonoImage *meta, guint32 index)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>meta:</i></dt><dd> metadata context</dd><dt><i>index:</i></dt><dd> index into the blob.</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  an in-memory pointer to the <i>index</i> in the Blob heap.
+</blockquote>
+
+</div> <a name="api:mono_metadata_user_string"></a>
+ <div class="api">
+    <div class="api-entry">mono_metadata_user_string</div>
+
+    <div class="prototype">const char *
+mono_metadata_user_string (MonoImage *meta, guint32 index)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>meta:</i></dt><dd> metadata context</dd><dt><i>index:</i></dt><dd> index into the user string heap.</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  an in-memory pointer to the <i>index</i> in the user string heap ("<i>US</i>").
+</blockquote>
+
+</div> <a name="api:mono_metadata_decode_blob_size"></a>
+ <div class="api">
+    <div class="api-entry">mono_metadata_decode_blob_size</div>
+
+    <div class="prototype">guint32
+mono_metadata_decode_blob_size (const char *xptr, const char **rptr)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>ptr:</i></dt><dd> pointer to a blob object</dd><dt><i>rptr:</i></dt><dd> the new position of the pointer</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  the size of the blob object
+</blockquote>
+<b>Remarks</b>
+<p />	 
+	 This decodes a compressed size as described by 23.1.4 (a blob or user string object)
+	
+
+
+<a name="metadata-tables"></a>
+</div><h2>Metadata Tables</h2>
+
+	<p />Metadata is encoded in a number of tables included on every
+	CIL image.   These tables contain type definitions, member
+	definitions and so on, these constants are defined in the ECMA 335
+	specification Partition II section 22.   The following table
+	shows the C constants defined in the Mono runtime and how they
+	map to the equivalent ECMA CLI metadata table:
+
+	<center>
+	<table border="1">
+	  <thead>
+	    <td>
+	       <b>ECMA CLI Table Name</b>
+	    </td>
+	    <td>
+	    <b>C Constant Name</b>
+	    </td>
+	    <td>
+	       <b>Table Schema (Array Size + Columns Constants)</b>
+	    </td>
+	  </thead>
+<td>Assembly</td><td>MONO_TABLE_ASSEMBLY</td><td>
+Array size: 
+MONO_ASSEMBLY_SIZE
+<ul>
+	<li>MONO_ASSEMBLY_HASH_ALG
+	<li>MONO_ASSEMBLY_MAJOR_VERSION
+	<li>MONO_ASSEMBLY_MINOR_VERSION
+	<li>MONO_ASSEMBLY_BUILD_NUMBER
+	<li>MONO_ASSEMBLY_REV_NUMBER
+	<li>MONO_ASSEMBLY_FLAGS
+	<li>MONO_ASSEMBLY_PUBLIC_KEY
+	<li>MONO_ASSEMBLY_NAME
+	<li>MONO_ASSEMBLY_CULTURE
+</li></li></li></li></li></li></li></li></li></ul>
+</td>
+
+
+<td>AssemblyOS</td><td>MONO_TABLE_ASSEMBLYOS</td><td>
+Array size: 
+MONO_ASSEMBLYOS_SIZE
+<ul>
+	<li>MONO_ASSEMBLYOS_PLATFORM
+	<li>MONO_ASSEMBLYOS_MAJOR_VERSION
+	<li>MONO_ASSEMBLYOS_MINOR_VERSION
+</li></li></li></ul>
+</td>
+
+
+<td>AssemblyProcessor</td><td>MONO_TABLE_ASSEMBLYPROCESSOR</td><td>Array
+size: MONO_ASSEMBLYPROCESSOR_SIZE
+<ul>
+	<li>MONO_ASSEMBLY_PROCESSOR
+</li></ul>
+</td>
+
+
+<td>AssemblyRef</td><td>MONO_TABLE_ASSEMBLYREF</td><td>
+Array size: 
+MONO_ASSEMBLYREF_SIZE
+<ul>
+	<li>MONO_ASSEMBLYREF_MAJOR_VERSION
+	<li>MONO_ASSEMBLYREF_MINOR_VERSION
+	<li>MONO_ASSEMBLYREF_BUILD_NUMBER
+	<li>MONO_ASSEMBLYREF_REV_NUMBER
+	<li>MONO_ASSEMBLYREF_FLAGS
+	<li>MONO_ASSEMBLYREF_PUBLIC_KEY
+	<li>MONO_ASSEMBLYREF_NAME
+	<li>MONO_ASSEMBLYREF_CULTURE
+	<li>MONO_ASSEMBLYREF_HASH_VALUE
+</li></li></li></li></li></li></li></li></li></ul>
+</td>
+
+
+<td>AssemblyRefProcessor</td><td>MONO_TABLE_ASSEMBLYREFPROCESSOR</td><td>Array
+size: MONO_ASSEMBLYREFPROC_SIZE
+<ul>
+	<li>MONO_ASSEMBLYREFPROC_PROCESSOR
+	<li>MONO_ASSEMBLYREFPROC_ASSEMBLYREF
+</li></li></ul>
+</td>
+
+
+<td>AssemblyRefOS</td><td>MONO_TABLE_ASSEMBLYREFOS</td><td>
+Array size: 
+	<li>MONO_ASSEMBLYREFOS_SIZE
+<ul>
+	<li>MONO_ASSEMBLYREFOS_PLATFORM
+	<li>MONO_ASSEMBLYREFOS_MAJOR_VERSION
+	<li>MONO_ASSEMBLYREFOS_MINOR_VERSION
+	<li>MONO_ASSEMBLYREFOS_ASSEMBLYREF
+</li></li></li></li></ul>
+</li></td>
+
+
+<td>ClassLayout</td><td>MONO_TABLE_CLASSLAYOUT</td><td>
+Array size: 
+MONO_CLASSLAYOUT_SIZE
+<ul>
+	<li>MONO_CLASS_LAYOUT_PACKING_SIZE
+	<li>MONO_CLASS_LAYOUT_CLASS_SIZE
+	<li>MONO_CLASS_LAYOUT_PARENT
+</li></li></li></ul>
+</td>
+
+
+<td>Constant</td><td>MONO_TABLE_CONSTANT</td><td>
+Array size: 
+MONO_CONSTANT_SIZE
+<ul>
+	<li>MONO_CONSTANT_TYPE
+	<li>MONO_CONSTANT_PADDING
+	<li>MONO_CONSTANT_PARENT
+	<li>MONO_CONSTANT_VALUE
+</li></li></li></li></ul>
+</td>
+
+
+<td>CustomAttribute</td><td>MONO_TABLE_CUSTOMATTRIBUTE</td><td>
+Array size:
+MONO_CUSTOM_ATTR_SIZE
+<ul>
+	<li>MONO_CUSTOM_ATTR_PARENT
+	<li>MONO_CUSTOM_ATTR_TYPE
+	<li>MONO_CUSTOM_ATTR_VALUE
+</li></li></li></ul>
+</td>
+
+
+<td>DeclSecurity</td><td>MONO_TABLE_DECLSECURITY</td><td>
+Array size: 
+MONO_DECL_SECURITY_SIZE
+<ul>
+	<li>MONO_DECL_SECURITY_ACTION
+	<li>MONO_DECL_SECURITY_PARENT
+	<li>MONO_DECL_SECURITY_PERMISSIONSET
+</li></li></li></ul>
+</td>
+
+
+<td>EventMap</td><td>MONO_TABLE_EVENTMAP</td><td>
+Array size: 
+MONO_EVENT_MAP_SIZE
+<ul>
+	<li>MONO_EVENT_MAP_PARENT
+	<li>MONO_EVENT_MAP_EVENTLIST
+</li></li></ul>
+</td>
+
+
+<td>EventPtr</td><td>MONO_TABLE_EVENT_POINTER</td><td>
+Array size: 
+MONO_EVENT_POINTER_SIZE
+<ul>
+	<li>MONO_EVENT_POINTER_EVENT
+</li></ul>
+</td>
+
+
+<td>Event</td><td>MONO_TABLE_EVENT</td><td>
+Array size:  MONO_EVENT_SIZE
+<ul>
+	<li>MONO_EVENT_FLAGS
+	<li>MONO_EVENT_NAME
+	<li>MONO_EVENT_TYPE
+</li></li></li></ul>
+</td>
+
+
+<td>ExportedType</td><td>MONO_TABLE_EXPORTEDTYPE</td><td>
+Array size: 
+MONO_EXPORTEDTYPE_SIZE
+<ul>
+	<li>MONO_EXP_TYPE_FLAGS
+	<li>MONO_EXP_TYPE_TYPEDEF
+	<li>MONO_EXP_TYPE_NAME
+	<li>MONO_EXP_TYPE_NAMESPACE
+	<li>MONO_EXP_TYPE_IMPLEMENTATION
+</li></li></li></li></li></ul>
+</td>
+
+
+<td>Field</td><td>MONO_TABLE_FIELD</td><td>
+Array size:  MONO_FIELD_SIZE
+<ul>
+	<li>MONO_FIELD_FLAGS
+	<li>MONO_FIELD_NAME
+	<li>MONO_FIELD_SIGNATURE
+</li></li></li></ul>
+</td>
+
+
+<td>FieldLayoutt</td><td>MONO_TABLE_FIELDLAYOUT</td><td>
+Array size: 
+MONO_FIELDLAYOUT_SIZE
+<ul>
+	<li>MONO_FIELD_LAYOUT_OFFSET
+	<li>MONO_FIELD_LAYOUT_FIELD
+</li></li></ul>
+</td>
+
+
+<td>FieldMarshal</td><td>MONO_TABLE_FIELDMARSHAL</td><td>
+Array size: 
+MONO_FIELD_MARSHAL_SIZE
+<ul>
+	<li>MONO_FIELD_MARSHAL_PARENT
+	<li>MONO_FIELD_MARSHAL_NATIVE_TYPE
+</li></li></ul>
+</td>
+
+
+<td>FieldPtr</td><td>MONO_TABLE_FIELD_POINTER</td><td>
+Array size: 
+MONO_FIELD_POINTER_SIZE
+<ul>
+	<li>MONO_FIELD_POINTER_FIELD
+</li></ul>
+</td>
+
+
+<td>FieldRVA</td><td>MONO_TABLE_FIELDRVA</td><td>
+Array size: 
+MONO_FIELDRVA_SIZE
+<ul>
+	<li>MONO_FIELD_RVA_RVA
+	<li>MONO_FIELD_RVA_FIELD
+</li></li></ul>
+</td>
+
+
+<td>File</td><td>MONO_TABLE_FILE</td><td>
+Array size:  MONO_FILE_SIZE
+<ul>
+	<li>MONO_FILE_FLAGS
+	<li>MONO_FILE_NAME
+	<li>MONO_FILE_HASH_VALUE
+</li></li></li></ul>
+</td>
+
+
+<td>GenericParam</td><td>MONO_TABLE_GENERICPARAM</td><td>
+Array size: 
+MONO_GENERICPARAM_SIZE
+<ul>
+	<li>MONO_GENERICPARAM_NUMBER
+	<li>MONO_GENERICPARAM_FLAGS
+	<li>MONO_GENERICPARAM_OWNER
+	<li>MONO_GENERICPARAM_NAME
+</li></li></li></li></ul>
+</td>
+
+
+<td>GenericParamConstraint</td><td>MONO_TABLE_GENERICPARAMCONSTRAINT</td><td>Array
+size: MONO_GENERICPARAMCONSTRAINT_SIZE
+<ul>
+	<li>MONO_GENPARCONSTRAINT_GENERICPAR
+	<li>MONO_GENPARCONSTRAINT_CONSTRAINT
+</li></li></ul>
+</td>
+
+<tr>
+<td>ImplMap</td><td>MONO_TABLE_IMPLMAP</td><td>
+Array size: 
+MONO_IMPLMAP_SIZE
+<ul>
+	<li>MONO_IMPLMAP_FLAGS
+	<li>MONO_IMPLMAP_MEMBER
+	<li>MONO_IMPLMAP_NAME
+	<li>MONO_IMPLMAP_SCOPE
+</li></li></li></li></ul>
+</td>
+</tr>
+
+
+<td>InterfaceImpl</td><td>MONO_TABLE_INTERFACEIMPL</td><td>
+Array size: 
+	<li>MONO_INTERFACEIMPL_SIZE
+<ul>
+	<li>MONO_INTERFACEIMPL_CLASS
+	<li>MONO_INTERFACEIMPL_INTERFACE
+</li></li></ul>
+</li></td>
+
+
+
+<td>ManifestResource</td><td>MONO_TABLE_MANIFESTRESOURCE</td><td>Array
+size: MONO_MANIFESTRESOURCE_SIZE
+<ul>
+	<li>MONO_MANIFEST_OFFSET
+	<li>MONO_MANIFEST_FLAGS
+	<li>MONO_MANIFEST_NAME
+	<li>MONO_MANIFEST_IMPLEMENTATION
+</li></li></li></li></ul>
+</td>
+
+
+<tr>
+<td>MemberRef</td><td>MONO_TABLE_MEMBERREF</td><td>
+Array size: 
+MONO_MEMBERREF_SIZE
+<ul>
+	<li>MONO_MEMBERREF_CLASS
+	<li>MONO_MEMBERREF_NAME
+	<li>MONO_MEMBERREF_SIGNATURE
+</li></li></li></ul>
+</td>
+</tr>
+
+<td>MethodImpl</td><td>MONO_TABLE_METHODIMPL</td><td>
+Array size: 
+MONO_METHODIMPL_SIZE
+<ul>
+	<li>MONO_METHODIMPL_CLASS
+	<li>MONO_METHODIMPL_BODY
+	<li>MONO_METHODIMPL_DECLARATION
+</li></li></li></ul>
+</td>
+
+
+
+<td>MethodSpec</td><td>MONO_TABLE_METHODSPEC</td><td>
+Array size: 
+MONO_METHODSPEC_SIZE
+<ul>
+	<li>MONO_METHODSPEC_METHOD
+	<li>MONO_METHODSPEC_SIGNATURE
+</li></li></ul>
+</td>
+
+<tr>
+<td>MethodSemantics</td><td>MONO_TABLE_METHODSEMANTICS</td><td>Array
+size: MONO_METHOD_SEMA_SIZE
+<ul>
+	<li>MONO_METHOD_SEMA_SEMANTICS
+	<li>MONO_METHOD_SEMA_METHOD
+	<li>MONO_METHOD_SEMA_ASSOCIATION
+</li></li></li></ul>
+</td>
+</tr>
+
+<td>Moduleref</td><td>MONO_TABLE_MODULEREF</td><td>
+Array size: 
+MONO_MODULEREF_SIZE
+<ul>
+	<li>MONO_MODULEREF_NAME
+</li></ul>
+</td>
+
+
+<tr>
+<td>Module</td><td>MONO_TABLE_MODULE</td><td>
+Array size: 
+MONO_MODULE_SIZE
+<br />
+Columns:
+<ul>
+	<li>MONO_MODULE_GENERATION
+	<li>MONO_MODULE_NAME
+	<li>MONO_MODULE_MVID
+	<li>MONO_MODULE_ENC
+	<li>MONO_MODULE_ENCBASE
+</li></li></li></li></li></ul>
+</td>
+</tr>
+
+<td>TypeRef</td><td>MONO_TABLE_TYPEREF</td><td>
+Array size: 
+MONO_TYPEREF_SIZE
+<ul>
+	<li>MONO_TYPEREF_SCOPE
+	<li>MONO_TYPEREF_NAME
+	<li>MONO_TYPEREF_NAMESPACE
+</li></li></li></ul>
+</td>
+
+
+<tr>
+<td>MethodPtr</td><td>MONO_TABLE_METHOD_POINTER</td><td>
+Array size: 
+MONO_METHOD_POINTER_SIZE
+<ul>
+	<li>MONO_METHOD_POINTER_METHOD
+</li></ul>
+</td>
+</tr>
+
+<td>Method</td><td>MONO_TABLE_METHOD</td><td>
+Array size: 
+MONO_METHOD_SIZE
+<ul>
+	<li>MONO_METHOD_RVA
+	<li>MONO_METHOD_IMPLFLAGS
+	<li>MONO_METHOD_FLAGS
+	<li>MONO_METHOD_NAME
+	<li>MONO_METHOD_SIGNATURE
+	<li>MONO_METHOD_PARAMLIST
+</li></li></li></li></li></li></ul>
+</td>
+
+
+<tr>
+<td>NestedClass</td><td>MONO_TABLE_NESTEDCLASS</td><td>
+Array size: 
+MONO_NESTEDCLASS_SIZE
+<ul>
+	<li>MONO_NESTED_CLASS_NESTED
+	<li>MONO_NESTED_CLASS_ENCLOSING
+</li></li></ul>
+</td>
+</tr>
+
+<tr>
+<td>ParamPtr</td><td>MONO_TABLE_PARAM_POINTER</td><td>
+Array size: 
+MONO_PARAM_POINTER_SIZE
+<ul>
+	<li>MONO_PARAM_POINTER_PARAM
+</li></ul>
+</td>
+</tr>
+
+<td>Param</td><td>MONO_TABLE_PARAM</td><td>
+Array size:  MONO_PARAM_SIZE
+<ul>
+	<li>MONO_PARAM_FLAGS
+	<li>MONO_PARAM_SEQUENCE
+	<li>MONO_PARAM_NAME
+</li></li></li></ul>
+</td>
+
+
+<td>PropertyMap</td><td>MONO_TABLE_PROPERTYMAP</td><td>
+Array size: 
+MONO_PROPERTY_MAP_SIZE
+<ul>
+	<li>MONO_PROPERTY_MAP_PARENT
+	<li>MONO_PROPERTY_MAP_PROPERTY_LIST
+</li></li></ul>
+</td>
+
+
+<td>PropertyPtr</td><td>MONO_TABLE_PROPERTY_POINTER</td><td>Array
+size: MONO_PROPERTY_POINTER_SIZE
+<ul>
+	<li>MONO_PROPERTY_POINTER_PROPERTY
+</li></ul>
+</td>
+
+
+<td>Property</td><td>MONO_TABLE_PROPERTY</td><td>
+Array size: 
+MONO_PROPERTY_SIZE
+<ul>
+	<li>MONO_PROPERTY_FLAGS
+	<li>MONO_PROPERTY_NAME
+	<li>MONO_PROPERTY_TYPE
+</li></li></li></ul>
+</td>
+
+<tr>
+<td>StandaloneSig</td><td>MONO_TABLE_STANDALONESIG</td><td>
+Array size: 
+	<li>MONO_STAND_ALONE_SIGNATURE_SIZE
+<ul>
+	<li>MONO_STAND_ALONE_SIGNATURE
+</li></ul>
+</li></td>
+</tr>
+
+<tr>
+<td>TypeDef</td><td>MONO_TABLE_TYPEDEF</td><td>
+Array size: 
+MONO_TYPEDEF_SIZE
+<ul>
+	<li>MONO_TYPEDEF_FLAGS
+	<li>MONO_TYPEDEF_NAME
+	<li>MONO_TYPEDEF_NAMESPACE
+	<li>MONO_TYPEDEF_EXTENDS
+	<li>MONO_TYPEDEF_FIELD_LIST
+	<li>MONO_TYPEDEF_METHOD_LIST
+</li></li></li></li></li></li></ul>
+</td>
+</tr>
+
+<tr>
+<td>TypeSpec</td><td>MONO_TABLE_TYPESPEC</td><td>
+Array size: 
+MONO_TYPESPEC_SIZE
+<ul>
+	<li>MONO_TYPESPEC_SIGNATURE
+</li></ul>
+</td>
+</tr>
+
+	</table>
+	</center>
+
+	<p />Each table can contain zero or more rows, you must call the
+	<a href="#api:mono_metadata_table_rows">mono_metadata_table_rows</a>
+	to obtain the number of rows in a table, and then you can
+	extract individual row values by using
+	the <a href="#api:mono_metadata_decode_row">mono_metadata_decode_row</a>
+	or
+	the <a href="#api:mono_metadata_decode_row_col">mono_metadata_decode_row_col</a>.
+	When decoding rows you must provide an guint32 array large
+	enough to hold as many columns as the table contains.
+	
+	<p />The metadata tables are stored in the MonoImage, you obtain
+	a pointer to the MonoTableInfo by calling
+	the <a href="#api:mono_image_get_table_info">mono_image_get_table_info</a>
+	and then you can scan those tables, for example:
+
+	<pre class="prettyprint">
+	/*
+	 * Dumps a few fields from the AssemblyRef table
+	 */
+	void DumpAssemblyRefs (MonoImage *image)
+	{
+		/* Get a pointer to the AssemblyRef metadata table */
+		MonoTableInfo *t = mono_image_get_table_info (image, MONO_TABLE_ASSEMBLYREF);
+
+		/* Fetch the number of rows available in the table */
+		int rows = mono_table_info_get_rows (t);
+		int i;
+
+		/* For each row, print some of its values */
+		for (i = 0; i < rows; i++){
+			/* Space where we extract one row from the metadata table */
+			guint32 cols [MONO_ASSEMBLYREF_SIZE];
+
+			/* Extract the row into the array cols */
+			mono_metadata_decode_row (t, i, cols, MONO_ASSEMBLYREF_SIZE);
+
+			fprintf (output, "%d: Version=%d.%d.%d.%d\n\tName=%s\n", i + 1,
+                        	cols [MONO_ASSEMBLYREF_MAJOR_VERSION],
+                        	cols [MONO_ASSEMBLYREF_MINOR_VERSION],
+                        	cols [MONO_ASSEMBLYREF_BUILD_NUMBER],
+                        	cols [MONO_ASSEMBLYREF_REV_NUMBER],
+                        	mono_metadata_string_heap (image, cols [MONO_ASSEMBLYREF_NAME]));
+		}
+	}
+	</pre>
+
+	<p />The above program shows the following output when ran on
+	the C# compiler:
+
+	<pre>
+	1: Version=1.0.5000.0
+		Name=mscorlib
+	2: Version=1.0.5000.0
+		Name=System
+	3: Version=1.0.5000.0
+		Name=System.Xml
+	</pre>
+
+	<p />
+
+<h3>Metadata Tables API</h3>
+
+	<p />These are the APIs for dealing with tables:
+
+ <a name="api:mono_image_get_table_info"></a>
+ <div class="api">
+    <div class="api-entry">mono_image_get_table_info</div>
+
+    <div class="prototype">Prototype: mono_image_get_table_info</div>
+<p />
+
+</div> <a name="api:mono_image_get_table_rows"></a>
+ <div class="api">
+    <div class="api-entry">mono_image_get_table_rows</div>
+
+    <div class="prototype">Prototype: mono_image_get_table_rows</div>
+<p />
+
+</div> <a name="api:mono_metadata_get_table"></a>
+ <div class="api">
+    <div class="api-entry">mono_metadata_get_table</div>
+
+    <div class="prototype">Prototype: mono_metadata_get_table</div>
+<p />
+
+</div> <a name="api:mono_metadata_decode_row_col"></a>
+ <div class="api">
+    <div class="api-entry">mono_metadata_decode_row_col</div>
+
+    <div class="prototype">guint32
+mono_metadata_decode_row_col (const MonoTableInfo *t, int idx, guint col)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>t:</i></dt><dd> table to extract information from.</dd><dt><i>idx:</i></dt><dd> index for row in table.</dd><dt><i>col:</i></dt><dd> column in the row.</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 This function returns the value of column <i>col</i> from the <i>idx</i>
+	 row in the table <i>t</i>.
+
+</div> <a name="api:mono_metadata_decode_row"></a>
+ <div class="api">
+    <div class="api-entry">mono_metadata_decode_row</div>
+
+    <div class="prototype">void
+mono_metadata_decode_row (const MonoTableInfo *t, int idx, guint32 *res, int res_size)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>t:</i></dt><dd> table to extract information from.</dd><dt><i>idx:</i></dt><dd> index in table.</dd><dt><i>res:</i></dt><dd> array of <i>res_size</i> cols to store the results in</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 This decompresses the metadata element <i>idx</i> in table <i>t</i>
+	 into the guint32 <i>res</i> array that has res_size elements
+
+</div> <a name="api:mono_metadata_compute_size"></a>
+ <div class="api">
+    <div class="api-entry">mono_metadata_compute_size</div>
+
+    <div class="prototype">Prototype: mono_metadata_compute_size</div>
+<p />
+
+</div> <a name="api:mono_metadata_custom_attrs_from_index"></a>
+ <div class="api">
+    <div class="api-entry">mono_metadata_custom_attrs_from_index</div>
+
+    <div class="prototype">Prototype: mono_metadata_custom_attrs_from_index</div>
+<p />
+
+</div> <a name="api:mono_metadata_decode_signed_value"></a>
+ <div class="api">
+    <div class="api-entry">mono_metadata_decode_signed_value</div>
+
+    <div class="prototype">gint32
+mono_metadata_decode_signed_value (const char *ptr, const char **rptr)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>ptr:</i></dt><dd> pointer to decode from</dd><dt><i>rptr:</i></dt><dd> the new position of the pointer</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  the decoded value
+</blockquote>
+<b>Remarks</b>
+<p />	 
+	 This routine decompresses 32-bit signed values
+	 (not specified in the spec)
+	
+
+</div> <a name="api:mono_metadata_decode_value"></a>
+ <div class="api">
+    <div class="api-entry">mono_metadata_decode_value</div>
+
+    <div class="prototype">guint32
+mono_metadata_decode_value (const char *_ptr, const char **rptr)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>ptr:</i></dt><dd> pointer to decode from</dd><dt><i>rptr:</i></dt><dd> the new position of the pointer</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  the decoded value
+</blockquote>
+<b>Remarks</b>
+<p />	 
+	 This routine decompresses 32-bit values as specified in the "Blob and
+	 Signature" section (22.2)
+	
+
+</div> <a name="api:mono_metadata_encode_value"></a>
+ <div class="api">
+    <div class="api-entry">mono_metadata_encode_value</div>
+
+    <div class="prototype">Prototype: mono_metadata_encode_value</div>
+<p />
+
+	
+</div><h2>Metadata access API</h2>
+
+	<p />This is the low-level API for accessing the metadata
+	images.
+	
+ <a name="api:mono_cli_rva_image_map"></a>
+ <div class="api">
+    <div class="api-entry">mono_cli_rva_image_map</div>
+
+    <div class="prototype">Prototype: mono_cli_rva_image_map</div>
+<p />
+
+</div> <a name="api:mono_pe_file_open"></a>
+ <div class="api">
+    <div class="api-entry">mono_pe_file_open</div>
+
+    <div class="prototype">MonoImage*
+mono_pe_file_open (const char *fname, MonoImageOpenStatus *status)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>fname:</i></dt><dd> filename that points to the module we want to open</dd><dt><i>status:</i></dt><dd> An error condition is returned in this field</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  An open image of type %MonoImage or NULL on error.  if
+
+	 NULL, then check the value of <i>status</i> for details on the error.
+	 This variant for mono_image_open DOES NOT SET UP CLI METADATA.
+	 It's just a PE file loader, used for FileVersionInfo.  It also does
+	 not use the image cache.</blockquote>
+
+</div> <a name="api:mono_metadata_events_from_typedef"></a>
+ <div class="api">
+    <div class="api-entry">mono_metadata_events_from_typedef</div>
+
+    <div class="prototype">Prototype: mono_metadata_events_from_typedef</div>
+<p />
+
+</div> <a name="api:mono_metadata_field_info"></a>
+ <div class="api">
+    <div class="api-entry">mono_metadata_field_info</div>
+
+    <div class="prototype">Prototype: mono_metadata_field_info</div>
+<p />
+
+</div> <a name="api:mono_metadata_free_array"></a>
+ <div class="api">
+    <div class="api-entry">mono_metadata_free_array</div>
+
+    <div class="prototype">Prototype: mono_metadata_free_array</div>
+<p />
+
+</div> <a name="api:mono_metadata_free_marshal_spec"></a>
+ <div class="api">
+    <div class="api-entry">mono_metadata_free_marshal_spec</div>
+
+    <div class="prototype">Prototype: mono_metadata_free_marshal_spec</div>
+<p />
+
+</div> <a name="api:mono_metadata_free_mh"></a>
+ <div class="api">
+    <div class="api-entry">mono_metadata_free_mh</div>
+
+    <div class="prototype">Prototype: mono_metadata_free_mh</div>
+<p />
+
+</div> <a name="api:mono_metadata_free_type"></a>
+ <div class="api">
+    <div class="api-entry">mono_metadata_free_type</div>
+
+    <div class="prototype">Prototype: mono_metadata_free_type</div>
+<p />
+
+</div> <a name="api:mono_metadata_get_constant_index"></a>
+ <div class="api">
+    <div class="api-entry">mono_metadata_get_constant_index</div>
+
+    <div class="prototype">Prototype: mono_metadata_get_constant_index</div>
+<p />
+
+</div> <a name="api:mono_metadata_get_marshal_info"></a>
+ <div class="api">
+    <div class="api-entry">mono_metadata_get_marshal_info</div>
+
+    <div class="prototype">Prototype: mono_metadata_get_marshal_info</div>
+<p />
+
+</div> <a name="api:mono_metadata_implmap_from_method"></a>
+ <div class="api">
+    <div class="api-entry">mono_metadata_implmap_from_method</div>
+
+    <div class="prototype">Prototype: mono_metadata_implmap_from_method</div>
+<p />
+
+</div> <a name="api:mono_metadata_interfaces_from_typedef"></a>
+ <div class="api">
+    <div class="api-entry">mono_metadata_interfaces_from_typedef</div>
+
+    <div class="prototype">Prototype: mono_metadata_interfaces_from_typedef</div>
+<p />
+
+</div> <a name="api:mono_metadata_locate"></a>
+ <div class="api">
+    <div class="api-entry">mono_metadata_locate</div>
+
+    <div class="prototype">const char *
+mono_metadata_locate (MonoImage *meta, int table, int idx)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>meta:</i></dt><dd> metadata context</dd><dt><i>table:</i></dt><dd> table code.</dd><dt><i>idx:</i></dt><dd> index of element to retrieve from <i>table</i>.</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  a pointer to the <i>idx</i> element in the metadata table
+
+	 whose code is <i>table</i>.</blockquote>
+
+</div> <a name="api:mono_metadata_locate_token"></a>
+ <div class="api">
+    <div class="api-entry">mono_metadata_locate_token</div>
+
+    <div class="prototype">const char *
+mono_metadata_locate_token (MonoImage *meta, guint32 token)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>meta:</i></dt><dd> metadata context</dd><dt><i>token:</i></dt><dd> metadata token</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  a pointer to the data in the metadata represented by the
+
+	 token <i>token</i>.</blockquote>
+
+</div> <a name="api:mono_metadata_methods_from_event"></a>
+ <div class="api">
+    <div class="api-entry">mono_metadata_methods_from_event</div>
+
+    <div class="prototype">Prototype: mono_metadata_methods_from_event</div>
+<p />
+
+</div> <a name="api:mono_metadata_methods_from_property"></a>
+ <div class="api">
+    <div class="api-entry">mono_metadata_methods_from_property</div>
+
+    <div class="prototype">Prototype: mono_metadata_methods_from_property</div>
+<p />
+
+</div> <a name="api:mono_metadata_nested_in_typedef"></a>
+ <div class="api">
+    <div class="api-entry">mono_metadata_nested_in_typedef</div>
+
+    <div class="prototype">Prototype: mono_metadata_nested_in_typedef</div>
+<p />
+
+</div> <a name="api:mono_metadata_nesting_typedef"></a>
+ <div class="api">
+    <div class="api-entry">mono_metadata_nesting_typedef</div>
+
+    <div class="prototype">Prototype: mono_metadata_nesting_typedef</div>
+<p />
+
+</div> <a name="api:mono_metadata_packing_from_typedef"></a>
+ <div class="api">
+    <div class="api-entry">mono_metadata_packing_from_typedef</div>
+
+    <div class="prototype">Prototype: mono_metadata_packing_from_typedef</div>
+<p />
+
+</div> <a name="api:mono_metadata_properties_from_typedef"></a>
+ <div class="api">
+    <div class="api-entry">mono_metadata_properties_from_typedef</div>
+
+    <div class="prototype">Prototype: mono_metadata_properties_from_typedef</div>
+<p />
+
+</div> <a name="api:mono_metadata_token_from_dor"></a>
+ <div class="api">
+    <div class="api-entry">mono_metadata_token_from_dor</div>
+
+    <div class="prototype">Prototype: mono_metadata_token_from_dor</div>
+<p />
+
+</div> <a name="api:mono_metadata_typedef_from_field"></a>
+ <div class="api">
+    <div class="api-entry">mono_metadata_typedef_from_field</div>
+
+    <div class="prototype">guint32
+mono_metadata_typedef_from_field (MonoImage *meta, guint32 index)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>meta:</i></dt><dd> metadata context</dd><dt><i>index:</i></dt><dd> FieldDef token</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  the 1-based index into the TypeDef table of the type that
+
+	 declared the field described by <i>index</i>, or 0 if not found.</blockquote>
+
+</div> <a name="api:mono_metadata_typedef_from_method"></a>
+ <div class="api">
+    <div class="api-entry">mono_metadata_typedef_from_method</div>
+
+    <div class="prototype">Prototype: mono_metadata_typedef_from_method</div>
+<p />
+
+</div> <a name="api:mono_metadata_type_equal"></a>
+ <div class="api">
+    <div class="api-entry">mono_metadata_type_equal</div>
+
+    <div class="prototype">Prototype: mono_metadata_type_equal</div>
+<p />
+
+</div> <a name="api:mono_metadata_type_hash"></a>
+ <div class="api">
+    <div class="api-entry">mono_metadata_type_hash</div>
+
+    <div class="prototype">Prototype: mono_metadata_type_hash</div>
+<p />
+
+</div> <a name="api:mono_metadata_declsec_from_index"></a>
+ <div class="api">
+    <div class="api-entry">mono_metadata_declsec_from_index</div>
+
+    <div class="prototype">Prototype: mono_metadata_declsec_from_index</div>
+<p />
+
+</div> <a name="api:mono_metadata_free_method_signature"></a>
+ <div class="api">
+    <div class="api-entry">mono_metadata_free_method_signature</div>
+
+    <div class="prototype">Prototype: mono_metadata_free_method_signature</div>
+<p />
+
+
+</div><h3>Retrieving Objects from Tokens</h3>
+
+ <a name="api:mono_metadata_parse_custom_mod"></a>
+ <div class="api">
+    <div class="api-entry">mono_metadata_parse_custom_mod</div>
+
+    <div class="prototype">Prototype: mono_metadata_parse_custom_mod</div>
+<p />
+
+</div> <a name="api:mono_metadata_parse_field_type"></a>
+ <div class="api">
+    <div class="api-entry">mono_metadata_parse_field_type</div>
+
+    <div class="prototype">MonoType*
+mono_metadata_parse_field_type (MonoImage *m, short field_flags, const char *ptr, const char **rptr)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>m:</i></dt><dd> metadata context to extract information from</dd><dt><i>ptr:</i></dt><dd> pointer to the field signature</dd><dt><i>rptr:</i></dt><dd> pointer updated to match the end of the decoded stream</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  The MonoType that was extracted from <i>ptr</i>.
+</blockquote>
+<b>Remarks</b>
+<p />	 
+	 Parses the field signature, and returns the type information for it. 
+	
+
+</div> <a name="api:mono_metadata_parse_marshal_spec"></a>
+ <div class="api">
+    <div class="api-entry">mono_metadata_parse_marshal_spec</div>
+
+    <div class="prototype">Prototype: mono_metadata_parse_marshal_spec</div>
+<p />
+
+</div> <a name="api:mono_metadata_parse_method_signature_full"></a>
+ <div class="api">
+    <div class="api-entry">mono_metadata_parse_method_signature_full</div>
+
+    <div class="prototype">Prototype: mono_metadata_parse_method_signature_full</div>
+<p />
+
+</div> <a name="api:mono_metadata_parse_method_signature"></a>
+ <div class="api">
+    <div class="api-entry">mono_metadata_parse_method_signature</div>
+
+    <div class="prototype">Prototype: mono_metadata_parse_method_signature</div>
+<p />
+
+</div> <a name="api:mono_metadata_parse_mh_full"></a>
+ <div class="api">
+    <div class="api-entry">mono_metadata_parse_mh_full</div>
+
+    <div class="prototype">Prototype: mono_metadata_parse_mh_full</div>
+<p />
+
+</div> <a name="api:mono_metadata_parse_mh"></a>
+ <div class="api">
+    <div class="api-entry">mono_metadata_parse_mh</div>
+
+    <div class="prototype">Prototype: mono_metadata_parse_mh</div>
+<p />
+
+</div> <a name="api:mono_metadata_parse_param"></a>
+ <div class="api">
+    <div class="api-entry">mono_metadata_parse_param</div>
+
+    <div class="prototype">MonoType*
+mono_metadata_parse_param (MonoImage *m, const char *ptr, const char **rptr)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>m:</i></dt><dd> metadata context to extract information from</dd><dt><i>ptr:</i></dt><dd> pointer to the param signature</dd><dt><i>rptr:</i></dt><dd> pointer updated to match the end of the decoded stream</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  The MonoType that was extracted from <i>ptr</i>.
+</blockquote>
+<b>Remarks</b>
+<p />	 
+	 Parses the param signature, and returns the type information for it. 
+	
+
+</div> <a name="api:mono_metadata_parse_signature"></a>
+ <div class="api">
+    <div class="api-entry">mono_metadata_parse_signature</div>
+
+    <div class="prototype">Prototype: mono_metadata_parse_signature</div>
+<p />
+
+</div> <a name="api:mono_metadata_parse_typedef_or_ref"></a>
+ <div class="api">
+    <div class="api-entry">mono_metadata_parse_typedef_or_ref</div>
+
+    <div class="prototype">Prototype: mono_metadata_parse_typedef_or_ref</div>
+<p />
+
+</div> <a name="api:mono_metadata_parse_type_full"></a>
+ <div class="api">
+    <div class="api-entry">mono_metadata_parse_type_full</div>
+
+    <div class="prototype">Prototype: mono_metadata_parse_type_full</div>
+<p />
+
+</div> <a name="api:mono_metadata_parse_type"></a>
+ <div class="api">
+    <div class="api-entry">mono_metadata_parse_type</div>
+
+    <div class="prototype">static MonoType*
+mono_metadata_parse_type_internal (MonoImage *m, MonoGenericContainer *container, MonoParseTypeMode mode,
+								   short opt_attrs, gboolean transient, const char *ptr, const char **rptr)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>m:</i></dt><dd> metadata context</dd><dt><i>mode:</i></dt><dd> king of type that may be found at <i>ptr</i></dd><dt><i>opt_attrs:</i></dt><dd> optional attributes to store in the returned type</dd><dt><i>ptr:</i></dt><dd> pointer to the type representation</dd><dt><i>rptr:</i></dt><dd> pointer updated to match the end of the decoded stream</dd><dt><i>transient:</i></dt><dd> whenever to allocate the result from the heap or from a mempool</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  a <i>MonoType</i> structure representing the decoded type.
+</blockquote>
+<b>Remarks</b>
+<p />	 <p />
+
+	 Decode a compressed type description found at <i>ptr</i> in <i>m</i>.
+	 <i>mode</i> can be one of MONO_PARSE_MOD_TYPE, MONO_PARSE_PARAM, MONO_PARSE_RET,
+	 MONO_PARSE_FIELD, MONO_PARSE_LOCAL, MONO_PARSE_TYPE.
+	 This function can be used to decode type descriptions in method signatures,
+	 field signatures, locals signatures etc.
+	
+	 To parse a generic type, `generic_container' points to the current class'es
+	 (the `generic_container' field in the MonoClass) or the current generic method's
+	 (stored in image->property_hash) generic container.
+	 When we encounter any MONO_TYPE_VAR or MONO_TYPE_MVAR's, they're looked up in
+	 this MonoGenericContainer.
+	
+	 LOCKING: Acquires the loader lock.
+	
+
+
+</div><h2>Generics Support</h2>
+
+ <a name="api:mono_metadata_generic_class_is_valuetype"></a>
+ <div class="api">
+    <div class="api-entry">mono_metadata_generic_class_is_valuetype</div>
+
+    <div class="prototype">Prototype: mono_metadata_generic_class_is_valuetype</div>
+<p />
+
+</div> <a name="api:mono_metadata_inflate_generic_inst"></a>
+ <div class="api">
+    <div class="api-entry">mono_metadata_inflate_generic_inst</div>
+
+    <div class="prototype">Prototype: mono_metadata_inflate_generic_inst</div>
+<p />
+
+</div> <a name="api:mono_metadata_load_generic_params"></a>
+ <div class="api">
+    <div class="api-entry">mono_metadata_load_generic_params</div>
+
+    <div class="prototype">Prototype: mono_metadata_load_generic_params</div>
+<p />
+
+
+</div><h2>Tokens</h2>
+
+ <a name="api:mono_ldtoken"></a>
+ <div class="api">
+    <div class="api-entry">mono_ldtoken</div>
+
+    <div class="prototype">Prototype: mono_ldtoken</div>
+<p />
+
+</div> <a name="api:mono_ldstr"></a>
+ <div class="api">
+    <div class="api-entry">mono_ldstr</div>
+
+    <div class="prototype">MonoString*
+mono_ldstr (MonoDomain *domain, MonoImage *image, guint32 idx)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>domain:</i></dt><dd> the domain where the string will be used.</dd><dt><i>image:</i></dt><dd> a metadata context</dd><dt><i>idx:</i></dt><dd> index into the user string table.</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  a loaded string from the <i>image</i>/<i>idx</i> combination.
+</blockquote>
+<b>Remarks</b>
+<p />	 <p />
+
+	 Implementation for the ldstr opcode.
+
+</div> <a name="api:mono_exception_from_token"></a>
+ <div class="api">
+    <div class="api-entry">mono_exception_from_token</div>
+
+    <div class="prototype">MonoException*
+mono_exception_from_token (MonoImage *image, guint32 token)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>image:</i></dt><dd> the Mono image where to look for the class</dd><dt><i>token:</i></dt><dd> The type token of the class</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  the initialized exception instance.
+</blockquote>
+<b>Remarks</b>
+<p />	 
+	 Creates an exception of the type given by <i>token</i>.
+	
+
+
+</div><h2>OpCodes</h2>
+
+ <a name="api:mono_opcode_name"></a>
+ <div class="api">
+    <div class="api-entry">mono_opcode_name</div>
+
+    <div class="prototype">Prototype: mono_opcode_name</div>
+<p />
+
+</div></body>
+</html>
+</span>
\ No newline at end of file
diff --git a/docs/deploy/mono-api-methods.html b/docs/deploy/mono-api-methods.html
new file mode 100644
index 0000000..d8abf6e
--- /dev/null
+++ b/docs/deploy/mono-api-methods.html
@@ -0,0 +1,578 @@
+<?xml version="1.0" encoding="utf-8"?><span>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+   <title>mono-api-methods.html</title>
+   <style type="text/css">
+
+
+   h3 { 
+       font-size: 18px;
+       padding-bottom: 4pt;
+       border-bottom: 2px solid #dddddd;
+   }
+       
+   .api {
+     border: 1px solid;
+     padding: 10pt;
+     margin: 10pt;
+   } 
+
+   .api-entry { 
+       border-bottom: none;
+       font-size: 18px;
+   }
+
+   .prototype {
+     border: 1px solid;
+     background-color: #f2f2f2;
+     padding: 5pt;
+     margin-top: 5pt;
+     margin-bottom: 5pt;  
+   } 
+
+   .header {
+     border: 1px solid;
+     padding: 0 0 5pt 5pt;
+     margin: 10pt;
+     white-space: pre;
+       font-family: monospace;
+   }
+    
+   .code {
+     border: 1px solid;
+     padding: 0 0 5pt 5pt;
+     margin: 10pt;
+     white-space: pre;
+       font-family: monospace;
+   }
+   
+
+</style>
+</head>
+<body>
+<h3>Methods</h3>
+
+<h3>Invoking Methods</h3>
+
+ <a name="api:mono_runtime_invoke"></a>
+ <div class="api">
+    <div class="api-entry">mono_runtime_invoke</div>
+
+    <div class="prototype">MonoObject*
+mono_runtime_invoke (MonoMethod *method, void *obj, void **params, MonoObject **exc)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>method:</i></dt><dd> method to invoke</dd><dt><i>obJ:</i></dt><dd> object instance</dd><dt><i>params:</i></dt><dd> arguments to the method</dd><dt><i>exc:</i></dt><dd> exception information.</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 Invokes the method represented by <i>method</i> on the object <i>obj</i>.
+	
+	 obj is the 'this' pointer, it should be NULL for static
+	 methods, a MonoObject* for object instances and a pointer to
+	 the value type for value types.
+	
+	 The params array contains the arguments to the method with the
+	 same convention: MonoObject* pointers for object instances and
+	 pointers to the value type otherwise. 
+	
+<p />
+	 From unmanaged code you'll usually use the
+	 mono_runtime_invoke() variant.
+	
+	 Note that this function doesn't handle virtual methods for
+	 you, it will exec the exact method you pass: we still need to
+	 expose a function to lookup the derived class implementation
+	 of a virtual method (there are examples of this in the code,
+	 though).
+	
+<p />
+	 You can pass NULL as the exc argument if you don't want to
+	 catch exceptions, otherwise, *exc will be set to the exception
+	 thrown, if any.  if an exception is thrown, you can't use the
+	 MonoObject* result from the function.
+	
+<p />
+	 If the method returns a value type, it is boxed in an object
+	 reference.
+
+
+If you want to invoke generic methods, you must call the method on the
+"inflated" class, which you can obtain from the
+<tt>mono_object_get_class()</tt>
+
+<div class="code">
+MonoClass *clazz;
+MonoMethod *method;
+
+clazz = mono_object_get_class (obj);
+
+/*
+ * If there are more Add methods declared, you
+ * may use mono_method_desc_search_in_class (clazz, ":Add(T)"),
+ * you must substitute ":Add(T)" with the correct type, for example
+ * for List<int>, you would use ":Add(int)".
+ */
+method = mono_class_get_method_from_name (clazz, "Add", 1);
+mono_runtime_invoke (method, obj, args, &exception);
+</div>
+
+
+</div> <a name="api:mono_runtime_invoke_array"></a>
+ <div class="api">
+    <div class="api-entry">mono_runtime_invoke_array</div>
+
+    <div class="prototype">MonoObject*
+mono_runtime_invoke_array (MonoMethod *method, void *obj, MonoArray *params,
+			   MonoObject **exc)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>method:</i></dt><dd> method to invoke</dd><dt><i>obJ:</i></dt><dd> object instance</dd><dt><i>params:</i></dt><dd> arguments to the method</dd><dt><i>exc:</i></dt><dd> exception information.</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 Invokes the method represented by <i>method</i> on the object <i>obj</i>.
+	
+	 obj is the 'this' pointer, it should be NULL for static
+	 methods, a MonoObject* for object instances and a pointer to
+	 the value type for value types.
+	
+	 The params array contains the arguments to the method with the
+	 same convention: MonoObject* pointers for object instances and
+	 pointers to the value type otherwise. The _invoke_array
+	 variant takes a C# object[] as the params argument (MonoArray
+	 *params): in this case the value types are boxed inside the
+	 respective reference representation.
+	
+<p />
+	 From unmanaged code you'll usually use the
+	 mono_runtime_invoke() variant.
+	
+	 Note that this function doesn't handle virtual methods for
+	 you, it will exec the exact method you pass: we still need to
+	 expose a function to lookup the derived class implementation
+	 of a virtual method (there are examples of this in the code,
+	 though).
+	
+<p />
+	 You can pass NULL as the exc argument if you don't want to
+	 catch exceptions, otherwise, *exc will be set to the exception
+	 thrown, if any.  if an exception is thrown, you can't use the
+	 MonoObject* result from the function.
+	
+<p />
+	 If the method returns a value type, it is boxed in an object
+	 reference.
+
+</div> <a name="api:mono_runtime_delegate_invoke"></a>
+ <div class="api">
+    <div class="api-entry">mono_runtime_delegate_invoke</div>
+
+    <div class="prototype">MonoObject*
+mono_runtime_delegate_invoke (MonoObject *delegate, void **params, MonoObject **exc)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>delegate:</i></dt><dd> pointer to a delegate object.</dd><dt><i>params:</i></dt><dd> parameters for the delegate.</dd><dt><i>exc:</i></dt><dd> Pointer to the exception result.</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 Invokes the delegate method <i>delegate</i> with the parameters provided.
+	
+	 You can pass NULL as the exc argument if you don't want to
+	 catch exceptions, otherwise, *exc will be set to the exception
+	 thrown, if any.  if an exception is thrown, you can't use the
+	 MonoObject* result from the function.
+
+
+</div> <a name="api:mono_method_body_get_object"></a>
+ <div class="api">
+    <div class="api-entry">mono_method_body_get_object</div>
+
+    <div class="prototype">Prototype: mono_method_body_get_object</div>
+<p />
+
+</div> <a name="api:mono_method_desc_free"></a>
+ <div class="api">
+    <div class="api-entry">mono_method_desc_free</div>
+
+    <div class="prototype">void
+mono_method_desc_free (MonoMethodDesc *desc)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>desc:</i></dt><dd> method description to be released</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 Releases the MonoMethodDesc object <i>desc</i>.
+
+</div> <a name="api:mono_method_desc_from_method"></a>
+ <div class="api">
+    <div class="api-entry">mono_method_desc_from_method</div>
+
+    <div class="prototype">Prototype: mono_method_desc_from_method</div>
+<p />
+
+</div> <a name="api:mono_method_desc_full_match"></a>
+ <div class="api">
+    <div class="api-entry">mono_method_desc_full_match</div>
+
+    <div class="prototype">Prototype: mono_method_desc_full_match</div>
+<p />
+
+</div> <a name="api:mono_method_desc_match"></a>
+ <div class="api">
+    <div class="api-entry">mono_method_desc_match</div>
+
+    <div class="prototype">Prototype: mono_method_desc_match</div>
+<p />
+
+</div> <a name="api:mono_method_desc_new"></a>
+ <div class="api">
+    <div class="api-entry">mono_method_desc_new</div>
+
+    <div class="prototype">MonoMethodDesc*
+mono_method_desc_new (const char *name, gboolean include_namespace)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>name:</i></dt><dd> the method name.</dd><dt><i>include_namespace:</i></dt><dd> whether the name includes a namespace or not.</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  a parsed representation of the method description.
+</blockquote>
+<b>Remarks</b>
+<p />	 
+	 Creates a method description for <i>name</i>, which conforms to the following
+	 specification:
+	
+	 [namespace.]classname:methodname[(args...)]
+	
+	 in all the loaded assemblies.
+	
+	 Both classname and methodname can contain '*' which matches anything.
+	
+
+</div> <a name="api:mono_method_desc_search_in_class"></a>
+ <div class="api">
+    <div class="api-entry">mono_method_desc_search_in_class</div>
+
+    <div class="prototype">Prototype: mono_method_desc_search_in_class</div>
+<p />
+
+</div> <a name="api:mono_method_desc_search_in_image"></a>
+ <div class="api">
+    <div class="api-entry">mono_method_desc_search_in_image</div>
+
+    <div class="prototype">Prototype: mono_method_desc_search_in_image</div>
+<p />
+
+</div> <a name="api:mono_method_full_name"></a>
+ <div class="api">
+    <div class="api-entry">mono_method_full_name</div>
+
+    <div class="prototype">Prototype: mono_method_full_name</div>
+<p />
+
+</div> <a name="api:mono_method_get_class"></a>
+ <div class="api">
+    <div class="api-entry">mono_method_get_class</div>
+
+    <div class="prototype">Prototype: mono_method_get_class</div>
+<p />
+
+</div> <a name="api:mono_method_get_flags"></a>
+ <div class="api">
+    <div class="api-entry">mono_method_get_flags</div>
+
+    <div class="prototype">Prototype: mono_method_get_flags</div>
+<p />
+
+</div> <a name="api:mono_method_get_last_managed"></a>
+ <div class="api">
+    <div class="api-entry">mono_method_get_last_managed</div>
+
+    <div class="prototype">Prototype: mono_method_get_last_managed</div>
+<p />
+
+</div> <a name="api:mono_method_get_marshal_info"></a>
+ <div class="api">
+    <div class="api-entry">mono_method_get_marshal_info</div>
+
+    <div class="prototype">Prototype: mono_method_get_marshal_info</div>
+<p />
+
+</div> <a name="api:mono_method_get_name"></a>
+ <div class="api">
+    <div class="api-entry">mono_method_get_name</div>
+
+    <div class="prototype">Prototype: mono_method_get_name</div>
+<p />
+
+</div> <a name="api:mono_method_get_object"></a>
+ <div class="api">
+    <div class="api-entry">mono_method_get_object</div>
+
+    <div class="prototype">Prototype: mono_method_get_object</div>
+<p />
+
+</div> <a name="api:mono_method_get_param_names"></a>
+ <div class="api">
+    <div class="api-entry">mono_method_get_param_names</div>
+
+    <div class="prototype">Prototype: mono_method_get_param_names</div>
+<p />
+
+</div> <a name="api:mono_method_get_param_token"></a>
+ <div class="api">
+    <div class="api-entry">mono_method_get_param_token</div>
+
+    <div class="prototype">Prototype: mono_method_get_param_token</div>
+<p />
+
+</div> <a name="api:mono_method_get_signature"></a>
+ <div class="api">
+    <div class="api-entry">mono_method_get_signature</div>
+
+    <div class="prototype">Prototype: mono_method_get_signature</div>
+<p />
+
+</div> <a name="api:mono_method_get_index"></a>
+ <div class="api">
+    <div class="api-entry">mono_method_get_index</div>
+
+    <div class="prototype">Prototype: mono_method_get_index</div>
+<p />
+
+</div> <a name="api:mono_method_get_signature_full"></a>
+ <div class="api">
+    <div class="api-entry">mono_method_get_signature_full</div>
+
+    <div class="prototype">Prototype: mono_method_get_signature_full</div>
+<p />
+
+</div> <a name="api:mono_method_get_token"></a>
+ <div class="api">
+    <div class="api-entry">mono_method_get_token</div>
+
+    <div class="prototype">Prototype: mono_method_get_token</div>
+<p />
+
+</div> <a name="api:mono_method_has_marshal_info"></a>
+ <div class="api">
+    <div class="api-entry">mono_method_has_marshal_info</div>
+
+    <div class="prototype">Prototype: mono_method_has_marshal_info</div>
+<p />
+
+</div> <a name="api:mono_method_verify"></a>
+ <div class="api">
+    <div class="api-entry">mono_method_verify</div>
+
+    <div class="prototype">Prototype: mono_method_verify</div>
+<p />
+
+
+</div><h3>Method Signatures</h3>
+
+ <a name="api:mono_method_signature"></a>
+ <div class="api">
+    <div class="api-entry">mono_method_signature</div>
+
+    <div class="prototype">MonoMethodSignature*
+mono_method_signature (MonoMethod *m)
+
+</div>
+<p />
+<b>Remarks</b>
+<p />	 
+	 Return the signature of the method M. On failure, returns NULL.
+
+</div> <a name="api:mono_signature_explicit_this"></a>
+ <div class="api">
+    <div class="api-entry">mono_signature_explicit_this</div>
+
+    <div class="prototype">gboolean
+mono_signature_explicit_this (MonoMethodSignature *sig)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>sig:</i></dt><dd> the method signature inspected</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  <i>TRUE</i> if this the method signature <i>sig</i> has an explicit
+
+	 instance argument. <i>FALSE</i> otherwise.</blockquote>
+
+</div> <a name="api:mono_signature_get_call_conv"></a>
+ <div class="api">
+    <div class="api-entry">mono_signature_get_call_conv</div>
+
+    <div class="prototype">guint32
+mono_signature_get_call_conv (MonoMethodSignature *sig)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>sig:</i></dt><dd> the method signature inspected</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  the call convention of the method signature <i>sig</i>.
+</blockquote>
+
+</div> <a name="api:mono_signature_get_desc"></a>
+ <div class="api">
+    <div class="api-entry">mono_signature_get_desc</div>
+
+    <div class="prototype">Prototype: mono_signature_get_desc</div>
+<p />
+
+</div> <a name="api:mono_signature_get_param_count"></a>
+ <div class="api">
+    <div class="api-entry">mono_signature_get_param_count</div>
+
+    <div class="prototype">guint32
+mono_signature_get_param_count (MonoMethodSignature *sig)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>sig:</i></dt><dd> the method signature inspected</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  the number of parameters in the method signature <i>sig</i>.
+</blockquote>
+
+</div> <a name="api:mono_signature_get_params"></a>
+ <div class="api">
+    <div class="api-entry">mono_signature_get_params</div>
+
+    <div class="prototype">MonoType*
+mono_signature_get_params (MonoMethodSignature *sig, gpointer *iter)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>sig:</i></dt><dd> the method signature inspected</dd><dt><i>iter:</i></dt><dd> pointer to an iterator</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  the next parameter type of the method signature <i>sig</i>,
+
+	 <i>NULL</i> when finished.</blockquote>
+<b>Remarks</b>
+<p />	 
+	 Iterates over the parameters for the method signature <i>sig</i>.
+	 A void* pointer must be initualized to <i>NULL</i> to start the iteration
+	 and it's address is passed to this function repeteadly until it returns
+	 <i>NULL</i>.
+	
+
+</div> <a name="api:mono_signature_get_return_type"></a>
+ <div class="api">
+    <div class="api-entry">mono_signature_get_return_type</div>
+
+    <div class="prototype">MonoType*
+mono_signature_get_return_type (MonoMethodSignature *sig)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>sig:</i></dt><dd> the method signature inspected</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  the return type of the method signature <i>sig</i>
+</blockquote>
+
+</div> <a name="api:mono_signature_hash"></a>
+ <div class="api">
+    <div class="api-entry">mono_signature_hash</div>
+
+    <div class="prototype">Prototype: mono_signature_hash</div>
+<p />
+
+</div> <a name="api:mono_signature_is_instance"></a>
+ <div class="api">
+    <div class="api-entry">mono_signature_is_instance</div>
+
+    <div class="prototype">gboolean
+mono_signature_is_instance (MonoMethodSignature *sig)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>sig:</i></dt><dd> the method signature inspected</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  <i>TRUE</i> if this the method signature <i>sig</i> has an implicit
+
+	 first instance argument. <i>FALSE</i> otherwise.</blockquote>
+
+</div> <a name="api:mono_signature_vararg_start"></a>
+ <div class="api">
+    <div class="api-entry">mono_signature_vararg_start</div>
+
+    <div class="prototype">int
+mono_signature_vararg_start (MonoMethodSignature *sig)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>sig:</i></dt><dd> the method signature inspected</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  the number of the first vararg parameter in the
+
+	 method signature <i>sig</i>. -1 if this is not a vararg signature.</blockquote>
+
+</div> <a name="api:mono_param_get_objects"></a>
+ <div class="api">
+    <div class="api-entry">mono_param_get_objects</div>
+
+    <div class="prototype">Prototype: mono_param_get_objects</div>
+<p />
+
+</div> <a name="api:mono_get_method_full"></a>
+ <div class="api">
+    <div class="api-entry">mono_get_method_full</div>
+
+    <div class="prototype">Prototype: mono_get_method_full</div>
+<p />
+
+</div> <a name="api:mono_get_method"></a>
+ <div class="api">
+    <div class="api-entry">mono_get_method</div>
+
+    <div class="prototype">Prototype: mono_get_method</div>
+<p />
+
+
+</div><h3>Methods Header Operations</h3>
+
+ <a name="api:mono_method_get_header"></a>
+ <div class="api">
+    <div class="api-entry">mono_method_get_header</div>
+
+    <div class="prototype">Prototype: mono_method_get_header</div>
+<p />
+
+</div> <a name="api:mono_method_header_get_clauses"></a>
+ <div class="api">
+    <div class="api-entry">mono_method_header_get_clauses</div>
+
+    <div class="prototype">Prototype: mono_method_header_get_clauses</div>
+<p />
+
+</div> <a name="api:mono_method_header_get_code"></a>
+ <div class="api">
+    <div class="api-entry">mono_method_header_get_code</div>
+
+    <div class="prototype">Prototype: mono_method_header_get_code</div>
+<p />
+
+</div> <a name="api:mono_method_header_get_locals"></a>
+ <div class="api">
+    <div class="api-entry">mono_method_header_get_locals</div>
+
+    <div class="prototype">Prototype: mono_method_header_get_locals</div>
+<p />
+
+</div></body>
+</html>
+</span>
\ No newline at end of file
diff --git a/docs/deploy/mono-api-object.html b/docs/deploy/mono-api-object.html
new file mode 100644
index 0000000..51cdd0d
--- /dev/null
+++ b/docs/deploy/mono-api-object.html
@@ -0,0 +1,1134 @@
+<?xml version="1.0" encoding="utf-8"?><span>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+   <title>mono-api-object.html</title>
+   <style type="text/css">
+
+
+   h3 { 
+       font-size: 18px;
+       padding-bottom: 4pt;
+       border-bottom: 2px solid #dddddd;
+   }
+       
+   .api {
+     border: 1px solid;
+     padding: 10pt;
+     margin: 10pt;
+   } 
+
+   .api-entry { 
+       border-bottom: none;
+       font-size: 18px;
+   }
+
+   .prototype {
+     border: 1px solid;
+     background-color: #f2f2f2;
+     padding: 5pt;
+     margin-top: 5pt;
+     margin-bottom: 5pt;  
+   } 
+
+   .header {
+     border: 1px solid;
+     padding: 0 0 5pt 5pt;
+     margin: 10pt;
+     white-space: pre;
+       font-family: monospace;
+   }
+    
+   .code {
+     border: 1px solid;
+     padding: 0 0 5pt 5pt;
+     margin: 10pt;
+     white-space: pre;
+       font-family: monospace;
+   }
+   
+
+</style>
+</head>
+<body>
+<h1>Object API</h1>
+
+	<p />The object API deals with all the operations shared by
+	<a href="#objects">objects</a>, <a href="#valuetypes">value
+	types</a>, <a href="#arrays">arrays</a>.
+
+	<p />The object API has methods for accessing <a href="#fields">fields</a>, <a href="#properties">properties</a>, <a href="#events">events</a>, <a href="#delegates">delegates</a>.
+
+	<p />There are some advanced uses that are useful to document
+	here dealing with <a href="#remote">remote fields</a>.
+	
+<h2>Synopsis</h2>
+
+<div class="header">
+#include <metadata/object.h>
+
+typedef struct MonoVTable MonoVTable;
+typedef struct _MonoThreadsSync MonoThreadsSync;
+
+typedef struct {
+	MonoVTable *vtable;
+	MonoThreadsSync *synchronisation;
+} MonoObject;
+
+typedef struct {
+	guint32 length;
+	guint32 lower_bound;
+} MonoArrayBounds;
+
+typedef struct {
+	MonoObject obj;
+	/* bounds is NULL for szarrays */
+	MonoArrayBounds *bounds;
+	/* total number of elements of the array */
+	guint32 max_length; 
+	/* we use double to ensure proper alignment on platforms that need it */
+	double vector [MONO_ZERO_LEN_ARRAY];
+} MonoArray;
+
+MonoObject* <a href="#api:mono_object_new">mono_object_new</a>                (MonoDomain *domain, 
+                                            MonoClass *klass);
+            <a href="#api:mono_object_new_alloc_specific"></a>                               
+            <a href="#api:mono_object_new_fast"></a>                               
+MonoObject* <a href="#api:mono_object_new_from_token">mono_object_new_from_token</a>      (MonoDomain *domain, 
+                                            MonoImage *image, 
+                                            guint32 token);
+MonoObject* <a href="#api:mono_object_new_specific">mono_object_new_specific</a>       (MonoVTable *vtable);
+MonoObject* <a href="#api:mono_object_clone">mono_object_clone</a>              (MonoObject *obj);
+MonoClass*  <a href="#api:mono_object_get_class">mono_object_get_class</a>          (MonoObject *obj);
+MonoDomain* <a href="#api:mono_object_get_domain">mono_object_get_domain</a>         (MonoObject *obj);
+MonoMethod* <a href="#api:mono_object_get_virtual_method">mono_object_get_virtual_method</a> (MonoObject *obj, 
+                                            MonoMethod *method);
+            <a href="#api:mono_object_isinst_mbyref"></a>                               
+MonoObject* <a href="#api:mono_object_isinst">mono_object_isinst</a>             (MonoObject *obj, 
+                                            MonoClass *klass);
+gpointer    <a href="#api:mono_object_unbox">mono_object_unbox</a>              (MonoObject *obj);
+MonoObject* <a href="#api:mono_object_castclass_mbyref">mono_object_castclass_mbyref</a>   (MonoObject *obj, 
+                                            MonoClass *klass);
+            <a href="#api:mono_object_is_alive"></a>                               
+guint       <a href="#api:mono_object_get_size">mono_object_get_size</a>           (MonoObject* o);
+MonoObject* <a href="#api:mono_value_box">mono_value_box</a>                 (MonoDomain *domain, 
+                                            MonoClass *class, 
+                                            gpointer value);
+            <a href="#api:mono_value_copy"></a>                               
+            <a href="#api:mono_value_copy_array"></a>                               
+MonoArray*  <a href="#api:mono_array_new">mono_array_new</a>                 (MonoDomain *domain, 
+                                            MonoClass *eclass, 
+                                            uintptr_t n);
+MonoArray*  <a href="#api:mono_array_new_full">mono_array_new_full</a>            (MonoDomain *domain, 
+                                            MonoClass *array_class, 
+                                            uintptr_t *lengths, 
+                                            intptr_t *lower_bounds);
+MonoArray*  <a href="#api:mono_array_new_specific">mono_array_new_specific</a>        (MonoVTable *vtable, 
+                                            uintptr_t n);
+MonoClass*  <a href="#api:mono_array_class_get">mono_array_class_get</a>           (MonoClass *eclass, 
+                                            guint32 rank);
+MonoArray*  <a href="#api:mono_array_clone">mono_array_clone</a>               (MonoArray *array);
+            <a href="#api:mono_array_set"></a>                               
+            <a href="#api:mono_array_setref"></a>                               
+uintptr_t   <a href="#api:mono_array_length">mono_array_length</a>              (MonoArray *array);
+            <a href="#api:mono_array_addr"></a>                               
+char*       <a href="#api:mono_array_addr_with_size">mono_array_addr_with_size</a>      (MonoArray *array, 
+                                            int size, 
+                                            uintptr_t idx);
+            <a href="#api:mono_array_get"></a>                               
+gint32      <a href="#api:mono_array_element_size">mono_array_element_size</a>        (MonoClass *ac);
+            <a href="#api:mono_field_from_token"></a>                               
+            <a href="#api:mono_field_get_flags"></a>                               
+const char* <a href="#api:mono_field_get_name">mono_field_get_name</a>            (MonoClassField *field);
+MonoClass*  <a href="#api:mono_field_get_parent">mono_field_get_parent</a>          (MonoClassField *field);
+MonoType*   <a href="#api:mono_field_get_type">mono_field_get_type</a>            (MonoClassField *field);
+void        <a href="#api:mono_field_get_value">mono_field_get_value</a>           (MonoObject *obj, 
+                                            MonoClassField *field, 
+                                            void *value);
+MonoObject* <a href="#api:mono_field_get_value_object">mono_field_get_value_object</a>    (MonoDomain *domain, 
+                                            MonoClassField *field, 
+                                            MonoObject *obj);
+void        <a href="#api:mono_field_set_value">mono_field_set_value</a>           (MonoObject *obj, 
+                                            MonoClassField *field, 
+                                            void *value);
+void        <a href="#api:mono_field_static_get_value">mono_field_static_get_value</a>    (MonoVTable *vt, 
+                                            MonoClassField *field, 
+                                            void *value);
+void        <a href="#api:mono_field_static_set_value">mono_field_static_set_value</a>    (MonoVTable *vt, 
+                                            MonoClassField *field, 
+                                            void *value);
+            <a href="#api:mono_field_get_object"></a>                               
+            <a href="#api:mono_property_get_object"></a>                               
+guint32     <a href="#api:mono_property_get_flags">mono_property_get_flags</a>        (MonoProperty *prop);
+MonoMethod* <a href="#api:mono_property_get_get_method">mono_property_get_get_method</a>   (MonoProperty *prop);
+            <a href="#api:mono_property_get_name"></a>                               
+MonoClass*  <a href="#api:mono_property_get_parent">mono_property_get_parent</a>       (MonoProperty *prop);
+MonoMethod* <a href="#api:mono_property_get_set_method">mono_property_get_set_method</a>   (MonoProperty *prop);
+MonoObject* <a href="#api:mono_property_get_value">mono_property_get_value</a>        (MonoProperty *prop, 
+                                            void *obj, 
+                                            void **params, 
+                                            MonoObject **exc);
+void        <a href="#api:mono_property_set_value">mono_property_set_value</a>        (MonoProperty *prop, 
+                                            void *obj, 
+                                            void **params, 
+                                            MonoObject **exc);
+            <a href="#api:mono_event_get_object"></a>                               
+MonoMethod* <a href="#api:mono_event_get_add_method">mono_event_get_add_method</a>      (MonoEvent *event);
+guint32     <a href="#api:mono_event_get_flags">mono_event_get_flags</a>           (MonoEvent *event);
+const char* <a href="#api:mono_event_get_name">mono_event_get_name</a>            (MonoEvent *event);
+MonoClass*  <a href="#api:mono_event_get_parent">mono_event_get_parent</a>          (MonoEvent *event);
+MonoMethod* <a href="#api:mono_event_get_raise_method">mono_event_get_raise_method</a>    (MonoEvent *event);
+MonoMethod* <a href="#api:mono_event_get_remove_method">mono_event_get_remove_method</a>   (MonoEvent *event);
+gpointer    <a href="#api:mono_load_remote_field">mono_load_remote_field</a>         (MonoObject *this, 
+                                            MonoClass *klass, 
+                                            MonoClassField *field, 
+                                            gpointer *res);
+MonoObject* <a href="#api:mono_load_remote_field_new">mono_load_remote_field_new</a>     (MonoObject *this, 
+                                            MonoClass *klass, 
+                                            MonoClassField *field);
+void        <a href="#api:mono_store_remote_field">mono_store_remote_field</a>        (MonoObject *this, 
+                                            MonoClass *klass, 
+                                            MonoClassField *field, 
+                                            gpointer val);
+void        <a href="#api:mono_store_remote_field_new">mono_store_remote_field_new</a>    (MonoObject *this, 
+                                            MonoClass *klass, 
+                                            MonoClassField *field, 
+                                            MonoObject *arg);
+
+</div>
+
+	<p />MonoObject is the base definition for all managed objects
+	in the Mono runtime, it represents the <a href="http://www.mono-project.com/monodoc/T:System.Object">System.Object</a>
+	managed type.
+
+	<p />All objects that derive from <a href="http://www.mono-project.com/monodoc/T:System.Object">System.Object</a>
+	do have this base definition.  Derived objects are declared
+	following the pattern where the parent class is the first
+	field of a structure definition, for example:
+
+	<div class="code">
+	typedef struct {
+		MonoObject parent;
+		int my_new_field;
+	} MyNewObject
+	</div>
+
+<a name="objects"></a>
+<h2>Core Object Methods</h2>
+
+ <a name="api:mono_object_new"></a>
+ <div class="api">
+    <div class="api-entry">mono_object_new</div>
+
+    <div class="prototype">MonoObject*
+mono_object_new (MonoDomain *domain, MonoClass *klass)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>klass:</i></dt><dd> the class of the object that we want to create</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  a newly created object whose definition is
+
+	 looked up using <i>klass</i>.   This will not invoke any constructors, 
+	 so the consumer of this routine has to invoke any constructors on
+	 its own to initialize the object.
+	
+<p />
+	 It returns NULL on failure.</blockquote>
+
+
+	<p />For example, if you wanted to create an object of type
+	System.Version, you would use a piece of code like this:
+
+	<div class="code">
+MonoClass *version_class;
+MonoObject *result;
+
+/* Get the class from mscorlib */
+version_class = mono_class_from_name (mono_get_corlib (),
+	"System", "Version");
+
+/* Create an object of that class */
+result = mono_object_new (mono_domain_get (), version_class);
+	</div>
+
+</div> <a name="api:mono_object_new_alloc_specific"></a>
+ <div class="api">
+    <div class="api-entry">mono_object_new_alloc_specific</div>
+
+    <div class="prototype">Prototype: mono_object_new_alloc_specific</div>
+<p />
+
+</div> <a name="api:mono_object_new_fast"></a>
+ <div class="api">
+    <div class="api-entry">mono_object_new_fast</div>
+
+    <div class="prototype">Prototype: mono_object_new_fast</div>
+<p />
+
+</div> <a name="api:mono_object_new_from_token"></a>
+ <div class="api">
+    <div class="api-entry">mono_object_new_from_token</div>
+
+    <div class="prototype">MonoObject*
+mono_object_new_from_token  (MonoDomain *domain, MonoImage *image, guint32 token)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>image:</i></dt><dd> Context where the type_token is hosted</dd><dt><i>token:</i></dt><dd> a token of the type that we want to create</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  A newly created object whose definition is
+
+	 looked up using <i>token</i> in the <i>image</i> image</blockquote>
+
+</div> <a name="api:mono_object_new_specific"></a>
+ <div class="api">
+    <div class="api-entry">mono_object_new_specific</div>
+
+    <div class="prototype">MonoObject*
+mono_object_new_specific (MonoVTable *vtable)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>vtable:</i></dt><dd> the vtable of the object that we want to create</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  A newly created object with class and domain specified
+
+	 by <i>vtable</i></blockquote>
+
+</div> <a name="api:mono_object_clone"></a>
+ <div class="api">
+    <div class="api-entry">mono_object_clone</div>
+
+    <div class="prototype">MonoObject*
+mono_object_clone (MonoObject *obj)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>obj:</i></dt><dd> the object to clone</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  A newly created object who is a shallow copy of <i>obj</i>
+</blockquote>
+
+</div> <a name="api:mono_object_get_class"></a>
+ <div class="api">
+    <div class="api-entry">mono_object_get_class</div>
+
+    <div class="prototype">MonoClass*
+mono_object_get_class (MonoObject *obj)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>obj:</i></dt><dd> object to query</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  the MonOClass of the object.
+</blockquote>
+<b>Remarks</b>
+<p />	 <p />
+
+
+</div> <a name="api:mono_object_get_domain"></a>
+ <div class="api">
+    <div class="api-entry">mono_object_get_domain</div>
+
+    <div class="prototype">MonoDomain*
+mono_object_get_domain (MonoObject *obj)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>obj:</i></dt><dd> object to query</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  the MonoDomain where the object is hosted
+</blockquote>
+<b>Remarks</b>
+<p />	 <p />
+
+
+</div> <a name="api:mono_object_get_virtual_method"></a>
+ <div class="api">
+    <div class="api-entry">mono_object_get_virtual_method</div>
+
+    <div class="prototype">MonoMethod*
+mono_object_get_virtual_method (MonoObject *obj, MonoMethod *method)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>obj:</i></dt><dd> object to operate on.</dd><dt><i>method:</i></dt><dd> method </dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 Retrieves the MonoMethod that would be called on obj if obj is passed as
+	 the instance of a callvirt of method.
+
+</div> <a name="api:mono_object_isinst_mbyref"></a>
+ <div class="api">
+    <div class="api-entry">mono_object_isinst_mbyref</div>
+
+    <div class="prototype">Prototype: mono_object_isinst_mbyref</div>
+<p />
+
+</div> <a name="api:mono_object_isinst"></a>
+ <div class="api">
+    <div class="api-entry">mono_object_isinst</div>
+
+    <div class="prototype">MonoObject*
+mono_object_isinst (MonoObject *obj, MonoClass *klass)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>obj:</i></dt><dd> an object</dd><dt><i>klass:</i></dt><dd> a pointer to a class </dd></blockquote>
+<b>Returns</b>
+<blockquote>	  <i>obj</i> if <i>obj</i> is derived from <i>klass</i>
+</blockquote>
+
+</div> <a name="api:mono_object_unbox"></a>
+ <div class="api">
+    <div class="api-entry">mono_object_unbox</div>
+
+    <div class="prototype">gpointer
+mono_object_unbox (MonoObject *obj)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>obj:</i></dt><dd> object to unbox</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  a pointer to the start of the valuetype boxed in this
+
+	 object.
+	
+	 This method will assert if the object passed is not a valuetype.</blockquote>
+<b>Remarks</b>
+<p />	 <p />
+
+
+</div> <a name="api:mono_object_castclass_mbyref"></a>
+ <div class="api">
+    <div class="api-entry">mono_object_castclass_mbyref</div>
+
+    <div class="prototype">MonoObject*
+mono_object_castclass_mbyref (MonoObject *obj, MonoClass *klass)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>obj:</i></dt><dd> an object</dd><dt><i>klass:</i></dt><dd> a pointer to a class </dd></blockquote>
+<b>Returns</b>
+<blockquote>	  <i>obj</i> if <i>obj</i> is derived from <i>klass</i>, throws an exception otherwise
+</blockquote>
+
+</div> <a name="api:mono_object_is_alive"></a>
+ <div class="api">
+    <div class="api-entry">mono_object_is_alive</div>
+
+    <div class="prototype">Prototype: mono_object_is_alive</div>
+<p />
+
+</div> <a name="api:mono_object_get_size"></a>
+ <div class="api">
+    <div class="api-entry">mono_object_get_size</div>
+
+    <div class="prototype">guint
+mono_object_get_size (MonoObject* o)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>o:</i></dt><dd> object to query</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  the size, in bytes, of <i>o</i>
+</blockquote>
+<b>Remarks</b>
+<p />	 <p />
+
+
+
+<a name="valuetypes"></a>
+</div><h2>Value Types</h2>
+
+ <a name="api:mono_value_box"></a>
+ <div class="api">
+    <div class="api-entry">mono_value_box</div>
+
+    <div class="prototype">MonoObject*
+mono_value_box (MonoDomain *domain, MonoClass *class, gpointer value)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>class:</i></dt><dd> the class of the value</dd><dt><i>value:</i></dt><dd> a pointer to the unboxed data</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  A newly created object which contains <i>value</i>.
+</blockquote>
+
+</div> <a name="api:mono_value_copy"></a>
+ <div class="api">
+    <div class="api-entry">mono_value_copy</div>
+
+    <div class="prototype">Prototype: mono_value_copy</div>
+<p />
+
+</div> <a name="api:mono_value_copy_array"></a>
+ <div class="api">
+    <div class="api-entry">mono_value_copy_array</div>
+
+    <div class="prototype">Prototype: mono_value_copy_array</div>
+<p />
+
+
+<a name="arrays"></a>
+</div><h2>Array Methods</h2>
+
+	<p />Use the <tt>mono_array_new_*</tt> methods to create arrays
+	of a given type.
+
+	<p />For example, the following code creates an array with two
+	elements of type <tt>System.Byte</tt>, and sets the values
+	0xca and 0xfe on it:
+	
+	<pre class="code">
+
+	MonoArray *CreateByteArray (MonoDomain *domain)
+	{
+	    MonoArray *data;
+
+	    data = mono_array_new (domain, mono_get_byte_class (), 2);
+	    mono_array_set (data, guint8, 0, 0xca);
+	    mono_array_set (data, guint8, 0, 0xfe);
+
+	    return data;
+	}
+
+	</pre>
+
+<h3>Creating Arrays</h3>
+
+ <a name="api:mono_array_new"></a>
+ <div class="api">
+    <div class="api-entry">mono_array_new</div>
+
+    <div class="prototype">MonoArray*
+mono_array_new (MonoDomain *domain, MonoClass *eclass, uintptr_t n)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>domain:</i></dt><dd> domain where the object is created</dd><dt><i>eclass:</i></dt><dd> element class</dd><dt><i>n:</i></dt><dd> number of array elements</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 This routine creates a new szarray with <i>n</i> elements of type <i>eclass</i>.
+
+</div> <a name="api:mono_array_new_full"></a>
+ <div class="api">
+    <div class="api-entry">mono_array_new_full</div>
+
+    <div class="prototype">MonoArray*
+mono_array_new_full (MonoDomain *domain, MonoClass *array_class, uintptr_t *lengths, intptr_t *lower_bounds)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>domain:</i></dt><dd> domain where the object is created</dd><dt><i>array_class:</i></dt><dd> array class</dd><dt><i>lengths:</i></dt><dd> lengths for each dimension in the array</dd><dt><i>lower_bounds:</i></dt><dd> lower bounds for each dimension in the array (may be NULL)</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 This routine creates a new array objects with the given dimensions,
+	 lower bounds and type.
+
+</div> <a name="api:mono_array_new_specific"></a>
+ <div class="api">
+    <div class="api-entry">mono_array_new_specific</div>
+
+    <div class="prototype">MonoArray*
+mono_array_new_specific (MonoVTable *vtable, uintptr_t n)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>vtable:</i></dt><dd> a vtable in the appropriate domain for an initialized class</dd><dt><i>n:</i></dt><dd> number of array elements</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 This routine is a fast alternative to mono_array_new() for code which
+	 can be sure about the domain it operates in.
+
+</div> <a name="api:mono_array_class_get"></a>
+ <div class="api">
+    <div class="api-entry">mono_array_class_get</div>
+
+    <div class="prototype">MonoClass*
+mono_array_class_get (MonoClass *eclass, guint32 rank)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>element_class:</i></dt><dd> element class </dd><dt><i>rank:</i></dt><dd> the dimension of the array class</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  a class object describing the array with element type <i>element_type</i> and 
+
+	 dimension <i>rank</i>. </blockquote>
+
+</div> <a name="api:mono_array_clone"></a>
+ <div class="api">
+    <div class="api-entry">mono_array_clone</div>
+
+    <div class="prototype">MonoArray*
+mono_array_clone (MonoArray *array)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>array:</i></dt><dd> the array to clone</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  A newly created array who is a shallow copy of <i>array</i>
+</blockquote>
+
+
+</div><h3>Using Arrays</h3>
+
+ <a name="api:mono_array_set"></a>
+ <div class="api">
+    <div class="api-entry">mono_array_set</div>
+
+    <div class="prototype">Prototype: mono_array_set</div>
+<p />
+
+</div> <a name="api:mono_array_setref"></a>
+ <div class="api">
+    <div class="api-entry">mono_array_setref</div>
+
+    <div class="prototype">Prototype: mono_array_setref</div>
+<p />
+
+</div> <a name="api:mono_array_length"></a>
+ <div class="api">
+    <div class="api-entry">mono_array_length</div>
+
+    <div class="prototype">uintptr_t
+mono_array_length (MonoArray *array)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>array:</i></dt><dd> a MonoArray*</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 Returns the total number of elements in the array. This works for
+	 both vectors and multidimensional arrays.
+
+</div> <a name="api:mono_array_addr"></a>
+ <div class="api">
+    <div class="api-entry">mono_array_addr</div>
+
+    <div class="prototype">Prototype: mono_array_addr</div>
+<p />
+
+</div> <a name="api:mono_array_addr_with_size"></a>
+ <div class="api">
+    <div class="api-entry">mono_array_addr_with_size</div>
+
+    <div class="prototype">char*
+mono_array_addr_with_size (MonoArray *array, int size, uintptr_t idx)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>array:</i></dt><dd> a MonoArray*</dd><dt><i>size:</i></dt><dd> size of the array elements</dd><dt><i>idx:</i></dt><dd> index into the array</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 Returns the address of the <i>idx</i> element in the array.
+
+</div> <a name="api:mono_array_get"></a>
+ <div class="api">
+    <div class="api-entry">mono_array_get</div>
+
+    <div class="prototype">Prototype: mono_array_get</div>
+<p />
+
+</div> <a name="api:mono_array_element_size"></a>
+ <div class="api">
+    <div class="api-entry">mono_array_element_size</div>
+
+    <div class="prototype">gint32
+mono_array_element_size (MonoClass *ac)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>ac:</i></dt><dd> pointer to a #MonoArrayClass</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  the size of single array element.
+</blockquote>
+
+
+<a name="fields"></a>
+</div><h2>Fields</h2>
+
+ <a name="api:mono_field_from_token"></a>
+ <div class="api">
+    <div class="api-entry">mono_field_from_token</div>
+
+    <div class="prototype">Prototype: mono_field_from_token</div>
+<p />
+
+</div> <a name="api:mono_field_get_flags"></a>
+ <div class="api">
+    <div class="api-entry">mono_field_get_flags</div>
+
+    <div class="prototype">Prototype: mono_field_get_flags</div>
+<p />
+
+</div> <a name="api:mono_field_get_name"></a>
+ <div class="api">
+    <div class="api-entry">mono_field_get_name</div>
+
+    <div class="prototype">const char*
+mono_field_get_name (MonoClassField *field)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>field:</i></dt><dd> the MonoClassField to act on</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  the name of the field.
+</blockquote>
+
+</div> <a name="api:mono_field_get_parent"></a>
+ <div class="api">
+    <div class="api-entry">mono_field_get_parent</div>
+
+    <div class="prototype">MonoClass*
+mono_field_get_parent (MonoClassField *field)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>field:</i></dt><dd> the MonoClassField to act on</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  MonoClass where the field was defined.
+</blockquote>
+
+</div> <a name="api:mono_field_get_type"></a>
+ <div class="api">
+    <div class="api-entry">mono_field_get_type</div>
+
+    <div class="prototype">MonoType*
+mono_field_get_type (MonoClassField *field)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>field:</i></dt><dd> the MonoClassField to act on</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  MonoType of the field.
+</blockquote>
+
+</div> <a name="api:mono_field_get_value"></a>
+ <div class="api">
+    <div class="api-entry">mono_field_get_value</div>
+
+    <div class="prototype">void
+mono_field_get_value (MonoObject *obj, MonoClassField *field, void *value)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>obj:</i></dt><dd> Object instance</dd><dt><i>field:</i></dt><dd> MonoClassField describing the field to fetch information from</dd><dt><i>value:</i></dt><dd> pointer to the location where the value will be stored</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 Use this routine to get the value of the field <i>field</i> in the object
+	 passed.
+	
+	 The pointer provided by value must be of the field type, for reference
+	 types this is a MonoObject*, for value types its the actual pointer to
+	 the value type.
+	
+	 For example:
+	     int i;
+	     mono_field_get_value (obj, int_field, &i);
+
+</div> <a name="api:mono_field_get_value_object"></a>
+ <div class="api">
+    <div class="api-entry">mono_field_get_value_object</div>
+
+    <div class="prototype">MonoObject*
+mono_field_get_value_object (MonoDomain *domain, MonoClassField *field, MonoObject *obj)
+	
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>domain:</i></dt><dd> domain where the object will be created (if boxing)</dd><dt><i>field:</i></dt><dd> MonoClassField describing the field to fetch information from</dd><dt><i>obj:</i></dt><dd> The object instance for the field.</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  a new MonoObject with the value from the given field.  If the
+
+	 field represents a value type, the value is boxed.
+	</blockquote>
+
+</div> <a name="api:mono_field_set_value"></a>
+ <div class="api">
+    <div class="api-entry">mono_field_set_value</div>
+
+    <div class="prototype">void
+mono_field_set_value (MonoObject *obj, MonoClassField *field, void *value)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>obj:</i></dt><dd> Instance object</dd><dt><i>field:</i></dt><dd> MonoClassField describing the field to set</dd><dt><i>value:</i></dt><dd> The value to be set</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 Sets the value of the field described by <i>field</i> in the object instance <i>obj</i>
+	 to the value passed in <i>value</i>.   This method should only be used for instance
+	 fields.   For static fields, use mono_field_static_set_value.
+	
+	 The value must be on the native format of the field type. 
+
+</div> <a name="api:mono_field_static_get_value"></a>
+ <div class="api">
+    <div class="api-entry">mono_field_static_get_value</div>
+
+    <div class="prototype">void
+mono_field_static_get_value (MonoVTable *vt, MonoClassField *field, void *value)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>vt:</i></dt><dd> vtable to the object</dd><dt><i>field:</i></dt><dd> MonoClassField describing the field to fetch information from</dd><dt><i>value:</i></dt><dd> where the value is returned</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 Use this routine to get the value of the static field <i>field</i> value.
+	
+	 The pointer provided by value must be of the field type, for reference
+	 types this is a MonoObject*, for value types its the actual pointer to
+	 the value type.
+	
+	 For example:
+	     int i;
+	     mono_field_static_get_value (vt, int_field, &i);
+
+</div> <a name="api:mono_field_static_set_value"></a>
+ <div class="api">
+    <div class="api-entry">mono_field_static_set_value</div>
+
+    <div class="prototype">void
+mono_field_static_set_value (MonoVTable *vt, MonoClassField *field, void *value)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>field:</i></dt><dd> MonoClassField describing the field to set</dd><dt><i>value:</i></dt><dd> The value to be set</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 Sets the value of the static field described by <i>field</i>
+	 to the value passed in <i>value</i>.
+	
+	 The value must be on the native format of the field type. 
+
+</div> <a name="api:mono_field_get_object"></a>
+ <div class="api">
+    <div class="api-entry">mono_field_get_object</div>
+
+    <div class="prototype">Prototype: mono_field_get_object</div>
+<p />
+
+
+<a name="properties"></a>
+</div><h2>Properties</h2>
+
+ <a name="api:mono_property_get_object"></a>
+ <div class="api">
+    <div class="api-entry">mono_property_get_object</div>
+
+    <div class="prototype">Prototype: mono_property_get_object</div>
+<p />
+
+</div> <a name="api:mono_property_get_flags"></a>
+ <div class="api">
+    <div class="api-entry">mono_property_get_flags</div>
+
+    <div class="prototype">guint32
+mono_property_get_flags (MonoProperty *prop)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>prop:</i></dt><dd> the MonoProperty to act on.</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  the flags for the property.
+</blockquote>
+<b>Remarks</b>
+<p />	 
+	 The metadata flags for a property are encoded using the
+	 PROPERTY_ATTRIBUTE_* constants.  See the tabledefs.h file for details.
+	
+
+</div> <a name="api:mono_property_get_get_method"></a>
+ <div class="api">
+    <div class="api-entry">mono_property_get_get_method</div>
+
+    <div class="prototype">MonoMethod*
+mono_property_get_get_method (MonoProperty *prop)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>prop:</i></dt><dd> the MonoProperty to act on.</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  the setter method of the property (A MonoMethod)
+</blockquote>
+
+</div> <a name="api:mono_property_get_name"></a>
+ <div class="api">
+    <div class="api-entry">mono_property_get_name</div>
+
+    <div class="prototype">Prototype: mono_property_get_name</div>
+<p />
+
+</div> <a name="api:mono_property_get_parent"></a>
+ <div class="api">
+    <div class="api-entry">mono_property_get_parent</div>
+
+    <div class="prototype">MonoClass*
+mono_property_get_parent (MonoProperty *prop)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>prop:</i></dt><dd> the MonoProperty to act on.</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  the MonoClass where the property was defined.
+</blockquote>
+
+</div> <a name="api:mono_property_get_set_method"></a>
+ <div class="api">
+    <div class="api-entry">mono_property_get_set_method</div>
+
+    <div class="prototype">MonoMethod*
+mono_property_get_set_method (MonoProperty *prop)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>prop:</i></dt><dd> the MonoProperty to act on.</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  the setter method of the property (A MonoMethod)
+</blockquote>
+
+</div> <a name="api:mono_property_get_value"></a>
+ <div class="api">
+    <div class="api-entry">mono_property_get_value</div>
+
+    <div class="prototype">MonoObject*
+mono_property_get_value (MonoProperty *prop, void *obj, void **params, MonoObject **exc)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>prop:</i></dt><dd> MonoProperty to fetch</dd><dt><i>obj:</i></dt><dd> instance object on which to act</dd><dt><i>params:</i></dt><dd> parameters to pass to the propery</dd><dt><i>exc:</i></dt><dd> optional exception</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  the value from invoking the get method on the property.
+</blockquote>
+<b>Remarks</b>
+<p />	 
+	 Invokes the property's get method with the given arguments on the
+	 object instance obj (or NULL for static properties). 
+	
+<p />
+	 You can pass NULL as the exc argument if you don't want to
+	 catch exceptions, otherwise, *exc will be set to the exception
+	 thrown, if any.  if an exception is thrown, you can't use the
+	 MonoObject* result from the function.
+	
+
+</div> <a name="api:mono_property_set_value"></a>
+ <div class="api">
+    <div class="api-entry">mono_property_set_value</div>
+
+    <div class="prototype">void
+mono_property_set_value (MonoProperty *prop, void *obj, void **params, MonoObject **exc)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>prop:</i></dt><dd> MonoProperty to set</dd><dt><i>obj:</i></dt><dd> instance object on which to act</dd><dt><i>params:</i></dt><dd> parameters to pass to the propery</dd><dt><i>exc:</i></dt><dd> optional exception</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 Invokes the property's set method with the given arguments on the
+	 object instance obj (or NULL for static properties). 
+	
+<p />
+	 You can pass NULL as the exc argument if you don't want to
+	 catch exceptions, otherwise, *exc will be set to the exception
+	 thrown, if any.  if an exception is thrown, you can't use the
+	 MonoObject* result from the function.
+
+
+<a name="events"></a>
+</div><h2>Events</h2>
+
+ <a name="api:mono_event_get_object"></a>
+ <div class="api">
+    <div class="api-entry">mono_event_get_object</div>
+
+    <div class="prototype">Prototype: mono_event_get_object</div>
+<p />
+
+</div> <a name="api:mono_event_get_add_method"></a>
+ <div class="api">
+    <div class="api-entry">mono_event_get_add_method</div>
+
+    <div class="prototype">MonoMethod*
+mono_event_get_add_method (MonoEvent *event)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>event:</i></dt><dd> The MonoEvent to act on.</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  the <i>add</i>' method for the event (a MonoMethod).
+</blockquote>
+
+</div> <a name="api:mono_event_get_flags"></a>
+ <div class="api">
+    <div class="api-entry">mono_event_get_flags</div>
+
+    <div class="prototype">guint32
+mono_event_get_flags (MonoEvent *event)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>event:</i></dt><dd> the MonoEvent to act on.</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  the flags for the event.
+</blockquote>
+<b>Remarks</b>
+<p />	 
+	 The metadata flags for an event are encoded using the
+	 EVENT_* constants.  See the tabledefs.h file for details.
+	
+
+</div> <a name="api:mono_event_get_name"></a>
+ <div class="api">
+    <div class="api-entry">mono_event_get_name</div>
+
+    <div class="prototype">const char*
+mono_event_get_name (MonoEvent *event)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>event:</i></dt><dd> the MonoEvent to act on</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  the name of the event.
+</blockquote>
+
+</div> <a name="api:mono_event_get_parent"></a>
+ <div class="api">
+    <div class="api-entry">mono_event_get_parent</div>
+
+    <div class="prototype">MonoClass*
+mono_event_get_parent (MonoEvent *event)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>event:</i></dt><dd> the MonoEvent to act on.</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  the MonoClass where the event is defined.
+</blockquote>
+
+</div> <a name="api:mono_event_get_raise_method"></a>
+ <div class="api">
+    <div class="api-entry">mono_event_get_raise_method</div>
+
+    <div class="prototype">MonoMethod*
+mono_event_get_raise_method (MonoEvent *event)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>event:</i></dt><dd> The MonoEvent to act on.</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  the <i>raise</i> method for the event (a MonoMethod).
+</blockquote>
+
+</div> <a name="api:mono_event_get_remove_method"></a>
+ <div class="api">
+    <div class="api-entry">mono_event_get_remove_method</div>
+
+    <div class="prototype">MonoMethod*
+mono_event_get_remove_method (MonoEvent *event)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>event:</i></dt><dd> The MonoEvent to act on.</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  the <i>remove</i> method for the event (a MonoMethod).
+</blockquote>
+
+
+<a name="remote"></a>
+</div><h2>Remote Fields</h2>
+ <a name="api:mono_load_remote_field"></a>
+ <div class="api">
+    <div class="api-entry">mono_load_remote_field</div>
+
+    <div class="prototype">gpointer
+mono_load_remote_field (MonoObject *this, MonoClass *klass, MonoClassField *field, gpointer *res)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>this:</i></dt><dd> pointer to an object</dd><dt><i>klass:</i></dt><dd> klass of the object containing <i>field</i></dd><dt><i>field:</i></dt><dd> the field to load</dd><dt><i>res:</i></dt><dd> a storage to store the result</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  an address pointing to the value of field.
+</blockquote>
+<b>Remarks</b>
+<p />	 
+	 This method is called by the runtime on attempts to load fields of
+	 transparent proxy objects. <i>this</i> points to such TP, <i>klass</i> is the class of
+	 the object containing <i>field</i>. <i>res</i> is a storage location which can be
+	 used to store the result.
+	
+
+</div> <a name="api:mono_load_remote_field_new"></a>
+ <div class="api">
+    <div class="api-entry">mono_load_remote_field_new</div>
+
+    <div class="prototype">MonoObject*
+mono_load_remote_field_new (MonoObject *this, MonoClass *klass, MonoClassField *field)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>this:</i></dt><dd> </dd><dt><i>klass:</i></dt><dd> </dd><dt><i>field:</i></dt><dd></dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 Missing documentation.
+
+</div> <a name="api:mono_store_remote_field"></a>
+ <div class="api">
+    <div class="api-entry">mono_store_remote_field</div>
+
+    <div class="prototype">void
+mono_store_remote_field (MonoObject *this, MonoClass *klass, MonoClassField *field, gpointer val)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>this:</i></dt><dd> pointer to an object</dd><dt><i>klass:</i></dt><dd> klass of the object containing <i>field</i></dd><dt><i>field:</i></dt><dd> the field to load</dd><dt><i>val:</i></dt><dd> the value/object to store</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 This method is called by the runtime on attempts to store fields of
+	 transparent proxy objects. <i>this</i> points to such TP, <i>klass</i> is the class of
+	 the object containing <i>field</i>. <i>val</i> is the new value to store in <i>field</i>.
+
+</div></body>
+</html>
+</span>
\ No newline at end of file
diff --git a/docs/deploy/mono-api-profiler.html b/docs/deploy/mono-api-profiler.html
new file mode 100644
index 0000000..c0b89c9
--- /dev/null
+++ b/docs/deploy/mono-api-profiler.html
@@ -0,0 +1,268 @@
+<?xml version="1.0" encoding="utf-8"?><span>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+   <title>mono-api-profiler.html</title>
+   <style type="text/css">
+
+
+   h3 { 
+       font-size: 18px;
+       padding-bottom: 4pt;
+       border-bottom: 2px solid #dddddd;
+   }
+       
+   .api {
+     border: 1px solid;
+     padding: 10pt;
+     margin: 10pt;
+   } 
+
+   .api-entry { 
+       border-bottom: none;
+       font-size: 18px;
+   }
+
+   .prototype {
+     border: 1px solid;
+     background-color: #f2f2f2;
+     padding: 5pt;
+     margin-top: 5pt;
+     margin-bottom: 5pt;  
+   } 
+
+   .header {
+     border: 1px solid;
+     padding: 0 0 5pt 5pt;
+     margin: 10pt;
+     white-space: pre;
+       font-family: monospace;
+   }
+    
+   .code {
+     border: 1px solid;
+     padding: 0 0 5pt 5pt;
+     margin: 10pt;
+     white-space: pre;
+       font-family: monospace;
+   }
+   
+
+</style>
+</head>
+<body>
+<h1>Profiling Interface</h1>
+
+<h3>Profiler Operation</h3>
+
+	<p />The following methods can be used by dynamic profiler
+	methods to monitor different aspects of the program.
+
+	<p />A custom profiler will have one public method defined in
+	the shared library which is the entry point that Mono calls at
+	startup, it has the following signature:
+
+	<pre>
+	void mono_profiler_startup (const char *desc)
+	</pre>
+
+	<p />Where "desc" is the set of arguments that were passed from
+	the command line.  This routine will call
+	<tt>mono_profiler_install</tt> to activate the profiler and
+	will install one or more filters (one of the various
+	<tt>mono_profiler_install_</tt> functions).
+
+	<p />In addition, a profiler developer will typically call
+	<tt>mono_profiler_set_events</tt> to register which kinds of
+	traces should be enabled, these can be an OR-ed combination of
+	the following:
+
+	<pre>
+	MONO_PROFILE_NONE
+        MONO_PROFILE_APPDOMAIN_EVENTS
+        MONO_PROFILE_ASSEMBLY_EVENTS
+        MONO_PROFILE_MODULE_EVENTS    
+        MONO_PROFILE_CLASS_EVENTS     
+        MONO_PROFILE_JIT_COMPILATION  
+        MONO_PROFILE_INLINING         
+        MONO_PROFILE_EXCEPTIONS       
+        MONO_PROFILE_ALLOCATIONS      
+        MONO_PROFILE_GC               
+        MONO_PROFILE_THREADS          
+        MONO_PROFILE_REMOTING         
+        MONO_PROFILE_TRANSITIONS      
+        MONO_PROFILE_ENTER_LEAVE      
+        MONO_PROFILE_COVERAGE         
+        MONO_PROFILE_INS_COVERAGE     
+        MONO_PROFILE_STATISTICAL      
+	</pre>
+
+	<p />Developers can change the set of monitored events at
+	runtime by calling <tt>mono_profiler_set_events</tt>.
+	
+ <a name="api:mono_profiler_install"></a>
+ <div class="api">
+    <div class="api-entry">mono_profiler_install</div>
+
+    <div class="prototype">void
+mono_profiler_install (MonoProfiler *prof, MonoProfileFunc callback)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>prof:</i></dt><dd> a MonoProfiler structure pointer, or a pointer to a derived structure.</dd><dt><i>callback:</i></dt><dd> the function to invoke at shutdown</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 Use mono_profiler_install to activate profiling in the Mono runtime.
+	 Typically developers of new profilers will create a new structure whose
+	 first field is a MonoProfiler and put any extra information that they need
+	 to access from the various profiling callbacks there.
+	
+
+</div> <a name="api:mono_profiler_install_allocation"></a>
+ <div class="api">
+    <div class="api-entry">mono_profiler_install_allocation</div>
+
+    <div class="prototype">Prototype: mono_profiler_install_allocation</div>
+<p />
+
+</div> <a name="api:mono_profiler_install_appdomain"></a>
+ <div class="api">
+    <div class="api-entry">mono_profiler_install_appdomain</div>
+
+    <div class="prototype">Prototype: mono_profiler_install_appdomain</div>
+<p />
+
+</div> <a name="api:mono_profiler_install_assembly"></a>
+ <div class="api">
+    <div class="api-entry">mono_profiler_install_assembly</div>
+
+    <div class="prototype">Prototype: mono_profiler_install_assembly</div>
+<p />
+
+</div> <a name="api:mono_profiler_install_class"></a>
+ <div class="api">
+    <div class="api-entry">mono_profiler_install_class</div>
+
+    <div class="prototype">Prototype: mono_profiler_install_class</div>
+<p />
+
+</div> <a name="api:mono_profiler_install_coverage_filter"></a>
+ <div class="api">
+    <div class="api-entry">mono_profiler_install_coverage_filter</div>
+
+    <div class="prototype">Prototype: mono_profiler_install_coverage_filter</div>
+<p />
+
+</div> <a name="api:mono_profiler_install_enter_leave"></a>
+ <div class="api">
+    <div class="api-entry">mono_profiler_install_enter_leave</div>
+
+    <div class="prototype">void
+mono_profiler_install_enter_leave (MonoProfileMethodFunc enter, MonoProfileMethodFunc fleave)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>enter:</i></dt><dd> the routine to be called on each method entry</dd><dt><i>fleave:</i></dt><dd> the routine to be called each time a method returns</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 Use this routine to install routines that will be called everytime
+	 a method enters and leaves.   The routines will receive as an argument
+	 the MonoMethod representing the method that is entering or leaving.
+
+</div> <a name="api:mono_profiler_install_jit_compile"></a>
+ <div class="api">
+    <div class="api-entry">mono_profiler_install_jit_compile</div>
+
+    <div class="prototype">void 
+mono_profiler_install_jit_compile (MonoProfileMethodFunc start, MonoProfileMethodResult end)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>start:</i></dt><dd> the routine to be called when the JIT process starts.</dd><dt><i>end:</i></dt><dd> the routine to be called when the JIT process ends.</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 Use this routine to install routines that will be called when JIT 
+	 compilation of a method starts and completes.
+
+</div> <a name="api:mono_profiler_install_module"></a>
+ <div class="api">
+    <div class="api-entry">mono_profiler_install_module</div>
+
+    <div class="prototype">Prototype: mono_profiler_install_module</div>
+<p />
+
+</div> <a name="api:mono_profiler_install_thread"></a>
+ <div class="api">
+    <div class="api-entry">mono_profiler_install_thread</div>
+
+    <div class="prototype">Prototype: mono_profiler_install_thread</div>
+<p />
+
+</div> <a name="api:mono_profiler_install_transition"></a>
+ <div class="api">
+    <div class="api-entry">mono_profiler_install_transition</div>
+
+    <div class="prototype">Prototype: mono_profiler_install_transition</div>
+<p />
+
+</div> <a name="api:mono_profiler_install_gc"></a>
+ <div class="api">
+    <div class="api-entry">mono_profiler_install_gc</div>
+
+    <div class="prototype">Prototype: mono_profiler_install_gc</div>
+<p />
+
+</div> <a name="api:mono_profiler_install_statistical"></a>
+ <div class="api">
+    <div class="api-entry">mono_profiler_install_statistical</div>
+
+    <div class="prototype">Prototype: mono_profiler_install_statistical</div>
+<p />
+
+</div> <a name="api:mono_profiler_set_events"></a>
+ <div class="api">
+    <div class="api-entry">mono_profiler_set_events</div>
+
+    <div class="prototype">void
+mono_profiler_set_events (MonoProfileFlags events)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>events:</i></dt><dd> an ORed set of values made up of MONO_PROFILER_ flags</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 The events descriped in the <i>events</i> argument is a set of flags
+	 that represent which profiling events must be triggered.  For
+	 example if you have registered a set of methods for tracking
+	 JIT compilation start and end with mono_profiler_install_jit_compile,
+	 you will want to pass the MONO_PROFILE_JIT_COMPILATION flag to
+	 this routine.
+	
+	 You can call mono_profile_set_events more than once and you can
+	 do this at runtime to modify which methods are invoked.
+
+</div> <a name="api:mono_profiler_get_events"></a>
+ <div class="api">
+    <div class="api-entry">mono_profiler_get_events</div>
+
+    <div class="prototype">MonoProfileFlags
+mono_profiler_get_events (void)
+
+</div>
+<p />
+<b>Remarks</b>
+<p />	 
+	 Returns a list of active events that will be intercepted. 
+
+
+</div><h3>Coverage</h3>
+
+	<p />To support profiling modules that need to do code coverage
+	analysis, the following routines is provided:
+	
+</body>
+</html>
+</span>
\ No newline at end of file
diff --git a/docs/deploy/mono-api-reflection.html b/docs/deploy/mono-api-reflection.html
new file mode 100644
index 0000000..e51b28d
--- /dev/null
+++ b/docs/deploy/mono-api-reflection.html
@@ -0,0 +1,257 @@
+<?xml version="1.0" encoding="utf-8"?><span>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+   <title>mono-api-reflection.html</title>
+   <style type="text/css">
+
+
+   h3 { 
+       font-size: 18px;
+       padding-bottom: 4pt;
+       border-bottom: 2px solid #dddddd;
+   }
+       
+   .api {
+     border: 1px solid;
+     padding: 10pt;
+     margin: 10pt;
+   } 
+
+   .api-entry { 
+       border-bottom: none;
+       font-size: 18px;
+   }
+
+   .prototype {
+     border: 1px solid;
+     background-color: #f2f2f2;
+     padding: 5pt;
+     margin-top: 5pt;
+     margin-bottom: 5pt;  
+   } 
+
+   .header {
+     border: 1px solid;
+     padding: 0 0 5pt 5pt;
+     margin: 10pt;
+     white-space: pre;
+       font-family: monospace;
+   }
+    
+   .code {
+     border: 1px solid;
+     padding: 0 0 5pt 5pt;
+     margin: 10pt;
+     white-space: pre;
+       font-family: monospace;
+   }
+   
+
+</style>
+</head>
+<body>
+<h2>Fetching Types, and Basic Reflection</h2>
+
+ <a name="api:mono_reflection_get_custom_attrs_blob"></a>
+ <div class="api">
+    <div class="api-entry">mono_reflection_get_custom_attrs_blob</div>
+
+    <div class="prototype">Prototype: mono_reflection_get_custom_attrs_blob</div>
+<p />
+
+</div> <a name="api:mono_reflection_get_custom_attrs"></a>
+ <div class="api">
+    <div class="api-entry">mono_reflection_get_custom_attrs</div>
+
+    <div class="prototype">Prototype: mono_reflection_get_custom_attrs</div>
+<p />
+
+</div> <a name="api:mono_custom_attrs_get_attr"></a>
+ <div class="api">
+    <div class="api-entry">mono_custom_attrs_get_attr</div>
+
+    <div class="prototype">Prototype: mono_custom_attrs_get_attr</div>
+<p />
+
+</div> <a name="api:mono_reflection_get_token"></a>
+ <div class="api">
+    <div class="api-entry">mono_reflection_get_token</div>
+
+    <div class="prototype">Prototype: mono_reflection_get_token</div>
+<p />
+
+</div> <a name="api:mono_reflection_get_type"></a>
+ <div class="api">
+    <div class="api-entry">mono_reflection_get_type</div>
+
+    <div class="prototype">Prototype: mono_reflection_get_type</div>
+<p />
+
+</div> <a name="api:mono_reflection_parse_type"></a>
+ <div class="api">
+    <div class="api-entry">mono_reflection_parse_type</div>
+
+    <div class="prototype">Prototype: mono_reflection_parse_type</div>
+<p />
+
+</div> <a name="api:mono_reflection_type_from_name"></a>
+ <div class="api">
+    <div class="api-entry">mono_reflection_type_from_name</div>
+
+    <div class="prototype">Prototype: mono_reflection_type_from_name</div>
+<p />
+
+</div> <a name="api:mono_reflection_get_custom_attrs_info"></a>
+ <div class="api">
+    <div class="api-entry">mono_reflection_get_custom_attrs_info</div>
+
+    <div class="prototype">Prototype: mono_reflection_get_custom_attrs_info</div>
+<p />
+
+
+</div><h2>Custom Attributes</h2>
+
+ <a name="api:mono_custom_attrs_construct"></a>
+ <div class="api">
+    <div class="api-entry">mono_custom_attrs_construct</div>
+
+    <div class="prototype">Prototype: mono_custom_attrs_construct</div>
+<p />
+
+</div> <a name="api:mono_custom_attrs_free"></a>
+ <div class="api">
+    <div class="api-entry">mono_custom_attrs_free</div>
+
+    <div class="prototype">Prototype: mono_custom_attrs_free</div>
+<p />
+
+</div> <a name="api:mono_custom_attrs_from_assembly"></a>
+ <div class="api">
+    <div class="api-entry">mono_custom_attrs_from_assembly</div>
+
+    <div class="prototype">Prototype: mono_custom_attrs_from_assembly</div>
+<p />
+
+</div> <a name="api:mono_custom_attrs_from_class"></a>
+ <div class="api">
+    <div class="api-entry">mono_custom_attrs_from_class</div>
+
+    <div class="prototype">Prototype: mono_custom_attrs_from_class</div>
+<p />
+
+</div> <a name="api:mono_custom_attrs_from_event"></a>
+ <div class="api">
+    <div class="api-entry">mono_custom_attrs_from_event</div>
+
+    <div class="prototype">Prototype: mono_custom_attrs_from_event</div>
+<p />
+
+</div> <a name="api:mono_custom_attrs_from_field"></a>
+ <div class="api">
+    <div class="api-entry">mono_custom_attrs_from_field</div>
+
+    <div class="prototype">Prototype: mono_custom_attrs_from_field</div>
+<p />
+
+</div> <a name="api:mono_custom_attrs_from_index"></a>
+ <div class="api">
+    <div class="api-entry">mono_custom_attrs_from_index</div>
+
+    <div class="prototype">MonoCustomAttrInfo*
+mono_custom_attrs_from_index (MonoImage *image, guint32 idx)
+
+</div>
+<p />
+<b>Returns</b>
+<blockquote>	  NULL if no attributes are found or if a loading error occurs.
+</blockquote>
+
+</div> <a name="api:mono_custom_attrs_from_method"></a>
+ <div class="api">
+    <div class="api-entry">mono_custom_attrs_from_method</div>
+
+    <div class="prototype">Prototype: mono_custom_attrs_from_method</div>
+<p />
+
+</div> <a name="api:mono_custom_attrs_from_param"></a>
+ <div class="api">
+    <div class="api-entry">mono_custom_attrs_from_param</div>
+
+    <div class="prototype">Prototype: mono_custom_attrs_from_param</div>
+<p />
+
+</div> <a name="api:mono_custom_attrs_from_property"></a>
+ <div class="api">
+    <div class="api-entry">mono_custom_attrs_from_property</div>
+
+    <div class="prototype">Prototype: mono_custom_attrs_from_property</div>
+<p />
+
+</div> <a name="api:mono_custom_attrs_has_attr"></a>
+ <div class="api">
+    <div class="api-entry">mono_custom_attrs_has_attr</div>
+
+    <div class="prototype">Prototype: mono_custom_attrs_has_attr</div>
+<p />
+
+
+</div><h2>
+ <a name="api:mono_module_file_get_object"></a>
+ <div class="api">
+    <div class="api-entry">mono_module_file_get_object</div>
+
+    <div class="prototype">Prototype: mono_module_file_get_object</div>
+<p />
+
+</div> <a name="api:mono_module_get_object"></a>
+ <div class="api">
+    <div class="api-entry">mono_module_get_object</div>
+
+    <div class="prototype">Prototype: mono_module_get_object</div>
+<p />
+
+</div> <a name="api:mono_method_body_get_object"></a>
+ <div class="api">
+    <div class="api-entry">mono_method_body_get_object</div>
+
+    <div class="prototype">Prototype: mono_method_body_get_object</div>
+<p />
+
+</div> <a name="api:mono_event_get_object"></a>
+ <div class="api">
+    <div class="api-entry">mono_event_get_object</div>
+
+    <div class="prototype">Prototype: mono_event_get_object</div>
+<p />
+
+</div> <a name="api:mono_assembly_get_object"></a>
+ <div class="api">
+    <div class="api-entry">mono_assembly_get_object</div>
+
+    <div class="prototype">Prototype: mono_assembly_get_object</div>
+<p />
+
+</div> <a name="api:mono_param_get_objects"></a>
+ <div class="api">
+    <div class="api-entry">mono_param_get_objects</div>
+
+    <div class="prototype">Prototype: mono_param_get_objects</div>
+<p />
+
+</div> <a name="api:mono_field_get_object"></a>
+ <div class="api">
+    <div class="api-entry">mono_field_get_object</div>
+
+    <div class="prototype">Prototype: mono_field_get_object</div>
+<p />
+
+</div> <a name="api:mono_property_get_object"></a>
+ <div class="api">
+    <div class="api-entry">mono_property_get_object</div>
+
+    <div class="prototype">Prototype: mono_property_get_object</div>
+<p />
+
+</div></h2></body>
+</html>
+</span>
\ No newline at end of file
diff --git a/docs/deploy/mono-api-security.html b/docs/deploy/mono-api-security.html
new file mode 100644
index 0000000..9643964
--- /dev/null
+++ b/docs/deploy/mono-api-security.html
@@ -0,0 +1,130 @@
+<?xml version="1.0" encoding="utf-8"?><span>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+   <title>mono-api-security.html</title>
+   <style type="text/css">
+
+
+   h3 { 
+       font-size: 18px;
+       padding-bottom: 4pt;
+       border-bottom: 2px solid #dddddd;
+   }
+       
+   .api {
+     border: 1px solid;
+     padding: 10pt;
+     margin: 10pt;
+   } 
+
+   .api-entry { 
+       border-bottom: none;
+       font-size: 18px;
+   }
+
+   .prototype {
+     border: 1px solid;
+     background-color: #f2f2f2;
+     padding: 5pt;
+     margin-top: 5pt;
+     margin-bottom: 5pt;  
+   } 
+
+   .header {
+     border: 1px solid;
+     padding: 0 0 5pt 5pt;
+     margin: 10pt;
+     white-space: pre;
+       font-family: monospace;
+   }
+    
+   .code {
+     border: 1px solid;
+     padding: 0 0 5pt 5pt;
+     margin: 10pt;
+     white-space: pre;
+       font-family: monospace;
+   }
+   
+
+</style>
+</head>
+<body>
+<h3>Security Manager</h3>
+
+ <a name="api:mono_get_context_capture_method"></a>
+ <div class="api">
+    <div class="api-entry">mono_get_context_capture_method</div>
+
+    <div class="prototype">Prototype: mono_get_context_capture_method</div>
+<p />
+
+
+</div><h3>Declarative Security</h3>
+
+ <a name="api:mono_declsec_flags_from_assembly"></a>
+ <div class="api">
+    <div class="api-entry">mono_declsec_flags_from_assembly</div>
+
+    <div class="prototype">Prototype: mono_declsec_flags_from_assembly</div>
+<p />
+
+</div> <a name="api:mono_declsec_flags_from_class"></a>
+ <div class="api">
+    <div class="api-entry">mono_declsec_flags_from_class</div>
+
+    <div class="prototype">Prototype: mono_declsec_flags_from_class</div>
+<p />
+
+</div> <a name="api:mono_declsec_flags_from_method"></a>
+ <div class="api">
+    <div class="api-entry">mono_declsec_flags_from_method</div>
+
+    <div class="prototype">Prototype: mono_declsec_flags_from_method</div>
+<p />
+
+</div> <a name="api:mono_declsec_get_assembly_action"></a>
+ <div class="api">
+    <div class="api-entry">mono_declsec_get_assembly_action</div>
+
+    <div class="prototype">Prototype: mono_declsec_get_assembly_action</div>
+<p />
+
+</div> <a name="api:mono_declsec_get_class_action"></a>
+ <div class="api">
+    <div class="api-entry">mono_declsec_get_class_action</div>
+
+    <div class="prototype">Prototype: mono_declsec_get_class_action</div>
+<p />
+
+</div> <a name="api:mono_declsec_get_demands"></a>
+ <div class="api">
+    <div class="api-entry">mono_declsec_get_demands</div>
+
+    <div class="prototype">Prototype: mono_declsec_get_demands</div>
+<p />
+
+</div> <a name="api:mono_declsec_get_inheritdemands_class"></a>
+ <div class="api">
+    <div class="api-entry">mono_declsec_get_inheritdemands_class</div>
+
+    <div class="prototype">Prototype: mono_declsec_get_inheritdemands_class</div>
+<p />
+
+</div> <a name="api:mono_declsec_get_inheritdemands_method"></a>
+ <div class="api">
+    <div class="api-entry">mono_declsec_get_inheritdemands_method</div>
+
+    <div class="prototype">Prototype: mono_declsec_get_inheritdemands_method</div>
+<p />
+
+</div> <a name="api:mono_declsec_get_linkdemands"></a>
+ <div class="api">
+    <div class="api-entry">mono_declsec_get_linkdemands</div>
+
+    <div class="prototype">Prototype: mono_declsec_get_linkdemands</div>
+<p />
+
+</div></body>
+</html>
+</span>
\ No newline at end of file
diff --git a/docs/deploy/mono-api-string.html b/docs/deploy/mono-api-string.html
new file mode 100644
index 0000000..54b012b
--- /dev/null
+++ b/docs/deploy/mono-api-string.html
@@ -0,0 +1,405 @@
+<?xml version="1.0" encoding="utf-8"?><span>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+   <title>mono-api-string.html</title>
+   <style type="text/css">
+
+
+   h3 { 
+       font-size: 18px;
+       padding-bottom: 4pt;
+       border-bottom: 2px solid #dddddd;
+   }
+       
+   .api {
+     border: 1px solid;
+     padding: 10pt;
+     margin: 10pt;
+   } 
+
+   .api-entry { 
+       border-bottom: none;
+       font-size: 18px;
+   }
+
+   .prototype {
+     border: 1px solid;
+     background-color: #f2f2f2;
+     padding: 5pt;
+     margin-top: 5pt;
+     margin-bottom: 5pt;  
+   } 
+
+   .header {
+     border: 1px solid;
+     padding: 0 0 5pt 5pt;
+     margin: 10pt;
+     white-space: pre;
+       font-family: monospace;
+   }
+    
+   .code {
+     border: 1px solid;
+     padding: 0 0 5pt 5pt;
+     margin: 10pt;
+     white-space: pre;
+       font-family: monospace;
+   }
+   
+
+</style>
+</head>
+<body>
+<h2>Strings</h2>
+
+	<p />Strings representation inside the Mono runtime.
+
+<h3>Synopsis</h3>
+
+	<div class="header">
+#include <metadata/object.h>
+
+typedef struct {
+	MonoObject object;
+	gint32 length;
+	gunichar2 chars [0];
+} MonoString;
+
+MonoString*    <a href="#api:mono_string_new">mono_string_new</a>            (MonoDomain *domain, 
+                                           const char *text);
+MonoString*    <a href="#api:mono_string_new_len">mono_string_new_len</a>        (MonoDomain *domain, 
+                                           const char *text, 
+                                           guint length);
+MonoString*    <a href="#api:mono_string_new_size">mono_string_new_size</a>       (MonoDomain *domain, 
+                                           gint32 len);
+MonoString*    <a href="#api:mono_string_new_utf16">mono_string_new_utf16</a>      (MonoDomain *domain, 
+                                           const guint16 *text, 
+                                           gint32 len);
+MonoString*    <a href="#api:mono_string_from_utf16">mono_string_from_utf16</a>     (gunichar2 *data);
+mono_unichar2* <a href="#api:mono_string_to_utf16">mono_string_to_utf16</a>       (MonoString *s);
+char*          <a href="#api:mono_string_to_utf8">mono_string_to_utf8</a>        (MonoString *s);
+gboolean       <a href="#api:mono_string_equal">mono_string_equal</a>          (MonoString *s1, 
+                                           MonoString *s2);
+guint          <a href="#api:mono_string_hash">mono_string_hash</a>           (MonoString *s);
+MonoString*    <a href="#api:mono_string_intern">mono_string_intern</a>         (MonoString *str);
+MonoString*    <a href="#api:mono_string_is_interned">mono_string_is_interned</a>    (MonoString *o);
+MonoString*    <a href="#api:mono_string_new_wrapper">mono_string_new_wrapper</a>    (const char *text);
+gunichar2*     <a href="#api:mono_string_chars">mono_string_chars</a>          (MonoString *s);
+int            <a href="#api:mono_string_length">mono_string_length</a>         (MonoString *s);
+gunichar2*     <a href="#api:mono_unicode_from_external">mono_unicode_from_external</a> (const gchar *in, 
+                                           gsize *bytes);
+               <a href="#api:mono_unicode_to_external"></a>                           
+               <a href="#api:mono_utf8_from_external"></a>                           
+
+	</div>
+
+	<p />All of the operations on strings are done on pointers to
+	MonoString objects, like this:
+
+	<div class="code">
+	MonoString *hello = mono_string_new (mono_domain_get (), "hello, world");
+	</div>
+
+	<p />Strings are bound to a particular application domain, which
+	is why it is necessary to pass a MonoDomain argument as the
+	first parameter to all the constructor functions. 
+
+	<p />Typically, you want to create the strings on the current
+	application domain, so a call to <tt>mono_domain_get()</tt> is
+	sufficient.
+	
+<h3>Constructors</h3>
+	
+ <a name="api:mono_string_new"></a>
+ <div class="api">
+    <div class="api-entry">mono_string_new</div>
+
+    <div class="prototype">MonoString*
+mono_string_new (MonoDomain *domain, const char *text)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>text:</i></dt><dd> a pointer to an utf8 string</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  A newly created string object which contains <i>text</i>.
+</blockquote>
+
+</div> <a name="api:mono_string_new_len"></a>
+ <div class="api">
+    <div class="api-entry">mono_string_new_len</div>
+
+    <div class="prototype">MonoString*
+mono_string_new_len (MonoDomain *domain, const char *text, guint length)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>text:</i></dt><dd> a pointer to an utf8 string</dd><dt><i>length:</i></dt><dd> number of bytes in <i>text</i> to consider</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  A newly created string object which contains <i>text</i>.
+</blockquote>
+
+</div> <a name="api:mono_string_new_size"></a>
+ <div class="api">
+    <div class="api-entry">mono_string_new_size</div>
+
+    <div class="prototype">MonoString*
+mono_string_new_size (MonoDomain *domain, gint32 len)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>text:</i></dt><dd> a pointer to an utf16 string</dd><dt><i>len:</i></dt><dd> the length of the string</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  A newly created string object of <i>len</i>
+</blockquote>
+
+</div> <a name="api:mono_string_new_utf16"></a>
+ <div class="api">
+    <div class="api-entry">mono_string_new_utf16</div>
+
+    <div class="prototype">MonoString*
+mono_string_new_utf16 (MonoDomain *domain, const guint16 *text, gint32 len)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>text:</i></dt><dd> a pointer to an utf16 string</dd><dt><i>len:</i></dt><dd> the length of the string</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  A newly created string object which contains <i>text</i>.
+</blockquote>
+
+</div> <a name="api:mono_string_from_utf16"></a>
+ <div class="api">
+    <div class="api-entry">mono_string_from_utf16</div>
+
+    <div class="prototype">MonoString*
+mono_string_from_utf16 (gunichar2 *data)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>data:</i></dt><dd> the UTF16 string (LPWSTR) to convert</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  a MonoString.
+</blockquote>
+<b>Remarks</b>
+<p />	 
+	 Converts a NULL terminated UTF16 string (LPWSTR) to a MonoString.
+	
+
+
+</div><h3>Conversions</h3>
+
+ <a name="api:mono_string_to_utf16"></a>
+ <div class="api">
+    <div class="api-entry">mono_string_to_utf16</div>
+
+    <div class="prototype">mono_unichar2*
+mono_string_to_utf16 (MonoString *s)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>s:</i></dt><dd> a MonoString</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 Return an null-terminated array of the utf-16 chars
+	 contained in <i>s</i>. The result must be freed with g_free().
+	 This is a temporary helper until our string implementation
+	 is reworked to always include the null terminating char.
+
+</div> <a name="api:mono_string_to_utf8"></a>
+ <div class="api">
+    <div class="api-entry">mono_string_to_utf8</div>
+
+    <div class="prototype">char*
+mono_string_to_utf8 (MonoString *s)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>s:</i></dt><dd> a System.String</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 Returns the UTF8 representation for <i>s</i>.
+	 The resulting buffer needs to be freed with mono_free().
+	
+	 <i>deprecated</i> Use mono_string_to_utf8_checked to avoid having an exception arbritraly raised.
+
+
+</div><h3>Methods</h3>
+
+ <a name="api:mono_string_equal"></a>
+ <div class="api">
+    <div class="api-entry">mono_string_equal</div>
+
+    <div class="prototype">gboolean
+mono_string_equal (MonoString *s1, MonoString *s2)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>s1:</i></dt><dd> First string to compare</dd><dt><i>s2:</i></dt><dd> Second string to compare</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 Returns FALSE if the strings differ.
+
+</div> <a name="api:mono_string_hash"></a>
+ <div class="api">
+    <div class="api-entry">mono_string_hash</div>
+
+    <div class="prototype">guint
+mono_string_hash (MonoString *s)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>s:</i></dt><dd> the string to hash</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 Returns the hash for the string.
+
+</div> <a name="api:mono_string_intern"></a>
+ <div class="api">
+    <div class="api-entry">mono_string_intern</div>
+
+    <div class="prototype">MonoString*
+mono_string_intern (MonoString *str)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>o:</i></dt><dd> String to intern</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  The interned string.
+</blockquote>
+<b>Remarks</b>
+<p />	 
+	 Interns the string passed.  
+
+</div> <a name="api:mono_string_is_interned"></a>
+ <div class="api">
+    <div class="api-entry">mono_string_is_interned</div>
+
+    <div class="prototype">MonoString*
+mono_string_is_interned (MonoString *o)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>o:</i></dt><dd> String to probe</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 Returns whether the string has been interned.
+
+</div> <a name="api:mono_string_new_wrapper"></a>
+ <div class="api">
+    <div class="api-entry">mono_string_new_wrapper</div>
+
+    <div class="prototype">MonoString*
+mono_string_new_wrapper (const char *text)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>text:</i></dt><dd> pointer to utf8 characters.</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 Helper function to create a string object from <i>text</i> in the current domain.
+
+</div> <a name="api:mono_string_chars"></a>
+ <div class="api">
+    <div class="api-entry">mono_string_chars</div>
+
+    <div class="prototype">gunichar2*
+mono_string_chars (MonoString *s)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>s:</i></dt><dd> a MonoString</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 Returns a pointer to the UCS16 characters stored in the MonoString
+
+</div> <a name="api:mono_string_length"></a>
+ <div class="api">
+    <div class="api-entry">mono_string_length</div>
+
+    <div class="prototype">int
+mono_string_length (MonoString *s)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>s:</i></dt><dd> MonoString</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 Returns the lenght in characters of the string
+
+
+
+</div><h3>Other Encodings</h3>
+
+	<p />These routines are used when coping with strings that come
+	from Mono's environment, and might be encoded in one or more
+	of the external encodings.
+
+	<p />For example, some file systems might historically contain a
+	mix of file names with both old and new encodings, typically
+	UTF8 for new files, and the old files would be encoded in an 8
+	bit character set (ISO-8859-1 for example).
+	
+	<p />These routines try a number of encodings, those specified
+	in the <tt>MONO_ENCODINGS</tt> environment variable and return
+	unicode strings that can be used internally.
+
+	<p />See the mono(1) man page for more details.
+	
+ <a name="api:mono_unicode_from_external"></a>
+ <div class="api">
+    <div class="api-entry">mono_unicode_from_external</div>
+
+    <div class="prototype">gunichar2*
+mono_unicode_from_external (const gchar *in, gsize *bytes)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>in:</i></dt><dd> pointers to the buffer.</dd><dt><i>bytes:</i></dt><dd> number of bytes in the string.</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 Tries to turn a NULL-terminated string into UTF16.
+	
+	 First, see if it's valid UTF8, in which case just turn it directly
+	 into UTF16.  Next, run through the colon-separated encodings in
+	 MONO_EXTERNAL_ENCODINGS and do an iconv conversion on each,
+	 returning the first successful conversion to UTF16.  If no
+	 conversion succeeds, return NULL.
+	
+	 Callers must free the returned string if not NULL. bytes holds the number
+	 of bytes in the returned string, not including the terminator.
+
+</div> <a name="api:mono_unicode_to_external"></a>
+ <div class="api">
+    <div class="api-entry">mono_unicode_to_external</div>
+
+    <div class="prototype">gchar*mono_unicode_to_external (const gunichar2 *uni)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>uni:</i></dt><dd> an UTF16 string to conver to an external representation.</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 Turns NULL-terminated UTF16 into either UTF8, or the first
+	 working item in MONO_EXTERNAL_ENCODINGS if set.  If no conversions
+	 work, then UTF8 is returned.
+	
+	 Callers must free the returned string.
+
+</div></body>
+</html>
+</span>
\ No newline at end of file
diff --git a/docs/deploy/mono-api-threads.html b/docs/deploy/mono-api-threads.html
new file mode 100644
index 0000000..96fa796
--- /dev/null
+++ b/docs/deploy/mono-api-threads.html
@@ -0,0 +1,185 @@
+<?xml version="1.0" encoding="utf-8"?><span>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+   <title>mono-api-threads.html</title>
+   <style type="text/css">
+
+
+   h3 { 
+       font-size: 18px;
+       padding-bottom: 4pt;
+       border-bottom: 2px solid #dddddd;
+   }
+       
+   .api {
+     border: 1px solid;
+     padding: 10pt;
+     margin: 10pt;
+   } 
+
+   .api-entry { 
+       border-bottom: none;
+       font-size: 18px;
+   }
+
+   .prototype {
+     border: 1px solid;
+     background-color: #f2f2f2;
+     padding: 5pt;
+     margin-top: 5pt;
+     margin-bottom: 5pt;  
+   } 
+
+   .header {
+     border: 1px solid;
+     padding: 0 0 5pt 5pt;
+     margin: 10pt;
+     white-space: pre;
+       font-family: monospace;
+   }
+    
+   .code {
+     border: 1px solid;
+     padding: 0 0 5pt 5pt;
+     margin: 10pt;
+     white-space: pre;
+       font-family: monospace;
+   }
+   
+
+</style>
+</head>
+<body>
+<h2>Working with threads</h2>
+
+<h3>Thread API</h3>
+ <a name="api:mono_thread_attach"></a>
+ <div class="api">
+    <div class="api-entry">mono_thread_attach</div>
+
+    <div class="prototype">Prototype: mono_thread_attach</div>
+<p />
+
+</div> <a name="api:mono_thread_create"></a>
+ <div class="api">
+    <div class="api-entry">mono_thread_create</div>
+
+    <div class="prototype">Prototype: mono_thread_create</div>
+<p />
+
+</div> <a name="api:mono_thread_current"></a>
+ <div class="api">
+    <div class="api-entry">mono_thread_current</div>
+
+    <div class="prototype">Prototype: mono_thread_current</div>
+<p />
+
+</div> <a name="api:mono_thread_detach"></a>
+ <div class="api">
+    <div class="api-entry">mono_thread_detach</div>
+
+    <div class="prototype">Prototype: mono_thread_detach</div>
+<p />
+
+</div> <a name="api:mono_thread_exit"></a>
+ <div class="api">
+    <div class="api-entry">mono_thread_exit</div>
+
+    <div class="prototype">Prototype: mono_thread_exit</div>
+<p />
+
+</div> <a name="api:mono_thread_manage"></a>
+ <div class="api">
+    <div class="api-entry">mono_thread_manage</div>
+
+    <div class="prototype">Prototype: mono_thread_manage</div>
+<p />
+
+</div> <a name="api:mono_thread_new_init"></a>
+ <div class="api">
+    <div class="api-entry">mono_thread_new_init</div>
+
+    <div class="prototype">Prototype: mono_thread_new_init</div>
+<p />
+
+</div> <a name="api:mono_threads_get_default_stacksize"></a>
+ <div class="api">
+    <div class="api-entry">mono_threads_get_default_stacksize</div>
+
+    <div class="prototype">Prototype: mono_threads_get_default_stacksize</div>
+<p />
+
+</div> <a name="api:mono_threads_install_cleanup"></a>
+ <div class="api">
+    <div class="api-entry">mono_threads_install_cleanup</div>
+
+    <div class="prototype">Prototype: mono_threads_install_cleanup</div>
+<p />
+
+</div> <a name="api:mono_threads_set_default_stacksize"></a>
+ <div class="api">
+    <div class="api-entry">mono_threads_set_default_stacksize</div>
+
+    <div class="prototype">Prototype: mono_threads_set_default_stacksize</div>
+<p />
+
+</div> <a name="api:mono_thread_stop"></a>
+ <div class="api">
+    <div class="api-entry">mono_thread_stop</div>
+
+    <div class="prototype">Prototype: mono_thread_stop</div>
+<p />
+
+
+</div> <a name="api:mono_thread_get_main"></a>
+ <div class="api">
+    <div class="api-entry">mono_thread_get_main</div>
+
+    <div class="prototype">Prototype: mono_thread_get_main</div>
+<p />
+
+</div> <a name="api:mono_thread_set_main"></a>
+ <div class="api">
+    <div class="api-entry">mono_thread_set_main</div>
+
+    <div class="prototype">void
+mono_thread_set_main (MonoThread *thread)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>thread:</i></dt><dd> thread to set as the main thread</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 This function can be used to instruct the runtime to treat <i>thread</i>
+	 as the main thread, ie, the thread that would normally execute the Main()
+	 method. This basically means that at the end of <i>thread</i>, the runtime will
+	 wait for the existing foreground threads to quit and other such details.
+
+</div> <a name="api:mono_pthread_key_for_tls"></a>
+ <div class="api">
+    <div class="api-entry">mono_pthread_key_for_tls</div>
+
+    <div class="prototype">Prototype: mono_pthread_key_for_tls</div>
+<p />
+
+
+</div><h3>Monitors</h3>
+
+ <a name="api:mono_monitor_enter"></a>
+ <div class="api">
+    <div class="api-entry">mono_monitor_enter</div>
+
+    <div class="prototype">Prototype: mono_monitor_enter</div>
+<p />
+
+</div> <a name="api:mono_monitor_exit"></a>
+ <div class="api">
+    <div class="api-entry">mono_monitor_exit</div>
+
+    <div class="prototype">Prototype: mono_monitor_exit</div>
+<p />
+
+</div></body>
+</html>
+</span>
\ No newline at end of file
diff --git a/docs/deploy/mono-api-type.html b/docs/deploy/mono-api-type.html
new file mode 100644
index 0000000..4364e7d
--- /dev/null
+++ b/docs/deploy/mono-api-type.html
@@ -0,0 +1,274 @@
+<?xml version="1.0" encoding="utf-8"?><span>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+   <title>mono-api-type.html</title>
+   <style type="text/css">
+
+
+   h3 { 
+       font-size: 18px;
+       padding-bottom: 4pt;
+       border-bottom: 2px solid #dddddd;
+   }
+       
+   .api {
+     border: 1px solid;
+     padding: 10pt;
+     margin: 10pt;
+   } 
+
+   .api-entry { 
+       border-bottom: none;
+       font-size: 18px;
+   }
+
+   .prototype {
+     border: 1px solid;
+     background-color: #f2f2f2;
+     padding: 5pt;
+     margin-top: 5pt;
+     margin-bottom: 5pt;  
+   } 
+
+   .header {
+     border: 1px solid;
+     padding: 0 0 5pt 5pt;
+     margin: 10pt;
+     white-space: pre;
+       font-family: monospace;
+   }
+    
+   .code {
+     border: 1px solid;
+     padding: 0 0 5pt 5pt;
+     margin: 10pt;
+     white-space: pre;
+       font-family: monospace;
+   }
+   
+
+</style>
+</head>
+<body>
+<h2>Type support</h2>
+
+<h3>Synopsis</h3>
+
+	<div class="header">
+#include <metadata/metadata.h>
+#include <metadata/class.h>
+
+typedef struct _MonoType MonoType;
+                     <a href="#api:mono_type_get_object"></a>                         
+                     <a href="#api:mono_type_create_from_typespec"></a>                         
+                     <a href="#api:mono_type_full_name"></a>                         
+MonoArrayType*       <a href="#api:mono_type_get_array_type">mono_type_get_array_type</a> (MonoType *type);
+MonoClass*           <a href="#api:mono_type_get_class">mono_type_get_class</a>      (MonoType *type);
+                     <a href="#api:mono_type_get_desc"></a>                         
+                     <a href="#api:mono_type_get_modifiers"></a>                         
+char*                <a href="#api:mono_type_get_name">mono_type_get_name</a>       (MonoType *type);
+MonoMethodSignature* <a href="#api:mono_type_get_signature">mono_type_get_signature</a>  (MonoType *type);
+int                  <a href="#api:mono_type_get_type">mono_type_get_type</a>       (MonoType *type);
+                     <a href="#api:mono_type_get_underlying_type"></a>                         
+gboolean             <a href="#api:mono_type_is_byref">mono_type_is_byref</a>       (MonoType *type);
+                     <a href="#api:mono_type_size"></a>                         
+                     <a href="#api:mono_type_stack_size"></a>                         
+guint32              <a href="#api:mono_type_to_unmanaged">mono_type_to_unmanaged</a>   (MonoType *type, 
+                                               MonoMarshalSpec *mspec, 
+                                               gboolean as_field;
+                     <a href="#api:mono_type_generic_inst_is_valuetype"></a>                         
+
+	
+	</div>
+
+	<p />The MonoType represents the unmanaged version of
+	System.Type.
+	
+ <a name="api:mono_type_get_object"></a>
+ <div class="api">
+    <div class="api-entry">mono_type_get_object</div>
+
+    <div class="prototype">Prototype: mono_type_get_object</div>
+<p />
+
+</div> <a name="api:mono_type_create_from_typespec"></a>
+ <div class="api">
+    <div class="api-entry">mono_type_create_from_typespec</div>
+
+    <div class="prototype">Prototype: mono_type_create_from_typespec</div>
+<p />
+
+</div> <a name="api:mono_type_full_name"></a>
+ <div class="api">
+    <div class="api-entry">mono_type_full_name</div>
+
+    <div class="prototype">Prototype: mono_type_full_name</div>
+<p />
+
+</div> <a name="api:mono_type_get_array_type"></a>
+ <div class="api">
+    <div class="api-entry">mono_type_get_array_type</div>
+
+    <div class="prototype">MonoArrayType*
+mono_type_get_array_type (MonoType *type)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>type:</i></dt><dd> the MonoType operated on</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  a MonoArrayType struct describing the array type that <i>type</i>
+
+	 represents. The info includes details such as rank, array element type
+	 and the sizes and bounds of multidimensional arrays.</blockquote>
+<b>Remarks</b>
+<p />	 
+	 It is only valid to call this function if <i>type</i> is a MONO_TYPE_ARRAY.
+	
+
+</div> <a name="api:mono_type_get_class"></a>
+ <div class="api">
+    <div class="api-entry">mono_type_get_class</div>
+
+    <div class="prototype">MonoClass*
+mono_type_get_class (MonoType *type)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>type:</i></dt><dd> the MonoType operated on</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  the MonoClass pointer that describes the class that <i>type</i> represents.
+</blockquote>
+<b>Remarks</b>
+<p />	 
+	 It is only valid to call this function if <i>type</i> is a MONO_TYPE_CLASS or a
+	 MONO_TYPE_VALUETYPE. For more general functionality, use mono_class_from_mono_type (),
+	 instead
+	
+
+</div> <a name="api:mono_type_get_desc"></a>
+ <div class="api">
+    <div class="api-entry">mono_type_get_desc</div>
+
+    <div class="prototype">Prototype: mono_type_get_desc</div>
+<p />
+
+</div> <a name="api:mono_type_get_modifiers"></a>
+ <div class="api">
+    <div class="api-entry">mono_type_get_modifiers</div>
+
+    <div class="prototype">Prototype: mono_type_get_modifiers</div>
+<p />
+
+</div> <a name="api:mono_type_get_name"></a>
+ <div class="api">
+    <div class="api-entry">mono_type_get_name</div>
+
+    <div class="prototype">char*
+mono_type_get_name (MonoType *type)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>type:</i></dt><dd> a type</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  the string representation for type as it would be represented in IL code.
+</blockquote>
+
+</div> <a name="api:mono_type_get_signature"></a>
+ <div class="api">
+    <div class="api-entry">mono_type_get_signature</div>
+
+    <div class="prototype">MonoMethodSignature*
+mono_type_get_signature (MonoType *type)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>type:</i></dt><dd> the MonoType operated on</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  the MonoMethodSignature pointer that describes the signature
+
+	 of the function pointer <i>type</i> represents.</blockquote>
+<b>Remarks</b>
+<p />	 
+	 It is only valid to call this function if <i>type</i> is a MONO_TYPE_FNPTR.
+	
+
+</div> <a name="api:mono_type_get_type"></a>
+ <div class="api">
+    <div class="api-entry">mono_type_get_type</div>
+
+    <div class="prototype">int
+mono_type_get_type (MonoType *type)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>type:</i></dt><dd> the MonoType operated on</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  the IL type value for <i>type</i>. This is one of the MonoTypeEnum
+
+	 enum members like MONO_TYPE_I4 or MONO_TYPE_STRING.</blockquote>
+
+</div> <a name="api:mono_type_get_underlying_type"></a>
+ <div class="api">
+    <div class="api-entry">mono_type_get_underlying_type</div>
+
+    <div class="prototype">Prototype: mono_type_get_underlying_type</div>
+<p />
+
+</div> <a name="api:mono_type_is_byref"></a>
+ <div class="api">
+    <div class="api-entry">mono_type_is_byref</div>
+
+    <div class="prototype">gboolean
+mono_type_is_byref (MonoType *type)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>type:</i></dt><dd> the MonoType operated on</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  <i>TRUE</i> if <i>type</i> represents a type passed by reference,
+
+	 <i>FALSE</i> otherwise.</blockquote>
+
+</div> <a name="api:mono_type_size"></a>
+ <div class="api">
+    <div class="api-entry">mono_type_size</div>
+
+    <div class="prototype">Prototype: mono_type_size</div>
+<p />
+
+</div> <a name="api:mono_type_stack_size"></a>
+ <div class="api">
+    <div class="api-entry">mono_type_stack_size</div>
+
+    <div class="prototype">Prototype: mono_type_stack_size</div>
+<p />
+
+</div> <a name="api:mono_type_to_unmanaged"></a>
+ <div class="api">
+    <div class="api-entry">mono_type_to_unmanaged</div>
+
+    <div class="prototype">guint32
+mono_type_to_unmanaged (MonoType *type, MonoMarshalSpec *mspec, gboolean as_field,
+			gboolean unicode, MonoMarshalConv *conv) 
+
+</div>
+<p />
+<b>Returns</b>
+<blockquote>	  A MonoMarshalNative enumeration value (MONO_NATIVE_) value
+
+	 describing the underlying native reprensetation of the type.
+	
+<p />
+	 In addition the value pointed by
+	 "conv" will contain the kind of marshalling required for this
+	 particular type one of the MONO_MARSHAL_CONV_ enumeration values.</blockquote>
+
+</div></body>
+</html>
+</span>
\ No newline at end of file
diff --git a/docs/deploy/mono-api-types.html b/docs/deploy/mono-api-types.html
new file mode 100644
index 0000000..0774670
--- /dev/null
+++ b/docs/deploy/mono-api-types.html
@@ -0,0 +1,201 @@
+<?xml version="1.0" encoding="utf-8"?><span>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+   <title>mono-api-types.html</title>
+   <style type="text/css">
+
+
+   h3 { 
+       font-size: 18px;
+       padding-bottom: 4pt;
+       border-bottom: 2px solid #dddddd;
+   }
+       
+   .api {
+     border: 1px solid;
+     padding: 10pt;
+     margin: 10pt;
+   } 
+
+   .api-entry { 
+       border-bottom: none;
+       font-size: 18px;
+   }
+
+   .prototype {
+     border: 1px solid;
+     background-color: #f2f2f2;
+     padding: 5pt;
+     margin-top: 5pt;
+     margin-bottom: 5pt;  
+   } 
+
+   .header {
+     border: 1px solid;
+     padding: 0 0 5pt 5pt;
+     margin: 10pt;
+     white-space: pre;
+       font-family: monospace;
+   }
+    
+   .code {
+     border: 1px solid;
+     padding: 0 0 5pt 5pt;
+     margin: 10pt;
+     white-space: pre;
+       font-family: monospace;
+   }
+   
+
+</style>
+</head>
+<body>
+<h3>Common core types</h3>
+
+	<p />These are accesor methods to retrieve the <tt>MonoClass
+	*</tt> handle for the various built-in CLI types. 
+	
+ <a name="api:mono_get_object_class"></a>
+ <div class="api">
+    <div class="api-entry">mono_get_object_class</div>
+
+    <div class="prototype">Prototype: mono_get_object_class</div>
+<p />
+
+</div> <a name="api:mono_get_int16_class"></a>
+ <div class="api">
+    <div class="api-entry">mono_get_int16_class</div>
+
+    <div class="prototype">Prototype: mono_get_int16_class</div>
+<p />
+
+</div> <a name="api:mono_get_int32_class"></a>
+ <div class="api">
+    <div class="api-entry">mono_get_int32_class</div>
+
+    <div class="prototype">Prototype: mono_get_int32_class</div>
+<p />
+
+</div> <a name="api:mono_get_int64_class"></a>
+ <div class="api">
+    <div class="api-entry">mono_get_int64_class</div>
+
+    <div class="prototype">Prototype: mono_get_int64_class</div>
+<p />
+
+</div> <a name="api:mono_get_double_class"></a>
+ <div class="api">
+    <div class="api-entry">mono_get_double_class</div>
+
+    <div class="prototype">Prototype: mono_get_double_class</div>
+<p />
+
+</div> <a name="api:mono_get_enum_class"></a>
+ <div class="api">
+    <div class="api-entry">mono_get_enum_class</div>
+
+    <div class="prototype">Prototype: mono_get_enum_class</div>
+<p />
+
+</div> <a name="api:mono_get_intptr_class"></a>
+ <div class="api">
+    <div class="api-entry">mono_get_intptr_class</div>
+
+    <div class="prototype">Prototype: mono_get_intptr_class</div>
+<p />
+
+</div> <a name="api:mono_get_sbyte_class"></a>
+ <div class="api">
+    <div class="api-entry">mono_get_sbyte_class</div>
+
+    <div class="prototype">Prototype: mono_get_sbyte_class</div>
+<p />
+
+</div> <a name="api:mono_get_single_class"></a>
+ <div class="api">
+    <div class="api-entry">mono_get_single_class</div>
+
+    <div class="prototype">Prototype: mono_get_single_class</div>
+<p />
+
+</div> <a name="api:mono_get_string_class"></a>
+ <div class="api">
+    <div class="api-entry">mono_get_string_class</div>
+
+    <div class="prototype">Prototype: mono_get_string_class</div>
+<p />
+
+</div> <a name="api:mono_get_thread_class"></a>
+ <div class="api">
+    <div class="api-entry">mono_get_thread_class</div>
+
+    <div class="prototype">Prototype: mono_get_thread_class</div>
+<p />
+
+</div> <a name="api:mono_get_uint16_class"></a>
+ <div class="api">
+    <div class="api-entry">mono_get_uint16_class</div>
+
+    <div class="prototype">Prototype: mono_get_uint16_class</div>
+<p />
+
+</div> <a name="api:mono_get_uint32_class"></a>
+ <div class="api">
+    <div class="api-entry">mono_get_uint32_class</div>
+
+    <div class="prototype">Prototype: mono_get_uint32_class</div>
+<p />
+
+</div> <a name="api:mono_get_uint64_class"></a>
+ <div class="api">
+    <div class="api-entry">mono_get_uint64_class</div>
+
+    <div class="prototype">Prototype: mono_get_uint64_class</div>
+<p />
+
+</div> <a name="api:mono_get_uintptr_class"></a>
+ <div class="api">
+    <div class="api-entry">mono_get_uintptr_class</div>
+
+    <div class="prototype">Prototype: mono_get_uintptr_class</div>
+<p />
+
+</div> <a name="api:mono_get_void_class"></a>
+ <div class="api">
+    <div class="api-entry">mono_get_void_class</div>
+
+    <div class="prototype">Prototype: mono_get_void_class</div>
+<p />
+
+</div> <a name="api:mono_get_array_class"></a>
+ <div class="api">
+    <div class="api-entry">mono_get_array_class</div>
+
+    <div class="prototype">Prototype: mono_get_array_class</div>
+<p />
+
+</div> <a name="api:mono_get_boolean_class"></a>
+ <div class="api">
+    <div class="api-entry">mono_get_boolean_class</div>
+
+    <div class="prototype">Prototype: mono_get_boolean_class</div>
+<p />
+
+</div> <a name="api:mono_get_byte_class"></a>
+ <div class="api">
+    <div class="api-entry">mono_get_byte_class</div>
+
+    <div class="prototype">Prototype: mono_get_byte_class</div>
+<p />
+
+</div> <a name="api:mono_get_char_class"></a>
+ <div class="api">
+    <div class="api-entry">mono_get_char_class</div>
+
+    <div class="prototype">Prototype: mono_get_char_class</div>
+<p />
+
+
+</div></body>
+</html>
+</span>
\ No newline at end of file
diff --git a/docs/deploy/mono-api-unsorted.html b/docs/deploy/mono-api-unsorted.html
new file mode 100644
index 0000000..da555b2
--- /dev/null
+++ b/docs/deploy/mono-api-unsorted.html
@@ -0,0 +1,483 @@
+<?xml version="1.0" encoding="utf-8"?><span>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+   <title>mono-api-unsorted.html</title>
+   <style type="text/css">
+
+
+   h3 { 
+       font-size: 18px;
+       padding-bottom: 4pt;
+       border-bottom: 2px solid #dddddd;
+   }
+       
+   .api {
+     border: 1px solid;
+     padding: 10pt;
+     margin: 10pt;
+   } 
+
+   .api-entry { 
+       border-bottom: none;
+       font-size: 18px;
+   }
+
+   .prototype {
+     border: 1px solid;
+     background-color: #f2f2f2;
+     padding: 5pt;
+     margin-top: 5pt;
+     margin-bottom: 5pt;  
+   } 
+
+   .header {
+     border: 1px solid;
+     padding: 0 0 5pt 5pt;
+     margin: 10pt;
+     white-space: pre;
+       font-family: monospace;
+   }
+    
+   .code {
+     border: 1px solid;
+     padding: 0 0 5pt 5pt;
+     margin: 10pt;
+     white-space: pre;
+       font-family: monospace;
+   }
+   
+
+</style>
+</head>
+<body>
+
+
+ <a name="api:mono_bounded_array_class_get"></a>
+ <div class="api">
+    <div class="api-entry">mono_bounded_array_class_get</div>
+
+    <div class="prototype">MonoClass*
+mono_bounded_array_class_get (MonoClass *eclass, guint32 rank, gboolean bounded)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>element_class:</i></dt><dd> element class </dd><dt><i>rank:</i></dt><dd> the dimension of the array class</dd><dt><i>bounded:</i></dt><dd> whenever the array has non-zero bounds</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  a class object describing the array with element type <i>element_type</i> and 
+
+	 dimension <i>rank</i>. </blockquote>
+
+</div> <a name="api:mono_check_corlib_version"></a>
+ <div class="api">
+    <div class="api-entry">mono_check_corlib_version</div>
+
+    <div class="prototype">const char*
+mono_check_corlib_version (void)
+
+</div>
+<p />
+<b>Returns</b>
+<blockquote>	  NULL if the runtime will work with the corlib, or a g_malloc
+
+	 allocated string with the error otherwise.</blockquote>
+<b>Remarks</b>
+<p />	 
+	 Checks that the corlib that is loaded matches the version of this runtime.
+	
+
+</div> <a name="api:mono_compile_method"></a>
+ <div class="api">
+    <div class="api-entry">mono_compile_method</div>
+
+    <div class="prototype">gpointer 
+mono_compile_method (MonoMethod *method)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>method:</i></dt><dd> The method to compile.</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 This JIT-compiles the method, and returns the pointer to the native code
+	 produced.
+
+</div> <a name="api:mono_config_for_assembly"></a>
+ <div class="api">
+    <div class="api-entry">mono_config_for_assembly</div>
+
+    <div class="prototype">Prototype: mono_config_for_assembly</div>
+<p />
+
+</div> <a name="api:mono_dllmap_insert"></a>
+ <div class="api">
+    <div class="api-entry">mono_dllmap_insert</div>
+
+    <div class="prototype">Prototype: mono_dllmap_insert</div>
+<p />
+
+</div> <a name="api:mono_environment_exitcode_get"></a>
+ <div class="api">
+    <div class="api-entry">mono_environment_exitcode_get</div>
+
+    <div class="prototype">Prototype: mono_environment_exitcode_get</div>
+<p />
+
+</div> <a name="api:mono_environment_exitcode_set"></a>
+ <div class="api">
+    <div class="api-entry">mono_environment_exitcode_set</div>
+
+    <div class="prototype">Prototype: mono_environment_exitcode_set</div>
+<p />
+
+</div> <a name="api:mono_free_method"></a>
+ <div class="api">
+    <div class="api-entry">mono_free_method</div>
+
+    <div class="prototype">Prototype: mono_free_method</div>
+<p />
+
+</div> <a name="api:mono_free_verify_list"></a>
+ <div class="api">
+    <div class="api-entry">mono_free_verify_list</div>
+
+    <div class="prototype">Prototype: mono_free_verify_list</div>
+<p />
+
+</div> <a name="api:mono_get_config_dir"></a>
+ <div class="api">
+    <div class="api-entry">mono_get_config_dir</div>
+
+    <div class="prototype">Prototype: mono_get_config_dir</div>
+<p />
+
+</div> <a name="api:mono_get_corlib"></a>
+ <div class="api">
+    <div class="api-entry">mono_get_corlib</div>
+
+    <div class="prototype">Prototype: mono_get_corlib</div>
+<p />
+
+</div> <a name="api:mono_get_delegate_invoke"></a>
+ <div class="api">
+    <div class="api-entry">mono_get_delegate_invoke</div>
+
+    <div class="prototype">MonoMethod*
+mono_get_delegate_invoke (MonoClass *klass)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>klass:</i></dt><dd> The delegate class</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  the MonoMethod for the "Invoke" method in the delegate klass or NULL if <i>klass</i> is a broken delegate type
+</blockquote>
+
+</div> <a name="api:mono_get_method_full"></a>
+ <div class="api">
+    <div class="api-entry">mono_get_method_full</div>
+
+    <div class="prototype">Prototype: mono_get_method_full</div>
+<p />
+
+</div> <a name="api:mono_get_method"></a>
+ <div class="api">
+    <div class="api-entry">mono_get_method</div>
+
+    <div class="prototype">Prototype: mono_get_method</div>
+<p />
+
+</div> <a name="api:mono_get_root_domain"></a>
+ <div class="api">
+    <div class="api-entry">mono_get_root_domain</div>
+
+    <div class="prototype">MonoDomain*
+mono_get_root_domain (void)
+
+</div>
+<p />
+<b>Returns</b>
+<blockquote>	  the root appdomain, to obtain the current domain, use mono_domain_get ()
+</blockquote>
+<b>Remarks</b>
+<p />	 
+	 The root AppDomain is the initial domain created by the runtime when it is
+	 initialized.  Programs execute on this AppDomain, but can create new ones
+	 later.   Currently there is no unmanaged API to create new AppDomains, this
+	 must be done from managed code.
+	
+
+</div> <a name="api:mono_init_from_assembly"></a>
+ <div class="api">
+    <div class="api-entry">mono_init_from_assembly</div>
+
+    <div class="prototype">MonoDomain*
+mono_init_from_assembly (const char *domain_name, const char *filename)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>domain_name:</i></dt><dd> name to give to the initial domain</dd><dt><i>filename:</i></dt><dd> filename to load on startup</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  the initial domain.
+</blockquote>
+<b>Remarks</b>
+<p />	 
+	 Used by the runtime, users should use mono_jit_init instead.
+	
+	 Creates the initial application domain and initializes the mono_defaults
+	 structure.
+	 This function is guaranteed to not run any IL code.
+	 The runtime is initialized using the runtime version required by the
+	 provided executable. The version is determined by looking at the exe 
+	 configuration file and the version PE field)
+	
+
+</div> <a name="api:mono_init"></a>
+ <div class="api">
+    <div class="api-entry">mono_init</div>
+
+    <div class="prototype">MonoDomain*
+mono_init (const char *domain_name)
+
+</div>
+<p />
+<b>Returns</b>
+<blockquote>	  the initial domain.
+</blockquote>
+<b>Remarks</b>
+<p />	 <p />
+
+	 Creates the initial application domain and initializes the mono_defaults
+	 structure.
+	 This function is guaranteed to not run any IL code.
+	 The runtime is initialized using the default runtime version.
+	
+
+</div> <a name="api:mono_init_version"></a>
+ <div class="api">
+    <div class="api-entry">mono_init_version</div>
+
+    <div class="prototype">MonoDomain*
+mono_init_version (const char *domain_name, const char *version)
+
+</div>
+<p />
+<b>Returns</b>
+<blockquote>	  the initial domain.
+</blockquote>
+<b>Remarks</b>
+<p />	 <p />
+
+	 Used by the runtime, users should use mono_jit_init instead.
+	
+<p />
+	 Creates the initial application domain and initializes the mono_defaults
+	 structure.
+	
+	 This function is guaranteed to not run any IL code.
+	 The runtime is initialized using the provided rutime version.
+	
+
+</div> <a name="api:mono_jit_exec"></a>
+ <div class="api">
+    <div class="api-entry">mono_jit_exec</div>
+
+    <div class="prototype">int 
+mono_jit_exec (MonoDomain *domain, MonoAssembly *assembly, int argc, char *argv[])
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>assembly:</i></dt><dd> reference to an assembly</dd><dt><i>argc:</i></dt><dd> argument count</dd><dt><i>argv:</i></dt><dd> argument vector</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 Start execution of a program.
+
+</div> <a name="api:mono_lookup_internal_call"></a>
+ <div class="api">
+    <div class="api-entry">mono_lookup_internal_call</div>
+
+    <div class="prototype">Prototype: mono_lookup_internal_call</div>
+<p />
+
+</div> <a name="api:mono_lookup_pinvoke_call"></a>
+ <div class="api">
+    <div class="api-entry">mono_lookup_pinvoke_call</div>
+
+    <div class="prototype">Prototype: mono_lookup_pinvoke_call</div>
+<p />
+
+</div> <a name="api:mono_main"></a>
+ <div class="api">
+    <div class="api-entry">mono_main</div>
+
+    <div class="prototype">int
+mono_main (int argc, char* argv[])
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>argc:</i></dt><dd> number of arguments in the argv array</dd><dt><i>argv:</i></dt><dd> array of strings containing the startup arguments</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 Launches the Mono JIT engine and parses all the command line options
+	 in the same way that the mono command line VM would.
+
+</div> <a name="api:mono_parse_default_optimizations"></a>
+ <div class="api">
+    <div class="api-entry">mono_parse_default_optimizations</div>
+
+    <div class="prototype">Prototype: mono_parse_default_optimizations</div>
+<p />
+
+</div> <a name="api:mono_ptr_class_get"></a>
+ <div class="api">
+    <div class="api-entry">mono_ptr_class_get</div>
+
+    <div class="prototype">Prototype: mono_ptr_class_get</div>
+<p />
+
+</div> <a name="api:mono_register_bundled_assemblies"></a>
+ <div class="api">
+    <div class="api-entry">mono_register_bundled_assemblies</div>
+
+    <div class="prototype">Prototype: mono_register_bundled_assemblies</div>
+<p />
+
+</div> <a name="api:mono_runtime_class_init"></a>
+ <div class="api">
+    <div class="api-entry">mono_runtime_class_init</div>
+
+    <div class="prototype">Prototype: mono_runtime_class_init</div>
+<p />
+
+</div> <a name="api:mono_runtime_cleanup"></a>
+ <div class="api">
+    <div class="api-entry">mono_runtime_cleanup</div>
+
+    <div class="prototype">void
+mono_runtime_cleanup (MonoDomain *domain)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>domain:</i></dt><dd> unused.</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 Internal routine.
+	
+	 This must not be called while there are still running threads executing
+	 managed code.
+
+</div> <a name="api:mono_runtime_get_main_args"></a>
+ <div class="api">
+    <div class="api-entry">mono_runtime_get_main_args</div>
+
+    <div class="prototype">MonoArray*
+mono_runtime_get_main_args (void)
+
+</div>
+<p />
+<b>Returns</b>
+<blockquote>	  a MonoArray with the arguments passed to the main program
+</blockquote>
+
+</div> <a name="api:mono_runtime_init"></a>
+ <div class="api">
+    <div class="api-entry">mono_runtime_init</div>
+
+    <div class="prototype">void
+mono_runtime_init (MonoDomain *domain, MonoThreadStartCB start_cb,
+		   MonoThreadAttachCB attach_cb)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>domain:</i></dt><dd> domain returned by mono_init ()</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 Initialize the core AppDomain: this function will run also some
+	 IL initialization code, so it needs the execution engine to be fully 
+	 operational.
+	
+	 AppDomain.SetupInformation is set up in mono_runtime_exec_main, where
+	 we know the entry_assembly.
+	
+
+</div> <a name="api:mono_runtime_is_shutting_down"></a>
+ <div class="api">
+    <div class="api-entry">mono_runtime_is_shutting_down</div>
+
+    <div class="prototype">gboolean
+mono_runtime_is_shutting_down (void)
+
+</div>
+<p />
+<b>Remarks</b>
+<p />	 
+	 Returns whether the runtime has been flagged for shutdown.
+	
+	 This is consumed by the P:System.Environment.HasShutdownStarted
+	 property.
+	
+
+</div> <a name="api:mono_runtime_object_init"></a>
+ <div class="api">
+    <div class="api-entry">mono_runtime_object_init</div>
+
+    <div class="prototype">Prototype: mono_runtime_object_init</div>
+<p />
+
+</div> <a name="api:mono_runtime_quit"></a>
+ <div class="api">
+    <div class="api-entry">mono_runtime_quit</div>
+
+    <div class="prototype">Prototype: mono_runtime_quit</div>
+<p />
+
+</div> <a name="api:mono_runtime_run_main"></a>
+ <div class="api">
+    <div class="api-entry">mono_runtime_run_main</div>
+
+    <div class="prototype">int
+mono_runtime_run_main (MonoMethod *method, int argc, char* argv[],
+		       MonoObject **exc)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>method:</i></dt><dd> the method to start the application with (usually Main)</dd><dt><i>argc:</i></dt><dd> number of arguments from the command line</dd><dt><i>argv:</i></dt><dd> array of strings from the command line</dd><dt><i>exc:</i></dt><dd> excetption results</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 Execute a standard Main() method (argc/argv contains the
+	 executable name). This method also sets the command line argument value
+	 needed by System.Environment.
+	
+	
+<p />
+
+</div> <a name="api:mono_table_info_get_rows"></a>
+ <div class="api">
+    <div class="api-entry">mono_table_info_get_rows</div>
+
+    <div class="prototype">Prototype: mono_table_info_get_rows</div>
+<p />
+
+</div> <a name="api:mono_upgrade_remote_class_wrapper"></a>
+ <div class="api">
+    <div class="api-entry">mono_upgrade_remote_class_wrapper</div>
+
+    <div class="prototype">Prototype: mono_upgrade_remote_class_wrapper</div>
+<p />
+
+</div> <a name="api:mono_verify_corlib"></a>
+ <div class="api">
+    <div class="api-entry">mono_verify_corlib</div>
+
+    <div class="prototype">Prototype: mono_verify_corlib</div>
+<p />
+
+</div></body>
+</html>
+</span>
\ No newline at end of file
diff --git a/docs/deploy/mono-api-utils.html b/docs/deploy/mono-api-utils.html
new file mode 100644
index 0000000..bc05ede
--- /dev/null
+++ b/docs/deploy/mono-api-utils.html
@@ -0,0 +1,635 @@
+<?xml version="1.0" encoding="utf-8"?><span>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+   <title>mono-api-utils.html</title>
+   <style type="text/css">
+
+
+   h3 { 
+       font-size: 18px;
+       padding-bottom: 4pt;
+       border-bottom: 2px solid #dddddd;
+   }
+       
+   .api {
+     border: 1px solid;
+     padding: 10pt;
+     margin: 10pt;
+   } 
+
+   .api-entry { 
+       border-bottom: none;
+       font-size: 18px;
+   }
+
+   .prototype {
+     border: 1px solid;
+     background-color: #f2f2f2;
+     padding: 5pt;
+     margin-top: 5pt;
+     margin-bottom: 5pt;  
+   } 
+
+   .header {
+     border: 1px solid;
+     padding: 0 0 5pt 5pt;
+     margin: 10pt;
+     white-space: pre;
+       font-family: monospace;
+   }
+    
+   .code {
+     border: 1px solid;
+     padding: 0 0 5pt 5pt;
+     margin: 10pt;
+     white-space: pre;
+       font-family: monospace;
+   }
+   
+
+</style>
+</head>
+<body>
+<h2>Utility Methods</h2>
+
+<h3>Bitsets</h3>
+
+	<p />MonoBitsets are a set of routines used to manipulate sets
+	of bits.
+	
+ <a name="api:mono_bitset_alloc_size"></a>
+ <div class="api">
+    <div class="api-entry">mono_bitset_alloc_size</div>
+
+    <div class="prototype">Prototype: mono_bitset_alloc_size</div>
+<p />
+
+</div> <a name="api:mono_bitset_clear"></a>
+ <div class="api">
+    <div class="api-entry">mono_bitset_clear</div>
+
+    <div class="prototype">Prototype: mono_bitset_clear</div>
+<p />
+
+</div> <a name="api:mono_bitset_clear_all"></a>
+ <div class="api">
+    <div class="api-entry">mono_bitset_clear_all</div>
+
+    <div class="prototype">Prototype: mono_bitset_clear_all</div>
+<p />
+
+</div> <a name="api:mono_bitset_clone"></a>
+ <div class="api">
+    <div class="api-entry">mono_bitset_clone</div>
+
+    <div class="prototype">Prototype: mono_bitset_clone</div>
+<p />
+
+</div> <a name="api:mono_bitset_copyto"></a>
+ <div class="api">
+    <div class="api-entry">mono_bitset_copyto</div>
+
+    <div class="prototype">Prototype: mono_bitset_copyto</div>
+<p />
+
+</div> <a name="api:mono_bitset_count"></a>
+ <div class="api">
+    <div class="api-entry">mono_bitset_count</div>
+
+    <div class="prototype">Prototype: mono_bitset_count</div>
+<p />
+
+</div> <a name="api:mono_bitset_equal"></a>
+ <div class="api">
+    <div class="api-entry">mono_bitset_equal</div>
+
+    <div class="prototype">Prototype: mono_bitset_equal</div>
+<p />
+
+</div> <a name="api:mono_bitset_find_first"></a>
+ <div class="api">
+    <div class="api-entry">mono_bitset_find_first</div>
+
+    <div class="prototype">Prototype: mono_bitset_find_first</div>
+<p />
+
+</div> <a name="api:mono_bitset_find_last"></a>
+ <div class="api">
+    <div class="api-entry">mono_bitset_find_last</div>
+
+    <div class="prototype">Prototype: mono_bitset_find_last</div>
+<p />
+
+</div> <a name="api:mono_bitset_find_start"></a>
+ <div class="api">
+    <div class="api-entry">mono_bitset_find_start</div>
+
+    <div class="prototype">Prototype: mono_bitset_find_start</div>
+<p />
+
+</div> <a name="api:mono_bitset_foreach"></a>
+ <div class="api">
+    <div class="api-entry">mono_bitset_foreach</div>
+
+    <div class="prototype">Prototype: mono_bitset_foreach</div>
+<p />
+
+</div> <a name="api:mono_bitset_free"></a>
+ <div class="api">
+    <div class="api-entry">mono_bitset_free</div>
+
+    <div class="prototype">Prototype: mono_bitset_free</div>
+<p />
+
+</div> <a name="api:mono_bitset_intersection"></a>
+ <div class="api">
+    <div class="api-entry">mono_bitset_intersection</div>
+
+    <div class="prototype">Prototype: mono_bitset_intersection</div>
+<p />
+
+</div> <a name="api:mono_bitset_invert"></a>
+ <div class="api">
+    <div class="api-entry">mono_bitset_invert</div>
+
+    <div class="prototype">Prototype: mono_bitset_invert</div>
+<p />
+
+</div> <a name="api:mono_bitset_mem_new"></a>
+ <div class="api">
+    <div class="api-entry">mono_bitset_mem_new</div>
+
+    <div class="prototype">Prototype: mono_bitset_mem_new</div>
+<p />
+
+</div> <a name="api:mono_bitset_new"></a>
+ <div class="api">
+    <div class="api-entry">mono_bitset_new</div>
+
+    <div class="prototype">Prototype: mono_bitset_new</div>
+<p />
+
+</div> <a name="api:mono_bitset_set"></a>
+ <div class="api">
+    <div class="api-entry">mono_bitset_set</div>
+
+    <div class="prototype">Prototype: mono_bitset_set</div>
+<p />
+
+</div> <a name="api:mono_bitset_set_all"></a>
+ <div class="api">
+    <div class="api-entry">mono_bitset_set_all</div>
+
+    <div class="prototype">Prototype: mono_bitset_set_all</div>
+<p />
+
+</div> <a name="api:mono_bitset_size"></a>
+ <div class="api">
+    <div class="api-entry">mono_bitset_size</div>
+
+    <div class="prototype">Prototype: mono_bitset_size</div>
+<p />
+
+</div> <a name="api:mono_bitset_sub"></a>
+ <div class="api">
+    <div class="api-entry">mono_bitset_sub</div>
+
+    <div class="prototype">Prototype: mono_bitset_sub</div>
+<p />
+
+</div> <a name="api:mono_bitset_test"></a>
+ <div class="api">
+    <div class="api-entry">mono_bitset_test</div>
+
+    <div class="prototype">Prototype: mono_bitset_test</div>
+<p />
+
+</div> <a name="api:mono_bitset_test_bulk"></a>
+ <div class="api">
+    <div class="api-entry">mono_bitset_test_bulk</div>
+
+    <div class="prototype">Prototype: mono_bitset_test_bulk</div>
+<p />
+
+</div> <a name="api:mono_bitset_union"></a>
+ <div class="api">
+    <div class="api-entry">mono_bitset_union</div>
+
+    <div class="prototype">Prototype: mono_bitset_union</div>
+<p />
+
+</div> <a name="api:mono_bitset_find_first_unset"></a>
+ <div class="api">
+    <div class="api-entry">mono_bitset_find_first_unset</div>
+
+    <div class="prototype">Prototype: mono_bitset_find_first_unset</div>
+<p />
+
+</div> <a name="api:mono_bitset_intersection_2"></a>
+ <div class="api">
+    <div class="api-entry">mono_bitset_intersection_2</div>
+
+    <div class="prototype">Prototype: mono_bitset_intersection_2</div>
+<p />
+
+
+</div><h3>Hashtables</h3>
+
+	<p /><tt>GHashTable</tt> is used when you need to store object
+	references into a hashtable, objects stored in a
+	<tt>MonoGHashTable</tt> are properly tracked by the garbage
+	collector.
+
+	<p />The <tt>MonoGHashTable</tt> data type has the same API as
+	the GLIB.
+	
+ <a name="api:mono_g_hash_table_destroy"></a>
+ <div class="api">
+    <div class="api-entry">mono_g_hash_table_destroy</div>
+
+    <div class="prototype">Prototype: mono_g_hash_table_destroy</div>
+<p />
+
+</div> <a name="api:mono_g_hash_table_foreach"></a>
+ <div class="api">
+    <div class="api-entry">mono_g_hash_table_foreach</div>
+
+    <div class="prototype">Prototype: mono_g_hash_table_foreach</div>
+<p />
+
+</div> <a name="api:mono_g_hash_table_foreach_remove"></a>
+ <div class="api">
+    <div class="api-entry">mono_g_hash_table_foreach_remove</div>
+
+    <div class="prototype">Prototype: mono_g_hash_table_foreach_remove</div>
+<p />
+
+</div> <a name="api:mono_g_hash_table_foreach_steal"></a>
+ <div class="api">
+    <div class="api-entry">mono_g_hash_table_foreach_steal</div>
+
+    <div class="prototype">Prototype: mono_g_hash_table_foreach_steal</div>
+<p />
+
+</div> <a name="api:mono_g_hash_table_insert"></a>
+ <div class="api">
+    <div class="api-entry">mono_g_hash_table_insert</div>
+
+    <div class="prototype">Prototype: mono_g_hash_table_insert</div>
+<p />
+
+</div> <a name="api:mono_g_hash_table_lookup"></a>
+ <div class="api">
+    <div class="api-entry">mono_g_hash_table_lookup</div>
+
+    <div class="prototype">Prototype: mono_g_hash_table_lookup</div>
+<p />
+
+</div> <a name="api:mono_g_hash_table_lookup_extended"></a>
+ <div class="api">
+    <div class="api-entry">mono_g_hash_table_lookup_extended</div>
+
+    <div class="prototype">Prototype: mono_g_hash_table_lookup_extended</div>
+<p />
+
+</div> <a name="api:mono_g_hash_table_new"></a>
+ <div class="api">
+    <div class="api-entry">mono_g_hash_table_new</div>
+
+    <div class="prototype">Prototype: mono_g_hash_table_new</div>
+<p />
+
+</div> <a name="api:mono_g_hash_table_new_full"></a>
+ <div class="api">
+    <div class="api-entry">mono_g_hash_table_new_full</div>
+
+    <div class="prototype">Prototype: mono_g_hash_table_new_full</div>
+<p />
+
+</div> <a name="api:mono_g_hash_table_remap"></a>
+ <div class="api">
+    <div class="api-entry">mono_g_hash_table_remap</div>
+
+    <div class="prototype">Prototype: mono_g_hash_table_remap</div>
+<p />
+
+</div> <a name="api:mono_g_hash_table_remove"></a>
+ <div class="api">
+    <div class="api-entry">mono_g_hash_table_remove</div>
+
+    <div class="prototype">Prototype: mono_g_hash_table_remove</div>
+<p />
+
+</div> <a name="api:mono_g_hash_table_replace"></a>
+ <div class="api">
+    <div class="api-entry">mono_g_hash_table_replace</div>
+
+    <div class="prototype">Prototype: mono_g_hash_table_replace</div>
+<p />
+
+</div> <a name="api:mono_g_hash_table_size"></a>
+ <div class="api">
+    <div class="api-entry">mono_g_hash_table_size</div>
+
+    <div class="prototype">Prototype: mono_g_hash_table_size</div>
+<p />
+
+</div> <a name="api:mono_g_hash_table_steal"></a>
+ <div class="api">
+    <div class="api-entry">mono_g_hash_table_steal</div>
+
+    <div class="prototype">Prototype: mono_g_hash_table_steal</div>
+<p />
+
+
+</div><h3>SHA1 Signatures</h3>
+
+ <a name="api:mono_sha1_init"></a>
+ <div class="api">
+    <div class="api-entry">mono_sha1_init</div>
+
+    <div class="prototype">Prototype: mono_sha1_init</div>
+<p />
+
+</div> <a name="api:mono_sha1_update"></a>
+ <div class="api">
+    <div class="api-entry">mono_sha1_update</div>
+
+    <div class="prototype">Prototype: mono_sha1_update</div>
+<p />
+
+</div> <a name="api:mono_sha1_get_digest_from_file"></a>
+ <div class="api">
+    <div class="api-entry">mono_sha1_get_digest_from_file</div>
+
+    <div class="prototype">Prototype: mono_sha1_get_digest_from_file</div>
+<p />
+
+</div> <a name="api:mono_sha1_get_digest"></a>
+ <div class="api">
+    <div class="api-entry">mono_sha1_get_digest</div>
+
+    <div class="prototype">Prototype: mono_sha1_get_digest</div>
+<p />
+
+</div> <a name="api:mono_sha1_final"></a>
+ <div class="api">
+    <div class="api-entry">mono_sha1_final</div>
+
+    <div class="prototype">Prototype: mono_sha1_final</div>
+<p />
+
+
+</div><h3>MD5 Signatures</h3>
+
+ <a name="api:mono_md5_init"></a>
+ <div class="api">
+    <div class="api-entry">mono_md5_init</div>
+
+    <div class="prototype">Prototype: mono_md5_init</div>
+<p />
+
+</div> <a name="api:mono_md5_update"></a>
+ <div class="api">
+    <div class="api-entry">mono_md5_update</div>
+
+    <div class="prototype">Prototype: mono_md5_update</div>
+<p />
+
+</div> <a name="api:mono_md5_get_digest_from_file"></a>
+ <div class="api">
+    <div class="api-entry">mono_md5_get_digest_from_file</div>
+
+    <div class="prototype">Prototype: mono_md5_get_digest_from_file</div>
+<p />
+
+</div> <a name="api:mono_md5_get_digest"></a>
+ <div class="api">
+    <div class="api-entry">mono_md5_get_digest</div>
+
+    <div class="prototype">Prototype: mono_md5_get_digest</div>
+<p />
+
+</div> <a name="api:mono_md5_final"></a>
+ <div class="api">
+    <div class="api-entry">mono_md5_final</div>
+
+    <div class="prototype">Prototype: mono_md5_final</div>
+<p />
+
+
+</div> <a name="api:mono_digest_get_public_token"></a>
+ <div class="api">
+    <div class="api-entry">mono_digest_get_public_token</div>
+
+    <div class="prototype">Prototype: mono_digest_get_public_token</div>
+<p />
+
+
+</div><h3>Memory Pools</h3>
+
+	<p />Memory pools are a convenient way of tracking memory
+	allocations that are used for one specific task, they are also
+	faster than using the standard memory allocation procedures,
+	as they are designed to be used only by a single thread at a
+	time. 
+
+	<p /><tt>MonoMemPool</tt> objects are not thread safe, which
+	means that you should not share the objects across multiple
+	threads without providing proper locking around it (unlike
+	<tt>malloc</tt> and <tt>free</tt> which are thread safe). 
+
+	<p />When a <tt>MonoMemPool</tt> is released with
+	<tt>mono_mempool_destroy</tt> all of the of the memory
+	allocated from that memory pool with
+	<tt>mono_mempool_alloc</tt> and <tt>mono_mempool_alloc0</tt>
+	is released.
+	
+ <a name="api:mono_mempool_new"></a>
+ <div class="api">
+    <div class="api-entry">mono_mempool_new</div>
+
+    <div class="prototype">MonoMemPool*
+mono_mempool_new (void)
+
+</div>
+<p />
+<b>Returns</b>
+<blockquote>	  a new memory pool.
+</blockquote>
+
+</div> <a name="api:mono_mempool_destroy"></a>
+ <div class="api">
+    <div class="api-entry">mono_mempool_destroy</div>
+
+    <div class="prototype">void
+mono_mempool_destroy (MonoMemPool *pool)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>pool:</i></dt><dd> the memory pool to destroy</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 Free all memory associated with this pool.
+
+</div> <a name="api:mono_mempool_alloc"></a>
+ <div class="api">
+    <div class="api-entry">mono_mempool_alloc</div>
+
+    <div class="prototype">gpointer
+mono_mempool_alloc (MonoMemPool *pool, guint size)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>pool:</i></dt><dd> the momory pool to use</dd><dt><i>size:</i></dt><dd> size of the momory block</dd></blockquote>
+<b>Returns</b>
+<blockquote>	  the address of a newly allocated memory block.
+</blockquote>
+<b>Remarks</b>
+<p />	 
+	 Allocates a new block of memory in <i>pool</i>.
+	
+
+</div> <a name="api:mono_mempool_alloc0"></a>
+ <div class="api">
+    <div class="api-entry">mono_mempool_alloc0</div>
+
+    <div class="prototype">gpointer
+mono_mempool_alloc0 (MonoMemPool *pool, guint size)
+
+</div>
+<p />
+<b>Remarks</b>
+<p />	 
+	 same as mono_mempool_alloc, but fills memory with zero.
+
+</div> <a name="api:mono_mempool_empty"></a>
+ <div class="api">
+    <div class="api-entry">mono_mempool_empty</div>
+
+    <div class="prototype">Prototype: mono_mempool_empty</div>
+<p />
+
+</div> <a name="api:mono_mempool_invalidate"></a>
+ <div class="api">
+    <div class="api-entry">mono_mempool_invalidate</div>
+
+    <div class="prototype">void
+mono_mempool_invalidate (MonoMemPool *pool)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>pool:</i></dt><dd> the memory pool to invalidate</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 Fill the memory associated with this pool to 0x2a (42). Useful for debugging.
+
+</div> <a name="api:mono_mempool_stats"></a>
+ <div class="api">
+    <div class="api-entry">mono_mempool_stats</div>
+
+    <div class="prototype">void
+mono_mempool_stats (MonoMemPool *pool)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>pool:</i></dt><dd> the momory pool we need stats for</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 Print a few stats about the mempool
+
+</div> <a name="api:mono_mempool_contains_addr"></a>
+ <div class="api">
+    <div class="api-entry">mono_mempool_contains_addr</div>
+
+    <div class="prototype">gboolean
+mono_mempool_contains_addr (MonoMemPool *pool,
+							gpointer addr)
+
+</div>
+<p />
+<b>Remarks</b>
+<p />	 
+	  Determines whenever ADDR is inside the memory used by the mempool.
+
+ 
+</div><h3>JIT utilities</h3>
+
+ <a name="api:mono_signbit_double"></a>
+ <div class="api">
+    <div class="api-entry">mono_signbit_double</div>
+
+    <div class="prototype">Prototype: mono_signbit_double</div>
+<p />
+
+</div> <a name="api:mono_signbit_float"></a>
+ <div class="api">
+    <div class="api-entry">mono_signbit_float</div>
+
+    <div class="prototype">Prototype: mono_signbit_float</div>
+<p />
+
+
+</div><h3>Disassembling Generated Code</h3>
+
+	<p />Routines used to debug the JIT-produced code.
+	
+ <a name="api:mono_disasm_code"></a>
+ <div class="api">
+    <div class="api-entry">mono_disasm_code</div>
+
+    <div class="prototype">Prototype: mono_disasm_code</div>
+<p />
+
+</div> <a name="api:mono_disasm_code_one"></a>
+ <div class="api">
+    <div class="api-entry">mono_disasm_code_one</div>
+
+    <div class="prototype">Prototype: mono_disasm_code_one</div>
+<p />
+
+
+</div><h3>Walking the Stack</h3>
+
+ <a name="api:mono_walk_stack"></a>
+ <div class="api">
+    <div class="api-entry">mono_walk_stack</div>
+
+    <div class="prototype">void
+mono_walk_stack (MonoJitStackWalk func, MonoDomain *domain, MonoContext *start_ctx, MonoUnwindOptions unwind_options, MonoInternalThread *thread, MonoLMF *lmf, gpointer user_data)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>func:</i></dt><dd> callback to call for each stack frame</dd><dt><i>domain:</i></dt><dd> starting appdomain, can be NULL to use the current domain</dd><dt><i>unwind_options:</i></dt><dd> what extra information the unwinder should gather</dd><dt><i>start_ctx:</i></dt><dd> starting state of the stack walk, can be NULL.</dd><dt><i>thread:</i></dt><dd> the thread whose stack to walk, can be NULL to use the current thread</dd><dt><i>lmf:</i></dt><dd> the LMF of <i>thread</i>, can be NULL to use the LMF of the current thread</dd><dt><i>user_data:</i></dt><dd> data passed to the callback</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 This function walks the stack of a thread, starting from the state
+	 represented by start_ctx. For each frame the callback
+	 function is called with the relevant info. The walk ends when no more
+	 managed stack frames are found or when the callback returns a TRUE value.
+
+</div> <a name="api:mono_stack_walk_no_il"></a>
+ <div class="api">
+    <div class="api-entry">mono_stack_walk_no_il</div>
+
+    <div class="prototype">Prototype: mono_stack_walk_no_il</div>
+<p />
+
+
+</div><h3>Others</h3>
+
+ <a name="api:mono_escape_uri_string"></a>
+ <div class="api">
+    <div class="api-entry">mono_escape_uri_string</div>
+
+    <div class="prototype">Prototype: mono_escape_uri_string</div>
+<p />
+
+</div></body>
+</html>
+</span>
\ No newline at end of file
diff --git a/docs/deploy/mono-api-vm.html b/docs/deploy/mono-api-vm.html
new file mode 100644
index 0000000..d1dc657
--- /dev/null
+++ b/docs/deploy/mono-api-vm.html
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="utf-8"?><span>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+   <title>mono-api-vm.html</title>
+   <style type="text/css">
+
+
+   h3 { 
+       font-size: 18px;
+       padding-bottom: 4pt;
+       border-bottom: 2px solid #dddddd;
+   }
+       
+   .api {
+     border: 1px solid;
+     padding: 10pt;
+     margin: 10pt;
+   } 
+
+   .api-entry { 
+       border-bottom: none;
+       font-size: 18px;
+   }
+
+   .prototype {
+     border: 1px solid;
+     background-color: #f2f2f2;
+     padding: 5pt;
+     margin-top: 5pt;
+     margin-bottom: 5pt;  
+   } 
+
+   .header {
+     border: 1px solid;
+     padding: 0 0 5pt 5pt;
+     margin: 10pt;
+     white-space: pre;
+       font-family: monospace;
+   }
+    
+   .code {
+     border: 1px solid;
+     padding: 0 0 5pt 5pt;
+     margin: 10pt;
+     white-space: pre;
+       font-family: monospace;
+   }
+   
+
+</style>
+</head>
+<body>
+</body>
+</html>
+</span>
\ No newline at end of file
diff --git a/docs/deploy/mono-api-wapi.html b/docs/deploy/mono-api-wapi.html
new file mode 100644
index 0000000..ab6be4c
--- /dev/null
+++ b/docs/deploy/mono-api-wapi.html
@@ -0,0 +1,1604 @@
+<?xml version="1.0" encoding="utf-8"?><span>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+   <title>mono-api-wapi.html</title>
+   <style type="text/css">
+
+
+   h3 { 
+       font-size: 18px;
+       padding-bottom: 4pt;
+       border-bottom: 2px solid #dddddd;
+   }
+       
+   .api {
+     border: 1px solid;
+     padding: 10pt;
+     margin: 10pt;
+   } 
+
+   .api-entry { 
+       border-bottom: none;
+       font-size: 18px;
+   }
+
+   .prototype {
+     border: 1px solid;
+     background-color: #f2f2f2;
+     padding: 5pt;
+     margin-top: 5pt;
+     margin-bottom: 5pt;  
+   } 
+
+   .header {
+     border: 1px solid;
+     padding: 0 0 5pt 5pt;
+     margin: 10pt;
+     white-space: pre;
+       font-family: monospace;
+   }
+    
+   .code {
+     border: 1px solid;
+     padding: 0 0 5pt 5pt;
+     margin: 10pt;
+     white-space: pre;
+       font-family: monospace;
+   }
+   
+
+</style>
+</head>
+<body>
+<h2>Windows Compatibility API</h2>
+
+	<p />Mono implements a small subset of the Win32 API for some
+	file system interaction, I/O, thread and process operations.
+
+	<p />On Windows, Mono uses directly the services provided by the
+	operating system.   On other operating system it uses its own
+	implementation (referred to as the "io-layer" or "wapi"). 
+
+<h3>Windows Compatibility API</h3>
+
+ <a name="api:BindIoCompletionCallback"></a>
+ <div class="api">
+    <div class="api-entry">BindIoCompletionCallback</div>
+
+    <div class="prototype">Prototype: BindIoCompletionCallback</div>
+<p />
+
+</div> <a name="api:CloseHandle"></a>
+ <div class="api">
+    <div class="api-entry">CloseHandle</div>
+
+    <div class="prototype">gboolean CloseHandle(gpointer handle)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>handle:</i></dt><dd> The handle to release</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 Closes and invalidates <i>handle</i>, releasing any resources it
+	 consumes.  When the last handle to a temporary or non-persistent
+	 object is closed, that object can be deleted.  Closing the same
+	 handle twice is an error.
+	
+	 Return value: %TRUE on success, %FALSE otherwise.
+
+</div> <a name="api:closesocket"></a>
+ <div class="api">
+    <div class="api-entry">closesocket</div>
+
+    <div class="prototype">Prototype: closesocket</div>
+<p />
+
+</div> <a name="api:CopyFile"></a>
+ <div class="api">
+    <div class="api-entry">CopyFile</div>
+
+    <div class="prototype">gboolean CopyFile (const gunichar2 *name, const gunichar2 *dest_name,
+		   gboolean fail_if_exists)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>name:</i></dt><dd> a pointer to a NULL-terminated unicode string, that names</dd></blockquote>
+<b>Remarks</b>
+<p />	 the file to be copied. 
+	 <i>dest_name</i>: a pointer to a NULL-terminated unicode string, that is the
+	 new name for the file.
+	 <i>fail_if_exists</i>: if TRUE and dest_name exists, the copy will fail.
+	
+	 Copies file <i>name</i> to <i>dest_name</i>
+	
+	 Return value: %TRUE on success, %FALSE otherwise.
+
+</div> <a name="api:CreateDirectory"></a>
+ <div class="api">
+    <div class="api-entry">CreateDirectory</div>
+
+    <div class="prototype">gboolean CreateDirectory (const gunichar2 *name,
+			  WapiSecurityAttributes *security)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>name:</i></dt><dd> a pointer to a NULL-terminated unicode string, that names</dd></blockquote>
+<b>Remarks</b>
+<p />	 the directory to be created. 
+	 <i>security</i>: ignored for now
+	
+	 Creates directory <i>name</i>
+	
+	 Return value: %TRUE on success, %FALSE otherwise.
+
+</div> <a name="api:CreateEvent"></a>
+ <div class="api">
+    <div class="api-entry">CreateEvent</div>
+
+    <div class="prototype">gpointer CreateEvent(WapiSecurityAttributes *security G_GNUC_UNUSED,
+		     gboolean manual, gboolean initial,
+		     const gunichar2 *name G_GNUC_UNUSED)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>security:</i></dt><dd> Ignored for now.</dd><dt><i>manual:</i></dt><dd> Specifies whether the new event handle has manual or auto</dd></blockquote>
+<b>Remarks</b>
+<p />	 reset behaviour. 
+	 <i>initial</i>: Specifies whether the new event handle is initially
+	 signalled or not.
+	 <i>name</i>:Pointer to a string specifying the name of this name, or
+	 %NULL.  Currently ignored.
+	
+	 Creates a new event handle.
+	
+	 An event handle is signalled with SetEvent().  If the new handle is
+	 a manual reset event handle, it remains signalled until it is reset
+	 with ResetEvent().  An auto reset event remains signalled until a
+	 single thread has waited for it, at which time the event handle is
+	 automatically reset to unsignalled.
+	
+	 Return value: A new handle, or %NULL on error.
+
+</div> <a name="api:CreateFile"></a>
+ <div class="api">
+    <div class="api-entry">CreateFile</div>
+
+    <div class="prototype">gpointer CreateFile(const gunichar2 *name, guint32 fileaccess,
+		    guint32 sharemode, WapiSecurityAttributes *security,
+		    guint32 createmode, guint32 attrs,
+		    gpointer template G_GNUC_UNUSED)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>name:</i></dt><dd> a pointer to a NULL-terminated unicode string, that names</dd></blockquote>
+<b>Remarks</b>
+<p />	 the file or other object to create. 
+	 <i>fileaccess</i>: specifies the file access mode
+	 <i>sharemode</i>: whether the file should be shared.  This parameter is
+	 currently ignored.
+	 <i>security</i>: Ignored for now.
+	 <i>createmode</i>: specifies whether to create a new file, whether to
+	 overwrite an existing file, whether to truncate the file, etc.
+	 <i>attrs</i>: specifies file attributes and flags.  On win32 attributes
+	 are characteristics of the file, not the handle, and are ignored
+	 when an existing file is opened.  Flags give the library hints on
+	 how to process a file to optimise performance.
+	 <i>template</i>: the handle of an open %GENERIC_READ file that specifies
+	 attributes to apply to a newly created file, ignoring <i>attrs</i>.
+	 Normally this parameter is NULL.  This parameter is ignored when an
+	 existing file is opened.
+	
+	 Creates a new file handle.  This only applies to normal files:
+	 pipes are handled by CreatePipe(), and console handles are created
+	 with GetStdHandle().
+	
+	 Return value: the new handle, or %INVALID_HANDLE_VALUE on error.
+
+</div> <a name="api:CreateMutex"></a>
+ <div class="api">
+    <div class="api-entry">CreateMutex</div>
+
+    <div class="prototype">gpointer CreateMutex(WapiSecurityAttributes *security G_GNUC_UNUSED, gboolean owned,
+			const gunichar2 *name)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>security:</i></dt><dd> Ignored for now.</dd><dt><i>owned:</i></dt><dd> If %TRUE, the mutex is created with the calling thread</dd></blockquote>
+<b>Remarks</b>
+<p />	 already owning the mutex. 
+	 <i>name</i>:Pointer to a string specifying the name of this mutex, or
+	 %NULL.
+	
+	 Creates a new mutex handle.  A mutex is signalled when no thread
+	 owns it.  A thread acquires ownership of the mutex by waiting for
+	 it with WaitForSingleObject() or WaitForMultipleObjects().  A
+	 thread relinquishes ownership with ReleaseMutex().
+	
+	 A thread that owns a mutex can specify the same mutex in repeated
+	 wait function calls without blocking.  The thread must call
+	 ReleaseMutex() an equal number of times to release the mutex.
+	
+	 Return value: A new handle, or %NULL on error.
+
+</div> <a name="api:CreatePipe"></a>
+ <div class="api">
+    <div class="api-entry">CreatePipe</div>
+
+    <div class="prototype">Prototype: CreatePipe</div>
+<p />
+
+</div> <a name="api:CreateProcess"></a>
+ <div class="api">
+    <div class="api-entry">CreateProcess</div>
+
+    <div class="prototype">Prototype: CreateProcess</div>
+<p />
+
+</div><h4><a name="api:CreateProcessWithLogonW">CreateProcessWithLogonW</a>
+ <a name="api:CreateSemaphore"></a>
+ <div class="api">
+    <div class="api-entry">CreateSemaphore</div>
+
+    <div class="prototype">gpointer CreateSemaphore(WapiSecurityAttributes *security G_GNUC_UNUSED, gint32 initial, gint32 max, const gunichar2 *name)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>security:</i></dt><dd> Ignored for now.</dd><dt><i>initial:</i></dt><dd> The initial count for the semaphore.  The value must be</dd></blockquote>
+<b>Remarks</b>
+<p />	 greater than or equal to zero, and less than or equal to <i>max</i>. 
+	 <i>max</i>: The maximum count for this semaphore.  The value must be
+	 greater than zero.
+	 <i>name</i>: Pointer to a string specifying the name of this semaphore,
+	 or %NULL.  Currently ignored.
+	
+	 Creates a new semaphore handle.  A semaphore is signalled when its
+	 count is greater than zero, and unsignalled otherwise.  The count
+	 is decreased by one whenever a wait function releases a thread that
+	 was waiting for the semaphore.  The count is increased by calling
+	 ReleaseSemaphore().
+	
+	 Return value: a new handle, or NULL
+
+</div> <a name="api:CreateThread"></a>
+ <div class="api">
+    <div class="api-entry">CreateThread</div>
+
+    <div class="prototype">gpointer CreateThread(WapiSecurityAttributes *security G_GNUC_UNUSED, guint32 stacksize,
+		      WapiThreadStart start, gpointer param, guint32 create,
+		      gsize *tid) 
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>security:</i></dt><dd> Ignored for now.</dd><dt><i>stacksize:</i></dt><dd> the size in bytes of the new thread's stack. Use 0 to</dd></blockquote>
+<b>Remarks</b>
+<p />	 default to the normal stack size. (Ignored for now). 
+	 <i>start</i>: The function that the new thread should start with
+	 <i>param</i>: The parameter to give to <i>start</i>.
+	 <i>create</i>: If 0, the new thread is ready to run immediately.  If
+	 %CREATE_SUSPENDED, the new thread will be in the suspended state,
+	 requiring a ResumeThread() call to continue running.
+	 <i>tid</i>: If non-NULL, the ID of the new thread is stored here.  NB
+	 this is defined as a DWORD (ie 32bit) in the MS API, but we need to
+	 cope with 64 bit IDs for s390x and amd64.
+	
+	 Creates a new threading handle.
+	
+	 Return value: a new handle, or NULL
+
+</div> <a name="api:DeleteCriticalSection"></a>
+ <div class="api">
+    <div class="api-entry">DeleteCriticalSection</div>
+
+    <div class="prototype">void DeleteCriticalSection(WapiCriticalSection *section)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>section:</i></dt><dd> The critical section to delete.</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 Releases all resources owned by critical section <i>section</i>.
+
+</div> <a name="api:DeleteFile"></a>
+ <div class="api">
+    <div class="api-entry">DeleteFile</div>
+
+    <div class="prototype">gboolean DeleteFile(const gunichar2 *name)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>name:</i></dt><dd> a pointer to a NULL-terminated unicode string, that names</dd></blockquote>
+<b>Remarks</b>
+<p />	 the file to be deleted. 
+	
+	 Deletes file <i>name</i>.
+	
+	 Return value: %TRUE on success, %FALSE otherwise.
+
+</div><h4><a name="api:DuplicateHandle">DuplicateHandle</a>
+ <a name="api:EnterCriticalSection"></a>
+ <div class="api">
+    <div class="api-entry">EnterCriticalSection</div>
+
+    <div class="prototype">Prototype: EnterCriticalSection</div>
+<p />
+
+</div> <a name="api:EnumProcesses"></a>
+ <div class="api">
+    <div class="api-entry">EnumProcesses</div>
+
+    <div class="prototype">Prototype: EnumProcesses</div>
+<p />
+
+</div> <a name="api:EnumProcessModules"></a>
+ <div class="api">
+    <div class="api-entry">EnumProcessModules</div>
+
+    <div class="prototype">Prototype: EnumProcessModules</div>
+<p />
+
+</div> <a name="api:errno_to_WSA"></a>
+ <div class="api">
+    <div class="api-entry">errno_to_WSA</div>
+
+    <div class="prototype">Prototype: errno_to_WSA</div>
+<p />
+
+</div> <a name="api:ExitThread"></a>
+ <div class="api">
+    <div class="api-entry">ExitThread</div>
+
+    <div class="prototype">void ExitThread(guint32 exitcode)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>exitcode:</i></dt><dd> Sets the thread's exit code, which can be read from</dd></blockquote>
+<b>Remarks</b>
+<p />	 another thread with GetExitCodeThread(). 
+	
+	 Terminates the calling thread.  A thread can also exit by returning
+	 from its start function. When the last thread in a process
+	 terminates, the process itself terminates.
+
+</div> <a name="api:FileTimeToSystemTime"></a>
+ <div class="api">
+    <div class="api-entry">FileTimeToSystemTime</div>
+
+    <div class="prototype">gboolean FileTimeToSystemTime(const WapiFileTime *file_time,
+			      WapiSystemTime *system_time)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>file_time:</i></dt><dd> Points to a %WapiFileTime structure that contains the</dd></blockquote>
+<b>Remarks</b>
+<p />	 number of ticks to convert. 
+	 <i>system_time</i>: Points to a %WapiSystemTime structure to receive the
+	 broken-out time.
+	
+	 Converts a tick count into broken-out time values.
+	
+	 Return value: %TRUE on success, %FALSE otherwise.
+
+</div> <a name="api:FindClose"></a>
+ <div class="api">
+    <div class="api-entry">FindClose</div>
+
+    <div class="prototype">gboolean FindClose (gpointer handle)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>wapi_handle:</i></dt><dd> the find handle to close.</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 Closes find handle <i>wapi_handle</i>
+	
+	 Return value: %TRUE on success, %FALSE otherwise.
+
+</div> <a name="api:FindFirstFile"></a>
+ <div class="api">
+    <div class="api-entry">FindFirstFile</div>
+
+    <div class="prototype">Prototype: FindFirstFile</div>
+<p />
+
+</div> <a name="api:FindNextFile"></a>
+ <div class="api">
+    <div class="api-entry">FindNextFile</div>
+
+    <div class="prototype">Prototype: FindNextFile</div>
+<p />
+
+</div> <a name="api:FlushFileBuffers"></a>
+ <div class="api">
+    <div class="api-entry">FlushFileBuffers</div>
+
+    <div class="prototype">gboolean FlushFileBuffers(gpointer handle)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>handle:</i></dt><dd> Handle to open file.  The handle must have</dd></blockquote>
+<b>Remarks</b>
+<p />	 %GENERIC_WRITE access. 
+	
+	 Flushes buffers of the file and causes all unwritten data to
+	 be written.
+	
+	 Return value: %TRUE on success, %FALSE otherwise.
+
+</div><h4><a name="api:FormatMessage">FormatMessage</a>
+ <a name="api:GetCurrentDirectory"></a>
+ <div class="api">
+    <div class="api-entry">GetCurrentDirectory</div>
+
+    <div class="prototype">extern guint32 GetCurrentDirectory (guint32 length, gunichar2 *buffer)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>length:</i></dt><dd> size of the buffer</dd><dt><i>buffer:</i></dt><dd> pointer to buffer that recieves path</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 Retrieves the current directory for the current process.
+	
+	 Return value: number of characters in buffer on success, zero on failure
+
+</div> <a name="api:GetCurrentProcess"></a>
+ <div class="api">
+    <div class="api-entry">GetCurrentProcess</div>
+
+    <div class="prototype">Prototype: GetCurrentProcess</div>
+<p />
+
+</div> <a name="api:GetCurrentProcessId"></a>
+ <div class="api">
+    <div class="api-entry">GetCurrentProcessId</div>
+
+    <div class="prototype">Prototype: GetCurrentProcessId</div>
+<p />
+
+</div> <a name="api:GetCurrentThread"></a>
+ <div class="api">
+    <div class="api-entry">GetCurrentThread</div>
+
+    <div class="prototype">gpointer GetCurrentThread(void)
+
+</div>
+<p />
+<b>Remarks</b>
+<p />	 
+	 Looks up the handle associated with the current thread.  Under
+	 Windows this is a pseudohandle, and must be duplicated with
+	 DuplicateHandle() for some operations.
+	
+	 Return value: The current thread handle, or %NULL on failure.
+	 (Unknown whether Windows has a possible failure here.  It may be
+	 necessary to implement the pseudohandle-constant behaviour).
+
+</div> <a name="api:GetCurrentThreadId"></a>
+ <div class="api">
+    <div class="api-entry">GetCurrentThreadId</div>
+
+    <div class="prototype">gsize GetCurrentThreadId(void)
+
+</div>
+<p />
+<b>Remarks</b>
+<p />	 
+	 Looks up the thread ID of the current thread.  This ID can be
+	 passed to OpenThread() to create a new handle on this thread.
+	
+	 Return value: the thread ID.  NB this is defined as DWORD (ie 32
+	 bit) in the MS API, but we need to cope with 64 bit IDs for s390x
+	 and amd64.  This doesn't really break the API, it just embraces and
+	 extends it on 64bit platforms :)
+
+</div><h4><a name="api:GetDiskFreeSpaceEx">GetDiskFreeSpaceEx</a>
+<h4><a name="api:GetDriveType">GetDriveType</a>
+ <a name="api:GetExitCodeProcess"></a>
+ <div class="api">
+    <div class="api-entry">GetExitCodeProcess</div>
+
+    <div class="prototype">Prototype: GetExitCodeProcess</div>
+<p />
+
+</div> <a name="api:GetExitCodeThread"></a>
+ <div class="api">
+    <div class="api-entry">GetExitCodeThread</div>
+
+    <div class="prototype">gboolean GetExitCodeThread(gpointer handle, guint32 *exitcode)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>handle:</i></dt><dd> The thread handle to query</dd><dt><i>exitcode:</i></dt><dd> The thread <i>handle</i> exit code is stored here</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 Finds the exit code of <i>handle</i>, and stores it in <i>exitcode</i>.  If the
+	 thread <i>handle</i> is still running, the value stored is %STILL_ACTIVE.
+	
+	 Return value: %TRUE, or %FALSE on error.
+
+</div> <a name="api:GetFileAttributesEx"></a>
+ <div class="api">
+    <div class="api-entry">GetFileAttributesEx</div>
+
+    <div class="prototype">gboolean GetFileAttributesEx (const gunichar2 *name, WapiGetFileExInfoLevels level, gpointer info)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>name:</i></dt><dd> a pointer to a NULL-terminated unicode filename.</dd><dt><i>level:</i></dt><dd> must be GetFileExInfoStandard</dd><dt><i>info:</i></dt><dd> pointer to a WapiFileAttributesData structure</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 Gets attributes, size and filetimes for <i>name</i>;
+	
+	 Return value: %TRUE on success, %FALSE on failure
+
+</div> <a name="api:GetFileAttributes"></a>
+ <div class="api">
+    <div class="api-entry">GetFileAttributes</div>
+
+    <div class="prototype">guint32 GetFileAttributes (const gunichar2 *name)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>name:</i></dt><dd> a pointer to a NULL-terminated unicode filename.</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 Gets the attributes for <i>name</i>;
+	
+	 Return value: %INVALID_FILE_ATTRIBUTES on failure
+
+</div> <a name="api:GetFileSize"></a>
+ <div class="api">
+    <div class="api-entry">GetFileSize</div>
+
+    <div class="prototype">guint32 GetFileSize(gpointer handle, guint32 *highsize)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>handle:</i></dt><dd> The file handle to query.  The handle must have</dd></blockquote>
+<b>Remarks</b>
+<p />	 %GENERIC_READ or %GENERIC_WRITE access. 
+	 <i>highsize</i>: If non-%NULL, the high 32 bits of the file size are
+	 stored here.
+	
+	 Retrieves the size of the file <i>handle</i>.
+	
+	 If the library is compiled without large file support, <i>highsize</i>
+	 has its value set to zero on a successful return.
+	
+	 Return value: On success, the low 32 bits of the file size.  If
+	 <i>highsize</i> is non-%NULL then the high 32 bits of the file size are
+	 stored here.  On failure %INVALID_FILE_SIZE is returned.
+
+</div> <a name="api:GetFileTime"></a>
+ <div class="api">
+    <div class="api-entry">GetFileTime</div>
+
+    <div class="prototype">gboolean GetFileTime(gpointer handle, WapiFileTime *create_time,
+		     WapiFileTime *last_access, WapiFileTime *last_write)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>handle:</i></dt><dd> The file handle to query.  The handle must have</dd></blockquote>
+<b>Remarks</b>
+<p />	 %GENERIC_READ access. 
+	 <i>create_time</i>: Points to a %WapiFileTime structure to receive the
+	 number of ticks since the epoch that file was created.  May be
+	 %NULL.
+	 <i>last_access</i>: Points to a %WapiFileTime structure to receive the
+	 number of ticks since the epoch when file was last accessed.  May be
+	 %NULL.
+	 <i>last_write</i>: Points to a %WapiFileTime structure to receive the
+	 number of ticks since the epoch when file was last written to.  May
+	 be %NULL.
+	
+	 Finds the number of ticks since the epoch that the file referenced
+	 by <i>handle</i> was created, last accessed and last modified.  A tick is
+	 a 100 nanosecond interval.  The epoch is Midnight, January 1 1601
+	 GMT.
+	
+	 Create time isn't recorded on POSIX file systems or reported by
+	 stat(2), so that time is guessed by returning the oldest of the
+	 other times.
+	
+	 Return value: %TRUE on success, %FALSE otherwise.
+
+</div> <a name="api:GetFileType"></a>
+ <div class="api">
+    <div class="api-entry">GetFileType</div>
+
+    <div class="prototype">WapiFileType GetFileType(gpointer handle)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>handle:</i></dt><dd> The file handle to test.</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 Finds the type of file <i>handle</i>.
+	
+	 Return value: %FILE_TYPE_UNKNOWN - the type of the file <i>handle</i> is
+	 unknown.  %FILE_TYPE_DISK - <i>handle</i> is a disk file.
+	 %FILE_TYPE_CHAR - <i>handle</i> is a character device, such as a console.
+	 %FILE_TYPE_PIPE - <i>handle</i> is a named or anonymous pipe.
+
+</div><h4><a name="api:GetFileVersionInfo">GetFileVersionInfo</a>
+<h4><a name="api:GetFileVersionInfoSize">GetFileVersionInfoSize</a>
+ <a name="api:GetLastError"></a>
+ <div class="api">
+    <div class="api-entry">GetLastError</div>
+
+    <div class="prototype">guint32 GetLastError(void)
+
+</div>
+<p />
+<b>Remarks</b>
+<p />	 
+	 Retrieves the last error that occurred in the calling thread.
+	
+	 Return value: The error code for the last error that happened on
+	 the calling thread.
+
+</div> <a name="api:GetLogicalDriveStrings"></a>
+ <div class="api">
+    <div class="api-entry">GetLogicalDriveStrings</div>
+
+    <div class="prototype">Prototype: GetLogicalDriveStrings</div>
+<p />
+
+</div> <a name="api:GetModuleBaseName"></a>
+ <div class="api">
+    <div class="api-entry">GetModuleBaseName</div>
+
+    <div class="prototype">Prototype: GetModuleBaseName</div>
+<p />
+
+</div><h4><a name="api:GetModuleFileNameEx">GetModuleFileNameEx</a>
+<h4><a name="api:GetModuleInformation">GetModuleInformation</a>
+<h4><a name="api:GetPriorityClass">GetPriorityClass</a>
+ <a name="api:GetProcessId"></a>
+ <div class="api">
+    <div class="api-entry">GetProcessId</div>
+
+    <div class="prototype">Prototype: GetProcessId</div>
+<p />
+
+</div> <a name="api:GetProcessTimes"></a>
+ <div class="api">
+    <div class="api-entry">GetProcessTimes</div>
+
+    <div class="prototype">Prototype: GetProcessTimes</div>
+<p />
+
+</div> <a name="api:GetProcessWorkingSetSize"></a>
+ <div class="api">
+    <div class="api-entry">GetProcessWorkingSetSize</div>
+
+    <div class="prototype">Prototype: GetProcessWorkingSetSize</div>
+<p />
+
+</div> <a name="api:GetStdHandle"></a>
+ <div class="api">
+    <div class="api-entry">GetStdHandle</div>
+
+    <div class="prototype">
+static mono_mutex_t stdhandle_mutex = MONO_MUTEX_INITIALIZER;
+
+gpointer GetStdHandle(WapiStdHandle stdhandle)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>stdhandle:</i></dt><dd> specifies the file descriptor</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 Returns a handle for stdin, stdout, or stderr.  Always returns the
+	 same handle for the same <i>stdhandle</i>.
+	
+	 Return value: the handle, or %INVALID_HANDLE_VALUE on error
+
+</div> <a name="api:GetSystemInfo"></a>
+ <div class="api">
+    <div class="api-entry">GetSystemInfo</div>
+
+    <div class="prototype">Prototype: GetSystemInfo</div>
+<p />
+
+</div> <a name="api:GetTempPath"></a>
+ <div class="api">
+    <div class="api-entry">GetTempPath</div>
+
+    <div class="prototype">Prototype: GetTempPath</div>
+<p />
+
+</div> <a name="api:GetThreadContext"></a>
+ <div class="api">
+    <div class="api-entry">GetThreadContext</div>
+
+    <div class="prototype">Prototype: GetThreadContext</div>
+<p />
+
+</div> <a name="api:GetTickCount"></a>
+ <div class="api">
+    <div class="api-entry">GetTickCount</div>
+
+    <div class="prototype">Prototype: GetTickCount</div>
+<p />
+
+</div> <a name="api:ImpersonateLoggedOnUser"></a>
+ <div class="api">
+    <div class="api-entry">ImpersonateLoggedOnUser</div>
+
+    <div class="prototype">Prototype: ImpersonateLoggedOnUser</div>
+<p />
+
+</div> <a name="api:InitializeCriticalSectionAndSpinCount"></a>
+ <div class="api">
+    <div class="api-entry">InitializeCriticalSectionAndSpinCount</div>
+
+    <div class="prototype">gboolean InitializeCriticalSectionAndSpinCount(WapiCriticalSection *section,
+					       guint32 spincount G_GNUC_UNUSED)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>section:</i></dt><dd> The critical section to initialise.</dd><dt><i>spincount:</i></dt><dd> The spin count for this critical section.  Not</dd></blockquote>
+<b>Remarks</b>
+<p />	 currently used. 
+	
+	 Initialises a critical section and sets the spin count.  This
+	 implementation just calls InitializeCriticalSection().
+	
+	 Return value: %TRUE on success, %FALSE otherwise.  (%FALSE never
+	 happens).
+
+</div> <a name="api:InitializeCriticalSection"></a>
+ <div class="api">
+    <div class="api-entry">InitializeCriticalSection</div>
+
+    <div class="prototype">void InitializeCriticalSection(WapiCriticalSection *section)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>section:</i></dt><dd> The critical section to initialise</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 Initialises a critical section.
+
+</div> <a name="api:ioctlsocket"></a>
+ <div class="api">
+    <div class="api-entry">ioctlsocket</div>
+
+    <div class="prototype">Prototype: ioctlsocket</div>
+<p />
+
+</div> <a name="api:LeaveCriticalSection"></a>
+ <div class="api">
+    <div class="api-entry">LeaveCriticalSection</div>
+
+    <div class="prototype">Prototype: LeaveCriticalSection</div>
+<p />
+
+</div> <a name="api:LockFile"></a>
+ <div class="api">
+    <div class="api-entry">LockFile</div>
+
+    <div class="prototype">Prototype: LockFile</div>
+<p />
+
+</div> <a name="api:MoveFile"></a>
+ <div class="api">
+    <div class="api-entry">MoveFile</div>
+
+    <div class="prototype">gboolean MoveFile (const gunichar2 *name, const gunichar2 *dest_name)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>name:</i></dt><dd> a pointer to a NULL-terminated unicode string, that names</dd></blockquote>
+<b>Remarks</b>
+<p />	 the file to be moved. 
+	 <i>dest_name</i>: a pointer to a NULL-terminated unicode string, that is the
+	 new name for the file.
+	
+	 Renames file <i>name</i> to <i>dest_name</i>.
+	 MoveFile sets ERROR_ALREADY_EXISTS if the destination exists, except
+	 when it is the same file as the source.  In that case it silently succeeds.
+	
+	 Return value: %TRUE on success, %FALSE otherwise.
+
+</div> <a name="api:OpenEvent"></a>
+ <div class="api">
+    <div class="api-entry">OpenEvent</div>
+
+    <div class="prototype">Prototype: OpenEvent</div>
+<p />
+
+</div> <a name="api:OpenMutex"></a>
+ <div class="api">
+    <div class="api-entry">OpenMutex</div>
+
+    <div class="prototype">Prototype: OpenMutex</div>
+<p />
+
+</div> <a name="api:OpenProcess"></a>
+ <div class="api">
+    <div class="api-entry">OpenProcess</div>
+
+    <div class="prototype">Prototype: OpenProcess</div>
+<p />
+
+</div> <a name="api:OpenSemaphore"></a>
+ <div class="api">
+    <div class="api-entry">OpenSemaphore</div>
+
+    <div class="prototype">Prototype: OpenSemaphore</div>
+<p />
+
+</div> <a name="api:OpenThread"></a>
+ <div class="api">
+    <div class="api-entry">OpenThread</div>
+
+    <div class="prototype">Prototype: OpenThread</div>
+<p />
+
+</div> <a name="api:PulseEvent"></a>
+ <div class="api">
+    <div class="api-entry">PulseEvent</div>
+
+    <div class="prototype">gboolean PulseEvent(gpointer handle)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>handle:</i></dt><dd> The event handle.</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 Sets the event handle <i>handle</i> to the signalled state, and then
+	 resets it to unsignalled after informing any waiting threads.
+	
+	 If <i>handle</i> is a manual reset event, all waiting threads that can be
+	 released immediately are released.  <i>handle</i> is then reset.  If
+	 <i>handle</i> is an auto reset event, one waiting thread is released even
+	 if multiple threads are waiting.
+	
+	 Return value: %TRUE on success, %FALSE otherwise.  (Currently only
+	 ever returns %TRUE).
+
+</div> <a name="api:QueryPerformanceCounter"></a>
+ <div class="api">
+    <div class="api-entry">QueryPerformanceCounter</div>
+
+    <div class="prototype">Prototype: QueryPerformanceCounter</div>
+<p />
+
+</div> <a name="api:QueryPerformanceFrequency"></a>
+ <div class="api">
+    <div class="api-entry">QueryPerformanceFrequency</div>
+
+    <div class="prototype">Prototype: QueryPerformanceFrequency</div>
+<p />
+
+</div> <a name="api:QueueUserAPC"></a>
+ <div class="api">
+    <div class="api-entry">QueueUserAPC</div>
+
+    <div class="prototype">Prototype: QueueUserAPC</div>
+<p />
+
+</div> <a name="api:ReadFile"></a>
+ <div class="api">
+    <div class="api-entry">ReadFile</div>
+
+    <div class="prototype">gboolean ReadFile(gpointer handle, gpointer buffer, guint32 numbytes,
+		  guint32 *bytesread, WapiOverlapped *overlapped)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>handle:</i></dt><dd> The file handle to read from.  The handle must have</dd></blockquote>
+<b>Remarks</b>
+<p />	 %GENERIC_READ access. 
+	 <i>buffer</i>: The buffer to store read data in
+	 <i>numbytes</i>: The maximum number of bytes to read
+	 <i>bytesread</i>: The actual number of bytes read is stored here.  This
+	 value can be zero if the handle is positioned at the end of the
+	 file.
+	 <i>overlapped</i>: points to a required %WapiOverlapped structure if
+	 <i>handle</i> has the %FILE_FLAG_OVERLAPPED option set, should be NULL
+	 otherwise.
+	
+	 If <i>handle</i> does not have the %FILE_FLAG_OVERLAPPED option set, this
+	 function reads up to <i>numbytes</i> bytes from the file from the current
+	 file position, and stores them in <i>buffer</i>.  If there are not enough
+	 bytes left in the file, just the amount available will be read.
+	 The actual number of bytes read is stored in <i>bytesread</i>.
+	
+	 If <i>handle</i> has the %FILE_FLAG_OVERLAPPED option set, the current
+	 file position is ignored and the read position is taken from data
+	 in the <i>overlapped</i> structure.
+	
+	 Return value: %TRUE if the read succeeds (even if no bytes were
+	 read due to an attempt to read past the end of the file), %FALSE on
+	 error.
+
+</div> <a name="api:ReleaseMutex"></a>
+ <div class="api">
+    <div class="api-entry">ReleaseMutex</div>
+
+    <div class="prototype">gboolean ReleaseMutex(gpointer handle)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>handle:</i></dt><dd> The mutex handle.</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 Releases ownership if the mutex handle <i>handle</i>.
+	
+	 Return value: %TRUE on success, %FALSE otherwise.  This function
+	 fails if the calling thread does not own the mutex <i>handle</i>.
+
+</div> <a name="api:ReleaseSemaphore"></a>
+ <div class="api">
+    <div class="api-entry">ReleaseSemaphore</div>
+
+    <div class="prototype">gboolean ReleaseSemaphore(gpointer handle, gint32 count, gint32 *prevcount)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>handle:</i></dt><dd> The semaphore handle to release.</dd><dt><i>count:</i></dt><dd> The amount by which the semaphore's count should be</dd></blockquote>
+<b>Remarks</b>
+<p />	 increased. 
+	 <i>prevcount</i>: Pointer to a location to store the previous count of
+	 the semaphore, or %NULL.
+	
+	 Increases the count of semaphore <i>handle</i> by <i>count</i>.
+	
+	 Return value: %TRUE on success, %FALSE otherwise.
+
+</div> <a name="api:RemoveDirectory"></a>
+ <div class="api">
+    <div class="api-entry">RemoveDirectory</div>
+
+    <div class="prototype">gboolean RemoveDirectory (const gunichar2 *name)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>name:</i></dt><dd> a pointer to a NULL-terminated unicode string, that names</dd></blockquote>
+<b>Remarks</b>
+<p />	 the directory to be removed. 
+	
+	 Removes directory <i>name</i>
+	
+	 Return value: %TRUE on success, %FALSE otherwise.
+
+</div><h4><a name="api:ReplaceFile">ReplaceFile</a>
+ <a name="api:ResetEvent"></a>
+ <div class="api">
+    <div class="api-entry">ResetEvent</div>
+
+    <div class="prototype">gboolean ResetEvent(gpointer handle)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>handle:</i></dt><dd> The event handle.</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 Resets the event handle <i>handle</i> to the unsignalled state.
+	
+	 Return value: %TRUE on success, %FALSE otherwise.  (Currently only
+	 ever returns %TRUE).
+
+</div> <a name="api:ResumeThread"></a>
+ <div class="api">
+    <div class="api-entry">ResumeThread</div>
+
+    <div class="prototype">guint32 ResumeThread(gpointer handle)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>handle:</i></dt><dd> the thread handle to resume</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 Decrements the suspend count of thread <i>handle</i>. A thread can only
+	 run if its suspend count is zero.
+	
+	 Return value: the previous suspend count, or 0xFFFFFFFF on error.
+
+</div> <a name="api:RevertToSelf"></a>
+ <div class="api">
+    <div class="api-entry">RevertToSelf</div>
+
+    <div class="prototype">Prototype: RevertToSelf</div>
+<p />
+
+</div> <a name="api:SetCriticalSectionSpinCount"></a>
+ <div class="api">
+    <div class="api-entry">SetCriticalSectionSpinCount</div>
+
+    <div class="prototype">guint32 SetCriticalSectionSpinCount(WapiCriticalSection *section G_GNUC_UNUSED, guint32 spincount G_GNUC_UNUSED)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>section:</i></dt><dd> The critical section to set</dd><dt><i>spincount:</i></dt><dd> The new spin count for this critical section.  Not</dd></blockquote>
+<b>Remarks</b>
+<p />	 currently used. 
+	
+	 Sets the spin count for the critical section <i>section</i>.  The spin
+	 count is currently ignored, and set to zero.
+	
+	 Return value: The previous spin count.  (Currently always zero).
+
+</div> <a name="api:SetCurrentDirectory"></a>
+ <div class="api">
+    <div class="api-entry">SetCurrentDirectory</div>
+
+    <div class="prototype">extern gboolean SetCurrentDirectory (const gunichar2 *path)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>path:</i></dt><dd> path to new directory</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 Changes the directory path for the current process.
+	
+	 Return value: %TRUE on success, %FALSE on failure.
+
+</div> <a name="api:SetEndOfFile"></a>
+ <div class="api">
+    <div class="api-entry">SetEndOfFile</div>
+
+    <div class="prototype">gboolean SetEndOfFile(gpointer handle)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>handle:</i></dt><dd> The file handle to set.  The handle must have</dd></blockquote>
+<b>Remarks</b>
+<p />	 %GENERIC_WRITE access. 
+	
+	 Moves the end-of-file position to the current position of the file
+	 pointer.  This function is used to truncate or extend a file.
+	
+	 Return value: %TRUE on success, %FALSE otherwise.
+
+</div> <a name="api:SetEvent"></a>
+ <div class="api">
+    <div class="api-entry">SetEvent</div>
+
+    <div class="prototype">gboolean SetEvent(gpointer handle)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>handle:</i></dt><dd> The event handle</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 Sets the event handle <i>handle</i> to the signalled state.
+	
+	 If <i>handle</i> is a manual reset event, it remains signalled until it
+	 is reset with ResetEvent().  An auto reset event remains signalled
+	 until a single thread has waited for it, at which time <i>handle</i> is
+	 automatically reset to unsignalled.
+	
+	 Return value: %TRUE on success, %FALSE otherwise.  (Currently only
+	 ever returns %TRUE).
+
+</div> <a name="api:SetFileAttributes"></a>
+ <div class="api">
+    <div class="api-entry">SetFileAttributes</div>
+
+    <div class="prototype">extern gboolean SetFileAttributes (const gunichar2 *name, guint32 attrs)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>name:</i></dt><dd> name of file</dd><dt><i>attrs:</i></dt><dd> attributes to set</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 Changes the attributes on a named file.
+	
+	 Return value: %TRUE on success, %FALSE on failure.
+
+</div> <a name="api:SetFilePointer"></a>
+ <div class="api">
+    <div class="api-entry">SetFilePointer</div>
+
+    <div class="prototype">guint32 SetFilePointer(gpointer handle, gint32 movedistance,
+		       gint32 *highmovedistance, WapiSeekMethod method)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>handle:</i></dt><dd> The file handle to set.  The handle must have</dd></blockquote>
+<b>Remarks</b>
+<p />	 %GENERIC_READ or %GENERIC_WRITE access. 
+	 <i>movedistance</i>: Low 32 bits of a signed value that specifies the
+	 number of bytes to move the file pointer.
+	 <i>highmovedistance</i>: Pointer to the high 32 bits of a signed value
+	 that specifies the number of bytes to move the file pointer, or
+	 %NULL.
+	 <i>method</i>: The starting point for the file pointer move.
+	
+	 Sets the file pointer of an open file.
+	
+	 The distance to move the file pointer is calculated from
+	 <i>movedistance</i> and <i>highmovedistance</i>: If <i>highmovedistance</i> is %NULL,
+	 <i>movedistance</i> is the 32-bit signed value; otherwise, <i>movedistance</i>
+	 is the low 32 bits and <i>highmovedistance</i> a pointer to the high 32
+	 bits of a 64 bit signed value.  A positive distance moves the file
+	 pointer forward from the position specified by <i>method</i>; a negative
+	 distance moves the file pointer backward.
+	
+	 If the library is compiled without large file support,
+	 <i>highmovedistance</i> is ignored and its value is set to zero on a
+	 successful return.
+	
+	 Return value: On success, the low 32 bits of the new file pointer.
+	 If <i>highmovedistance</i> is not %NULL, the high 32 bits of the new file
+	 pointer are stored there.  On failure, %INVALID_SET_FILE_POINTER.
+
+</div> <a name="api:SetFileTime"></a>
+ <div class="api">
+    <div class="api-entry">SetFileTime</div>
+
+    <div class="prototype">gboolean SetFileTime(gpointer handle, const WapiFileTime *create_time,
+		     const WapiFileTime *last_access,
+		     const WapiFileTime *last_write)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>handle:</i></dt><dd> The file handle to set.  The handle must have</dd></blockquote>
+<b>Remarks</b>
+<p />	 %GENERIC_WRITE access. 
+	 <i>create_time</i>: Points to a %WapiFileTime structure that contains the
+	 number of ticks since the epoch that the file was created.  May be
+	 %NULL.
+	 <i>last_access</i>: Points to a %WapiFileTime structure that contains the
+	 number of ticks since the epoch when the file was last accessed.
+	 May be %NULL.
+	 <i>last_write</i>: Points to a %WapiFileTime structure that contains the
+	 number of ticks since the epoch when the file was last written to.
+	 May be %NULL.
+	
+	 Sets the number of ticks since the epoch that the file referenced
+	 by <i>handle</i> was created, last accessed or last modified.  A tick is
+	 a 100 nanosecond interval.  The epoch is Midnight, January 1 1601
+	 GMT.
+	
+	 Create time isn't recorded on POSIX file systems, and is ignored.
+	
+	 Return value: %TRUE on success, %FALSE otherwise.
+
+</div> <a name="api:SetLastError"></a>
+ <div class="api">
+    <div class="api-entry">SetLastError</div>
+
+    <div class="prototype">void SetLastError(guint32 code)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>code:</i></dt><dd> The error code.</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 Sets the error code in the calling thread.
+
+</div><h4><a name="api:SetPriorityClass">SetPriorityClass</a>
+ <a name="api:SetProcessWorkingSetSize"></a>
+ <div class="api">
+    <div class="api-entry">SetProcessWorkingSetSize</div>
+
+    <div class="prototype">Prototype: SetProcessWorkingSetSize</div>
+<p />
+
+</div> <a name="api:ShellExecuteEx"></a>
+ <div class="api">
+    <div class="api-entry">ShellExecuteEx</div>
+
+    <div class="prototype">Prototype: ShellExecuteEx</div>
+<p />
+
+</div> <a name="api:SignalObjectAndWait"></a>
+ <div class="api">
+    <div class="api-entry">SignalObjectAndWait</div>
+
+    <div class="prototype">guint32 SignalObjectAndWait(gpointer signal_handle, gpointer wait,
+			    guint32 timeout, gboolean alertable)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>signal_handle:</i></dt><dd> An object to signal</dd><dt><i>wait:</i></dt><dd> An object to wait for</dd><dt><i>timeout:</i></dt><dd> The maximum time in milliseconds to wait for</dd><dt><i>alertable:</i></dt><dd> Specifies whether the function returnes when the system</dd></blockquote>
+<b>Remarks</b>
+<p />	 queues an I/O completion routine or an APC for the calling thread. 
+	
+	 Atomically signals <i>signal</i> and waits for <i>wait</i> to become signalled,
+	 or <i>timeout</i> ms elapses.  If <i>timeout</i> is zero, the object's state is
+	 tested and the function returns immediately.  If <i>timeout</i> is
+	 %INFINITE, the function waits forever.
+	
+	 <i>signal</i> can be a semaphore, mutex or event object.
+	
+	 If <i>alertable</i> is %TRUE and the system queues an I/O completion
+	 routine or an APC for the calling thread, the function returns and
+	 the thread calls the completion routine or APC function.  If
+	 %FALSE, the function does not return, and the thread does not call
+	 the completion routine or APC function.  A completion routine is
+	 queued when the ReadFileEx() or WriteFileEx() function in which it
+	 was specified has completed.  The calling thread is the thread that
+	 initiated the read or write operation.  An APC is queued when
+	 QueueUserAPC() is called.  Currently completion routines and APC
+	 functions are not supported.
+	
+	 Return value: %WAIT_ABANDONED - <i>wait</i> is a mutex that was not
+	 released by the owning thread when it exited.  Ownershop of the
+	 mutex object is granted to the calling thread and the mutex is set
+	 to nonsignalled.  %WAIT_IO_COMPLETION - the wait was ended by one
+	 or more user-mode asynchronous procedure calls queued to the
+	 thread.  %WAIT_OBJECT_0 - The state of <i>wait</i> is signalled.
+	 %WAIT_TIMEOUT - The <i>timeout</i> interval elapsed and <i>wait</i>'s state is
+	 still not signalled.  %WAIT_FAILED - an error occurred.
+
+</div> <a name="api:SleepEx"></a>
+ <div class="api">
+    <div class="api-entry">SleepEx</div>
+
+    <div class="prototype">guint32 SleepEx(guint32 ms, gboolean alertable)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>ms:</i></dt><dd> The time in milliseconds to suspend for</dd><dt><i>alertable:</i></dt><dd> if TRUE, the wait can be interrupted by an APC call</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 Suspends execution of the current thread for <i>ms</i> milliseconds.  A
+	 value of zero causes the thread to relinquish its time slice.  A
+	 value of %INFINITE causes an infinite delay.
+
+</div> <a name="api:Sleep"></a>
+ <div class="api">
+    <div class="api-entry">Sleep</div>
+
+    <div class="prototype">Prototype: Sleep</div>
+<p />
+
+</div> <a name="api:SuspendThread"></a>
+ <div class="api">
+    <div class="api-entry">SuspendThread</div>
+
+    <div class="prototype">guint32 SuspendThread(gpointer handle)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>handle:</i></dt><dd> the thread handle to suspend</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 Increments the suspend count of thread <i>handle</i>. A thread can only
+	 run if its suspend count is zero.
+	
+	 Return value: the previous suspend count, or 0xFFFFFFFF on error.
+
+</div> <a name="api:TerminateProcess"></a>
+ <div class="api">
+    <div class="api-entry">TerminateProcess</div>
+
+    <div class="prototype">Prototype: TerminateProcess</div>
+<p />
+
+</div> <a name="api:TlsAlloc"></a>
+ <div class="api">
+    <div class="api-entry">TlsAlloc</div>
+
+    <div class="prototype">guint32 TlsAlloc(void)
+
+</div>
+<p />
+<b>Remarks</b>
+<p />	 
+	 Allocates a Thread Local Storage (TLS) index.  Any thread in the
+	 same process can use this index to store and retrieve values that
+	 are local to that thread.
+	
+	 Return value: The index value, or %TLS_OUT_OF_INDEXES if no index
+	 is available.
+
+</div> <a name="api:TlsFree"></a>
+ <div class="api">
+    <div class="api-entry">TlsFree</div>
+
+    <div class="prototype">gboolean TlsFree(guint32 idx)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>idx:</i></dt><dd> The TLS index to free</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 Releases a TLS index, making it available for reuse.  This call
+	 will delete any TLS data stored under index <i>idx</i> in all threads.
+	
+	 Return value: %TRUE on success, %FALSE otherwise.
+
+</div> <a name="api:TlsGetValue"></a>
+ <div class="api">
+    <div class="api-entry">TlsGetValue</div>
+
+    <div class="prototype">gpointer TlsGetValue(guint32 idx)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>idx:</i></dt><dd> The TLS index to retrieve</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 Retrieves the TLS data stored under index <i>idx</i>.
+	
+	 Return value: The value stored in the TLS index <i>idx</i> in the current
+	 thread, or %NULL on error.  As %NULL can be a valid return value,
+	 in this case GetLastError() returns %ERROR_SUCCESS.
+
+</div> <a name="api:TlsSetValue"></a>
+ <div class="api">
+    <div class="api-entry">TlsSetValue</div>
+
+    <div class="prototype">gboolean TlsSetValue(guint32 idx, gpointer value)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>idx:</i></dt><dd> The TLS index to store</dd><dt><i>value:</i></dt><dd> The value to store under index <i>idx</i></dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 Stores <i>value</i> at TLS index <i>idx</i>.
+	
+	 Return value: %TRUE on success, %FALSE otherwise.
+
+</div><h4><a name="api:TransmitFile">TransmitFile</a>
+ <a name="api:TryEnterCriticalSection"></a>
+ <div class="api">
+    <div class="api-entry">TryEnterCriticalSection</div>
+
+    <div class="prototype">gboolean TryEnterCriticalSection(WapiCriticalSection *section)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>section:</i></dt><dd> The critical section to try and enter</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 Attempts to enter a critical section without blocking.  If
+	 successful the calling thread takes ownership of the critical
+	 section.
+	
+	 A thread can recursively call EnterCriticalSection() and
+	 TryEnterCriticalSection(), but must call LeaveCriticalSection() an
+	 equal number of times.
+	
+	 Return value: %TRUE if the thread successfully locked the critical
+	 section, %FALSE otherwise.
+
+</div> <a name="api:UnlockFile"></a>
+ <div class="api">
+    <div class="api-entry">UnlockFile</div>
+
+    <div class="prototype">Prototype: UnlockFile</div>
+<p />
+
+</div><h4><a name="api:VerLanguageName">VerLanguageName</a>
+<h4><a name="api:VerQueryValue">VerQueryValue</a>
+<h4><a name="api:WaitForInputIdle">WaitForInputIdle</a>
+ <a name="api:WaitForMultipleObjectsEx"></a>
+ <div class="api">
+    <div class="api-entry">WaitForMultipleObjectsEx</div>
+
+    <div class="prototype">guint32 WaitForMultipleObjectsEx(guint32 numobjects, gpointer *handles,
+				 gboolean waitall, guint32 timeout,
+				 gboolean alertable)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>numobjects:</i></dt><dd> The number of objects in <i>handles</i>. The maximum allowed</dd></blockquote>
+<b>Remarks</b>
+<p />	 is %MAXIMUM_WAIT_OBJECTS. 
+	 <i>handles</i>: An array of object handles.  Duplicates are not allowed.
+	 <i>waitall</i>: If %TRUE, this function waits until all of the handles
+	 are signalled.  If %FALSE, this function returns when any object is
+	 signalled.
+	 <i>timeout</i>: The maximum time in milliseconds to wait for.
+	 <i>alertable</i>: if TRUE, the wait can be interrupted by an APC call
+	
+<p />
+	 This function returns when either one or more of <i>handles</i> is
+	 signalled, or <i>timeout</i> ms elapses.  If <i>timeout</i> is zero, the state
+	 of each item of <i>handles</i> is tested and the function returns
+	 immediately.  If <i>timeout</i> is %INFINITE, the function waits forever.
+	
+	 Return value: %WAIT_OBJECT_0 to %WAIT_OBJECT_0 + <i>numobjects</i> - 1 -
+	 if <i>waitall</i> is %TRUE, indicates that all objects are signalled.  If
+	 <i>waitall</i> is %FALSE, the return value minus %WAIT_OBJECT_0 indicates
+	 the first index into <i>handles</i> of the objects that are signalled.
+	 %WAIT_ABANDONED_0 to %WAIT_ABANDONED_0 + <i>numobjects</i> - 1 - if
+	 <i>waitall</i> is %TRUE, indicates that all objects are signalled, and at
+	 least one object is an abandoned mutex object (See
+	 WaitForSingleObject() for a description of abandoned mutexes.)  If
+	 <i>waitall</i> is %FALSE, the return value minus %WAIT_ABANDONED_0
+	 indicates the first index into <i>handles</i> of an abandoned mutex.
+	 %WAIT_TIMEOUT - The <i>timeout</i> interval elapsed and no objects in
+	 <i>handles</i> are signalled.  %WAIT_FAILED - an error occurred.
+	 %WAIT_IO_COMPLETION - the wait was ended by an APC.
+
+</div> <a name="api:WaitForMultipleObjects"></a>
+ <div class="api">
+    <div class="api-entry">WaitForMultipleObjects</div>
+
+    <div class="prototype">Prototype: WaitForMultipleObjects</div>
+<p />
+
+</div> <a name="api:WaitForSingleObjectEx"></a>
+ <div class="api">
+    <div class="api-entry">WaitForSingleObjectEx</div>
+
+    <div class="prototype">guint32 WaitForSingleObjectEx(gpointer handle, guint32 timeout,
+			      gboolean alertable)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>handle:</i></dt><dd> an object to wait for</dd><dt><i>timeout:</i></dt><dd> the maximum time in milliseconds to wait for</dd><dt><i>alertable:</i></dt><dd> if TRUE, the wait can be interrupted by an APC call</dd></blockquote>
+<b>Remarks</b>
+<p />	 
+	 This function returns when either <i>handle</i> is signalled, or <i>timeout</i>
+	 ms elapses.  If <i>timeout</i> is zero, the object's state is tested and
+	 the function returns immediately.  If <i>timeout</i> is %INFINITE, the
+	 function waits forever.
+	
+	 Return value: %WAIT_ABANDONED - <i>handle</i> is a mutex that was not
+	 released by the owning thread when it exited.  Ownership of the
+	 mutex object is granted to the calling thread and the mutex is set
+	 to nonsignalled.  %WAIT_OBJECT_0 - The state of <i>handle</i> is
+	 signalled.  %WAIT_TIMEOUT - The <i>timeout</i> interval elapsed and
+	 <i>handle</i>'s state is still not signalled.  %WAIT_FAILED - an error
+	 occurred. %WAIT_IO_COMPLETION - the wait was ended by an APC.
+
+</div> <a name="api:WaitForSingleObject"></a>
+ <div class="api">
+    <div class="api-entry">WaitForSingleObject</div>
+
+    <div class="prototype">Prototype: WaitForSingleObject</div>
+<p />
+
+</div> <a name="api:WriteFile"></a>
+ <div class="api">
+    <div class="api-entry">WriteFile</div>
+
+    <div class="prototype">gboolean WriteFile(gpointer handle, gconstpointer buffer, guint32 numbytes,
+		   guint32 *byteswritten, WapiOverlapped *overlapped)
+
+</div>
+<p />
+<b>Parameters</b>
+<blockquote><dt><i>handle:</i></dt><dd> The file handle to write to.  The handle must have</dd></blockquote>
+<b>Remarks</b>
+<p />	 %GENERIC_WRITE access. 
+	 <i>buffer</i>: The buffer to read data from.
+	 <i>numbytes</i>: The maximum number of bytes to write.
+	 <i>byteswritten</i>: The actual number of bytes written is stored here.
+	 If the handle is positioned at the file end, the length of the file
+	 is extended.  This parameter may be %NULL.
+	 <i>overlapped</i>: points to a required %WapiOverlapped structure if
+	 <i>handle</i> has the %FILE_FLAG_OVERLAPPED option set, should be NULL
+	 otherwise.
+	
+	 If <i>handle</i> does not have the %FILE_FLAG_OVERLAPPED option set, this
+	 function writes up to <i>numbytes</i> bytes from <i>buffer</i> to the file at
+	 the current file position.  If <i>handle</i> is positioned at the end of
+	 the file, the file is extended.  The actual number of bytes written
+	 is stored in <i>byteswritten</i>.
+	
+	 If <i>handle</i> has the %FILE_FLAG_OVERLAPPED option set, the current
+	 file position is ignored and the write position is taken from data
+	 in the <i>overlapped</i> structure.
+	
+	 Return value: %TRUE if the write succeeds, %FALSE on error.
+
+</div> <a name="api:WSACleanup"></a>
+ <div class="api">
+    <div class="api-entry">WSACleanup</div>
+
+    <div class="prototype">Prototype: WSACleanup</div>
+<p />
+
+</div> <a name="api:WSAGetLastError"></a>
+ <div class="api">
+    <div class="api-entry">WSAGetLastError</div>
+
+    <div class="prototype">Prototype: WSAGetLastError</div>
+<p />
+
+</div> <a name="api:WSAIoctl"></a>
+ <div class="api">
+    <div class="api-entry">WSAIoctl</div>
+
+    <div class="prototype">Prototype: WSAIoctl</div>
+<p />
+
+</div> <a name="api:WSARecv"></a>
+ <div class="api">
+    <div class="api-entry">WSARecv</div>
+
+    <div class="prototype">Prototype: WSARecv</div>
+<p />
+
+</div> <a name="api:WSASend"></a>
+ <div class="api">
+    <div class="api-entry">WSASend</div>
+
+    <div class="prototype">Prototype: WSASend</div>
+<p />
+
+</div> <a name="api:WSASetLastError"></a>
+ <div class="api">
+    <div class="api-entry">WSASetLastError</div>
+
+    <div class="prototype">Prototype: WSASetLastError</div>
+<p />
+
+</div> <a name="api:WSAStartup"></a>
+ <div class="api">
+    <div class="api-entry">WSAStartup</div>
+
+    <div class="prototype">Prototype: WSAStartup</div>
+<p />
+
+
+</div><h3>Extended APIs</h3>
+
+	<p />The extended APIs provide access to a few internals of the
+	WAPI stack that are not exposed through the standard Win32
+	APIs.
+	
+ <a name="api:mono_once"></a>
+ <div class="api">
+    <div class="api-entry">mono_once</div>
+
+    <div class="prototype">Prototype: mono_once</div>
+<p />
+
+</div><h4><a name="api:wapi_clear_interruption">wapi_clear_interruption</a>
+<h4><a name="api:wapi_current_thread_desc">wapi_current_thread_desc</a>
+<h4><a name="api:wapi_interrupt_thread">wapi_interrupt_thread</a>
+<h4><a name="api:wapi_self_interrupt">wapi_self_interrupt</a>
+<h4><a name="api:wapi_thread_clear_wait_handle">wapi_thread_clear_wait_handle</a>
+</h4></h4></h4></h4></h4></h4></h4></h4></h4></h4></h4></h4></h4></h4></h4></h4></h4></h4></h4></h4></h4></body>
+</html>
+</span>
\ No newline at end of file
diff --git a/eglib/ChangeLog b/eglib/ChangeLog
index 5aa5a6b..7ae4fda 100644
--- a/eglib/ChangeLog
+++ b/eglib/ChangeLog
@@ -1,3 +1,9 @@
+2011-08-30  Jonathan Pryor  <jonpryor at vt.edu>
+
+	Don't use vasprintf on PLATFORM_ANDROID.
+
+	This allows sanely using g_log() within signal handlers.
+
 2011-08-16  Rodrigo Kumpera  <kumpera at gmail.com>
 
 	Fix g_log redirection under android.
diff --git a/eglib/INSTALL b/eglib/INSTALL
index 5458714..7d1c323 100644
--- a/eglib/INSTALL
+++ b/eglib/INSTALL
@@ -2,18 +2,24 @@ Installation Instructions
 *************************
 
 Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
-2006 Free Software Foundation, Inc.
+2006, 2007, 2008, 2009 Free Software Foundation, Inc.
 
-This file is free documentation; the Free Software Foundation gives
-unlimited permission to copy, distribute and modify it.
+   Copying and distribution of this file, with or without modification,
+are permitted in any medium without royalty provided the copyright
+notice and this notice are preserved.  This file is offered as-is,
+without warranty of any kind.
 
 Basic Installation
 ==================
 
-Briefly, the shell commands `./configure; make; make install' should
+   Briefly, the shell commands `./configure; make; make install' should
 configure, build, and install this package.  The following
 more-detailed instructions are generic; see the `README' file for
-instructions specific to this package.
+instructions specific to this package.  Some packages provide this
+`INSTALL' file but do not implement all of the features documented
+below.  The lack of an optional feature in a given package is not
+necessarily a bug.  More recommendations for GNU packages can be found
+in *note Makefile Conventions: (standards)Makefile Conventions.
 
    The `configure' shell script attempts to guess correct values for
 various system-dependent variables used during compilation.  It uses
@@ -42,7 +48,7 @@ may remove or edit it.
 you want to change it or regenerate `configure' using a newer version
 of `autoconf'.
 
-The simplest way to compile this package is:
+   The simplest way to compile this package is:
 
   1. `cd' to the directory containing the package's source code and type
      `./configure' to configure the package for your system.
@@ -53,12 +59,22 @@ The simplest way to compile this package is:
   2. Type `make' to compile the package.
 
   3. Optionally, type `make check' to run any self-tests that come with
-     the package.
+     the package, generally using the just-built uninstalled binaries.
 
   4. Type `make install' to install the programs and any data files and
-     documentation.
-
-  5. You can remove the program binaries and object files from the
+     documentation.  When installing into a prefix owned by root, it is
+     recommended that the package be configured and built as a regular
+     user, and only the `make install' phase executed with root
+     privileges.
+
+  5. Optionally, type `make installcheck' to repeat any self-tests, but
+     this time using the binaries in their final installed location.
+     This target does not install anything.  Running this target as a
+     regular user, particularly if the prior `make install' required
+     root privileges, verifies that the installation completed
+     correctly.
+
+  6. You can remove the program binaries and object files from the
      source code directory by typing `make clean'.  To also remove the
      files that `configure' created (so you can compile the package for
      a different kind of computer), type `make distclean'.  There is
@@ -67,12 +83,22 @@ The simplest way to compile this package is:
      all sorts of other programs in order to regenerate files that came
      with the distribution.
 
+  7. Often, you can also type `make uninstall' to remove the installed
+     files again.  In practice, not all packages have tested that
+     uninstallation works correctly, even though it is required by the
+     GNU Coding Standards.
+
+  8. Some packages, particularly those that use Automake, provide `make
+     distcheck', which can by used by developers to test that all other
+     targets like `make install' and `make uninstall' work correctly.
+     This target is generally not run by end users.
+
 Compilers and Options
 =====================
 
-Some systems require unusual options for compilation or linking that the
-`configure' script does not know about.  Run `./configure --help' for
-details on some of the pertinent environment variables.
+   Some systems require unusual options for compilation or linking that
+the `configure' script does not know about.  Run `./configure --help'
+for details on some of the pertinent environment variables.
 
    You can give `configure' initial values for configuration parameters
 by setting variables in the command line or in the environment.  Here
@@ -85,25 +111,41 @@ is an example:
 Compiling For Multiple Architectures
 ====================================
 
-You can compile the package for more than one kind of computer at the
+   You can compile the package for more than one kind of computer at the
 same time, by placing the object files for each architecture in their
 own directory.  To do this, you can use GNU `make'.  `cd' to the
 directory where you want the object files and executables to go and run
 the `configure' script.  `configure' automatically checks for the
-source code in the directory that `configure' is in and in `..'.
+source code in the directory that `configure' is in and in `..'.  This
+is known as a "VPATH" build.
 
    With a non-GNU `make', it is safer to compile the package for one
 architecture at a time in the source code directory.  After you have
 installed the package for one architecture, use `make distclean' before
 reconfiguring for another architecture.
 
+   On MacOS X 10.5 and later systems, you can create libraries and
+executables that work on multiple system types--known as "fat" or
+"universal" binaries--by specifying multiple `-arch' options to the
+compiler but only a single `-arch' option to the preprocessor.  Like
+this:
+
+     ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
+                 CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
+                 CPP="gcc -E" CXXCPP="g++ -E"
+
+   This is not guaranteed to produce working output in all cases, you
+may have to build one architecture at a time and combine the results
+using the `lipo' tool if you have problems.
+
 Installation Names
 ==================
 
-By default, `make install' installs the package's commands under
+   By default, `make install' installs the package's commands under
 `/usr/local/bin', include files under `/usr/local/include', etc.  You
 can specify an installation prefix other than `/usr/local' by giving
-`configure' the option `--prefix=PREFIX'.
+`configure' the option `--prefix=PREFIX', where PREFIX must be an
+absolute file name.
 
    You can specify separate installation prefixes for
 architecture-specific files and architecture-independent files.  If you
@@ -114,16 +156,47 @@ Documentation and other data files still use the regular prefix.
    In addition, if you use an unusual directory layout you can give
 options like `--bindir=DIR' to specify different values for particular
 kinds of files.  Run `configure --help' for a list of the directories
-you can set and what kinds of files go in them.
+you can set and what kinds of files go in them.  In general, the
+default for these options is expressed in terms of `${prefix}', so that
+specifying just `--prefix' will affect all of the other directory
+specifications that were not explicitly provided.
+
+   The most portable way to affect installation locations is to pass the
+correct locations to `configure'; however, many packages provide one or
+both of the following shortcuts of passing variable assignments to the
+`make install' command line to change installation locations without
+having to reconfigure or recompile.
+
+   The first method involves providing an override variable for each
+affected directory.  For example, `make install
+prefix=/alternate/directory' will choose an alternate location for all
+directory configuration variables that were expressed in terms of
+`${prefix}'.  Any directories that were specified during `configure',
+but not in terms of `${prefix}', must each be overridden at install
+time for the entire installation to be relocated.  The approach of
+makefile variable overrides for each directory variable is required by
+the GNU Coding Standards, and ideally causes no recompilation.
+However, some platforms have known limitations with the semantics of
+shared libraries that end up requiring recompilation when using this
+method, particularly noticeable in packages that use GNU Libtool.
+
+   The second method involves providing the `DESTDIR' variable.  For
+example, `make install DESTDIR=/alternate/directory' will prepend
+`/alternate/directory' before all installation names.  The approach of
+`DESTDIR' overrides is not required by the GNU Coding Standards, and
+does not work on platforms that have drive letters.  On the other hand,
+it does better at avoiding recompilation issues, and works well even
+when some directory options were not specified in terms of `${prefix}'
+at `configure' time.
+
+Optional Features
+=================
 
    If the package supports it, you can cause programs to be installed
 with an extra prefix or suffix on their names by giving `configure' the
 option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
 
-Optional Features
-=================
-
-Some packages pay attention to `--enable-FEATURE' options to
+   Some packages pay attention to `--enable-FEATURE' options to
 `configure', where FEATURE indicates an optional part of the package.
 They may also pay attention to `--with-PACKAGE' options, where PACKAGE
 is something like `gnu-as' or `x' (for the X Window System).  The
@@ -135,14 +208,53 @@ find the X include and library files automatically, but if it doesn't,
 you can use the `configure' options `--x-includes=DIR' and
 `--x-libraries=DIR' to specify their locations.
 
+   Some packages offer the ability to configure how verbose the
+execution of `make' will be.  For these packages, running `./configure
+--enable-silent-rules' sets the default to minimal output, which can be
+overridden with `make V=1'; while running `./configure
+--disable-silent-rules' sets the default to verbose, which can be
+overridden with `make V=0'.
+
+Particular systems
+==================
+
+   On HP-UX, the default C compiler is not ANSI C compatible.  If GNU
+CC is not installed, it is recommended to use the following options in
+order to use an ANSI C compiler:
+
+     ./configure CC="cc -Ae -D_XOPEN_SOURCE=500"
+
+and if that doesn't work, install pre-built binaries of GCC for HP-UX.
+
+   On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
+parse its `<wchar.h>' header file.  The option `-nodtk' can be used as
+a workaround.  If GNU CC is not installed, it is therefore recommended
+to try
+
+     ./configure CC="cc"
+
+and if that doesn't work, try
+
+     ./configure CC="cc -nodtk"
+
+   On Solaris, don't put `/usr/ucb' early in your `PATH'.  This
+directory contains several dysfunctional programs; working variants of
+these programs are available in `/usr/bin'.  So, if you need `/usr/ucb'
+in your `PATH', put it _after_ `/usr/bin'.
+
+   On Haiku, software installed for all users goes in `/boot/common',
+not `/usr/local'.  It is recommended to use the following options:
+
+     ./configure --prefix=/boot/common
+
 Specifying the System Type
 ==========================
 
-There may be some features `configure' cannot figure out automatically,
-but needs to determine by the type of machine the package will run on.
-Usually, assuming the package is built to be run on the _same_
-architectures, `configure' can figure that out, but if it prints a
-message saying it cannot guess the machine type, give it the
+   There may be some features `configure' cannot figure out
+automatically, but needs to determine by the type of machine the package
+will run on.  Usually, assuming the package is built to be run on the
+_same_ architectures, `configure' can figure that out, but if it prints
+a message saying it cannot guess the machine type, give it the
 `--build=TYPE' option.  TYPE can either be a short name for the system
 type, such as `sun4', or a canonical name which has the form:
 
@@ -150,7 +262,8 @@ type, such as `sun4', or a canonical name which has the form:
 
 where SYSTEM can have one of these forms:
 
-     OS KERNEL-OS
+     OS
+     KERNEL-OS
 
    See the file `config.sub' for the possible values of each field.  If
 `config.sub' isn't included in this package, then this package doesn't
@@ -168,9 +281,9 @@ eventually be run) with `--host=TYPE'.
 Sharing Defaults
 ================
 
-If you want to set default values for `configure' scripts to share, you
-can create a site shell script called `config.site' that gives default
-values for variables like `CC', `cache_file', and `prefix'.
+   If you want to set default values for `configure' scripts to share,
+you can create a site shell script called `config.site' that gives
+default values for variables like `CC', `cache_file', and `prefix'.
 `configure' looks for `PREFIX/share/config.site' if it exists, then
 `PREFIX/etc/config.site' if it exists.  Or, you can set the
 `CONFIG_SITE' environment variable to the location of the site script.
@@ -179,7 +292,7 @@ A warning: not all `configure' scripts look for a site script.
 Defining Variables
 ==================
 
-Variables not defined in a site shell script can be set in the
+   Variables not defined in a site shell script can be set in the
 environment passed to `configure'.  However, some packages may run
 configure again during the build, and the customized values of these
 variables may be lost.  In order to avoid this problem, you should set
@@ -198,11 +311,19 @@ an Autoconf bug.  Until the bug is fixed you can use this workaround:
 `configure' Invocation
 ======================
 
-`configure' recognizes the following options to control how it operates.
+   `configure' recognizes the following options to control how it
+operates.
 
 `--help'
 `-h'
-     Print a summary of the options to `configure', and exit.
+     Print a summary of all of the options to `configure', and exit.
+
+`--help=short'
+`--help=recursive'
+     Print a summary of the options unique to this package's
+     `configure', and exit.  The `short' variant lists options used
+     only in the top level, while the `recursive' variant lists options
+     also present in any nested packages.
 
 `--version'
 `-V'
@@ -229,6 +350,16 @@ an Autoconf bug.  Until the bug is fixed you can use this workaround:
      Look for the package's source code in directory DIR.  Usually
      `configure' can determine that directory automatically.
 
+`--prefix=DIR'
+     Use DIR as the installation prefix.  *note Installation Names::
+     for more details, including other options available for fine-tuning
+     the installation locations.
+
+`--no-create'
+`-n'
+     Run the configure checks, but stop before creating any output
+     files.
+
 `configure' also accepts some other, not widely useful, options.  Run
 `configure --help' for more details.
 
diff --git a/eglib/Makefile.in b/eglib/Makefile.in
index 414ca22..4fb433c 100644
--- a/eglib/Makefile.in
+++ b/eglib/Makefile.in
@@ -35,11 +35,13 @@ build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
 subdir = .
-DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
+DIST_COMMON = README $(am__configure_deps) $(srcdir)/../config.guess \
+	$(srcdir)/../config.sub $(srcdir)/../install-sh \
+	$(srcdir)/../ltmain.sh $(srcdir)/../missing \
+	$(srcdir)/../mkinstalldirs $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in $(srcdir)/config.h.in \
 	$(top_srcdir)/configure AUTHORS COPYING ChangeLog INSTALL NEWS \
-	TODO config.guess config.sub depcomp install-sh ltmain.sh \
-	missing
+	TODO
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
 	$(top_srcdir)/configure.ac
@@ -47,7 +49,7 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
  configure.lineno config.status.lineno
-mkinstalldirs = $(install_sh) -d
+mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs
 CONFIG_HEADER = config.h
 CONFIG_CLEAN_FILES =
 CONFIG_CLEAN_VPATH_FILES =
diff --git a/eglib/config.guess b/eglib/config.guess
deleted file mode 100755
index 396482d..0000000
--- a/eglib/config.guess
+++ /dev/null
@@ -1,1500 +0,0 @@
-#! /bin/sh
-# Attempt to guess a canonical system name.
-#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-#   2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
-#   Inc.
-
-timestamp='2006-07-02'
-
-# This file is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
-# 02110-1301, USA.
-#
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-
-# Originally written by Per Bothner <per at bothner.com>.
-# Please send patches to <config-patches at gnu.org>.  Submit a context
-# diff and a properly formatted ChangeLog entry.
-#
-# This script attempts to guess a canonical system name similar to
-# config.sub.  If it succeeds, it prints the system name on stdout, and
-# exits with 0.  Otherwise, it exits with 1.
-#
-# The plan is that this can be called by configure scripts if you
-# don't specify an explicit build system type.
-
-me=`echo "$0" | sed -e 's,.*/,,'`
-
-usage="\
-Usage: $0 [OPTION]
-
-Output the configuration name of the system \`$me' is run on.
-
-Operation modes:
-  -h, --help         print this help, then exit
-  -t, --time-stamp   print date of last modification, then exit
-  -v, --version      print version number, then exit
-
-Report bugs and patches to <config-patches at gnu.org>."
-
-version="\
-GNU config.guess ($timestamp)
-
-Originally written by Per Bothner.
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
-Free Software Foundation, Inc.
-
-This is free software; see the source for copying conditions.  There is NO
-warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
-
-help="
-Try \`$me --help' for more information."
-
-# Parse command line
-while test $# -gt 0 ; do
-  case $1 in
-    --time-stamp | --time* | -t )
-       echo "$timestamp" ; exit ;;
-    --version | -v )
-       echo "$version" ; exit ;;
-    --help | --h* | -h )
-       echo "$usage"; exit ;;
-    -- )     # Stop option processing
-       shift; break ;;
-    - )	# Use stdin as input.
-       break ;;
-    -* )
-       echo "$me: invalid option $1$help" >&2
-       exit 1 ;;
-    * )
-       break ;;
-  esac
-done
-
-if test $# != 0; then
-  echo "$me: too many arguments$help" >&2
-  exit 1
-fi
-
-trap 'exit 1' 1 2 15
-
-# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
-# compiler to aid in system detection is discouraged as it requires
-# temporary files to be created and, as you can see below, it is a
-# headache to deal with in a portable fashion.
-
-# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
-# use `HOST_CC' if defined, but it is deprecated.
-
-# Portable tmp directory creation inspired by the Autoconf team.
-
-set_cc_for_build='
-trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
-trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
-: ${TMPDIR=/tmp} ;
- { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
- { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
- { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
- { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
-dummy=$tmp/dummy ;
-tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
-case $CC_FOR_BUILD,$HOST_CC,$CC in
- ,,)    echo "int x;" > $dummy.c ;
-	for c in cc gcc c89 c99 ; do
-	  if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
-	     CC_FOR_BUILD="$c"; break ;
-	  fi ;
-	done ;
-	if test x"$CC_FOR_BUILD" = x ; then
-	  CC_FOR_BUILD=no_compiler_found ;
-	fi
-	;;
- ,,*)   CC_FOR_BUILD=$CC ;;
- ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
-esac ; set_cc_for_build= ;'
-
-# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
-# (ghazi at noc.rutgers.edu 1994-08-24)
-if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
-	PATH=$PATH:/.attbin ; export PATH
-fi
-
-UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
-UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
-UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
-UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
-
-# Note: order is significant - the case branches are not exclusive.
-
-case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
-    *:NetBSD:*:*)
-	# NetBSD (nbsd) targets should (where applicable) match one or
-	# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
-	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
-	# switched to ELF, *-*-netbsd* would select the old
-	# object file format.  This provides both forward
-	# compatibility and a consistent mechanism for selecting the
-	# object file format.
-	#
-	# Note: NetBSD doesn't particularly care about the vendor
-	# portion of the name.  We always set it to "unknown".
-	sysctl="sysctl -n hw.machine_arch"
-	UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
-	    /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
-	case "${UNAME_MACHINE_ARCH}" in
-	    armeb) machine=armeb-unknown ;;
-	    arm*) machine=arm-unknown ;;
-	    sh3el) machine=shl-unknown ;;
-	    sh3eb) machine=sh-unknown ;;
-	    *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
-	esac
-	# The Operating System including object format, if it has switched
-	# to ELF recently, or will in the future.
-	case "${UNAME_MACHINE_ARCH}" in
-	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
-		eval $set_cc_for_build
-		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
-			| grep __ELF__ >/dev/null
-		then
-		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
-		    # Return netbsd for either.  FIX?
-		    os=netbsd
-		else
-		    os=netbsdelf
-		fi
-		;;
-	    *)
-	        os=netbsd
-		;;
-	esac
-	# The OS release
-	# Debian GNU/NetBSD machines have a different userland, and
-	# thus, need a distinct triplet. However, they do not need
-	# kernel version information, so it can be replaced with a
-	# suitable tag, in the style of linux-gnu.
-	case "${UNAME_VERSION}" in
-	    Debian*)
-		release='-gnu'
-		;;
-	    *)
-		release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
-		;;
-	esac
-	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
-	# contains redundant information, the shorter form:
-	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
-	echo "${machine}-${os}${release}"
-	exit ;;
-    *:OpenBSD:*:*)
-	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
-	echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
-	exit ;;
-    *:ekkoBSD:*:*)
-	echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
-	exit ;;
-    *:SolidBSD:*:*)
-	echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
-	exit ;;
-    macppc:MirBSD:*:*)
-	echo powerpc-unknown-mirbsd${UNAME_RELEASE}
-	exit ;;
-    *:MirBSD:*:*)
-	echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
-	exit ;;
-    alpha:OSF1:*:*)
-	case $UNAME_RELEASE in
-	*4.0)
-		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
-		;;
-	*5.*)
-	        UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
-		;;
-	esac
-	# According to Compaq, /usr/sbin/psrinfo has been available on
-	# OSF/1 and Tru64 systems produced since 1995.  I hope that
-	# covers most systems running today.  This code pipes the CPU
-	# types through head -n 1, so we only detect the type of CPU 0.
-	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
-	case "$ALPHA_CPU_TYPE" in
-	    "EV4 (21064)")
-		UNAME_MACHINE="alpha" ;;
-	    "EV4.5 (21064)")
-		UNAME_MACHINE="alpha" ;;
-	    "LCA4 (21066/21068)")
-		UNAME_MACHINE="alpha" ;;
-	    "EV5 (21164)")
-		UNAME_MACHINE="alphaev5" ;;
-	    "EV5.6 (21164A)")
-		UNAME_MACHINE="alphaev56" ;;
-	    "EV5.6 (21164PC)")
-		UNAME_MACHINE="alphapca56" ;;
-	    "EV5.7 (21164PC)")
-		UNAME_MACHINE="alphapca57" ;;
-	    "EV6 (21264)")
-		UNAME_MACHINE="alphaev6" ;;
-	    "EV6.7 (21264A)")
-		UNAME_MACHINE="alphaev67" ;;
-	    "EV6.8CB (21264C)")
-		UNAME_MACHINE="alphaev68" ;;
-	    "EV6.8AL (21264B)")
-		UNAME_MACHINE="alphaev68" ;;
-	    "EV6.8CX (21264D)")
-		UNAME_MACHINE="alphaev68" ;;
-	    "EV6.9A (21264/EV69A)")
-		UNAME_MACHINE="alphaev69" ;;
-	    "EV7 (21364)")
-		UNAME_MACHINE="alphaev7" ;;
-	    "EV7.9 (21364A)")
-		UNAME_MACHINE="alphaev79" ;;
-	esac
-	# A Pn.n version is a patched version.
-	# A Vn.n version is a released version.
-	# A Tn.n version is a released field test version.
-	# A Xn.n version is an unreleased experimental baselevel.
-	# 1.2 uses "1.2" for uname -r.
-	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
-	exit ;;
-    Alpha\ *:Windows_NT*:*)
-	# How do we know it's Interix rather than the generic POSIX subsystem?
-	# Should we change UNAME_MACHINE based on the output of uname instead
-	# of the specific Alpha model?
-	echo alpha-pc-interix
-	exit ;;
-    21064:Windows_NT:50:3)
-	echo alpha-dec-winnt3.5
-	exit ;;
-    Amiga*:UNIX_System_V:4.0:*)
-	echo m68k-unknown-sysv4
-	exit ;;
-    *:[Aa]miga[Oo][Ss]:*:*)
-	echo ${UNAME_MACHINE}-unknown-amigaos
-	exit ;;
-    *:[Mm]orph[Oo][Ss]:*:*)
-	echo ${UNAME_MACHINE}-unknown-morphos
-	exit ;;
-    *:OS/390:*:*)
-	echo i370-ibm-openedition
-	exit ;;
-    *:z/VM:*:*)
-	echo s390-ibm-zvmoe
-	exit ;;
-    *:OS400:*:*)
-        echo powerpc-ibm-os400
-	exit ;;
-    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
-	echo arm-acorn-riscix${UNAME_RELEASE}
-	exit ;;
-    arm:riscos:*:*|arm:RISCOS:*:*)
-	echo arm-unknown-riscos
-	exit ;;
-    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
-	echo hppa1.1-hitachi-hiuxmpp
-	exit ;;
-    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
-	# akee at wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
-	if test "`(/bin/universe) 2>/dev/null`" = att ; then
-		echo pyramid-pyramid-sysv3
-	else
-		echo pyramid-pyramid-bsd
-	fi
-	exit ;;
-    NILE*:*:*:dcosx)
-	echo pyramid-pyramid-svr4
-	exit ;;
-    DRS?6000:unix:4.0:6*)
-	echo sparc-icl-nx6
-	exit ;;
-    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
-	case `/usr/bin/uname -p` in
-	    sparc) echo sparc-icl-nx7; exit ;;
-	esac ;;
-    sun4H:SunOS:5.*:*)
-	echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
-	exit ;;
-    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
-	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
-	exit ;;
-    i86pc:SunOS:5.*:*)
-	echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
-	exit ;;
-    sun4*:SunOS:6*:*)
-	# According to config.sub, this is the proper way to canonicalize
-	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
-	# it's likely to be more like Solaris than SunOS4.
-	echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
-	exit ;;
-    sun4*:SunOS:*:*)
-	case "`/usr/bin/arch -k`" in
-	    Series*|S4*)
-		UNAME_RELEASE=`uname -v`
-		;;
-	esac
-	# Japanese Language versions have a version number like `4.1.3-JL'.
-	echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
-	exit ;;
-    sun3*:SunOS:*:*)
-	echo m68k-sun-sunos${UNAME_RELEASE}
-	exit ;;
-    sun*:*:4.2BSD:*)
-	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
-	test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
-	case "`/bin/arch`" in
-	    sun3)
-		echo m68k-sun-sunos${UNAME_RELEASE}
-		;;
-	    sun4)
-		echo sparc-sun-sunos${UNAME_RELEASE}
-		;;
-	esac
-	exit ;;
-    aushp:SunOS:*:*)
-	echo sparc-auspex-sunos${UNAME_RELEASE}
-	exit ;;
-    # The situation for MiNT is a little confusing.  The machine name
-    # can be virtually everything (everything which is not
-    # "atarist" or "atariste" at least should have a processor
-    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
-    # to the lowercase version "mint" (or "freemint").  Finally
-    # the system name "TOS" denotes a system which is actually not
-    # MiNT.  But MiNT is downward compatible to TOS, so this should
-    # be no problem.
-    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
-        echo m68k-atari-mint${UNAME_RELEASE}
-	exit ;;
-    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
-	echo m68k-atari-mint${UNAME_RELEASE}
-        exit ;;
-    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
-        echo m68k-atari-mint${UNAME_RELEASE}
-	exit ;;
-    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
-        echo m68k-milan-mint${UNAME_RELEASE}
-        exit ;;
-    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
-        echo m68k-hades-mint${UNAME_RELEASE}
-        exit ;;
-    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
-        echo m68k-unknown-mint${UNAME_RELEASE}
-        exit ;;
-    m68k:machten:*:*)
-	echo m68k-apple-machten${UNAME_RELEASE}
-	exit ;;
-    powerpc:machten:*:*)
-	echo powerpc-apple-machten${UNAME_RELEASE}
-	exit ;;
-    RISC*:Mach:*:*)
-	echo mips-dec-mach_bsd4.3
-	exit ;;
-    RISC*:ULTRIX:*:*)
-	echo mips-dec-ultrix${UNAME_RELEASE}
-	exit ;;
-    VAX*:ULTRIX*:*:*)
-	echo vax-dec-ultrix${UNAME_RELEASE}
-	exit ;;
-    2020:CLIX:*:* | 2430:CLIX:*:*)
-	echo clipper-intergraph-clix${UNAME_RELEASE}
-	exit ;;
-    mips:*:*:UMIPS | mips:*:*:RISCos)
-	eval $set_cc_for_build
-	sed 's/^	//' << EOF >$dummy.c
-#ifdef __cplusplus
-#include <stdio.h>  /* for printf() prototype */
-	int main (int argc, char *argv[]) {
-#else
-	int main (argc, argv) int argc; char *argv[]; {
-#endif
-	#if defined (host_mips) && defined (MIPSEB)
-	#if defined (SYSTYPE_SYSV)
-	  printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
-	#endif
-	#if defined (SYSTYPE_SVR4)
-	  printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
-	#endif
-	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
-	  printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
-	#endif
-	#endif
-	  exit (-1);
-	}
-EOF
-	$CC_FOR_BUILD -o $dummy $dummy.c &&
-	  dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
-	  SYSTEM_NAME=`$dummy $dummyarg` &&
-	    { echo "$SYSTEM_NAME"; exit; }
-	echo mips-mips-riscos${UNAME_RELEASE}
-	exit ;;
-    Motorola:PowerMAX_OS:*:*)
-	echo powerpc-motorola-powermax
-	exit ;;
-    Motorola:*:4.3:PL8-*)
-	echo powerpc-harris-powermax
-	exit ;;
-    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
-	echo powerpc-harris-powermax
-	exit ;;
-    Night_Hawk:Power_UNIX:*:*)
-	echo powerpc-harris-powerunix
-	exit ;;
-    m88k:CX/UX:7*:*)
-	echo m88k-harris-cxux7
-	exit ;;
-    m88k:*:4*:R4*)
-	echo m88k-motorola-sysv4
-	exit ;;
-    m88k:*:3*:R3*)
-	echo m88k-motorola-sysv3
-	exit ;;
-    AViiON:dgux:*:*)
-        # DG/UX returns AViiON for all architectures
-        UNAME_PROCESSOR=`/usr/bin/uname -p`
-	if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
-	then
-	    if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
-	       [ ${TARGET_BINARY_INTERFACE}x = x ]
-	    then
-		echo m88k-dg-dgux${UNAME_RELEASE}
-	    else
-		echo m88k-dg-dguxbcs${UNAME_RELEASE}
-	    fi
-	else
-	    echo i586-dg-dgux${UNAME_RELEASE}
-	fi
- 	exit ;;
-    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
-	echo m88k-dolphin-sysv3
-	exit ;;
-    M88*:*:R3*:*)
-	# Delta 88k system running SVR3
-	echo m88k-motorola-sysv3
-	exit ;;
-    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
-	echo m88k-tektronix-sysv3
-	exit ;;
-    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
-	echo m68k-tektronix-bsd
-	exit ;;
-    *:IRIX*:*:*)
-	echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
-	exit ;;
-    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
-	echo romp-ibm-aix     # uname -m gives an 8 hex-code CPU id
-	exit ;;               # Note that: echo "'`uname -s`'" gives 'AIX '
-    i*86:AIX:*:*)
-	echo i386-ibm-aix
-	exit ;;
-    ia64:AIX:*:*)
-	if [ -x /usr/bin/oslevel ] ; then
-		IBM_REV=`/usr/bin/oslevel`
-	else
-		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
-	fi
-	echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
-	exit ;;
-    *:AIX:2:3)
-	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
-		eval $set_cc_for_build
-		sed 's/^		//' << EOF >$dummy.c
-		#include <sys/systemcfg.h>
-
-		main()
-			{
-			if (!__power_pc())
-				exit(1);
-			puts("powerpc-ibm-aix3.2.5");
-			exit(0);
-			}
-EOF
-		if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
-		then
-			echo "$SYSTEM_NAME"
-		else
-			echo rs6000-ibm-aix3.2.5
-		fi
-	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
-		echo rs6000-ibm-aix3.2.4
-	else
-		echo rs6000-ibm-aix3.2
-	fi
-	exit ;;
-    *:AIX:*:[45])
-	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
-	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
-		IBM_ARCH=rs6000
-	else
-		IBM_ARCH=powerpc
-	fi
-	if [ -x /usr/bin/oslevel ] ; then
-		IBM_REV=`/usr/bin/oslevel`
-	else
-		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
-	fi
-	echo ${IBM_ARCH}-ibm-aix${IBM_REV}
-	exit ;;
-    *:AIX:*:*)
-	echo rs6000-ibm-aix
-	exit ;;
-    ibmrt:4.4BSD:*|romp-ibm:BSD:*)
-	echo romp-ibm-bsd4.4
-	exit ;;
-    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
-	echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
-	exit ;;                             # report: romp-ibm BSD 4.3
-    *:BOSX:*:*)
-	echo rs6000-bull-bosx
-	exit ;;
-    DPX/2?00:B.O.S.:*:*)
-	echo m68k-bull-sysv3
-	exit ;;
-    9000/[34]??:4.3bsd:1.*:*)
-	echo m68k-hp-bsd
-	exit ;;
-    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
-	echo m68k-hp-bsd4.4
-	exit ;;
-    9000/[34678]??:HP-UX:*:*)
-	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
-	case "${UNAME_MACHINE}" in
-	    9000/31? )            HP_ARCH=m68000 ;;
-	    9000/[34]?? )         HP_ARCH=m68k ;;
-	    9000/[678][0-9][0-9])
-		if [ -x /usr/bin/getconf ]; then
-		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
-                    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
-                    case "${sc_cpu_version}" in
-                      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
-                      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
-                      532)                      # CPU_PA_RISC2_0
-                        case "${sc_kernel_bits}" in
-                          32) HP_ARCH="hppa2.0n" ;;
-                          64) HP_ARCH="hppa2.0w" ;;
-			  '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
-                        esac ;;
-                    esac
-		fi
-		if [ "${HP_ARCH}" = "" ]; then
-		    eval $set_cc_for_build
-		    sed 's/^              //' << EOF >$dummy.c
-
-              #define _HPUX_SOURCE
-              #include <stdlib.h>
-              #include <unistd.h>
-
-              int main ()
-              {
-              #if defined(_SC_KERNEL_BITS)
-                  long bits = sysconf(_SC_KERNEL_BITS);
-              #endif
-                  long cpu  = sysconf (_SC_CPU_VERSION);
-
-                  switch (cpu)
-              	{
-              	case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
-              	case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
-              	case CPU_PA_RISC2_0:
-              #if defined(_SC_KERNEL_BITS)
-              	    switch (bits)
-              		{
-              		case 64: puts ("hppa2.0w"); break;
-              		case 32: puts ("hppa2.0n"); break;
-              		default: puts ("hppa2.0"); break;
-              		} break;
-              #else  /* !defined(_SC_KERNEL_BITS) */
-              	    puts ("hppa2.0"); break;
-              #endif
-              	default: puts ("hppa1.0"); break;
-              	}
-                  exit (0);
-              }
-EOF
-		    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
-		    test -z "$HP_ARCH" && HP_ARCH=hppa
-		fi ;;
-	esac
-	if [ ${HP_ARCH} = "hppa2.0w" ]
-	then
-	    eval $set_cc_for_build
-
-	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
-	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
-	    # generating 64-bit code.  GNU and HP use different nomenclature:
-	    #
-	    # $ CC_FOR_BUILD=cc ./config.guess
-	    # => hppa2.0w-hp-hpux11.23
-	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
-	    # => hppa64-hp-hpux11.23
-
-	    if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
-		grep __LP64__ >/dev/null
-	    then
-		HP_ARCH="hppa2.0w"
-	    else
-		HP_ARCH="hppa64"
-	    fi
-	fi
-	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
-	exit ;;
-    ia64:HP-UX:*:*)
-	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
-	echo ia64-hp-hpux${HPUX_REV}
-	exit ;;
-    3050*:HI-UX:*:*)
-	eval $set_cc_for_build
-	sed 's/^	//' << EOF >$dummy.c
-	#include <unistd.h>
-	int
-	main ()
-	{
-	  long cpu = sysconf (_SC_CPU_VERSION);
-	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
-	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
-	     results, however.  */
-	  if (CPU_IS_PA_RISC (cpu))
-	    {
-	      switch (cpu)
-		{
-		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
-		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
-		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
-		  default: puts ("hppa-hitachi-hiuxwe2"); break;
-		}
-	    }
-	  else if (CPU_IS_HP_MC68K (cpu))
-	    puts ("m68k-hitachi-hiuxwe2");
-	  else puts ("unknown-hitachi-hiuxwe2");
-	  exit (0);
-	}
-EOF
-	$CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
-		{ echo "$SYSTEM_NAME"; exit; }
-	echo unknown-hitachi-hiuxwe2
-	exit ;;
-    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
-	echo hppa1.1-hp-bsd
-	exit ;;
-    9000/8??:4.3bsd:*:*)
-	echo hppa1.0-hp-bsd
-	exit ;;
-    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
-	echo hppa1.0-hp-mpeix
-	exit ;;
-    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
-	echo hppa1.1-hp-osf
-	exit ;;
-    hp8??:OSF1:*:*)
-	echo hppa1.0-hp-osf
-	exit ;;
-    i*86:OSF1:*:*)
-	if [ -x /usr/sbin/sysversion ] ; then
-	    echo ${UNAME_MACHINE}-unknown-osf1mk
-	else
-	    echo ${UNAME_MACHINE}-unknown-osf1
-	fi
-	exit ;;
-    parisc*:Lites*:*:*)
-	echo hppa1.1-hp-lites
-	exit ;;
-    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
-	echo c1-convex-bsd
-        exit ;;
-    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
-	if getsysinfo -f scalar_acc
-	then echo c32-convex-bsd
-	else echo c2-convex-bsd
-	fi
-        exit ;;
-    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
-	echo c34-convex-bsd
-        exit ;;
-    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
-	echo c38-convex-bsd
-        exit ;;
-    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
-	echo c4-convex-bsd
-        exit ;;
-    CRAY*Y-MP:*:*:*)
-	echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
-	exit ;;
-    CRAY*[A-Z]90:*:*:*)
-	echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
-	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
-	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
-	      -e 's/\.[^.]*$/.X/'
-	exit ;;
-    CRAY*TS:*:*:*)
-	echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
-	exit ;;
-    CRAY*T3E:*:*:*)
-	echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
-	exit ;;
-    CRAY*SV1:*:*:*)
-	echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
-	exit ;;
-    *:UNICOS/mp:*:*)
-	echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
-	exit ;;
-    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
-	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
-        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
-        FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
-        echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
-        exit ;;
-    5000:UNIX_System_V:4.*:*)
-        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
-        FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
-        echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
-	exit ;;
-    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
-	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
-	exit ;;
-    sparc*:BSD/OS:*:*)
-	echo sparc-unknown-bsdi${UNAME_RELEASE}
-	exit ;;
-    *:BSD/OS:*:*)
-	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
-	exit ;;
-    *:FreeBSD:*:*)
-	case ${UNAME_MACHINE} in
-	    pc98)
-		echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
-	    amd64)
-		echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
-	    *)
-		echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
-	esac
-	exit ;;
-    i*:CYGWIN*:*)
-	echo ${UNAME_MACHINE}-pc-cygwin
-	exit ;;
-    i*:MINGW*:*)
-	echo ${UNAME_MACHINE}-pc-mingw32
-	exit ;;
-    i*:windows32*:*)
-    	# uname -m includes "-pc" on this system.
-    	echo ${UNAME_MACHINE}-mingw32
-	exit ;;
-    i*:PW*:*)
-	echo ${UNAME_MACHINE}-pc-pw32
-	exit ;;
-    x86:Interix*:[3456]*)
-	echo i586-pc-interix${UNAME_RELEASE}
-	exit ;;
-    EM64T:Interix*:[3456]*)
-	echo x86_64-unknown-interix${UNAME_RELEASE}
-	exit ;;
-    [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
-	echo i${UNAME_MACHINE}-pc-mks
-	exit ;;
-    i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
-	# How do we know it's Interix rather than the generic POSIX subsystem?
-	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
-	# UNAME_MACHINE based on the output of uname instead of i386?
-	echo i586-pc-interix
-	exit ;;
-    i*:UWIN*:*)
-	echo ${UNAME_MACHINE}-pc-uwin
-	exit ;;
-    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
-	echo x86_64-unknown-cygwin
-	exit ;;
-    p*:CYGWIN*:*)
-	echo powerpcle-unknown-cygwin
-	exit ;;
-    prep*:SunOS:5.*:*)
-	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
-	exit ;;
-    *:GNU:*:*)
-	# the GNU system
-	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
-	exit ;;
-    *:GNU/*:*:*)
-	# other systems with GNU libc and userland
-	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
-	exit ;;
-    i*86:Minix:*:*)
-	echo ${UNAME_MACHINE}-pc-minix
-	exit ;;
-    arm*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
-	exit ;;
-    avr32*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
-	exit ;;
-    cris:Linux:*:*)
-	echo cris-axis-linux-gnu
-	exit ;;
-    crisv32:Linux:*:*)
-	echo crisv32-axis-linux-gnu
-	exit ;;
-    frv:Linux:*:*)
-    	echo frv-unknown-linux-gnu
-	exit ;;
-    ia64:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
-	exit ;;
-    m32r*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
-	exit ;;
-    m68*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
-	exit ;;
-    mips:Linux:*:*)
-	eval $set_cc_for_build
-	sed 's/^	//' << EOF >$dummy.c
-	#undef CPU
-	#undef mips
-	#undef mipsel
-	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
-	CPU=mipsel
-	#else
-	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
-	CPU=mips
-	#else
-	CPU=
-	#endif
-	#endif
-EOF
-	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
-	    /^CPU/{
-		s: ::g
-		p
-	    }'`"
-	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
-	;;
-    mips64:Linux:*:*)
-	eval $set_cc_for_build
-	sed 's/^	//' << EOF >$dummy.c
-	#undef CPU
-	#undef mips64
-	#undef mips64el
-	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
-	CPU=mips64el
-	#else
-	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
-	CPU=mips64
-	#else
-	CPU=
-	#endif
-	#endif
-EOF
-	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
-	    /^CPU/{
-		s: ::g
-		p
-	    }'`"
-	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
-	;;
-    or32:Linux:*:*)
-	echo or32-unknown-linux-gnu
-	exit ;;
-    ppc:Linux:*:*)
-	echo powerpc-unknown-linux-gnu
-	exit ;;
-    ppc64:Linux:*:*)
-	echo powerpc64-unknown-linux-gnu
-	exit ;;
-    alpha:Linux:*:*)
-	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
-	  EV5)   UNAME_MACHINE=alphaev5 ;;
-	  EV56)  UNAME_MACHINE=alphaev56 ;;
-	  PCA56) UNAME_MACHINE=alphapca56 ;;
-	  PCA57) UNAME_MACHINE=alphapca56 ;;
-	  EV6)   UNAME_MACHINE=alphaev6 ;;
-	  EV67)  UNAME_MACHINE=alphaev67 ;;
-	  EV68*) UNAME_MACHINE=alphaev68 ;;
-        esac
-	objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
-	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
-	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
-	exit ;;
-    parisc:Linux:*:* | hppa:Linux:*:*)
-	# Look for CPU level
-	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
-	  PA7*) echo hppa1.1-unknown-linux-gnu ;;
-	  PA8*) echo hppa2.0-unknown-linux-gnu ;;
-	  *)    echo hppa-unknown-linux-gnu ;;
-	esac
-	exit ;;
-    parisc64:Linux:*:* | hppa64:Linux:*:*)
-	echo hppa64-unknown-linux-gnu
-	exit ;;
-    s390:Linux:*:* | s390x:Linux:*:*)
-	echo ${UNAME_MACHINE}-ibm-linux
-	exit ;;
-    sh64*:Linux:*:*)
-    	echo ${UNAME_MACHINE}-unknown-linux-gnu
-	exit ;;
-    sh*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
-	exit ;;
-    sparc:Linux:*:* | sparc64:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
-	exit ;;
-    vax:Linux:*:*)
-	echo ${UNAME_MACHINE}-dec-linux-gnu
-	exit ;;
-    x86_64:Linux:*:*)
-	echo x86_64-unknown-linux-gnu
-	exit ;;
-    i*86:Linux:*:*)
-	# The BFD linker knows what the default object file format is, so
-	# first see if it will tell us. cd to the root directory to prevent
-	# problems with other programs or directories called `ld' in the path.
-	# Set LC_ALL=C to ensure ld outputs messages in English.
-	ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
-			 | sed -ne '/supported targets:/!d
-				    s/[ 	][ 	]*/ /g
-				    s/.*supported targets: *//
-				    s/ .*//
-				    p'`
-        case "$ld_supported_targets" in
-	  elf32-i386)
-		TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
-		;;
-	  a.out-i386-linux)
-		echo "${UNAME_MACHINE}-pc-linux-gnuaout"
-		exit ;;
-	  coff-i386)
-		echo "${UNAME_MACHINE}-pc-linux-gnucoff"
-		exit ;;
-	  "")
-		# Either a pre-BFD a.out linker (linux-gnuoldld) or
-		# one that does not give us useful --help.
-		echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
-		exit ;;
-	esac
-	# Determine whether the default compiler is a.out or elf
-	eval $set_cc_for_build
-	sed 's/^	//' << EOF >$dummy.c
-	#include <features.h>
-	#ifdef __ELF__
-	# ifdef __GLIBC__
-	#  if __GLIBC__ >= 2
-	LIBC=gnu
-	#  else
-	LIBC=gnulibc1
-	#  endif
-	# else
-	LIBC=gnulibc1
-	# endif
-	#else
-	#if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
-	LIBC=gnu
-	#else
-	LIBC=gnuaout
-	#endif
-	#endif
-	#ifdef __dietlibc__
-	LIBC=dietlibc
-	#endif
-EOF
-	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
-	    /^LIBC/{
-		s: ::g
-		p
-	    }'`"
-	test x"${LIBC}" != x && {
-		echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
-		exit
-	}
-	test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
-	;;
-    i*86:DYNIX/ptx:4*:*)
-	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
-	# earlier versions are messed up and put the nodename in both
-	# sysname and nodename.
-	echo i386-sequent-sysv4
-	exit ;;
-    i*86:UNIX_SV:4.2MP:2.*)
-        # Unixware is an offshoot of SVR4, but it has its own version
-        # number series starting with 2...
-        # I am not positive that other SVR4 systems won't match this,
-	# I just have to hope.  -- rms.
-        # Use sysv4.2uw... so that sysv4* matches it.
-	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
-	exit ;;
-    i*86:OS/2:*:*)
-	# If we were able to find `uname', then EMX Unix compatibility
-	# is probably installed.
-	echo ${UNAME_MACHINE}-pc-os2-emx
-	exit ;;
-    i*86:XTS-300:*:STOP)
-	echo ${UNAME_MACHINE}-unknown-stop
-	exit ;;
-    i*86:atheos:*:*)
-	echo ${UNAME_MACHINE}-unknown-atheos
-	exit ;;
-    i*86:syllable:*:*)
-	echo ${UNAME_MACHINE}-pc-syllable
-	exit ;;
-    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
-	echo i386-unknown-lynxos${UNAME_RELEASE}
-	exit ;;
-    i*86:*DOS:*:*)
-	echo ${UNAME_MACHINE}-pc-msdosdjgpp
-	exit ;;
-    i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
-	UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
-	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
-		echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
-	else
-		echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
-	fi
-	exit ;;
-    i*86:*:5:[678]*)
-    	# UnixWare 7.x, OpenUNIX and OpenServer 6.
-	case `/bin/uname -X | grep "^Machine"` in
-	    *486*)	     UNAME_MACHINE=i486 ;;
-	    *Pentium)	     UNAME_MACHINE=i586 ;;
-	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
-	esac
-	echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
-	exit ;;
-    i*86:*:3.2:*)
-	if test -f /usr/options/cb.name; then
-		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
-		echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
-	elif /bin/uname -X 2>/dev/null >/dev/null ; then
-		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
-		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
-		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
-			&& UNAME_MACHINE=i586
-		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
-			&& UNAME_MACHINE=i686
-		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
-			&& UNAME_MACHINE=i686
-		echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
-	else
-		echo ${UNAME_MACHINE}-pc-sysv32
-	fi
-	exit ;;
-    pc:*:*:*)
-	# Left here for compatibility:
-        # uname -m prints for DJGPP always 'pc', but it prints nothing about
-        # the processor, so we play safe by assuming i386.
-	echo i386-pc-msdosdjgpp
-        exit ;;
-    Intel:Mach:3*:*)
-	echo i386-pc-mach3
-	exit ;;
-    paragon:*:*:*)
-	echo i860-intel-osf1
-	exit ;;
-    i860:*:4.*:*) # i860-SVR4
-	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
-	  echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
-	else # Add other i860-SVR4 vendors below as they are discovered.
-	  echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
-	fi
-	exit ;;
-    mini*:CTIX:SYS*5:*)
-	# "miniframe"
-	echo m68010-convergent-sysv
-	exit ;;
-    mc68k:UNIX:SYSTEM5:3.51m)
-	echo m68k-convergent-sysv
-	exit ;;
-    M680?0:D-NIX:5.3:*)
-	echo m68k-diab-dnix
-	exit ;;
-    M68*:*:R3V[5678]*:*)
-	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
-    3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
-	OS_REL=''
-	test -r /etc/.relid \
-	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
-	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
-	  && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
-	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
-	  && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
-    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
-        /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
-          && { echo i486-ncr-sysv4; exit; } ;;
-    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
-	echo m68k-unknown-lynxos${UNAME_RELEASE}
-	exit ;;
-    mc68030:UNIX_System_V:4.*:*)
-	echo m68k-atari-sysv4
-	exit ;;
-    TSUNAMI:LynxOS:2.*:*)
-	echo sparc-unknown-lynxos${UNAME_RELEASE}
-	exit ;;
-    rs6000:LynxOS:2.*:*)
-	echo rs6000-unknown-lynxos${UNAME_RELEASE}
-	exit ;;
-    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
-	echo powerpc-unknown-lynxos${UNAME_RELEASE}
-	exit ;;
-    SM[BE]S:UNIX_SV:*:*)
-	echo mips-dde-sysv${UNAME_RELEASE}
-	exit ;;
-    RM*:ReliantUNIX-*:*:*)
-	echo mips-sni-sysv4
-	exit ;;
-    RM*:SINIX-*:*:*)
-	echo mips-sni-sysv4
-	exit ;;
-    *:SINIX-*:*:*)
-	if uname -p 2>/dev/null >/dev/null ; then
-		UNAME_MACHINE=`(uname -p) 2>/dev/null`
-		echo ${UNAME_MACHINE}-sni-sysv4
-	else
-		echo ns32k-sni-sysv
-	fi
-	exit ;;
-    PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
-                      # says <Richard.M.Bartel at ccMail.Census.GOV>
-        echo i586-unisys-sysv4
-        exit ;;
-    *:UNIX_System_V:4*:FTX*)
-	# From Gerald Hewes <hewes at openmarket.com>.
-	# How about differentiating between stratus architectures? -djm
-	echo hppa1.1-stratus-sysv4
-	exit ;;
-    *:*:*:FTX*)
-	# From seanf at swdc.stratus.com.
-	echo i860-stratus-sysv4
-	exit ;;
-    i*86:VOS:*:*)
-	# From Paul.Green at stratus.com.
-	echo ${UNAME_MACHINE}-stratus-vos
-	exit ;;
-    *:VOS:*:*)
-	# From Paul.Green at stratus.com.
-	echo hppa1.1-stratus-vos
-	exit ;;
-    mc68*:A/UX:*:*)
-	echo m68k-apple-aux${UNAME_RELEASE}
-	exit ;;
-    news*:NEWS-OS:6*:*)
-	echo mips-sony-newsos6
-	exit ;;
-    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
-	if [ -d /usr/nec ]; then
-	        echo mips-nec-sysv${UNAME_RELEASE}
-	else
-	        echo mips-unknown-sysv${UNAME_RELEASE}
-	fi
-        exit ;;
-    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
-	echo powerpc-be-beos
-	exit ;;
-    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
-	echo powerpc-apple-beos
-	exit ;;
-    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
-	echo i586-pc-beos
-	exit ;;
-    SX-4:SUPER-UX:*:*)
-	echo sx4-nec-superux${UNAME_RELEASE}
-	exit ;;
-    SX-5:SUPER-UX:*:*)
-	echo sx5-nec-superux${UNAME_RELEASE}
-	exit ;;
-    SX-6:SUPER-UX:*:*)
-	echo sx6-nec-superux${UNAME_RELEASE}
-	exit ;;
-    Power*:Rhapsody:*:*)
-	echo powerpc-apple-rhapsody${UNAME_RELEASE}
-	exit ;;
-    *:Rhapsody:*:*)
-	echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
-	exit ;;
-    *:Darwin:*:*)
-	UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
-	case $UNAME_PROCESSOR in
-	    unknown) UNAME_PROCESSOR=powerpc ;;
-	esac
-	echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
-	exit ;;
-    *:procnto*:*:* | *:QNX:[0123456789]*:*)
-	UNAME_PROCESSOR=`uname -p`
-	if test "$UNAME_PROCESSOR" = "x86"; then
-		UNAME_PROCESSOR=i386
-		UNAME_MACHINE=pc
-	fi
-	echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
-	exit ;;
-    *:QNX:*:4*)
-	echo i386-pc-qnx
-	exit ;;
-    NSE-?:NONSTOP_KERNEL:*:*)
-	echo nse-tandem-nsk${UNAME_RELEASE}
-	exit ;;
-    NSR-?:NONSTOP_KERNEL:*:*)
-	echo nsr-tandem-nsk${UNAME_RELEASE}
-	exit ;;
-    *:NonStop-UX:*:*)
-	echo mips-compaq-nonstopux
-	exit ;;
-    BS2000:POSIX*:*:*)
-	echo bs2000-siemens-sysv
-	exit ;;
-    DS/*:UNIX_System_V:*:*)
-	echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
-	exit ;;
-    *:Plan9:*:*)
-	# "uname -m" is not consistent, so use $cputype instead. 386
-	# is converted to i386 for consistency with other x86
-	# operating systems.
-	if test "$cputype" = "386"; then
-	    UNAME_MACHINE=i386
-	else
-	    UNAME_MACHINE="$cputype"
-	fi
-	echo ${UNAME_MACHINE}-unknown-plan9
-	exit ;;
-    *:TOPS-10:*:*)
-	echo pdp10-unknown-tops10
-	exit ;;
-    *:TENEX:*:*)
-	echo pdp10-unknown-tenex
-	exit ;;
-    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
-	echo pdp10-dec-tops20
-	exit ;;
-    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
-	echo pdp10-xkl-tops20
-	exit ;;
-    *:TOPS-20:*:*)
-	echo pdp10-unknown-tops20
-	exit ;;
-    *:ITS:*:*)
-	echo pdp10-unknown-its
-	exit ;;
-    SEI:*:*:SEIUX)
-        echo mips-sei-seiux${UNAME_RELEASE}
-	exit ;;
-    *:DragonFly:*:*)
-	echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
-	exit ;;
-    *:*VMS:*:*)
-    	UNAME_MACHINE=`(uname -p) 2>/dev/null`
-	case "${UNAME_MACHINE}" in
-	    A*) echo alpha-dec-vms ; exit ;;
-	    I*) echo ia64-dec-vms ; exit ;;
-	    V*) echo vax-dec-vms ; exit ;;
-	esac ;;
-    *:XENIX:*:SysV)
-	echo i386-pc-xenix
-	exit ;;
-    i*86:skyos:*:*)
-	echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
-	exit ;;
-    i*86:rdos:*:*)
-	echo ${UNAME_MACHINE}-pc-rdos
-	exit ;;
-esac
-
-#echo '(No uname command or uname output not recognized.)' 1>&2
-#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
-
-eval $set_cc_for_build
-cat >$dummy.c <<EOF
-#ifdef _SEQUENT_
-# include <sys/types.h>
-# include <sys/utsname.h>
-#endif
-main ()
-{
-#if defined (sony)
-#if defined (MIPSEB)
-  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
-     I don't know....  */
-  printf ("mips-sony-bsd\n"); exit (0);
-#else
-#include <sys/param.h>
-  printf ("m68k-sony-newsos%s\n",
-#ifdef NEWSOS4
-          "4"
-#else
-	  ""
-#endif
-         ); exit (0);
-#endif
-#endif
-
-#if defined (__arm) && defined (__acorn) && defined (__unix)
-  printf ("arm-acorn-riscix\n"); exit (0);
-#endif
-
-#if defined (hp300) && !defined (hpux)
-  printf ("m68k-hp-bsd\n"); exit (0);
-#endif
-
-#if defined (NeXT)
-#if !defined (__ARCHITECTURE__)
-#define __ARCHITECTURE__ "m68k"
-#endif
-  int version;
-  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
-  if (version < 4)
-    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
-  else
-    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
-  exit (0);
-#endif
-
-#if defined (MULTIMAX) || defined (n16)
-#if defined (UMAXV)
-  printf ("ns32k-encore-sysv\n"); exit (0);
-#else
-#if defined (CMU)
-  printf ("ns32k-encore-mach\n"); exit (0);
-#else
-  printf ("ns32k-encore-bsd\n"); exit (0);
-#endif
-#endif
-#endif
-
-#if defined (__386BSD__)
-  printf ("i386-pc-bsd\n"); exit (0);
-#endif
-
-#if defined (sequent)
-#if defined (i386)
-  printf ("i386-sequent-dynix\n"); exit (0);
-#endif
-#if defined (ns32000)
-  printf ("ns32k-sequent-dynix\n"); exit (0);
-#endif
-#endif
-
-#if defined (_SEQUENT_)
-    struct utsname un;
-
-    uname(&un);
-
-    if (strncmp(un.version, "V2", 2) == 0) {
-	printf ("i386-sequent-ptx2\n"); exit (0);
-    }
-    if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
-	printf ("i386-sequent-ptx1\n"); exit (0);
-    }
-    printf ("i386-sequent-ptx\n"); exit (0);
-
-#endif
-
-#if defined (vax)
-# if !defined (ultrix)
-#  include <sys/param.h>
-#  if defined (BSD)
-#   if BSD == 43
-      printf ("vax-dec-bsd4.3\n"); exit (0);
-#   else
-#    if BSD == 199006
-      printf ("vax-dec-bsd4.3reno\n"); exit (0);
-#    else
-      printf ("vax-dec-bsd\n"); exit (0);
-#    endif
-#   endif
-#  else
-    printf ("vax-dec-bsd\n"); exit (0);
-#  endif
-# else
-    printf ("vax-dec-ultrix\n"); exit (0);
-# endif
-#endif
-
-#if defined (alliant) && defined (i860)
-  printf ("i860-alliant-bsd\n"); exit (0);
-#endif
-
-  exit (1);
-}
-EOF
-
-$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
-	{ echo "$SYSTEM_NAME"; exit; }
-
-# Apollos put the system type in the environment.
-
-test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
-
-# Convex versions that predate uname can use getsysinfo(1)
-
-if [ -x /usr/convex/getsysinfo ]
-then
-    case `getsysinfo -f cpu_type` in
-    c1*)
-	echo c1-convex-bsd
-	exit ;;
-    c2*)
-	if getsysinfo -f scalar_acc
-	then echo c32-convex-bsd
-	else echo c2-convex-bsd
-	fi
-	exit ;;
-    c34*)
-	echo c34-convex-bsd
-	exit ;;
-    c38*)
-	echo c38-convex-bsd
-	exit ;;
-    c4*)
-	echo c4-convex-bsd
-	exit ;;
-    esac
-fi
-
-cat >&2 <<EOF
-$0: unable to guess system type
-
-This script, last modified $timestamp, has failed to recognize
-the operating system you are using. It is advised that you
-download the most up to date version of the config scripts from
-
-  http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess
-and
-  http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub
-
-If the version you run ($0) is already up to date, please
-send the following data and any information you think might be
-pertinent to <config-patches at gnu.org> in order to provide the needed
-information to handle your system.
-
-config.guess timestamp = $timestamp
-
-uname -m = `(uname -m) 2>/dev/null || echo unknown`
-uname -r = `(uname -r) 2>/dev/null || echo unknown`
-uname -s = `(uname -s) 2>/dev/null || echo unknown`
-uname -v = `(uname -v) 2>/dev/null || echo unknown`
-
-/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
-/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
-
-hostinfo               = `(hostinfo) 2>/dev/null`
-/bin/universe          = `(/bin/universe) 2>/dev/null`
-/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
-/bin/arch              = `(/bin/arch) 2>/dev/null`
-/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
-/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
-
-UNAME_MACHINE = ${UNAME_MACHINE}
-UNAME_RELEASE = ${UNAME_RELEASE}
-UNAME_SYSTEM  = ${UNAME_SYSTEM}
-UNAME_VERSION = ${UNAME_VERSION}
-EOF
-
-exit 1
-
-# Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "timestamp='"
-# time-stamp-format: "%:y-%02m-%02d"
-# time-stamp-end: "'"
-# End:
diff --git a/eglib/config.sub b/eglib/config.sub
deleted file mode 100755
index fab0aa3..0000000
--- a/eglib/config.sub
+++ /dev/null
@@ -1,1616 +0,0 @@
-#! /bin/sh
-# Configuration validation subroutine script.
-#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-#   2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
-#   Inc.
-
-timestamp='2006-09-20'
-
-# This file is (in principle) common to ALL GNU software.
-# The presence of a machine in this file suggests that SOME GNU software
-# can handle that machine.  It does not imply ALL GNU software can.
-#
-# This file is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
-# 02110-1301, USA.
-#
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-
-# Please send patches to <config-patches at gnu.org>.  Submit a context
-# diff and a properly formatted ChangeLog entry.
-#
-# Configuration subroutine to validate and canonicalize a configuration type.
-# Supply the specified configuration type as an argument.
-# If it is invalid, we print an error message on stderr and exit with code 1.
-# Otherwise, we print the canonical config type on stdout and succeed.
-
-# This file is supposed to be the same for all GNU packages
-# and recognize all the CPU types, system types and aliases
-# that are meaningful with *any* GNU software.
-# Each package is responsible for reporting which valid configurations
-# it does not support.  The user should be able to distinguish
-# a failure to support a valid configuration from a meaningless
-# configuration.
-
-# The goal of this file is to map all the various variations of a given
-# machine specification into a single specification in the form:
-#	CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
-# or in some cases, the newer four-part form:
-#	CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
-# It is wrong to echo any other type of specification.
-
-me=`echo "$0" | sed -e 's,.*/,,'`
-
-usage="\
-Usage: $0 [OPTION] CPU-MFR-OPSYS
-       $0 [OPTION] ALIAS
-
-Canonicalize a configuration name.
-
-Operation modes:
-  -h, --help         print this help, then exit
-  -t, --time-stamp   print date of last modification, then exit
-  -v, --version      print version number, then exit
-
-Report bugs and patches to <config-patches at gnu.org>."
-
-version="\
-GNU config.sub ($timestamp)
-
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
-Free Software Foundation, Inc.
-
-This is free software; see the source for copying conditions.  There is NO
-warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
-
-help="
-Try \`$me --help' for more information."
-
-# Parse command line
-while test $# -gt 0 ; do
-  case $1 in
-    --time-stamp | --time* | -t )
-       echo "$timestamp" ; exit ;;
-    --version | -v )
-       echo "$version" ; exit ;;
-    --help | --h* | -h )
-       echo "$usage"; exit ;;
-    -- )     # Stop option processing
-       shift; break ;;
-    - )	# Use stdin as input.
-       break ;;
-    -* )
-       echo "$me: invalid option $1$help"
-       exit 1 ;;
-
-    *local*)
-       # First pass through any local machine types.
-       echo $1
-       exit ;;
-
-    * )
-       break ;;
-  esac
-done
-
-case $# in
- 0) echo "$me: missing argument$help" >&2
-    exit 1;;
- 1) ;;
- *) echo "$me: too many arguments$help" >&2
-    exit 1;;
-esac
-
-# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
-# Here we must recognize all the valid KERNEL-OS combinations.
-maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
-case $maybe_os in
-  nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
-  uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
-  storm-chaos* | os2-emx* | rtmk-nova*)
-    os=-$maybe_os
-    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
-    ;;
-  *)
-    basic_machine=`echo $1 | sed 's/-[^-]*$//'`
-    if [ $basic_machine != $1 ]
-    then os=`echo $1 | sed 's/.*-/-/'`
-    else os=; fi
-    ;;
-esac
-
-### Let's recognize common machines as not being operating systems so
-### that things like config.sub decstation-3100 work.  We also
-### recognize some manufacturers as not being operating systems, so we
-### can provide default operating systems below.
-case $os in
-	-sun*os*)
-		# Prevent following clause from handling this invalid input.
-		;;
-	-dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
-	-att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
-	-unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
-	-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
-	-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
-	-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
-	-apple | -axis | -knuth | -cray)
-		os=
-		basic_machine=$1
-		;;
-	-sim | -cisco | -oki | -wec | -winbond)
-		os=
-		basic_machine=$1
-		;;
-	-scout)
-		;;
-	-wrs)
-		os=-vxworks
-		basic_machine=$1
-		;;
-	-chorusos*)
-		os=-chorusos
-		basic_machine=$1
-		;;
- 	-chorusrdb)
- 		os=-chorusrdb
-		basic_machine=$1
- 		;;
-	-hiux*)
-		os=-hiuxwe2
-		;;
-	-sco6)
-		os=-sco5v6
-		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
-		;;
-	-sco5)
-		os=-sco3.2v5
-		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
-		;;
-	-sco4)
-		os=-sco3.2v4
-		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
-		;;
-	-sco3.2.[4-9]*)
-		os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
-		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
-		;;
-	-sco3.2v[4-9]*)
-		# Don't forget version if it is 3.2v4 or newer.
-		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
-		;;
-	-sco5v6*)
-		# Don't forget version if it is 3.2v4 or newer.
-		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
-		;;
-	-sco*)
-		os=-sco3.2v2
-		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
-		;;
-	-udk*)
-		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
-		;;
-	-isc)
-		os=-isc2.2
-		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
-		;;
-	-clix*)
-		basic_machine=clipper-intergraph
-		;;
-	-isc*)
-		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
-		;;
-	-lynx*)
-		os=-lynxos
-		;;
-	-ptx*)
-		basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
-		;;
-	-windowsnt*)
-		os=`echo $os | sed -e 's/windowsnt/winnt/'`
-		;;
-	-psos*)
-		os=-psos
-		;;
-	-mint | -mint[0-9]*)
-		basic_machine=m68k-atari
-		os=-mint
-		;;
-esac
-
-# Decode aliases for certain CPU-COMPANY combinations.
-case $basic_machine in
-	# Recognize the basic CPU types without company name.
-	# Some are omitted here because they have special meanings below.
-	1750a | 580 \
-	| a29k \
-	| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
-	| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
-	| am33_2.0 \
-	| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
-	| bfin \
-	| c4x | clipper \
-	| d10v | d30v | dlx | dsp16xx \
-	| fr30 | frv \
-	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
-	| i370 | i860 | i960 | ia64 \
-	| ip2k | iq2000 \
-	| m32c | m32r | m32rle | m68000 | m68k | m88k \
-	| maxq | mb | microblaze | mcore \
-	| mips | mipsbe | mipseb | mipsel | mipsle \
-	| mips16 \
-	| mips64 | mips64el \
-	| mips64vr | mips64vrel \
-	| mips64orion | mips64orionel \
-	| mips64vr4100 | mips64vr4100el \
-	| mips64vr4300 | mips64vr4300el \
-	| mips64vr5000 | mips64vr5000el \
-	| mips64vr5900 | mips64vr5900el \
-	| mipsisa32 | mipsisa32el \
-	| mipsisa32r2 | mipsisa32r2el \
-	| mipsisa64 | mipsisa64el \
-	| mipsisa64r2 | mipsisa64r2el \
-	| mipsisa64sb1 | mipsisa64sb1el \
-	| mipsisa64sr71k | mipsisa64sr71kel \
-	| mipstx39 | mipstx39el \
-	| mn10200 | mn10300 \
-	| mt \
-	| msp430 \
-	| nios | nios2 \
-	| ns16k | ns32k \
-	| or32 \
-	| pdp10 | pdp11 | pj | pjl \
-	| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
-	| pyramid \
-	| score \
-	| sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
-	| sh64 | sh64le \
-	| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
-	| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
-	| spu | strongarm \
-	| tahoe | thumb | tic4x | tic80 | tron \
-	| v850 | v850e \
-	| we32k \
-	| x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
-	| z8k)
-		basic_machine=$basic_machine-unknown
-		;;
-	m6811 | m68hc11 | m6812 | m68hc12)
-		# Motorola 68HC11/12.
-		basic_machine=$basic_machine-unknown
-		os=-none
-		;;
-	m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
-		;;
-	ms1)
-		basic_machine=mt-unknown
-		;;
-
-	# We use `pc' rather than `unknown'
-	# because (1) that's what they normally are, and
-	# (2) the word "unknown" tends to confuse beginning users.
-	i*86 | x86_64)
-	  basic_machine=$basic_machine-pc
-	  ;;
-	# Object if more than one company name word.
-	*-*-*)
-		echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
-		exit 1
-		;;
-	# Recognize the basic CPU types with company name.
-	580-* \
-	| a29k-* \
-	| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
-	| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
-	| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
-	| arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
-	| avr-* | avr32-* \
-	| bfin-* | bs2000-* \
-	| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
-	| clipper-* | craynv-* | cydra-* \
-	| d10v-* | d30v-* | dlx-* \
-	| elxsi-* \
-	| f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
-	| h8300-* | h8500-* \
-	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
-	| i*86-* | i860-* | i960-* | ia64-* \
-	| ip2k-* | iq2000-* \
-	| m32c-* | m32r-* | m32rle-* \
-	| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
-	| m88110-* | m88k-* | maxq-* | mcore-* \
-	| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
-	| mips16-* \
-	| mips64-* | mips64el-* \
-	| mips64vr-* | mips64vrel-* \
-	| mips64orion-* | mips64orionel-* \
-	| mips64vr4100-* | mips64vr4100el-* \
-	| mips64vr4300-* | mips64vr4300el-* \
-	| mips64vr5000-* | mips64vr5000el-* \
-	| mips64vr5900-* | mips64vr5900el-* \
-	| mipsisa32-* | mipsisa32el-* \
-	| mipsisa32r2-* | mipsisa32r2el-* \
-	| mipsisa64-* | mipsisa64el-* \
-	| mipsisa64r2-* | mipsisa64r2el-* \
-	| mipsisa64sb1-* | mipsisa64sb1el-* \
-	| mipsisa64sr71k-* | mipsisa64sr71kel-* \
-	| mipstx39-* | mipstx39el-* \
-	| mmix-* \
-	| mt-* \
-	| msp430-* \
-	| nios-* | nios2-* \
-	| none-* | np1-* | ns16k-* | ns32k-* \
-	| orion-* \
-	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
-	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
-	| pyramid-* \
-	| romp-* | rs6000-* \
-	| sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
-	| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
-	| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
-	| sparclite-* \
-	| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
-	| tahoe-* | thumb-* \
-	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
-	| tron-* \
-	| v850-* | v850e-* | vax-* \
-	| we32k-* \
-	| x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
-	| xstormy16-* | xtensa-* \
-	| ymp-* \
-	| z8k-*)
-		;;
-	# Recognize the various machine names and aliases which stand
-	# for a CPU type and a company and sometimes even an OS.
-	386bsd)
-		basic_machine=i386-unknown
-		os=-bsd
-		;;
-	3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
-		basic_machine=m68000-att
-		;;
-	3b*)
-		basic_machine=we32k-att
-		;;
-	a29khif)
-		basic_machine=a29k-amd
-		os=-udi
-		;;
-    	abacus)
-		basic_machine=abacus-unknown
-		;;
-	adobe68k)
-		basic_machine=m68010-adobe
-		os=-scout
-		;;
-	alliant | fx80)
-		basic_machine=fx80-alliant
-		;;
-	altos | altos3068)
-		basic_machine=m68k-altos
-		;;
-	am29k)
-		basic_machine=a29k-none
-		os=-bsd
-		;;
-	amd64)
-		basic_machine=x86_64-pc
-		;;
-	amd64-*)
-		basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
-		;;
-	amdahl)
-		basic_machine=580-amdahl
-		os=-sysv
-		;;
-	amiga | amiga-*)
-		basic_machine=m68k-unknown
-		;;
-	amigaos | amigados)
-		basic_machine=m68k-unknown
-		os=-amigaos
-		;;
-	amigaunix | amix)
-		basic_machine=m68k-unknown
-		os=-sysv4
-		;;
-	apollo68)
-		basic_machine=m68k-apollo
-		os=-sysv
-		;;
-	apollo68bsd)
-		basic_machine=m68k-apollo
-		os=-bsd
-		;;
-	aux)
-		basic_machine=m68k-apple
-		os=-aux
-		;;
-	balance)
-		basic_machine=ns32k-sequent
-		os=-dynix
-		;;
-	c90)
-		basic_machine=c90-cray
-		os=-unicos
-		;;
-	convex-c1)
-		basic_machine=c1-convex
-		os=-bsd
-		;;
-	convex-c2)
-		basic_machine=c2-convex
-		os=-bsd
-		;;
-	convex-c32)
-		basic_machine=c32-convex
-		os=-bsd
-		;;
-	convex-c34)
-		basic_machine=c34-convex
-		os=-bsd
-		;;
-	convex-c38)
-		basic_machine=c38-convex
-		os=-bsd
-		;;
-	cray | j90)
-		basic_machine=j90-cray
-		os=-unicos
-		;;
-	craynv)
-		basic_machine=craynv-cray
-		os=-unicosmp
-		;;
-	cr16c)
-		basic_machine=cr16c-unknown
-		os=-elf
-		;;
-	crds | unos)
-		basic_machine=m68k-crds
-		;;
-	crisv32 | crisv32-* | etraxfs*)
-		basic_machine=crisv32-axis
-		;;
-	cris | cris-* | etrax*)
-		basic_machine=cris-axis
-		;;
-	crx)
-		basic_machine=crx-unknown
-		os=-elf
-		;;
-	da30 | da30-*)
-		basic_machine=m68k-da30
-		;;
-	decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
-		basic_machine=mips-dec
-		;;
-	decsystem10* | dec10*)
-		basic_machine=pdp10-dec
-		os=-tops10
-		;;
-	decsystem20* | dec20*)
-		basic_machine=pdp10-dec
-		os=-tops20
-		;;
-	delta | 3300 | motorola-3300 | motorola-delta \
-	      | 3300-motorola | delta-motorola)
-		basic_machine=m68k-motorola
-		;;
-	delta88)
-		basic_machine=m88k-motorola
-		os=-sysv3
-		;;
-	djgpp)
-		basic_machine=i586-pc
-		os=-msdosdjgpp
-		;;
-	dpx20 | dpx20-*)
-		basic_machine=rs6000-bull
-		os=-bosx
-		;;
-	dpx2* | dpx2*-bull)
-		basic_machine=m68k-bull
-		os=-sysv3
-		;;
-	ebmon29k)
-		basic_machine=a29k-amd
-		os=-ebmon
-		;;
-	elxsi)
-		basic_machine=elxsi-elxsi
-		os=-bsd
-		;;
-	encore | umax | mmax)
-		basic_machine=ns32k-encore
-		;;
-	es1800 | OSE68k | ose68k | ose | OSE)
-		basic_machine=m68k-ericsson
-		os=-ose
-		;;
-	fx2800)
-		basic_machine=i860-alliant
-		;;
-	genix)
-		basic_machine=ns32k-ns
-		;;
-	gmicro)
-		basic_machine=tron-gmicro
-		os=-sysv
-		;;
-	go32)
-		basic_machine=i386-pc
-		os=-go32
-		;;
-	h3050r* | hiux*)
-		basic_machine=hppa1.1-hitachi
-		os=-hiuxwe2
-		;;
-	h8300hms)
-		basic_machine=h8300-hitachi
-		os=-hms
-		;;
-	h8300xray)
-		basic_machine=h8300-hitachi
-		os=-xray
-		;;
-	h8500hms)
-		basic_machine=h8500-hitachi
-		os=-hms
-		;;
-	harris)
-		basic_machine=m88k-harris
-		os=-sysv3
-		;;
-	hp300-*)
-		basic_machine=m68k-hp
-		;;
-	hp300bsd)
-		basic_machine=m68k-hp
-		os=-bsd
-		;;
-	hp300hpux)
-		basic_machine=m68k-hp
-		os=-hpux
-		;;
-	hp3k9[0-9][0-9] | hp9[0-9][0-9])
-		basic_machine=hppa1.0-hp
-		;;
-	hp9k2[0-9][0-9] | hp9k31[0-9])
-		basic_machine=m68000-hp
-		;;
-	hp9k3[2-9][0-9])
-		basic_machine=m68k-hp
-		;;
-	hp9k6[0-9][0-9] | hp6[0-9][0-9])
-		basic_machine=hppa1.0-hp
-		;;
-	hp9k7[0-79][0-9] | hp7[0-79][0-9])
-		basic_machine=hppa1.1-hp
-		;;
-	hp9k78[0-9] | hp78[0-9])
-		# FIXME: really hppa2.0-hp
-		basic_machine=hppa1.1-hp
-		;;
-	hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
-		# FIXME: really hppa2.0-hp
-		basic_machine=hppa1.1-hp
-		;;
-	hp9k8[0-9][13679] | hp8[0-9][13679])
-		basic_machine=hppa1.1-hp
-		;;
-	hp9k8[0-9][0-9] | hp8[0-9][0-9])
-		basic_machine=hppa1.0-hp
-		;;
-	hppa-next)
-		os=-nextstep3
-		;;
-	hppaosf)
-		basic_machine=hppa1.1-hp
-		os=-osf
-		;;
-	hppro)
-		basic_machine=hppa1.1-hp
-		os=-proelf
-		;;
-	i370-ibm* | ibm*)
-		basic_machine=i370-ibm
-		;;
-# I'm not sure what "Sysv32" means.  Should this be sysv3.2?
-	i*86v32)
-		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
-		os=-sysv32
-		;;
-	i*86v4*)
-		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
-		os=-sysv4
-		;;
-	i*86v)
-		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
-		os=-sysv
-		;;
-	i*86sol2)
-		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
-		os=-solaris2
-		;;
-	i386mach)
-		basic_machine=i386-mach
-		os=-mach
-		;;
-	i386-vsta | vsta)
-		basic_machine=i386-unknown
-		os=-vsta
-		;;
-	iris | iris4d)
-		basic_machine=mips-sgi
-		case $os in
-		    -irix*)
-			;;
-		    *)
-			os=-irix4
-			;;
-		esac
-		;;
-	isi68 | isi)
-		basic_machine=m68k-isi
-		os=-sysv
-		;;
-	m88k-omron*)
-		basic_machine=m88k-omron
-		;;
-	magnum | m3230)
-		basic_machine=mips-mips
-		os=-sysv
-		;;
-	merlin)
-		basic_machine=ns32k-utek
-		os=-sysv
-		;;
-	mingw32)
-		basic_machine=i386-pc
-		os=-mingw32
-		;;
-	miniframe)
-		basic_machine=m68000-convergent
-		;;
-	*mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
-		basic_machine=m68k-atari
-		os=-mint
-		;;
-	mips3*-*)
-		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
-		;;
-	mips3*)
-		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
-		;;
-	monitor)
-		basic_machine=m68k-rom68k
-		os=-coff
-		;;
-	morphos)
-		basic_machine=powerpc-unknown
-		os=-morphos
-		;;
-	msdos)
-		basic_machine=i386-pc
-		os=-msdos
-		;;
-	ms1-*)
-		basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
-		;;
-	mvs)
-		basic_machine=i370-ibm
-		os=-mvs
-		;;
-	ncr3000)
-		basic_machine=i486-ncr
-		os=-sysv4
-		;;
-	netbsd386)
-		basic_machine=i386-unknown
-		os=-netbsd
-		;;
-	netwinder)
-		basic_machine=armv4l-rebel
-		os=-linux
-		;;
-	news | news700 | news800 | news900)
-		basic_machine=m68k-sony
-		os=-newsos
-		;;
-	news1000)
-		basic_machine=m68030-sony
-		os=-newsos
-		;;
-	news-3600 | risc-news)
-		basic_machine=mips-sony
-		os=-newsos
-		;;
-	necv70)
-		basic_machine=v70-nec
-		os=-sysv
-		;;
-	next | m*-next )
-		basic_machine=m68k-next
-		case $os in
-		    -nextstep* )
-			;;
-		    -ns2*)
-		      os=-nextstep2
-			;;
-		    *)
-		      os=-nextstep3
-			;;
-		esac
-		;;
-	nh3000)
-		basic_machine=m68k-harris
-		os=-cxux
-		;;
-	nh[45]000)
-		basic_machine=m88k-harris
-		os=-cxux
-		;;
-	nindy960)
-		basic_machine=i960-intel
-		os=-nindy
-		;;
-	mon960)
-		basic_machine=i960-intel
-		os=-mon960
-		;;
-	nonstopux)
-		basic_machine=mips-compaq
-		os=-nonstopux
-		;;
-	np1)
-		basic_machine=np1-gould
-		;;
-	nsr-tandem)
-		basic_machine=nsr-tandem
-		;;
-	op50n-* | op60c-*)
-		basic_machine=hppa1.1-oki
-		os=-proelf
-		;;
-	openrisc | openrisc-*)
-		basic_machine=or32-unknown
-		;;
-	os400)
-		basic_machine=powerpc-ibm
-		os=-os400
-		;;
-	OSE68000 | ose68000)
-		basic_machine=m68000-ericsson
-		os=-ose
-		;;
-	os68k)
-		basic_machine=m68k-none
-		os=-os68k
-		;;
-	pa-hitachi)
-		basic_machine=hppa1.1-hitachi
-		os=-hiuxwe2
-		;;
-	paragon)
-		basic_machine=i860-intel
-		os=-osf
-		;;
-	pbd)
-		basic_machine=sparc-tti
-		;;
-	pbb)
-		basic_machine=m68k-tti
-		;;
-	pc532 | pc532-*)
-		basic_machine=ns32k-pc532
-		;;
-	pc98)
-		basic_machine=i386-pc
-		;;
-	pc98-*)
-		basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
-		;;
-	pentium | p5 | k5 | k6 | nexgen | viac3)
-		basic_machine=i586-pc
-		;;
-	pentiumpro | p6 | 6x86 | athlon | athlon_*)
-		basic_machine=i686-pc
-		;;
-	pentiumii | pentium2 | pentiumiii | pentium3)
-		basic_machine=i686-pc
-		;;
-	pentium4)
-		basic_machine=i786-pc
-		;;
-	pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
-		basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
-		;;
-	pentiumpro-* | p6-* | 6x86-* | athlon-*)
-		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
-		;;
-	pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
-		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
-		;;
-	pentium4-*)
-		basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
-		;;
-	pn)
-		basic_machine=pn-gould
-		;;
-	power)	basic_machine=power-ibm
-		;;
-	ppc)	basic_machine=powerpc-unknown
-		;;
-	ppc-*)	basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
-		;;
-	ppcle | powerpclittle | ppc-le | powerpc-little)
-		basic_machine=powerpcle-unknown
-		;;
-	ppcle-* | powerpclittle-*)
-		basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
-		;;
-	ppc64)	basic_machine=powerpc64-unknown
-		;;
-	ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
-		;;
-	ppc64le | powerpc64little | ppc64-le | powerpc64-little)
-		basic_machine=powerpc64le-unknown
-		;;
-	ppc64le-* | powerpc64little-*)
-		basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
-		;;
-	ps2)
-		basic_machine=i386-ibm
-		;;
-	pw32)
-		basic_machine=i586-unknown
-		os=-pw32
-		;;
-	rdos)
-		basic_machine=i386-pc
-		os=-rdos
-		;;
-	rom68k)
-		basic_machine=m68k-rom68k
-		os=-coff
-		;;
-	rm[46]00)
-		basic_machine=mips-siemens
-		;;
-	rtpc | rtpc-*)
-		basic_machine=romp-ibm
-		;;
-	s390 | s390-*)
-		basic_machine=s390-ibm
-		;;
-	s390x | s390x-*)
-		basic_machine=s390x-ibm
-		;;
-	sa29200)
-		basic_machine=a29k-amd
-		os=-udi
-		;;
-	sb1)
-		basic_machine=mipsisa64sb1-unknown
-		;;
-	sb1el)
-		basic_machine=mipsisa64sb1el-unknown
-		;;
-	sde)
-		basic_machine=mipsisa32-sde
-		os=-elf
-		;;
-	sei)
-		basic_machine=mips-sei
-		os=-seiux
-		;;
-	sequent)
-		basic_machine=i386-sequent
-		;;
-	sh)
-		basic_machine=sh-hitachi
-		os=-hms
-		;;
-	sh64)
-		basic_machine=sh64-unknown
-		;;
-	sparclite-wrs | simso-wrs)
-		basic_machine=sparclite-wrs
-		os=-vxworks
-		;;
-	sps7)
-		basic_machine=m68k-bull
-		os=-sysv2
-		;;
-	spur)
-		basic_machine=spur-unknown
-		;;
-	st2000)
-		basic_machine=m68k-tandem
-		;;
-	stratus)
-		basic_machine=i860-stratus
-		os=-sysv4
-		;;
-	sun2)
-		basic_machine=m68000-sun
-		;;
-	sun2os3)
-		basic_machine=m68000-sun
-		os=-sunos3
-		;;
-	sun2os4)
-		basic_machine=m68000-sun
-		os=-sunos4
-		;;
-	sun3os3)
-		basic_machine=m68k-sun
-		os=-sunos3
-		;;
-	sun3os4)
-		basic_machine=m68k-sun
-		os=-sunos4
-		;;
-	sun4os3)
-		basic_machine=sparc-sun
-		os=-sunos3
-		;;
-	sun4os4)
-		basic_machine=sparc-sun
-		os=-sunos4
-		;;
-	sun4sol2)
-		basic_machine=sparc-sun
-		os=-solaris2
-		;;
-	sun3 | sun3-*)
-		basic_machine=m68k-sun
-		;;
-	sun4)
-		basic_machine=sparc-sun
-		;;
-	sun386 | sun386i | roadrunner)
-		basic_machine=i386-sun
-		;;
-	sv1)
-		basic_machine=sv1-cray
-		os=-unicos
-		;;
-	symmetry)
-		basic_machine=i386-sequent
-		os=-dynix
-		;;
-	t3e)
-		basic_machine=alphaev5-cray
-		os=-unicos
-		;;
-	t90)
-		basic_machine=t90-cray
-		os=-unicos
-		;;
-	tic54x | c54x*)
-		basic_machine=tic54x-unknown
-		os=-coff
-		;;
-	tic55x | c55x*)
-		basic_machine=tic55x-unknown
-		os=-coff
-		;;
-	tic6x | c6x*)
-		basic_machine=tic6x-unknown
-		os=-coff
-		;;
-	tx39)
-		basic_machine=mipstx39-unknown
-		;;
-	tx39el)
-		basic_machine=mipstx39el-unknown
-		;;
-	toad1)
-		basic_machine=pdp10-xkl
-		os=-tops20
-		;;
-	tower | tower-32)
-		basic_machine=m68k-ncr
-		;;
-	tpf)
-		basic_machine=s390x-ibm
-		os=-tpf
-		;;
-	udi29k)
-		basic_machine=a29k-amd
-		os=-udi
-		;;
-	ultra3)
-		basic_machine=a29k-nyu
-		os=-sym1
-		;;
-	v810 | necv810)
-		basic_machine=v810-nec
-		os=-none
-		;;
-	vaxv)
-		basic_machine=vax-dec
-		os=-sysv
-		;;
-	vms)
-		basic_machine=vax-dec
-		os=-vms
-		;;
-	vpp*|vx|vx-*)
-		basic_machine=f301-fujitsu
-		;;
-	vxworks960)
-		basic_machine=i960-wrs
-		os=-vxworks
-		;;
-	vxworks68)
-		basic_machine=m68k-wrs
-		os=-vxworks
-		;;
-	vxworks29k)
-		basic_machine=a29k-wrs
-		os=-vxworks
-		;;
-	w65*)
-		basic_machine=w65-wdc
-		os=-none
-		;;
-	w89k-*)
-		basic_machine=hppa1.1-winbond
-		os=-proelf
-		;;
-	xbox)
-		basic_machine=i686-pc
-		os=-mingw32
-		;;
-	xps | xps100)
-		basic_machine=xps100-honeywell
-		;;
-	ymp)
-		basic_machine=ymp-cray
-		os=-unicos
-		;;
-	z8k-*-coff)
-		basic_machine=z8k-unknown
-		os=-sim
-		;;
-	none)
-		basic_machine=none-none
-		os=-none
-		;;
-
-# Here we handle the default manufacturer of certain CPU types.  It is in
-# some cases the only manufacturer, in others, it is the most popular.
-	w89k)
-		basic_machine=hppa1.1-winbond
-		;;
-	op50n)
-		basic_machine=hppa1.1-oki
-		;;
-	op60c)
-		basic_machine=hppa1.1-oki
-		;;
-	romp)
-		basic_machine=romp-ibm
-		;;
-	mmix)
-		basic_machine=mmix-knuth
-		;;
-	rs6000)
-		basic_machine=rs6000-ibm
-		;;
-	vax)
-		basic_machine=vax-dec
-		;;
-	pdp10)
-		# there are many clones, so DEC is not a safe bet
-		basic_machine=pdp10-unknown
-		;;
-	pdp11)
-		basic_machine=pdp11-dec
-		;;
-	we32k)
-		basic_machine=we32k-att
-		;;
-	sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
-		basic_machine=sh-unknown
-		;;
-	sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
-		basic_machine=sparc-sun
-		;;
-	cydra)
-		basic_machine=cydra-cydrome
-		;;
-	orion)
-		basic_machine=orion-highlevel
-		;;
-	orion105)
-		basic_machine=clipper-highlevel
-		;;
-	mac | mpw | mac-mpw)
-		basic_machine=m68k-apple
-		;;
-	pmac | pmac-mpw)
-		basic_machine=powerpc-apple
-		;;
-	*-unknown)
-		# Make sure to match an already-canonicalized machine name.
-		;;
-	*)
-		echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
-		exit 1
-		;;
-esac
-
-# Here we canonicalize certain aliases for manufacturers.
-case $basic_machine in
-	*-digital*)
-		basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
-		;;
-	*-commodore*)
-		basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
-		;;
-	*)
-		;;
-esac
-
-# Decode manufacturer-specific aliases for certain operating systems.
-
-if [ x"$os" != x"" ]
-then
-case $os in
-        # First match some system type aliases
-        # that might get confused with valid system types.
-	# -solaris* is a basic system type, with this one exception.
-	-solaris1 | -solaris1.*)
-		os=`echo $os | sed -e 's|solaris1|sunos4|'`
-		;;
-	-solaris)
-		os=-solaris2
-		;;
-	-svr4*)
-		os=-sysv4
-		;;
-	-unixware*)
-		os=-sysv4.2uw
-		;;
-	-gnu/linux*)
-		os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
-		;;
-	# First accept the basic system types.
-	# The portable systems comes first.
-	# Each alternative MUST END IN A *, to match a version number.
-	# -sysv* is not here because it comes later, after sysvr4.
-	-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
-	      | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
-	      | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
-	      | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
-	      | -aos* \
-	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
-	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
-	      | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
-	      | -openbsd* | -solidbsd* \
-	      | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
-	      | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
-	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
-	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
-	      | -chorusos* | -chorusrdb* \
-	      | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
-	      | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
-	      | -uxpv* | -beos* | -mpeix* | -udk* \
-	      | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
-	      | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
-	      | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
-	      | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
-	      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
-	      | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
-	      | -skyos* | -haiku* | -rdos* | -toppers*)
-	# Remember, each alternative MUST END IN *, to match a version number.
-		;;
-	-qnx*)
-		case $basic_machine in
-		    x86-* | i*86-*)
-			;;
-		    *)
-			os=-nto$os
-			;;
-		esac
-		;;
-	-nto-qnx*)
-		;;
-	-nto*)
-		os=`echo $os | sed -e 's|nto|nto-qnx|'`
-		;;
-	-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
-	      | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
-	      | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
-		;;
-	-mac*)
-		os=`echo $os | sed -e 's|mac|macos|'`
-		;;
-	-linux-dietlibc)
-		os=-linux-dietlibc
-		;;
-	-linux*)
-		os=`echo $os | sed -e 's|linux|linux-gnu|'`
-		;;
-	-sunos5*)
-		os=`echo $os | sed -e 's|sunos5|solaris2|'`
-		;;
-	-sunos6*)
-		os=`echo $os | sed -e 's|sunos6|solaris3|'`
-		;;
-	-opened*)
-		os=-openedition
-		;;
-        -os400*)
-		os=-os400
-		;;
-	-wince*)
-		os=-wince
-		;;
-	-osfrose*)
-		os=-osfrose
-		;;
-	-osf*)
-		os=-osf
-		;;
-	-utek*)
-		os=-bsd
-		;;
-	-dynix*)
-		os=-bsd
-		;;
-	-acis*)
-		os=-aos
-		;;
-	-atheos*)
-		os=-atheos
-		;;
-	-syllable*)
-		os=-syllable
-		;;
-	-386bsd)
-		os=-bsd
-		;;
-	-ctix* | -uts*)
-		os=-sysv
-		;;
-	-nova*)
-		os=-rtmk-nova
-		;;
-	-ns2 )
-		os=-nextstep2
-		;;
-	-nsk*)
-		os=-nsk
-		;;
-	# Preserve the version number of sinix5.
-	-sinix5.*)
-		os=`echo $os | sed -e 's|sinix|sysv|'`
-		;;
-	-sinix*)
-		os=-sysv4
-		;;
-        -tpf*)
-		os=-tpf
-		;;
-	-triton*)
-		os=-sysv3
-		;;
-	-oss*)
-		os=-sysv3
-		;;
-	-svr4)
-		os=-sysv4
-		;;
-	-svr3)
-		os=-sysv3
-		;;
-	-sysvr4)
-		os=-sysv4
-		;;
-	# This must come after -sysvr4.
-	-sysv*)
-		;;
-	-ose*)
-		os=-ose
-		;;
-	-es1800*)
-		os=-ose
-		;;
-	-xenix)
-		os=-xenix
-		;;
-	-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
-		os=-mint
-		;;
-	-aros*)
-		os=-aros
-		;;
-	-kaos*)
-		os=-kaos
-		;;
-	-zvmoe)
-		os=-zvmoe
-		;;
-	-none)
-		;;
-	*)
-		# Get rid of the `-' at the beginning of $os.
-		os=`echo $os | sed 's/[^-]*-//'`
-		echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
-		exit 1
-		;;
-esac
-else
-
-# Here we handle the default operating systems that come with various machines.
-# The value should be what the vendor currently ships out the door with their
-# machine or put another way, the most popular os provided with the machine.
-
-# Note that if you're going to try to match "-MANUFACTURER" here (say,
-# "-sun"), then you have to tell the case statement up towards the top
-# that MANUFACTURER isn't an operating system.  Otherwise, code above
-# will signal an error saying that MANUFACTURER isn't an operating
-# system, and we'll never get to this point.
-
-case $basic_machine in
-        score-*)
-		os=-elf
-		;;
-        spu-*)
-		os=-elf
-		;;
-	*-acorn)
-		os=-riscix1.2
-		;;
-	arm*-rebel)
-		os=-linux
-		;;
-	arm*-semi)
-		os=-aout
-		;;
-        c4x-* | tic4x-*)
-        	os=-coff
-		;;
-	# This must come before the *-dec entry.
-	pdp10-*)
-		os=-tops20
-		;;
-	pdp11-*)
-		os=-none
-		;;
-	*-dec | vax-*)
-		os=-ultrix4.2
-		;;
-	m68*-apollo)
-		os=-domain
-		;;
-	i386-sun)
-		os=-sunos4.0.2
-		;;
-	m68000-sun)
-		os=-sunos3
-		# This also exists in the configure program, but was not the
-		# default.
-		# os=-sunos4
-		;;
-	m68*-cisco)
-		os=-aout
-		;;
-	mips*-cisco)
-		os=-elf
-		;;
-	mips*-*)
-		os=-elf
-		;;
-	or32-*)
-		os=-coff
-		;;
-	*-tti)	# must be before sparc entry or we get the wrong os.
-		os=-sysv3
-		;;
-	sparc-* | *-sun)
-		os=-sunos4.1.1
-		;;
-	*-be)
-		os=-beos
-		;;
-	*-haiku)
-		os=-haiku
-		;;
-	*-ibm)
-		os=-aix
-		;;
-    	*-knuth)
-		os=-mmixware
-		;;
-	*-wec)
-		os=-proelf
-		;;
-	*-winbond)
-		os=-proelf
-		;;
-	*-oki)
-		os=-proelf
-		;;
-	*-hp)
-		os=-hpux
-		;;
-	*-hitachi)
-		os=-hiux
-		;;
-	i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
-		os=-sysv
-		;;
-	*-cbm)
-		os=-amigaos
-		;;
-	*-dg)
-		os=-dgux
-		;;
-	*-dolphin)
-		os=-sysv3
-		;;
-	m68k-ccur)
-		os=-rtu
-		;;
-	m88k-omron*)
-		os=-luna
-		;;
-	*-next )
-		os=-nextstep
-		;;
-	*-sequent)
-		os=-ptx
-		;;
-	*-crds)
-		os=-unos
-		;;
-	*-ns)
-		os=-genix
-		;;
-	i370-*)
-		os=-mvs
-		;;
-	*-next)
-		os=-nextstep3
-		;;
-	*-gould)
-		os=-sysv
-		;;
-	*-highlevel)
-		os=-bsd
-		;;
-	*-encore)
-		os=-bsd
-		;;
-	*-sgi)
-		os=-irix
-		;;
-	*-siemens)
-		os=-sysv4
-		;;
-	*-masscomp)
-		os=-rtu
-		;;
-	f30[01]-fujitsu | f700-fujitsu)
-		os=-uxpv
-		;;
-	*-rom68k)
-		os=-coff
-		;;
-	*-*bug)
-		os=-coff
-		;;
-	*-apple)
-		os=-macos
-		;;
-	*-atari*)
-		os=-mint
-		;;
-	*)
-		os=-none
-		;;
-esac
-fi
-
-# Here we handle the case where we know the os, and the CPU type, but not the
-# manufacturer.  We pick the logical manufacturer.
-vendor=unknown
-case $basic_machine in
-	*-unknown)
-		case $os in
-			-riscix*)
-				vendor=acorn
-				;;
-			-sunos*)
-				vendor=sun
-				;;
-			-aix*)
-				vendor=ibm
-				;;
-			-beos*)
-				vendor=be
-				;;
-			-hpux*)
-				vendor=hp
-				;;
-			-mpeix*)
-				vendor=hp
-				;;
-			-hiux*)
-				vendor=hitachi
-				;;
-			-unos*)
-				vendor=crds
-				;;
-			-dgux*)
-				vendor=dg
-				;;
-			-luna*)
-				vendor=omron
-				;;
-			-genix*)
-				vendor=ns
-				;;
-			-mvs* | -opened*)
-				vendor=ibm
-				;;
-			-os400*)
-				vendor=ibm
-				;;
-			-ptx*)
-				vendor=sequent
-				;;
-			-tpf*)
-				vendor=ibm
-				;;
-			-vxsim* | -vxworks* | -windiss*)
-				vendor=wrs
-				;;
-			-aux*)
-				vendor=apple
-				;;
-			-hms*)
-				vendor=hitachi
-				;;
-			-mpw* | -macos*)
-				vendor=apple
-				;;
-			-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
-				vendor=atari
-				;;
-			-vos*)
-				vendor=stratus
-				;;
-		esac
-		basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
-		;;
-esac
-
-echo $basic_machine$os
-exit
-
-# Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "timestamp='"
-# time-stamp-format: "%:y-%02m-%02d"
-# time-stamp-end: "'"
-# End:
diff --git a/eglib/depcomp b/eglib/depcomp
deleted file mode 100755
index ca5ea4e..0000000
--- a/eglib/depcomp
+++ /dev/null
@@ -1,584 +0,0 @@
-#! /bin/sh
-# depcomp - compile a program generating dependencies as side-effects
-
-scriptversion=2006-10-15.18
-
-# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006 Free Software
-# Foundation, Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
-
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-# Originally written by Alexandre Oliva <oliva at dcc.unicamp.br>.
-
-case $1 in
-  '')
-     echo "$0: No command.  Try \`$0 --help' for more information." 1>&2
-     exit 1;
-     ;;
-  -h | --h*)
-    cat <<\EOF
-Usage: depcomp [--help] [--version] PROGRAM [ARGS]
-
-Run PROGRAMS ARGS to compile a file, generating dependencies
-as side-effects.
-
-Environment variables:
-  depmode     Dependency tracking mode.
-  source      Source file read by `PROGRAMS ARGS'.
-  object      Object file output by `PROGRAMS ARGS'.
-  DEPDIR      directory where to store dependencies.
-  depfile     Dependency file to output.
-  tmpdepfile  Temporary file to use when outputing dependencies.
-  libtool     Whether libtool is used (yes/no).
-
-Report bugs to <bug-automake at gnu.org>.
-EOF
-    exit $?
-    ;;
-  -v | --v*)
-    echo "depcomp $scriptversion"
-    exit $?
-    ;;
-esac
-
-if test -z "$depmode" || test -z "$source" || test -z "$object"; then
-  echo "depcomp: Variables source, object and depmode must be set" 1>&2
-  exit 1
-fi
-
-# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
-depfile=${depfile-`echo "$object" |
-  sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
-tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
-
-rm -f "$tmpdepfile"
-
-# Some modes work just like other modes, but use different flags.  We
-# parameterize here, but still list the modes in the big case below,
-# to make depend.m4 easier to write.  Note that we *cannot* use a case
-# here, because this file can only contain one case statement.
-if test "$depmode" = hp; then
-  # HP compiler uses -M and no extra arg.
-  gccflag=-M
-  depmode=gcc
-fi
-
-if test "$depmode" = dashXmstdout; then
-   # This is just like dashmstdout with a different argument.
-   dashmflag=-xM
-   depmode=dashmstdout
-fi
-
-case "$depmode" in
-gcc3)
-## gcc 3 implements dependency tracking that does exactly what
-## we want.  Yay!  Note: for some reason libtool 1.4 doesn't like
-## it if -MD -MP comes after the -MF stuff.  Hmm.
-## Unfortunately, FreeBSD c89 acceptance of flags depends upon
-## the command line argument order; so add the flags where they
-## appear in depend2.am.  Note that the slowdown incurred here
-## affects only configure: in makefiles, %FASTDEP% shortcuts this.
-  for arg
-  do
-    case $arg in
-    -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
-    *)  set fnord "$@" "$arg" ;;
-    esac
-    shift # fnord
-    shift # $arg
-  done
-  "$@"
-  stat=$?
-  if test $stat -eq 0; then :
-  else
-    rm -f "$tmpdepfile"
-    exit $stat
-  fi
-  mv "$tmpdepfile" "$depfile"
-  ;;
-
-gcc)
-## There are various ways to get dependency output from gcc.  Here's
-## why we pick this rather obscure method:
-## - Don't want to use -MD because we'd like the dependencies to end
-##   up in a subdir.  Having to rename by hand is ugly.
-##   (We might end up doing this anyway to support other compilers.)
-## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
-##   -MM, not -M (despite what the docs say).
-## - Using -M directly means running the compiler twice (even worse
-##   than renaming).
-  if test -z "$gccflag"; then
-    gccflag=-MD,
-  fi
-  "$@" -Wp,"$gccflag$tmpdepfile"
-  stat=$?
-  if test $stat -eq 0; then :
-  else
-    rm -f "$tmpdepfile"
-    exit $stat
-  fi
-  rm -f "$depfile"
-  echo "$object : \\" > "$depfile"
-  alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
-## The second -e expression handles DOS-style file names with drive letters.
-  sed -e 's/^[^:]*: / /' \
-      -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
-## This next piece of magic avoids the `deleted header file' problem.
-## The problem is that when a header file which appears in a .P file
-## is deleted, the dependency causes make to die (because there is
-## typically no way to rebuild the header).  We avoid this by adding
-## dummy dependencies for each header file.  Too bad gcc doesn't do
-## this for us directly.
-  tr ' ' '
-' < "$tmpdepfile" |
-## Some versions of gcc put a space before the `:'.  On the theory
-## that the space means something, we add a space to the output as
-## well.
-## Some versions of the HPUX 10.20 sed can't process this invocation
-## correctly.  Breaking it into two sed invocations is a workaround.
-    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
-  rm -f "$tmpdepfile"
-  ;;
-
-hp)
-  # This case exists only to let depend.m4 do its work.  It works by
-  # looking at the text of this script.  This case will never be run,
-  # since it is checked for above.
-  exit 1
-  ;;
-
-sgi)
-  if test "$libtool" = yes; then
-    "$@" "-Wp,-MDupdate,$tmpdepfile"
-  else
-    "$@" -MDupdate "$tmpdepfile"
-  fi
-  stat=$?
-  if test $stat -eq 0; then :
-  else
-    rm -f "$tmpdepfile"
-    exit $stat
-  fi
-  rm -f "$depfile"
-
-  if test -f "$tmpdepfile"; then  # yes, the sourcefile depend on other files
-    echo "$object : \\" > "$depfile"
-
-    # Clip off the initial element (the dependent).  Don't try to be
-    # clever and replace this with sed code, as IRIX sed won't handle
-    # lines with more than a fixed number of characters (4096 in
-    # IRIX 6.2 sed, 8192 in IRIX 6.5).  We also remove comment lines;
-    # the IRIX cc adds comments like `#:fec' to the end of the
-    # dependency line.
-    tr ' ' '
-' < "$tmpdepfile" \
-    | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
-    tr '
-' ' ' >> $depfile
-    echo >> $depfile
-
-    # The second pass generates a dummy entry for each header file.
-    tr ' ' '
-' < "$tmpdepfile" \
-   | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
-   >> $depfile
-  else
-    # The sourcefile does not contain any dependencies, so just
-    # store a dummy comment line, to avoid errors with the Makefile
-    # "include basename.Plo" scheme.
-    echo "#dummy" > "$depfile"
-  fi
-  rm -f "$tmpdepfile"
-  ;;
-
-aix)
-  # The C for AIX Compiler uses -M and outputs the dependencies
-  # in a .u file.  In older versions, this file always lives in the
-  # current directory.  Also, the AIX compiler puts `$object:' at the
-  # start of each line; $object doesn't have directory information.
-  # Version 6 uses the directory in both cases.
-  stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
-  tmpdepfile="$stripped.u"
-  if test "$libtool" = yes; then
-    "$@" -Wc,-M
-  else
-    "$@" -M
-  fi
-  stat=$?
-
-  if test -f "$tmpdepfile"; then :
-  else
-    stripped=`echo "$stripped" | sed 's,^.*/,,'`
-    tmpdepfile="$stripped.u"
-  fi
-
-  if test $stat -eq 0; then :
-  else
-    rm -f "$tmpdepfile"
-    exit $stat
-  fi
-
-  if test -f "$tmpdepfile"; then
-    outname="$stripped.o"
-    # Each line is of the form `foo.o: dependent.h'.
-    # Do two passes, one to just change these to
-    # `$object: dependent.h' and one to simply `dependent.h:'.
-    sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
-    sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
-  else
-    # The sourcefile does not contain any dependencies, so just
-    # store a dummy comment line, to avoid errors with the Makefile
-    # "include basename.Plo" scheme.
-    echo "#dummy" > "$depfile"
-  fi
-  rm -f "$tmpdepfile"
-  ;;
-
-icc)
-  # Intel's C compiler understands `-MD -MF file'.  However on
-  #    icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
-  # ICC 7.0 will fill foo.d with something like
-  #    foo.o: sub/foo.c
-  #    foo.o: sub/foo.h
-  # which is wrong.  We want:
-  #    sub/foo.o: sub/foo.c
-  #    sub/foo.o: sub/foo.h
-  #    sub/foo.c:
-  #    sub/foo.h:
-  # ICC 7.1 will output
-  #    foo.o: sub/foo.c sub/foo.h
-  # and will wrap long lines using \ :
-  #    foo.o: sub/foo.c ... \
-  #     sub/foo.h ... \
-  #     ...
-
-  "$@" -MD -MF "$tmpdepfile"
-  stat=$?
-  if test $stat -eq 0; then :
-  else
-    rm -f "$tmpdepfile"
-    exit $stat
-  fi
-  rm -f "$depfile"
-  # Each line is of the form `foo.o: dependent.h',
-  # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
-  # Do two passes, one to just change these to
-  # `$object: dependent.h' and one to simply `dependent.h:'.
-  sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
-  # Some versions of the HPUX 10.20 sed can't process this invocation
-  # correctly.  Breaking it into two sed invocations is a workaround.
-  sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
-    sed -e 's/$/ :/' >> "$depfile"
-  rm -f "$tmpdepfile"
-  ;;
-
-hp2)
-  # The "hp" stanza above does not work with aCC (C++) and HP's ia64
-  # compilers, which have integrated preprocessors.  The correct option
-  # to use with these is +Maked; it writes dependencies to a file named
-  # 'foo.d', which lands next to the object file, wherever that
-  # happens to be.
-  # Much of this is similar to the tru64 case; see comments there.
-  dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
-  test "x$dir" = "x$object" && dir=
-  base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
-  if test "$libtool" = yes; then
-    tmpdepfile1=$dir$base.d
-    tmpdepfile2=$dir.libs/$base.d
-    "$@" -Wc,+Maked
-  else
-    tmpdepfile1=$dir$base.d
-    tmpdepfile2=$dir$base.d
-    "$@" +Maked
-  fi
-  stat=$?
-  if test $stat -eq 0; then :
-  else
-     rm -f "$tmpdepfile1" "$tmpdepfile2"
-     exit $stat
-  fi
-
-  for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
-  do
-    test -f "$tmpdepfile" && break
-  done
-  if test -f "$tmpdepfile"; then
-    sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
-    # Add `dependent.h:' lines.
-    sed -ne '2,${; s/^ *//; s/ \\*$//; s/$/:/; p;}' "$tmpdepfile" >> "$depfile"
-  else
-    echo "#dummy" > "$depfile"
-  fi
-  rm -f "$tmpdepfile" "$tmpdepfile2"
-  ;;
-
-tru64)
-   # The Tru64 compiler uses -MD to generate dependencies as a side
-   # effect.  `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
-   # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
-   # dependencies in `foo.d' instead, so we check for that too.
-   # Subdirectories are respected.
-   dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
-   test "x$dir" = "x$object" && dir=
-   base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
-
-   if test "$libtool" = yes; then
-      # With Tru64 cc, shared objects can also be used to make a
-      # static library.  This mechanism is used in libtool 1.4 series to
-      # handle both shared and static libraries in a single compilation.
-      # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
-      #
-      # With libtool 1.5 this exception was removed, and libtool now
-      # generates 2 separate objects for the 2 libraries.  These two
-      # compilations output dependencies in $dir.libs/$base.o.d and
-      # in $dir$base.o.d.  We have to check for both files, because
-      # one of the two compilations can be disabled.  We should prefer
-      # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
-      # automatically cleaned when .libs/ is deleted, while ignoring
-      # the former would cause a distcleancheck panic.
-      tmpdepfile1=$dir.libs/$base.lo.d   # libtool 1.4
-      tmpdepfile2=$dir$base.o.d          # libtool 1.5
-      tmpdepfile3=$dir.libs/$base.o.d    # libtool 1.5
-      tmpdepfile4=$dir.libs/$base.d      # Compaq CCC V6.2-504
-      "$@" -Wc,-MD
-   else
-      tmpdepfile1=$dir$base.o.d
-      tmpdepfile2=$dir$base.d
-      tmpdepfile3=$dir$base.d
-      tmpdepfile4=$dir$base.d
-      "$@" -MD
-   fi
-
-   stat=$?
-   if test $stat -eq 0; then :
-   else
-      rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
-      exit $stat
-   fi
-
-   for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
-   do
-     test -f "$tmpdepfile" && break
-   done
-   if test -f "$tmpdepfile"; then
-      sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
-      # That's a tab and a space in the [].
-      sed -e 's,^.*\.[a-z]*:[	 ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
-   else
-      echo "#dummy" > "$depfile"
-   fi
-   rm -f "$tmpdepfile"
-   ;;
-
-#nosideeffect)
-  # This comment above is used by automake to tell side-effect
-  # dependency tracking mechanisms from slower ones.
-
-dashmstdout)
-  # Important note: in order to support this mode, a compiler *must*
-  # always write the preprocessed file to stdout, regardless of -o.
-  "$@" || exit $?
-
-  # Remove the call to Libtool.
-  if test "$libtool" = yes; then
-    while test $1 != '--mode=compile'; do
-      shift
-    done
-    shift
-  fi
-
-  # Remove `-o $object'.
-  IFS=" "
-  for arg
-  do
-    case $arg in
-    -o)
-      shift
-      ;;
-    $object)
-      shift
-      ;;
-    *)
-      set fnord "$@" "$arg"
-      shift # fnord
-      shift # $arg
-      ;;
-    esac
-  done
-
-  test -z "$dashmflag" && dashmflag=-M
-  # Require at least two characters before searching for `:'
-  # in the target name.  This is to cope with DOS-style filenames:
-  # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
-  "$@" $dashmflag |
-    sed 's:^[  ]*[^: ][^:][^:]*\:[    ]*:'"$object"'\: :' > "$tmpdepfile"
-  rm -f "$depfile"
-  cat < "$tmpdepfile" > "$depfile"
-  tr ' ' '
-' < "$tmpdepfile" | \
-## Some versions of the HPUX 10.20 sed can't process this invocation
-## correctly.  Breaking it into two sed invocations is a workaround.
-    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
-  rm -f "$tmpdepfile"
-  ;;
-
-dashXmstdout)
-  # This case only exists to satisfy depend.m4.  It is never actually
-  # run, as this mode is specially recognized in the preamble.
-  exit 1
-  ;;
-
-makedepend)
-  "$@" || exit $?
-  # Remove any Libtool call
-  if test "$libtool" = yes; then
-    while test $1 != '--mode=compile'; do
-      shift
-    done
-    shift
-  fi
-  # X makedepend
-  shift
-  cleared=no
-  for arg in "$@"; do
-    case $cleared in
-    no)
-      set ""; shift
-      cleared=yes ;;
-    esac
-    case "$arg" in
-    -D*|-I*)
-      set fnord "$@" "$arg"; shift ;;
-    # Strip any option that makedepend may not understand.  Remove
-    # the object too, otherwise makedepend will parse it as a source file.
-    -*|$object)
-      ;;
-    *)
-      set fnord "$@" "$arg"; shift ;;
-    esac
-  done
-  obj_suffix="`echo $object | sed 's/^.*\././'`"
-  touch "$tmpdepfile"
-  ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
-  rm -f "$depfile"
-  cat < "$tmpdepfile" > "$depfile"
-  sed '1,2d' "$tmpdepfile" | tr ' ' '
-' | \
-## Some versions of the HPUX 10.20 sed can't process this invocation
-## correctly.  Breaking it into two sed invocations is a workaround.
-    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
-  rm -f "$tmpdepfile" "$tmpdepfile".bak
-  ;;
-
-cpp)
-  # Important note: in order to support this mode, a compiler *must*
-  # always write the preprocessed file to stdout.
-  "$@" || exit $?
-
-  # Remove the call to Libtool.
-  if test "$libtool" = yes; then
-    while test $1 != '--mode=compile'; do
-      shift
-    done
-    shift
-  fi
-
-  # Remove `-o $object'.
-  IFS=" "
-  for arg
-  do
-    case $arg in
-    -o)
-      shift
-      ;;
-    $object)
-      shift
-      ;;
-    *)
-      set fnord "$@" "$arg"
-      shift # fnord
-      shift # $arg
-      ;;
-    esac
-  done
-
-  "$@" -E |
-    sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
-       -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
-    sed '$ s: \\$::' > "$tmpdepfile"
-  rm -f "$depfile"
-  echo "$object : \\" > "$depfile"
-  cat < "$tmpdepfile" >> "$depfile"
-  sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
-  rm -f "$tmpdepfile"
-  ;;
-
-msvisualcpp)
-  # Important note: in order to support this mode, a compiler *must*
-  # always write the preprocessed file to stdout, regardless of -o,
-  # because we must use -o when running libtool.
-  "$@" || exit $?
-  IFS=" "
-  for arg
-  do
-    case "$arg" in
-    "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
-	set fnord "$@"
-	shift
-	shift
-	;;
-    *)
-	set fnord "$@" "$arg"
-	shift
-	shift
-	;;
-    esac
-  done
-  "$@" -E |
-  sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
-  rm -f "$depfile"
-  echo "$object : \\" > "$depfile"
-  . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::	\1 \\:p' >> "$depfile"
-  echo "	" >> "$depfile"
-  . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
-  rm -f "$tmpdepfile"
-  ;;
-
-none)
-  exec "$@"
-  ;;
-
-*)
-  echo "Unknown depmode $depmode" 1>&2
-  exit 1
-  ;;
-esac
-
-exit 0
-
-# Local Variables:
-# mode: shell-script
-# sh-indentation: 2
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "scriptversion="
-# time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-end: "$"
-# End:
diff --git a/eglib/install-sh b/eglib/install-sh
deleted file mode 100755
index 4fbbae7..0000000
--- a/eglib/install-sh
+++ /dev/null
@@ -1,507 +0,0 @@
-#!/bin/sh
-# install - install a program, script, or datafile
-
-scriptversion=2006-10-14.15
-
-# This originates from X11R5 (mit/util/scripts/install.sh), which was
-# later released in X11R6 (xc/config/util/install.sh) with the
-# following copyright and license.
-#
-# Copyright (C) 1994 X Consortium
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to
-# deal in the Software without restriction, including without limitation the
-# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-# sell copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
-# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-# Except as contained in this notice, the name of the X Consortium shall not
-# be used in advertising or otherwise to promote the sale, use or other deal-
-# ings in this Software without prior written authorization from the X Consor-
-# tium.
-#
-#
-# FSF changes to this file are in the public domain.
-#
-# Calling this script install-sh is preferred over install.sh, to prevent
-# `make' implicit rules from creating a file called install from it
-# when there is no Makefile.
-#
-# This script is compatible with the BSD install script, but was written
-# from scratch.
-
-nl='
-'
-IFS=" ""	$nl"
-
-# set DOITPROG to echo to test this script
-
-# Don't use :- since 4.3BSD and earlier shells don't like it.
-doit="${DOITPROG-}"
-if test -z "$doit"; then
-  doit_exec=exec
-else
-  doit_exec=$doit
-fi
-
-# Put in absolute file names if you don't have them in your path;
-# or use environment vars.
-
-mvprog="${MVPROG-mv}"
-cpprog="${CPPROG-cp}"
-chmodprog="${CHMODPROG-chmod}"
-chownprog="${CHOWNPROG-chown}"
-chgrpprog="${CHGRPPROG-chgrp}"
-stripprog="${STRIPPROG-strip}"
-rmprog="${RMPROG-rm}"
-mkdirprog="${MKDIRPROG-mkdir}"
-
-posix_glob=
-posix_mkdir=
-
-# Desired mode of installed file.
-mode=0755
-
-chmodcmd=$chmodprog
-chowncmd=
-chgrpcmd=
-stripcmd=
-rmcmd="$rmprog -f"
-mvcmd="$mvprog"
-src=
-dst=
-dir_arg=
-dstarg=
-no_target_directory=
-
-usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
-   or: $0 [OPTION]... SRCFILES... DIRECTORY
-   or: $0 [OPTION]... -t DIRECTORY SRCFILES...
-   or: $0 [OPTION]... -d DIRECTORIES...
-
-In the 1st form, copy SRCFILE to DSTFILE.
-In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
-In the 4th, create DIRECTORIES.
-
-Options:
--c         (ignored)
--d         create directories instead of installing files.
--g GROUP   $chgrpprog installed files to GROUP.
--m MODE    $chmodprog installed files to MODE.
--o USER    $chownprog installed files to USER.
--s         $stripprog installed files.
--t DIRECTORY  install into DIRECTORY.
--T         report an error if DSTFILE is a directory.
---help     display this help and exit.
---version  display version info and exit.
-
-Environment variables override the default commands:
-  CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
-"
-
-while test $# -ne 0; do
-  case $1 in
-    -c) shift
-        continue;;
-
-    -d) dir_arg=true
-        shift
-        continue;;
-
-    -g) chgrpcmd="$chgrpprog $2"
-        shift
-        shift
-        continue;;
-
-    --help) echo "$usage"; exit $?;;
-
-    -m) mode=$2
-        shift
-        shift
-	case $mode in
-	  *' '* | *'	'* | *'
-'*	  | *'*'* | *'?'* | *'['*)
-	    echo "$0: invalid mode: $mode" >&2
-	    exit 1;;
-	esac
-        continue;;
-
-    -o) chowncmd="$chownprog $2"
-        shift
-        shift
-        continue;;
-
-    -s) stripcmd=$stripprog
-        shift
-        continue;;
-
-    -t) dstarg=$2
-	shift
-	shift
-	continue;;
-
-    -T) no_target_directory=true
-	shift
-	continue;;
-
-    --version) echo "$0 $scriptversion"; exit $?;;
-
-    --)	shift
-	break;;
-
-    -*)	echo "$0: invalid option: $1" >&2
-	exit 1;;
-
-    *)  break;;
-  esac
-done
-
-if test $# -ne 0 && test -z "$dir_arg$dstarg"; then
-  # When -d is used, all remaining arguments are directories to create.
-  # When -t is used, the destination is already specified.
-  # Otherwise, the last argument is the destination.  Remove it from $@.
-  for arg
-  do
-    if test -n "$dstarg"; then
-      # $@ is not empty: it contains at least $arg.
-      set fnord "$@" "$dstarg"
-      shift # fnord
-    fi
-    shift # arg
-    dstarg=$arg
-  done
-fi
-
-if test $# -eq 0; then
-  if test -z "$dir_arg"; then
-    echo "$0: no input file specified." >&2
-    exit 1
-  fi
-  # It's OK to call `install-sh -d' without argument.
-  # This can happen when creating conditional directories.
-  exit 0
-fi
-
-if test -z "$dir_arg"; then
-  trap '(exit $?); exit' 1 2 13 15
-
-  # Set umask so as not to create temps with too-generous modes.
-  # However, 'strip' requires both read and write access to temps.
-  case $mode in
-    # Optimize common cases.
-    *644) cp_umask=133;;
-    *755) cp_umask=22;;
-
-    *[0-7])
-      if test -z "$stripcmd"; then
-	u_plus_rw=
-      else
-	u_plus_rw='% 200'
-      fi
-      cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
-    *)
-      if test -z "$stripcmd"; then
-	u_plus_rw=
-      else
-	u_plus_rw=,u+rw
-      fi
-      cp_umask=$mode$u_plus_rw;;
-  esac
-fi
-
-for src
-do
-  # Protect names starting with `-'.
-  case $src in
-    -*) src=./$src ;;
-  esac
-
-  if test -n "$dir_arg"; then
-    dst=$src
-    dstdir=$dst
-    test -d "$dstdir"
-    dstdir_status=$?
-  else
-
-    # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
-    # might cause directories to be created, which would be especially bad
-    # if $src (and thus $dsttmp) contains '*'.
-    if test ! -f "$src" && test ! -d "$src"; then
-      echo "$0: $src does not exist." >&2
-      exit 1
-    fi
-
-    if test -z "$dstarg"; then
-      echo "$0: no destination specified." >&2
-      exit 1
-    fi
-
-    dst=$dstarg
-    # Protect names starting with `-'.
-    case $dst in
-      -*) dst=./$dst ;;
-    esac
-
-    # If destination is a directory, append the input filename; won't work
-    # if double slashes aren't ignored.
-    if test -d "$dst"; then
-      if test -n "$no_target_directory"; then
-	echo "$0: $dstarg: Is a directory" >&2
-	exit 1
-      fi
-      dstdir=$dst
-      dst=$dstdir/`basename "$src"`
-      dstdir_status=0
-    else
-      # Prefer dirname, but fall back on a substitute if dirname fails.
-      dstdir=`
-	(dirname "$dst") 2>/dev/null ||
-	expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-	     X"$dst" : 'X\(//\)[^/]' \| \
-	     X"$dst" : 'X\(//\)$' \| \
-	     X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
-	echo X"$dst" |
-	    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
-		   s//\1/
-		   q
-		 }
-		 /^X\(\/\/\)[^/].*/{
-		   s//\1/
-		   q
-		 }
-		 /^X\(\/\/\)$/{
-		   s//\1/
-		   q
-		 }
-		 /^X\(\/\).*/{
-		   s//\1/
-		   q
-		 }
-		 s/.*/./; q'
-      `
-
-      test -d "$dstdir"
-      dstdir_status=$?
-    fi
-  fi
-
-  obsolete_mkdir_used=false
-
-  if test $dstdir_status != 0; then
-    case $posix_mkdir in
-      '')
-	# Create intermediate dirs using mode 755 as modified by the umask.
-	# This is like FreeBSD 'install' as of 1997-10-28.
-	umask=`umask`
-	case $stripcmd.$umask in
-	  # Optimize common cases.
-	  *[2367][2367]) mkdir_umask=$umask;;
-	  .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
-
-	  *[0-7])
-	    mkdir_umask=`expr $umask + 22 \
-	      - $umask % 100 % 40 + $umask % 20 \
-	      - $umask % 10 % 4 + $umask % 2
-	    `;;
-	  *) mkdir_umask=$umask,go-w;;
-	esac
-
-	# With -d, create the new directory with the user-specified mode.
-	# Otherwise, rely on $mkdir_umask.
-	if test -n "$dir_arg"; then
-	  mkdir_mode=-m$mode
-	else
-	  mkdir_mode=
-	fi
-
-	posix_mkdir=false
-	case $umask in
-	  *[123567][0-7][0-7])
-	    # POSIX mkdir -p sets u+wx bits regardless of umask, which
-	    # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
-	    ;;
-	  *)
-	    tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
-	    trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
-
-	    if (umask $mkdir_umask &&
-		exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
-	    then
-	      if test -z "$dir_arg" || {
-		   # Check for POSIX incompatibilities with -m.
-		   # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
-		   # other-writeable bit of parent directory when it shouldn't.
-		   # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
-		   ls_ld_tmpdir=`ls -ld "$tmpdir"`
-		   case $ls_ld_tmpdir in
-		     d????-?r-*) different_mode=700;;
-		     d????-?--*) different_mode=755;;
-		     *) false;;
-		   esac &&
-		   $mkdirprog -m$different_mode -p -- "$tmpdir" && {
-		     ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
-		     test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
-		   }
-		 }
-	      then posix_mkdir=:
-	      fi
-	      rmdir "$tmpdir/d" "$tmpdir"
-	    else
-	      # Remove any dirs left behind by ancient mkdir implementations.
-	      rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
-	    fi
-	    trap '' 0;;
-	esac;;
-    esac
-
-    if
-      $posix_mkdir && (
-	umask $mkdir_umask &&
-	$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
-      )
-    then :
-    else
-
-      # The umask is ridiculous, or mkdir does not conform to POSIX,
-      # or it failed possibly due to a race condition.  Create the
-      # directory the slow way, step by step, checking for races as we go.
-
-      case $dstdir in
-	/*) prefix=/ ;;
-	-*) prefix=./ ;;
-	*)  prefix= ;;
-      esac
-
-      case $posix_glob in
-        '')
-	  if (set -f) 2>/dev/null; then
-	    posix_glob=true
-	  else
-	    posix_glob=false
-	  fi ;;
-      esac
-
-      oIFS=$IFS
-      IFS=/
-      $posix_glob && set -f
-      set fnord $dstdir
-      shift
-      $posix_glob && set +f
-      IFS=$oIFS
-
-      prefixes=
-
-      for d
-      do
-	test -z "$d" && continue
-
-	prefix=$prefix$d
-	if test -d "$prefix"; then
-	  prefixes=
-	else
-	  if $posix_mkdir; then
-	    (umask=$mkdir_umask &&
-	     $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
-	    # Don't fail if two instances are running concurrently.
-	    test -d "$prefix" || exit 1
-	  else
-	    case $prefix in
-	      *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
-	      *) qprefix=$prefix;;
-	    esac
-	    prefixes="$prefixes '$qprefix'"
-	  fi
-	fi
-	prefix=$prefix/
-      done
-
-      if test -n "$prefixes"; then
-	# Don't fail if two instances are running concurrently.
-	(umask $mkdir_umask &&
-	 eval "\$doit_exec \$mkdirprog $prefixes") ||
-	  test -d "$dstdir" || exit 1
-	obsolete_mkdir_used=true
-      fi
-    fi
-  fi
-
-  if test -n "$dir_arg"; then
-    { test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
-    { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
-    { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
-      test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
-  else
-
-    # Make a couple of temp file names in the proper directory.
-    dsttmp=$dstdir/_inst.$$_
-    rmtmp=$dstdir/_rm.$$_
-
-    # Trap to clean up those temp files at exit.
-    trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
-
-    # Copy the file name to the temp name.
-    (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
-
-    # and set any options; do chmod last to preserve setuid bits.
-    #
-    # If any of these fail, we abort the whole thing.  If we want to
-    # ignore errors from any of these, just make sure not to ignore
-    # errors from the above "$doit $cpprog $src $dsttmp" command.
-    #
-    { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
-      && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
-      && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
-      && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
-
-    # Now rename the file to the real destination.
-    { $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null \
-      || {
-	   # The rename failed, perhaps because mv can't rename something else
-	   # to itself, or perhaps because mv is so ancient that it does not
-	   # support -f.
-
-	   # Now remove or move aside any old file at destination location.
-	   # We try this two ways since rm can't unlink itself on some
-	   # systems and the destination file might be busy for other
-	   # reasons.  In this case, the final cleanup might fail but the new
-	   # file should still install successfully.
-	   {
-	     if test -f "$dst"; then
-	       $doit $rmcmd -f "$dst" 2>/dev/null \
-	       || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null \
-		     && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }; }\
-	       || {
-		 echo "$0: cannot unlink or rename $dst" >&2
-		 (exit 1); exit 1
-	       }
-	     else
-	       :
-	     fi
-	   } &&
-
-	   # Now rename the file to the real destination.
-	   $doit $mvcmd "$dsttmp" "$dst"
-	 }
-    } || exit 1
-
-    trap '' 0
-  fi
-done
-
-# Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "scriptversion="
-# time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-end: "$"
-# End:
diff --git a/eglib/ltmain.sh b/eglib/ltmain.sh
deleted file mode 100755
index 950feee..0000000
--- a/eglib/ltmain.sh
+++ /dev/null
@@ -1,8406 +0,0 @@
-# Generated from ltmain.m4sh.
-
-# ltmain.sh (GNU libtool) 2.2.6b
-# Written by Gordon Matzigkeit <gord at gnu.ai.mit.edu>, 1996
-
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 2008 Free Software Foundation, Inc.
-# This is free software; see the source for copying conditions.  There is NO
-# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
-# GNU Libtool is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# As a special exception to the GNU General Public License,
-# if you distribute this file as part of a program or library that
-# is built using GNU Libtool, you may include this file under the
-# same distribution terms that you use for the rest of that program.
-#
-# GNU Libtool is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GNU Libtool; see the file COPYING.  If not, a copy
-# can be downloaded from http://www.gnu.org/licenses/gpl.html,
-# or obtained by writing to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
-# Usage: $progname [OPTION]... [MODE-ARG]...
-#
-# Provide generalized library-building support services.
-#
-#     --config             show all configuration variables
-#     --debug              enable verbose shell tracing
-# -n, --dry-run            display commands without modifying any files
-#     --features           display basic configuration information and exit
-#     --mode=MODE          use operation mode MODE
-#     --preserve-dup-deps  don't remove duplicate dependency libraries
-#     --quiet, --silent    don't print informational messages
-#     --tag=TAG            use configuration variables from tag TAG
-# -v, --verbose            print informational messages (default)
-#     --version            print version information
-# -h, --help               print short or long help message
-#
-# MODE must be one of the following:
-#
-#       clean              remove files from the build directory
-#       compile            compile a source file into a libtool object
-#       execute            automatically set library path, then run a program
-#       finish             complete the installation of libtool libraries
-#       install            install libraries or executables
-#       link               create a library or an executable
-#       uninstall          remove libraries from an installed directory
-#
-# MODE-ARGS vary depending on the MODE.
-# Try `$progname --help --mode=MODE' for a more detailed description of MODE.
-#
-# When reporting a bug, please describe a test case to reproduce it and
-# include the following information:
-#
-#       host-triplet:	$host
-#       shell:		$SHELL
-#       compiler:		$LTCC
-#       compiler flags:		$LTCFLAGS
-#       linker:		$LD (gnu? $with_gnu_ld)
-#       $progname:		(GNU libtool) 2.2.6b
-#       automake:		$automake_version
-#       autoconf:		$autoconf_version
-#
-# Report bugs to <bug-libtool at gnu.org>.
-
-PROGRAM=ltmain.sh
-PACKAGE=libtool
-VERSION=2.2.6b
-TIMESTAMP=""
-package_revision=1.3018
-
-# Be Bourne compatible
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
-  emulate sh
-  NULLCMD=:
-  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
-  # is contrary to our usage.  Disable this feature.
-  alias -g '${1+"$@"}'='"$@"'
-  setopt NO_GLOB_SUBST
-else
-  case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
-fi
-BIN_SH=xpg4; export BIN_SH # for Tru64
-DUALCASE=1; export DUALCASE # for MKS sh
-
-# NLS nuisances: We save the old values to restore during execute mode.
-# Only set LANG and LC_ALL to C if already set.
-# These must not be set unconditionally because not all systems understand
-# e.g. LANG=C (notably SCO).
-lt_user_locale=
-lt_safe_locale=
-for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
-do
-  eval "if test \"\${$lt_var+set}\" = set; then
-          save_$lt_var=\$$lt_var
-          $lt_var=C
-	  export $lt_var
-	  lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\"
-	  lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
-	fi"
-done
-
-$lt_unset CDPATH
-
-
-
-
-
-: ${CP="cp -f"}
-: ${ECHO="echo"}
-: ${EGREP="/usr/bin/grep -E"}
-: ${FGREP="/usr/bin/grep -F"}
-: ${GREP="/usr/bin/grep"}
-: ${LN_S="ln -s"}
-: ${MAKE="make"}
-: ${MKDIR="mkdir"}
-: ${MV="mv -f"}
-: ${RM="rm -f"}
-: ${SED="/usr/bin/sed"}
-: ${SHELL="${CONFIG_SHELL-/bin/sh}"}
-: ${Xsed="$SED -e 1s/^X//"}
-
-# Global variables:
-EXIT_SUCCESS=0
-EXIT_FAILURE=1
-EXIT_MISMATCH=63  # $? = 63 is used to indicate version mismatch to missing.
-EXIT_SKIP=77	  # $? = 77 is used to indicate a skipped test to automake.
-
-exit_status=$EXIT_SUCCESS
-
-# Make sure IFS has a sensible default
-lt_nl='
-'
-IFS=" 	$lt_nl"
-
-dirname="s,/[^/]*$,,"
-basename="s,^.*/,,"
-
-# func_dirname_and_basename file append nondir_replacement
-# perform func_basename and func_dirname in a single function
-# call:
-#   dirname:  Compute the dirname of FILE.  If nonempty,
-#             add APPEND to the result, otherwise set result
-#             to NONDIR_REPLACEMENT.
-#             value returned in "$func_dirname_result"
-#   basename: Compute filename of FILE.
-#             value retuned in "$func_basename_result"
-# Implementation must be kept synchronized with func_dirname
-# and func_basename. For efficiency, we do not delegate to
-# those functions but instead duplicate the functionality here.
-func_dirname_and_basename ()
-{
-  # Extract subdirectory from the argument.
-  func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"`
-  if test "X$func_dirname_result" = "X${1}"; then
-    func_dirname_result="${3}"
-  else
-    func_dirname_result="$func_dirname_result${2}"
-  fi
-  func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"`
-}
-
-# Generated shell functions inserted here.
-
-# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
-# is ksh but when the shell is invoked as "sh" and the current value of
-# the _XPG environment variable is not equal to 1 (one), the special
-# positional parameter $0, within a function call, is the name of the
-# function.
-progpath="$0"
-
-# The name of this program:
-# In the unlikely event $progname began with a '-', it would play havoc with
-# func_echo (imagine progname=-n), so we prepend ./ in that case:
-func_dirname_and_basename "$progpath"
-progname=$func_basename_result
-case $progname in
-  -*) progname=./$progname ;;
-esac
-
-# Make sure we have an absolute path for reexecution:
-case $progpath in
-  [\\/]*|[A-Za-z]:\\*) ;;
-  *[\\/]*)
-     progdir=$func_dirname_result
-     progdir=`cd "$progdir" && pwd`
-     progpath="$progdir/$progname"
-     ;;
-  *)
-     save_IFS="$IFS"
-     IFS=:
-     for progdir in $PATH; do
-       IFS="$save_IFS"
-       test -x "$progdir/$progname" && break
-     done
-     IFS="$save_IFS"
-     test -n "$progdir" || progdir=`pwd`
-     progpath="$progdir/$progname"
-     ;;
-esac
-
-# Sed substitution that helps us do robust quoting.  It backslashifies
-# metacharacters that are still active within double-quoted strings.
-Xsed="${SED}"' -e 1s/^X//'
-sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
-
-# Same as above, but do not quote variable references.
-double_quote_subst='s/\(["`\\]\)/\\\1/g'
-
-# Re-`\' parameter expansions in output of double_quote_subst that were
-# `\'-ed in input to the same.  If an odd number of `\' preceded a '$'
-# in input to double_quote_subst, that '$' was protected from expansion.
-# Since each input `\' is now two `\'s, look for any number of runs of
-# four `\'s followed by two `\'s and then a '$'.  `\' that '$'.
-bs='\\'
-bs2='\\\\'
-bs4='\\\\\\\\'
-dollar='\$'
-sed_double_backslash="\
-  s/$bs4/&\\
-/g
-  s/^$bs2$dollar/$bs&/
-  s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
-  s/\n//g"
-
-# Standard options:
-opt_dry_run=false
-opt_help=false
-opt_quiet=false
-opt_verbose=false
-opt_warning=:
-
-# func_echo arg...
-# Echo program name prefixed message, along with the current mode
-# name if it has been set yet.
-func_echo ()
-{
-    $ECHO "$progname${mode+: }$mode: $*"
-}
-
-# func_verbose arg...
-# Echo program name prefixed message in verbose mode only.
-func_verbose ()
-{
-    $opt_verbose && func_echo ${1+"$@"}
-
-    # A bug in bash halts the script if the last line of a function
-    # fails when set -e is in force, so we need another command to
-    # work around that:
-    :
-}
-
-# func_error arg...
-# Echo program name prefixed message to standard error.
-func_error ()
-{
-    $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2
-}
-
-# func_warning arg...
-# Echo program name prefixed warning message to standard error.
-func_warning ()
-{
-    $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2
-
-    # bash bug again:
-    :
-}
-
-# func_fatal_error arg...
-# Echo program name prefixed message to standard error, and exit.
-func_fatal_error ()
-{
-    func_error ${1+"$@"}
-    exit $EXIT_FAILURE
-}
-
-# func_fatal_help arg...
-# Echo program name prefixed message to standard error, followed by
-# a help hint, and exit.
-func_fatal_help ()
-{
-    func_error ${1+"$@"}
-    func_fatal_error "$help"
-}
-help="Try \`$progname --help' for more information."  ## default
-
-
-# func_grep expression filename
-# Check whether EXPRESSION matches any line of FILENAME, without output.
-func_grep ()
-{
-    $GREP "$1" "$2" >/dev/null 2>&1
-}
-
-
-# func_mkdir_p directory-path
-# Make sure the entire path to DIRECTORY-PATH is available.
-func_mkdir_p ()
-{
-    my_directory_path="$1"
-    my_dir_list=
-
-    if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
-
-      # Protect directory names starting with `-'
-      case $my_directory_path in
-        -*) my_directory_path="./$my_directory_path" ;;
-      esac
-
-      # While some portion of DIR does not yet exist...
-      while test ! -d "$my_directory_path"; do
-        # ...make a list in topmost first order.  Use a colon delimited
-	# list incase some portion of path contains whitespace.
-        my_dir_list="$my_directory_path:$my_dir_list"
-
-        # If the last portion added has no slash in it, the list is done
-        case $my_directory_path in */*) ;; *) break ;; esac
-
-        # ...otherwise throw away the child directory and loop
-        my_directory_path=`$ECHO "X$my_directory_path" | $Xsed -e "$dirname"`
-      done
-      my_dir_list=`$ECHO "X$my_dir_list" | $Xsed -e 's,:*$,,'`
-
-      save_mkdir_p_IFS="$IFS"; IFS=':'
-      for my_dir in $my_dir_list; do
-	IFS="$save_mkdir_p_IFS"
-        # mkdir can fail with a `File exist' error if two processes
-        # try to create one of the directories concurrently.  Don't
-        # stop in that case!
-        $MKDIR "$my_dir" 2>/dev/null || :
-      done
-      IFS="$save_mkdir_p_IFS"
-
-      # Bail out if we (or some other process) failed to create a directory.
-      test -d "$my_directory_path" || \
-        func_fatal_error "Failed to create \`$1'"
-    fi
-}
-
-
-# func_mktempdir [string]
-# Make a temporary directory that won't clash with other running
-# libtool processes, and avoids race conditions if possible.  If
-# given, STRING is the basename for that directory.
-func_mktempdir ()
-{
-    my_template="${TMPDIR-/tmp}/${1-$progname}"
-
-    if test "$opt_dry_run" = ":"; then
-      # Return a directory name, but don't create it in dry-run mode
-      my_tmpdir="${my_template}-$$"
-    else
-
-      # If mktemp works, use that first and foremost
-      my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
-
-      if test ! -d "$my_tmpdir"; then
-        # Failing that, at least try and use $RANDOM to avoid a race
-        my_tmpdir="${my_template}-${RANDOM-0}$$"
-
-        save_mktempdir_umask=`umask`
-        umask 0077
-        $MKDIR "$my_tmpdir"
-        umask $save_mktempdir_umask
-      fi
-
-      # If we're not in dry-run mode, bomb out on failure
-      test -d "$my_tmpdir" || \
-        func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
-    fi
-
-    $ECHO "X$my_tmpdir" | $Xsed
-}
-
-
-# func_quote_for_eval arg
-# Aesthetically quote ARG to be evaled later.
-# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
-# is double-quoted, suitable for a subsequent eval, whereas
-# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
-# which are still active within double quotes backslashified.
-func_quote_for_eval ()
-{
-    case $1 in
-      *[\\\`\"\$]*)
-	func_quote_for_eval_unquoted_result=`$ECHO "X$1" | $Xsed -e "$sed_quote_subst"` ;;
-      *)
-        func_quote_for_eval_unquoted_result="$1" ;;
-    esac
-
-    case $func_quote_for_eval_unquoted_result in
-      # Double-quote args containing shell metacharacters to delay
-      # word splitting, command substitution and and variable
-      # expansion for a subsequent eval.
-      # Many Bourne shells cannot handle close brackets correctly
-      # in scan sets, so we specify it separately.
-      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
-        func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
-        ;;
-      *)
-        func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
-    esac
-}
-
-
-# func_quote_for_expand arg
-# Aesthetically quote ARG to be evaled later; same as above,
-# but do not quote variable references.
-func_quote_for_expand ()
-{
-    case $1 in
-      *[\\\`\"]*)
-	my_arg=`$ECHO "X$1" | $Xsed \
-	    -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
-      *)
-        my_arg="$1" ;;
-    esac
-
-    case $my_arg in
-      # Double-quote args containing shell metacharacters to delay
-      # word splitting and command substitution for a subsequent eval.
-      # Many Bourne shells cannot handle close brackets correctly
-      # in scan sets, so we specify it separately.
-      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
-        my_arg="\"$my_arg\""
-        ;;
-    esac
-
-    func_quote_for_expand_result="$my_arg"
-}
-
-
-# func_show_eval cmd [fail_exp]
-# Unless opt_silent is true, then output CMD.  Then, if opt_dryrun is
-# not true, evaluate CMD.  If the evaluation of CMD fails, and FAIL_EXP
-# is given, then evaluate it.
-func_show_eval ()
-{
-    my_cmd="$1"
-    my_fail_exp="${2-:}"
-
-    ${opt_silent-false} || {
-      func_quote_for_expand "$my_cmd"
-      eval "func_echo $func_quote_for_expand_result"
-    }
-
-    if ${opt_dry_run-false}; then :; else
-      eval "$my_cmd"
-      my_status=$?
-      if test "$my_status" -eq 0; then :; else
-	eval "(exit $my_status); $my_fail_exp"
-      fi
-    fi
-}
-
-
-# func_show_eval_locale cmd [fail_exp]
-# Unless opt_silent is true, then output CMD.  Then, if opt_dryrun is
-# not true, evaluate CMD.  If the evaluation of CMD fails, and FAIL_EXP
-# is given, then evaluate it.  Use the saved locale for evaluation.
-func_show_eval_locale ()
-{
-    my_cmd="$1"
-    my_fail_exp="${2-:}"
-
-    ${opt_silent-false} || {
-      func_quote_for_expand "$my_cmd"
-      eval "func_echo $func_quote_for_expand_result"
-    }
-
-    if ${opt_dry_run-false}; then :; else
-      eval "$lt_user_locale
-	    $my_cmd"
-      my_status=$?
-      eval "$lt_safe_locale"
-      if test "$my_status" -eq 0; then :; else
-	eval "(exit $my_status); $my_fail_exp"
-      fi
-    fi
-}
-
-
-
-
-
-# func_version
-# Echo version message to standard output and exit.
-func_version ()
-{
-    $SED -n '/^# '$PROGRAM' (GNU /,/# warranty; / {
-        s/^# //
-	s/^# *$//
-        s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
-        p
-     }' < "$progpath"
-     exit $?
-}
-
-# func_usage
-# Echo short help message to standard output and exit.
-func_usage ()
-{
-    $SED -n '/^# Usage:/,/# -h/ {
-        s/^# //
-	s/^# *$//
-	s/\$progname/'$progname'/
-	p
-    }' < "$progpath"
-    $ECHO
-    $ECHO "run \`$progname --help | more' for full usage"
-    exit $?
-}
-
-# func_help
-# Echo long help message to standard output and exit.
-func_help ()
-{
-    $SED -n '/^# Usage:/,/# Report bugs to/ {
-        s/^# //
-	s/^# *$//
-	s*\$progname*'$progname'*
-	s*\$host*'"$host"'*
-	s*\$SHELL*'"$SHELL"'*
-	s*\$LTCC*'"$LTCC"'*
-	s*\$LTCFLAGS*'"$LTCFLAGS"'*
-	s*\$LD*'"$LD"'*
-	s/\$with_gnu_ld/'"$with_gnu_ld"'/
-	s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/
-	s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/
-	p
-     }' < "$progpath"
-    exit $?
-}
-
-# func_missing_arg argname
-# Echo program name prefixed message to standard error and set global
-# exit_cmd.
-func_missing_arg ()
-{
-    func_error "missing argument for $1"
-    exit_cmd=exit
-}
-
-exit_cmd=:
-
-
-
-
-
-# Check that we have a working $ECHO.
-if test "X$1" = X--no-reexec; then
-  # Discard the --no-reexec flag, and continue.
-  shift
-elif test "X$1" = X--fallback-echo; then
-  # Avoid inline document here, it may be left over
-  :
-elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then
-  # Yippee, $ECHO works!
-  :
-else
-  # Restart under the correct shell, and then maybe $ECHO will work.
-  exec $SHELL "$progpath" --no-reexec ${1+"$@"}
-fi
-
-if test "X$1" = X--fallback-echo; then
-  # used as fallback echo
-  shift
-  cat <<EOF
-$*
-EOF
-  exit $EXIT_SUCCESS
-fi
-
-magic="%%%MAGIC variable%%%"
-magic_exe="%%%MAGIC EXE variable%%%"
-
-# Global variables.
-# $mode is unset
-nonopt=
-execute_dlfiles=
-preserve_args=
-lo2o="s/\\.lo\$/.${objext}/"
-o2lo="s/\\.${objext}\$/.lo/"
-extracted_archives=
-extracted_serial=0
-
-opt_dry_run=false
-opt_duplicate_deps=false
-opt_silent=false
-opt_debug=:
-
-# If this variable is set in any of the actions, the command in it
-# will be execed at the end.  This prevents here-documents from being
-# left over by shells.
-exec_cmd=
-
-# func_fatal_configuration arg...
-# Echo program name prefixed message to standard error, followed by
-# a configuration failure hint, and exit.
-func_fatal_configuration ()
-{
-    func_error ${1+"$@"}
-    func_error "See the $PACKAGE documentation for more information."
-    func_fatal_error "Fatal configuration error."
-}
-
-
-# func_config
-# Display the configuration for all the tags in this script.
-func_config ()
-{
-    re_begincf='^# ### BEGIN LIBTOOL'
-    re_endcf='^# ### END LIBTOOL'
-
-    # Default configuration.
-    $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
-
-    # Now print the configurations for the tags.
-    for tagname in $taglist; do
-      $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
-    done
-
-    exit $?
-}
-
-# func_features
-# Display the features supported by this script.
-func_features ()
-{
-    $ECHO "host: $host"
-    if test "$build_libtool_libs" = yes; then
-      $ECHO "enable shared libraries"
-    else
-      $ECHO "disable shared libraries"
-    fi
-    if test "$build_old_libs" = yes; then
-      $ECHO "enable static libraries"
-    else
-      $ECHO "disable static libraries"
-    fi
-
-    exit $?
-}
-
-# func_enable_tag tagname
-# Verify that TAGNAME is valid, and either flag an error and exit, or
-# enable the TAGNAME tag.  We also add TAGNAME to the global $taglist
-# variable here.
-func_enable_tag ()
-{
-  # Global variable:
-  tagname="$1"
-
-  re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
-  re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
-  sed_extractcf="/$re_begincf/,/$re_endcf/p"
-
-  # Validate tagname.
-  case $tagname in
-    *[!-_A-Za-z0-9,/]*)
-      func_fatal_error "invalid tag name: $tagname"
-      ;;
-  esac
-
-  # Don't test for the "default" C tag, as we know it's
-  # there but not specially marked.
-  case $tagname in
-    CC) ;;
-    *)
-      if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
-	taglist="$taglist $tagname"
-
-	# Evaluate the configuration.  Be careful to quote the path
-	# and the sed script, to avoid splitting on whitespace, but
-	# also don't use non-portable quotes within backquotes within
-	# quotes we have to do it in 2 steps:
-	extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
-	eval "$extractedcf"
-      else
-	func_error "ignoring unknown tag $tagname"
-      fi
-      ;;
-  esac
-}
-
-# Parse options once, thoroughly.  This comes as soon as possible in
-# the script to make things like `libtool --version' happen quickly.
-{
-
-  # Shorthand for --mode=foo, only valid as the first argument
-  case $1 in
-  clean|clea|cle|cl)
-    shift; set dummy --mode clean ${1+"$@"}; shift
-    ;;
-  compile|compil|compi|comp|com|co|c)
-    shift; set dummy --mode compile ${1+"$@"}; shift
-    ;;
-  execute|execut|execu|exec|exe|ex|e)
-    shift; set dummy --mode execute ${1+"$@"}; shift
-    ;;
-  finish|finis|fini|fin|fi|f)
-    shift; set dummy --mode finish ${1+"$@"}; shift
-    ;;
-  install|instal|insta|inst|ins|in|i)
-    shift; set dummy --mode install ${1+"$@"}; shift
-    ;;
-  link|lin|li|l)
-    shift; set dummy --mode link ${1+"$@"}; shift
-    ;;
-  uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
-    shift; set dummy --mode uninstall ${1+"$@"}; shift
-    ;;
-  esac
-
-  # Parse non-mode specific arguments:
-  while test "$#" -gt 0; do
-    opt="$1"
-    shift
-
-    case $opt in
-      --config)		func_config					;;
-
-      --debug)		preserve_args="$preserve_args $opt"
-			func_echo "enabling shell trace mode"
-			opt_debug='set -x'
-			$opt_debug
-			;;
-
-      -dlopen)		test "$#" -eq 0 && func_missing_arg "$opt" && break
-			execute_dlfiles="$execute_dlfiles $1"
-			shift
-			;;
-
-      --dry-run | -n)	opt_dry_run=:					;;
-      --features)       func_features					;;
-      --finish)		mode="finish"					;;
-
-      --mode)		test "$#" -eq 0 && func_missing_arg "$opt" && break
-			case $1 in
-			  # Valid mode arguments:
-			  clean)	;;
-			  compile)	;;
-			  execute)	;;
-			  finish)	;;
-			  install)	;;
-			  link)		;;
-			  relink)	;;
-			  uninstall)	;;
-
-			  # Catch anything else as an error
-			  *) func_error "invalid argument for $opt"
-			     exit_cmd=exit
-			     break
-			     ;;
-		        esac
-
-			mode="$1"
-			shift
-			;;
-
-      --preserve-dup-deps)
-			opt_duplicate_deps=:				;;
-
-      --quiet|--silent)	preserve_args="$preserve_args $opt"
-			opt_silent=:
-			;;
-
-      --verbose| -v)	preserve_args="$preserve_args $opt"
-			opt_silent=false
-			;;
-
-      --tag)		test "$#" -eq 0 && func_missing_arg "$opt" && break
-			preserve_args="$preserve_args $opt $1"
-			func_enable_tag "$1"	# tagname is set here
-			shift
-			;;
-
-      # Separate optargs to long options:
-      -dlopen=*|--mode=*|--tag=*)
-			func_opt_split "$opt"
-			set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"}
-			shift
-			;;
-
-      -\?|-h)		func_usage					;;
-      --help)		opt_help=:					;;
-      --version)	func_version					;;
-
-      -*)		func_fatal_help "unrecognized option \`$opt'"	;;
-
-      *)		nonopt="$opt"
-			break
-			;;
-    esac
-  done
-
-
-  case $host in
-    *cygwin* | *mingw* | *pw32* | *cegcc*)
-      # don't eliminate duplications in $postdeps and $predeps
-      opt_duplicate_compiler_generated_deps=:
-      ;;
-    *)
-      opt_duplicate_compiler_generated_deps=$opt_duplicate_deps
-      ;;
-  esac
-
-  # Having warned about all mis-specified options, bail out if
-  # anything was wrong.
-  $exit_cmd $EXIT_FAILURE
-}
-
-# func_check_version_match
-# Ensure that we are using m4 macros, and libtool script from the same
-# release of libtool.
-func_check_version_match ()
-{
-  if test "$package_revision" != "$macro_revision"; then
-    if test "$VERSION" != "$macro_version"; then
-      if test -z "$macro_version"; then
-        cat >&2 <<_LT_EOF
-$progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
-$progname: definition of this LT_INIT comes from an older release.
-$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
-$progname: and run autoconf again.
-_LT_EOF
-      else
-        cat >&2 <<_LT_EOF
-$progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
-$progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
-$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
-$progname: and run autoconf again.
-_LT_EOF
-      fi
-    else
-      cat >&2 <<_LT_EOF
-$progname: Version mismatch error.  This is $PACKAGE $VERSION, revision $package_revision,
-$progname: but the definition of this LT_INIT comes from revision $macro_revision.
-$progname: You should recreate aclocal.m4 with macros from revision $package_revision
-$progname: of $PACKAGE $VERSION and run autoconf again.
-_LT_EOF
-    fi
-
-    exit $EXIT_MISMATCH
-  fi
-}
-
-
-## ----------- ##
-##    Main.    ##
-## ----------- ##
-
-$opt_help || {
-  # Sanity checks first:
-  func_check_version_match
-
-  if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
-    func_fatal_configuration "not configured to build any kind of library"
-  fi
-
-  test -z "$mode" && func_fatal_error "error: you must specify a MODE."
-
-
-  # Darwin sucks
-  eval std_shrext=\"$shrext_cmds\"
-
-
-  # Only execute mode is allowed to have -dlopen flags.
-  if test -n "$execute_dlfiles" && test "$mode" != execute; then
-    func_error "unrecognized option \`-dlopen'"
-    $ECHO "$help" 1>&2
-    exit $EXIT_FAILURE
-  fi
-
-  # Change the help message to a mode-specific one.
-  generic_help="$help"
-  help="Try \`$progname --help --mode=$mode' for more information."
-}
-
-
-# func_lalib_p file
-# True iff FILE is a libtool `.la' library or `.lo' object file.
-# This function is only a basic sanity check; it will hardly flush out
-# determined imposters.
-func_lalib_p ()
-{
-    test -f "$1" &&
-      $SED -e 4q "$1" 2>/dev/null \
-        | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
-}
-
-# func_lalib_unsafe_p file
-# True iff FILE is a libtool `.la' library or `.lo' object file.
-# This function implements the same check as func_lalib_p without
-# resorting to external programs.  To this end, it redirects stdin and
-# closes it afterwards, without saving the original file descriptor.
-# As a safety measure, use it only where a negative result would be
-# fatal anyway.  Works if `file' does not exist.
-func_lalib_unsafe_p ()
-{
-    lalib_p=no
-    if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
-	for lalib_p_l in 1 2 3 4
-	do
-	    read lalib_p_line
-	    case "$lalib_p_line" in
-		\#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
-	    esac
-	done
-	exec 0<&5 5<&-
-    fi
-    test "$lalib_p" = yes
-}
-
-# func_ltwrapper_script_p file
-# True iff FILE is a libtool wrapper script
-# This function is only a basic sanity check; it will hardly flush out
-# determined imposters.
-func_ltwrapper_script_p ()
-{
-    func_lalib_p "$1"
-}
-
-# func_ltwrapper_executable_p file
-# True iff FILE is a libtool wrapper executable
-# This function is only a basic sanity check; it will hardly flush out
-# determined imposters.
-func_ltwrapper_executable_p ()
-{
-    func_ltwrapper_exec_suffix=
-    case $1 in
-    *.exe) ;;
-    *) func_ltwrapper_exec_suffix=.exe ;;
-    esac
-    $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
-}
-
-# func_ltwrapper_scriptname file
-# Assumes file is an ltwrapper_executable
-# uses $file to determine the appropriate filename for a
-# temporary ltwrapper_script.
-func_ltwrapper_scriptname ()
-{
-    func_ltwrapper_scriptname_result=""
-    if func_ltwrapper_executable_p "$1"; then
-	func_dirname_and_basename "$1" "" "."
-	func_stripname '' '.exe' "$func_basename_result"
-	func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
-    fi
-}
-
-# func_ltwrapper_p file
-# True iff FILE is a libtool wrapper script or wrapper executable
-# This function is only a basic sanity check; it will hardly flush out
-# determined imposters.
-func_ltwrapper_p ()
-{
-    func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
-}
-
-
-# func_execute_cmds commands fail_cmd
-# Execute tilde-delimited COMMANDS.
-# If FAIL_CMD is given, eval that upon failure.
-# FAIL_CMD may read-access the current command in variable CMD!
-func_execute_cmds ()
-{
-    $opt_debug
-    save_ifs=$IFS; IFS='~'
-    for cmd in $1; do
-      IFS=$save_ifs
-      eval cmd=\"$cmd\"
-      func_show_eval "$cmd" "${2-:}"
-    done
-    IFS=$save_ifs
-}
-
-
-# func_source file
-# Source FILE, adding directory component if necessary.
-# Note that it is not necessary on cygwin/mingw to append a dot to
-# FILE even if both FILE and FILE.exe exist: automatic-append-.exe
-# behavior happens only for exec(3), not for open(2)!  Also, sourcing
-# `FILE.' does not work on cygwin managed mounts.
-func_source ()
-{
-    $opt_debug
-    case $1 in
-    */* | *\\*)	. "$1" ;;
-    *)		. "./$1" ;;
-    esac
-}
-
-
-# func_infer_tag arg
-# Infer tagged configuration to use if any are available and
-# if one wasn't chosen via the "--tag" command line option.
-# Only attempt this if the compiler in the base compile
-# command doesn't match the default compiler.
-# arg is usually of the form 'gcc ...'
-func_infer_tag ()
-{
-    $opt_debug
-    if test -n "$available_tags" && test -z "$tagname"; then
-      CC_quoted=
-      for arg in $CC; do
-        func_quote_for_eval "$arg"
-	CC_quoted="$CC_quoted $func_quote_for_eval_result"
-      done
-      case $@ in
-      # Blanks in the command may have been stripped by the calling shell,
-      # but not from the CC environment variable when configure was run.
-      " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) ;;
-      # Blanks at the start of $base_compile will cause this to fail
-      # if we don't check for them as well.
-      *)
-	for z in $available_tags; do
-	  if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
-	    # Evaluate the configuration.
-	    eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
-	    CC_quoted=
-	    for arg in $CC; do
-	      # Double-quote args containing other shell metacharacters.
-	      func_quote_for_eval "$arg"
-	      CC_quoted="$CC_quoted $func_quote_for_eval_result"
-	    done
-	    case "$@ " in
-	      " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*)
-	      # The compiler in the base compile command matches
-	      # the one in the tagged configuration.
-	      # Assume this is the tagged configuration we want.
-	      tagname=$z
-	      break
-	      ;;
-	    esac
-	  fi
-	done
-	# If $tagname still isn't set, then no tagged configuration
-	# was found and let the user know that the "--tag" command
-	# line option must be used.
-	if test -z "$tagname"; then
-	  func_echo "unable to infer tagged configuration"
-	  func_fatal_error "specify a tag with \`--tag'"
-#	else
-#	  func_verbose "using $tagname tagged configuration"
-	fi
-	;;
-      esac
-    fi
-}
-
-
-
-# func_write_libtool_object output_name pic_name nonpic_name
-# Create a libtool object file (analogous to a ".la" file),
-# but don't create it if we're doing a dry run.
-func_write_libtool_object ()
-{
-    write_libobj=${1}
-    if test "$build_libtool_libs" = yes; then
-      write_lobj=\'${2}\'
-    else
-      write_lobj=none
-    fi
-
-    if test "$build_old_libs" = yes; then
-      write_oldobj=\'${3}\'
-    else
-      write_oldobj=none
-    fi
-
-    $opt_dry_run || {
-      cat >${write_libobj}T <<EOF
-# $write_libobj - a libtool object file
-# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
-#
-# Please DO NOT delete this file!
-# It is necessary for linking the library.
-
-# Name of the PIC object.
-pic_object=$write_lobj
-
-# Name of the non-PIC object
-non_pic_object=$write_oldobj
-
-EOF
-      $MV "${write_libobj}T" "${write_libobj}"
-    }
-}
-
-# func_mode_compile arg...
-func_mode_compile ()
-{
-    $opt_debug
-    # Get the compilation command and the source file.
-    base_compile=
-    srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
-    suppress_opt=yes
-    suppress_output=
-    arg_mode=normal
-    libobj=
-    later=
-    pie_flag=
-
-    for arg
-    do
-      case $arg_mode in
-      arg  )
-	# do not "continue".  Instead, add this to base_compile
-	lastarg="$arg"
-	arg_mode=normal
-	;;
-
-      target )
-	libobj="$arg"
-	arg_mode=normal
-	continue
-	;;
-
-      normal )
-	# Accept any command-line options.
-	case $arg in
-	-o)
-	  test -n "$libobj" && \
-	    func_fatal_error "you cannot specify \`-o' more than once"
-	  arg_mode=target
-	  continue
-	  ;;
-
-	-pie | -fpie | -fPIE)
-          pie_flag="$pie_flag $arg"
-	  continue
-	  ;;
-
-	-shared | -static | -prefer-pic | -prefer-non-pic)
-	  later="$later $arg"
-	  continue
-	  ;;
-
-	-no-suppress)
-	  suppress_opt=no
-	  continue
-	  ;;
-
-	-Xcompiler)
-	  arg_mode=arg  #  the next one goes into the "base_compile" arg list
-	  continue      #  The current "srcfile" will either be retained or
-	  ;;            #  replaced later.  I would guess that would be a bug.
-
-	-Wc,*)
-	  func_stripname '-Wc,' '' "$arg"
-	  args=$func_stripname_result
-	  lastarg=
-	  save_ifs="$IFS"; IFS=','
-	  for arg in $args; do
-	    IFS="$save_ifs"
-	    func_quote_for_eval "$arg"
-	    lastarg="$lastarg $func_quote_for_eval_result"
-	  done
-	  IFS="$save_ifs"
-	  func_stripname ' ' '' "$lastarg"
-	  lastarg=$func_stripname_result
-
-	  # Add the arguments to base_compile.
-	  base_compile="$base_compile $lastarg"
-	  continue
-	  ;;
-
-	*)
-	  # Accept the current argument as the source file.
-	  # The previous "srcfile" becomes the current argument.
-	  #
-	  lastarg="$srcfile"
-	  srcfile="$arg"
-	  ;;
-	esac  #  case $arg
-	;;
-      esac    #  case $arg_mode
-
-      # Aesthetically quote the previous argument.
-      func_quote_for_eval "$lastarg"
-      base_compile="$base_compile $func_quote_for_eval_result"
-    done # for arg
-
-    case $arg_mode in
-    arg)
-      func_fatal_error "you must specify an argument for -Xcompile"
-      ;;
-    target)
-      func_fatal_error "you must specify a target with \`-o'"
-      ;;
-    *)
-      # Get the name of the library object.
-      test -z "$libobj" && {
-	func_basename "$srcfile"
-	libobj="$func_basename_result"
-      }
-      ;;
-    esac
-
-    # Recognize several different file suffixes.
-    # If the user specifies -o file.o, it is replaced with file.lo
-    case $libobj in
-    *.[cCFSifmso] | \
-    *.ada | *.adb | *.ads | *.asm | \
-    *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
-    *.[fF][09]? | *.for | *.java | *.obj | *.sx)
-      func_xform "$libobj"
-      libobj=$func_xform_result
-      ;;
-    esac
-
-    case $libobj in
-    *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
-    *)
-      func_fatal_error "cannot determine name of library object from \`$libobj'"
-      ;;
-    esac
-
-    func_infer_tag $base_compile
-
-    for arg in $later; do
-      case $arg in
-      -shared)
-	test "$build_libtool_libs" != yes && \
-	  func_fatal_configuration "can not build a shared library"
-	build_old_libs=no
-	continue
-	;;
-
-      -static)
-	build_libtool_libs=no
-	build_old_libs=yes
-	continue
-	;;
-
-      -prefer-pic)
-	pic_mode=yes
-	continue
-	;;
-
-      -prefer-non-pic)
-	pic_mode=no
-	continue
-	;;
-      esac
-    done
-
-    func_quote_for_eval "$libobj"
-    test "X$libobj" != "X$func_quote_for_eval_result" \
-      && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"'	 &()|`$[]' \
-      && func_warning "libobj name \`$libobj' may not contain shell special characters."
-    func_dirname_and_basename "$obj" "/" ""
-    objname="$func_basename_result"
-    xdir="$func_dirname_result"
-    lobj=${xdir}$objdir/$objname
-
-    test -z "$base_compile" && \
-      func_fatal_help "you must specify a compilation command"
-
-    # Delete any leftover library objects.
-    if test "$build_old_libs" = yes; then
-      removelist="$obj $lobj $libobj ${libobj}T"
-    else
-      removelist="$lobj $libobj ${libobj}T"
-    fi
-
-    # On Cygwin there's no "real" PIC flag so we must build both object types
-    case $host_os in
-    cygwin* | mingw* | pw32* | os2* | cegcc*)
-      pic_mode=default
-      ;;
-    esac
-    if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
-      # non-PIC code in shared libraries is not supported
-      pic_mode=default
-    fi
-
-    # Calculate the filename of the output object if compiler does
-    # not support -o with -c
-    if test "$compiler_c_o" = no; then
-      output_obj=`$ECHO "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
-      lockfile="$output_obj.lock"
-    else
-      output_obj=
-      need_locks=no
-      lockfile=
-    fi
-
-    # Lock this critical section if it is needed
-    # We use this script file to make the link, it avoids creating a new file
-    if test "$need_locks" = yes; then
-      until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
-	func_echo "Waiting for $lockfile to be removed"
-	sleep 2
-      done
-    elif test "$need_locks" = warn; then
-      if test -f "$lockfile"; then
-	$ECHO "\
-*** ERROR, $lockfile exists and contains:
-`cat $lockfile 2>/dev/null`
-
-This indicates that another process is trying to use the same
-temporary object file, and libtool could not work around it because
-your compiler does not support \`-c' and \`-o' together.  If you
-repeat this compilation, it may succeed, by chance, but you had better
-avoid parallel builds (make -j) in this platform, or get a better
-compiler."
-
-	$opt_dry_run || $RM $removelist
-	exit $EXIT_FAILURE
-      fi
-      removelist="$removelist $output_obj"
-      $ECHO "$srcfile" > "$lockfile"
-    fi
-
-    $opt_dry_run || $RM $removelist
-    removelist="$removelist $lockfile"
-    trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
-
-    if test -n "$fix_srcfile_path"; then
-      eval srcfile=\"$fix_srcfile_path\"
-    fi
-    func_quote_for_eval "$srcfile"
-    qsrcfile=$func_quote_for_eval_result
-
-    # Only build a PIC object if we are building libtool libraries.
-    if test "$build_libtool_libs" = yes; then
-      # Without this assignment, base_compile gets emptied.
-      fbsd_hideous_sh_bug=$base_compile
-
-      if test "$pic_mode" != no; then
-	command="$base_compile $qsrcfile $pic_flag"
-      else
-	# Don't build PIC code
-	command="$base_compile $qsrcfile"
-      fi
-
-      func_mkdir_p "$xdir$objdir"
-
-      if test -z "$output_obj"; then
-	# Place PIC objects in $objdir
-	command="$command -o $lobj"
-      fi
-
-      func_show_eval_locale "$command"	\
-          'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
-
-      if test "$need_locks" = warn &&
-	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
-	$ECHO "\
-*** ERROR, $lockfile contains:
-`cat $lockfile 2>/dev/null`
-
-but it should contain:
-$srcfile
-
-This indicates that another process is trying to use the same
-temporary object file, and libtool could not work around it because
-your compiler does not support \`-c' and \`-o' together.  If you
-repeat this compilation, it may succeed, by chance, but you had better
-avoid parallel builds (make -j) in this platform, or get a better
-compiler."
-
-	$opt_dry_run || $RM $removelist
-	exit $EXIT_FAILURE
-      fi
-
-      # Just move the object if needed, then go on to compile the next one
-      if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
-	func_show_eval '$MV "$output_obj" "$lobj"' \
-	  'error=$?; $opt_dry_run || $RM $removelist; exit $error'
-      fi
-
-      # Allow error messages only from the first compilation.
-      if test "$suppress_opt" = yes; then
-	suppress_output=' >/dev/null 2>&1'
-      fi
-    fi
-
-    # Only build a position-dependent object if we build old libraries.
-    if test "$build_old_libs" = yes; then
-      if test "$pic_mode" != yes; then
-	# Don't build PIC code
-	command="$base_compile $qsrcfile$pie_flag"
-      else
-	command="$base_compile $qsrcfile $pic_flag"
-      fi
-      if test "$compiler_c_o" = yes; then
-	command="$command -o $obj"
-      fi
-
-      # Suppress compiler output if we already did a PIC compilation.
-      command="$command$suppress_output"
-      func_show_eval_locale "$command" \
-        '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
-
-      if test "$need_locks" = warn &&
-	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
-	$ECHO "\
-*** ERROR, $lockfile contains:
-`cat $lockfile 2>/dev/null`
-
-but it should contain:
-$srcfile
-
-This indicates that another process is trying to use the same
-temporary object file, and libtool could not work around it because
-your compiler does not support \`-c' and \`-o' together.  If you
-repeat this compilation, it may succeed, by chance, but you had better
-avoid parallel builds (make -j) in this platform, or get a better
-compiler."
-
-	$opt_dry_run || $RM $removelist
-	exit $EXIT_FAILURE
-      fi
-
-      # Just move the object if needed
-      if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
-	func_show_eval '$MV "$output_obj" "$obj"' \
-	  'error=$?; $opt_dry_run || $RM $removelist; exit $error'
-      fi
-    fi
-
-    $opt_dry_run || {
-      func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
-
-      # Unlock the critical section if it was locked
-      if test "$need_locks" != no; then
-	removelist=$lockfile
-        $RM "$lockfile"
-      fi
-    }
-
-    exit $EXIT_SUCCESS
-}
-
-$opt_help || {
-test "$mode" = compile && func_mode_compile ${1+"$@"}
-}
-
-func_mode_help ()
-{
-    # We need to display help for each of the modes.
-    case $mode in
-      "")
-        # Generic help is extracted from the usage comments
-        # at the start of this file.
-        func_help
-        ;;
-
-      clean)
-        $ECHO \
-"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
-
-Remove files from the build directory.
-
-RM is the name of the program to use to delete files associated with each FILE
-(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
-to RM.
-
-If FILE is a libtool library, object or program, all the files associated
-with it are deleted. Otherwise, only FILE itself is deleted using RM."
-        ;;
-
-      compile)
-      $ECHO \
-"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
-
-Compile a source file into a libtool library object.
-
-This mode accepts the following additional options:
-
-  -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
-  -no-suppress      do not suppress compiler output for multiple passes
-  -prefer-pic       try to building PIC objects only
-  -prefer-non-pic   try to building non-PIC objects only
-  -shared           do not build a \`.o' file suitable for static linking
-  -static           only build a \`.o' file suitable for static linking
-
-COMPILE-COMMAND is a command to be used in creating a \`standard' object file
-from the given SOURCEFILE.
-
-The output file name is determined by removing the directory component from
-SOURCEFILE, then substituting the C source code suffix \`.c' with the
-library object suffix, \`.lo'."
-        ;;
-
-      execute)
-        $ECHO \
-"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
-
-Automatically set library path, then run a program.
-
-This mode accepts the following additional options:
-
-  -dlopen FILE      add the directory containing FILE to the library path
-
-This mode sets the library path environment variable according to \`-dlopen'
-flags.
-
-If any of the ARGS are libtool executable wrappers, then they are translated
-into their corresponding uninstalled binary, and any of their required library
-directories are added to the library path.
-
-Then, COMMAND is executed, with ARGS as arguments."
-        ;;
-
-      finish)
-        $ECHO \
-"Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
-
-Complete the installation of libtool libraries.
-
-Each LIBDIR is a directory that contains libtool libraries.
-
-The commands that this mode executes may require superuser privileges.  Use
-the \`--dry-run' option if you just want to see what would be executed."
-        ;;
-
-      install)
-        $ECHO \
-"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
-
-Install executables or libraries.
-
-INSTALL-COMMAND is the installation command.  The first component should be
-either the \`install' or \`cp' program.
-
-The following components of INSTALL-COMMAND are treated specially:
-
-  -inst-prefix PREFIX-DIR  Use PREFIX-DIR as a staging area for installation
-
-The rest of the components are interpreted as arguments to that command (only
-BSD-compatible install options are recognized)."
-        ;;
-
-      link)
-        $ECHO \
-"Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
-
-Link object files or libraries together to form another library, or to
-create an executable program.
-
-LINK-COMMAND is a command using the C compiler that you would use to create
-a program from several object files.
-
-The following components of LINK-COMMAND are treated specially:
-
-  -all-static       do not do any dynamic linking at all
-  -avoid-version    do not add a version suffix if possible
-  -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
-  -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
-  -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
-  -export-symbols SYMFILE
-                    try to export only the symbols listed in SYMFILE
-  -export-symbols-regex REGEX
-                    try to export only the symbols matching REGEX
-  -LLIBDIR          search LIBDIR for required installed libraries
-  -lNAME            OUTPUT-FILE requires the installed library libNAME
-  -module           build a library that can dlopened
-  -no-fast-install  disable the fast-install mode
-  -no-install       link a not-installable executable
-  -no-undefined     declare that a library does not refer to external symbols
-  -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
-  -objectlist FILE  Use a list of object files found in FILE to specify objects
-  -precious-files-regex REGEX
-                    don't remove output files matching REGEX
-  -release RELEASE  specify package release information
-  -rpath LIBDIR     the created library will eventually be installed in LIBDIR
-  -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
-  -shared           only do dynamic linking of libtool libraries
-  -shrext SUFFIX    override the standard shared library file extension
-  -static           do not do any dynamic linking of uninstalled libtool libraries
-  -static-libtool-libs
-                    do not do any dynamic linking of libtool libraries
-  -version-info CURRENT[:REVISION[:AGE]]
-                    specify library version info [each variable defaults to 0]
-  -weak LIBNAME     declare that the target provides the LIBNAME interface
-
-All other options (arguments beginning with \`-') are ignored.
-
-Every other argument is treated as a filename.  Files ending in \`.la' are
-treated as uninstalled libtool libraries, other files are standard or library
-object files.
-
-If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
-only library objects (\`.lo' files) may be specified, and \`-rpath' is
-required, except when creating a convenience library.
-
-If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
-using \`ar' and \`ranlib', or on Windows using \`lib'.
-
-If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
-is created, otherwise an executable program is created."
-        ;;
-
-      uninstall)
-        $ECHO \
-"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
-
-Remove libraries from an installation directory.
-
-RM is the name of the program to use to delete files associated with each FILE
-(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
-to RM.
-
-If FILE is a libtool library, all the files associated with it are deleted.
-Otherwise, only FILE itself is deleted using RM."
-        ;;
-
-      *)
-        func_fatal_help "invalid operation mode \`$mode'"
-        ;;
-    esac
-
-    $ECHO
-    $ECHO "Try \`$progname --help' for more information about other modes."
-
-    exit $?
-}
-
-  # Now that we've collected a possible --mode arg, show help if necessary
-  $opt_help && func_mode_help
-
-
-# func_mode_execute arg...
-func_mode_execute ()
-{
-    $opt_debug
-    # The first argument is the command name.
-    cmd="$nonopt"
-    test -z "$cmd" && \
-      func_fatal_help "you must specify a COMMAND"
-
-    # Handle -dlopen flags immediately.
-    for file in $execute_dlfiles; do
-      test -f "$file" \
-	|| func_fatal_help "\`$file' is not a file"
-
-      dir=
-      case $file in
-      *.la)
-	# Check to see that this really is a libtool archive.
-	func_lalib_unsafe_p "$file" \
-	  || func_fatal_help "\`$lib' is not a valid libtool archive"
-
-	# Read the libtool library.
-	dlname=
-	library_names=
-	func_source "$file"
-
-	# Skip this library if it cannot be dlopened.
-	if test -z "$dlname"; then
-	  # Warn if it was a shared library.
-	  test -n "$library_names" && \
-	    func_warning "\`$file' was not linked with \`-export-dynamic'"
-	  continue
-	fi
-
-	func_dirname "$file" "" "."
-	dir="$func_dirname_result"
-
-	if test -f "$dir/$objdir/$dlname"; then
-	  dir="$dir/$objdir"
-	else
-	  if test ! -f "$dir/$dlname"; then
-	    func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
-	  fi
-	fi
-	;;
-
-      *.lo)
-	# Just add the directory containing the .lo file.
-	func_dirname "$file" "" "."
-	dir="$func_dirname_result"
-	;;
-
-      *)
-	func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
-	continue
-	;;
-      esac
-
-      # Get the absolute pathname.
-      absdir=`cd "$dir" && pwd`
-      test -n "$absdir" && dir="$absdir"
-
-      # Now add the directory to shlibpath_var.
-      if eval "test -z \"\$$shlibpath_var\""; then
-	eval "$shlibpath_var=\"\$dir\""
-      else
-	eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
-      fi
-    done
-
-    # This variable tells wrapper scripts just to set shlibpath_var
-    # rather than running their programs.
-    libtool_execute_magic="$magic"
-
-    # Check if any of the arguments is a wrapper script.
-    args=
-    for file
-    do
-      case $file in
-      -*) ;;
-      *)
-	# Do a test to see if this is really a libtool program.
-	if func_ltwrapper_script_p "$file"; then
-	  func_source "$file"
-	  # Transform arg to wrapped name.
-	  file="$progdir/$program"
-	elif func_ltwrapper_executable_p "$file"; then
-	  func_ltwrapper_scriptname "$file"
-	  func_source "$func_ltwrapper_scriptname_result"
-	  # Transform arg to wrapped name.
-	  file="$progdir/$program"
-	fi
-	;;
-      esac
-      # Quote arguments (to preserve shell metacharacters).
-      func_quote_for_eval "$file"
-      args="$args $func_quote_for_eval_result"
-    done
-
-    if test "X$opt_dry_run" = Xfalse; then
-      if test -n "$shlibpath_var"; then
-	# Export the shlibpath_var.
-	eval "export $shlibpath_var"
-      fi
-
-      # Restore saved environment variables
-      for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
-      do
-	eval "if test \"\${save_$lt_var+set}\" = set; then
-                $lt_var=\$save_$lt_var; export $lt_var
-	      else
-		$lt_unset $lt_var
-	      fi"
-      done
-
-      # Now prepare to actually exec the command.
-      exec_cmd="\$cmd$args"
-    else
-      # Display what would be done.
-      if test -n "$shlibpath_var"; then
-	eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
-	$ECHO "export $shlibpath_var"
-      fi
-      $ECHO "$cmd$args"
-      exit $EXIT_SUCCESS
-    fi
-}
-
-test "$mode" = execute && func_mode_execute ${1+"$@"}
-
-
-# func_mode_finish arg...
-func_mode_finish ()
-{
-    $opt_debug
-    libdirs="$nonopt"
-    admincmds=
-
-    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
-      for dir
-      do
-	libdirs="$libdirs $dir"
-      done
-
-      for libdir in $libdirs; do
-	if test -n "$finish_cmds"; then
-	  # Do each command in the finish commands.
-	  func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
-'"$cmd"'"'
-	fi
-	if test -n "$finish_eval"; then
-	  # Do the single finish_eval.
-	  eval cmds=\"$finish_eval\"
-	  $opt_dry_run || eval "$cmds" || admincmds="$admincmds
-       $cmds"
-	fi
-      done
-    fi
-
-    # Exit here if they wanted silent mode.
-    $opt_silent && exit $EXIT_SUCCESS
-
-    $ECHO "X----------------------------------------------------------------------" | $Xsed
-    $ECHO "Libraries have been installed in:"
-    for libdir in $libdirs; do
-      $ECHO "   $libdir"
-    done
-    $ECHO
-    $ECHO "If you ever happen to want to link against installed libraries"
-    $ECHO "in a given directory, LIBDIR, you must either use libtool, and"
-    $ECHO "specify the full pathname of the library, or use the \`-LLIBDIR'"
-    $ECHO "flag during linking and do at least one of the following:"
-    if test -n "$shlibpath_var"; then
-      $ECHO "   - add LIBDIR to the \`$shlibpath_var' environment variable"
-      $ECHO "     during execution"
-    fi
-    if test -n "$runpath_var"; then
-      $ECHO "   - add LIBDIR to the \`$runpath_var' environment variable"
-      $ECHO "     during linking"
-    fi
-    if test -n "$hardcode_libdir_flag_spec"; then
-      libdir=LIBDIR
-      eval flag=\"$hardcode_libdir_flag_spec\"
-
-      $ECHO "   - use the \`$flag' linker flag"
-    fi
-    if test -n "$admincmds"; then
-      $ECHO "   - have your system administrator run these commands:$admincmds"
-    fi
-    if test -f /etc/ld.so.conf; then
-      $ECHO "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
-    fi
-    $ECHO
-
-    $ECHO "See any operating system documentation about shared libraries for"
-    case $host in
-      solaris2.[6789]|solaris2.1[0-9])
-        $ECHO "more information, such as the ld(1), crle(1) and ld.so(8) manual"
-	$ECHO "pages."
-	;;
-      *)
-        $ECHO "more information, such as the ld(1) and ld.so(8) manual pages."
-        ;;
-    esac
-    $ECHO "X----------------------------------------------------------------------" | $Xsed
-    exit $EXIT_SUCCESS
-}
-
-test "$mode" = finish && func_mode_finish ${1+"$@"}
-
-
-# func_mode_install arg...
-func_mode_install ()
-{
-    $opt_debug
-    # There may be an optional sh(1) argument at the beginning of
-    # install_prog (especially on Windows NT).
-    if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
-       # Allow the use of GNU shtool's install command.
-       $ECHO "X$nonopt" | $GREP shtool >/dev/null; then
-      # Aesthetically quote it.
-      func_quote_for_eval "$nonopt"
-      install_prog="$func_quote_for_eval_result "
-      arg=$1
-      shift
-    else
-      install_prog=
-      arg=$nonopt
-    fi
-
-    # The real first argument should be the name of the installation program.
-    # Aesthetically quote it.
-    func_quote_for_eval "$arg"
-    install_prog="$install_prog$func_quote_for_eval_result"
-
-    # We need to accept at least all the BSD install flags.
-    dest=
-    files=
-    opts=
-    prev=
-    install_type=
-    isdir=no
-    stripme=
-    for arg
-    do
-      if test -n "$dest"; then
-	files="$files $dest"
-	dest=$arg
-	continue
-      fi
-
-      case $arg in
-      -d) isdir=yes ;;
-      -f)
-	case " $install_prog " in
-	*[\\\ /]cp\ *) ;;
-	*) prev=$arg ;;
-	esac
-	;;
-      -g | -m | -o)
-	prev=$arg
-	;;
-      -s)
-	stripme=" -s"
-	continue
-	;;
-      -*)
-	;;
-      *)
-	# If the previous option needed an argument, then skip it.
-	if test -n "$prev"; then
-	  prev=
-	else
-	  dest=$arg
-	  continue
-	fi
-	;;
-      esac
-
-      # Aesthetically quote the argument.
-      func_quote_for_eval "$arg"
-      install_prog="$install_prog $func_quote_for_eval_result"
-    done
-
-    test -z "$install_prog" && \
-      func_fatal_help "you must specify an install program"
-
-    test -n "$prev" && \
-      func_fatal_help "the \`$prev' option requires an argument"
-
-    if test -z "$files"; then
-      if test -z "$dest"; then
-	func_fatal_help "no file or destination specified"
-      else
-	func_fatal_help "you must specify a destination"
-      fi
-    fi
-
-    # Strip any trailing slash from the destination.
-    func_stripname '' '/' "$dest"
-    dest=$func_stripname_result
-
-    # Check to see that the destination is a directory.
-    test -d "$dest" && isdir=yes
-    if test "$isdir" = yes; then
-      destdir="$dest"
-      destname=
-    else
-      func_dirname_and_basename "$dest" "" "."
-      destdir="$func_dirname_result"
-      destname="$func_basename_result"
-
-      # Not a directory, so check to see that there is only one file specified.
-      set dummy $files; shift
-      test "$#" -gt 1 && \
-	func_fatal_help "\`$dest' is not a directory"
-    fi
-    case $destdir in
-    [\\/]* | [A-Za-z]:[\\/]*) ;;
-    *)
-      for file in $files; do
-	case $file in
-	*.lo) ;;
-	*)
-	  func_fatal_help "\`$destdir' must be an absolute directory name"
-	  ;;
-	esac
-      done
-      ;;
-    esac
-
-    # This variable tells wrapper scripts just to set variables rather
-    # than running their programs.
-    libtool_install_magic="$magic"
-
-    staticlibs=
-    future_libdirs=
-    current_libdirs=
-    for file in $files; do
-
-      # Do each installation.
-      case $file in
-      *.$libext)
-	# Do the static libraries later.
-	staticlibs="$staticlibs $file"
-	;;
-
-      *.la)
-	# Check to see that this really is a libtool archive.
-	func_lalib_unsafe_p "$file" \
-	  || func_fatal_help "\`$file' is not a valid libtool archive"
-
-	library_names=
-	old_library=
-	relink_command=
-	func_source "$file"
-
-	# Add the libdir to current_libdirs if it is the destination.
-	if test "X$destdir" = "X$libdir"; then
-	  case "$current_libdirs " in
-	  *" $libdir "*) ;;
-	  *) current_libdirs="$current_libdirs $libdir" ;;
-	  esac
-	else
-	  # Note the libdir as a future libdir.
-	  case "$future_libdirs " in
-	  *" $libdir "*) ;;
-	  *) future_libdirs="$future_libdirs $libdir" ;;
-	  esac
-	fi
-
-	func_dirname "$file" "/" ""
-	dir="$func_dirname_result"
-	dir="$dir$objdir"
-
-	if test -n "$relink_command"; then
-	  # Determine the prefix the user has applied to our future dir.
-	  inst_prefix_dir=`$ECHO "X$destdir" | $Xsed -e "s%$libdir\$%%"`
-
-	  # Don't allow the user to place us outside of our expected
-	  # location b/c this prevents finding dependent libraries that
-	  # are installed to the same prefix.
-	  # At present, this check doesn't affect windows .dll's that
-	  # are installed into $libdir/../bin (currently, that works fine)
-	  # but it's something to keep an eye on.
-	  test "$inst_prefix_dir" = "$destdir" && \
-	    func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
-
-	  if test -n "$inst_prefix_dir"; then
-	    # Stick the inst_prefix_dir data into the link command.
-	    relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
-	  else
-	    relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%%"`
-	  fi
-
-	  func_warning "relinking \`$file'"
-	  func_show_eval "$relink_command" \
-	    'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
-	fi
-
-	# See the names of the shared library.
-	set dummy $library_names; shift
-	if test -n "$1"; then
-	  realname="$1"
-	  shift
-
-	  srcname="$realname"
-	  test -n "$relink_command" && srcname="$realname"T
-
-	  # Install the shared library and build the symlinks.
-	  func_show_eval "$install_prog $dir/$srcname $destdir/$realname" \
-	      'exit $?'
-	  tstripme="$stripme"
-	  case $host_os in
-	  cygwin* | mingw* | pw32* | cegcc*)
-	    case $realname in
-	    *.dll.a)
-	      tstripme=""
-	      ;;
-	    esac
-	    ;;
-	  esac
-	  if test -n "$tstripme" && test -n "$striplib"; then
-	    func_show_eval "$striplib $destdir/$realname" 'exit $?'
-	  fi
-
-	  if test "$#" -gt 0; then
-	    # Delete the old symlinks, and create new ones.
-	    # Try `ln -sf' first, because the `ln' binary might depend on
-	    # the symlink we replace!  Solaris /bin/ln does not understand -f,
-	    # so we also need to try rm && ln -s.
-	    for linkname
-	    do
-	      test "$linkname" != "$realname" \
-		&& func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
-	    done
-	  fi
-
-	  # Do each command in the postinstall commands.
-	  lib="$destdir/$realname"
-	  func_execute_cmds "$postinstall_cmds" 'exit $?'
-	fi
-
-	# Install the pseudo-library for information purposes.
-	func_basename "$file"
-	name="$func_basename_result"
-	instname="$dir/$name"i
-	func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
-
-	# Maybe install the static library, too.
-	test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
-	;;
-
-      *.lo)
-	# Install (i.e. copy) a libtool object.
-
-	# Figure out destination file name, if it wasn't already specified.
-	if test -n "$destname"; then
-	  destfile="$destdir/$destname"
-	else
-	  func_basename "$file"
-	  destfile="$func_basename_result"
-	  destfile="$destdir/$destfile"
-	fi
-
-	# Deduce the name of the destination old-style object file.
-	case $destfile in
-	*.lo)
-	  func_lo2o "$destfile"
-	  staticdest=$func_lo2o_result
-	  ;;
-	*.$objext)
-	  staticdest="$destfile"
-	  destfile=
-	  ;;
-	*)
-	  func_fatal_help "cannot copy a libtool object to \`$destfile'"
-	  ;;
-	esac
-
-	# Install the libtool object if requested.
-	test -n "$destfile" && \
-	  func_show_eval "$install_prog $file $destfile" 'exit $?'
-
-	# Install the old object if enabled.
-	if test "$build_old_libs" = yes; then
-	  # Deduce the name of the old-style object file.
-	  func_lo2o "$file"
-	  staticobj=$func_lo2o_result
-	  func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
-	fi
-	exit $EXIT_SUCCESS
-	;;
-
-      *)
-	# Figure out destination file name, if it wasn't already specified.
-	if test -n "$destname"; then
-	  destfile="$destdir/$destname"
-	else
-	  func_basename "$file"
-	  destfile="$func_basename_result"
-	  destfile="$destdir/$destfile"
-	fi
-
-	# If the file is missing, and there is a .exe on the end, strip it
-	# because it is most likely a libtool script we actually want to
-	# install
-	stripped_ext=""
-	case $file in
-	  *.exe)
-	    if test ! -f "$file"; then
-	      func_stripname '' '.exe' "$file"
-	      file=$func_stripname_result
-	      stripped_ext=".exe"
-	    fi
-	    ;;
-	esac
-
-	# Do a test to see if this is really a libtool program.
-	case $host in
-	*cygwin* | *mingw*)
-	    if func_ltwrapper_executable_p "$file"; then
-	      func_ltwrapper_scriptname "$file"
-	      wrapper=$func_ltwrapper_scriptname_result
-	    else
-	      func_stripname '' '.exe' "$file"
-	      wrapper=$func_stripname_result
-	    fi
-	    ;;
-	*)
-	    wrapper=$file
-	    ;;
-	esac
-	if func_ltwrapper_script_p "$wrapper"; then
-	  notinst_deplibs=
-	  relink_command=
-
-	  func_source "$wrapper"
-
-	  # Check the variables that should have been set.
-	  test -z "$generated_by_libtool_version" && \
-	    func_fatal_error "invalid libtool wrapper script \`$wrapper'"
-
-	  finalize=yes
-	  for lib in $notinst_deplibs; do
-	    # Check to see that each library is installed.
-	    libdir=
-	    if test -f "$lib"; then
-	      func_source "$lib"
-	    fi
-	    libfile="$libdir/"`$ECHO "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
-	    if test -n "$libdir" && test ! -f "$libfile"; then
-	      func_warning "\`$lib' has not been installed in \`$libdir'"
-	      finalize=no
-	    fi
-	  done
-
-	  relink_command=
-	  func_source "$wrapper"
-
-	  outputname=
-	  if test "$fast_install" = no && test -n "$relink_command"; then
-	    $opt_dry_run || {
-	      if test "$finalize" = yes; then
-	        tmpdir=`func_mktempdir`
-		func_basename "$file$stripped_ext"
-		file="$func_basename_result"
-	        outputname="$tmpdir/$file"
-	        # Replace the output file specification.
-	        relink_command=`$ECHO "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
-
-	        $opt_silent || {
-	          func_quote_for_expand "$relink_command"
-		  eval "func_echo $func_quote_for_expand_result"
-	        }
-	        if eval "$relink_command"; then :
-	          else
-		  func_error "error: relink \`$file' with the above command before installing it"
-		  $opt_dry_run || ${RM}r "$tmpdir"
-		  continue
-	        fi
-	        file="$outputname"
-	      else
-	        func_warning "cannot relink \`$file'"
-	      fi
-	    }
-	  else
-	    # Install the binary that we compiled earlier.
-	    file=`$ECHO "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
-	  fi
-	fi
-
-	# remove .exe since cygwin /usr/bin/install will append another
-	# one anyway
-	case $install_prog,$host in
-	*/usr/bin/install*,*cygwin*)
-	  case $file:$destfile in
-	  *.exe:*.exe)
-	    # this is ok
-	    ;;
-	  *.exe:*)
-	    destfile=$destfile.exe
-	    ;;
-	  *:*.exe)
-	    func_stripname '' '.exe' "$destfile"
-	    destfile=$func_stripname_result
-	    ;;
-	  esac
-	  ;;
-	esac
-	func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
-	$opt_dry_run || if test -n "$outputname"; then
-	  ${RM}r "$tmpdir"
-	fi
-	;;
-      esac
-    done
-
-    for file in $staticlibs; do
-      func_basename "$file"
-      name="$func_basename_result"
-
-      # Set up the ranlib parameters.
-      oldlib="$destdir/$name"
-
-      func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
-
-      if test -n "$stripme" && test -n "$old_striplib"; then
-	func_show_eval "$old_striplib $oldlib" 'exit $?'
-      fi
-
-      # Do each command in the postinstall commands.
-      func_execute_cmds "$old_postinstall_cmds" 'exit $?'
-    done
-
-    test -n "$future_libdirs" && \
-      func_warning "remember to run \`$progname --finish$future_libdirs'"
-
-    if test -n "$current_libdirs"; then
-      # Maybe just do a dry run.
-      $opt_dry_run && current_libdirs=" -n$current_libdirs"
-      exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
-    else
-      exit $EXIT_SUCCESS
-    fi
-}
-
-test "$mode" = install && func_mode_install ${1+"$@"}
-
-
-# func_generate_dlsyms outputname originator pic_p
-# Extract symbols from dlprefiles and create ${outputname}S.o with
-# a dlpreopen symbol table.
-func_generate_dlsyms ()
-{
-    $opt_debug
-    my_outputname="$1"
-    my_originator="$2"
-    my_pic_p="${3-no}"
-    my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
-    my_dlsyms=
-
-    if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
-      if test -n "$NM" && test -n "$global_symbol_pipe"; then
-	my_dlsyms="${my_outputname}S.c"
-      else
-	func_error "not configured to extract global symbols from dlpreopened files"
-      fi
-    fi
-
-    if test -n "$my_dlsyms"; then
-      case $my_dlsyms in
-      "") ;;
-      *.c)
-	# Discover the nlist of each of the dlfiles.
-	nlist="$output_objdir/${my_outputname}.nm"
-
-	func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
-
-	# Parse the name list into a source file.
-	func_verbose "creating $output_objdir/$my_dlsyms"
-
-	$opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
-/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
-/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
-
-#ifdef __cplusplus
-extern \"C\" {
-#endif
-
-/* External symbol declarations for the compiler. */\
-"
-
-	if test "$dlself" = yes; then
-	  func_verbose "generating symbol list for \`$output'"
-
-	  $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
-
-	  # Add our own program objects to the symbol list.
-	  progfiles=`$ECHO "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
-	  for progfile in $progfiles; do
-	    func_verbose "extracting global C symbols from \`$progfile'"
-	    $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'"
-	  done
-
-	  if test -n "$exclude_expsyms"; then
-	    $opt_dry_run || {
-	      eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
-	      eval '$MV "$nlist"T "$nlist"'
-	    }
-	  fi
-
-	  if test -n "$export_symbols_regex"; then
-	    $opt_dry_run || {
-	      eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
-	      eval '$MV "$nlist"T "$nlist"'
-	    }
-	  fi
-
-	  # Prepare the list of exported symbols
-	  if test -z "$export_symbols"; then
-	    export_symbols="$output_objdir/$outputname.exp"
-	    $opt_dry_run || {
-	      $RM $export_symbols
-	      eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
-	      case $host in
-	      *cygwin* | *mingw* | *cegcc* )
-                eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
-                eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
-	        ;;
-	      esac
-	    }
-	  else
-	    $opt_dry_run || {
-	      eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
-	      eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
-	      eval '$MV "$nlist"T "$nlist"'
-	      case $host in
-	        *cygwin | *mingw* | *cegcc* )
-	          eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
-	          eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
-	          ;;
-	      esac
-	    }
-	  fi
-	fi
-
-	for dlprefile in $dlprefiles; do
-	  func_verbose "extracting global C symbols from \`$dlprefile'"
-	  func_basename "$dlprefile"
-	  name="$func_basename_result"
-	  $opt_dry_run || {
-	    eval '$ECHO ": $name " >> "$nlist"'
-	    eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'"
-	  }
-	done
-
-	$opt_dry_run || {
-	  # Make sure we have at least an empty file.
-	  test -f "$nlist" || : > "$nlist"
-
-	  if test -n "$exclude_expsyms"; then
-	    $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
-	    $MV "$nlist"T "$nlist"
-	  fi
-
-	  # Try sorting and uniquifying the output.
-	  if $GREP -v "^: " < "$nlist" |
-	      if sort -k 3 </dev/null >/dev/null 2>&1; then
-		sort -k 3
-	      else
-		sort +2
-	      fi |
-	      uniq > "$nlist"S; then
-	    :
-	  else
-	    $GREP -v "^: " < "$nlist" > "$nlist"S
-	  fi
-
-	  if test -f "$nlist"S; then
-	    eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
-	  else
-	    $ECHO '/* NONE */' >> "$output_objdir/$my_dlsyms"
-	  fi
-
-	  $ECHO >> "$output_objdir/$my_dlsyms" "\
-
-/* The mapping between symbol names and symbols.  */
-typedef struct {
-  const char *name;
-  void *address;
-} lt_dlsymlist;
-"
-	  case $host in
-	  *cygwin* | *mingw* | *cegcc* )
-	    $ECHO >> "$output_objdir/$my_dlsyms" "\
-/* DATA imports from DLLs on WIN32 con't be const, because
-   runtime relocations are performed -- see ld's documentation
-   on pseudo-relocs.  */"
-	    lt_dlsym_const= ;;
-	  *osf5*)
-	    echo >> "$output_objdir/$my_dlsyms" "\
-/* This system does not cope well with relocations in const data */"
-	    lt_dlsym_const= ;;
-	  *)
-	    lt_dlsym_const=const ;;
-	  esac
-
-	  $ECHO >> "$output_objdir/$my_dlsyms" "\
-extern $lt_dlsym_const lt_dlsymlist
-lt_${my_prefix}_LTX_preloaded_symbols[];
-$lt_dlsym_const lt_dlsymlist
-lt_${my_prefix}_LTX_preloaded_symbols[] =
-{\
-  { \"$my_originator\", (void *) 0 },"
-
-	  case $need_lib_prefix in
-	  no)
-	    eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
-	    ;;
-	  *)
-	    eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
-	    ;;
-	  esac
-	  $ECHO >> "$output_objdir/$my_dlsyms" "\
-  {0, (void *) 0}
-};
-
-/* This works around a problem in FreeBSD linker */
-#ifdef FREEBSD_WORKAROUND
-static const void *lt_preloaded_setup() {
-  return lt_${my_prefix}_LTX_preloaded_symbols;
-}
-#endif
-
-#ifdef __cplusplus
-}
-#endif\
-"
-	} # !$opt_dry_run
-
-	pic_flag_for_symtable=
-	case "$compile_command " in
-	*" -static "*) ;;
-	*)
-	  case $host in
-	  # compiling the symbol table file with pic_flag works around
-	  # a FreeBSD bug that causes programs to crash when -lm is
-	  # linked before any other PIC object.  But we must not use
-	  # pic_flag when linking with -static.  The problem exists in
-	  # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
-	  *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
-	    pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
-	  *-*-hpux*)
-	    pic_flag_for_symtable=" $pic_flag"  ;;
-	  *)
-	    if test "X$my_pic_p" != Xno; then
-	      pic_flag_for_symtable=" $pic_flag"
-	    fi
-	    ;;
-	  esac
-	  ;;
-	esac
-	symtab_cflags=
-	for arg in $LTCFLAGS; do
-	  case $arg in
-	  -pie | -fpie | -fPIE) ;;
-	  *) symtab_cflags="$symtab_cflags $arg" ;;
-	  esac
-	done
-
-	# Now compile the dynamic symbol file.
-	func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
-
-	# Clean up the generated files.
-	func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
-
-	# Transform the symbol file into the correct name.
-	symfileobj="$output_objdir/${my_outputname}S.$objext"
-	case $host in
-	*cygwin* | *mingw* | *cegcc* )
-	  if test -f "$output_objdir/$my_outputname.def"; then
-	    compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
-	    finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
-	  else
-	    compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
-	    finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
-	  fi
-	  ;;
-	*)
-	  compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
-	  finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
-	  ;;
-	esac
-	;;
-      *)
-	func_fatal_error "unknown suffix for \`$my_dlsyms'"
-	;;
-      esac
-    else
-      # We keep going just in case the user didn't refer to
-      # lt_preloaded_symbols.  The linker will fail if global_symbol_pipe
-      # really was required.
-
-      # Nullify the symbol file.
-      compile_command=`$ECHO "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
-      finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
-    fi
-}
-
-# func_win32_libid arg
-# return the library type of file 'arg'
-#
-# Need a lot of goo to handle *both* DLLs and import libs
-# Has to be a shell function in order to 'eat' the argument
-# that is supplied when $file_magic_command is called.
-func_win32_libid ()
-{
-  $opt_debug
-  win32_libid_type="unknown"
-  win32_fileres=`file -L $1 2>/dev/null`
-  case $win32_fileres in
-  *ar\ archive\ import\ library*) # definitely import
-    win32_libid_type="x86 archive import"
-    ;;
-  *ar\ archive*) # could be an import, or static
-    if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
-       $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
-      win32_nmres=`eval $NM -f posix -A $1 |
-	$SED -n -e '
-	    1,100{
-		/ I /{
-		    s,.*,import,
-		    p
-		    q
-		}
-	    }'`
-      case $win32_nmres in
-      import*)  win32_libid_type="x86 archive import";;
-      *)        win32_libid_type="x86 archive static";;
-      esac
-    fi
-    ;;
-  *DLL*)
-    win32_libid_type="x86 DLL"
-    ;;
-  *executable*) # but shell scripts are "executable" too...
-    case $win32_fileres in
-    *MS\ Windows\ PE\ Intel*)
-      win32_libid_type="x86 DLL"
-      ;;
-    esac
-    ;;
-  esac
-  $ECHO "$win32_libid_type"
-}
-
-
-
-# func_extract_an_archive dir oldlib
-func_extract_an_archive ()
-{
-    $opt_debug
-    f_ex_an_ar_dir="$1"; shift
-    f_ex_an_ar_oldlib="$1"
-    func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" 'exit $?'
-    if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
-     :
-    else
-      func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
-    fi
-}
-
-
-# func_extract_archives gentop oldlib ...
-func_extract_archives ()
-{
-    $opt_debug
-    my_gentop="$1"; shift
-    my_oldlibs=${1+"$@"}
-    my_oldobjs=""
-    my_xlib=""
-    my_xabs=""
-    my_xdir=""
-
-    for my_xlib in $my_oldlibs; do
-      # Extract the objects.
-      case $my_xlib in
-	[\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
-	*) my_xabs=`pwd`"/$my_xlib" ;;
-      esac
-      func_basename "$my_xlib"
-      my_xlib="$func_basename_result"
-      my_xlib_u=$my_xlib
-      while :; do
-        case " $extracted_archives " in
-	*" $my_xlib_u "*)
-	  func_arith $extracted_serial + 1
-	  extracted_serial=$func_arith_result
-	  my_xlib_u=lt$extracted_serial-$my_xlib ;;
-	*) break ;;
-	esac
-      done
-      extracted_archives="$extracted_archives $my_xlib_u"
-      my_xdir="$my_gentop/$my_xlib_u"
-
-      func_mkdir_p "$my_xdir"
-
-      case $host in
-      *-darwin*)
-	func_verbose "Extracting $my_xabs"
-	# Do not bother doing anything if just a dry run
-	$opt_dry_run || {
-	  darwin_orig_dir=`pwd`
-	  cd $my_xdir || exit $?
-	  darwin_archive=$my_xabs
-	  darwin_curdir=`pwd`
-	  darwin_base_archive=`basename "$darwin_archive"`
-	  darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
-	  if test -n "$darwin_arches"; then
-	    darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
-	    darwin_arch=
-	    func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
-	    for darwin_arch in  $darwin_arches ; do
-	      func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
-	      $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
-	      cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
-	      func_extract_an_archive "`pwd`" "${darwin_base_archive}"
-	      cd "$darwin_curdir"
-	      $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
-	    done # $darwin_arches
-            ## Okay now we've a bunch of thin objects, gotta fatten them up :)
-	    darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
-	    darwin_file=
-	    darwin_files=
-	    for darwin_file in $darwin_filelist; do
-	      darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
-	      $LIPO -create -output "$darwin_file" $darwin_files
-	    done # $darwin_filelist
-	    $RM -rf unfat-$$
-	    cd "$darwin_orig_dir"
-	  else
-	    cd $darwin_orig_dir
-	    func_extract_an_archive "$my_xdir" "$my_xabs"
-	  fi # $darwin_arches
-	} # !$opt_dry_run
-	;;
-      *)
-        func_extract_an_archive "$my_xdir" "$my_xabs"
-	;;
-      esac
-      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
-    done
-
-    func_extract_archives_result="$my_oldobjs"
-}
-
-
-
-# func_emit_wrapper_part1 [arg=no]
-#
-# Emit the first part of a libtool wrapper script on stdout.
-# For more information, see the description associated with
-# func_emit_wrapper(), below.
-func_emit_wrapper_part1 ()
-{
-	func_emit_wrapper_part1_arg1=no
-	if test -n "$1" ; then
-	  func_emit_wrapper_part1_arg1=$1
-	fi
-
-	$ECHO "\
-#! $SHELL
-
-# $output - temporary wrapper script for $objdir/$outputname
-# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
-#
-# The $output program cannot be directly executed until all the libtool
-# libraries that it depends on are installed.
-#
-# This wrapper script should never be moved out of the build directory.
-# If it is, it will not operate correctly.
-
-# Sed substitution that helps us do robust quoting.  It backslashifies
-# metacharacters that are still active within double-quoted strings.
-Xsed='${SED} -e 1s/^X//'
-sed_quote_subst='$sed_quote_subst'
-
-# Be Bourne compatible
-if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
-  emulate sh
-  NULLCMD=:
-  # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
-  # is contrary to our usage.  Disable this feature.
-  alias -g '\${1+\"\$@\"}'='\"\$@\"'
-  setopt NO_GLOB_SUBST
-else
-  case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
-fi
-BIN_SH=xpg4; export BIN_SH # for Tru64
-DUALCASE=1; export DUALCASE # for MKS sh
-
-# The HP-UX ksh and POSIX shell print the target directory to stdout
-# if CDPATH is set.
-(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
-
-relink_command=\"$relink_command\"
-
-# This environment variable determines our operation mode.
-if test \"\$libtool_install_magic\" = \"$magic\"; then
-  # install mode needs the following variables:
-  generated_by_libtool_version='$macro_version'
-  notinst_deplibs='$notinst_deplibs'
-else
-  # When we are sourced in execute mode, \$file and \$ECHO are already set.
-  if test \"\$libtool_execute_magic\" != \"$magic\"; then
-    ECHO=\"$qecho\"
-    file=\"\$0\"
-    # Make sure echo works.
-    if test \"X\$1\" = X--no-reexec; then
-      # Discard the --no-reexec flag, and continue.
-      shift
-    elif test \"X\`{ \$ECHO '\t'; } 2>/dev/null\`\" = 'X\t'; then
-      # Yippee, \$ECHO works!
-      :
-    else
-      # Restart under the correct shell, and then maybe \$ECHO will work.
-      exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
-    fi
-  fi\
-"
-	$ECHO "\
-
-  # Find the directory that this script lives in.
-  thisdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
-  test \"x\$thisdir\" = \"x\$file\" && thisdir=.
-
-  # Follow symbolic links until we get to the real thisdir.
-  file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
-  while test -n \"\$file\"; do
-    destdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
-
-    # If there was a directory component, then change thisdir.
-    if test \"x\$destdir\" != \"x\$file\"; then
-      case \"\$destdir\" in
-      [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
-      *) thisdir=\"\$thisdir/\$destdir\" ;;
-      esac
-    fi
-
-    file=\`\$ECHO \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
-    file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
-  done
-"
-}
-# end: func_emit_wrapper_part1
-
-# func_emit_wrapper_part2 [arg=no]
-#
-# Emit the second part of a libtool wrapper script on stdout.
-# For more information, see the description associated with
-# func_emit_wrapper(), below.
-func_emit_wrapper_part2 ()
-{
-	func_emit_wrapper_part2_arg1=no
-	if test -n "$1" ; then
-	  func_emit_wrapper_part2_arg1=$1
-	fi
-
-	$ECHO "\
-
-  # Usually 'no', except on cygwin/mingw when embedded into
-  # the cwrapper.
-  WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_part2_arg1
-  if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
-    # special case for '.'
-    if test \"\$thisdir\" = \".\"; then
-      thisdir=\`pwd\`
-    fi
-    # remove .libs from thisdir
-    case \"\$thisdir\" in
-    *[\\\\/]$objdir ) thisdir=\`\$ECHO \"X\$thisdir\" | \$Xsed -e 's%[\\\\/][^\\\\/]*$%%'\` ;;
-    $objdir )   thisdir=. ;;
-    esac
-  fi
-
-  # Try to get the absolute directory name.
-  absdir=\`cd \"\$thisdir\" && pwd\`
-  test -n \"\$absdir\" && thisdir=\"\$absdir\"
-"
-
-	if test "$fast_install" = yes; then
-	  $ECHO "\
-  program=lt-'$outputname'$exeext
-  progdir=\"\$thisdir/$objdir\"
-
-  if test ! -f \"\$progdir/\$program\" ||
-     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
-       test \"X\$file\" != \"X\$progdir/\$program\"; }; then
-
-    file=\"\$\$-\$program\"
-
-    if test ! -d \"\$progdir\"; then
-      $MKDIR \"\$progdir\"
-    else
-      $RM \"\$progdir/\$file\"
-    fi"
-
-	  $ECHO "\
-
-    # relink executable if necessary
-    if test -n \"\$relink_command\"; then
-      if relink_command_output=\`eval \$relink_command 2>&1\`; then :
-      else
-	$ECHO \"\$relink_command_output\" >&2
-	$RM \"\$progdir/\$file\"
-	exit 1
-      fi
-    fi
-
-    $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
-    { $RM \"\$progdir/\$program\";
-      $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
-    $RM \"\$progdir/\$file\"
-  fi"
-	else
-	  $ECHO "\
-  program='$outputname'
-  progdir=\"\$thisdir/$objdir\"
-"
-	fi
-
-	$ECHO "\
-
-  if test -f \"\$progdir/\$program\"; then"
-
-	# Export our shlibpath_var if we have one.
-	if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
-	  $ECHO "\
-    # Add our own library path to $shlibpath_var
-    $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
-
-    # Some systems cannot cope with colon-terminated $shlibpath_var
-    # The second colon is a workaround for a bug in BeOS R4 sed
-    $shlibpath_var=\`\$ECHO \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
-
-    export $shlibpath_var
-"
-	fi
-
-	# fixup the dll searchpath if we need to.
-	if test -n "$dllsearchpath"; then
-	  $ECHO "\
-    # Add the dll search path components to the executable PATH
-    PATH=$dllsearchpath:\$PATH
-"
-	fi
-
-	$ECHO "\
-    if test \"\$libtool_execute_magic\" != \"$magic\"; then
-      # Run the actual program with our arguments.
-"
-	case $host in
-	# Backslashes separate directories on plain windows
-	*-*-mingw | *-*-os2* | *-cegcc*)
-	  $ECHO "\
-      exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
-"
-	  ;;
-
-	*)
-	  $ECHO "\
-      exec \"\$progdir/\$program\" \${1+\"\$@\"}
-"
-	  ;;
-	esac
-	$ECHO "\
-      \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
-      exit 1
-    fi
-  else
-    # The program doesn't exist.
-    \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
-    \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
-    $ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
-    exit 1
-  fi
-fi\
-"
-}
-# end: func_emit_wrapper_part2
-
-
-# func_emit_wrapper [arg=no]
-#
-# Emit a libtool wrapper script on stdout.
-# Don't directly open a file because we may want to
-# incorporate the script contents within a cygwin/mingw
-# wrapper executable.  Must ONLY be called from within
-# func_mode_link because it depends on a number of variables
-# set therein.
-#
-# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
-# variable will take.  If 'yes', then the emitted script
-# will assume that the directory in which it is stored is
-# the $objdir directory.  This is a cygwin/mingw-specific
-# behavior.
-func_emit_wrapper ()
-{
-	func_emit_wrapper_arg1=no
-	if test -n "$1" ; then
-	  func_emit_wrapper_arg1=$1
-	fi
-
-	# split this up so that func_emit_cwrapperexe_src
-	# can call each part independently.
-	func_emit_wrapper_part1 "${func_emit_wrapper_arg1}"
-	func_emit_wrapper_part2 "${func_emit_wrapper_arg1}"
-}
-
-
-# func_to_host_path arg
-#
-# Convert paths to host format when used with build tools.
-# Intended for use with "native" mingw (where libtool itself
-# is running under the msys shell), or in the following cross-
-# build environments:
-#    $build          $host
-#    mingw (msys)    mingw  [e.g. native]
-#    cygwin          mingw
-#    *nix + wine     mingw
-# where wine is equipped with the `winepath' executable.
-# In the native mingw case, the (msys) shell automatically
-# converts paths for any non-msys applications it launches,
-# but that facility isn't available from inside the cwrapper.
-# Similar accommodations are necessary for $host mingw and
-# $build cygwin.  Calling this function does no harm for other
-# $host/$build combinations not listed above.
-#
-# ARG is the path (on $build) that should be converted to
-# the proper representation for $host. The result is stored
-# in $func_to_host_path_result.
-func_to_host_path ()
-{
-  func_to_host_path_result="$1"
-  if test -n "$1" ; then
-    case $host in
-      *mingw* )
-        lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
-        case $build in
-          *mingw* ) # actually, msys
-            # awkward: cmd appends spaces to result
-            lt_sed_strip_trailing_spaces="s/[ ]*\$//"
-            func_to_host_path_tmp1=`( cmd //c echo "$1" |\
-              $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""`
-            func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
-              $SED -e "$lt_sed_naive_backslashify"`
-            ;;
-          *cygwin* )
-            func_to_host_path_tmp1=`cygpath -w "$1"`
-            func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
-              $SED -e "$lt_sed_naive_backslashify"`
-            ;;
-          * )
-            # Unfortunately, winepath does not exit with a non-zero
-            # error code, so we are forced to check the contents of
-            # stdout. On the other hand, if the command is not
-            # found, the shell will set an exit code of 127 and print
-            # *an error message* to stdout. So we must check for both
-            # error code of zero AND non-empty stdout, which explains
-            # the odd construction:
-            func_to_host_path_tmp1=`winepath -w "$1" 2>/dev/null`
-            if test "$?" -eq 0 && test -n "${func_to_host_path_tmp1}"; then
-              func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
-                $SED -e "$lt_sed_naive_backslashify"`
-            else
-              # Allow warning below.
-              func_to_host_path_result=""
-            fi
-            ;;
-        esac
-        if test -z "$func_to_host_path_result" ; then
-          func_error "Could not determine host path corresponding to"
-          func_error "  '$1'"
-          func_error "Continuing, but uninstalled executables may not work."
-          # Fallback:
-          func_to_host_path_result="$1"
-        fi
-        ;;
-    esac
-  fi
-}
-# end: func_to_host_path
-
-# func_to_host_pathlist arg
-#
-# Convert pathlists to host format when used with build tools.
-# See func_to_host_path(), above. This function supports the
-# following $build/$host combinations (but does no harm for
-# combinations not listed here):
-#    $build          $host
-#    mingw (msys)    mingw  [e.g. native]
-#    cygwin          mingw
-#    *nix + wine     mingw
-#
-# Path separators are also converted from $build format to
-# $host format. If ARG begins or ends with a path separator
-# character, it is preserved (but converted to $host format)
-# on output.
-#
-# ARG is a pathlist (on $build) that should be converted to
-# the proper representation on $host. The result is stored
-# in $func_to_host_pathlist_result.
-func_to_host_pathlist ()
-{
-  func_to_host_pathlist_result="$1"
-  if test -n "$1" ; then
-    case $host in
-      *mingw* )
-        lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
-        # Remove leading and trailing path separator characters from
-        # ARG. msys behavior is inconsistent here, cygpath turns them
-        # into '.;' and ';.', and winepath ignores them completely.
-        func_to_host_pathlist_tmp2="$1"
-        # Once set for this call, this variable should not be
-        # reassigned. It is used in tha fallback case.
-        func_to_host_pathlist_tmp1=`echo "$func_to_host_pathlist_tmp2" |\
-          $SED -e 's|^:*||' -e 's|:*$||'`
-        case $build in
-          *mingw* ) # Actually, msys.
-            # Awkward: cmd appends spaces to result.
-            lt_sed_strip_trailing_spaces="s/[ ]*\$//"
-            func_to_host_pathlist_tmp2=`( cmd //c echo "$func_to_host_pathlist_tmp1" |\
-              $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""`
-            func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\
-              $SED -e "$lt_sed_naive_backslashify"`
-            ;;
-          *cygwin* )
-            func_to_host_pathlist_tmp2=`cygpath -w -p "$func_to_host_pathlist_tmp1"`
-            func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\
-              $SED -e "$lt_sed_naive_backslashify"`
-            ;;
-          * )
-            # unfortunately, winepath doesn't convert pathlists
-            func_to_host_pathlist_result=""
-            func_to_host_pathlist_oldIFS=$IFS
-            IFS=:
-            for func_to_host_pathlist_f in $func_to_host_pathlist_tmp1 ; do
-              IFS=$func_to_host_pathlist_oldIFS
-              if test -n "$func_to_host_pathlist_f" ; then
-                func_to_host_path "$func_to_host_pathlist_f"
-                if test -n "$func_to_host_path_result" ; then
-                  if test -z "$func_to_host_pathlist_result" ; then
-                    func_to_host_pathlist_result="$func_to_host_path_result"
-                  else
-                    func_to_host_pathlist_result="$func_to_host_pathlist_result;$func_to_host_path_result"
-                  fi
-                fi
-              fi
-              IFS=:
-            done
-            IFS=$func_to_host_pathlist_oldIFS
-            ;;
-        esac
-        if test -z "$func_to_host_pathlist_result" ; then
-          func_error "Could not determine the host path(s) corresponding to"
-          func_error "  '$1'"
-          func_error "Continuing, but uninstalled executables may not work."
-          # Fallback. This may break if $1 contains DOS-style drive
-          # specifications. The fix is not to complicate the expression
-          # below, but for the user to provide a working wine installation
-          # with winepath so that path translation in the cross-to-mingw
-          # case works properly.
-          lt_replace_pathsep_nix_to_dos="s|:|;|g"
-          func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp1" |\
-            $SED -e "$lt_replace_pathsep_nix_to_dos"`
-        fi
-        # Now, add the leading and trailing path separators back
-        case "$1" in
-          :* ) func_to_host_pathlist_result=";$func_to_host_pathlist_result"
-            ;;
-        esac
-        case "$1" in
-          *: ) func_to_host_pathlist_result="$func_to_host_pathlist_result;"
-            ;;
-        esac
-        ;;
-    esac
-  fi
-}
-# end: func_to_host_pathlist
-
-# func_emit_cwrapperexe_src
-# emit the source code for a wrapper executable on stdout
-# Must ONLY be called from within func_mode_link because
-# it depends on a number of variable set therein.
-func_emit_cwrapperexe_src ()
-{
-	cat <<EOF
-
-/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
-   Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
-
-   The $output program cannot be directly executed until all the libtool
-   libraries that it depends on are installed.
-
-   This wrapper executable should never be moved out of the build directory.
-   If it is, it will not operate correctly.
-
-   Currently, it simply execs the wrapper *script* "$SHELL $output",
-   but could eventually absorb all of the scripts functionality and
-   exec $objdir/$outputname directly.
-*/
-EOF
-	    cat <<"EOF"
-#include <stdio.h>
-#include <stdlib.h>
-#ifdef _MSC_VER
-# include <direct.h>
-# include <process.h>
-# include <io.h>
-# define setmode _setmode
-#else
-# include <unistd.h>
-# include <stdint.h>
-# ifdef __CYGWIN__
-#  include <io.h>
-#  define HAVE_SETENV
-#  ifdef __STRICT_ANSI__
-char *realpath (const char *, char *);
-int putenv (char *);
-int setenv (const char *, const char *, int);
-#  endif
-# endif
-#endif
-#include <malloc.h>
-#include <stdarg.h>
-#include <assert.h>
-#include <string.h>
-#include <ctype.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <sys/stat.h>
-
-#if defined(PATH_MAX)
-# define LT_PATHMAX PATH_MAX
-#elif defined(MAXPATHLEN)
-# define LT_PATHMAX MAXPATHLEN
-#else
-# define LT_PATHMAX 1024
-#endif
-
-#ifndef S_IXOTH
-# define S_IXOTH 0
-#endif
-#ifndef S_IXGRP
-# define S_IXGRP 0
-#endif
-
-#ifdef _MSC_VER
-# define S_IXUSR _S_IEXEC
-# define stat _stat
-# ifndef _INTPTR_T_DEFINED
-#  define intptr_t int
-# endif
-#endif
-
-#ifndef DIR_SEPARATOR
-# define DIR_SEPARATOR '/'
-# define PATH_SEPARATOR ':'
-#endif
-
-#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
-  defined (__OS2__)
-# define HAVE_DOS_BASED_FILE_SYSTEM
-# define FOPEN_WB "wb"
-# ifndef DIR_SEPARATOR_2
-#  define DIR_SEPARATOR_2 '\\'
-# endif
-# ifndef PATH_SEPARATOR_2
-#  define PATH_SEPARATOR_2 ';'
-# endif
-#endif
-
-#ifndef DIR_SEPARATOR_2
-# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
-#else /* DIR_SEPARATOR_2 */
-# define IS_DIR_SEPARATOR(ch) \
-	(((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
-#endif /* DIR_SEPARATOR_2 */
-
-#ifndef PATH_SEPARATOR_2
-# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
-#else /* PATH_SEPARATOR_2 */
-# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
-#endif /* PATH_SEPARATOR_2 */
-
-#ifdef __CYGWIN__
-# define FOPEN_WB "wb"
-#endif
-
-#ifndef FOPEN_WB
-# define FOPEN_WB "w"
-#endif
-#ifndef _O_BINARY
-# define _O_BINARY 0
-#endif
-
-#define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
-#define XFREE(stale) do { \
-  if (stale) { free ((void *) stale); stale = 0; } \
-} while (0)
-
-#undef LTWRAPPER_DEBUGPRINTF
-#if defined DEBUGWRAPPER
-# define LTWRAPPER_DEBUGPRINTF(args) ltwrapper_debugprintf args
-static void
-ltwrapper_debugprintf (const char *fmt, ...)
-{
-    va_list args;
-    va_start (args, fmt);
-    (void) vfprintf (stderr, fmt, args);
-    va_end (args);
-}
-#else
-# define LTWRAPPER_DEBUGPRINTF(args)
-#endif
-
-const char *program_name = NULL;
-
-void *xmalloc (size_t num);
-char *xstrdup (const char *string);
-const char *base_name (const char *name);
-char *find_executable (const char *wrapper);
-char *chase_symlinks (const char *pathspec);
-int make_executable (const char *path);
-int check_executable (const char *path);
-char *strendzap (char *str, const char *pat);
-void lt_fatal (const char *message, ...);
-void lt_setenv (const char *name, const char *value);
-char *lt_extend_str (const char *orig_value, const char *add, int to_end);
-void lt_opt_process_env_set (const char *arg);
-void lt_opt_process_env_prepend (const char *arg);
-void lt_opt_process_env_append (const char *arg);
-int lt_split_name_value (const char *arg, char** name, char** value);
-void lt_update_exe_path (const char *name, const char *value);
-void lt_update_lib_path (const char *name, const char *value);
-
-static const char *script_text_part1 =
-EOF
-
-	    func_emit_wrapper_part1 yes |
-	        $SED -e 's/\([\\"]\)/\\\1/g' \
-	             -e 's/^/  "/' -e 's/$/\\n"/'
-	    echo ";"
-	    cat <<EOF
-
-static const char *script_text_part2 =
-EOF
-	    func_emit_wrapper_part2 yes |
-	        $SED -e 's/\([\\"]\)/\\\1/g' \
-	             -e 's/^/  "/' -e 's/$/\\n"/'
-	    echo ";"
-
-	    cat <<EOF
-const char * MAGIC_EXE = "$magic_exe";
-const char * LIB_PATH_VARNAME = "$shlibpath_var";
-EOF
-
-	    if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
-              func_to_host_pathlist "$temp_rpath"
-	      cat <<EOF
-const char * LIB_PATH_VALUE   = "$func_to_host_pathlist_result";
-EOF
-	    else
-	      cat <<"EOF"
-const char * LIB_PATH_VALUE   = "";
-EOF
-	    fi
-
-	    if test -n "$dllsearchpath"; then
-              func_to_host_pathlist "$dllsearchpath:"
-	      cat <<EOF
-const char * EXE_PATH_VARNAME = "PATH";
-const char * EXE_PATH_VALUE   = "$func_to_host_pathlist_result";
-EOF
-	    else
-	      cat <<"EOF"
-const char * EXE_PATH_VARNAME = "";
-const char * EXE_PATH_VALUE   = "";
-EOF
-	    fi
-
-	    if test "$fast_install" = yes; then
-	      cat <<EOF
-const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
-EOF
-	    else
-	      cat <<EOF
-const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
-EOF
-	    fi
-
-
-	    cat <<"EOF"
-
-#define LTWRAPPER_OPTION_PREFIX         "--lt-"
-#define LTWRAPPER_OPTION_PREFIX_LENGTH  5
-
-static const size_t opt_prefix_len         = LTWRAPPER_OPTION_PREFIX_LENGTH;
-static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
-
-static const char *dumpscript_opt       = LTWRAPPER_OPTION_PREFIX "dump-script";
-
-static const size_t env_set_opt_len     = LTWRAPPER_OPTION_PREFIX_LENGTH + 7;
-static const char *env_set_opt          = LTWRAPPER_OPTION_PREFIX "env-set";
-  /* argument is putenv-style "foo=bar", value of foo is set to bar */
-
-static const size_t env_prepend_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 11;
-static const char *env_prepend_opt      = LTWRAPPER_OPTION_PREFIX "env-prepend";
-  /* argument is putenv-style "foo=bar", new value of foo is bar${foo} */
-
-static const size_t env_append_opt_len  = LTWRAPPER_OPTION_PREFIX_LENGTH + 10;
-static const char *env_append_opt       = LTWRAPPER_OPTION_PREFIX "env-append";
-  /* argument is putenv-style "foo=bar", new value of foo is ${foo}bar */
-
-int
-main (int argc, char *argv[])
-{
-  char **newargz;
-  int  newargc;
-  char *tmp_pathspec;
-  char *actual_cwrapper_path;
-  char *actual_cwrapper_name;
-  char *target_name;
-  char *lt_argv_zero;
-  intptr_t rval = 127;
-
-  int i;
-
-  program_name = (char *) xstrdup (base_name (argv[0]));
-  LTWRAPPER_DEBUGPRINTF (("(main) argv[0]      : %s\n", argv[0]));
-  LTWRAPPER_DEBUGPRINTF (("(main) program_name : %s\n", program_name));
-
-  /* very simple arg parsing; don't want to rely on getopt */
-  for (i = 1; i < argc; i++)
-    {
-      if (strcmp (argv[i], dumpscript_opt) == 0)
-	{
-EOF
-	    case "$host" in
-	      *mingw* | *cygwin* )
-		# make stdout use "unix" line endings
-		echo "          setmode(1,_O_BINARY);"
-		;;
-	      esac
-
-	    cat <<"EOF"
-	  printf ("%s", script_text_part1);
-	  printf ("%s", script_text_part2);
-	  return 0;
-	}
-    }
-
-  newargz = XMALLOC (char *, argc + 1);
-  tmp_pathspec = find_executable (argv[0]);
-  if (tmp_pathspec == NULL)
-    lt_fatal ("Couldn't find %s", argv[0]);
-  LTWRAPPER_DEBUGPRINTF (("(main) found exe (before symlink chase) at : %s\n",
-			  tmp_pathspec));
-
-  actual_cwrapper_path = chase_symlinks (tmp_pathspec);
-  LTWRAPPER_DEBUGPRINTF (("(main) found exe (after symlink chase) at : %s\n",
-			  actual_cwrapper_path));
-  XFREE (tmp_pathspec);
-
-  actual_cwrapper_name = xstrdup( base_name (actual_cwrapper_path));
-  strendzap (actual_cwrapper_path, actual_cwrapper_name);
-
-  /* wrapper name transforms */
-  strendzap (actual_cwrapper_name, ".exe");
-  tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
-  XFREE (actual_cwrapper_name);
-  actual_cwrapper_name = tmp_pathspec;
-  tmp_pathspec = 0;
-
-  /* target_name transforms -- use actual target program name; might have lt- prefix */
-  target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
-  strendzap (target_name, ".exe");
-  tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
-  XFREE (target_name);
-  target_name = tmp_pathspec;
-  tmp_pathspec = 0;
-
-  LTWRAPPER_DEBUGPRINTF (("(main) libtool target name: %s\n",
-			  target_name));
-EOF
-
-	    cat <<EOF
-  newargz[0] =
-    XMALLOC (char, (strlen (actual_cwrapper_path) +
-		    strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
-  strcpy (newargz[0], actual_cwrapper_path);
-  strcat (newargz[0], "$objdir");
-  strcat (newargz[0], "/");
-EOF
-
-	    cat <<"EOF"
-  /* stop here, and copy so we don't have to do this twice */
-  tmp_pathspec = xstrdup (newargz[0]);
-
-  /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
-  strcat (newargz[0], actual_cwrapper_name);
-
-  /* DO want the lt- prefix here if it exists, so use target_name */
-  lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
-  XFREE (tmp_pathspec);
-  tmp_pathspec = NULL;
-EOF
-
-	    case $host_os in
-	      mingw*)
-	    cat <<"EOF"
-  {
-    char* p;
-    while ((p = strchr (newargz[0], '\\')) != NULL)
-      {
-	*p = '/';
-      }
-    while ((p = strchr (lt_argv_zero, '\\')) != NULL)
-      {
-	*p = '/';
-      }
-  }
-EOF
-	    ;;
-	    esac
-
-	    cat <<"EOF"
-  XFREE (target_name);
-  XFREE (actual_cwrapper_path);
-  XFREE (actual_cwrapper_name);
-
-  lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
-  lt_setenv ("DUALCASE", "1");  /* for MSK sh */
-  lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
-  lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
-
-  newargc=0;
-  for (i = 1; i < argc; i++)
-    {
-      if (strncmp (argv[i], env_set_opt, env_set_opt_len) == 0)
-        {
-          if (argv[i][env_set_opt_len] == '=')
-            {
-              const char *p = argv[i] + env_set_opt_len + 1;
-              lt_opt_process_env_set (p);
-            }
-          else if (argv[i][env_set_opt_len] == '\0' && i + 1 < argc)
-            {
-              lt_opt_process_env_set (argv[++i]); /* don't copy */
-            }
-          else
-            lt_fatal ("%s missing required argument", env_set_opt);
-          continue;
-        }
-      if (strncmp (argv[i], env_prepend_opt, env_prepend_opt_len) == 0)
-        {
-          if (argv[i][env_prepend_opt_len] == '=')
-            {
-              const char *p = argv[i] + env_prepend_opt_len + 1;
-              lt_opt_process_env_prepend (p);
-            }
-          else if (argv[i][env_prepend_opt_len] == '\0' && i + 1 < argc)
-            {
-              lt_opt_process_env_prepend (argv[++i]); /* don't copy */
-            }
-          else
-            lt_fatal ("%s missing required argument", env_prepend_opt);
-          continue;
-        }
-      if (strncmp (argv[i], env_append_opt, env_append_opt_len) == 0)
-        {
-          if (argv[i][env_append_opt_len] == '=')
-            {
-              const char *p = argv[i] + env_append_opt_len + 1;
-              lt_opt_process_env_append (p);
-            }
-          else if (argv[i][env_append_opt_len] == '\0' && i + 1 < argc)
-            {
-              lt_opt_process_env_append (argv[++i]); /* don't copy */
-            }
-          else
-            lt_fatal ("%s missing required argument", env_append_opt);
-          continue;
-        }
-      if (strncmp (argv[i], ltwrapper_option_prefix, opt_prefix_len) == 0)
-        {
-          /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
-             namespace, but it is not one of the ones we know about and
-             have already dealt with, above (inluding dump-script), then
-             report an error. Otherwise, targets might begin to believe
-             they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
-             namespace. The first time any user complains about this, we'll
-             need to make LTWRAPPER_OPTION_PREFIX a configure-time option
-             or a configure.ac-settable value.
-           */
-          lt_fatal ("Unrecognized option in %s namespace: '%s'",
-                    ltwrapper_option_prefix, argv[i]);
-        }
-      /* otherwise ... */
-      newargz[++newargc] = xstrdup (argv[i]);
-    }
-  newargz[++newargc] = NULL;
-
-  LTWRAPPER_DEBUGPRINTF     (("(main) lt_argv_zero : %s\n", (lt_argv_zero ? lt_argv_zero : "<NULL>")));
-  for (i = 0; i < newargc; i++)
-    {
-      LTWRAPPER_DEBUGPRINTF (("(main) newargz[%d]   : %s\n", i, (newargz[i] ? newargz[i] : "<NULL>")));
-    }
-
-EOF
-
-	    case $host_os in
-	      mingw*)
-		cat <<"EOF"
-  /* execv doesn't actually work on mingw as expected on unix */
-  rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
-  if (rval == -1)
-    {
-      /* failed to start process */
-      LTWRAPPER_DEBUGPRINTF (("(main) failed to launch target \"%s\": errno = %d\n", lt_argv_zero, errno));
-      return 127;
-    }
-  return rval;
-EOF
-		;;
-	      *)
-		cat <<"EOF"
-  execv (lt_argv_zero, newargz);
-  return rval; /* =127, but avoids unused variable warning */
-EOF
-		;;
-	    esac
-
-	    cat <<"EOF"
-}
-
-void *
-xmalloc (size_t num)
-{
-  void *p = (void *) malloc (num);
-  if (!p)
-    lt_fatal ("Memory exhausted");
-
-  return p;
-}
-
-char *
-xstrdup (const char *string)
-{
-  return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
-			  string) : NULL;
-}
-
-const char *
-base_name (const char *name)
-{
-  const char *base;
-
-#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
-  /* Skip over the disk name in MSDOS pathnames. */
-  if (isalpha ((unsigned char) name[0]) && name[1] == ':')
-    name += 2;
-#endif
-
-  for (base = name; *name; name++)
-    if (IS_DIR_SEPARATOR (*name))
-      base = name + 1;
-  return base;
-}
-
-int
-check_executable (const char *path)
-{
-  struct stat st;
-
-  LTWRAPPER_DEBUGPRINTF (("(check_executable)  : %s\n",
-			  path ? (*path ? path : "EMPTY!") : "NULL!"));
-  if ((!path) || (!*path))
-    return 0;
-
-  if ((stat (path, &st) >= 0)
-      && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
-    return 1;
-  else
-    return 0;
-}
-
-int
-make_executable (const char *path)
-{
-  int rval = 0;
-  struct stat st;
-
-  LTWRAPPER_DEBUGPRINTF (("(make_executable)   : %s\n",
-			  path ? (*path ? path : "EMPTY!") : "NULL!"));
-  if ((!path) || (!*path))
-    return 0;
-
-  if (stat (path, &st) >= 0)
-    {
-      rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
-    }
-  return rval;
-}
-
-/* Searches for the full path of the wrapper.  Returns
-   newly allocated full path name if found, NULL otherwise
-   Does not chase symlinks, even on platforms that support them.
-*/
-char *
-find_executable (const char *wrapper)
-{
-  int has_slash = 0;
-  const char *p;
-  const char *p_next;
-  /* static buffer for getcwd */
-  char tmp[LT_PATHMAX + 1];
-  int tmp_len;
-  char *concat_name;
-
-  LTWRAPPER_DEBUGPRINTF (("(find_executable)   : %s\n",
-			  wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"));
-
-  if ((wrapper == NULL) || (*wrapper == '\0'))
-    return NULL;
-
-  /* Absolute path? */
-#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
-  if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
-    {
-      concat_name = xstrdup (wrapper);
-      if (check_executable (concat_name))
-	return concat_name;
-      XFREE (concat_name);
-    }
-  else
-    {
-#endif
-      if (IS_DIR_SEPARATOR (wrapper[0]))
-	{
-	  concat_name = xstrdup (wrapper);
-	  if (check_executable (concat_name))
-	    return concat_name;
-	  XFREE (concat_name);
-	}
-#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
-    }
-#endif
-
-  for (p = wrapper; *p; p++)
-    if (*p == '/')
-      {
-	has_slash = 1;
-	break;
-      }
-  if (!has_slash)
-    {
-      /* no slashes; search PATH */
-      const char *path = getenv ("PATH");
-      if (path != NULL)
-	{
-	  for (p = path; *p; p = p_next)
-	    {
-	      const char *q;
-	      size_t p_len;
-	      for (q = p; *q; q++)
-		if (IS_PATH_SEPARATOR (*q))
-		  break;
-	      p_len = q - p;
-	      p_next = (*q == '\0' ? q : q + 1);
-	      if (p_len == 0)
-		{
-		  /* empty path: current directory */
-		  if (getcwd (tmp, LT_PATHMAX) == NULL)
-		    lt_fatal ("getcwd failed");
-		  tmp_len = strlen (tmp);
-		  concat_name =
-		    XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
-		  memcpy (concat_name, tmp, tmp_len);
-		  concat_name[tmp_len] = '/';
-		  strcpy (concat_name + tmp_len + 1, wrapper);
-		}
-	      else
-		{
-		  concat_name =
-		    XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
-		  memcpy (concat_name, p, p_len);
-		  concat_name[p_len] = '/';
-		  strcpy (concat_name + p_len + 1, wrapper);
-		}
-	      if (check_executable (concat_name))
-		return concat_name;
-	      XFREE (concat_name);
-	    }
-	}
-      /* not found in PATH; assume curdir */
-    }
-  /* Relative path | not found in path: prepend cwd */
-  if (getcwd (tmp, LT_PATHMAX) == NULL)
-    lt_fatal ("getcwd failed");
-  tmp_len = strlen (tmp);
-  concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
-  memcpy (concat_name, tmp, tmp_len);
-  concat_name[tmp_len] = '/';
-  strcpy (concat_name + tmp_len + 1, wrapper);
-
-  if (check_executable (concat_name))
-    return concat_name;
-  XFREE (concat_name);
-  return NULL;
-}
-
-char *
-chase_symlinks (const char *pathspec)
-{
-#ifndef S_ISLNK
-  return xstrdup (pathspec);
-#else
-  char buf[LT_PATHMAX];
-  struct stat s;
-  char *tmp_pathspec = xstrdup (pathspec);
-  char *p;
-  int has_symlinks = 0;
-  while (strlen (tmp_pathspec) && !has_symlinks)
-    {
-      LTWRAPPER_DEBUGPRINTF (("checking path component for symlinks: %s\n",
-			      tmp_pathspec));
-      if (lstat (tmp_pathspec, &s) == 0)
-	{
-	  if (S_ISLNK (s.st_mode) != 0)
-	    {
-	      has_symlinks = 1;
-	      break;
-	    }
-
-	  /* search backwards for last DIR_SEPARATOR */
-	  p = tmp_pathspec + strlen (tmp_pathspec) - 1;
-	  while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
-	    p--;
-	  if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
-	    {
-	      /* no more DIR_SEPARATORS left */
-	      break;
-	    }
-	  *p = '\0';
-	}
-      else
-	{
-	  char *errstr = strerror (errno);
-	  lt_fatal ("Error accessing file %s (%s)", tmp_pathspec, errstr);
-	}
-    }
-  XFREE (tmp_pathspec);
-
-  if (!has_symlinks)
-    {
-      return xstrdup (pathspec);
-    }
-
-  tmp_pathspec = realpath (pathspec, buf);
-  if (tmp_pathspec == 0)
-    {
-      lt_fatal ("Could not follow symlinks for %s", pathspec);
-    }
-  return xstrdup (tmp_pathspec);
-#endif
-}
-
-char *
-strendzap (char *str, const char *pat)
-{
-  size_t len, patlen;
-
-  assert (str != NULL);
-  assert (pat != NULL);
-
-  len = strlen (str);
-  patlen = strlen (pat);
-
-  if (patlen <= len)
-    {
-      str += len - patlen;
-      if (strcmp (str, pat) == 0)
-	*str = '\0';
-    }
-  return str;
-}
-
-static void
-lt_error_core (int exit_status, const char *mode,
-	       const char *message, va_list ap)
-{
-  fprintf (stderr, "%s: %s: ", program_name, mode);
-  vfprintf (stderr, message, ap);
-  fprintf (stderr, ".\n");
-
-  if (exit_status >= 0)
-    exit (exit_status);
-}
-
-void
-lt_fatal (const char *message, ...)
-{
-  va_list ap;
-  va_start (ap, message);
-  lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
-  va_end (ap);
-}
-
-void
-lt_setenv (const char *name, const char *value)
-{
-  LTWRAPPER_DEBUGPRINTF (("(lt_setenv) setting '%s' to '%s'\n",
-                          (name ? name : "<NULL>"),
-                          (value ? value : "<NULL>")));
-  {
-#ifdef HAVE_SETENV
-    /* always make a copy, for consistency with !HAVE_SETENV */
-    char *str = xstrdup (value);
-    setenv (name, str, 1);
-#else
-    int len = strlen (name) + 1 + strlen (value) + 1;
-    char *str = XMALLOC (char, len);
-    sprintf (str, "%s=%s", name, value);
-    if (putenv (str) != EXIT_SUCCESS)
-      {
-        XFREE (str);
-      }
-#endif
-  }
-}
-
-char *
-lt_extend_str (const char *orig_value, const char *add, int to_end)
-{
-  char *new_value;
-  if (orig_value && *orig_value)
-    {
-      int orig_value_len = strlen (orig_value);
-      int add_len = strlen (add);
-      new_value = XMALLOC (char, add_len + orig_value_len + 1);
-      if (to_end)
-        {
-          strcpy (new_value, orig_value);
-          strcpy (new_value + orig_value_len, add);
-        }
-      else
-        {
-          strcpy (new_value, add);
-          strcpy (new_value + add_len, orig_value);
-        }
-    }
-  else
-    {
-      new_value = xstrdup (add);
-    }
-  return new_value;
-}
-
-int
-lt_split_name_value (const char *arg, char** name, char** value)
-{
-  const char *p;
-  int len;
-  if (!arg || !*arg)
-    return 1;
-
-  p = strchr (arg, (int)'=');
-
-  if (!p)
-    return 1;
-
-  *value = xstrdup (++p);
-
-  len = strlen (arg) - strlen (*value);
-  *name = XMALLOC (char, len);
-  strncpy (*name, arg, len-1);
-  (*name)[len - 1] = '\0';
-
-  return 0;
-}
-
-void
-lt_opt_process_env_set (const char *arg)
-{
-  char *name = NULL;
-  char *value = NULL;
-
-  if (lt_split_name_value (arg, &name, &value) != 0)
-    {
-      XFREE (name);
-      XFREE (value);
-      lt_fatal ("bad argument for %s: '%s'", env_set_opt, arg);
-    }
-
-  lt_setenv (name, value);
-  XFREE (name);
-  XFREE (value);
-}
-
-void
-lt_opt_process_env_prepend (const char *arg)
-{
-  char *name = NULL;
-  char *value = NULL;
-  char *new_value = NULL;
-
-  if (lt_split_name_value (arg, &name, &value) != 0)
-    {
-      XFREE (name);
-      XFREE (value);
-      lt_fatal ("bad argument for %s: '%s'", env_prepend_opt, arg);
-    }
-
-  new_value = lt_extend_str (getenv (name), value, 0);
-  lt_setenv (name, new_value);
-  XFREE (new_value);
-  XFREE (name);
-  XFREE (value);
-}
-
-void
-lt_opt_process_env_append (const char *arg)
-{
-  char *name = NULL;
-  char *value = NULL;
-  char *new_value = NULL;
-
-  if (lt_split_name_value (arg, &name, &value) != 0)
-    {
-      XFREE (name);
-      XFREE (value);
-      lt_fatal ("bad argument for %s: '%s'", env_append_opt, arg);
-    }
-
-  new_value = lt_extend_str (getenv (name), value, 1);
-  lt_setenv (name, new_value);
-  XFREE (new_value);
-  XFREE (name);
-  XFREE (value);
-}
-
-void
-lt_update_exe_path (const char *name, const char *value)
-{
-  LTWRAPPER_DEBUGPRINTF (("(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
-                          (name ? name : "<NULL>"),
-                          (value ? value : "<NULL>")));
-
-  if (name && *name && value && *value)
-    {
-      char *new_value = lt_extend_str (getenv (name), value, 0);
-      /* some systems can't cope with a ':'-terminated path #' */
-      int len = strlen (new_value);
-      while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
-        {
-          new_value[len-1] = '\0';
-        }
-      lt_setenv (name, new_value);
-      XFREE (new_value);
-    }
-}
-
-void
-lt_update_lib_path (const char *name, const char *value)
-{
-  LTWRAPPER_DEBUGPRINTF (("(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
-                          (name ? name : "<NULL>"),
-                          (value ? value : "<NULL>")));
-
-  if (name && *name && value && *value)
-    {
-      char *new_value = lt_extend_str (getenv (name), value, 0);
-      lt_setenv (name, new_value);
-      XFREE (new_value);
-    }
-}
-
-
-EOF
-}
-# end: func_emit_cwrapperexe_src
-
-# func_mode_link arg...
-func_mode_link ()
-{
-    $opt_debug
-    case $host in
-    *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
-      # It is impossible to link a dll without this setting, and
-      # we shouldn't force the makefile maintainer to figure out
-      # which system we are compiling for in order to pass an extra
-      # flag for every libtool invocation.
-      # allow_undefined=no
-
-      # FIXME: Unfortunately, there are problems with the above when trying
-      # to make a dll which has undefined symbols, in which case not
-      # even a static library is built.  For now, we need to specify
-      # -no-undefined on the libtool link line when we can be certain
-      # that all symbols are satisfied, otherwise we get a static library.
-      allow_undefined=yes
-      ;;
-    *)
-      allow_undefined=yes
-      ;;
-    esac
-    libtool_args=$nonopt
-    base_compile="$nonopt $@"
-    compile_command=$nonopt
-    finalize_command=$nonopt
-
-    compile_rpath=
-    finalize_rpath=
-    compile_shlibpath=
-    finalize_shlibpath=
-    convenience=
-    old_convenience=
-    deplibs=
-    old_deplibs=
-    compiler_flags=
-    linker_flags=
-    dllsearchpath=
-    lib_search_path=`pwd`
-    inst_prefix_dir=
-    new_inherited_linker_flags=
-
-    avoid_version=no
-    dlfiles=
-    dlprefiles=
-    dlself=no
-    export_dynamic=no
-    export_symbols=
-    export_symbols_regex=
-    generated=
-    libobjs=
-    ltlibs=
-    module=no
-    no_install=no
-    objs=
-    non_pic_objects=
-    precious_files_regex=
-    prefer_static_libs=no
-    preload=no
-    prev=
-    prevarg=
-    release=
-    rpath=
-    xrpath=
-    perm_rpath=
-    temp_rpath=
-    thread_safe=no
-    vinfo=
-    vinfo_number=no
-    weak_libs=
-    single_module="${wl}-single_module"
-    func_infer_tag $base_compile
-
-    # We need to know -static, to get the right output filenames.
-    for arg
-    do
-      case $arg in
-      -shared)
-	test "$build_libtool_libs" != yes && \
-	  func_fatal_configuration "can not build a shared library"
-	build_old_libs=no
-	break
-	;;
-      -all-static | -static | -static-libtool-libs)
-	case $arg in
-	-all-static)
-	  if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
-	    func_warning "complete static linking is impossible in this configuration"
-	  fi
-	  if test -n "$link_static_flag"; then
-	    dlopen_self=$dlopen_self_static
-	  fi
-	  prefer_static_libs=yes
-	  ;;
-	-static)
-	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
-	    dlopen_self=$dlopen_self_static
-	  fi
-	  prefer_static_libs=built
-	  ;;
-	-static-libtool-libs)
-	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
-	    dlopen_self=$dlopen_self_static
-	  fi
-	  prefer_static_libs=yes
-	  ;;
-	esac
-	build_libtool_libs=no
-	build_old_libs=yes
-	break
-	;;
-      esac
-    done
-
-    # See if our shared archives depend on static archives.
-    test -n "$old_archive_from_new_cmds" && build_old_libs=yes
-
-    # Go through the arguments, transforming them on the way.
-    while test "$#" -gt 0; do
-      arg="$1"
-      shift
-      func_quote_for_eval "$arg"
-      qarg=$func_quote_for_eval_unquoted_result
-      func_append libtool_args " $func_quote_for_eval_result"
-
-      # If the previous option needs an argument, assign it.
-      if test -n "$prev"; then
-	case $prev in
-	output)
-	  func_append compile_command " @OUTPUT@"
-	  func_append finalize_command " @OUTPUT@"
-	  ;;
-	esac
-
-	case $prev in
-	dlfiles|dlprefiles)
-	  if test "$preload" = no; then
-	    # Add the symbol object into the linking commands.
-	    func_append compile_command " @SYMFILE@"
-	    func_append finalize_command " @SYMFILE@"
-	    preload=yes
-	  fi
-	  case $arg in
-	  *.la | *.lo) ;;  # We handle these cases below.
-	  force)
-	    if test "$dlself" = no; then
-	      dlself=needless
-	      export_dynamic=yes
-	    fi
-	    prev=
-	    continue
-	    ;;
-	  self)
-	    if test "$prev" = dlprefiles; then
-	      dlself=yes
-	    elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
-	      dlself=yes
-	    else
-	      dlself=needless
-	      export_dynamic=yes
-	    fi
-	    prev=
-	    continue
-	    ;;
-	  *)
-	    if test "$prev" = dlfiles; then
-	      dlfiles="$dlfiles $arg"
-	    else
-	      dlprefiles="$dlprefiles $arg"
-	    fi
-	    prev=
-	    continue
-	    ;;
-	  esac
-	  ;;
-	expsyms)
-	  export_symbols="$arg"
-	  test -f "$arg" \
-	    || func_fatal_error "symbol file \`$arg' does not exist"
-	  prev=
-	  continue
-	  ;;
-	expsyms_regex)
-	  export_symbols_regex="$arg"
-	  prev=
-	  continue
-	  ;;
-	framework)
-	  case $host in
-	    *-*-darwin*)
-	      case "$deplibs " in
-		*" $qarg.ltframework "*) ;;
-		*) deplibs="$deplibs $qarg.ltframework" # this is fixed later
-		   ;;
-	      esac
-	      ;;
-	  esac
-	  prev=
-	  continue
-	  ;;
-	inst_prefix)
-	  inst_prefix_dir="$arg"
-	  prev=
-	  continue
-	  ;;
-	objectlist)
-	  if test -f "$arg"; then
-	    save_arg=$arg
-	    moreargs=
-	    for fil in `cat "$save_arg"`
-	    do
-#	      moreargs="$moreargs $fil"
-	      arg=$fil
-	      # A libtool-controlled object.
-
-	      # Check to see that this really is a libtool object.
-	      if func_lalib_unsafe_p "$arg"; then
-		pic_object=
-		non_pic_object=
-
-		# Read the .lo file
-		func_source "$arg"
-
-		if test -z "$pic_object" ||
-		   test -z "$non_pic_object" ||
-		   test "$pic_object" = none &&
-		   test "$non_pic_object" = none; then
-		  func_fatal_error "cannot find name of object for \`$arg'"
-		fi
-
-		# Extract subdirectory from the argument.
-		func_dirname "$arg" "/" ""
-		xdir="$func_dirname_result"
-
-		if test "$pic_object" != none; then
-		  # Prepend the subdirectory the object is found in.
-		  pic_object="$xdir$pic_object"
-
-		  if test "$prev" = dlfiles; then
-		    if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
-		      dlfiles="$dlfiles $pic_object"
-		      prev=
-		      continue
-		    else
-		      # If libtool objects are unsupported, then we need to preload.
-		      prev=dlprefiles
-		    fi
-		  fi
-
-		  # CHECK ME:  I think I busted this.  -Ossama
-		  if test "$prev" = dlprefiles; then
-		    # Preload the old-style object.
-		    dlprefiles="$dlprefiles $pic_object"
-		    prev=
-		  fi
-
-		  # A PIC object.
-		  func_append libobjs " $pic_object"
-		  arg="$pic_object"
-		fi
-
-		# Non-PIC object.
-		if test "$non_pic_object" != none; then
-		  # Prepend the subdirectory the object is found in.
-		  non_pic_object="$xdir$non_pic_object"
-
-		  # A standard non-PIC object
-		  func_append non_pic_objects " $non_pic_object"
-		  if test -z "$pic_object" || test "$pic_object" = none ; then
-		    arg="$non_pic_object"
-		  fi
-		else
-		  # If the PIC object exists, use it instead.
-		  # $xdir was prepended to $pic_object above.
-		  non_pic_object="$pic_object"
-		  func_append non_pic_objects " $non_pic_object"
-		fi
-	      else
-		# Only an error if not doing a dry-run.
-		if $opt_dry_run; then
-		  # Extract subdirectory from the argument.
-		  func_dirname "$arg" "/" ""
-		  xdir="$func_dirname_result"
-
-		  func_lo2o "$arg"
-		  pic_object=$xdir$objdir/$func_lo2o_result
-		  non_pic_object=$xdir$func_lo2o_result
-		  func_append libobjs " $pic_object"
-		  func_append non_pic_objects " $non_pic_object"
-	        else
-		  func_fatal_error "\`$arg' is not a valid libtool object"
-		fi
-	      fi
-	    done
-	  else
-	    func_fatal_error "link input file \`$arg' does not exist"
-	  fi
-	  arg=$save_arg
-	  prev=
-	  continue
-	  ;;
-	precious_regex)
-	  precious_files_regex="$arg"
-	  prev=
-	  continue
-	  ;;
-	release)
-	  release="-$arg"
-	  prev=
-	  continue
-	  ;;
-	rpath | xrpath)
-	  # We need an absolute path.
-	  case $arg in
-	  [\\/]* | [A-Za-z]:[\\/]*) ;;
-	  *)
-	    func_fatal_error "only absolute run-paths are allowed"
-	    ;;
-	  esac
-	  if test "$prev" = rpath; then
-	    case "$rpath " in
-	    *" $arg "*) ;;
-	    *) rpath="$rpath $arg" ;;
-	    esac
-	  else
-	    case "$xrpath " in
-	    *" $arg "*) ;;
-	    *) xrpath="$xrpath $arg" ;;
-	    esac
-	  fi
-	  prev=
-	  continue
-	  ;;
-	shrext)
-	  shrext_cmds="$arg"
-	  prev=
-	  continue
-	  ;;
-	weak)
-	  weak_libs="$weak_libs $arg"
-	  prev=
-	  continue
-	  ;;
-	xcclinker)
-	  linker_flags="$linker_flags $qarg"
-	  compiler_flags="$compiler_flags $qarg"
-	  prev=
-	  func_append compile_command " $qarg"
-	  func_append finalize_command " $qarg"
-	  continue
-	  ;;
-	xcompiler)
-	  compiler_flags="$compiler_flags $qarg"
-	  prev=
-	  func_append compile_command " $qarg"
-	  func_append finalize_command " $qarg"
-	  continue
-	  ;;
-	xlinker)
-	  linker_flags="$linker_flags $qarg"
-	  compiler_flags="$compiler_flags $wl$qarg"
-	  prev=
-	  func_append compile_command " $wl$qarg"
-	  func_append finalize_command " $wl$qarg"
-	  continue
-	  ;;
-	*)
-	  eval "$prev=\"\$arg\""
-	  prev=
-	  continue
-	  ;;
-	esac
-      fi # test -n "$prev"
-
-      prevarg="$arg"
-
-      case $arg in
-      -all-static)
-	if test -n "$link_static_flag"; then
-	  # See comment for -static flag below, for more details.
-	  func_append compile_command " $link_static_flag"
-	  func_append finalize_command " $link_static_flag"
-	fi
-	continue
-	;;
-
-      -allow-undefined)
-	# FIXME: remove this flag sometime in the future.
-	func_fatal_error "\`-allow-undefined' must not be used because it is the default"
-	;;
-
-      -avoid-version)
-	avoid_version=yes
-	continue
-	;;
-
-      -dlopen)
-	prev=dlfiles
-	continue
-	;;
-
-      -dlpreopen)
-	prev=dlprefiles
-	continue
-	;;
-
-      -export-dynamic)
-	export_dynamic=yes
-	continue
-	;;
-
-      -export-symbols | -export-symbols-regex)
-	if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
-	  func_fatal_error "more than one -exported-symbols argument is not allowed"
-	fi
-	if test "X$arg" = "X-export-symbols"; then
-	  prev=expsyms
-	else
-	  prev=expsyms_regex
-	fi
-	continue
-	;;
-
-      -framework)
-	prev=framework
-	continue
-	;;
-
-      -inst-prefix-dir)
-	prev=inst_prefix
-	continue
-	;;
-
-      # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
-      # so, if we see these flags be careful not to treat them like -L
-      -L[A-Z][A-Z]*:*)
-	case $with_gcc/$host in
-	no/*-*-irix* | /*-*-irix*)
-	  func_append compile_command " $arg"
-	  func_append finalize_command " $arg"
-	  ;;
-	esac
-	continue
-	;;
-
-      -L*)
-	func_stripname '-L' '' "$arg"
-	dir=$func_stripname_result
-	if test -z "$dir"; then
-	  if test "$#" -gt 0; then
-	    func_fatal_error "require no space between \`-L' and \`$1'"
-	  else
-	    func_fatal_error "need path for \`-L' option"
-	  fi
-	fi
-	# We need an absolute path.
-	case $dir in
-	[\\/]* | [A-Za-z]:[\\/]*) ;;
-	*)
-	  absdir=`cd "$dir" && pwd`
-	  test -z "$absdir" && \
-	    func_fatal_error "cannot determine absolute directory name of \`$dir'"
-	  dir="$absdir"
-	  ;;
-	esac
-	case "$deplibs " in
-	*" -L$dir "*) ;;
-	*)
-	  deplibs="$deplibs -L$dir"
-	  lib_search_path="$lib_search_path $dir"
-	  ;;
-	esac
-	case $host in
-	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
-	  testbindir=`$ECHO "X$dir" | $Xsed -e 's*/lib$*/bin*'`
-	  case :$dllsearchpath: in
-	  *":$dir:"*) ;;
-	  ::) dllsearchpath=$dir;;
-	  *) dllsearchpath="$dllsearchpath:$dir";;
-	  esac
-	  case :$dllsearchpath: in
-	  *":$testbindir:"*) ;;
-	  ::) dllsearchpath=$testbindir;;
-	  *) dllsearchpath="$dllsearchpath:$testbindir";;
-	  esac
-	  ;;
-	esac
-	continue
-	;;
-
-      -l*)
-	if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
-	  case $host in
-	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc*)
-	    # These systems don't actually have a C or math library (as such)
-	    continue
-	    ;;
-	  *-*-os2*)
-	    # These systems don't actually have a C library (as such)
-	    test "X$arg" = "X-lc" && continue
-	    ;;
-	  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
-	    # Do not include libc due to us having libc/libc_r.
-	    test "X$arg" = "X-lc" && continue
-	    ;;
-	  *-*-rhapsody* | *-*-darwin1.[012])
-	    # Rhapsody C and math libraries are in the System framework
-	    deplibs="$deplibs System.ltframework"
-	    continue
-	    ;;
-	  *-*-sco3.2v5* | *-*-sco5v6*)
-	    # Causes problems with __ctype
-	    test "X$arg" = "X-lc" && continue
-	    ;;
-	  *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
-	    # Compiler inserts libc in the correct place for threads to work
-	    test "X$arg" = "X-lc" && continue
-	    ;;
-	  esac
-	elif test "X$arg" = "X-lc_r"; then
-	 case $host in
-	 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
-	   # Do not include libc_r directly, use -pthread flag.
-	   continue
-	   ;;
-	 esac
-	fi
-	deplibs="$deplibs $arg"
-	continue
-	;;
-
-      -module)
-	module=yes
-	continue
-	;;
-
-      # Tru64 UNIX uses -model [arg] to determine the layout of C++
-      # classes, name mangling, and exception handling.
-      # Darwin uses the -arch flag to determine output architecture.
-      -model|-arch|-isysroot)
-	compiler_flags="$compiler_flags $arg"
-	func_append compile_command " $arg"
-	func_append finalize_command " $arg"
-	prev=xcompiler
-	continue
-	;;
-
-      -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
-	compiler_flags="$compiler_flags $arg"
-	func_append compile_command " $arg"
-	func_append finalize_command " $arg"
-	case "$new_inherited_linker_flags " in
-	    *" $arg "*) ;;
-	    * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;;
-	esac
-	continue
-	;;
-
-      -multi_module)
-	single_module="${wl}-multi_module"
-	continue
-	;;
-
-      -no-fast-install)
-	fast_install=no
-	continue
-	;;
-
-      -no-install)
-	case $host in
-	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
-	  # The PATH hackery in wrapper scripts is required on Windows
-	  # and Darwin in order for the loader to find any dlls it needs.
-	  func_warning "\`-no-install' is ignored for $host"
-	  func_warning "assuming \`-no-fast-install' instead"
-	  fast_install=no
-	  ;;
-	*) no_install=yes ;;
-	esac
-	continue
-	;;
-
-      -no-undefined)
-	allow_undefined=no
-	continue
-	;;
-
-      -objectlist)
-	prev=objectlist
-	continue
-	;;
-
-      -o) prev=output ;;
-
-      -precious-files-regex)
-	prev=precious_regex
-	continue
-	;;
-
-      -release)
-	prev=release
-	continue
-	;;
-
-      -rpath)
-	prev=rpath
-	continue
-	;;
-
-      -R)
-	prev=xrpath
-	continue
-	;;
-
-      -R*)
-	func_stripname '-R' '' "$arg"
-	dir=$func_stripname_result
-	# We need an absolute path.
-	case $dir in
-	[\\/]* | [A-Za-z]:[\\/]*) ;;
-	*)
-	  func_fatal_error "only absolute run-paths are allowed"
-	  ;;
-	esac
-	case "$xrpath " in
-	*" $dir "*) ;;
-	*) xrpath="$xrpath $dir" ;;
-	esac
-	continue
-	;;
-
-      -shared)
-	# The effects of -shared are defined in a previous loop.
-	continue
-	;;
-
-      -shrext)
-	prev=shrext
-	continue
-	;;
-
-      -static | -static-libtool-libs)
-	# The effects of -static are defined in a previous loop.
-	# We used to do the same as -all-static on platforms that
-	# didn't have a PIC flag, but the assumption that the effects
-	# would be equivalent was wrong.  It would break on at least
-	# Digital Unix and AIX.
-	continue
-	;;
-
-      -thread-safe)
-	thread_safe=yes
-	continue
-	;;
-
-      -version-info)
-	prev=vinfo
-	continue
-	;;
-
-      -version-number)
-	prev=vinfo
-	vinfo_number=yes
-	continue
-	;;
-
-      -weak)
-        prev=weak
-	continue
-	;;
-
-      -Wc,*)
-	func_stripname '-Wc,' '' "$arg"
-	args=$func_stripname_result
-	arg=
-	save_ifs="$IFS"; IFS=','
-	for flag in $args; do
-	  IFS="$save_ifs"
-          func_quote_for_eval "$flag"
-	  arg="$arg $wl$func_quote_for_eval_result"
-	  compiler_flags="$compiler_flags $func_quote_for_eval_result"
-	done
-	IFS="$save_ifs"
-	func_stripname ' ' '' "$arg"
-	arg=$func_stripname_result
-	;;
-
-      -Wl,*)
-	func_stripname '-Wl,' '' "$arg"
-	args=$func_stripname_result
-	arg=
-	save_ifs="$IFS"; IFS=','
-	for flag in $args; do
-	  IFS="$save_ifs"
-          func_quote_for_eval "$flag"
-	  arg="$arg $wl$func_quote_for_eval_result"
-	  compiler_flags="$compiler_flags $wl$func_quote_for_eval_result"
-	  linker_flags="$linker_flags $func_quote_for_eval_result"
-	done
-	IFS="$save_ifs"
-	func_stripname ' ' '' "$arg"
-	arg=$func_stripname_result
-	;;
-
-      -Xcompiler)
-	prev=xcompiler
-	continue
-	;;
-
-      -Xlinker)
-	prev=xlinker
-	continue
-	;;
-
-      -XCClinker)
-	prev=xcclinker
-	continue
-	;;
-
-      # -msg_* for osf cc
-      -msg_*)
-	func_quote_for_eval "$arg"
-	arg="$func_quote_for_eval_result"
-	;;
-
-      # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
-      # -r[0-9][0-9]* specifies the processor on the SGI compiler
-      # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
-      # +DA*, +DD* enable 64-bit mode on the HP compiler
-      # -q* pass through compiler args for the IBM compiler
-      # -m*, -t[45]*, -txscale* pass through architecture-specific
-      # compiler args for GCC
-      # -F/path gives path to uninstalled frameworks, gcc on darwin
-      # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
-      # @file GCC response files
-      -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
-      -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)
-        func_quote_for_eval "$arg"
-	arg="$func_quote_for_eval_result"
-        func_append compile_command " $arg"
-        func_append finalize_command " $arg"
-        compiler_flags="$compiler_flags $arg"
-        continue
-        ;;
-
-      # Some other compiler flag.
-      -* | +*)
-        func_quote_for_eval "$arg"
-	arg="$func_quote_for_eval_result"
-	;;
-
-      *.$objext)
-	# A standard object.
-	objs="$objs $arg"
-	;;
-
-      *.lo)
-	# A libtool-controlled object.
-
-	# Check to see that this really is a libtool object.
-	if func_lalib_unsafe_p "$arg"; then
-	  pic_object=
-	  non_pic_object=
-
-	  # Read the .lo file
-	  func_source "$arg"
-
-	  if test -z "$pic_object" ||
-	     test -z "$non_pic_object" ||
-	     test "$pic_object" = none &&
-	     test "$non_pic_object" = none; then
-	    func_fatal_error "cannot find name of object for \`$arg'"
-	  fi
-
-	  # Extract subdirectory from the argument.
-	  func_dirname "$arg" "/" ""
-	  xdir="$func_dirname_result"
-
-	  if test "$pic_object" != none; then
-	    # Prepend the subdirectory the object is found in.
-	    pic_object="$xdir$pic_object"
-
-	    if test "$prev" = dlfiles; then
-	      if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
-		dlfiles="$dlfiles $pic_object"
-		prev=
-		continue
-	      else
-		# If libtool objects are unsupported, then we need to preload.
-		prev=dlprefiles
-	      fi
-	    fi
-
-	    # CHECK ME:  I think I busted this.  -Ossama
-	    if test "$prev" = dlprefiles; then
-	      # Preload the old-style object.
-	      dlprefiles="$dlprefiles $pic_object"
-	      prev=
-	    fi
-
-	    # A PIC object.
-	    func_append libobjs " $pic_object"
-	    arg="$pic_object"
-	  fi
-
-	  # Non-PIC object.
-	  if test "$non_pic_object" != none; then
-	    # Prepend the subdirectory the object is found in.
-	    non_pic_object="$xdir$non_pic_object"
-
-	    # A standard non-PIC object
-	    func_append non_pic_objects " $non_pic_object"
-	    if test -z "$pic_object" || test "$pic_object" = none ; then
-	      arg="$non_pic_object"
-	    fi
-	  else
-	    # If the PIC object exists, use it instead.
-	    # $xdir was prepended to $pic_object above.
-	    non_pic_object="$pic_object"
-	    func_append non_pic_objects " $non_pic_object"
-	  fi
-	else
-	  # Only an error if not doing a dry-run.
-	  if $opt_dry_run; then
-	    # Extract subdirectory from the argument.
-	    func_dirname "$arg" "/" ""
-	    xdir="$func_dirname_result"
-
-	    func_lo2o "$arg"
-	    pic_object=$xdir$objdir/$func_lo2o_result
-	    non_pic_object=$xdir$func_lo2o_result
-	    func_append libobjs " $pic_object"
-	    func_append non_pic_objects " $non_pic_object"
-	  else
-	    func_fatal_error "\`$arg' is not a valid libtool object"
-	  fi
-	fi
-	;;
-
-      *.$libext)
-	# An archive.
-	deplibs="$deplibs $arg"
-	old_deplibs="$old_deplibs $arg"
-	continue
-	;;
-
-      *.la)
-	# A libtool-controlled library.
-
-	if test "$prev" = dlfiles; then
-	  # This library was specified with -dlopen.
-	  dlfiles="$dlfiles $arg"
-	  prev=
-	elif test "$prev" = dlprefiles; then
-	  # The library was specified with -dlpreopen.
-	  dlprefiles="$dlprefiles $arg"
-	  prev=
-	else
-	  deplibs="$deplibs $arg"
-	fi
-	continue
-	;;
-
-      # Some other compiler argument.
-      *)
-	# Unknown arguments in both finalize_command and compile_command need
-	# to be aesthetically quoted because they are evaled later.
-	func_quote_for_eval "$arg"
-	arg="$func_quote_for_eval_result"
-	;;
-      esac # arg
-
-      # Now actually substitute the argument into the commands.
-      if test -n "$arg"; then
-	func_append compile_command " $arg"
-	func_append finalize_command " $arg"
-      fi
-    done # argument parsing loop
-
-    test -n "$prev" && \
-      func_fatal_help "the \`$prevarg' option requires an argument"
-
-    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
-      eval arg=\"$export_dynamic_flag_spec\"
-      func_append compile_command " $arg"
-      func_append finalize_command " $arg"
-    fi
-
-    oldlibs=
-    # calculate the name of the file, without its directory
-    func_basename "$output"
-    outputname="$func_basename_result"
-    libobjs_save="$libobjs"
-
-    if test -n "$shlibpath_var"; then
-      # get the directories listed in $shlibpath_var
-      eval shlib_search_path=\`\$ECHO \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
-    else
-      shlib_search_path=
-    fi
-    eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
-    eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
-
-    func_dirname "$output" "/" ""
-    output_objdir="$func_dirname_result$objdir"
-    # Create the object directory.
-    func_mkdir_p "$output_objdir"
-
-    # Determine the type of output
-    case $output in
-    "")
-      func_fatal_help "you must specify an output file"
-      ;;
-    *.$libext) linkmode=oldlib ;;
-    *.lo | *.$objext) linkmode=obj ;;
-    *.la) linkmode=lib ;;
-    *) linkmode=prog ;; # Anything else should be a program.
-    esac
-
-    specialdeplibs=
-
-    libs=
-    # Find all interdependent deplibs by searching for libraries
-    # that are linked more than once (e.g. -la -lb -la)
-    for deplib in $deplibs; do
-      if $opt_duplicate_deps ; then
-	case "$libs " in
-	*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
-	esac
-      fi
-      libs="$libs $deplib"
-    done
-
-    if test "$linkmode" = lib; then
-      libs="$predeps $libs $compiler_lib_search_path $postdeps"
-
-      # Compute libraries that are listed more than once in $predeps
-      # $postdeps and mark them as special (i.e., whose duplicates are
-      # not to be eliminated).
-      pre_post_deps=
-      if $opt_duplicate_compiler_generated_deps; then
-	for pre_post_dep in $predeps $postdeps; do
-	  case "$pre_post_deps " in
-	  *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
-	  esac
-	  pre_post_deps="$pre_post_deps $pre_post_dep"
-	done
-      fi
-      pre_post_deps=
-    fi
-
-    deplibs=
-    newdependency_libs=
-    newlib_search_path=
-    need_relink=no # whether we're linking any uninstalled libtool libraries
-    notinst_deplibs= # not-installed libtool libraries
-    notinst_path= # paths that contain not-installed libtool libraries
-
-    case $linkmode in
-    lib)
-	passes="conv dlpreopen link"
-	for file in $dlfiles $dlprefiles; do
-	  case $file in
-	  *.la) ;;
-	  *)
-	    func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
-	    ;;
-	  esac
-	done
-	;;
-    prog)
-	compile_deplibs=
-	finalize_deplibs=
-	alldeplibs=no
-	newdlfiles=
-	newdlprefiles=
-	passes="conv scan dlopen dlpreopen link"
-	;;
-    *)  passes="conv"
-	;;
-    esac
-
-    for pass in $passes; do
-      # The preopen pass in lib mode reverses $deplibs; put it back here
-      # so that -L comes before libs that need it for instance...
-      if test "$linkmode,$pass" = "lib,link"; then
-	## FIXME: Find the place where the list is rebuilt in the wrong
-	##        order, and fix it there properly
-        tmp_deplibs=
-	for deplib in $deplibs; do
-	  tmp_deplibs="$deplib $tmp_deplibs"
-	done
-	deplibs="$tmp_deplibs"
-      fi
-
-      if test "$linkmode,$pass" = "lib,link" ||
-	 test "$linkmode,$pass" = "prog,scan"; then
-	libs="$deplibs"
-	deplibs=
-      fi
-      if test "$linkmode" = prog; then
-	case $pass in
-	dlopen) libs="$dlfiles" ;;
-	dlpreopen) libs="$dlprefiles" ;;
-	link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
-	esac
-      fi
-      if test "$linkmode,$pass" = "lib,dlpreopen"; then
-	# Collect and forward deplibs of preopened libtool libs
-	for lib in $dlprefiles; do
-	  # Ignore non-libtool-libs
-	  dependency_libs=
-	  case $lib in
-	  *.la)	func_source "$lib" ;;
-	  esac
-
-	  # Collect preopened libtool deplibs, except any this library
-	  # has declared as weak libs
-	  for deplib in $dependency_libs; do
-            deplib_base=`$ECHO "X$deplib" | $Xsed -e "$basename"`
-	    case " $weak_libs " in
-	    *" $deplib_base "*) ;;
-	    *) deplibs="$deplibs $deplib" ;;
-	    esac
-	  done
-	done
-	libs="$dlprefiles"
-      fi
-      if test "$pass" = dlopen; then
-	# Collect dlpreopened libraries
-	save_deplibs="$deplibs"
-	deplibs=
-      fi
-
-      for deplib in $libs; do
-	lib=
-	found=no
-	case $deplib in
-	-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
-	  if test "$linkmode,$pass" = "prog,link"; then
-	    compile_deplibs="$deplib $compile_deplibs"
-	    finalize_deplibs="$deplib $finalize_deplibs"
-	  else
-	    compiler_flags="$compiler_flags $deplib"
-	    if test "$linkmode" = lib ; then
-		case "$new_inherited_linker_flags " in
-		    *" $deplib "*) ;;
-		    * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
-		esac
-	    fi
-	  fi
-	  continue
-	  ;;
-	-l*)
-	  if test "$linkmode" != lib && test "$linkmode" != prog; then
-	    func_warning "\`-l' is ignored for archives/objects"
-	    continue
-	  fi
-	  func_stripname '-l' '' "$deplib"
-	  name=$func_stripname_result
-	  if test "$linkmode" = lib; then
-	    searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
-	  else
-	    searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
-	  fi
-	  for searchdir in $searchdirs; do
-	    for search_ext in .la $std_shrext .so .a; do
-	      # Search the libtool library
-	      lib="$searchdir/lib${name}${search_ext}"
-	      if test -f "$lib"; then
-		if test "$search_ext" = ".la"; then
-		  found=yes
-		else
-		  found=no
-		fi
-		break 2
-	      fi
-	    done
-	  done
-	  if test "$found" != yes; then
-	    # deplib doesn't seem to be a libtool library
-	    if test "$linkmode,$pass" = "prog,link"; then
-	      compile_deplibs="$deplib $compile_deplibs"
-	      finalize_deplibs="$deplib $finalize_deplibs"
-	    else
-	      deplibs="$deplib $deplibs"
-	      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
-	    fi
-	    continue
-	  else # deplib is a libtool library
-	    # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
-	    # We need to do some special things here, and not later.
-	    if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
-	      case " $predeps $postdeps " in
-	      *" $deplib "*)
-		if func_lalib_p "$lib"; then
-		  library_names=
-		  old_library=
-		  func_source "$lib"
-		  for l in $old_library $library_names; do
-		    ll="$l"
-		  done
-		  if test "X$ll" = "X$old_library" ; then # only static version available
-		    found=no
-		    func_dirname "$lib" "" "."
-		    ladir="$func_dirname_result"
-		    lib=$ladir/$old_library
-		    if test "$linkmode,$pass" = "prog,link"; then
-		      compile_deplibs="$deplib $compile_deplibs"
-		      finalize_deplibs="$deplib $finalize_deplibs"
-		    else
-		      deplibs="$deplib $deplibs"
-		      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
-		    fi
-		    continue
-		  fi
-		fi
-		;;
-	      *) ;;
-	      esac
-	    fi
-	  fi
-	  ;; # -l
-	*.ltframework)
-	  if test "$linkmode,$pass" = "prog,link"; then
-	    compile_deplibs="$deplib $compile_deplibs"
-	    finalize_deplibs="$deplib $finalize_deplibs"
-	  else
-	    deplibs="$deplib $deplibs"
-	    if test "$linkmode" = lib ; then
-		case "$new_inherited_linker_flags " in
-		    *" $deplib "*) ;;
-		    * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
-		esac
-	    fi
-	  fi
-	  continue
-	  ;;
-	-L*)
-	  case $linkmode in
-	  lib)
-	    deplibs="$deplib $deplibs"
-	    test "$pass" = conv && continue
-	    newdependency_libs="$deplib $newdependency_libs"
-	    func_stripname '-L' '' "$deplib"
-	    newlib_search_path="$newlib_search_path $func_stripname_result"
-	    ;;
-	  prog)
-	    if test "$pass" = conv; then
-	      deplibs="$deplib $deplibs"
-	      continue
-	    fi
-	    if test "$pass" = scan; then
-	      deplibs="$deplib $deplibs"
-	    else
-	      compile_deplibs="$deplib $compile_deplibs"
-	      finalize_deplibs="$deplib $finalize_deplibs"
-	    fi
-	    func_stripname '-L' '' "$deplib"
-	    newlib_search_path="$newlib_search_path $func_stripname_result"
-	    ;;
-	  *)
-	    func_warning "\`-L' is ignored for archives/objects"
-	    ;;
-	  esac # linkmode
-	  continue
-	  ;; # -L
-	-R*)
-	  if test "$pass" = link; then
-	    func_stripname '-R' '' "$deplib"
-	    dir=$func_stripname_result
-	    # Make sure the xrpath contains only unique directories.
-	    case "$xrpath " in
-	    *" $dir "*) ;;
-	    *) xrpath="$xrpath $dir" ;;
-	    esac
-	  fi
-	  deplibs="$deplib $deplibs"
-	  continue
-	  ;;
-	*.la) lib="$deplib" ;;
-	*.$libext)
-	  if test "$pass" = conv; then
-	    deplibs="$deplib $deplibs"
-	    continue
-	  fi
-	  case $linkmode in
-	  lib)
-	    # Linking convenience modules into shared libraries is allowed,
-	    # but linking other static libraries is non-portable.
-	    case " $dlpreconveniencelibs " in
-	    *" $deplib "*) ;;
-	    *)
-	      valid_a_lib=no
-	      case $deplibs_check_method in
-		match_pattern*)
-		  set dummy $deplibs_check_method; shift
-		  match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
-		  if eval "\$ECHO \"X$deplib\"" 2>/dev/null | $Xsed -e 10q \
-		    | $EGREP "$match_pattern_regex" > /dev/null; then
-		    valid_a_lib=yes
-		  fi
-		;;
-		pass_all)
-		  valid_a_lib=yes
-		;;
-	      esac
-	      if test "$valid_a_lib" != yes; then
-		$ECHO
-		$ECHO "*** Warning: Trying to link with static lib archive $deplib."
-		$ECHO "*** I have the capability to make that library automatically link in when"
-		$ECHO "*** you link to this library.  But I can only do this if you have a"
-		$ECHO "*** shared version of the library, which you do not appear to have"
-		$ECHO "*** because the file extensions .$libext of this argument makes me believe"
-		$ECHO "*** that it is just a static archive that I should not use here."
-	      else
-		$ECHO
-		$ECHO "*** Warning: Linking the shared library $output against the"
-		$ECHO "*** static library $deplib is not portable!"
-		deplibs="$deplib $deplibs"
-	      fi
-	      ;;
-	    esac
-	    continue
-	    ;;
-	  prog)
-	    if test "$pass" != link; then
-	      deplibs="$deplib $deplibs"
-	    else
-	      compile_deplibs="$deplib $compile_deplibs"
-	      finalize_deplibs="$deplib $finalize_deplibs"
-	    fi
-	    continue
-	    ;;
-	  esac # linkmode
-	  ;; # *.$libext
-	*.lo | *.$objext)
-	  if test "$pass" = conv; then
-	    deplibs="$deplib $deplibs"
-	  elif test "$linkmode" = prog; then
-	    if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
-	      # If there is no dlopen support or we're linking statically,
-	      # we need to preload.
-	      newdlprefiles="$newdlprefiles $deplib"
-	      compile_deplibs="$deplib $compile_deplibs"
-	      finalize_deplibs="$deplib $finalize_deplibs"
-	    else
-	      newdlfiles="$newdlfiles $deplib"
-	    fi
-	  fi
-	  continue
-	  ;;
-	%DEPLIBS%)
-	  alldeplibs=yes
-	  continue
-	  ;;
-	esac # case $deplib
-
-	if test "$found" = yes || test -f "$lib"; then :
-	else
-	  func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
-	fi
-
-	# Check to see that this really is a libtool archive.
-	func_lalib_unsafe_p "$lib" \
-	  || func_fatal_error "\`$lib' is not a valid libtool archive"
-
-	func_dirname "$lib" "" "."
-	ladir="$func_dirname_result"
-
-	dlname=
-	dlopen=
-	dlpreopen=
-	libdir=
-	library_names=
-	old_library=
-	inherited_linker_flags=
-	# If the library was installed with an old release of libtool,
-	# it will not redefine variables installed, or shouldnotlink
-	installed=yes
-	shouldnotlink=no
-	avoidtemprpath=
-
-
-	# Read the .la file
-	func_source "$lib"
-
-	# Convert "-framework foo" to "foo.ltframework"
-	if test -n "$inherited_linker_flags"; then
-	  tmp_inherited_linker_flags=`$ECHO "X$inherited_linker_flags" | $Xsed -e 's/-framework \([^ $]*\)/\1.ltframework/g'`
-	  for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
-	    case " $new_inherited_linker_flags " in
-	      *" $tmp_inherited_linker_flag "*) ;;
-	      *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";;
-	    esac
-	  done
-	fi
-	dependency_libs=`$ECHO "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
-	if test "$linkmode,$pass" = "lib,link" ||
-	   test "$linkmode,$pass" = "prog,scan" ||
-	   { test "$linkmode" != prog && test "$linkmode" != lib; }; then
-	  test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
-	  test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
-	fi
-
-	if test "$pass" = conv; then
-	  # Only check for convenience libraries
-	  deplibs="$lib $deplibs"
-	  if test -z "$libdir"; then
-	    if test -z "$old_library"; then
-	      func_fatal_error "cannot find name of link library for \`$lib'"
-	    fi
-	    # It is a libtool convenience library, so add in its objects.
-	    convenience="$convenience $ladir/$objdir/$old_library"
-	    old_convenience="$old_convenience $ladir/$objdir/$old_library"
-	  elif test "$linkmode" != prog && test "$linkmode" != lib; then
-	    func_fatal_error "\`$lib' is not a convenience library"
-	  fi
-	  tmp_libs=
-	  for deplib in $dependency_libs; do
-	    deplibs="$deplib $deplibs"
-	    if $opt_duplicate_deps ; then
-	      case "$tmp_libs " in
-	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
-	      esac
-	    fi
-	    tmp_libs="$tmp_libs $deplib"
-	  done
-	  continue
-	fi # $pass = conv
-
-
-	# Get the name of the library we link against.
-	linklib=
-	for l in $old_library $library_names; do
-	  linklib="$l"
-	done
-	if test -z "$linklib"; then
-	  func_fatal_error "cannot find name of link library for \`$lib'"
-	fi
-
-	# This library was specified with -dlopen.
-	if test "$pass" = dlopen; then
-	  if test -z "$libdir"; then
-	    func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
-	  fi
-	  if test -z "$dlname" ||
-	     test "$dlopen_support" != yes ||
-	     test "$build_libtool_libs" = no; then
-	    # If there is no dlname, no dlopen support or we're linking
-	    # statically, we need to preload.  We also need to preload any
-	    # dependent libraries so libltdl's deplib preloader doesn't
-	    # bomb out in the load deplibs phase.
-	    dlprefiles="$dlprefiles $lib $dependency_libs"
-	  else
-	    newdlfiles="$newdlfiles $lib"
-	  fi
-	  continue
-	fi # $pass = dlopen
-
-	# We need an absolute path.
-	case $ladir in
-	[\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
-	*)
-	  abs_ladir=`cd "$ladir" && pwd`
-	  if test -z "$abs_ladir"; then
-	    func_warning "cannot determine absolute directory name of \`$ladir'"
-	    func_warning "passing it literally to the linker, although it might fail"
-	    abs_ladir="$ladir"
-	  fi
-	  ;;
-	esac
-	func_basename "$lib"
-	laname="$func_basename_result"
-
-	# Find the relevant object directory and library name.
-	if test "X$installed" = Xyes; then
-	  if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
-	    func_warning "library \`$lib' was moved."
-	    dir="$ladir"
-	    absdir="$abs_ladir"
-	    libdir="$abs_ladir"
-	  else
-	    dir="$libdir"
-	    absdir="$libdir"
-	  fi
-	  test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
-	else
-	  if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
-	    dir="$ladir"
-	    absdir="$abs_ladir"
-	    # Remove this search path later
-	    notinst_path="$notinst_path $abs_ladir"
-	  else
-	    dir="$ladir/$objdir"
-	    absdir="$abs_ladir/$objdir"
-	    # Remove this search path later
-	    notinst_path="$notinst_path $abs_ladir"
-	  fi
-	fi # $installed = yes
-	func_stripname 'lib' '.la' "$laname"
-	name=$func_stripname_result
-
-	# This library was specified with -dlpreopen.
-	if test "$pass" = dlpreopen; then
-	  if test -z "$libdir" && test "$linkmode" = prog; then
-	    func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
-	  fi
-	  # Prefer using a static library (so that no silly _DYNAMIC symbols
-	  # are required to link).
-	  if test -n "$old_library"; then
-	    newdlprefiles="$newdlprefiles $dir/$old_library"
-	    # Keep a list of preopened convenience libraries to check
-	    # that they are being used correctly in the link pass.
-	    test -z "$libdir" && \
-		dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library"
-	  # Otherwise, use the dlname, so that lt_dlopen finds it.
-	  elif test -n "$dlname"; then
-	    newdlprefiles="$newdlprefiles $dir/$dlname"
-	  else
-	    newdlprefiles="$newdlprefiles $dir/$linklib"
-	  fi
-	fi # $pass = dlpreopen
-
-	if test -z "$libdir"; then
-	  # Link the convenience library
-	  if test "$linkmode" = lib; then
-	    deplibs="$dir/$old_library $deplibs"
-	  elif test "$linkmode,$pass" = "prog,link"; then
-	    compile_deplibs="$dir/$old_library $compile_deplibs"
-	    finalize_deplibs="$dir/$old_library $finalize_deplibs"
-	  else
-	    deplibs="$lib $deplibs" # used for prog,scan pass
-	  fi
-	  continue
-	fi
-
-
-	if test "$linkmode" = prog && test "$pass" != link; then
-	  newlib_search_path="$newlib_search_path $ladir"
-	  deplibs="$lib $deplibs"
-
-	  linkalldeplibs=no
-	  if test "$link_all_deplibs" != no || test -z "$library_names" ||
-	     test "$build_libtool_libs" = no; then
-	    linkalldeplibs=yes
-	  fi
-
-	  tmp_libs=
-	  for deplib in $dependency_libs; do
-	    case $deplib in
-	    -L*) func_stripname '-L' '' "$deplib"
-	         newlib_search_path="$newlib_search_path $func_stripname_result"
-		 ;;
-	    esac
-	    # Need to link against all dependency_libs?
-	    if test "$linkalldeplibs" = yes; then
-	      deplibs="$deplib $deplibs"
-	    else
-	      # Need to hardcode shared library paths
-	      # or/and link against static libraries
-	      newdependency_libs="$deplib $newdependency_libs"
-	    fi
-	    if $opt_duplicate_deps ; then
-	      case "$tmp_libs " in
-	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
-	      esac
-	    fi
-	    tmp_libs="$tmp_libs $deplib"
-	  done # for deplib
-	  continue
-	fi # $linkmode = prog...
-
-	if test "$linkmode,$pass" = "prog,link"; then
-	  if test -n "$library_names" &&
-	     { { test "$prefer_static_libs" = no ||
-	         test "$prefer_static_libs,$installed" = "built,yes"; } ||
-	       test -z "$old_library"; }; then
-	    # We need to hardcode the library path
-	    if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
-	      # Make sure the rpath contains only unique directories.
-	      case "$temp_rpath:" in
-	      *"$absdir:"*) ;;
-	      *) temp_rpath="$temp_rpath$absdir:" ;;
-	      esac
-	    fi
-
-	    # Hardcode the library path.
-	    # Skip directories that are in the system default run-time
-	    # search path.
-	    case " $sys_lib_dlsearch_path " in
-	    *" $absdir "*) ;;
-	    *)
-	      case "$compile_rpath " in
-	      *" $absdir "*) ;;
-	      *) compile_rpath="$compile_rpath $absdir"
-	      esac
-	      ;;
-	    esac
-	    case " $sys_lib_dlsearch_path " in
-	    *" $libdir "*) ;;
-	    *)
-	      case "$finalize_rpath " in
-	      *" $libdir "*) ;;
-	      *) finalize_rpath="$finalize_rpath $libdir"
-	      esac
-	      ;;
-	    esac
-	  fi # $linkmode,$pass = prog,link...
-
-	  if test "$alldeplibs" = yes &&
-	     { test "$deplibs_check_method" = pass_all ||
-	       { test "$build_libtool_libs" = yes &&
-		 test -n "$library_names"; }; }; then
-	    # We only need to search for static libraries
-	    continue
-	  fi
-	fi
-
-	link_static=no # Whether the deplib will be linked statically
-	use_static_libs=$prefer_static_libs
-	if test "$use_static_libs" = built && test "$installed" = yes; then
-	  use_static_libs=no
-	fi
-	if test -n "$library_names" &&
-	   { test "$use_static_libs" = no || test -z "$old_library"; }; then
-	  case $host in
-	  *cygwin* | *mingw* | *cegcc*)
-	      # No point in relinking DLLs because paths are not encoded
-	      notinst_deplibs="$notinst_deplibs $lib"
-	      need_relink=no
-	    ;;
-	  *)
-	    if test "$installed" = no; then
-	      notinst_deplibs="$notinst_deplibs $lib"
-	      need_relink=yes
-	    fi
-	    ;;
-	  esac
-	  # This is a shared library
-
-	  # Warn about portability, can't link against -module's on some
-	  # systems (darwin).  Don't bleat about dlopened modules though!
-	  dlopenmodule=""
-	  for dlpremoduletest in $dlprefiles; do
-	    if test "X$dlpremoduletest" = "X$lib"; then
-	      dlopenmodule="$dlpremoduletest"
-	      break
-	    fi
-	  done
-	  if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
-	    $ECHO
-	    if test "$linkmode" = prog; then
-	      $ECHO "*** Warning: Linking the executable $output against the loadable module"
-	    else
-	      $ECHO "*** Warning: Linking the shared library $output against the loadable module"
-	    fi
-	    $ECHO "*** $linklib is not portable!"
-	  fi
-	  if test "$linkmode" = lib &&
-	     test "$hardcode_into_libs" = yes; then
-	    # Hardcode the library path.
-	    # Skip directories that are in the system default run-time
-	    # search path.
-	    case " $sys_lib_dlsearch_path " in
-	    *" $absdir "*) ;;
-	    *)
-	      case "$compile_rpath " in
-	      *" $absdir "*) ;;
-	      *) compile_rpath="$compile_rpath $absdir"
-	      esac
-	      ;;
-	    esac
-	    case " $sys_lib_dlsearch_path " in
-	    *" $libdir "*) ;;
-	    *)
-	      case "$finalize_rpath " in
-	      *" $libdir "*) ;;
-	      *) finalize_rpath="$finalize_rpath $libdir"
-	      esac
-	      ;;
-	    esac
-	  fi
-
-	  if test -n "$old_archive_from_expsyms_cmds"; then
-	    # figure out the soname
-	    set dummy $library_names
-	    shift
-	    realname="$1"
-	    shift
-	    libname=`eval "\\$ECHO \"$libname_spec\""`
-	    # use dlname if we got it. it's perfectly good, no?
-	    if test -n "$dlname"; then
-	      soname="$dlname"
-	    elif test -n "$soname_spec"; then
-	      # bleh windows
-	      case $host in
-	      *cygwin* | mingw* | *cegcc*)
-	        func_arith $current - $age
-		major=$func_arith_result
-		versuffix="-$major"
-		;;
-	      esac
-	      eval soname=\"$soname_spec\"
-	    else
-	      soname="$realname"
-	    fi
-
-	    # Make a new name for the extract_expsyms_cmds to use
-	    soroot="$soname"
-	    func_basename "$soroot"
-	    soname="$func_basename_result"
-	    func_stripname 'lib' '.dll' "$soname"
-	    newlib=libimp-$func_stripname_result.a
-
-	    # If the library has no export list, then create one now
-	    if test -f "$output_objdir/$soname-def"; then :
-	    else
-	      func_verbose "extracting exported symbol list from \`$soname'"
-	      func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
-	    fi
-
-	    # Create $newlib
-	    if test -f "$output_objdir/$newlib"; then :; else
-	      func_verbose "generating import library for \`$soname'"
-	      func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
-	    fi
-	    # make sure the library variables are pointing to the new library
-	    dir=$output_objdir
-	    linklib=$newlib
-	  fi # test -n "$old_archive_from_expsyms_cmds"
-
-	  if test "$linkmode" = prog || test "$mode" != relink; then
-	    add_shlibpath=
-	    add_dir=
-	    add=
-	    lib_linked=yes
-	    case $hardcode_action in
-	    immediate | unsupported)
-	      if test "$hardcode_direct" = no; then
-		add="$dir/$linklib"
-		case $host in
-		  *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
-		  *-*-sysv4*uw2*) add_dir="-L$dir" ;;
-		  *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
-		    *-*-unixware7*) add_dir="-L$dir" ;;
-		  *-*-darwin* )
-		    # if the lib is a (non-dlopened) module then we can not
-		    # link against it, someone is ignoring the earlier warnings
-		    if /usr/bin/file -L $add 2> /dev/null |
-			 $GREP ": [^:]* bundle" >/dev/null ; then
-		      if test "X$dlopenmodule" != "X$lib"; then
-			$ECHO "*** Warning: lib $linklib is a module, not a shared library"
-			if test -z "$old_library" ; then
-			  $ECHO
-			  $ECHO "*** And there doesn't seem to be a static archive available"
-			  $ECHO "*** The link will probably fail, sorry"
-			else
-			  add="$dir/$old_library"
-			fi
-		      elif test -n "$old_library"; then
-			add="$dir/$old_library"
-		      fi
-		    fi
-		esac
-	      elif test "$hardcode_minus_L" = no; then
-		case $host in
-		*-*-sunos*) add_shlibpath="$dir" ;;
-		esac
-		add_dir="-L$dir"
-		add="-l$name"
-	      elif test "$hardcode_shlibpath_var" = no; then
-		add_shlibpath="$dir"
-		add="-l$name"
-	      else
-		lib_linked=no
-	      fi
-	      ;;
-	    relink)
-	      if test "$hardcode_direct" = yes &&
-	         test "$hardcode_direct_absolute" = no; then
-		add="$dir/$linklib"
-	      elif test "$hardcode_minus_L" = yes; then
-		add_dir="-L$dir"
-		# Try looking first in the location we're being installed to.
-		if test -n "$inst_prefix_dir"; then
-		  case $libdir in
-		    [\\/]*)
-		      add_dir="$add_dir -L$inst_prefix_dir$libdir"
-		      ;;
-		  esac
-		fi
-		add="-l$name"
-	      elif test "$hardcode_shlibpath_var" = yes; then
-		add_shlibpath="$dir"
-		add="-l$name"
-	      else
-		lib_linked=no
-	      fi
-	      ;;
-	    *) lib_linked=no ;;
-	    esac
-
-	    if test "$lib_linked" != yes; then
-	      func_fatal_configuration "unsupported hardcode properties"
-	    fi
-
-	    if test -n "$add_shlibpath"; then
-	      case :$compile_shlibpath: in
-	      *":$add_shlibpath:"*) ;;
-	      *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
-	      esac
-	    fi
-	    if test "$linkmode" = prog; then
-	      test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
-	      test -n "$add" && compile_deplibs="$add $compile_deplibs"
-	    else
-	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
-	      test -n "$add" && deplibs="$add $deplibs"
-	      if test "$hardcode_direct" != yes &&
-		 test "$hardcode_minus_L" != yes &&
-		 test "$hardcode_shlibpath_var" = yes; then
-		case :$finalize_shlibpath: in
-		*":$libdir:"*) ;;
-		*) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
-		esac
-	      fi
-	    fi
-	  fi
-
-	  if test "$linkmode" = prog || test "$mode" = relink; then
-	    add_shlibpath=
-	    add_dir=
-	    add=
-	    # Finalize command for both is simple: just hardcode it.
-	    if test "$hardcode_direct" = yes &&
-	       test "$hardcode_direct_absolute" = no; then
-	      add="$libdir/$linklib"
-	    elif test "$hardcode_minus_L" = yes; then
-	      add_dir="-L$libdir"
-	      add="-l$name"
-	    elif test "$hardcode_shlibpath_var" = yes; then
-	      case :$finalize_shlibpath: in
-	      *":$libdir:"*) ;;
-	      *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
-	      esac
-	      add="-l$name"
-	    elif test "$hardcode_automatic" = yes; then
-	      if test -n "$inst_prefix_dir" &&
-		 test -f "$inst_prefix_dir$libdir/$linklib" ; then
-		add="$inst_prefix_dir$libdir/$linklib"
-	      else
-		add="$libdir/$linklib"
-	      fi
-	    else
-	      # We cannot seem to hardcode it, guess we'll fake it.
-	      add_dir="-L$libdir"
-	      # Try looking first in the location we're being installed to.
-	      if test -n "$inst_prefix_dir"; then
-		case $libdir in
-		  [\\/]*)
-		    add_dir="$add_dir -L$inst_prefix_dir$libdir"
-		    ;;
-		esac
-	      fi
-	      add="-l$name"
-	    fi
-
-	    if test "$linkmode" = prog; then
-	      test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
-	      test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
-	    else
-	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
-	      test -n "$add" && deplibs="$add $deplibs"
-	    fi
-	  fi
-	elif test "$linkmode" = prog; then
-	  # Here we assume that one of hardcode_direct or hardcode_minus_L
-	  # is not unsupported.  This is valid on all known static and
-	  # shared platforms.
-	  if test "$hardcode_direct" != unsupported; then
-	    test -n "$old_library" && linklib="$old_library"
-	    compile_deplibs="$dir/$linklib $compile_deplibs"
-	    finalize_deplibs="$dir/$linklib $finalize_deplibs"
-	  else
-	    compile_deplibs="-l$name -L$dir $compile_deplibs"
-	    finalize_deplibs="-l$name -L$dir $finalize_deplibs"
-	  fi
-	elif test "$build_libtool_libs" = yes; then
-	  # Not a shared library
-	  if test "$deplibs_check_method" != pass_all; then
-	    # We're trying link a shared library against a static one
-	    # but the system doesn't support it.
-
-	    # Just print a warning and add the library to dependency_libs so
-	    # that the program can be linked against the static library.
-	    $ECHO
-	    $ECHO "*** Warning: This system can not link to static lib archive $lib."
-	    $ECHO "*** I have the capability to make that library automatically link in when"
-	    $ECHO "*** you link to this library.  But I can only do this if you have a"
-	    $ECHO "*** shared version of the library, which you do not appear to have."
-	    if test "$module" = yes; then
-	      $ECHO "*** But as you try to build a module library, libtool will still create "
-	      $ECHO "*** a static module, that should work as long as the dlopening application"
-	      $ECHO "*** is linked with the -dlopen flag to resolve symbols at runtime."
-	      if test -z "$global_symbol_pipe"; then
-		$ECHO
-		$ECHO "*** However, this would only work if libtool was able to extract symbol"
-		$ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could"
-		$ECHO "*** not find such a program.  So, this module is probably useless."
-		$ECHO "*** \`nm' from GNU binutils and a full rebuild may help."
-	      fi
-	      if test "$build_old_libs" = no; then
-		build_libtool_libs=module
-		build_old_libs=yes
-	      else
-		build_libtool_libs=no
-	      fi
-	    fi
-	  else
-	    deplibs="$dir/$old_library $deplibs"
-	    link_static=yes
-	  fi
-	fi # link shared/static library?
-
-	if test "$linkmode" = lib; then
-	  if test -n "$dependency_libs" &&
-	     { test "$hardcode_into_libs" != yes ||
-	       test "$build_old_libs" = yes ||
-	       test "$link_static" = yes; }; then
-	    # Extract -R from dependency_libs
-	    temp_deplibs=
-	    for libdir in $dependency_libs; do
-	      case $libdir in
-	      -R*) func_stripname '-R' '' "$libdir"
-	           temp_xrpath=$func_stripname_result
-		   case " $xrpath " in
-		   *" $temp_xrpath "*) ;;
-		   *) xrpath="$xrpath $temp_xrpath";;
-		   esac;;
-	      *) temp_deplibs="$temp_deplibs $libdir";;
-	      esac
-	    done
-	    dependency_libs="$temp_deplibs"
-	  fi
-
-	  newlib_search_path="$newlib_search_path $absdir"
-	  # Link against this library
-	  test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
-	  # ... and its dependency_libs
-	  tmp_libs=
-	  for deplib in $dependency_libs; do
-	    newdependency_libs="$deplib $newdependency_libs"
-	    if $opt_duplicate_deps ; then
-	      case "$tmp_libs " in
-	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
-	      esac
-	    fi
-	    tmp_libs="$tmp_libs $deplib"
-	  done
-
-	  if test "$link_all_deplibs" != no; then
-	    # Add the search paths of all dependency libraries
-	    for deplib in $dependency_libs; do
-	      case $deplib in
-	      -L*) path="$deplib" ;;
-	      *.la)
-	        func_dirname "$deplib" "" "."
-		dir="$func_dirname_result"
-		# We need an absolute path.
-		case $dir in
-		[\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
-		*)
-		  absdir=`cd "$dir" && pwd`
-		  if test -z "$absdir"; then
-		    func_warning "cannot determine absolute directory name of \`$dir'"
-		    absdir="$dir"
-		  fi
-		  ;;
-		esac
-		if $GREP "^installed=no" $deplib > /dev/null; then
-		case $host in
-		*-*-darwin*)
-		  depdepl=
-		  eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
-		  if test -n "$deplibrary_names" ; then
-		    for tmp in $deplibrary_names ; do
-		      depdepl=$tmp
-		    done
-		    if test -f "$absdir/$objdir/$depdepl" ; then
-		      depdepl="$absdir/$objdir/$depdepl"
-		      darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
-                      if test -z "$darwin_install_name"; then
-                          darwin_install_name=`${OTOOL64} -L $depdepl  | awk '{if (NR == 2) {print $1;exit}}'`
-                      fi
-		      compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
-		      linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}"
-		      path=
-		    fi
-		  fi
-		  ;;
-		*)
-		  path="-L$absdir/$objdir"
-		  ;;
-		esac
-		else
-		  eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
-		  test -z "$libdir" && \
-		    func_fatal_error "\`$deplib' is not a valid libtool archive"
-		  test "$absdir" != "$libdir" && \
-		    func_warning "\`$deplib' seems to be moved"
-
-		  path="-L$absdir"
-		fi
-		;;
-	      esac
-	      case " $deplibs " in
-	      *" $path "*) ;;
-	      *) deplibs="$path $deplibs" ;;
-	      esac
-	    done
-	  fi # link_all_deplibs != no
-	fi # linkmode = lib
-      done # for deplib in $libs
-      if test "$pass" = link; then
-	if test "$linkmode" = "prog"; then
-	  compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
-	  finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
-	else
-	  compiler_flags="$compiler_flags "`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
-	fi
-      fi
-      dependency_libs="$newdependency_libs"
-      if test "$pass" = dlpreopen; then
-	# Link the dlpreopened libraries before other libraries
-	for deplib in $save_deplibs; do
-	  deplibs="$deplib $deplibs"
-	done
-      fi
-      if test "$pass" != dlopen; then
-	if test "$pass" != conv; then
-	  # Make sure lib_search_path contains only unique directories.
-	  lib_search_path=
-	  for dir in $newlib_search_path; do
-	    case "$lib_search_path " in
-	    *" $dir "*) ;;
-	    *) lib_search_path="$lib_search_path $dir" ;;
-	    esac
-	  done
-	  newlib_search_path=
-	fi
-
-	if test "$linkmode,$pass" != "prog,link"; then
-	  vars="deplibs"
-	else
-	  vars="compile_deplibs finalize_deplibs"
-	fi
-	for var in $vars dependency_libs; do
-	  # Add libraries to $var in reverse order
-	  eval tmp_libs=\"\$$var\"
-	  new_libs=
-	  for deplib in $tmp_libs; do
-	    # FIXME: Pedantically, this is the right thing to do, so
-	    #        that some nasty dependency loop isn't accidentally
-	    #        broken:
-	    #new_libs="$deplib $new_libs"
-	    # Pragmatically, this seems to cause very few problems in
-	    # practice:
-	    case $deplib in
-	    -L*) new_libs="$deplib $new_libs" ;;
-	    -R*) ;;
-	    *)
-	      # And here is the reason: when a library appears more
-	      # than once as an explicit dependence of a library, or
-	      # is implicitly linked in more than once by the
-	      # compiler, it is considered special, and multiple
-	      # occurrences thereof are not removed.  Compare this
-	      # with having the same library being listed as a
-	      # dependency of multiple other libraries: in this case,
-	      # we know (pedantically, we assume) the library does not
-	      # need to be listed more than once, so we keep only the
-	      # last copy.  This is not always right, but it is rare
-	      # enough that we require users that really mean to play
-	      # such unportable linking tricks to link the library
-	      # using -Wl,-lname, so that libtool does not consider it
-	      # for duplicate removal.
-	      case " $specialdeplibs " in
-	      *" $deplib "*) new_libs="$deplib $new_libs" ;;
-	      *)
-		case " $new_libs " in
-		*" $deplib "*) ;;
-		*) new_libs="$deplib $new_libs" ;;
-		esac
-		;;
-	      esac
-	      ;;
-	    esac
-	  done
-	  tmp_libs=
-	  for deplib in $new_libs; do
-	    case $deplib in
-	    -L*)
-	      case " $tmp_libs " in
-	      *" $deplib "*) ;;
-	      *) tmp_libs="$tmp_libs $deplib" ;;
-	      esac
-	      ;;
-	    *) tmp_libs="$tmp_libs $deplib" ;;
-	    esac
-	  done
-	  eval $var=\"$tmp_libs\"
-	done # for var
-      fi
-      # Last step: remove runtime libs from dependency_libs
-      # (they stay in deplibs)
-      tmp_libs=
-      for i in $dependency_libs ; do
-	case " $predeps $postdeps $compiler_lib_search_path " in
-	*" $i "*)
-	  i=""
-	  ;;
-	esac
-	if test -n "$i" ; then
-	  tmp_libs="$tmp_libs $i"
-	fi
-      done
-      dependency_libs=$tmp_libs
-    done # for pass
-    if test "$linkmode" = prog; then
-      dlfiles="$newdlfiles"
-    fi
-    if test "$linkmode" = prog || test "$linkmode" = lib; then
-      dlprefiles="$newdlprefiles"
-    fi
-
-    case $linkmode in
-    oldlib)
-      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
-	func_warning "\`-dlopen' is ignored for archives"
-      fi
-
-      case " $deplibs" in
-      *\ -l* | *\ -L*)
-	func_warning "\`-l' and \`-L' are ignored for archives" ;;
-      esac
-
-      test -n "$rpath" && \
-	func_warning "\`-rpath' is ignored for archives"
-
-      test -n "$xrpath" && \
-	func_warning "\`-R' is ignored for archives"
-
-      test -n "$vinfo" && \
-	func_warning "\`-version-info/-version-number' is ignored for archives"
-
-      test -n "$release" && \
-	func_warning "\`-release' is ignored for archives"
-
-      test -n "$export_symbols$export_symbols_regex" && \
-	func_warning "\`-export-symbols' is ignored for archives"
-
-      # Now set the variables for building old libraries.
-      build_libtool_libs=no
-      oldlibs="$output"
-      objs="$objs$old_deplibs"
-      ;;
-
-    lib)
-      # Make sure we only generate libraries of the form `libNAME.la'.
-      case $outputname in
-      lib*)
-	func_stripname 'lib' '.la' "$outputname"
-	name=$func_stripname_result
-	eval shared_ext=\"$shrext_cmds\"
-	eval libname=\"$libname_spec\"
-	;;
-      *)
-	test "$module" = no && \
-	  func_fatal_help "libtool library \`$output' must begin with \`lib'"
-
-	if test "$need_lib_prefix" != no; then
-	  # Add the "lib" prefix for modules if required
-	  func_stripname '' '.la' "$outputname"
-	  name=$func_stripname_result
-	  eval shared_ext=\"$shrext_cmds\"
-	  eval libname=\"$libname_spec\"
-	else
-	  func_stripname '' '.la' "$outputname"
-	  libname=$func_stripname_result
-	fi
-	;;
-      esac
-
-      if test -n "$objs"; then
-	if test "$deplibs_check_method" != pass_all; then
-	  func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
-	else
-	  $ECHO
-	  $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
-	  $ECHO "*** objects $objs is not portable!"
-	  libobjs="$libobjs $objs"
-	fi
-      fi
-
-      test "$dlself" != no && \
-	func_warning "\`-dlopen self' is ignored for libtool libraries"
-
-      set dummy $rpath
-      shift
-      test "$#" -gt 1 && \
-	func_warning "ignoring multiple \`-rpath's for a libtool library"
-
-      install_libdir="$1"
-
-      oldlibs=
-      if test -z "$rpath"; then
-	if test "$build_libtool_libs" = yes; then
-	  # Building a libtool convenience library.
-	  # Some compilers have problems with a `.al' extension so
-	  # convenience libraries should have the same extension an
-	  # archive normally would.
-	  oldlibs="$output_objdir/$libname.$libext $oldlibs"
-	  build_libtool_libs=convenience
-	  build_old_libs=yes
-	fi
-
-	test -n "$vinfo" && \
-	  func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
-
-	test -n "$release" && \
-	  func_warning "\`-release' is ignored for convenience libraries"
-      else
-
-	# Parse the version information argument.
-	save_ifs="$IFS"; IFS=':'
-	set dummy $vinfo 0 0 0
-	shift
-	IFS="$save_ifs"
-
-	test -n "$7" && \
-	  func_fatal_help "too many parameters to \`-version-info'"
-
-	# convert absolute version numbers to libtool ages
-	# this retains compatibility with .la files and attempts
-	# to make the code below a bit more comprehensible
-
-	case $vinfo_number in
-	yes)
-	  number_major="$1"
-	  number_minor="$2"
-	  number_revision="$3"
-	  #
-	  # There are really only two kinds -- those that
-	  # use the current revision as the major version
-	  # and those that subtract age and use age as
-	  # a minor version.  But, then there is irix
-	  # which has an extra 1 added just for fun
-	  #
-	  case $version_type in
-	  darwin|linux|osf|windows|none)
-	    func_arith $number_major + $number_minor
-	    current=$func_arith_result
-	    age="$number_minor"
-	    revision="$number_revision"
-	    ;;
-	  freebsd-aout|freebsd-elf|sunos)
-	    current="$number_major"
-	    revision="$number_minor"
-	    age="0"
-	    ;;
-	  irix|nonstopux)
-	    func_arith $number_major + $number_minor
-	    current=$func_arith_result
-	    age="$number_minor"
-	    revision="$number_minor"
-	    lt_irix_increment=no
-	    ;;
-	  esac
-	  ;;
-	no)
-	  current="$1"
-	  revision="$2"
-	  age="$3"
-	  ;;
-	esac
-
-	# Check that each of the things are valid numbers.
-	case $current in
-	0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
-	*)
-	  func_error "CURRENT \`$current' must be a nonnegative integer"
-	  func_fatal_error "\`$vinfo' is not valid version information"
-	  ;;
-	esac
-
-	case $revision in
-	0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
-	*)
-	  func_error "REVISION \`$revision' must be a nonnegative integer"
-	  func_fatal_error "\`$vinfo' is not valid version information"
-	  ;;
-	esac
-
-	case $age in
-	0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
-	*)
-	  func_error "AGE \`$age' must be a nonnegative integer"
-	  func_fatal_error "\`$vinfo' is not valid version information"
-	  ;;
-	esac
-
-	if test "$age" -gt "$current"; then
-	  func_error "AGE \`$age' is greater than the current interface number \`$current'"
-	  func_fatal_error "\`$vinfo' is not valid version information"
-	fi
-
-	# Calculate the version variables.
-	major=
-	versuffix=
-	verstring=
-	case $version_type in
-	none) ;;
-
-	darwin)
-	  # Like Linux, but with the current version available in
-	  # verstring for coding it into the library header
-	  func_arith $current - $age
-	  major=.$func_arith_result
-	  versuffix="$major.$age.$revision"
-	  # Darwin ld doesn't like 0 for these options...
-	  func_arith $current + 1
-	  minor_current=$func_arith_result
-	  xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
-	  verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
-	  ;;
-
-	freebsd-aout)
-	  major=".$current"
-	  versuffix=".$current.$revision";
-	  ;;
-
-	freebsd-elf)
-	  major=".$current"
-	  versuffix=".$current"
-	  ;;
-
-	irix | nonstopux)
-	  if test "X$lt_irix_increment" = "Xno"; then
-	    func_arith $current - $age
-	  else
-	    func_arith $current - $age + 1
-	  fi
-	  major=$func_arith_result
-
-	  case $version_type in
-	    nonstopux) verstring_prefix=nonstopux ;;
-	    *)         verstring_prefix=sgi ;;
-	  esac
-	  verstring="$verstring_prefix$major.$revision"
-
-	  # Add in all the interfaces that we are compatible with.
-	  loop=$revision
-	  while test "$loop" -ne 0; do
-	    func_arith $revision - $loop
-	    iface=$func_arith_result
-	    func_arith $loop - 1
-	    loop=$func_arith_result
-	    verstring="$verstring_prefix$major.$iface:$verstring"
-	  done
-
-	  # Before this point, $major must not contain `.'.
-	  major=.$major
-	  versuffix="$major.$revision"
-	  ;;
-
-	linux)
-	  func_arith $current - $age
-	  major=.$func_arith_result
-	  versuffix="$major.$age.$revision"
-	  ;;
-
-	osf)
-	  func_arith $current - $age
-	  major=.$func_arith_result
-	  versuffix=".$current.$age.$revision"
-	  verstring="$current.$age.$revision"
-
-	  # Add in all the interfaces that we are compatible with.
-	  loop=$age
-	  while test "$loop" -ne 0; do
-	    func_arith $current - $loop
-	    iface=$func_arith_result
-	    func_arith $loop - 1
-	    loop=$func_arith_result
-	    verstring="$verstring:${iface}.0"
-	  done
-
-	  # Make executables depend on our current version.
-	  verstring="$verstring:${current}.0"
-	  ;;
-
-	qnx)
-	  major=".$current"
-	  versuffix=".$current"
-	  ;;
-
-	sunos)
-	  major=".$current"
-	  versuffix=".$current.$revision"
-	  ;;
-
-	windows)
-	  # Use '-' rather than '.', since we only want one
-	  # extension on DOS 8.3 filesystems.
-	  func_arith $current - $age
-	  major=$func_arith_result
-	  versuffix="-$major"
-	  ;;
-
-	*)
-	  func_fatal_configuration "unknown library version type \`$version_type'"
-	  ;;
-	esac
-
-	# Clear the version info if we defaulted, and they specified a release.
-	if test -z "$vinfo" && test -n "$release"; then
-	  major=
-	  case $version_type in
-	  darwin)
-	    # we can't check for "0.0" in archive_cmds due to quoting
-	    # problems, so we reset it completely
-	    verstring=
-	    ;;
-	  *)
-	    verstring="0.0"
-	    ;;
-	  esac
-	  if test "$need_version" = no; then
-	    versuffix=
-	  else
-	    versuffix=".0.0"
-	  fi
-	fi
-
-	# Remove version info from name if versioning should be avoided
-	if test "$avoid_version" = yes && test "$need_version" = no; then
-	  major=
-	  versuffix=
-	  verstring=""
-	fi
-
-	# Check to see if the archive will have undefined symbols.
-	if test "$allow_undefined" = yes; then
-	  if test "$allow_undefined_flag" = unsupported; then
-	    func_warning "undefined symbols not allowed in $host shared libraries"
-	    build_libtool_libs=no
-	    build_old_libs=yes
-	  fi
-	else
-	  # Don't allow undefined symbols.
-	  allow_undefined_flag="$no_undefined_flag"
-	fi
-
-      fi
-
-      func_generate_dlsyms "$libname" "$libname" "yes"
-      libobjs="$libobjs $symfileobj"
-      test "X$libobjs" = "X " && libobjs=
-
-      if test "$mode" != relink; then
-	# Remove our outputs, but don't remove object files since they
-	# may have been created when compiling PIC objects.
-	removelist=
-	tempremovelist=`$ECHO "$output_objdir/*"`
-	for p in $tempremovelist; do
-	  case $p in
-	    *.$objext | *.gcno)
-	       ;;
-	    $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
-	       if test "X$precious_files_regex" != "X"; then
-		 if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
-		 then
-		   continue
-		 fi
-	       fi
-	       removelist="$removelist $p"
-	       ;;
-	    *) ;;
-	  esac
-	done
-	test -n "$removelist" && \
-	  func_show_eval "${RM}r \$removelist"
-      fi
-
-      # Now set the variables for building old libraries.
-      if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
-	oldlibs="$oldlibs $output_objdir/$libname.$libext"
-
-	# Transform .lo files to .o files.
-	oldobjs="$objs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
-      fi
-
-      # Eliminate all temporary directories.
-      #for path in $notinst_path; do
-      #	lib_search_path=`$ECHO "X$lib_search_path " | $Xsed -e "s% $path % %g"`
-      #	deplibs=`$ECHO "X$deplibs " | $Xsed -e "s% -L$path % %g"`
-      #	dependency_libs=`$ECHO "X$dependency_libs " | $Xsed -e "s% -L$path % %g"`
-      #done
-
-      if test -n "$xrpath"; then
-	# If the user specified any rpath flags, then add them.
-	temp_xrpath=
-	for libdir in $xrpath; do
-	  temp_xrpath="$temp_xrpath -R$libdir"
-	  case "$finalize_rpath " in
-	  *" $libdir "*) ;;
-	  *) finalize_rpath="$finalize_rpath $libdir" ;;
-	  esac
-	done
-	if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
-	  dependency_libs="$temp_xrpath $dependency_libs"
-	fi
-      fi
-
-      # Make sure dlfiles contains only unique files that won't be dlpreopened
-      old_dlfiles="$dlfiles"
-      dlfiles=
-      for lib in $old_dlfiles; do
-	case " $dlprefiles $dlfiles " in
-	*" $lib "*) ;;
-	*) dlfiles="$dlfiles $lib" ;;
-	esac
-      done
-
-      # Make sure dlprefiles contains only unique files
-      old_dlprefiles="$dlprefiles"
-      dlprefiles=
-      for lib in $old_dlprefiles; do
-	case "$dlprefiles " in
-	*" $lib "*) ;;
-	*) dlprefiles="$dlprefiles $lib" ;;
-	esac
-      done
-
-      if test "$build_libtool_libs" = yes; then
-	if test -n "$rpath"; then
-	  case $host in
-	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc*)
-	    # these systems don't actually have a c library (as such)!
-	    ;;
-	  *-*-rhapsody* | *-*-darwin1.[012])
-	    # Rhapsody C library is in the System framework
-	    deplibs="$deplibs System.ltframework"
-	    ;;
-	  *-*-netbsd*)
-	    # Don't link with libc until the a.out ld.so is fixed.
-	    ;;
-	  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
-	    # Do not include libc due to us having libc/libc_r.
-	    ;;
-	  *-*-sco3.2v5* | *-*-sco5v6*)
-	    # Causes problems with __ctype
-	    ;;
-	  *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
-	    # Compiler inserts libc in the correct place for threads to work
-	    ;;
-	  *)
-	    # Add libc to deplibs on all other systems if necessary.
-	    if test "$build_libtool_need_lc" = "yes"; then
-	      deplibs="$deplibs -lc"
-	    fi
-	    ;;
-	  esac
-	fi
-
-	# Transform deplibs into only deplibs that can be linked in shared.
-	name_save=$name
-	libname_save=$libname
-	release_save=$release
-	versuffix_save=$versuffix
-	major_save=$major
-	# I'm not sure if I'm treating the release correctly.  I think
-	# release should show up in the -l (ie -lgmp5) so we don't want to
-	# add it in twice.  Is that correct?
-	release=""
-	versuffix=""
-	major=""
-	newdeplibs=
-	droppeddeps=no
-	case $deplibs_check_method in
-	pass_all)
-	  # Don't check for shared/static.  Everything works.
-	  # This might be a little naive.  We might want to check
-	  # whether the library exists or not.  But this is on
-	  # osf3 & osf4 and I'm not really sure... Just
-	  # implementing what was already the behavior.
-	  newdeplibs=$deplibs
-	  ;;
-	test_compile)
-	  # This code stresses the "libraries are programs" paradigm to its
-	  # limits. Maybe even breaks it.  We compile a program, linking it
-	  # against the deplibs as a proxy for the library.  Then we can check
-	  # whether they linked in statically or dynamically with ldd.
-	  $opt_dry_run || $RM conftest.c
-	  cat > conftest.c <<EOF
-	  int main() { return 0; }
-EOF
-	  $opt_dry_run || $RM conftest
-	  if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
-	    ldd_output=`ldd conftest`
-	    for i in $deplibs; do
-	      case $i in
-	      -l*)
-		func_stripname -l '' "$i"
-		name=$func_stripname_result
-		if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
-		  case " $predeps $postdeps " in
-		  *" $i "*)
-		    newdeplibs="$newdeplibs $i"
-		    i=""
-		    ;;
-		  esac
-		fi
-		if test -n "$i" ; then
-		  libname=`eval "\\$ECHO \"$libname_spec\""`
-		  deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
-		  set dummy $deplib_matches; shift
-		  deplib_match=$1
-		  if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
-		    newdeplibs="$newdeplibs $i"
-		  else
-		    droppeddeps=yes
-		    $ECHO
-		    $ECHO "*** Warning: dynamic linker does not accept needed library $i."
-		    $ECHO "*** I have the capability to make that library automatically link in when"
-		    $ECHO "*** you link to this library.  But I can only do this if you have a"
-		    $ECHO "*** shared version of the library, which I believe you do not have"
-		    $ECHO "*** because a test_compile did reveal that the linker did not use it for"
-		    $ECHO "*** its dynamic dependency list that programs get resolved with at runtime."
-		  fi
-		fi
-		;;
-	      *)
-		newdeplibs="$newdeplibs $i"
-		;;
-	      esac
-	    done
-	  else
-	    # Error occurred in the first compile.  Let's try to salvage
-	    # the situation: Compile a separate program for each library.
-	    for i in $deplibs; do
-	      case $i in
-	      -l*)
-		func_stripname -l '' "$i"
-		name=$func_stripname_result
-		$opt_dry_run || $RM conftest
-		if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
-		  ldd_output=`ldd conftest`
-		  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
-		    case " $predeps $postdeps " in
-		    *" $i "*)
-		      newdeplibs="$newdeplibs $i"
-		      i=""
-		      ;;
-		    esac
-		  fi
-		  if test -n "$i" ; then
-		    libname=`eval "\\$ECHO \"$libname_spec\""`
-		    deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
-		    set dummy $deplib_matches; shift
-		    deplib_match=$1
-		    if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
-		      newdeplibs="$newdeplibs $i"
-		    else
-		      droppeddeps=yes
-		      $ECHO
-		      $ECHO "*** Warning: dynamic linker does not accept needed library $i."
-		      $ECHO "*** I have the capability to make that library automatically link in when"
-		      $ECHO "*** you link to this library.  But I can only do this if you have a"
-		      $ECHO "*** shared version of the library, which you do not appear to have"
-		      $ECHO "*** because a test_compile did reveal that the linker did not use this one"
-		      $ECHO "*** as a dynamic dependency that programs can get resolved with at runtime."
-		    fi
-		  fi
-		else
-		  droppeddeps=yes
-		  $ECHO
-		  $ECHO "*** Warning!  Library $i is needed by this library but I was not able to"
-		  $ECHO "*** make it link in!  You will probably need to install it or some"
-		  $ECHO "*** library that it depends on before this library will be fully"
-		  $ECHO "*** functional.  Installing it before continuing would be even better."
-		fi
-		;;
-	      *)
-		newdeplibs="$newdeplibs $i"
-		;;
-	      esac
-	    done
-	  fi
-	  ;;
-	file_magic*)
-	  set dummy $deplibs_check_method; shift
-	  file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
-	  for a_deplib in $deplibs; do
-	    case $a_deplib in
-	    -l*)
-	      func_stripname -l '' "$a_deplib"
-	      name=$func_stripname_result
-	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
-		case " $predeps $postdeps " in
-		*" $a_deplib "*)
-		  newdeplibs="$newdeplibs $a_deplib"
-		  a_deplib=""
-		  ;;
-		esac
-	      fi
-	      if test -n "$a_deplib" ; then
-		libname=`eval "\\$ECHO \"$libname_spec\""`
-		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
-		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
-		  for potent_lib in $potential_libs; do
-		      # Follow soft links.
-		      if ls -lLd "$potent_lib" 2>/dev/null |
-			 $GREP " -> " >/dev/null; then
-			continue
-		      fi
-		      # The statement above tries to avoid entering an
-		      # endless loop below, in case of cyclic links.
-		      # We might still enter an endless loop, since a link
-		      # loop can be closed while we follow links,
-		      # but so what?
-		      potlib="$potent_lib"
-		      while test -h "$potlib" 2>/dev/null; do
-			potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
-			case $potliblink in
-			[\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
-			*) potlib=`$ECHO "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
-			esac
-		      done
-		      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
-			 $SED -e 10q |
-			 $EGREP "$file_magic_regex" > /dev/null; then
-			newdeplibs="$newdeplibs $a_deplib"
-			a_deplib=""
-			break 2
-		      fi
-		  done
-		done
-	      fi
-	      if test -n "$a_deplib" ; then
-		droppeddeps=yes
-		$ECHO
-		$ECHO "*** Warning: linker path does not have real file for library $a_deplib."
-		$ECHO "*** I have the capability to make that library automatically link in when"
-		$ECHO "*** you link to this library.  But I can only do this if you have a"
-		$ECHO "*** shared version of the library, which you do not appear to have"
-		$ECHO "*** because I did check the linker path looking for a file starting"
-		if test -z "$potlib" ; then
-		  $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
-		else
-		  $ECHO "*** with $libname and none of the candidates passed a file format test"
-		  $ECHO "*** using a file magic. Last file checked: $potlib"
-		fi
-	      fi
-	      ;;
-	    *)
-	      # Add a -L argument.
-	      newdeplibs="$newdeplibs $a_deplib"
-	      ;;
-	    esac
-	  done # Gone through all deplibs.
-	  ;;
-	match_pattern*)
-	  set dummy $deplibs_check_method; shift
-	  match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
-	  for a_deplib in $deplibs; do
-	    case $a_deplib in
-	    -l*)
-	      func_stripname -l '' "$a_deplib"
-	      name=$func_stripname_result
-	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
-		case " $predeps $postdeps " in
-		*" $a_deplib "*)
-		  newdeplibs="$newdeplibs $a_deplib"
-		  a_deplib=""
-		  ;;
-		esac
-	      fi
-	      if test -n "$a_deplib" ; then
-		libname=`eval "\\$ECHO \"$libname_spec\""`
-		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
-		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
-		  for potent_lib in $potential_libs; do
-		    potlib="$potent_lib" # see symlink-check above in file_magic test
-		    if eval "\$ECHO \"X$potent_lib\"" 2>/dev/null | $Xsed -e 10q | \
-		       $EGREP "$match_pattern_regex" > /dev/null; then
-		      newdeplibs="$newdeplibs $a_deplib"
-		      a_deplib=""
-		      break 2
-		    fi
-		  done
-		done
-	      fi
-	      if test -n "$a_deplib" ; then
-		droppeddeps=yes
-		$ECHO
-		$ECHO "*** Warning: linker path does not have real file for library $a_deplib."
-		$ECHO "*** I have the capability to make that library automatically link in when"
-		$ECHO "*** you link to this library.  But I can only do this if you have a"
-		$ECHO "*** shared version of the library, which you do not appear to have"
-		$ECHO "*** because I did check the linker path looking for a file starting"
-		if test -z "$potlib" ; then
-		  $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
-		else
-		  $ECHO "*** with $libname and none of the candidates passed a file format test"
-		  $ECHO "*** using a regex pattern. Last file checked: $potlib"
-		fi
-	      fi
-	      ;;
-	    *)
-	      # Add a -L argument.
-	      newdeplibs="$newdeplibs $a_deplib"
-	      ;;
-	    esac
-	  done # Gone through all deplibs.
-	  ;;
-	none | unknown | *)
-	  newdeplibs=""
-	  tmp_deplibs=`$ECHO "X $deplibs" | $Xsed \
-	      -e 's/ -lc$//' -e 's/ -[LR][^ ]*//g'`
-	  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
-	    for i in $predeps $postdeps ; do
-	      # can't use Xsed below, because $i might contain '/'
-	      tmp_deplibs=`$ECHO "X $tmp_deplibs" | $Xsed -e "s,$i,,"`
-	    done
-	  fi
-	  if $ECHO "X $tmp_deplibs" | $Xsed -e 's/[	 ]//g' |
-	     $GREP . >/dev/null; then
-	    $ECHO
-	    if test "X$deplibs_check_method" = "Xnone"; then
-	      $ECHO "*** Warning: inter-library dependencies are not supported in this platform."
-	    else
-	      $ECHO "*** Warning: inter-library dependencies are not known to be supported."
-	    fi
-	    $ECHO "*** All declared inter-library dependencies are being dropped."
-	    droppeddeps=yes
-	  fi
-	  ;;
-	esac
-	versuffix=$versuffix_save
-	major=$major_save
-	release=$release_save
-	libname=$libname_save
-	name=$name_save
-
-	case $host in
-	*-*-rhapsody* | *-*-darwin1.[012])
-	  # On Rhapsody replace the C library with the System framework
-	  newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
-	  ;;
-	esac
-
-	if test "$droppeddeps" = yes; then
-	  if test "$module" = yes; then
-	    $ECHO
-	    $ECHO "*** Warning: libtool could not satisfy all declared inter-library"
-	    $ECHO "*** dependencies of module $libname.  Therefore, libtool will create"
-	    $ECHO "*** a static module, that should work as long as the dlopening"
-	    $ECHO "*** application is linked with the -dlopen flag."
-	    if test -z "$global_symbol_pipe"; then
-	      $ECHO
-	      $ECHO "*** However, this would only work if libtool was able to extract symbol"
-	      $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could"
-	      $ECHO "*** not find such a program.  So, this module is probably useless."
-	      $ECHO "*** \`nm' from GNU binutils and a full rebuild may help."
-	    fi
-	    if test "$build_old_libs" = no; then
-	      oldlibs="$output_objdir/$libname.$libext"
-	      build_libtool_libs=module
-	      build_old_libs=yes
-	    else
-	      build_libtool_libs=no
-	    fi
-	  else
-	    $ECHO "*** The inter-library dependencies that have been dropped here will be"
-	    $ECHO "*** automatically added whenever a program is linked with this library"
-	    $ECHO "*** or is declared to -dlopen it."
-
-	    if test "$allow_undefined" = no; then
-	      $ECHO
-	      $ECHO "*** Since this library must not contain undefined symbols,"
-	      $ECHO "*** because either the platform does not support them or"
-	      $ECHO "*** it was explicitly requested with -no-undefined,"
-	      $ECHO "*** libtool will only create a static version of it."
-	      if test "$build_old_libs" = no; then
-		oldlibs="$output_objdir/$libname.$libext"
-		build_libtool_libs=module
-		build_old_libs=yes
-	      else
-		build_libtool_libs=no
-	      fi
-	    fi
-	  fi
-	fi
-	# Done checking deplibs!
-	deplibs=$newdeplibs
-      fi
-      # Time to change all our "foo.ltframework" stuff back to "-framework foo"
-      case $host in
-	*-*-darwin*)
-	  newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
-	  new_inherited_linker_flags=`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
-	  deplibs=`$ECHO "X $deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
-	  ;;
-      esac
-
-      # move library search paths that coincide with paths to not yet
-      # installed libraries to the beginning of the library search list
-      new_libs=
-      for path in $notinst_path; do
-	case " $new_libs " in
-	*" -L$path/$objdir "*) ;;
-	*)
-	  case " $deplibs " in
-	  *" -L$path/$objdir "*)
-	    new_libs="$new_libs -L$path/$objdir" ;;
-	  esac
-	  ;;
-	esac
-      done
-      for deplib in $deplibs; do
-	case $deplib in
-	-L*)
-	  case " $new_libs " in
-	  *" $deplib "*) ;;
-	  *) new_libs="$new_libs $deplib" ;;
-	  esac
-	  ;;
-	*) new_libs="$new_libs $deplib" ;;
-	esac
-      done
-      deplibs="$new_libs"
-
-      # All the library-specific variables (install_libdir is set above).
-      library_names=
-      old_library=
-      dlname=
-
-      # Test again, we may have decided not to build it any more
-      if test "$build_libtool_libs" = yes; then
-	if test "$hardcode_into_libs" = yes; then
-	  # Hardcode the library paths
-	  hardcode_libdirs=
-	  dep_rpath=
-	  rpath="$finalize_rpath"
-	  test "$mode" != relink && rpath="$compile_rpath$rpath"
-	  for libdir in $rpath; do
-	    if test -n "$hardcode_libdir_flag_spec"; then
-	      if test -n "$hardcode_libdir_separator"; then
-		if test -z "$hardcode_libdirs"; then
-		  hardcode_libdirs="$libdir"
-		else
-		  # Just accumulate the unique libdirs.
-		  case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
-		  *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
-		    ;;
-		  *)
-		    hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
-		    ;;
-		  esac
-		fi
-	      else
-		eval flag=\"$hardcode_libdir_flag_spec\"
-		dep_rpath="$dep_rpath $flag"
-	      fi
-	    elif test -n "$runpath_var"; then
-	      case "$perm_rpath " in
-	      *" $libdir "*) ;;
-	      *) perm_rpath="$perm_rpath $libdir" ;;
-	      esac
-	    fi
-	  done
-	  # Substitute the hardcoded libdirs into the rpath.
-	  if test -n "$hardcode_libdir_separator" &&
-	     test -n "$hardcode_libdirs"; then
-	    libdir="$hardcode_libdirs"
-	    if test -n "$hardcode_libdir_flag_spec_ld"; then
-	      eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
-	    else
-	      eval dep_rpath=\"$hardcode_libdir_flag_spec\"
-	    fi
-	  fi
-	  if test -n "$runpath_var" && test -n "$perm_rpath"; then
-	    # We should set the runpath_var.
-	    rpath=
-	    for dir in $perm_rpath; do
-	      rpath="$rpath$dir:"
-	    done
-	    eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
-	  fi
-	  test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
-	fi
-
-	shlibpath="$finalize_shlibpath"
-	test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
-	if test -n "$shlibpath"; then
-	  eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
-	fi
-
-	# Get the real and link names of the library.
-	eval shared_ext=\"$shrext_cmds\"
-	eval library_names=\"$library_names_spec\"
-	set dummy $library_names
-	shift
-	realname="$1"
-	shift
-
-	if test -n "$soname_spec"; then
-	  eval soname=\"$soname_spec\"
-	else
-	  soname="$realname"
-	fi
-	if test -z "$dlname"; then
-	  dlname=$soname
-	fi
-
-	lib="$output_objdir/$realname"
-	linknames=
-	for link
-	do
-	  linknames="$linknames $link"
-	done
-
-	# Use standard objects if they are pic
-	test -z "$pic_flag" && libobjs=`$ECHO "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
-	test "X$libobjs" = "X " && libobjs=
-
-	delfiles=
-	if test -n "$export_symbols" && test -n "$include_expsyms"; then
-	  $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
-	  export_symbols="$output_objdir/$libname.uexp"
-	  delfiles="$delfiles $export_symbols"
-	fi
-
-	orig_export_symbols=
-	case $host_os in
-	cygwin* | mingw* | cegcc*)
-	  if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
-	    # exporting using user supplied symfile
-	    if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
-	      # and it's NOT already a .def file. Must figure out
-	      # which of the given symbols are data symbols and tag
-	      # them as such. So, trigger use of export_symbols_cmds.
-	      # export_symbols gets reassigned inside the "prepare
-	      # the list of exported symbols" if statement, so the
-	      # include_expsyms logic still works.
-	      orig_export_symbols="$export_symbols"
-	      export_symbols=
-	      always_export_symbols=yes
-	    fi
-	  fi
-	  ;;
-	esac
-
-	# Prepare the list of exported symbols
-	if test -z "$export_symbols"; then
-	  if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
-	    func_verbose "generating symbol list for \`$libname.la'"
-	    export_symbols="$output_objdir/$libname.exp"
-	    $opt_dry_run || $RM $export_symbols
-	    cmds=$export_symbols_cmds
-	    save_ifs="$IFS"; IFS='~'
-	    for cmd in $cmds; do
-	      IFS="$save_ifs"
-	      eval cmd=\"$cmd\"
-	      func_len " $cmd"
-	      len=$func_len_result
-	      if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
-		func_show_eval "$cmd" 'exit $?'
-		skipped_export=false
-	      else
-		# The command line is too long to execute in one step.
-		func_verbose "using reloadable object file for export list..."
-		skipped_export=:
-		# Break out early, otherwise skipped_export may be
-		# set to false by a later but shorter cmd.
-		break
-	      fi
-	    done
-	    IFS="$save_ifs"
-	    if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then
-	      func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
-	      func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
-	    fi
-	  fi
-	fi
-
-	if test -n "$export_symbols" && test -n "$include_expsyms"; then
-	  tmp_export_symbols="$export_symbols"
-	  test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
-	  $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"'
-	fi
-
-	if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
-	  # The given exports_symbols file has to be filtered, so filter it.
-	  func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
-	  # FIXME: $output_objdir/$libname.filter potentially contains lots of
-	  # 's' commands which not all seds can handle. GNU sed should be fine
-	  # though. Also, the filter scales superlinearly with the number of
-	  # global variables. join(1) would be nice here, but unfortunately
-	  # isn't a blessed tool.
-	  $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
-	  delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
-	  export_symbols=$output_objdir/$libname.def
-	  $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
-	fi
-
-	tmp_deplibs=
-	for test_deplib in $deplibs; do
-	  case " $convenience " in
-	  *" $test_deplib "*) ;;
-	  *)
-	    tmp_deplibs="$tmp_deplibs $test_deplib"
-	    ;;
-	  esac
-	done
-	deplibs="$tmp_deplibs"
-
-	if test -n "$convenience"; then
-	  if test -n "$whole_archive_flag_spec" &&
-	    test "$compiler_needs_object" = yes &&
-	    test -z "$libobjs"; then
-	    # extract the archives, so we have objects to list.
-	    # TODO: could optimize this to just extract one archive.
-	    whole_archive_flag_spec=
-	  fi
-	  if test -n "$whole_archive_flag_spec"; then
-	    save_libobjs=$libobjs
-	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
-	    test "X$libobjs" = "X " && libobjs=
-	  else
-	    gentop="$output_objdir/${outputname}x"
-	    generated="$generated $gentop"
-
-	    func_extract_archives $gentop $convenience
-	    libobjs="$libobjs $func_extract_archives_result"
-	    test "X$libobjs" = "X " && libobjs=
-	  fi
-	fi
-
-	if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
-	  eval flag=\"$thread_safe_flag_spec\"
-	  linker_flags="$linker_flags $flag"
-	fi
-
-	# Make a backup of the uninstalled library when relinking
-	if test "$mode" = relink; then
-	  $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
-	fi
-
-	# Do each of the archive commands.
-	if test "$module" = yes && test -n "$module_cmds" ; then
-	  if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
-	    eval test_cmds=\"$module_expsym_cmds\"
-	    cmds=$module_expsym_cmds
-	  else
-	    eval test_cmds=\"$module_cmds\"
-	    cmds=$module_cmds
-	  fi
-	else
-	  if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
-	    eval test_cmds=\"$archive_expsym_cmds\"
-	    cmds=$archive_expsym_cmds
-	  else
-	    eval test_cmds=\"$archive_cmds\"
-	    cmds=$archive_cmds
-	  fi
-	fi
-
-	if test "X$skipped_export" != "X:" &&
-	   func_len " $test_cmds" &&
-	   len=$func_len_result &&
-	   test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
-	  :
-	else
-	  # The command line is too long to link in one step, link piecewise
-	  # or, if using GNU ld and skipped_export is not :, use a linker
-	  # script.
-
-	  # Save the value of $output and $libobjs because we want to
-	  # use them later.  If we have whole_archive_flag_spec, we
-	  # want to use save_libobjs as it was before
-	  # whole_archive_flag_spec was expanded, because we can't
-	  # assume the linker understands whole_archive_flag_spec.
-	  # This may have to be revisited, in case too many
-	  # convenience libraries get linked in and end up exceeding
-	  # the spec.
-	  if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
-	    save_libobjs=$libobjs
-	  fi
-	  save_output=$output
-	  output_la=`$ECHO "X$output" | $Xsed -e "$basename"`
-
-	  # Clear the reloadable object creation command queue and
-	  # initialize k to one.
-	  test_cmds=
-	  concat_cmds=
-	  objlist=
-	  last_robj=
-	  k=1
-
-	  if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
-	    output=${output_objdir}/${output_la}.lnkscript
-	    func_verbose "creating GNU ld script: $output"
-	    $ECHO 'INPUT (' > $output
-	    for obj in $save_libobjs
-	    do
-	      $ECHO "$obj" >> $output
-	    done
-	    $ECHO ')' >> $output
-	    delfiles="$delfiles $output"
-	  elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
-	    output=${output_objdir}/${output_la}.lnk
-	    func_verbose "creating linker input file list: $output"
-	    : > $output
-	    set x $save_libobjs
-	    shift
-	    firstobj=
-	    if test "$compiler_needs_object" = yes; then
-	      firstobj="$1 "
-	      shift
-	    fi
-	    for obj
-	    do
-	      $ECHO "$obj" >> $output
-	    done
-	    delfiles="$delfiles $output"
-	    output=$firstobj\"$file_list_spec$output\"
-	  else
-	    if test -n "$save_libobjs"; then
-	      func_verbose "creating reloadable object files..."
-	      output=$output_objdir/$output_la-${k}.$objext
-	      eval test_cmds=\"$reload_cmds\"
-	      func_len " $test_cmds"
-	      len0=$func_len_result
-	      len=$len0
-
-	      # Loop over the list of objects to be linked.
-	      for obj in $save_libobjs
-	      do
-		func_len " $obj"
-		func_arith $len + $func_len_result
-		len=$func_arith_result
-		if test "X$objlist" = X ||
-		   test "$len" -lt "$max_cmd_len"; then
-		  func_append objlist " $obj"
-		else
-		  # The command $test_cmds is almost too long, add a
-		  # command to the queue.
-		  if test "$k" -eq 1 ; then
-		    # The first file doesn't have a previous command to add.
-		    eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
-		  else
-		    # All subsequent reloadable object files will link in
-		    # the last one created.
-		    eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj~\$RM $last_robj\"
-		  fi
-		  last_robj=$output_objdir/$output_la-${k}.$objext
-		  func_arith $k + 1
-		  k=$func_arith_result
-		  output=$output_objdir/$output_la-${k}.$objext
-		  objlist=$obj
-		  func_len " $last_robj"
-		  func_arith $len0 + $func_len_result
-		  len=$func_arith_result
-		fi
-	      done
-	      # Handle the remaining objects by creating one last
-	      # reloadable object file.  All subsequent reloadable object
-	      # files will link in the last one created.
-	      test -z "$concat_cmds" || concat_cmds=$concat_cmds~
-	      eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
-	      if test -n "$last_robj"; then
-	        eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
-	      fi
-	      delfiles="$delfiles $output"
-
-	    else
-	      output=
-	    fi
-
-	    if ${skipped_export-false}; then
-	      func_verbose "generating symbol list for \`$libname.la'"
-	      export_symbols="$output_objdir/$libname.exp"
-	      $opt_dry_run || $RM $export_symbols
-	      libobjs=$output
-	      # Append the command to create the export file.
-	      test -z "$concat_cmds" || concat_cmds=$concat_cmds~
-	      eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
-	      if test -n "$last_robj"; then
-		eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
-	      fi
-	    fi
-
-	    test -n "$save_libobjs" &&
-	      func_verbose "creating a temporary reloadable object file: $output"
-
-	    # Loop through the commands generated above and execute them.
-	    save_ifs="$IFS"; IFS='~'
-	    for cmd in $concat_cmds; do
-	      IFS="$save_ifs"
-	      $opt_silent || {
-		  func_quote_for_expand "$cmd"
-		  eval "func_echo $func_quote_for_expand_result"
-	      }
-	      $opt_dry_run || eval "$cmd" || {
-		lt_exit=$?
-
-		# Restore the uninstalled library and exit
-		if test "$mode" = relink; then
-		  ( cd "$output_objdir" && \
-		    $RM "${realname}T" && \
-		    $MV "${realname}U" "$realname" )
-		fi
-
-		exit $lt_exit
-	      }
-	    done
-	    IFS="$save_ifs"
-
-	    if test -n "$export_symbols_regex" && ${skipped_export-false}; then
-	      func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
-	      func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
-	    fi
-	  fi
-
-          if ${skipped_export-false}; then
-	    if test -n "$export_symbols" && test -n "$include_expsyms"; then
-	      tmp_export_symbols="$export_symbols"
-	      test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
-	      $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"'
-	    fi
-
-	    if test -n "$orig_export_symbols"; then
-	      # The given exports_symbols file has to be filtered, so filter it.
-	      func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
-	      # FIXME: $output_objdir/$libname.filter potentially contains lots of
-	      # 's' commands which not all seds can handle. GNU sed should be fine
-	      # though. Also, the filter scales superlinearly with the number of
-	      # global variables. join(1) would be nice here, but unfortunately
-	      # isn't a blessed tool.
-	      $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
-	      delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
-	      export_symbols=$output_objdir/$libname.def
-	      $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
-	    fi
-	  fi
-
-	  libobjs=$output
-	  # Restore the value of output.
-	  output=$save_output
-
-	  if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
-	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
-	    test "X$libobjs" = "X " && libobjs=
-	  fi
-	  # Expand the library linking commands again to reset the
-	  # value of $libobjs for piecewise linking.
-
-	  # Do each of the archive commands.
-	  if test "$module" = yes && test -n "$module_cmds" ; then
-	    if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
-	      cmds=$module_expsym_cmds
-	    else
-	      cmds=$module_cmds
-	    fi
-	  else
-	    if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
-	      cmds=$archive_expsym_cmds
-	    else
-	      cmds=$archive_cmds
-	    fi
-	  fi
-	fi
-
-	if test -n "$delfiles"; then
-	  # Append the command to remove temporary files to $cmds.
-	  eval cmds=\"\$cmds~\$RM $delfiles\"
-	fi
-
-	# Add any objects from preloaded convenience libraries
-	if test -n "$dlprefiles"; then
-	  gentop="$output_objdir/${outputname}x"
-	  generated="$generated $gentop"
-
-	  func_extract_archives $gentop $dlprefiles
-	  libobjs="$libobjs $func_extract_archives_result"
-	  test "X$libobjs" = "X " && libobjs=
-	fi
-
-	save_ifs="$IFS"; IFS='~'
-	for cmd in $cmds; do
-	  IFS="$save_ifs"
-	  eval cmd=\"$cmd\"
-	  $opt_silent || {
-	    func_quote_for_expand "$cmd"
-	    eval "func_echo $func_quote_for_expand_result"
-	  }
-	  $opt_dry_run || eval "$cmd" || {
-	    lt_exit=$?
-
-	    # Restore the uninstalled library and exit
-	    if test "$mode" = relink; then
-	      ( cd "$output_objdir" && \
-	        $RM "${realname}T" && \
-		$MV "${realname}U" "$realname" )
-	    fi
-
-	    exit $lt_exit
-	  }
-	done
-	IFS="$save_ifs"
-
-	# Restore the uninstalled library and exit
-	if test "$mode" = relink; then
-	  $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
-
-	  if test -n "$convenience"; then
-	    if test -z "$whole_archive_flag_spec"; then
-	      func_show_eval '${RM}r "$gentop"'
-	    fi
-	  fi
-
-	  exit $EXIT_SUCCESS
-	fi
-
-	# Create links to the real library.
-	for linkname in $linknames; do
-	  if test "$realname" != "$linkname"; then
-	    func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
-	  fi
-	done
-
-	# If -module or -export-dynamic was specified, set the dlname.
-	if test "$module" = yes || test "$export_dynamic" = yes; then
-	  # On all known operating systems, these are identical.
-	  dlname="$soname"
-	fi
-      fi
-      ;;
-
-    obj)
-      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
-	func_warning "\`-dlopen' is ignored for objects"
-      fi
-
-      case " $deplibs" in
-      *\ -l* | *\ -L*)
-	func_warning "\`-l' and \`-L' are ignored for objects" ;;
-      esac
-
-      test -n "$rpath" && \
-	func_warning "\`-rpath' is ignored for objects"
-
-      test -n "$xrpath" && \
-	func_warning "\`-R' is ignored for objects"
-
-      test -n "$vinfo" && \
-	func_warning "\`-version-info' is ignored for objects"
-
-      test -n "$release" && \
-	func_warning "\`-release' is ignored for objects"
-
-      case $output in
-      *.lo)
-	test -n "$objs$old_deplibs" && \
-	  func_fatal_error "cannot build library object \`$output' from non-libtool objects"
-
-	libobj=$output
-	func_lo2o "$libobj"
-	obj=$func_lo2o_result
-	;;
-      *)
-	libobj=
-	obj="$output"
-	;;
-      esac
-
-      # Delete the old objects.
-      $opt_dry_run || $RM $obj $libobj
-
-      # Objects from convenience libraries.  This assumes
-      # single-version convenience libraries.  Whenever we create
-      # different ones for PIC/non-PIC, this we'll have to duplicate
-      # the extraction.
-      reload_conv_objs=
-      gentop=
-      # reload_cmds runs $LD directly, so let us get rid of
-      # -Wl from whole_archive_flag_spec and hope we can get by with
-      # turning comma into space..
-      wl=
-
-      if test -n "$convenience"; then
-	if test -n "$whole_archive_flag_spec"; then
-	  eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
-	  reload_conv_objs=$reload_objs\ `$ECHO "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
-	else
-	  gentop="$output_objdir/${obj}x"
-	  generated="$generated $gentop"
-
-	  func_extract_archives $gentop $convenience
-	  reload_conv_objs="$reload_objs $func_extract_archives_result"
-	fi
-      fi
-
-      # Create the old-style object.
-      reload_objs="$objs$old_deplibs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
-
-      output="$obj"
-      func_execute_cmds "$reload_cmds" 'exit $?'
-
-      # Exit if we aren't doing a library object file.
-      if test -z "$libobj"; then
-	if test -n "$gentop"; then
-	  func_show_eval '${RM}r "$gentop"'
-	fi
-
-	exit $EXIT_SUCCESS
-      fi
-
-      if test "$build_libtool_libs" != yes; then
-	if test -n "$gentop"; then
-	  func_show_eval '${RM}r "$gentop"'
-	fi
-
-	# Create an invalid libtool object if no PIC, so that we don't
-	# accidentally link it into a program.
-	# $show "echo timestamp > $libobj"
-	# $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
-	exit $EXIT_SUCCESS
-      fi
-
-      if test -n "$pic_flag" || test "$pic_mode" != default; then
-	# Only do commands if we really have different PIC objects.
-	reload_objs="$libobjs $reload_conv_objs"
-	output="$libobj"
-	func_execute_cmds "$reload_cmds" 'exit $?'
-      fi
-
-      if test -n "$gentop"; then
-	func_show_eval '${RM}r "$gentop"'
-      fi
-
-      exit $EXIT_SUCCESS
-      ;;
-
-    prog)
-      case $host in
-	*cygwin*) func_stripname '' '.exe' "$output"
-	          output=$func_stripname_result.exe;;
-      esac
-      test -n "$vinfo" && \
-	func_warning "\`-version-info' is ignored for programs"
-
-      test -n "$release" && \
-	func_warning "\`-release' is ignored for programs"
-
-      test "$preload" = yes \
-        && test "$dlopen_support" = unknown \
-	&& test "$dlopen_self" = unknown \
-	&& test "$dlopen_self_static" = unknown && \
-	  func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
-
-      case $host in
-      *-*-rhapsody* | *-*-darwin1.[012])
-	# On Rhapsody replace the C library is the System framework
-	compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
-	finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
-	;;
-      esac
-
-      case $host in
-      *-*-darwin*)
-	# Don't allow lazy linking, it breaks C++ global constructors
-	# But is supposedly fixed on 10.4 or later (yay!).
-	if test "$tagname" = CXX ; then
-	  case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
-	    10.[0123])
-	      compile_command="$compile_command ${wl}-bind_at_load"
-	      finalize_command="$finalize_command ${wl}-bind_at_load"
-	    ;;
-	  esac
-	fi
-	# Time to change all our "foo.ltframework" stuff back to "-framework foo"
-	compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
-	finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
-	;;
-      esac
-
-
-      # move library search paths that coincide with paths to not yet
-      # installed libraries to the beginning of the library search list
-      new_libs=
-      for path in $notinst_path; do
-	case " $new_libs " in
-	*" -L$path/$objdir "*) ;;
-	*)
-	  case " $compile_deplibs " in
-	  *" -L$path/$objdir "*)
-	    new_libs="$new_libs -L$path/$objdir" ;;
-	  esac
-	  ;;
-	esac
-      done
-      for deplib in $compile_deplibs; do
-	case $deplib in
-	-L*)
-	  case " $new_libs " in
-	  *" $deplib "*) ;;
-	  *) new_libs="$new_libs $deplib" ;;
-	  esac
-	  ;;
-	*) new_libs="$new_libs $deplib" ;;
-	esac
-      done
-      compile_deplibs="$new_libs"
-
-
-      compile_command="$compile_command $compile_deplibs"
-      finalize_command="$finalize_command $finalize_deplibs"
-
-      if test -n "$rpath$xrpath"; then
-	# If the user specified any rpath flags, then add them.
-	for libdir in $rpath $xrpath; do
-	  # This is the magic to use -rpath.
-	  case "$finalize_rpath " in
-	  *" $libdir "*) ;;
-	  *) finalize_rpath="$finalize_rpath $libdir" ;;
-	  esac
-	done
-      fi
-
-      # Now hardcode the library paths
-      rpath=
-      hardcode_libdirs=
-      for libdir in $compile_rpath $finalize_rpath; do
-	if test -n "$hardcode_libdir_flag_spec"; then
-	  if test -n "$hardcode_libdir_separator"; then
-	    if test -z "$hardcode_libdirs"; then
-	      hardcode_libdirs="$libdir"
-	    else
-	      # Just accumulate the unique libdirs.
-	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
-	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
-		;;
-	      *)
-		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
-		;;
-	      esac
-	    fi
-	  else
-	    eval flag=\"$hardcode_libdir_flag_spec\"
-	    rpath="$rpath $flag"
-	  fi
-	elif test -n "$runpath_var"; then
-	  case "$perm_rpath " in
-	  *" $libdir "*) ;;
-	  *) perm_rpath="$perm_rpath $libdir" ;;
-	  esac
-	fi
-	case $host in
-	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
-	  testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
-	  case :$dllsearchpath: in
-	  *":$libdir:"*) ;;
-	  ::) dllsearchpath=$libdir;;
-	  *) dllsearchpath="$dllsearchpath:$libdir";;
-	  esac
-	  case :$dllsearchpath: in
-	  *":$testbindir:"*) ;;
-	  ::) dllsearchpath=$testbindir;;
-	  *) dllsearchpath="$dllsearchpath:$testbindir";;
-	  esac
-	  ;;
-	esac
-      done
-      # Substitute the hardcoded libdirs into the rpath.
-      if test -n "$hardcode_libdir_separator" &&
-	 test -n "$hardcode_libdirs"; then
-	libdir="$hardcode_libdirs"
-	eval rpath=\" $hardcode_libdir_flag_spec\"
-      fi
-      compile_rpath="$rpath"
-
-      rpath=
-      hardcode_libdirs=
-      for libdir in $finalize_rpath; do
-	if test -n "$hardcode_libdir_flag_spec"; then
-	  if test -n "$hardcode_libdir_separator"; then
-	    if test -z "$hardcode_libdirs"; then
-	      hardcode_libdirs="$libdir"
-	    else
-	      # Just accumulate the unique libdirs.
-	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
-	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
-		;;
-	      *)
-		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
-		;;
-	      esac
-	    fi
-	  else
-	    eval flag=\"$hardcode_libdir_flag_spec\"
-	    rpath="$rpath $flag"
-	  fi
-	elif test -n "$runpath_var"; then
-	  case "$finalize_perm_rpath " in
-	  *" $libdir "*) ;;
-	  *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
-	  esac
-	fi
-      done
-      # Substitute the hardcoded libdirs into the rpath.
-      if test -n "$hardcode_libdir_separator" &&
-	 test -n "$hardcode_libdirs"; then
-	libdir="$hardcode_libdirs"
-	eval rpath=\" $hardcode_libdir_flag_spec\"
-      fi
-      finalize_rpath="$rpath"
-
-      if test -n "$libobjs" && test "$build_old_libs" = yes; then
-	# Transform all the library objects into standard objects.
-	compile_command=`$ECHO "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
-	finalize_command=`$ECHO "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
-      fi
-
-      func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
-
-      # template prelinking step
-      if test -n "$prelink_cmds"; then
-	func_execute_cmds "$prelink_cmds" 'exit $?'
-      fi
-
-      wrappers_required=yes
-      case $host in
-      *cygwin* | *mingw* )
-        if test "$build_libtool_libs" != yes; then
-          wrappers_required=no
-        fi
-        ;;
-      *cegcc)
-        # Disable wrappers for cegcc, we are cross compiling anyway.
-        wrappers_required=no
-        ;;
-      *)
-        if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
-          wrappers_required=no
-        fi
-        ;;
-      esac
-      if test "$wrappers_required" = no; then
-	# Replace the output file specification.
-	compile_command=`$ECHO "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
-	link_command="$compile_command$compile_rpath"
-
-	# We have no uninstalled library dependencies, so finalize right now.
-	exit_status=0
-	func_show_eval "$link_command" 'exit_status=$?'
-
-	# Delete the generated files.
-	if test -f "$output_objdir/${outputname}S.${objext}"; then
-	  func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
-	fi
-
-	exit $exit_status
-      fi
-
-      if test -n "$compile_shlibpath$finalize_shlibpath"; then
-	compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
-      fi
-      if test -n "$finalize_shlibpath"; then
-	finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
-      fi
-
-      compile_var=
-      finalize_var=
-      if test -n "$runpath_var"; then
-	if test -n "$perm_rpath"; then
-	  # We should set the runpath_var.
-	  rpath=
-	  for dir in $perm_rpath; do
-	    rpath="$rpath$dir:"
-	  done
-	  compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
-	fi
-	if test -n "$finalize_perm_rpath"; then
-	  # We should set the runpath_var.
-	  rpath=
-	  for dir in $finalize_perm_rpath; do
-	    rpath="$rpath$dir:"
-	  done
-	  finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
-	fi
-      fi
-
-      if test "$no_install" = yes; then
-	# We don't need to create a wrapper script.
-	link_command="$compile_var$compile_command$compile_rpath"
-	# Replace the output file specification.
-	link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
-	# Delete the old output file.
-	$opt_dry_run || $RM $output
-	# Link the executable and exit
-	func_show_eval "$link_command" 'exit $?'
-	exit $EXIT_SUCCESS
-      fi
-
-      if test "$hardcode_action" = relink; then
-	# Fast installation is not supported
-	link_command="$compile_var$compile_command$compile_rpath"
-	relink_command="$finalize_var$finalize_command$finalize_rpath"
-
-	func_warning "this platform does not like uninstalled shared libraries"
-	func_warning "\`$output' will be relinked during installation"
-      else
-	if test "$fast_install" != no; then
-	  link_command="$finalize_var$compile_command$finalize_rpath"
-	  if test "$fast_install" = yes; then
-	    relink_command=`$ECHO "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
-	  else
-	    # fast_install is set to needless
-	    relink_command=
-	  fi
-	else
-	  link_command="$compile_var$compile_command$compile_rpath"
-	  relink_command="$finalize_var$finalize_command$finalize_rpath"
-	fi
-      fi
-
-      # Replace the output file specification.
-      link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
-
-      # Delete the old output files.
-      $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
-
-      func_show_eval "$link_command" 'exit $?'
-
-      # Now create the wrapper script.
-      func_verbose "creating $output"
-
-      # Quote the relink command for shipping.
-      if test -n "$relink_command"; then
-	# Preserve any variables that may affect compiler behavior
-	for var in $variables_saved_for_relink; do
-	  if eval test -z \"\${$var+set}\"; then
-	    relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
-	  elif eval var_value=\$$var; test -z "$var_value"; then
-	    relink_command="$var=; export $var; $relink_command"
-	  else
-	    func_quote_for_eval "$var_value"
-	    relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
-	  fi
-	done
-	relink_command="(cd `pwd`; $relink_command)"
-	relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"`
-      fi
-
-      # Quote $ECHO for shipping.
-      if test "X$ECHO" = "X$SHELL $progpath --fallback-echo"; then
-	case $progpath in
-	[\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
-	*) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
-	esac
-	qecho=`$ECHO "X$qecho" | $Xsed -e "$sed_quote_subst"`
-      else
-	qecho=`$ECHO "X$ECHO" | $Xsed -e "$sed_quote_subst"`
-      fi
-
-      # Only actually do things if not in dry run mode.
-      $opt_dry_run || {
-	# win32 will think the script is a binary if it has
-	# a .exe suffix, so we strip it off here.
-	case $output in
-	  *.exe) func_stripname '' '.exe' "$output"
-	         output=$func_stripname_result ;;
-	esac
-	# test for cygwin because mv fails w/o .exe extensions
-	case $host in
-	  *cygwin*)
-	    exeext=.exe
-	    func_stripname '' '.exe' "$outputname"
-	    outputname=$func_stripname_result ;;
-	  *) exeext= ;;
-	esac
-	case $host in
-	  *cygwin* | *mingw* )
-	    func_dirname_and_basename "$output" "" "."
-	    output_name=$func_basename_result
-	    output_path=$func_dirname_result
-	    cwrappersource="$output_path/$objdir/lt-$output_name.c"
-	    cwrapper="$output_path/$output_name.exe"
-	    $RM $cwrappersource $cwrapper
-	    trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
-
-	    func_emit_cwrapperexe_src > $cwrappersource
-
-	    # The wrapper executable is built using the $host compiler,
-	    # because it contains $host paths and files. If cross-
-	    # compiling, it, like the target executable, must be
-	    # executed on the $host or under an emulation environment.
-	    $opt_dry_run || {
-	      $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
-	      $STRIP $cwrapper
-	    }
-
-	    # Now, create the wrapper script for func_source use:
-	    func_ltwrapper_scriptname $cwrapper
-	    $RM $func_ltwrapper_scriptname_result
-	    trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
-	    $opt_dry_run || {
-	      # note: this script will not be executed, so do not chmod.
-	      if test "x$build" = "x$host" ; then
-		$cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
-	      else
-		func_emit_wrapper no > $func_ltwrapper_scriptname_result
-	      fi
-	    }
-	  ;;
-	  * )
-	    $RM $output
-	    trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
-
-	    func_emit_wrapper no > $output
-	    chmod +x $output
-	  ;;
-	esac
-      }
-      exit $EXIT_SUCCESS
-      ;;
-    esac
-
-    # See if we need to build an old-fashioned archive.
-    for oldlib in $oldlibs; do
-
-      if test "$build_libtool_libs" = convenience; then
-	oldobjs="$libobjs_save $symfileobj"
-	addlibs="$convenience"
-	build_libtool_libs=no
-      else
-	if test "$build_libtool_libs" = module; then
-	  oldobjs="$libobjs_save"
-	  build_libtool_libs=no
-	else
-	  oldobjs="$old_deplibs $non_pic_objects"
-	  if test "$preload" = yes && test -f "$symfileobj"; then
-	    oldobjs="$oldobjs $symfileobj"
-	  fi
-	fi
-	addlibs="$old_convenience"
-      fi
-
-      if test -n "$addlibs"; then
-	gentop="$output_objdir/${outputname}x"
-	generated="$generated $gentop"
-
-	func_extract_archives $gentop $addlibs
-	oldobjs="$oldobjs $func_extract_archives_result"
-      fi
-
-      # Do each command in the archive commands.
-      if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
-	cmds=$old_archive_from_new_cmds
-      else
-
-	# Add any objects from preloaded convenience libraries
-	if test -n "$dlprefiles"; then
-	  gentop="$output_objdir/${outputname}x"
-	  generated="$generated $gentop"
-
-	  func_extract_archives $gentop $dlprefiles
-	  oldobjs="$oldobjs $func_extract_archives_result"
-	fi
-
-	# POSIX demands no paths to be encoded in archives.  We have
-	# to avoid creating archives with duplicate basenames if we
-	# might have to extract them afterwards, e.g., when creating a
-	# static archive out of a convenience library, or when linking
-	# the entirety of a libtool archive into another (currently
-	# not supported by libtool).
-	if (for obj in $oldobjs
-	    do
-	      func_basename "$obj"
-	      $ECHO "$func_basename_result"
-	    done | sort | sort -uc >/dev/null 2>&1); then
-	  :
-	else
-	  $ECHO "copying selected object files to avoid basename conflicts..."
-	  gentop="$output_objdir/${outputname}x"
-	  generated="$generated $gentop"
-	  func_mkdir_p "$gentop"
-	  save_oldobjs=$oldobjs
-	  oldobjs=
-	  counter=1
-	  for obj in $save_oldobjs
-	  do
-	    func_basename "$obj"
-	    objbase="$func_basename_result"
-	    case " $oldobjs " in
-	    " ") oldobjs=$obj ;;
-	    *[\ /]"$objbase "*)
-	      while :; do
-		# Make sure we don't pick an alternate name that also
-		# overlaps.
-		newobj=lt$counter-$objbase
-		func_arith $counter + 1
-		counter=$func_arith_result
-		case " $oldobjs " in
-		*[\ /]"$newobj "*) ;;
-		*) if test ! -f "$gentop/$newobj"; then break; fi ;;
-		esac
-	      done
-	      func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
-	      oldobjs="$oldobjs $gentop/$newobj"
-	      ;;
-	    *) oldobjs="$oldobjs $obj" ;;
-	    esac
-	  done
-	fi
-	eval cmds=\"$old_archive_cmds\"
-
-	func_len " $cmds"
-	len=$func_len_result
-	if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
-	  cmds=$old_archive_cmds
-	else
-	  # the command line is too long to link in one step, link in parts
-	  func_verbose "using piecewise archive linking..."
-	  save_RANLIB=$RANLIB
-	  RANLIB=:
-	  objlist=
-	  concat_cmds=
-	  save_oldobjs=$oldobjs
-	  oldobjs=
-	  # Is there a better way of finding the last object in the list?
-	  for obj in $save_oldobjs
-	  do
-	    last_oldobj=$obj
-	  done
-	  eval test_cmds=\"$old_archive_cmds\"
-	  func_len " $test_cmds"
-	  len0=$func_len_result
-	  len=$len0
-	  for obj in $save_oldobjs
-	  do
-	    func_len " $obj"
-	    func_arith $len + $func_len_result
-	    len=$func_arith_result
-	    func_append objlist " $obj"
-	    if test "$len" -lt "$max_cmd_len"; then
-	      :
-	    else
-	      # the above command should be used before it gets too long
-	      oldobjs=$objlist
-	      if test "$obj" = "$last_oldobj" ; then
-		RANLIB=$save_RANLIB
-	      fi
-	      test -z "$concat_cmds" || concat_cmds=$concat_cmds~
-	      eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
-	      objlist=
-	      len=$len0
-	    fi
-	  done
-	  RANLIB=$save_RANLIB
-	  oldobjs=$objlist
-	  if test "X$oldobjs" = "X" ; then
-	    eval cmds=\"\$concat_cmds\"
-	  else
-	    eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
-	  fi
-	fi
-      fi
-      func_execute_cmds "$cmds" 'exit $?'
-    done
-
-    test -n "$generated" && \
-      func_show_eval "${RM}r$generated"
-
-    # Now create the libtool archive.
-    case $output in
-    *.la)
-      old_library=
-      test "$build_old_libs" = yes && old_library="$libname.$libext"
-      func_verbose "creating $output"
-
-      # Preserve any variables that may affect compiler behavior
-      for var in $variables_saved_for_relink; do
-	if eval test -z \"\${$var+set}\"; then
-	  relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
-	elif eval var_value=\$$var; test -z "$var_value"; then
-	  relink_command="$var=; export $var; $relink_command"
-	else
-	  func_quote_for_eval "$var_value"
-	  relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
-	fi
-      done
-      # Quote the link command for shipping.
-      relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
-      relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"`
-      if test "$hardcode_automatic" = yes ; then
-	relink_command=
-      fi
-
-      # Only create the output if not a dry run.
-      $opt_dry_run || {
-	for installed in no yes; do
-	  if test "$installed" = yes; then
-	    if test -z "$install_libdir"; then
-	      break
-	    fi
-	    output="$output_objdir/$outputname"i
-	    # Replace all uninstalled libtool libraries with the installed ones
-	    newdependency_libs=
-	    for deplib in $dependency_libs; do
-	      case $deplib in
-	      *.la)
-		func_basename "$deplib"
-		name="$func_basename_result"
-		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
-		test -z "$libdir" && \
-		  func_fatal_error "\`$deplib' is not a valid libtool archive"
-		newdependency_libs="$newdependency_libs $libdir/$name"
-		;;
-	      *) newdependency_libs="$newdependency_libs $deplib" ;;
-	      esac
-	    done
-	    dependency_libs="$newdependency_libs"
-	    newdlfiles=
-
-	    for lib in $dlfiles; do
-	      case $lib in
-	      *.la)
-	        func_basename "$lib"
-		name="$func_basename_result"
-		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
-		test -z "$libdir" && \
-		  func_fatal_error "\`$lib' is not a valid libtool archive"
-		newdlfiles="$newdlfiles $libdir/$name"
-		;;
-	      *) newdlfiles="$newdlfiles $lib" ;;
-	      esac
-	    done
-	    dlfiles="$newdlfiles"
-	    newdlprefiles=
-	    for lib in $dlprefiles; do
-	      case $lib in
-	      *.la)
-		# Only pass preopened files to the pseudo-archive (for
-		# eventual linking with the app. that links it) if we
-		# didn't already link the preopened objects directly into
-		# the library:
-		func_basename "$lib"
-		name="$func_basename_result"
-		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
-		test -z "$libdir" && \
-		  func_fatal_error "\`$lib' is not a valid libtool archive"
-		newdlprefiles="$newdlprefiles $libdir/$name"
-		;;
-	      esac
-	    done
-	    dlprefiles="$newdlprefiles"
-	  else
-	    newdlfiles=
-	    for lib in $dlfiles; do
-	      case $lib in
-		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
-		*) abs=`pwd`"/$lib" ;;
-	      esac
-	      newdlfiles="$newdlfiles $abs"
-	    done
-	    dlfiles="$newdlfiles"
-	    newdlprefiles=
-	    for lib in $dlprefiles; do
-	      case $lib in
-		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
-		*) abs=`pwd`"/$lib" ;;
-	      esac
-	      newdlprefiles="$newdlprefiles $abs"
-	    done
-	    dlprefiles="$newdlprefiles"
-	  fi
-	  $RM $output
-	  # place dlname in correct position for cygwin
-	  tdlname=$dlname
-	  case $host,$output,$installed,$module,$dlname in
-	    *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
-	  esac
-	  $ECHO > $output "\
-# $outputname - a libtool library file
-# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
-#
-# Please DO NOT delete this file!
-# It is necessary for linking the library.
-
-# The name that we can dlopen(3).
-dlname='$tdlname'
-
-# Names of this library.
-library_names='$library_names'
-
-# The name of the static archive.
-old_library='$old_library'
-
-# Linker flags that can not go in dependency_libs.
-inherited_linker_flags='$new_inherited_linker_flags'
-
-# Libraries that this one depends upon.
-dependency_libs='$dependency_libs'
-
-# Names of additional weak libraries provided by this library
-weak_library_names='$weak_libs'
-
-# Version information for $libname.
-current=$current
-age=$age
-revision=$revision
-
-# Is this an already installed library?
-installed=$installed
-
-# Should we warn about portability when linking against -modules?
-shouldnotlink=$module
-
-# Files to dlopen/dlpreopen
-dlopen='$dlfiles'
-dlpreopen='$dlprefiles'
-
-# Directory that this library needs to be installed in:
-libdir='$install_libdir'"
-	  if test "$installed" = no && test "$need_relink" = yes; then
-	    $ECHO >> $output "\
-relink_command=\"$relink_command\""
-	  fi
-	done
-      }
-
-      # Do a symbolic link so that the libtool archive can be found in
-      # LD_LIBRARY_PATH before the program is installed.
-      func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
-      ;;
-    esac
-    exit $EXIT_SUCCESS
-}
-
-{ test "$mode" = link || test "$mode" = relink; } &&
-    func_mode_link ${1+"$@"}
-
-
-# func_mode_uninstall arg...
-func_mode_uninstall ()
-{
-    $opt_debug
-    RM="$nonopt"
-    files=
-    rmforce=
-    exit_status=0
-
-    # This variable tells wrapper scripts just to set variables rather
-    # than running their programs.
-    libtool_install_magic="$magic"
-
-    for arg
-    do
-      case $arg in
-      -f) RM="$RM $arg"; rmforce=yes ;;
-      -*) RM="$RM $arg" ;;
-      *) files="$files $arg" ;;
-      esac
-    done
-
-    test -z "$RM" && \
-      func_fatal_help "you must specify an RM program"
-
-    rmdirs=
-
-    origobjdir="$objdir"
-    for file in $files; do
-      func_dirname "$file" "" "."
-      dir="$func_dirname_result"
-      if test "X$dir" = X.; then
-	objdir="$origobjdir"
-      else
-	objdir="$dir/$origobjdir"
-      fi
-      func_basename "$file"
-      name="$func_basename_result"
-      test "$mode" = uninstall && objdir="$dir"
-
-      # Remember objdir for removal later, being careful to avoid duplicates
-      if test "$mode" = clean; then
-	case " $rmdirs " in
-	  *" $objdir "*) ;;
-	  *) rmdirs="$rmdirs $objdir" ;;
-	esac
-      fi
-
-      # Don't error if the file doesn't exist and rm -f was used.
-      if { test -L "$file"; } >/dev/null 2>&1 ||
-	 { test -h "$file"; } >/dev/null 2>&1 ||
-	 test -f "$file"; then
-	:
-      elif test -d "$file"; then
-	exit_status=1
-	continue
-      elif test "$rmforce" = yes; then
-	continue
-      fi
-
-      rmfiles="$file"
-
-      case $name in
-      *.la)
-	# Possibly a libtool archive, so verify it.
-	if func_lalib_p "$file"; then
-	  func_source $dir/$name
-
-	  # Delete the libtool libraries and symlinks.
-	  for n in $library_names; do
-	    rmfiles="$rmfiles $objdir/$n"
-	  done
-	  test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
-
-	  case "$mode" in
-	  clean)
-	    case "  $library_names " in
-	    # "  " in the beginning catches empty $dlname
-	    *" $dlname "*) ;;
-	    *) rmfiles="$rmfiles $objdir/$dlname" ;;
-	    esac
-	    test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
-	    ;;
-	  uninstall)
-	    if test -n "$library_names"; then
-	      # Do each command in the postuninstall commands.
-	      func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
-	    fi
-
-	    if test -n "$old_library"; then
-	      # Do each command in the old_postuninstall commands.
-	      func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
-	    fi
-	    # FIXME: should reinstall the best remaining shared library.
-	    ;;
-	  esac
-	fi
-	;;
-
-      *.lo)
-	# Possibly a libtool object, so verify it.
-	if func_lalib_p "$file"; then
-
-	  # Read the .lo file
-	  func_source $dir/$name
-
-	  # Add PIC object to the list of files to remove.
-	  if test -n "$pic_object" &&
-	     test "$pic_object" != none; then
-	    rmfiles="$rmfiles $dir/$pic_object"
-	  fi
-
-	  # Add non-PIC object to the list of files to remove.
-	  if test -n "$non_pic_object" &&
-	     test "$non_pic_object" != none; then
-	    rmfiles="$rmfiles $dir/$non_pic_object"
-	  fi
-	fi
-	;;
-
-      *)
-	if test "$mode" = clean ; then
-	  noexename=$name
-	  case $file in
-	  *.exe)
-	    func_stripname '' '.exe' "$file"
-	    file=$func_stripname_result
-	    func_stripname '' '.exe' "$name"
-	    noexename=$func_stripname_result
-	    # $file with .exe has already been added to rmfiles,
-	    # add $file without .exe
-	    rmfiles="$rmfiles $file"
-	    ;;
-	  esac
-	  # Do a test to see if this is a libtool program.
-	  if func_ltwrapper_p "$file"; then
-	    if func_ltwrapper_executable_p "$file"; then
-	      func_ltwrapper_scriptname "$file"
-	      relink_command=
-	      func_source $func_ltwrapper_scriptname_result
-	      rmfiles="$rmfiles $func_ltwrapper_scriptname_result"
-	    else
-	      relink_command=
-	      func_source $dir/$noexename
-	    fi
-
-	    # note $name still contains .exe if it was in $file originally
-	    # as does the version of $file that was added into $rmfiles
-	    rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
-	    if test "$fast_install" = yes && test -n "$relink_command"; then
-	      rmfiles="$rmfiles $objdir/lt-$name"
-	    fi
-	    if test "X$noexename" != "X$name" ; then
-	      rmfiles="$rmfiles $objdir/lt-${noexename}.c"
-	    fi
-	  fi
-	fi
-	;;
-      esac
-      func_show_eval "$RM $rmfiles" 'exit_status=1'
-    done
-    objdir="$origobjdir"
-
-    # Try to remove the ${objdir}s in the directories where we deleted files
-    for dir in $rmdirs; do
-      if test -d "$dir"; then
-	func_show_eval "rmdir $dir >/dev/null 2>&1"
-      fi
-    done
-
-    exit $exit_status
-}
-
-{ test "$mode" = uninstall || test "$mode" = clean; } &&
-    func_mode_uninstall ${1+"$@"}
-
-test -z "$mode" && {
-  help="$generic_help"
-  func_fatal_help "you must specify a MODE"
-}
-
-test -z "$exec_cmd" && \
-  func_fatal_help "invalid operation mode \`$mode'"
-
-if test -n "$exec_cmd"; then
-  eval exec "$exec_cmd"
-  exit $EXIT_FAILURE
-fi
-
-exit $exit_status
-
-
-# The TAGs below are defined such that we never get into a situation
-# in which we disable both kinds of libraries.  Given conflicting
-# choices, we go for a static library, that is the most portable,
-# since we can't tell whether shared libraries were disabled because
-# the user asked for that or because the platform doesn't support
-# them.  This is particularly important on AIX, because we don't
-# support having both static and shared libraries enabled at the same
-# time on that platform, so we default to a shared-only configuration.
-# If a disable-shared tag is given, we'll fallback to a static-only
-# configuration.  But we'll never go from static-only to shared-only.
-
-# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
-build_libtool_libs=no
-build_old_libs=yes
-# ### END LIBTOOL TAG CONFIG: disable-shared
-
-# ### BEGIN LIBTOOL TAG CONFIG: disable-static
-build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
-# ### END LIBTOOL TAG CONFIG: disable-static
-
-# Local Variables:
-# mode:shell-script
-# sh-indentation:2
-# End:
-# vi:sw=2
-
diff --git a/eglib/missing b/eglib/missing
deleted file mode 100755
index 1c8ff70..0000000
--- a/eglib/missing
+++ /dev/null
@@ -1,367 +0,0 @@
-#! /bin/sh
-# Common stub for a few missing GNU programs while installing.
-
-scriptversion=2006-05-10.23
-
-# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006
-#   Free Software Foundation, Inc.
-# Originally by Fran,cois Pinard <pinard at iro.umontreal.ca>, 1996.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
-
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-if test $# -eq 0; then
-  echo 1>&2 "Try \`$0 --help' for more information"
-  exit 1
-fi
-
-run=:
-sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
-sed_minuso='s/.* -o \([^ ]*\).*/\1/p'
-
-# In the cases where this matters, `missing' is being run in the
-# srcdir already.
-if test -f configure.ac; then
-  configure_ac=configure.ac
-else
-  configure_ac=configure.in
-fi
-
-msg="missing on your system"
-
-case $1 in
---run)
-  # Try to run requested program, and just exit if it succeeds.
-  run=
-  shift
-  "$@" && exit 0
-  # Exit code 63 means version mismatch.  This often happens
-  # when the user try to use an ancient version of a tool on
-  # a file that requires a minimum version.  In this case we
-  # we should proceed has if the program had been absent, or
-  # if --run hadn't been passed.
-  if test $? = 63; then
-    run=:
-    msg="probably too old"
-  fi
-  ;;
-
-  -h|--h|--he|--hel|--help)
-    echo "\
-$0 [OPTION]... PROGRAM [ARGUMENT]...
-
-Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
-error status if there is no known handling for PROGRAM.
-
-Options:
-  -h, --help      display this help and exit
-  -v, --version   output version information and exit
-  --run           try to run the given command, and emulate it if it fails
-
-Supported PROGRAM values:
-  aclocal      touch file \`aclocal.m4'
-  autoconf     touch file \`configure'
-  autoheader   touch file \`config.h.in'
-  autom4te     touch the output file, or create a stub one
-  automake     touch all \`Makefile.in' files
-  bison        create \`y.tab.[ch]', if possible, from existing .[ch]
-  flex         create \`lex.yy.c', if possible, from existing .c
-  help2man     touch the output file
-  lex          create \`lex.yy.c', if possible, from existing .c
-  makeinfo     touch the output file
-  tar          try tar, gnutar, gtar, then tar without non-portable flags
-  yacc         create \`y.tab.[ch]', if possible, from existing .[ch]
-
-Send bug reports to <bug-automake at gnu.org>."
-    exit $?
-    ;;
-
-  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
-    echo "missing $scriptversion (GNU Automake)"
-    exit $?
-    ;;
-
-  -*)
-    echo 1>&2 "$0: Unknown \`$1' option"
-    echo 1>&2 "Try \`$0 --help' for more information"
-    exit 1
-    ;;
-
-esac
-
-# Now exit if we have it, but it failed.  Also exit now if we
-# don't have it and --version was passed (most likely to detect
-# the program).
-case $1 in
-  lex|yacc)
-    # Not GNU programs, they don't have --version.
-    ;;
-
-  tar)
-    if test -n "$run"; then
-       echo 1>&2 "ERROR: \`tar' requires --run"
-       exit 1
-    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
-       exit 1
-    fi
-    ;;
-
-  *)
-    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
-       # We have it, but it failed.
-       exit 1
-    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
-       # Could not run --version or --help.  This is probably someone
-       # running `$TOOL --version' or `$TOOL --help' to check whether
-       # $TOOL exists and not knowing $TOOL uses missing.
-       exit 1
-    fi
-    ;;
-esac
-
-# If it does not exist, or fails to run (possibly an outdated version),
-# try to emulate it.
-case $1 in
-  aclocal*)
-    echo 1>&2 "\
-WARNING: \`$1' is $msg.  You should only need it if
-         you modified \`acinclude.m4' or \`${configure_ac}'.  You might want
-         to install the \`Automake' and \`Perl' packages.  Grab them from
-         any GNU archive site."
-    touch aclocal.m4
-    ;;
-
-  autoconf)
-    echo 1>&2 "\
-WARNING: \`$1' is $msg.  You should only need it if
-         you modified \`${configure_ac}'.  You might want to install the
-         \`Autoconf' and \`GNU m4' packages.  Grab them from any GNU
-         archive site."
-    touch configure
-    ;;
-
-  autoheader)
-    echo 1>&2 "\
-WARNING: \`$1' is $msg.  You should only need it if
-         you modified \`acconfig.h' or \`${configure_ac}'.  You might want
-         to install the \`Autoconf' and \`GNU m4' packages.  Grab them
-         from any GNU archive site."
-    files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
-    test -z "$files" && files="config.h"
-    touch_files=
-    for f in $files; do
-      case $f in
-      *:*) touch_files="$touch_files "`echo "$f" |
-				       sed -e 's/^[^:]*://' -e 's/:.*//'`;;
-      *) touch_files="$touch_files $f.in";;
-      esac
-    done
-    touch $touch_files
-    ;;
-
-  automake*)
-    echo 1>&2 "\
-WARNING: \`$1' is $msg.  You should only need it if
-         you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
-         You might want to install the \`Automake' and \`Perl' packages.
-         Grab them from any GNU archive site."
-    find . -type f -name Makefile.am -print |
-	   sed 's/\.am$/.in/' |
-	   while read f; do touch "$f"; done
-    ;;
-
-  autom4te)
-    echo 1>&2 "\
-WARNING: \`$1' is needed, but is $msg.
-         You might have modified some files without having the
-         proper tools for further handling them.
-         You can get \`$1' as part of \`Autoconf' from any GNU
-         archive site."
-
-    file=`echo "$*" | sed -n "$sed_output"`
-    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
-    if test -f "$file"; then
-	touch $file
-    else
-	test -z "$file" || exec >$file
-	echo "#! /bin/sh"
-	echo "# Created by GNU Automake missing as a replacement of"
-	echo "#  $ $@"
-	echo "exit 0"
-	chmod +x $file
-	exit 1
-    fi
-    ;;
-
-  bison|yacc)
-    echo 1>&2 "\
-WARNING: \`$1' $msg.  You should only need it if
-         you modified a \`.y' file.  You may need the \`Bison' package
-         in order for those modifications to take effect.  You can get
-         \`Bison' from any GNU archive site."
-    rm -f y.tab.c y.tab.h
-    if test $# -ne 1; then
-        eval LASTARG="\${$#}"
-	case $LASTARG in
-	*.y)
-	    SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
-	    if test -f "$SRCFILE"; then
-	         cp "$SRCFILE" y.tab.c
-	    fi
-	    SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
-	    if test -f "$SRCFILE"; then
-	         cp "$SRCFILE" y.tab.h
-	    fi
-	  ;;
-	esac
-    fi
-    if test ! -f y.tab.h; then
-	echo >y.tab.h
-    fi
-    if test ! -f y.tab.c; then
-	echo 'main() { return 0; }' >y.tab.c
-    fi
-    ;;
-
-  lex|flex)
-    echo 1>&2 "\
-WARNING: \`$1' is $msg.  You should only need it if
-         you modified a \`.l' file.  You may need the \`Flex' package
-         in order for those modifications to take effect.  You can get
-         \`Flex' from any GNU archive site."
-    rm -f lex.yy.c
-    if test $# -ne 1; then
-        eval LASTARG="\${$#}"
-	case $LASTARG in
-	*.l)
-	    SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
-	    if test -f "$SRCFILE"; then
-	         cp "$SRCFILE" lex.yy.c
-	    fi
-	  ;;
-	esac
-    fi
-    if test ! -f lex.yy.c; then
-	echo 'main() { return 0; }' >lex.yy.c
-    fi
-    ;;
-
-  help2man)
-    echo 1>&2 "\
-WARNING: \`$1' is $msg.  You should only need it if
-	 you modified a dependency of a manual page.  You may need the
-	 \`Help2man' package in order for those modifications to take
-	 effect.  You can get \`Help2man' from any GNU archive site."
-
-    file=`echo "$*" | sed -n "$sed_output"`
-    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
-    if test -f "$file"; then
-	touch $file
-    else
-	test -z "$file" || exec >$file
-	echo ".ab help2man is required to generate this page"
-	exit 1
-    fi
-    ;;
-
-  makeinfo)
-    echo 1>&2 "\
-WARNING: \`$1' is $msg.  You should only need it if
-         you modified a \`.texi' or \`.texinfo' file, or any other file
-         indirectly affecting the aspect of the manual.  The spurious
-         call might also be the consequence of using a buggy \`make' (AIX,
-         DU, IRIX).  You might want to install the \`Texinfo' package or
-         the \`GNU make' package.  Grab either from any GNU archive site."
-    # The file to touch is that specified with -o ...
-    file=`echo "$*" | sed -n "$sed_output"`
-    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
-    if test -z "$file"; then
-      # ... or it is the one specified with @setfilename ...
-      infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
-      file=`sed -n '
-	/^@setfilename/{
-	  s/.* \([^ ]*\) *$/\1/
-	  p
-	  q
-	}' $infile`
-      # ... or it is derived from the source name (dir/f.texi becomes f.info)
-      test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
-    fi
-    # If the file does not exist, the user really needs makeinfo;
-    # let's fail without touching anything.
-    test -f $file || exit 1
-    touch $file
-    ;;
-
-  tar)
-    shift
-
-    # We have already tried tar in the generic part.
-    # Look for gnutar/gtar before invocation to avoid ugly error
-    # messages.
-    if (gnutar --version > /dev/null 2>&1); then
-       gnutar "$@" && exit 0
-    fi
-    if (gtar --version > /dev/null 2>&1); then
-       gtar "$@" && exit 0
-    fi
-    firstarg="$1"
-    if shift; then
-	case $firstarg in
-	*o*)
-	    firstarg=`echo "$firstarg" | sed s/o//`
-	    tar "$firstarg" "$@" && exit 0
-	    ;;
-	esac
-	case $firstarg in
-	*h*)
-	    firstarg=`echo "$firstarg" | sed s/h//`
-	    tar "$firstarg" "$@" && exit 0
-	    ;;
-	esac
-    fi
-
-    echo 1>&2 "\
-WARNING: I can't seem to be able to run \`tar' with the given arguments.
-         You may want to install GNU tar or Free paxutils, or check the
-         command line arguments."
-    exit 1
-    ;;
-
-  *)
-    echo 1>&2 "\
-WARNING: \`$1' is needed, and is $msg.
-         You might have modified some files without having the
-         proper tools for further handling them.  Check the \`README' file,
-         it often tells you about the needed prerequisites for installing
-         this package.  You may also peek at any GNU archive site, in case
-         some other package would contain this missing \`$1' program."
-    exit 1
-    ;;
-esac
-
-exit 0
-
-# Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "scriptversion="
-# time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-end: "$"
-# End:
diff --git a/eglib/src/Makefile.in b/eglib/src/Makefile.in
index c6d8122..3171c9d 100644
--- a/eglib/src/Makefile.in
+++ b/eglib/src/Makefile.in
@@ -43,7 +43,7 @@ am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
 	$(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
-mkinstalldirs = $(install_sh) -d
+mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs
 CONFIG_HEADER = $(top_builddir)/config.h
 CONFIG_CLEAN_FILES = eglib-config.h
 CONFIG_CLEAN_VPATH_FILES =
@@ -129,7 +129,7 @@ libeglib_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
 	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(libeglib_la_CFLAGS) \
 	$(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
 DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
-depcomp = $(SHELL) $(top_srcdir)/depcomp
+depcomp = $(SHELL) $(top_srcdir)/../depcomp
 am__depfiles_maybe = depfiles
 am__mv = mv -f
 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
diff --git a/eglib/src/goutput.c b/eglib/src/goutput.c
index 755aaa9..642a97e 100644
--- a/eglib/src/goutput.c
+++ b/eglib/src/goutput.c
@@ -112,28 +112,26 @@ g_log_set_fatal_mask (const gchar *log_domain, GLogLevelFlags fatal_mask)
 void
 g_logv (const gchar *log_domain, GLogLevelFlags log_level, const gchar *format, va_list args)
 {
+#if PLATFORM_ANDROID
+	__android_log_vprint (to_android_priority (log_level), log_domain, format, args);
+#else
 	char *msg;
 	
 	vasprintf (&msg, format, args);
-#if PLATFORM_ANDROID
-	__android_log_print (to_android_priority (log_level), 
-		/* TODO: provide a proper app name */
-		"mono", "%s%s%s",
-		log_domain != NULL ? log_domain : "",
-		log_domain != NULL ? ": " : "",
-		msg);
-#else
 	printf ("%s%s%s\n",
 		log_domain != NULL ? log_domain : "",
 		log_domain != NULL ? ": " : "",
 		msg);
-#endif
 	free (msg);
 	if (log_level & fatal){
 		fflush (stdout);
 		fflush (stderr);
 		abort ();
 	}
+#endif
+	if (log_level & fatal){
+		abort ();
+	}
 }
 
 void
diff --git a/eglib/test/Makefile.in b/eglib/test/Makefile.in
index cd839a0..25c65bb 100644
--- a/eglib/test/Makefile.in
+++ b/eglib/test/Makefile.in
@@ -45,7 +45,7 @@ am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
 	$(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
-mkinstalldirs = $(install_sh) -d
+mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs
 CONFIG_HEADER = $(top_builddir)/config.h
 CONFIG_CLEAN_FILES =
 CONFIG_CLEAN_VPATH_FILES =
@@ -94,7 +94,7 @@ test_glib_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
 	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(test_glib_CFLAGS) \
 	$(CFLAGS) $(test_glib_LDFLAGS) $(LDFLAGS) -o $@
 DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
-depcomp = $(SHELL) $(top_srcdir)/depcomp
+depcomp = $(SHELL) $(top_srcdir)/../depcomp
 am__depfiles_maybe = depfiles
 am__mv = mv -f
 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
diff --git a/ikvm-native/Makefile.in b/ikvm-native/Makefile.in
index 9706918..5d9a8ec 100644
--- a/ikvm-native/Makefile.in
+++ b/ikvm-native/Makefile.in
@@ -307,9 +307,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign ikvm-native/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu ikvm-native/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign ikvm-native/Makefile
+	  $(AUTOMAKE) --gnu ikvm-native/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
diff --git a/install-sh b/install-sh
index 4fbbae7..6781b98 100755
--- a/install-sh
+++ b/install-sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 # install - install a program, script, or datafile
 
-scriptversion=2006-10-14.15
+scriptversion=2009-04-28.21; # UTC
 
 # This originates from X11R5 (mit/util/scripts/install.sh), which was
 # later released in X11R6 (xc/config/util/install.sh) with the
@@ -48,7 +48,7 @@ IFS=" ""	$nl"
 # set DOITPROG to echo to test this script
 
 # Don't use :- since 4.3BSD and earlier shells don't like it.
-doit="${DOITPROG-}"
+doit=${DOITPROG-}
 if test -z "$doit"; then
   doit_exec=exec
 else
@@ -58,34 +58,49 @@ fi
 # Put in absolute file names if you don't have them in your path;
 # or use environment vars.
 
-mvprog="${MVPROG-mv}"
-cpprog="${CPPROG-cp}"
-chmodprog="${CHMODPROG-chmod}"
-chownprog="${CHOWNPROG-chown}"
-chgrpprog="${CHGRPPROG-chgrp}"
-stripprog="${STRIPPROG-strip}"
-rmprog="${RMPROG-rm}"
-mkdirprog="${MKDIRPROG-mkdir}"
+chgrpprog=${CHGRPPROG-chgrp}
+chmodprog=${CHMODPROG-chmod}
+chownprog=${CHOWNPROG-chown}
+cmpprog=${CMPPROG-cmp}
+cpprog=${CPPROG-cp}
+mkdirprog=${MKDIRPROG-mkdir}
+mvprog=${MVPROG-mv}
+rmprog=${RMPROG-rm}
+stripprog=${STRIPPROG-strip}
+
+posix_glob='?'
+initialize_posix_glob='
+  test "$posix_glob" != "?" || {
+    if (set -f) 2>/dev/null; then
+      posix_glob=
+    else
+      posix_glob=:
+    fi
+  }
+'
 
-posix_glob=
 posix_mkdir=
 
 # Desired mode of installed file.
 mode=0755
 
+chgrpcmd=
 chmodcmd=$chmodprog
 chowncmd=
-chgrpcmd=
-stripcmd=
+mvcmd=$mvprog
 rmcmd="$rmprog -f"
-mvcmd="$mvprog"
+stripcmd=
+
 src=
 dst=
 dir_arg=
-dstarg=
+dst_arg=
+
+copy_on_change=false
 no_target_directory=
 
-usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
+usage="\
+Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
    or: $0 [OPTION]... SRCFILES... DIRECTORY
    or: $0 [OPTION]... -t DIRECTORY SRCFILES...
    or: $0 [OPTION]... -d DIRECTORIES...
@@ -95,65 +110,55 @@ In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
 In the 4th, create DIRECTORIES.
 
 Options:
--c         (ignored)
--d         create directories instead of installing files.
--g GROUP   $chgrpprog installed files to GROUP.
--m MODE    $chmodprog installed files to MODE.
--o USER    $chownprog installed files to USER.
--s         $stripprog installed files.
--t DIRECTORY  install into DIRECTORY.
--T         report an error if DSTFILE is a directory.
---help     display this help and exit.
---version  display version info and exit.
+     --help     display this help and exit.
+     --version  display version info and exit.
+
+  -c            (ignored)
+  -C            install only if different (preserve the last data modification time)
+  -d            create directories instead of installing files.
+  -g GROUP      $chgrpprog installed files to GROUP.
+  -m MODE       $chmodprog installed files to MODE.
+  -o USER       $chownprog installed files to USER.
+  -s            $stripprog installed files.
+  -t DIRECTORY  install into DIRECTORY.
+  -T            report an error if DSTFILE is a directory.
 
 Environment variables override the default commands:
-  CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
+  CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
+  RMPROG STRIPPROG
 "
 
 while test $# -ne 0; do
   case $1 in
-    -c) shift
-        continue;;
+    -c) ;;
+
+    -C) copy_on_change=true;;
 
-    -d) dir_arg=true
-        shift
-        continue;;
+    -d) dir_arg=true;;
 
     -g) chgrpcmd="$chgrpprog $2"
-        shift
-        shift
-        continue;;
+	shift;;
 
     --help) echo "$usage"; exit $?;;
 
     -m) mode=$2
-        shift
-        shift
 	case $mode in
 	  *' '* | *'	'* | *'
 '*	  | *'*'* | *'?'* | *'['*)
 	    echo "$0: invalid mode: $mode" >&2
 	    exit 1;;
 	esac
-        continue;;
+	shift;;
 
     -o) chowncmd="$chownprog $2"
-        shift
-        shift
-        continue;;
+	shift;;
 
-    -s) stripcmd=$stripprog
-        shift
-        continue;;
+    -s) stripcmd=$stripprog;;
 
-    -t) dstarg=$2
-	shift
-	shift
-	continue;;
+    -t) dst_arg=$2
+	shift;;
 
-    -T) no_target_directory=true
-	shift
-	continue;;
+    -T) no_target_directory=true;;
 
     --version) echo "$0 $scriptversion"; exit $?;;
 
@@ -165,21 +170,22 @@ while test $# -ne 0; do
 
     *)  break;;
   esac
+  shift
 done
 
-if test $# -ne 0 && test -z "$dir_arg$dstarg"; then
+if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
   # When -d is used, all remaining arguments are directories to create.
   # When -t is used, the destination is already specified.
   # Otherwise, the last argument is the destination.  Remove it from $@.
   for arg
   do
-    if test -n "$dstarg"; then
+    if test -n "$dst_arg"; then
       # $@ is not empty: it contains at least $arg.
-      set fnord "$@" "$dstarg"
+      set fnord "$@" "$dst_arg"
       shift # fnord
     fi
     shift # arg
-    dstarg=$arg
+    dst_arg=$arg
   done
 fi
 
@@ -224,7 +230,7 @@ for src
 do
   # Protect names starting with `-'.
   case $src in
-    -*) src=./$src ;;
+    -*) src=./$src;;
   esac
 
   if test -n "$dir_arg"; then
@@ -242,22 +248,22 @@ do
       exit 1
     fi
 
-    if test -z "$dstarg"; then
+    if test -z "$dst_arg"; then
       echo "$0: no destination specified." >&2
       exit 1
     fi
 
-    dst=$dstarg
+    dst=$dst_arg
     # Protect names starting with `-'.
     case $dst in
-      -*) dst=./$dst ;;
+      -*) dst=./$dst;;
     esac
 
     # If destination is a directory, append the input filename; won't work
     # if double slashes aren't ignored.
     if test -d "$dst"; then
       if test -n "$no_target_directory"; then
-	echo "$0: $dstarg: Is a directory" >&2
+	echo "$0: $dst_arg: Is a directory" >&2
 	exit 1
       fi
       dstdir=$dst
@@ -378,26 +384,19 @@ do
       # directory the slow way, step by step, checking for races as we go.
 
       case $dstdir in
-	/*) prefix=/ ;;
-	-*) prefix=./ ;;
-	*)  prefix= ;;
+	/*) prefix='/';;
+	-*) prefix='./';;
+	*)  prefix='';;
       esac
 
-      case $posix_glob in
-        '')
-	  if (set -f) 2>/dev/null; then
-	    posix_glob=true
-	  else
-	    posix_glob=false
-	  fi ;;
-      esac
+      eval "$initialize_posix_glob"
 
       oIFS=$IFS
       IFS=/
-      $posix_glob && set -f
+      $posix_glob set -f
       set fnord $dstdir
       shift
-      $posix_glob && set +f
+      $posix_glob set +f
       IFS=$oIFS
 
       prefixes=
@@ -459,41 +458,54 @@ do
     # ignore errors from any of these, just make sure not to ignore
     # errors from the above "$doit $cpprog $src $dsttmp" command.
     #
-    { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
-      && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
-      && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
-      && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
-
-    # Now rename the file to the real destination.
-    { $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null \
-      || {
-	   # The rename failed, perhaps because mv can't rename something else
-	   # to itself, or perhaps because mv is so ancient that it does not
-	   # support -f.
-
-	   # Now remove or move aside any old file at destination location.
-	   # We try this two ways since rm can't unlink itself on some
-	   # systems and the destination file might be busy for other
-	   # reasons.  In this case, the final cleanup might fail but the new
-	   # file should still install successfully.
-	   {
-	     if test -f "$dst"; then
-	       $doit $rmcmd -f "$dst" 2>/dev/null \
-	       || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null \
-		     && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }; }\
-	       || {
-		 echo "$0: cannot unlink or rename $dst" >&2
-		 (exit 1); exit 1
-	       }
-	     else
-	       :
-	     fi
-	   } &&
-
-	   # Now rename the file to the real destination.
-	   $doit $mvcmd "$dsttmp" "$dst"
-	 }
-    } || exit 1
+    { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
+    { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
+    { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
+    { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
+
+    # If -C, don't bother to copy if it wouldn't change the file.
+    if $copy_on_change &&
+       old=`LC_ALL=C ls -dlL "$dst"	2>/dev/null` &&
+       new=`LC_ALL=C ls -dlL "$dsttmp"	2>/dev/null` &&
+
+       eval "$initialize_posix_glob" &&
+       $posix_glob set -f &&
+       set X $old && old=:$2:$4:$5:$6 &&
+       set X $new && new=:$2:$4:$5:$6 &&
+       $posix_glob set +f &&
+
+       test "$old" = "$new" &&
+       $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
+    then
+      rm -f "$dsttmp"
+    else
+      # Rename the file to the real destination.
+      $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
+
+      # The rename failed, perhaps because mv can't rename something else
+      # to itself, or perhaps because mv is so ancient that it does not
+      # support -f.
+      {
+	# Now remove or move aside any old file at destination location.
+	# We try this two ways since rm can't unlink itself on some
+	# systems and the destination file might be busy for other
+	# reasons.  In this case, the final cleanup might fail but the new
+	# file should still install successfully.
+	{
+	  test ! -f "$dst" ||
+	  $doit $rmcmd -f "$dst" 2>/dev/null ||
+	  { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
+	    { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
+	  } ||
+	  { echo "$0: cannot unlink or rename $dst" >&2
+	    (exit 1); exit 1
+	  }
+	} &&
+
+	# Now rename the file to the real destination.
+	$doit $mvcmd "$dsttmp" "$dst"
+      }
+    fi || exit 1
 
     trap '' 0
   fi
@@ -503,5 +515,6 @@ done
 # eval: (add-hook 'write-file-hooks 'time-stamp)
 # time-stamp-start: "scriptversion="
 # time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-end: "$"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
 # End:
diff --git a/libgc/ChangeLog b/libgc/ChangeLog
index de9b317..af75452 100644
--- a/libgc/ChangeLog
+++ b/libgc/ChangeLog
@@ -1,3 +1,7 @@
+2011-04-19  Rodrigo Kumpera  <kumpera at gmail.com>
+
+	publish the same events as pthread_stop_world
+
 2011-08-02  Geoff Norton  <grompf at gmail.com>
 
 	[gc] Darwin/AMD64 can have 64-bit thread id's, so we need to
diff --git a/libgc/config.guess b/libgc/config.guess
index 396482d..666c5ad 100755
--- a/libgc/config.guess
+++ b/libgc/config.guess
@@ -1,10 +1,10 @@
 #! /bin/sh
 # Attempt to guess a canonical system name.
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-#   2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
-#   Inc.
+#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+#   Free Software Foundation, Inc.
 
-timestamp='2006-07-02'
+timestamp='2009-11-20'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -27,16 +27,16 @@ timestamp='2006-07-02'
 # the same distribution terms that you use for the rest of that program.
 
 
-# Originally written by Per Bothner <per at bothner.com>.
-# Please send patches to <config-patches at gnu.org>.  Submit a context
-# diff and a properly formatted ChangeLog entry.
+# Originally written by Per Bothner.  Please send patches (context
+# diff format) to <config-patches at gnu.org> and include a ChangeLog
+# entry.
 #
 # This script attempts to guess a canonical system name similar to
 # config.sub.  If it succeeds, it prints the system name on stdout, and
 # exits with 0.  Otherwise, it exits with 1.
 #
-# The plan is that this can be called by configure scripts if you
-# don't specify an explicit build system type.
+# You can get the latest version of this script from:
+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
 
 me=`echo "$0" | sed -e 's,.*/,,'`
 
@@ -56,8 +56,8 @@ version="\
 GNU config.guess ($timestamp)
 
 Originally written by Per Bothner.
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
-Free Software Foundation, Inc.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
+2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -139,6 +139,16 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
 UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
 UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
 
+case "${UNAME_MACHINE}" in
+    i?86)
+	test -z "$VENDOR" && VENDOR=pc
+	;;
+    *)
+	test -z "$VENDOR" && VENDOR=unknown
+	;;
+esac
+test -f /etc/SuSE-release -o -f /.buildenv && VENDOR=suse
+
 # Note: order is significant - the case branches are not exclusive.
 
 case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
@@ -161,6 +171,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 	    arm*) machine=arm-unknown ;;
 	    sh3el) machine=shl-unknown ;;
 	    sh3eb) machine=sh-unknown ;;
+	    sh5el) machine=sh5le-unknown ;;
 	    *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
 	esac
 	# The Operating System including object format, if it has switched
@@ -169,7 +180,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
 		eval $set_cc_for_build
 		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
-			| grep __ELF__ >/dev/null
+			| grep -q __ELF__
 		then
 		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
 		    # Return netbsd for either.  FIX?
@@ -202,19 +213,19 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 	exit ;;
     *:OpenBSD:*:*)
 	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
-	echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
+	echo ${UNAME_MACHINE_ARCH}-${VENDOR}-openbsd${UNAME_RELEASE}
 	exit ;;
     *:ekkoBSD:*:*)
-	echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
+	echo ${UNAME_MACHINE}-${VENDOR}-ekkobsd${UNAME_RELEASE}
 	exit ;;
     *:SolidBSD:*:*)
-	echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
+	echo ${UNAME_MACHINE}-${VENDOR}-solidbsd${UNAME_RELEASE}
 	exit ;;
     macppc:MirBSD:*:*)
-	echo powerpc-unknown-mirbsd${UNAME_RELEASE}
+	echo powerpc-${VENDOR}-mirbsd${UNAME_RELEASE}
 	exit ;;
     *:MirBSD:*:*)
-	echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
+	echo ${UNAME_MACHINE}-${VENDOR}-mirbsd${UNAME_RELEASE}
 	exit ;;
     alpha:OSF1:*:*)
 	case $UNAME_RELEASE in
@@ -279,13 +290,13 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 	echo alpha-dec-winnt3.5
 	exit ;;
     Amiga*:UNIX_System_V:4.0:*)
-	echo m68k-unknown-sysv4
+	echo m68k-${VENDOR}-sysv4
 	exit ;;
     *:[Aa]miga[Oo][Ss]:*:*)
-	echo ${UNAME_MACHINE}-unknown-amigaos
+	echo ${UNAME_MACHINE}-${VENDOR}-amigaos
 	exit ;;
     *:[Mm]orph[Oo][Ss]:*:*)
-	echo ${UNAME_MACHINE}-unknown-morphos
+	echo ${UNAME_MACHINE}-${VENDOR}-morphos
 	exit ;;
     *:OS/390:*:*)
 	echo i370-ibm-openedition
@@ -300,7 +311,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 	echo arm-acorn-riscix${UNAME_RELEASE}
 	exit ;;
     arm:riscos:*:*|arm:RISCOS:*:*)
-	echo arm-unknown-riscos
+	echo arm-${VENDOR}-riscos
 	exit ;;
     SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
 	echo hppa1.1-hitachi-hiuxmpp
@@ -323,14 +334,33 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 	case `/usr/bin/uname -p` in
 	    sparc) echo sparc-icl-nx7; exit ;;
 	esac ;;
+    s390x:SunOS:*:*)
+	echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
     sun4H:SunOS:5.*:*)
 	echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
 	exit ;;
     sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
 	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
 	exit ;;
-    i86pc:SunOS:5.*:*)
-	echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+    i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
+	echo i386-pc-auroraux${UNAME_RELEASE}
+	exit ;;
+    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
+	eval $set_cc_for_build
+	SUN_ARCH="i386"
+	# If there is a compiler, see if it is configured for 64-bit objects.
+	# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
+	# This test works for both compilers.
+	if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+	    if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
+		(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+		grep IS_64BIT_ARCH >/dev/null
+	    then
+		SUN_ARCH="x86_64"
+	    fi
+	fi
+	echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
 	exit ;;
     sun4*:SunOS:6*:*)
 	# According to config.sub, this is the proper way to canonicalize
@@ -389,7 +419,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
         echo m68k-hades-mint${UNAME_RELEASE}
         exit ;;
     *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
-        echo m68k-unknown-mint${UNAME_RELEASE}
+        echo m68k-${VENDOR}-mint${UNAME_RELEASE}
         exit ;;
     m68k:machten:*:*)
 	echo m68k-apple-machten${UNAME_RELEASE}
@@ -531,7 +561,7 @@ EOF
 		echo rs6000-ibm-aix3.2
 	fi
 	exit ;;
-    *:AIX:*:[45])
+    *:AIX:*:[456])
 	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
 	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
 		IBM_ARCH=rs6000
@@ -639,7 +669,7 @@ EOF
 	    # => hppa64-hp-hpux11.23
 
 	    if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
-		grep __LP64__ >/dev/null
+		grep -q __LP64__
 	    then
 		HP_ARCH="hppa2.0w"
 	    else
@@ -700,9 +730,9 @@ EOF
 	exit ;;
     i*86:OSF1:*:*)
 	if [ -x /usr/sbin/sysversion ] ; then
-	    echo ${UNAME_MACHINE}-unknown-osf1mk
+	    echo ${UNAME_MACHINE}-${VENDOR}-osf1mk
 	else
-	    echo ${UNAME_MACHINE}-unknown-osf1
+	    echo ${UNAME_MACHINE}-${VENDOR}-osf1
 	fi
 	exit ;;
     parisc*:Lites*:*:*)
@@ -762,25 +792,25 @@ EOF
 	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
 	exit ;;
     sparc*:BSD/OS:*:*)
-	echo sparc-unknown-bsdi${UNAME_RELEASE}
+	echo sparc-${VENDOR}-bsdi${UNAME_RELEASE}
 	exit ;;
     *:BSD/OS:*:*)
-	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+	echo ${UNAME_MACHINE}-${VENDOR}-bsdi${UNAME_RELEASE}
 	exit ;;
     *:FreeBSD:*:*)
 	case ${UNAME_MACHINE} in
 	    pc98)
-		echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+		echo i386-${VENDOR}-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
 	    amd64)
-		echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+		echo x86_64-${VENDOR}-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
 	    *)
-		echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+		echo ${UNAME_MACHINE}-${VENDOR}-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
 	esac
 	exit ;;
     i*:CYGWIN*:*)
 	echo ${UNAME_MACHINE}-pc-cygwin
 	exit ;;
-    i*:MINGW*:*)
+    *:MINGW*:*)
 	echo ${UNAME_MACHINE}-pc-mingw32
 	exit ;;
     i*:windows32*:*)
@@ -790,15 +820,24 @@ EOF
     i*:PW*:*)
 	echo ${UNAME_MACHINE}-pc-pw32
 	exit ;;
-    x86:Interix*:[3456]*)
-	echo i586-pc-interix${UNAME_RELEASE}
-	exit ;;
-    EM64T:Interix*:[3456]*)
-	echo x86_64-unknown-interix${UNAME_RELEASE}
-	exit ;;
+    *:Interix*:*)
+    	case ${UNAME_MACHINE} in
+	    x86)
+		echo i586-pc-interix${UNAME_RELEASE}
+		exit ;;
+	    authenticamd | genuineintel | EM64T)
+		echo x86_64-${VENDOR}-interix${UNAME_RELEASE}
+		exit ;;
+	    IA64)
+		echo ia64-${VENDOR}-interix${UNAME_RELEASE}
+		exit ;;
+	esac ;;
     [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
 	echo i${UNAME_MACHINE}-pc-mks
 	exit ;;
+    8664:Windows_NT:*)
+	echo x86_64-pc-mks
+	exit ;;
     i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
 	# How do we know it's Interix rather than the generic POSIX subsystem?
 	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
@@ -809,30 +848,51 @@ EOF
 	echo ${UNAME_MACHINE}-pc-uwin
 	exit ;;
     amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
-	echo x86_64-unknown-cygwin
+	echo x86_64-${VENDOR}-cygwin
 	exit ;;
     p*:CYGWIN*:*)
-	echo powerpcle-unknown-cygwin
+	echo powerpcle-${VENDOR}-cygwin
 	exit ;;
     prep*:SunOS:5.*:*)
-	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	echo powerpcle-${VENDOR}-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
 	exit ;;
     *:GNU:*:*)
 	# the GNU system
-	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-${VENDOR}-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
 	exit ;;
     *:GNU/*:*:*)
 	# other systems with GNU libc and userland
-	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
+	echo ${UNAME_MACHINE}-${VENDOR}-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
 	exit ;;
     i*86:Minix:*:*)
 	echo ${UNAME_MACHINE}-pc-minix
 	exit ;;
+    alpha:Linux:*:*)
+	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+	  EV5)   UNAME_MACHINE=alphaev5 ;;
+	  EV56)  UNAME_MACHINE=alphaev56 ;;
+	  PCA56) UNAME_MACHINE=alphapca56 ;;
+	  PCA57) UNAME_MACHINE=alphapca56 ;;
+	  EV6)   UNAME_MACHINE=alphaev6 ;;
+	  EV67)  UNAME_MACHINE=alphaev67 ;;
+	  EV68*) UNAME_MACHINE=alphaev68 ;;
+        esac
+	objdump --private-headers /bin/sh | grep -q ld.so.1
+	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
+	echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu${LIBC}
+	exit ;;
     arm*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	eval $set_cc_for_build
+	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
+	    | grep -q __ARM_EABI__
+	then
+	    echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu
+	else
+	    echo ${UNAME_MACHINE}-${VENDOR}-linux-gnueabi
+	fi
 	exit ;;
     avr32*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu
 	exit ;;
     cris:Linux:*:*)
 	echo cris-axis-linux-gnu
@@ -841,178 +901,91 @@ EOF
 	echo crisv32-axis-linux-gnu
 	exit ;;
     frv:Linux:*:*)
-    	echo frv-unknown-linux-gnu
+    	echo frv-${VENDOR}-linux-gnu
+	exit ;;
+    i*86:Linux:*:*)
+	LIBC=gnu
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#ifdef __dietlibc__
+	LIBC=dietlibc
+	#endif
+EOF
+	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
+	echo "${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}"
 	exit ;;
     ia64:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu
 	exit ;;
     m32r*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu
 	exit ;;
     m68*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu
 	exit ;;
-    mips:Linux:*:*)
-	eval $set_cc_for_build
-	sed 's/^	//' << EOF >$dummy.c
-	#undef CPU
-	#undef mips
-	#undef mipsel
-	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
-	CPU=mipsel
-	#else
-	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
-	CPU=mips
-	#else
-	CPU=
-	#endif
-	#endif
-EOF
-	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
-	    /^CPU/{
-		s: ::g
-		p
-	    }'`"
-	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
-	;;
-    mips64:Linux:*:*)
+    mips:Linux:*:* | mips64:Linux:*:*)
 	eval $set_cc_for_build
 	sed 's/^	//' << EOF >$dummy.c
 	#undef CPU
-	#undef mips64
-	#undef mips64el
+	#undef ${UNAME_MACHINE}
+	#undef ${UNAME_MACHINE}el
 	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
-	CPU=mips64el
+	CPU=${UNAME_MACHINE}el
 	#else
 	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
-	CPU=mips64
+	CPU=${UNAME_MACHINE}
 	#else
 	CPU=
 	#endif
 	#endif
 EOF
-	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
-	    /^CPU/{
-		s: ::g
-		p
-	    }'`"
-	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
+	test x"${CPU}" != x && { echo "${CPU}-${VENDOR}-linux-gnu"; exit; }
 	;;
     or32:Linux:*:*)
-	echo or32-unknown-linux-gnu
+	echo or32-${VENDOR}-linux-gnu
 	exit ;;
-    ppc:Linux:*:*)
-	echo powerpc-unknown-linux-gnu
+    padre:Linux:*:*)
+	echo sparc-${VENDOR}-linux-gnu
 	exit ;;
-    ppc64:Linux:*:*)
-	echo powerpc64-unknown-linux-gnu
-	exit ;;
-    alpha:Linux:*:*)
-	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
-	  EV5)   UNAME_MACHINE=alphaev5 ;;
-	  EV56)  UNAME_MACHINE=alphaev56 ;;
-	  PCA56) UNAME_MACHINE=alphapca56 ;;
-	  PCA57) UNAME_MACHINE=alphapca56 ;;
-	  EV6)   UNAME_MACHINE=alphaev6 ;;
-	  EV67)  UNAME_MACHINE=alphaev67 ;;
-	  EV68*) UNAME_MACHINE=alphaev68 ;;
-        esac
-	objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
-	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
-	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+    parisc64:Linux:*:* | hppa64:Linux:*:*)
+	echo hppa64-${VENDOR}-linux-gnu
 	exit ;;
     parisc:Linux:*:* | hppa:Linux:*:*)
 	# Look for CPU level
 	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
-	  PA7*) echo hppa1.1-unknown-linux-gnu ;;
-	  PA8*) echo hppa2.0-unknown-linux-gnu ;;
-	  *)    echo hppa-unknown-linux-gnu ;;
+	  PA7*) echo hppa1.1-${VENDOR}-linux-gnu ;;
+	  PA8*) echo hppa2.0-${VENDOR}-linux-gnu ;;
+	  *)    echo hppa-${VENDOR}-linux-gnu ;;
 	esac
 	exit ;;
-    parisc64:Linux:*:* | hppa64:Linux:*:*)
-	echo hppa64-unknown-linux-gnu
+    ppc64:Linux:*:*)
+	echo powerpc64-${VENDOR}-linux-gnu
+	exit ;;
+    ppc:Linux:*:*)
+	echo powerpc-${VENDOR}-linux-gnu
 	exit ;;
     s390:Linux:*:* | s390x:Linux:*:*)
 	echo ${UNAME_MACHINE}-ibm-linux
 	exit ;;
     sh64*:Linux:*:*)
-    	echo ${UNAME_MACHINE}-unknown-linux-gnu
+    	echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu
 	exit ;;
     sh*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu
 	exit ;;
     sparc:Linux:*:* | sparc64:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu
 	exit ;;
     vax:Linux:*:*)
 	echo ${UNAME_MACHINE}-dec-linux-gnu
 	exit ;;
     x86_64:Linux:*:*)
-	echo x86_64-unknown-linux-gnu
+	echo x86_64-${VENDOR}-linux-gnu
+	exit ;;
+    xtensa*:Linux:*:*)
+    	echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu
 	exit ;;
-    i*86:Linux:*:*)
-	# The BFD linker knows what the default object file format is, so
-	# first see if it will tell us. cd to the root directory to prevent
-	# problems with other programs or directories called `ld' in the path.
-	# Set LC_ALL=C to ensure ld outputs messages in English.
-	ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
-			 | sed -ne '/supported targets:/!d
-				    s/[ 	][ 	]*/ /g
-				    s/.*supported targets: *//
-				    s/ .*//
-				    p'`
-        case "$ld_supported_targets" in
-	  elf32-i386)
-		TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
-		;;
-	  a.out-i386-linux)
-		echo "${UNAME_MACHINE}-pc-linux-gnuaout"
-		exit ;;
-	  coff-i386)
-		echo "${UNAME_MACHINE}-pc-linux-gnucoff"
-		exit ;;
-	  "")
-		# Either a pre-BFD a.out linker (linux-gnuoldld) or
-		# one that does not give us useful --help.
-		echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
-		exit ;;
-	esac
-	# Determine whether the default compiler is a.out or elf
-	eval $set_cc_for_build
-	sed 's/^	//' << EOF >$dummy.c
-	#include <features.h>
-	#ifdef __ELF__
-	# ifdef __GLIBC__
-	#  if __GLIBC__ >= 2
-	LIBC=gnu
-	#  else
-	LIBC=gnulibc1
-	#  endif
-	# else
-	LIBC=gnulibc1
-	# endif
-	#else
-	#if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
-	LIBC=gnu
-	#else
-	LIBC=gnuaout
-	#endif
-	#endif
-	#ifdef __dietlibc__
-	LIBC=dietlibc
-	#endif
-EOF
-	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
-	    /^LIBC/{
-		s: ::g
-		p
-	    }'`"
-	test x"${LIBC}" != x && {
-		echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
-		exit
-	}
-	test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
-	;;
     i*86:DYNIX/ptx:4*:*)
 	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
 	# earlier versions are messed up and put the nodename in both
@@ -1033,16 +1006,16 @@ EOF
 	echo ${UNAME_MACHINE}-pc-os2-emx
 	exit ;;
     i*86:XTS-300:*:STOP)
-	echo ${UNAME_MACHINE}-unknown-stop
+	echo ${UNAME_MACHINE}-${VENDOR}-stop
 	exit ;;
     i*86:atheos:*:*)
-	echo ${UNAME_MACHINE}-unknown-atheos
+	echo ${UNAME_MACHINE}-${VENDOR}-atheos
 	exit ;;
     i*86:syllable:*:*)
 	echo ${UNAME_MACHINE}-pc-syllable
 	exit ;;
-    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
-	echo i386-unknown-lynxos${UNAME_RELEASE}
+    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
+	echo i386-${VENDOR}-lynxos${UNAME_RELEASE}
 	exit ;;
     i*86:*DOS:*:*)
 	echo ${UNAME_MACHINE}-pc-msdosdjgpp
@@ -1062,7 +1035,7 @@ EOF
 	    *Pentium)	     UNAME_MACHINE=i586 ;;
 	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
 	esac
-	echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
+	echo ${UNAME_MACHINE}-${VENDOR}-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
 	exit ;;
     i*86:*:3.2:*)
 	if test -f /usr/options/cb.name; then
@@ -1085,8 +1058,11 @@ EOF
     pc:*:*:*)
 	# Left here for compatibility:
         # uname -m prints for DJGPP always 'pc', but it prints nothing about
-        # the processor, so we play safe by assuming i386.
-	echo i386-pc-msdosdjgpp
+        # the processor, so we play safe by assuming i586.
+	# Note: whatever this is, it MUST be the same as what config.sub
+	# prints for the "djgpp" host, or else GDB configury will decide that
+	# this is a cross-build.
+	echo i586-pc-msdosdjgpp
         exit ;;
     Intel:Mach:3*:*)
 	echo i386-pc-mach3
@@ -1098,7 +1074,7 @@ EOF
 	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
 	  echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
 	else # Add other i860-SVR4 vendors below as they are discovered.
-	  echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
+	  echo i860-${VENDOR}-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
 	fi
 	exit ;;
     mini*:CTIX:SYS*5:*)
@@ -1124,20 +1100,30 @@ EOF
     3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
         /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
           && { echo i486-ncr-sysv4; exit; } ;;
+    NCR*:*:4.2:* | MPRAS*:*:4.2:*)
+	OS_REL='.3'
+	test -r /etc/.relid \
+	    && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+	    && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
+	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+	    && { echo i586-ncr-sysv4.3${OS_REL}; exit; }
+	/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
+	    && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
     m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
-	echo m68k-unknown-lynxos${UNAME_RELEASE}
+	echo m68k-${VENDOR}-lynxos${UNAME_RELEASE}
 	exit ;;
     mc68030:UNIX_System_V:4.*:*)
 	echo m68k-atari-sysv4
 	exit ;;
     TSUNAMI:LynxOS:2.*:*)
-	echo sparc-unknown-lynxos${UNAME_RELEASE}
+	echo sparc-${VENDOR}-lynxos${UNAME_RELEASE}
 	exit ;;
     rs6000:LynxOS:2.*:*)
-	echo rs6000-unknown-lynxos${UNAME_RELEASE}
+	echo rs6000-${VENDOR}-lynxos${UNAME_RELEASE}
 	exit ;;
-    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
-	echo powerpc-unknown-lynxos${UNAME_RELEASE}
+    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
+	echo powerpc-${VENDOR}-lynxos${UNAME_RELEASE}
 	exit ;;
     SM[BE]S:UNIX_SV:*:*)
 	echo mips-dde-sysv${UNAME_RELEASE}
@@ -1187,7 +1173,7 @@ EOF
 	if [ -d /usr/nec ]; then
 	        echo mips-nec-sysv${UNAME_RELEASE}
 	else
-	        echo mips-unknown-sysv${UNAME_RELEASE}
+	        echo mips-${VENDOR}-sysv${UNAME_RELEASE}
 	fi
         exit ;;
     BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
@@ -1199,6 +1185,9 @@ EOF
     BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
 	echo i586-pc-beos
 	exit ;;
+    BePC:Haiku:*:*)	# Haiku running on Intel PC compatible.
+	echo i586-pc-haiku
+	exit ;;
     SX-4:SUPER-UX:*:*)
 	echo sx4-nec-superux${UNAME_RELEASE}
 	exit ;;
@@ -1208,6 +1197,15 @@ EOF
     SX-6:SUPER-UX:*:*)
 	echo sx6-nec-superux${UNAME_RELEASE}
 	exit ;;
+    SX-7:SUPER-UX:*:*)
+	echo sx7-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-8:SUPER-UX:*:*)
+	echo sx8-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-8R:SUPER-UX:*:*)
+	echo sx8r-nec-superux${UNAME_RELEASE}
+	exit ;;
     Power*:Rhapsody:*:*)
 	echo powerpc-apple-rhapsody${UNAME_RELEASE}
 	exit ;;
@@ -1217,6 +1215,16 @@ EOF
     *:Darwin:*:*)
 	UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
 	case $UNAME_PROCESSOR in
+	    i386)
+		eval $set_cc_for_build
+		if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+		  if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
+		      (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+		      grep IS_64BIT_ARCH >/dev/null
+		  then
+		      UNAME_PROCESSOR="x86_64"
+		  fi
+		fi ;;
 	    unknown) UNAME_PROCESSOR=powerpc ;;
 	esac
 	echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
@@ -1256,13 +1264,13 @@ EOF
 	else
 	    UNAME_MACHINE="$cputype"
 	fi
-	echo ${UNAME_MACHINE}-unknown-plan9
+	echo ${UNAME_MACHINE}-${VENDOR}-plan9
 	exit ;;
     *:TOPS-10:*:*)
-	echo pdp10-unknown-tops10
+	echo pdp10-${VENDOR}-tops10
 	exit ;;
     *:TENEX:*:*)
-	echo pdp10-unknown-tenex
+	echo pdp10-${VENDOR}-tenex
 	exit ;;
     KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
 	echo pdp10-dec-tops20
@@ -1271,16 +1279,16 @@ EOF
 	echo pdp10-xkl-tops20
 	exit ;;
     *:TOPS-20:*:*)
-	echo pdp10-unknown-tops20
+	echo pdp10-${VENDOR}-tops20
 	exit ;;
     *:ITS:*:*)
-	echo pdp10-unknown-its
+	echo pdp10-${VENDOR}-its
 	exit ;;
     SEI:*:*:SEIUX)
         echo mips-sei-seiux${UNAME_RELEASE}
 	exit ;;
     *:DragonFly:*:*)
-	echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+	echo ${UNAME_MACHINE}-${VENDOR}-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
 	exit ;;
     *:*VMS:*:*)
     	UNAME_MACHINE=`(uname -p) 2>/dev/null`
@@ -1298,6 +1306,9 @@ EOF
     i*86:rdos:*:*)
 	echo ${UNAME_MACHINE}-pc-rdos
 	exit ;;
+    i*86:AROS:*:*)
+	echo ${UNAME_MACHINE}-pc-aros
+	exit ;;
 esac
 
 #echo '(No uname command or uname output not recognized.)' 1>&2
@@ -1458,9 +1469,9 @@ This script, last modified $timestamp, has failed to recognize
 the operating system you are using. It is advised that you
 download the most up to date version of the config scripts from
 
-  http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess
+  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
 and
-  http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub
+  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
 
 If the version you run ($0) is already up to date, please
 send the following data and any information you think might be
diff --git a/libgc/config.sub b/libgc/config.sub
index fab0aa3..2a55a50 100755
--- a/libgc/config.sub
+++ b/libgc/config.sub
@@ -1,10 +1,10 @@
 #! /bin/sh
 # Configuration validation subroutine script.
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-#   2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
-#   Inc.
+#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+#   Free Software Foundation, Inc.
 
-timestamp='2006-09-20'
+timestamp='2009-11-20'
 
 # This file is (in principle) common to ALL GNU software.
 # The presence of a machine in this file suggests that SOME GNU software
@@ -32,13 +32,16 @@ timestamp='2006-09-20'
 
 
 # Please send patches to <config-patches at gnu.org>.  Submit a context
-# diff and a properly formatted ChangeLog entry.
+# diff and a properly formatted GNU ChangeLog entry.
 #
 # Configuration subroutine to validate and canonicalize a configuration type.
 # Supply the specified configuration type as an argument.
 # If it is invalid, we print an error message on stderr and exit with code 1.
 # Otherwise, we print the canonical config type on stdout and succeed.
 
+# You can get the latest version of this script from:
+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
+
 # This file is supposed to be the same for all GNU packages
 # and recognize all the CPU types, system types and aliases
 # that are meaningful with *any* GNU software.
@@ -72,8 +75,8 @@ Report bugs and patches to <config-patches at gnu.org>."
 version="\
 GNU config.sub ($timestamp)
 
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
-Free Software Foundation, Inc.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
+2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -122,6 +125,7 @@ maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
 case $maybe_os in
   nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
   uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
+  kopensolaris*-gnu* | \
   storm-chaos* | os2-emx* | rtmk-nova*)
     os=-$maybe_os
     basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
@@ -148,10 +152,13 @@ case $os in
 	-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
 	-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
 	-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
-	-apple | -axis | -knuth | -cray)
+	-apple | -axis | -knuth | -cray | -microblaze)
 		os=
 		basic_machine=$1
 		;;
+        -bluegene*)
+	        os=-cnk
+		;;
 	-sim | -cisco | -oki | -wec | -winbond)
 		os=
 		basic_machine=$1
@@ -245,17 +252,20 @@ case $basic_machine in
 	| bfin \
 	| c4x | clipper \
 	| d10v | d30v | dlx | dsp16xx \
-	| fr30 | frv \
+	| fido | fr30 | frv \
 	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
 	| i370 | i860 | i960 | ia64 \
 	| ip2k | iq2000 \
+	| lm32 \
 	| m32c | m32r | m32rle | m68000 | m68k | m88k \
-	| maxq | mb | microblaze | mcore \
+	| maxq | mb | microblaze | mcore | mep | metag \
 	| mips | mipsbe | mipseb | mipsel | mipsle \
 	| mips16 \
 	| mips64 | mips64el \
-	| mips64vr | mips64vrel \
+	| mips64octeon | mips64octeonel \
 	| mips64orion | mips64orionel \
+	| mips64r5900 | mips64r5900el \
+	| mips64vr | mips64vrel \
 	| mips64vr4100 | mips64vr4100el \
 	| mips64vr4300 | mips64vr4300el \
 	| mips64vr5000 | mips64vr5000el \
@@ -268,6 +278,7 @@ case $basic_machine in
 	| mipsisa64sr71k | mipsisa64sr71kel \
 	| mipstx39 | mipstx39el \
 	| mn10200 | mn10300 \
+	| moxie \
 	| mt \
 	| msp430 \
 	| nios | nios2 \
@@ -276,20 +287,22 @@ case $basic_machine in
 	| pdp10 | pdp11 | pj | pjl \
 	| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
 	| pyramid \
+	| rx \
 	| score \
-	| sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
+	| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
 	| sh64 | sh64le \
 	| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
 	| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
 	| spu | strongarm \
 	| tahoe | thumb | tic4x | tic80 | tron \
+	| ubicom32 \
 	| v850 | v850e \
 	| we32k \
 	| x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
-	| z8k)
+	| z8k | z80)
 		basic_machine=$basic_machine-unknown
 		;;
-	m6811 | m68hc11 | m6812 | m68hc12)
+	m6811 | m68hc11 | m6812 | m68hc12 | picochip)
 		# Motorola 68HC11/12.
 		basic_machine=$basic_machine-unknown
 		os=-none
@@ -324,19 +337,22 @@ case $basic_machine in
 	| clipper-* | craynv-* | cydra-* \
 	| d10v-* | d30v-* | dlx-* \
 	| elxsi-* \
-	| f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
+	| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
 	| h8300-* | h8500-* \
 	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
 	| i*86-* | i860-* | i960-* | ia64-* \
 	| ip2k-* | iq2000-* \
+	| lm32-* \
 	| m32c-* | m32r-* | m32rle-* \
 	| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
-	| m88110-* | m88k-* | maxq-* | mcore-* \
+	| m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \
 	| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
 	| mips16-* \
 	| mips64-* | mips64el-* \
-	| mips64vr-* | mips64vrel-* \
+	| mips64octeon-* | mips64octeonel-* \
 	| mips64orion-* | mips64orionel-* \
+	| mips64r5900-* | mips64r5900el-* \
+	| mips64vr-* | mips64vrel-* \
 	| mips64vr4100-* | mips64vr4100el-* \
 	| mips64vr4300-* | mips64vr4300el-* \
 	| mips64vr5000-* | mips64vr5000el-* \
@@ -357,21 +373,26 @@ case $basic_machine in
 	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
 	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
 	| pyramid-* \
-	| romp-* | rs6000-* \
-	| sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
+	| romp-* | rs6000-* | rx-* \
+	| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
 	| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
 	| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
 	| sparclite-* \
 	| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
 	| tahoe-* | thumb-* \
-	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
+	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \
 	| tron-* \
+	| ubicom32-* \
 	| v850-* | v850e-* | vax-* \
 	| we32k-* \
 	| x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
-	| xstormy16-* | xtensa-* \
+	| xstormy16-* | xtensa*-* \
 	| ymp-* \
-	| z8k-*)
+	| z8k-* | z80-*)
+		;;
+	# Recognize the basic CPU types without company name, with glob match.
+	xtensa*)
+		basic_machine=$basic_machine-unknown
 		;;
 	# Recognize the various machine names and aliases which stand
 	# for a CPU type and a company and sometimes even an OS.
@@ -435,6 +456,10 @@ case $basic_machine in
 		basic_machine=m68k-apollo
 		os=-bsd
 		;;
+	aros)
+		basic_machine=i386-pc
+		os=-aros
+		;;
 	aux)
 		basic_machine=m68k-apple
 		os=-aux
@@ -443,10 +468,26 @@ case $basic_machine in
 		basic_machine=ns32k-sequent
 		os=-dynix
 		;;
+	blackfin)
+		basic_machine=bfin-unknown
+		os=-linux
+		;;
+	blackfin-*)
+		basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
+		os=-linux
+		;;
+	bluegene*)
+		basic_machine=powerpc-ibm
+		os=-cnk
+		;;
 	c90)
 		basic_machine=c90-cray
 		os=-unicos
 		;;
+        cegcc)
+		basic_machine=arm-unknown
+		os=-cegcc
+		;;
 	convex-c1)
 		basic_machine=c1-convex
 		os=-bsd
@@ -475,8 +516,8 @@ case $basic_machine in
 		basic_machine=craynv-cray
 		os=-unicosmp
 		;;
-	cr16c)
-		basic_machine=cr16c-unknown
+	cr16)
+		basic_machine=cr16-unknown
 		os=-elf
 		;;
 	crds | unos)
@@ -514,6 +555,10 @@ case $basic_machine in
 		basic_machine=m88k-motorola
 		os=-sysv3
 		;;
+	dicos)
+		basic_machine=i686-pc
+		os=-dicos
+		;;
 	djgpp)
 		basic_machine=i586-pc
 		os=-msdosdjgpp
@@ -668,6 +713,14 @@ case $basic_machine in
 		basic_machine=m68k-isi
 		os=-sysv
 		;;
+	m68knommu)
+		basic_machine=m68k-unknown
+		os=-linux
+		;;
+	m68knommu-*)
+		basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
+		os=-linux
+		;;
 	m88k-omron*)
 		basic_machine=m88k-omron
 		;;
@@ -679,10 +732,17 @@ case $basic_machine in
 		basic_machine=ns32k-utek
 		os=-sysv
 		;;
+        microblaze)
+		basic_machine=microblaze-xilinx
+		;;
 	mingw32)
 		basic_machine=i386-pc
 		os=-mingw32
 		;;
+	mingw32ce)
+		basic_machine=arm-unknown
+		os=-mingw32ce
+		;;
 	miniframe)
 		basic_machine=m68000-convergent
 		;;
@@ -809,6 +869,14 @@ case $basic_machine in
 		basic_machine=i860-intel
 		os=-osf
 		;;
+	parisc)
+		basic_machine=hppa-unknown
+		os=-linux
+		;;
+	parisc-*)
+		basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
+		os=-linux
+		;;
 	pbd)
 		basic_machine=sparc-tti
 		;;
@@ -925,6 +993,9 @@ case $basic_machine in
 		basic_machine=sh-hitachi
 		os=-hms
 		;;
+	sh5el)
+		basic_machine=sh5le-unknown
+		;;
 	sh64)
 		basic_machine=sh64-unknown
 		;;
@@ -1014,6 +1085,10 @@ case $basic_machine in
 		basic_machine=tic6x-unknown
 		os=-coff
 		;;
+	tile*)
+		basic_machine=tile-unknown
+		os=-linux-gnu
+		;;
 	tx39)
 		basic_machine=mipstx39-unknown
 		;;
@@ -1089,6 +1164,10 @@ case $basic_machine in
 		basic_machine=z8k-unknown
 		os=-sim
 		;;
+	z80-*-coff)
+		basic_machine=z80-unknown
+		os=-sim
+		;;
 	none)
 		basic_machine=none-none
 		os=-none
@@ -1127,7 +1206,7 @@ case $basic_machine in
 	we32k)
 		basic_machine=we32k-att
 		;;
-	sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
+	sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
 		basic_machine=sh-unknown
 		;;
 	sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
@@ -1177,6 +1256,9 @@ case $os in
         # First match some system type aliases
         # that might get confused with valid system types.
 	# -solaris* is a basic system type, with this one exception.
+        -auroraux)
+	        os=-auroraux
+		;;
 	-solaris1 | -solaris1.*)
 		os=`echo $os | sed -e 's|solaris1|sunos4|'`
 		;;
@@ -1197,10 +1279,11 @@ case $os in
 	# Each alternative MUST END IN A *, to match a version number.
 	# -sysv* is not here because it comes later, after sysvr4.
 	-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
-	      | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
-	      | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
+	      | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
+	      | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
+	      | -sym* | -kopensolaris* \
 	      | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
-	      | -aos* \
+	      | -aos* | -aros* \
 	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
 	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
 	      | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
@@ -1209,7 +1292,7 @@ case $os in
 	      | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
 	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
 	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
-	      | -chorusos* | -chorusrdb* \
+	      | -chorusos* | -chorusrdb* | -cegcc* \
 	      | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
 	      | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
 	      | -uxpv* | -beos* | -mpeix* | -udk* \
@@ -1219,7 +1302,7 @@ case $os in
 	      | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
 	      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
 	      | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
-	      | -skyos* | -haiku* | -rdos* | -toppers*)
+	      | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*)
 	# Remember, each alternative MUST END IN *, to match a version number.
 		;;
 	-qnx*)
@@ -1349,6 +1432,9 @@ case $os in
 	-zvmoe)
 		os=-zvmoe
 		;;
+	-dicos*)
+		os=-dicos
+		;;
 	-none)
 		;;
 	*)
@@ -1414,6 +1500,9 @@ case $basic_machine in
 	m68*-cisco)
 		os=-aout
 		;;
+        mep-*)
+		os=-elf
+		;;
 	mips*-cisco)
 		os=-elf
 		;;
@@ -1543,7 +1632,7 @@ case $basic_machine in
 			-sunos*)
 				vendor=sun
 				;;
-			-aix*)
+			-cnk*|-aix*)
 				vendor=ibm
 				;;
 			-beos*)
diff --git a/libgc/darwin_stop_world.c b/libgc/darwin_stop_world.c
index ac50256..516b12c 100644
--- a/libgc/darwin_stop_world.c
+++ b/libgc/darwin_stop_world.c
@@ -569,6 +569,9 @@ void GC_stop_world()
     thread_act_array_t act_list, prev_list;
     mach_msg_type_number_t listcount, prevcount;
     
+    if (GC_notify_event)
+        GC_notify_event (GC_EVENT_PRE_STOP_WORLD);
+
 #   if DEBUG_THREADS
       GC_printf1("Stopping the world from 0x%lx\n", mach_thread_self());
 #   endif
@@ -639,6 +642,9 @@ void GC_stop_world()
     #endif
 	  
 	  mach_port_deallocate(my_task, my_thread);
+
+    if (GC_notify_event)
+        GC_notify_event (GC_EVENT_POST_STOP_WORLD);
 }
 
 /* Caller holds allocation lock, and has held it continuously since	*/
@@ -654,6 +660,9 @@ void GC_start_world()
   mach_msg_type_number_t listcount;
   struct thread_basic_info info;
   mach_msg_type_number_t outCount = THREAD_INFO_MAX;
+
+  if (GC_notify_event)
+      GC_notify_event (GC_EVENT_PRE_START_WORLD);
   
 #   if DEBUG_THREADS
       GC_printf0("World starting\n");
@@ -700,6 +709,10 @@ void GC_start_world()
     vm_deallocate(my_task, (vm_address_t)act_list, sizeof(thread_t) * listcount);
 	
 	mach_port_deallocate(my_task, my_thread);
+
+    if (GC_notify_event)
+        GC_notify_event (GC_EVENT_POST_START_WORLD);
+
 #   if DEBUG_THREADS
      GC_printf0("World started\n");
 #   endif
diff --git a/man/Makefile.in b/man/Makefile.in
index e983f37..bb8473c 100644
--- a/man/Makefile.in
+++ b/man/Makefile.in
@@ -343,9 +343,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign man/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu man/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign man/Makefile
+	  $(AUTOMAKE) --gnu man/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
diff --git a/mcs/build/ChangeLog b/mcs/build/ChangeLog
index 80ddab5..525e3c5 100644
--- a/mcs/build/ChangeLog
+++ b/mcs/build/ChangeLog
@@ -1,3 +1,7 @@
+2011-09-15  Alex Corrado  <alexc at xamarin.com>
+
+	Fix prepending $(CURDIR) to paths failing under cygwin
+
 2010-12-29  Marek Safar  <marek.safar at gmail.com>
 
 	[661642] Fixed v4 resgen compilation
diff --git a/mcs/build/common/Consts.cs b/mcs/build/common/Consts.cs
index 5ca4b8b..a7227be 100644
--- a/mcs/build/common/Consts.cs
+++ b/mcs/build/common/Consts.cs
@@ -34,7 +34,7 @@ static class Consts
 	// Use these assembly version constants to make code more maintainable.
 	//
 
-	public const string MonoVersion = "2.10.2.0";
+	public const string MonoVersion = "2.10.8.1";
 	public const string MonoCompany = "MONO development team";
 	public const string MonoProduct = "MONO Common language infrastructure";
 	public const string MonoCopyright = "(c) various MONO Authors";
diff --git a/mcs/build/platforms/win32.make b/mcs/build/platforms/win32.make
index 71b8a89..403a47e 100644
--- a/mcs/build/platforms/win32.make
+++ b/mcs/build/platforms/win32.make
@@ -26,6 +26,8 @@ PLATFORM_MAKE_CORLIB_CMP = yes
 PLATFORM_CHANGE_SEPARATOR_CMD=tr '/' '\\\\'
 PLATFORM_PATH_SEPARATOR = ;
 
+override CURDIR:=$(shell cygpath -m $(CURDIR))
+
 ## not so simple :-)
 #PLATFORM_AOT_SUFFIX = .dll
 
diff --git a/mcs/class/ChangeLog b/mcs/class/ChangeLog
index 8d7ffe6..4cf4eb3 100644
--- a/mcs/class/ChangeLog
+++ b/mcs/class/ChangeLog
@@ -1,3 +1,61 @@
+2011-10-17  Rolf Bjarne Kvinge  <rolf at xamarin.com>
+
+	Add System.Numerics to the mobile profile.
+
+2011-01-13  Marek Safar  <marek.safar at gmail.com>
+
+	Fix System.Data.Services.Client public key
+
+2011-09-23  Rolf Bjarne Kvinge  <rolf at xamarin.com>
+
+	[Microsoft.Build] Stub out a lot of classes to make NuGet build
+	with mono.
+
+2011-09-21  Rolf Bjarne Kvinge  <rolf at xamarin.com>
+
+	[Microsoft.Build] Stub out a few types to make nuget run.
+
+2011-06-25  Leszek 'skolima' Ciesielski  <skolima at gmail.com>
+
+	[MSBuild] Fixed issues found by Paul Selormey.
+
+	Unset attributes should return String.Empty, null is only for
+	invalid.
+
+2011-06-21  Leszek 'skolima' Ciesielski  <skolima at gmail.com>
+
+	[MSBuild] LinkedList used for storing children
+
+	ProjectElementContainer should now handle modifications faster.
+
+2011-06-04  Leszek 'skolima' Ciesielski  <skolima at gmail.com>
+
+	[MSBuild] Preserve comments in build files
+
+	Contribution by Paul Selormey
+
+2011-06-04  Leszek 'skolima' Ciesielski  <skolima at gmail.com>
+
+	[MSBuild] Finishing Microsoft.Build.Construction
+
+	No more NotImplementedException.
+
+2011-04-29  Leszek 'skolima' Ciesielski  <skolima at gmail.com>
+
+	[MSBuild] Microsoft.Build.Construction loading project files
+
+2011-04-28  Leszek 'skolima' Ciesielski  <skolima at gmail.com>
+
+	fixing the build
+
+2011-02-13  Leszek 'skolima' Ciesielski  <skolima at gmail.com>
+
+	[MSBuild] Add Microsoft.Build for 4.0 profile
+
+	Namespace Microsoft.Build.Construction partiallly implemented,
+	enought to construct and save a valid project file. Some tests
+	present (work on .Net).
+
 2011-04-01  Marek Habersack  <grendel at twistedcode.net>
 
 	[mvc3] Part of fix for bug #683339. Override more
diff --git a/mcs/class/Commons.Xml.Relaxng/ChangeLog b/mcs/class/Commons.Xml.Relaxng/ChangeLog
index c0de63c..6e52c24 100644
--- a/mcs/class/Commons.Xml.Relaxng/ChangeLog
+++ b/mcs/class/Commons.Xml.Relaxng/ChangeLog
@@ -1,3 +1,8 @@
+2011-08-30  Chris Toshok  <toshok at gmail.com>
+
+	prepend $(CURDIR) to jay input files so that the debugging info
+	references the right .jay
+
 2009-01-20  Atsushi Enomoto <atsushi at ximian.com>
 
 	* Commons.Xml.Relaxng_test.dll.sources : forgot to add
diff --git a/mcs/class/Commons.Xml.Relaxng/ChangeLog b/mcs/class/Commons.Xml.Relaxng/ChangeLog.old
similarity index 100%
copy from mcs/class/Commons.Xml.Relaxng/ChangeLog
copy to mcs/class/Commons.Xml.Relaxng/ChangeLog.old
diff --git a/mcs/class/Commons.Xml.Relaxng/Makefile b/mcs/class/Commons.Xml.Relaxng/Makefile
index c43c5f7..5e9c85d 100644
--- a/mcs/class/Commons.Xml.Relaxng/Makefile
+++ b/mcs/class/Commons.Xml.Relaxng/Makefile
@@ -22,7 +22,7 @@ EXTRA_DISTFILES = \
 	$(RESOURCE_FILES)
 
 Commons.Xml.Relaxng.Rnc/RncParser.cs: Commons.Xml.Relaxng.Rnc/RncParser.jay $(topdir)/jay/skeleton.cs
-	$(topdir)/jay/jay -ctv < $(topdir)/jay/skeleton.cs Commons.Xml.Relaxng.Rnc/RncParser.jay > Commons.Xml.Relaxng.Rnc/RncParser.cs
+	$(topdir)/jay/jay -ctv < $(topdir)/jay/skeleton.cs $(CURDIR)/Commons.Xml.Relaxng.Rnc/RncParser.jay > Commons.Xml.Relaxng.Rnc/RncParser.cs
 
 BUILT_SOURCES = Commons.Xml.Relaxng.Rnc/RncParser.cs
 
diff --git a/mcs/class/Makefile b/mcs/class/Makefile
index fe5faa7..436668b 100644
--- a/mcs/class/Makefile
+++ b/mcs/class/Makefile
@@ -144,6 +144,7 @@ mobile_dirs := \
 	System.Transactions	\
 	System.Data	\
 	Mono.Cairo	\
+	System.Numerics	\
 	Mono.Data.Sqlite
 
 net_3_5_only_dirs := \
@@ -156,6 +157,7 @@ net_4_0_dirs := \
 	System.Dynamic		\
 	System.Numerics		\
 	Microsoft.CSharp	\
+	Microsoft.Build		\
 	System.Windows.Forms.DataVisualization	\
 	System.ComponentModel.Composition \
 	System.Xaml \
diff --git a/mcs/class/Microsoft.Build.Framework/ChangeLog b/mcs/class/Microsoft.Build.Framework/ChangeLog
index dea0641..863ae84 100644
--- a/mcs/class/Microsoft.Build.Framework/ChangeLog
+++ b/mcs/class/Microsoft.Build.Framework/ChangeLog
@@ -1,3 +1,7 @@
+2011-09-23  Rolf Bjarne Kvinge  <rolf at xamarin.com>
+
+	[Microsoft.Build.Framework] Add a couple of 4.0 interfaces.
+
 2010-04-03  Ankit Jain  <jankit at novell.com>
 
 	* Makefile: Import tools/xbuild/xbuild_targets.make, which copies
diff --git a/mcs/class/Microsoft.Build.Framework/ChangeLog b/mcs/class/Microsoft.Build.Framework/ChangeLog.old
similarity index 100%
copy from mcs/class/Microsoft.Build.Framework/ChangeLog
copy to mcs/class/Microsoft.Build.Framework/ChangeLog.old
diff --git a/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework.dll.sources b/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework.dll.sources
index 7e7d3a5..f9071bc 100644
--- a/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework.dll.sources
+++ b/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework.dll.sources
@@ -23,9 +23,11 @@ Microsoft.Build.Framework/IBuildEngine.cs
 Microsoft.Build.Framework/IBuildEngine2.cs
 Microsoft.Build.Framework/IEventSource.cs
 Microsoft.Build.Framework/ILogger.cs
+Microsoft.Build.Framework/INodeLogger.cs
 Microsoft.Build.Framework/ITask.cs
 Microsoft.Build.Framework/ITaskHost.cs
 Microsoft.Build.Framework/ITaskItem.cs
+Microsoft.Build.Framework/ITaskItem2.cs
 Microsoft.Build.Framework/LoadInSeparateAppDomainAttribute.cs
 Microsoft.Build.Framework/LoggerException.cs
 Microsoft.Build.Framework/LoggerVerbosity.cs
diff --git a/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/ChangeLog b/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/ChangeLog
index 0f14e7b..709836c 100644
--- a/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/ChangeLog
+++ b/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/ChangeLog
@@ -1,3 +1,7 @@
+2011-09-23  Rolf Bjarne Kvinge  <rolf at xamarin.com>
+
+	[Microsoft.Build.Framework] Add a couple of 4.0 interfaces.
+
 2010-04-03  Ankit Jain  <jankit at novell.com>
 
 	* IBuildEngine2.cs: New.
diff --git a/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/ChangeLog b/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/ChangeLog.old
similarity index 100%
copy from mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/ChangeLog
copy to mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/ChangeLog.old
diff --git a/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/INodeLogger.cs b/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/INodeLogger.cs
new file mode 100644
index 0000000..3fe741d
--- /dev/null
+++ b/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/INodeLogger.cs
@@ -0,0 +1,44 @@
+//
+// INodeLogger.cs:
+//
+// Author:
+//   Rolf Bjarne Kvinge (rolf at xamarin.com)
+//
+// Copyright (C) 2011 Xamarin Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+
+#if NET_4_0
+
+using System;
+using System.Collections;
+
+namespace Microsoft.Build.Framework
+{
+	[System.Runtime.InteropServices.ComVisible (true)]
+	public interface INodeLogger : ILogger
+	{
+		void Initialize (IEventSource eventSource, int nodeCount);
+	}
+}
+
+#endif
diff --git a/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/ITaskItem2.cs b/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/ITaskItem2.cs
new file mode 100644
index 0000000..b9d882c
--- /dev/null
+++ b/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework/ITaskItem2.cs
@@ -0,0 +1,50 @@
+//
+// ITaskItem2.cs:
+//
+// Author:
+//   Rolf Bjarne Kvinge (rolf at xamarin.com)
+//
+// Copyright (C) 2011 Xamarin Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_4_0
+
+using System;
+using System.Collections;
+
+namespace Microsoft.Build.Framework
+{
+	[System.Runtime.InteropServices.GuidAttribute ("ac6d5a59-f877-461b-88e3-b2f06fce0cb9")]
+	[System.Runtime.InteropServices.ComVisible (true)]
+	public interface ITaskItem2 : ITaskItem
+	{
+		string EvaluatedIncludeEscaped { get; set; }
+		
+		string GetMetadataValueEscaped (string metadataName);
+		
+		void SetMetadataValueLiteral (string metadataName, string metadataValue);
+		
+		IDictionary CloneCustomMetadataEscaped ();
+	}
+}
+
+#endif
diff --git a/mcs/class/Microsoft.Build/Assembly/AssemblyInfo.cs b/mcs/class/Microsoft.Build/Assembly/AssemblyInfo.cs
new file mode 100644
index 0000000..6ac9a83
--- /dev/null
+++ b/mcs/class/Microsoft.Build/Assembly/AssemblyInfo.cs
@@ -0,0 +1,64 @@
+//
+// AssemblyInfo.cs
+//
+// Author:
+//   Leszek Ciesielski (skolima at gmail.com)
+//
+// (C) 2011 Leszek Ciesielski
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Reflection;
+using System.Resources;
+using System.Runtime;
+using System.Security;
+using System.Security.Permissions;
+using System.Diagnostics;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.Versioning;
+
+// General Information about the Microsoft.Build assembly
+
+[assembly: AssemblyTitle ("Microsoft.Build.dll")]
+[assembly: AssemblyDescription ("Microsoft.Build.dll")]
+[assembly: AssemblyDefaultAlias ("Microsoft.Build.dll")]
+
+[assembly: AssemblyCompany (Consts.MonoCompany)]
+[assembly: AssemblyProduct (Consts.MonoProduct)]
+[assembly: AssemblyCopyright (Consts.MonoCopyright)]
+[assembly: AssemblyVersion (Consts.FxVersion)]
+[assembly: SatelliteContractVersion (Consts.FxVersion)]
+[assembly: AssemblyInformationalVersion (Consts.FxFileVersion)]
+
+[assembly: NeutralResourcesLanguage ("en-US")]
+
+[assembly: ComVisible (false)]
+[assembly: CLSCompliant (true)]
+[assembly: AssemblyDelaySign (true)]
+[assembly: AssemblyKeyFile("../msfinal.pub")]
+
+[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
+[assembly: CompilationRelaxations (CompilationRelaxations.NoStringInterning)]
+[assembly: Debuggable (DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
+[assembly: RuntimeCompatibility (WrapNonExceptionThrows = true)]
+
diff --git a/mcs/class/Microsoft.Build/Makefile b/mcs/class/Microsoft.Build/Makefile
new file mode 100644
index 0000000..0fde304
--- /dev/null
+++ b/mcs/class/Microsoft.Build/Makefile
@@ -0,0 +1,26 @@
+thisdir = class/Microsoft.Build
+SUBDIRS = 
+include ../../build/rules.make
+
+LIBRARY = Microsoft.Build.dll
+
+ifneq (4.0, $(FRAMEWORK_VERSION))
+LIBRARY_NAME = dummy-Microsoft.Build.dll
+NO_INSTALL = yes
+NO_TEST = yes
+NO_SIGN_ASSEMBLY = yes
+endif
+
+LIB_MCS_FLAGS = \
+	/r:$(corlib)				\
+	/r:System.dll				\
+	/r:System.Core.dll			\
+	/r:System.Xml.dll			\
+	/r:Microsoft.Build.Engine.dll		\
+	/r:Microsoft.Build.Framework.dll
+
+include ../../build/library.make
+
+export TESTING_MONO=a
+XBUILD_DIR=../../tools/xbuild
+include $(XBUILD_DIR)/xbuild_targets.make
diff --git a/mcs/class/Microsoft.Build/Microsoft.Build.Construction/ProjectChooseElement.cs b/mcs/class/Microsoft.Build/Microsoft.Build.Construction/ProjectChooseElement.cs
new file mode 100644
index 0000000..551a67b
--- /dev/null
+++ b/mcs/class/Microsoft.Build/Microsoft.Build.Construction/ProjectChooseElement.cs
@@ -0,0 +1,74 @@
+//
+// ProjectChooseElement.cs
+//
+// Author:
+//   Leszek Ciesielski (skolima at gmail.com)
+//
+// (C) 2011 Leszek Ciesielski
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Microsoft.Build.Exceptions;
+using Microsoft.Build.Internal;
+
+namespace Microsoft.Build.Construction
+{
+        [System.Diagnostics.DebuggerDisplayAttribute ("ProjectChooseElement (#Children={Count} "
+                                                      + "HasOtherwise={OtherwiseElement != null})")]
+        public class ProjectChooseElement : ProjectElementContainer
+        {
+                internal ProjectChooseElement (ProjectRootElement containingProject)
+                {
+                        ContainingProject = containingProject;
+                }
+                public override string Condition { get { return null; } set { throw new InvalidOperationException(
+                        "Can not set Condition."); } }
+                public ProjectOtherwiseElement OtherwiseElement {
+                        get { return LastChild as ProjectOtherwiseElement; }
+                }
+                public ICollection<ProjectWhenElement> WhenElements {
+                        get { return new CollectionFromEnumerable<ProjectWhenElement> (
+                                new FilteredEnumerable<ProjectWhenElement> (Children)); }
+                }
+                internal override string XmlName {
+                        get { return "Choose"; }
+                }
+                internal override ProjectElement LoadChildElement (string name)
+                {
+                        switch (name) {
+                        case "Otherwise":
+                                var other = ContainingProject.CreateOtherwiseElement ();
+                                AppendChild (other);
+                                return other;
+                        case "When":
+                                var when = ContainingProject.CreateWhenElement (null);
+                                PrependChild (when);
+                                return when;
+                        default:
+                                throw new InvalidProjectFileException (string.Format (
+                                        "Child \"{0}\" is not a known node type.", name));
+                        }
+                }
+        }
+}
diff --git a/mcs/class/Microsoft.Build/Microsoft.Build.Construction/ProjectCommentElement.cs b/mcs/class/Microsoft.Build/Microsoft.Build.Construction/ProjectCommentElement.cs
new file mode 100644
index 0000000..2366618
--- /dev/null
+++ b/mcs/class/Microsoft.Build/Microsoft.Build.Construction/ProjectCommentElement.cs
@@ -0,0 +1,76 @@
+//
+// ProjectCommentElement.cs
+//
+// Author:
+//   Leszek Ciesielski (skolima at gmail.com)
+//
+// (C) 2011 Leszek Ciesielski
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Xml;
+
+namespace Microsoft.Build.Construction
+{
+        internal class ProjectCommentElement : ProjectElement
+        {
+                internal ProjectCommentElement (ProjectRootElement containingProject)
+                {
+                        ContainingProject = containingProject;
+                }
+
+                string comment;
+                public string Comment { get { return comment ?? String.Empty; } set { comment = value; } }
+
+                internal override string XmlName {
+                        get { return String.Empty; }
+                }
+
+                internal override void Load (XmlReader reader)
+                {
+                        LoadValue (reader);
+                }
+
+                internal override void LoadAttribute (string name, string value)
+                {
+                }
+
+                internal override void LoadValue (XmlReader reader)
+                {
+                        if (reader.NodeType == XmlNodeType.Comment) {
+                                Comment = reader.Value;
+                        }
+                }
+
+                internal override void Save (XmlWriter writer)
+                {
+                        this.SaveValue (writer);
+                }
+
+                internal override void SaveValue (XmlWriter writer)
+                {
+                        if (!String.IsNullOrEmpty (Comment)) {
+                                writer.WriteComment (Comment);
+                        }
+                }
+        }
+}
diff --git a/mcs/class/Microsoft.Build/Microsoft.Build.Construction/ProjectElement.cs b/mcs/class/Microsoft.Build/Microsoft.Build.Construction/ProjectElement.cs
new file mode 100644
index 0000000..7454665
--- /dev/null
+++ b/mcs/class/Microsoft.Build/Microsoft.Build.Construction/ProjectElement.cs
@@ -0,0 +1,113 @@
+//
+// ProjectElement.cs
+//
+// Author:
+//   Leszek Ciesielski (skolima at gmail.com)
+//
+// (C) 2011 Leszek Ciesielski
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Collections.Generic;
+using System.Xml;
+using Microsoft.Build.Exceptions;
+
+namespace Microsoft.Build.Construction
+{
+        public abstract class ProjectElement
+        {
+                internal ProjectElement ()
+                {
+                        linkedListNode = new LinkedListNode<ProjectElement> (this);
+                }
+                public ProjectRootElement ContainingProject { get; internal set; }
+                public ProjectElement PreviousSibling {
+                        get { return LinkedListNode.Previous == null ? null : LinkedListNode.Previous.Value; }
+                        internal set { }
+                }
+                public ProjectElementContainer Parent { get; internal set; }
+                public ProjectElement NextSibling {
+                        get { return LinkedListNode.Next == null ? null : LinkedListNode.Next.Value; }
+                        internal set { }
+                }
+                string label;
+                public string Label { get { return label ?? String.Empty; } set { label = value; } }
+                string condition;
+                public virtual string Condition { get { return condition ?? String.Empty; } set { condition = value; } }
+                public IEnumerable<ProjectElementContainer> AllParents {
+                        get {
+                                var parent = Parent;
+                                while (parent != null) {
+                                        yield return parent;
+                                        parent = parent.Parent;
+                                }
+                        }
+                }
+                readonly LinkedListNode<ProjectElement> linkedListNode;
+                internal LinkedListNode<ProjectElement> LinkedListNode { get { return linkedListNode; } }
+                internal virtual void Load (XmlReader reader)
+                {
+                        reader.ReadToFollowing (XmlName);
+                        while (reader.MoveToNextAttribute ()) {
+                                LoadAttribute (reader.Name, reader.Value);
+                        }
+                        LoadValue (reader);
+                }
+                internal virtual void LoadAttribute (string name, string value)
+                {
+                        switch (name) {
+                        case "xmlns":
+                                break;
+                        case "Label":
+                                Label = value;
+                                break;
+                        case "Condition":
+                                Condition = value;
+                                break;
+                        default:
+                                throw new InvalidProjectFileException (string.Format (
+                                        "Attribute \"{0}\" is not known on node \"{1}\" [type {2}].", name, XmlName,
+                                        GetType ()));
+                        }
+                }
+                internal virtual void LoadValue (XmlReader reader)
+                {
+                }
+                internal abstract string XmlName { get; }
+                internal virtual void Save (XmlWriter writer)
+                {
+                        writer.WriteStartElement (XmlName);
+                        SaveValue (writer);
+                        writer.WriteEndElement ();
+                }
+                internal virtual void SaveValue (XmlWriter writer)
+                {
+                        SaveAttribute (writer, "Label", Label);
+                        SaveAttribute (writer, "Condition", Condition);
+                }
+                internal void SaveAttribute (XmlWriter writer, string attributeName, string attributeValue)
+                {
+                        if (!string.IsNullOrWhiteSpace (attributeValue))
+                                writer.WriteAttributeString (attributeName, attributeValue);
+                }
+        }
+}
diff --git a/mcs/class/Microsoft.Build/Microsoft.Build.Construction/ProjectElementContainer.cs b/mcs/class/Microsoft.Build/Microsoft.Build.Construction/ProjectElementContainer.cs
new file mode 100644
index 0000000..eb9f59e
--- /dev/null
+++ b/mcs/class/Microsoft.Build/Microsoft.Build.Construction/ProjectElementContainer.cs
@@ -0,0 +1,142 @@
+//
+// ProjectElementContainer.cs
+//
+// Author:
+//   Leszek Ciesielski (skolima at gmail.com)
+//
+// (C) 2011 Leszek Ciesielski
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System.Collections.Generic;
+using System.Linq;
+using System.Xml;
+using Microsoft.Build.Internal;
+
+namespace Microsoft.Build.Construction
+{
+        public abstract class ProjectElementContainer : ProjectElement
+        {
+                internal ProjectElementContainer () {}
+                LinkedList<ProjectElement> children = new LinkedList<ProjectElement> ();
+
+                public IEnumerable<ProjectElement> AllChildren {
+                        get {
+                                foreach (var child in Children) {
+                                        var container = child as ProjectElementContainer;
+                                        if (container != null)
+                                                foreach (var containersChild in container.AllChildren)
+                                                        yield return containersChild;
+                                        yield return child;
+                                }
+                        }
+                }
+
+                public ICollection<ProjectElement> Children {
+                        get { return new CollectionFromEnumerable<ProjectElement> (
+                                children.Where (p => !(p is ProjectCommentElement))); }
+                }
+
+                public ICollection<ProjectElement> ChildrenReversed {
+                        get { return new CollectionFromEnumerable<ProjectElement> (
+                                new ReverseEnumerable<ProjectElement> (children)); }
+                }
+
+                public int Count {
+                        get { return children.Count; }
+                }
+                public ProjectElement FirstChild {
+                        get { return children.First == null ? null : children.First.Value; }
+                        private set { }
+                }
+                public ProjectElement LastChild {
+                        get { return children.Last == null ? null: children.Last.Value; }
+                        private set { }
+                }
+
+                public void AppendChild (ProjectElement child)
+                {
+                        children.AddLast (child.LinkedListNode);
+                        child.Parent = this;
+                }
+
+                public void InsertAfterChild (ProjectElement child, ProjectElement reference)
+                {
+                        if (reference == null) {
+                                PrependChild (child);
+                        } else {
+                                child.Parent = this;
+                                children.AddAfter (reference.LinkedListNode, child.LinkedListNode);
+                        }
+                }
+
+                public void InsertBeforeChild (ProjectElement child, ProjectElement reference)
+                {
+                        if (reference == null) {
+                                AppendChild (child);
+                        } else {
+                                child.Parent = this;
+                                children.AddBefore (reference.LinkedListNode, child.LinkedListNode);
+                        }
+                }
+
+                public void PrependChild (ProjectElement child)
+                {
+                        children.AddFirst (child.LinkedListNode);
+                        child.Parent = this;
+                }
+
+                public void RemoveAllChildren ()
+                {
+                        foreach (var child in children)
+                                RemoveChild (child);
+                }
+
+                public void RemoveChild (ProjectElement child)
+                {
+                        child.Parent = null;
+                        children.Remove (child.LinkedListNode);
+                }
+
+                internal override void SaveValue (XmlWriter writer)
+                {
+                        base.SaveValue (writer);
+                        foreach (var child in children)
+                                child.Save (writer);
+                }
+
+                internal override void LoadValue (XmlReader reader)
+                {
+                        while (reader.Read ()) {
+                                if (reader.NodeType == XmlNodeType.Element) {
+                                        var child = LoadChildElement (reader.Name);
+                                        child.Load (reader.ReadSubtree ());
+                                } else if (reader.NodeType == XmlNodeType.Comment) {
+                                        var commentElement = new ProjectCommentElement (ContainingProject);
+                                        commentElement.Load (reader);
+                                        AppendChild (commentElement);
+                                }
+                        }
+                }
+
+                internal abstract ProjectElement LoadChildElement (string name);
+        }
+}
diff --git a/mcs/class/Microsoft.Build/Microsoft.Build.Construction/ProjectExtensionsElement.cs b/mcs/class/Microsoft.Build/Microsoft.Build.Construction/ProjectExtensionsElement.cs
new file mode 100644
index 0000000..d6bcbbb
--- /dev/null
+++ b/mcs/class/Microsoft.Build/Microsoft.Build.Construction/ProjectExtensionsElement.cs
@@ -0,0 +1,90 @@
+//
+// ProjectExtensionsElement.cs
+//
+// Author:
+//   Leszek Ciesielski (skolima at gmail.com)
+//
+// (C) 2011 Leszek Ciesielski
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Xml;
+using System.Text;
+
+namespace Microsoft.Build.Construction
+{
+        public class ProjectExtensionsElement : ProjectElement
+        {
+                internal ProjectExtensionsElement (ProjectRootElement containingProject)
+                {
+                        ContainingProject = containingProject;
+                }
+                public override string Condition {
+                        get { return null; }
+                        set {
+                                throw new InvalidOperationException ("Can not set Condition.");
+                        }
+                }
+                public string Content {
+                        get { return element.InnerXml; }
+                        set { element.InnerXml = value; }
+                }
+                public string this[string name] {
+                        get {
+                                var child = element[name];
+                                return child == null ? string.Empty : child.InnerXml;
+                        }
+                        set {
+                                var child = element[name];
+                                if (child == null) {
+                                        if (string.IsNullOrEmpty (name))
+                                                return;
+                                        child = document.CreateElement (name);
+                                        element.AppendChild (child);
+                                }
+                                if (string.IsNullOrEmpty (value))
+                                        element.RemoveChild (child);
+                                else
+                                        child.InnerXml = value;
+                        }
+                }
+                internal override void Load (XmlReader reader)
+                {
+                        while (reader.Read () && reader.NodeType != XmlNodeType.Element)
+                                ;
+                        using (XmlReader subReader = reader.ReadSubtree ()) {
+                                document = new XmlDocument ();
+                                document.Load (subReader);
+                                element = document.DocumentElement;
+                        }
+                }
+                internal override void SaveValue (XmlWriter writer)
+                {
+                        element.WriteContentTo (writer);
+                }
+                internal override string XmlName {
+                        get { return "ProjectExtensions"; }
+                }
+                XmlDocument document;
+                XmlElement element;
+        }
+}
diff --git a/mcs/class/Microsoft.Build/Microsoft.Build.Construction/ProjectImportElement.cs b/mcs/class/Microsoft.Build/Microsoft.Build.Construction/ProjectImportElement.cs
new file mode 100644
index 0000000..d824cc7
--- /dev/null
+++ b/mcs/class/Microsoft.Build/Microsoft.Build.Construction/ProjectImportElement.cs
@@ -0,0 +1,72 @@
+//
+// ProjectImportElement.cs
+//
+// Author:
+//   Leszek Ciesielski (skolima at gmail.com)
+//
+// (C) 2011 Leszek Ciesielski
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Xml;
+namespace Microsoft.Build.Construction
+{
+        [System.Diagnostics.DebuggerDisplayAttribute ("Project={Project} Condition={Condition}")]
+        public class ProjectImportElement : ProjectElement
+        {
+                internal ProjectImportElement (string project, ProjectRootElement containingProject)
+                        : this(containingProject)
+                {
+                        Project = project;
+                }
+
+                internal ProjectImportElement (ProjectRootElement containingProject)
+                {
+                        ContainingProject = containingProject;
+                }
+
+                string project;
+                public string Project { get { return project ?? String.Empty; } set { project = value; } }
+
+                internal override string XmlName {
+                        get { return "Import"; }
+                }
+
+                internal override void SaveValue (XmlWriter writer)
+                {
+                        SaveAttribute (writer, "Project", Project);
+                        base.SaveValue (writer);
+                }
+
+                internal override void LoadAttribute (string name, string value)
+                {
+                        switch (name) {
+                        case "Project":
+                                Project = value;
+                                break;
+                        default:
+                                base.LoadAttribute (name, value);
+                                break;
+                        }
+                }
+        }
+}
diff --git a/mcs/class/Microsoft.Build/Microsoft.Build.Construction/ProjectImportGroupElement.cs b/mcs/class/Microsoft.Build/Microsoft.Build.Construction/ProjectImportGroupElement.cs
new file mode 100644
index 0000000..9223b5d
--- /dev/null
+++ b/mcs/class/Microsoft.Build/Microsoft.Build.Construction/ProjectImportGroupElement.cs
@@ -0,0 +1,58 @@
+//
+// ProjectImportGroupElement.cs
+//
+// Author:
+//   Leszek Ciesielski (skolima at gmail.com)
+//
+// (C) 2011 Leszek Ciesielski
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Collections.Generic;
+using Microsoft.Build.Internal;
+
+namespace Microsoft.Build.Construction
+{
+        [System.Diagnostics.DebuggerDisplayAttribute ("#Imports={Count} Condition={Condition} Label={Label}")]
+        public class ProjectImportGroupElement : ProjectElementContainer
+        {
+                internal ProjectImportGroupElement (ProjectRootElement containingProject)
+                {
+                        ContainingProject = containingProject;
+                }
+                public ICollection<ProjectImportElement> Imports {
+                        get { return new CollectionFromEnumerable<ProjectImportElement> (
+                                new FilteredEnumerable<ProjectImportElement> (Children)); }
+                }
+                public ProjectImportElement AddImport (string project)
+                {
+                        var import = ContainingProject.CreateImportElement (project);
+                        AppendChild (import);
+                        return import;
+                }
+                internal override string XmlName { get { return "ImportGroup"; } }
+                internal override ProjectElement LoadChildElement (string name)
+                {
+                        return AddImport (null);
+                }
+        }
+}
diff --git a/mcs/class/Microsoft.Build/Microsoft.Build.Construction/ProjectItemDefinitionElement.cs b/mcs/class/Microsoft.Build/Microsoft.Build.Construction/ProjectItemDefinitionElement.cs
new file mode 100644
index 0000000..283e8b7
--- /dev/null
+++ b/mcs/class/Microsoft.Build/Microsoft.Build.Construction/ProjectItemDefinitionElement.cs
@@ -0,0 +1,64 @@
+//
+// ProjectItemDefinitionElement.cs
+//
+// Author:
+//   Leszek Ciesielski (skolima at gmail.com)
+//
+// (C) 2011 Leszek Ciesielski
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Microsoft.Build.Internal;
+
+namespace Microsoft.Build.Construction
+{
+        [System.Diagnostics.DebuggerDisplayAttribute ("{ItemType} #Metadata={Count} Condition={Condition}")]
+        public class ProjectItemDefinitionElement : ProjectElementContainer
+        {
+                internal ProjectItemDefinitionElement (string itemType, ProjectRootElement containingProject)
+                {
+                        ItemType = itemType;
+                        ContainingProject = containingProject;
+                }
+                public string ItemType { get; private set; }
+                public ICollection<ProjectMetadataElement> Metadata {
+                        get { return new CollectionFromEnumerable<ProjectMetadataElement> (
+                                new FilteredEnumerable<ProjectMetadataElement> (Children)); }
+                }
+                public ProjectMetadataElement AddMetadata (string name, string unevaluatedValue)
+                {
+                        var metadata = ContainingProject.CreateMetadataElement (name);
+                        metadata.Value = unevaluatedValue;
+                        AppendChild (metadata);
+                        return metadata;
+                }
+                internal override string XmlName {
+                        get { return ItemType; }
+                }
+                internal override ProjectElement LoadChildElement (string name)
+                {
+                        return AddMetadata (name, null);
+                }
+        }
+}
diff --git a/mcs/class/Microsoft.Build/Microsoft.Build.Construction/ProjectItemDefinitionGroupElement.cs b/mcs/class/Microsoft.Build/Microsoft.Build.Construction/ProjectItemDefinitionGroupElement.cs
new file mode 100644
index 0000000..43570e8
--- /dev/null
+++ b/mcs/class/Microsoft.Build/Microsoft.Build.Construction/ProjectItemDefinitionGroupElement.cs
@@ -0,0 +1,61 @@
+//
+// ProjectItemDefinitionGroupElement.cs
+//
+// Author:
+//   Leszek Ciesielski (skolima at gmail.com)
+//
+// (C) 2011 Leszek Ciesielski
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Microsoft.Build.Internal;
+
+namespace Microsoft.Build.Construction
+{
+        [System.Diagnostics.DebuggerDisplayAttribute ("#ItemDefinitions={Count} Condition={Condition} Label={Label}")]
+        public class ProjectItemDefinitionGroupElement : ProjectElementContainer
+        {
+                internal ProjectItemDefinitionGroupElement (ProjectRootElement containingProject)
+                {
+                        ContainingProject = containingProject;
+                }
+                public ICollection<ProjectItemDefinitionElement> ItemDefinitions {
+                        get { return new CollectionFromEnumerable<ProjectItemDefinitionElement> (
+                                new FilteredEnumerable<ProjectItemDefinitionElement> (Children)); }
+                }
+                public ProjectItemDefinitionElement AddItemDefinition (string itemType)
+                {
+                        var definition = ContainingProject.CreateItemDefinitionElement (itemType);
+                        AppendChild (definition);
+                        return definition;
+                }
+                internal override string XmlName {
+                        get { return "ItemDefinitionGroup"; }
+                }
+                internal override ProjectElement LoadChildElement (string name)
+                {
+                        return AddItemDefinition (name);
+                }
+        }
+}
diff --git a/mcs/class/Microsoft.Build/Microsoft.Build.Construction/ProjectItemElement.cs b/mcs/class/Microsoft.Build/Microsoft.Build.Construction/ProjectItemElement.cs
new file mode 100644
index 0000000..02a1a6e
--- /dev/null
+++ b/mcs/class/Microsoft.Build/Microsoft.Build.Construction/ProjectItemElement.cs
@@ -0,0 +1,104 @@
+//
+// ProjectItemElementa.cs
+//
+// Author:
+//   Leszek Ciesielski (skolima at gmail.com)
+//
+// (C) 2011 Leszek Ciesielski
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Microsoft.Build.Internal;
+using System.Xml;
+
+namespace Microsoft.Build.Construction
+{
+        [System.Diagnostics.DebuggerDisplayAttribute ("{ItemType} Include={Include} Exclude={Exclude} "
+                                                      + "#Metadata={Count} Condition={Condition}")]
+        public class ProjectItemElement : ProjectElementContainer
+        {
+                internal ProjectItemElement (string itemType, ProjectRootElement containingProject)
+                {
+                        ItemType = itemType;
+                        ContainingProject = containingProject;
+                }
+                string exclude;
+                public string Exclude { get { return exclude ?? String.Empty; } set { exclude = value; } }
+                public bool HasMetadata {
+                        get {
+                                var metadata = Metadata.FirstOrDefault ();
+                                return metadata != null;
+                        }
+                }
+                string include;
+                public string Include { get { return include ?? String.Empty; } set { include = value; } }
+                string itemType;
+                public string ItemType { get { return itemType ?? String.Empty; } set { itemType = value; } }
+                public ICollection<ProjectMetadataElement> Metadata {
+                        get { return new CollectionFromEnumerable<ProjectMetadataElement> (
+                                new FilteredEnumerable<ProjectMetadataElement> (Children)); }
+                }
+                string @remove;
+                public string Remove { get { return @remove ?? String.Empty; } set { @remove = value; } }
+                public ProjectMetadataElement AddMetadata (string name, string unevaluatedValue)
+                {
+                        var metadata = ContainingProject.CreateMetadataElement (name, unevaluatedValue);
+                        AppendChild (metadata);
+                        return metadata;
+                }
+                internal override string XmlName {
+                        get { return ItemType; }
+                }
+                internal override void SaveValue (XmlWriter writer)
+                {
+                        SaveAttribute (writer, "Include", Include);
+                        SaveAttribute (writer, "Exclude", Exclude);
+                        SaveAttribute (writer, "Remove", Remove);
+                        base.SaveValue (writer);
+                }
+                internal override void LoadAttribute (string name, string value)
+                {
+                        switch (name) {
+                        case "Include":
+                                Include = value;
+                                break;
+                        case "Exclude":
+                                Exclude = value;
+                                break;
+                        case "Remove":
+                                Remove = value;
+                                break;
+                        default:
+                                base.LoadAttribute (name, value);
+                                break;
+                        }
+                }
+                internal override ProjectElement LoadChildElement (string name)
+                {
+                        var metadata = ContainingProject.CreateMetadataElement (name);
+                        AppendChild (metadata);
+                        return metadata;
+                }
+        }
+}
diff --git a/mcs/class/Microsoft.Build/Microsoft.Build.Construction/ProjectItemGroupElement.cs b/mcs/class/Microsoft.Build/Microsoft.Build.Construction/ProjectItemGroupElement.cs
new file mode 100644
index 0000000..5cece64
--- /dev/null
+++ b/mcs/class/Microsoft.Build/Microsoft.Build.Construction/ProjectItemGroupElement.cs
@@ -0,0 +1,94 @@
+//
+// ProjectItemGroupElement.cs
+//
+// Author:
+//   Leszek Ciesielski (skolima at gmail.com)
+//
+// (C) 2011 Leszek Ciesielski
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System.Collections.Generic;
+using System.Linq;
+using Microsoft.Build.Internal;
+using System;
+
+namespace Microsoft.Build.Construction
+{
+        [System.Diagnostics.DebuggerDisplayAttribute ("#Items={Count} Condition={Condition} Label={Label}")]
+        public class ProjectItemGroupElement : ProjectElementContainer
+        {
+                public ProjectItemElement AddItem (string itemType, string include)
+                {
+                        return AddItem (itemType, include, null);
+                }
+
+                public ProjectItemElement AddItem (string itemType, string include,
+                                                   IEnumerable<KeyValuePair<string, string>> metadata)
+                {
+                        var item = ContainingProject.CreateItemElement (itemType, include);
+                        if (metadata != null)
+                                foreach (var data in metadata)
+                                        item.AddMetadata (data.Key, data.Value);
+                        var lastChild = LastChild;
+                        foreach (var existingItem in Items) {
+                                var compare = string.Compare (item.ItemType, existingItem.ItemType,
+                                        StringComparison.OrdinalIgnoreCase);
+                                
+                                if (compare == 0) {
+                                        if (string.Compare (item.Include, existingItem.Include,
+                                                StringComparison.OrdinalIgnoreCase) >= 0)
+                                                continue;
+                                        lastChild = existingItem.PreviousSibling;
+                                        break;
+                                }
+                                
+                                if (compare < 0) {
+                                        lastChild = existingItem.PreviousSibling;
+                                        break;
+                                }
+                        }
+                        InsertAfterChild (item, lastChild);
+                        return item;
+                }
+
+                internal ProjectItemGroupElement (ProjectRootElement containingProject)
+                {
+                        ContainingProject = containingProject;
+                }
+
+                public ICollection<ProjectItemElement> Items {
+                        get { return new CollectionFromEnumerable<ProjectItemElement> (
+                                new FilteredEnumerable<ProjectItemElement> (Children)); }
+                }
+
+                internal override string XmlName {
+                        get { return "ItemGroup"; }
+                }
+
+                internal override ProjectElement LoadChildElement (string name)
+                {
+                        var item = ContainingProject.CreateItemElement (name);
+                        AppendChild (item);
+                        return item;
+                }
+        }
+}
diff --git a/mcs/class/Microsoft.Build/Microsoft.Build.Construction/ProjectMetadataElement.cs b/mcs/class/Microsoft.Build/Microsoft.Build.Construction/ProjectMetadataElement.cs
new file mode 100644
index 0000000..797a04d
--- /dev/null
+++ b/mcs/class/Microsoft.Build/Microsoft.Build.Construction/ProjectMetadataElement.cs
@@ -0,0 +1,63 @@
+//
+// ProjectMetadataElement.cs
+//
+// Author:
+//   Leszek Ciesielski (skolima at gmail.com)
+//
+// (C) 2011 Leszek Ciesielski
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Collections.Generic;
+using System.Xml;
+
+namespace Microsoft.Build.Construction
+{
+        [System.Diagnostics.DebuggerDisplayAttribute ("{Name} Value={Value} Condition={Condition}")]
+        public class ProjectMetadataElement : ProjectElement
+        {
+                internal ProjectMetadataElement (string name, ProjectRootElement containingProject)
+                {
+                        Name = name;
+                        ContainingProject = containingProject;
+                }
+                string name;
+                public string Name { get { return name ?? String.Empty; } set { name = value; } }
+                string internalValue;
+                public string Value { get { return internalValue ?? String.Empty; } set { internalValue = value; } }
+                internal override string XmlName {
+                        get { return Name; }
+                }
+                internal override void SaveValue (XmlWriter writer)
+                {
+                        base.SaveValue (writer);
+                        if (!string.IsNullOrWhiteSpace (Value))
+                                writer.WriteValue (Value);
+                }
+                internal override void LoadValue (XmlReader reader)
+                {
+                        while (reader.Read () & reader.NodeType != XmlNodeType.Text)
+                                ;
+                        Value = reader.Value;
+                }
+        }
+}
diff --git a/mcs/class/Microsoft.Build/Microsoft.Build.Construction/ProjectOnErrorElement.cs b/mcs/class/Microsoft.Build/Microsoft.Build.Construction/ProjectOnErrorElement.cs
new file mode 100644
index 0000000..5d6b75a
--- /dev/null
+++ b/mcs/class/Microsoft.Build/Microsoft.Build.Construction/ProjectOnErrorElement.cs
@@ -0,0 +1,65 @@
+//
+// ProjectOnErrorElement.cs
+//
+// Author:
+//   Leszek Ciesielski (skolima at gmail.com)
+//
+// (C) 2011 Leszek Ciesielski
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System.Xml;
+namespace Microsoft.Build.Construction
+{
+        [System.Diagnostics.DebuggerDisplayAttribute ("ExecuteTargets={ExecuteTargets}")]
+        public class ProjectOnErrorElement : ProjectElement
+        {
+                internal ProjectOnErrorElement (string executeTargets, ProjectRootElement containingProject)
+                        : this(containingProject)
+                {
+                        ExecuteTargetsAttribute = executeTargets;
+                }
+                internal ProjectOnErrorElement (ProjectRootElement containingProject)
+                {
+                        ContainingProject = containingProject;
+                }
+                public string ExecuteTargetsAttribute { get; set; }
+                internal override string XmlName {
+                        get { return "OnError"; }
+                }
+                internal override void SaveValue (XmlWriter writer)
+                {
+                        base.SaveValue (writer);
+                        SaveAttribute (writer, "ExecuteTargets", ExecuteTargetsAttribute);
+                }
+                internal override void LoadAttribute (string name, string value)
+                {
+                        switch (name) {
+                        case "ExecuteTargets":
+                                ExecuteTargetsAttribute = value;
+                                break;
+                        default:
+                                base.LoadAttribute (name, value);
+                                break;
+                        }
+                }
+        }
+}
diff --git a/mcs/class/Microsoft.Build/Microsoft.Build.Construction/ProjectOtherwiseElement.cs b/mcs/class/Microsoft.Build/Microsoft.Build.Construction/ProjectOtherwiseElement.cs
new file mode 100644
index 0000000..9c25e50
--- /dev/null
+++ b/mcs/class/Microsoft.Build/Microsoft.Build.Construction/ProjectOtherwiseElement.cs
@@ -0,0 +1,86 @@
+//
+// ProjectOtherwiseElement.cs
+//
+// Author:
+//   Leszek Ciesielski (skolima at gmail.com)
+//
+// (C) 2011 Leszek Ciesielski
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System.Collections.Generic;
+using System;
+using System.Linq;
+using Microsoft.Build.Exceptions;
+using Microsoft.Build.Internal;
+
+namespace Microsoft.Build.Construction
+{
+        [System.Diagnostics.DebuggerDisplayAttribute ("#Children={Count}")]
+        public class ProjectOtherwiseElement : ProjectElementContainer
+        {
+                internal ProjectOtherwiseElement (ProjectRootElement containingProject)
+                {
+                        ContainingProject = containingProject;
+                }
+                public ICollection<ProjectChooseElement> ChooseElements {
+                        get { return new CollectionFromEnumerable<ProjectChooseElement> (
+                                new FilteredEnumerable<ProjectChooseElement> (Children)); }
+                }
+                public override string Condition {
+                        get { return null; }
+                        set {
+                                throw new InvalidOperationException ("Can not set Condition.");
+                        }
+                }
+                public ICollection<ProjectItemGroupElement> ItemGroups {
+                        get { return new CollectionFromEnumerable<ProjectItemGroupElement> (
+                                new FilteredEnumerable<ProjectItemGroupElement> (Children)); }
+                }
+                public ICollection<ProjectPropertyGroupElement> PropertyGroups {
+                        get { return new CollectionFromEnumerable<ProjectPropertyGroupElement> (
+                                new FilteredEnumerable<ProjectPropertyGroupElement> (Children)); }
+                }
+                internal override string XmlName {
+                        get { return "Otherwise"; }
+                }
+                internal override ProjectElement LoadChildElement (string name)
+                {
+                        switch (name) {
+                        case "PropertyGroup":
+                                var property = ContainingProject.CreatePropertyGroupElement ();
+                                AppendChild (property);
+                                return property;
+                        case "ItemGroup":
+                                var item = ContainingProject.CreateItemGroupElement ();
+                                AppendChild (item);
+                                return item;
+                        case "When":
+                                var when = ContainingProject.CreateWhenElement (null);
+                                AppendChild (when);
+                                return when;
+                        default:
+                                throw new InvalidProjectFileException (string.Format (
+                                        "Child \"{0}\" is not a known node type.", name));
+                        }
+                }
+        }
+}
diff --git a/mcs/class/Microsoft.Build/Microsoft.Build.Construction/ProjectOutputElement.cs b/mcs/class/Microsoft.Build/Microsoft.Build.Construction/ProjectOutputElement.cs
new file mode 100644
index 0000000..bb56937
--- /dev/null
+++ b/mcs/class/Microsoft.Build/Microsoft.Build.Construction/ProjectOutputElement.cs
@@ -0,0 +1,90 @@
+//
+// ProjectOutputElement.cs
+//
+// Author:
+//   Leszek Ciesielski (skolima at gmail.com)
+//
+// (C) 2011 Leszek Ciesielski
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Xml;
+namespace Microsoft.Build.Construction
+{
+        [System.Diagnostics.DebuggerDisplayAttribute ("Name={Name} TaskParameter={TaskParameter} ItemName={ItemName} "
+                                                      + "PropertyName={PropertyName} Condition={Condition}")]
+        public class ProjectOutputElement : ProjectElement
+        {
+                internal ProjectOutputElement (string taskParameter, string itemType, string propertyName,
+                                               ProjectRootElement containintProject)
+                {
+                        TaskParameter = taskParameter;
+                        ItemType = itemType;
+                        PropertyName = propertyName;
+                        ContainingProject = containintProject;
+                }
+                public bool IsOutputItem {
+                        get { return !String.IsNullOrWhiteSpace(itemType); }
+                }
+                public bool IsOutputProperty {
+                        get { return !String.IsNullOrWhiteSpace(propertyName); }
+                }
+                string itemType;
+                public string ItemType { get { return itemType ?? String.Empty; } set { itemType = value; } }
+                string propertyName;
+                public string PropertyName { get { return propertyName ?? String.Empty; } set { propertyName = value; } }
+                string taskParameter;
+                public string TaskParameter {
+                        get { return taskParameter ?? String.Empty; }
+                        set { taskParameter = value; }
+                }
+                internal override string XmlName {
+                        get { return "Output"; }
+                }
+                internal override void SaveValue (XmlWriter writer)
+                {
+                        base.SaveValue (writer);
+                        SaveAttribute (writer, "TaskParameter", TaskParameter);
+                        if (IsOutputProperty)
+                                SaveAttribute (writer, "PropertyName", PropertyName);
+                        else
+                                SaveAttribute (writer, "ItemName", ItemType);
+                }
+                internal override void LoadAttribute (string name, string value)
+                {
+                        switch (name) {
+                        case "TaskParameter":
+                                TaskParameter = value;
+                                break;
+                        case "PropertyName":
+                                PropertyName = value;
+                                break;
+                        case "ItemName":
+                                ItemType = value;
+                                break;
+                        default:
+                                base.LoadAttribute (name, value);
+                                break;
+                        }
+                }
+        }
+}
diff --git a/mcs/class/Microsoft.Build/Microsoft.Build.Construction/ProjectPropertyElement.cs b/mcs/class/Microsoft.Build/Microsoft.Build.Construction/ProjectPropertyElement.cs
new file mode 100644
index 0000000..27cba95
--- /dev/null
+++ b/mcs/class/Microsoft.Build/Microsoft.Build.Construction/ProjectPropertyElement.cs
@@ -0,0 +1,61 @@
+//
+// ProjectPropertyElement.cs
+//
+// Author:
+//   Leszek Ciesielski (skolima at gmail.com)
+//
+// (C) 2011 Leszek Ciesielski
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Xml;
+namespace Microsoft.Build.Construction
+{
+        [System.Diagnostics.DebuggerDisplayAttribute ("{Name} Value={Value} Condition={Condition}")]
+        public class ProjectPropertyElement : ProjectElement
+        {
+                string name;
+                public string Name { get { return name ?? String.Empty; } set { name = value; } }
+                string internalValue;
+                public string Value { get { return internalValue ?? String.Empty; } set { internalValue = value; } }
+                internal ProjectPropertyElement (string name, ProjectRootElement containingProject)
+                {
+                        Name = name;
+                        ContainingProject = containingProject;
+                }
+                internal override string XmlName {
+                        get { return Name; }
+                }
+                internal override void SaveValue (XmlWriter writer)
+                {
+                        base.SaveValue (writer);
+                        if (!string.IsNullOrWhiteSpace (Value))
+                                writer.WriteValue (Value);
+                }
+                internal override void LoadValue (XmlReader reader)
+                {
+                        while (reader.Read () & reader.NodeType != XmlNodeType.Text)
+                                ;
+                        Value = reader.Value;
+                }
+        }
+}
diff --git a/mcs/class/Microsoft.Build/Microsoft.Build.Construction/ProjectPropertyGroupElement.cs b/mcs/class/Microsoft.Build/Microsoft.Build.Construction/ProjectPropertyGroupElement.cs
new file mode 100644
index 0000000..0050ff5
--- /dev/null
+++ b/mcs/class/Microsoft.Build/Microsoft.Build.Construction/ProjectPropertyGroupElement.cs
@@ -0,0 +1,84 @@
+//
+// ProjectPropertyGroupElement.cs
+//
+// Author:
+//   Leszek Ciesielski (skolima at gmail.com)
+//
+// (C) 2011 Leszek Ciesielski
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Microsoft.Build.Internal;
+using System.Xml;
+
+namespace Microsoft.Build.Construction
+{
+        [System.Diagnostics.DebuggerDisplayAttribute ("#Properties={Count} Condition={Condition} Label={Label}")]
+        public class ProjectPropertyGroupElement : ProjectElementContainer
+        {
+                public ProjectPropertyElement AddProperty (string name, string unevaluatedValue)
+                {
+                        var property = ContainingProject.CreatePropertyElement (name);
+                        property.Value = unevaluatedValue;
+                        AppendChild (property);
+                        return property;
+                }
+
+                public ProjectPropertyElement SetProperty (string name, string unevaluatedValue)
+                {
+                        var existing = Properties.Where (p => p.Name.Equals (name, StringComparison.OrdinalIgnoreCase)
+                                                         && p.Condition.Length == 0).FirstOrDefault ();
+                        if (existing != null) {
+                                existing.Value = unevaluatedValue;
+                                return existing;
+                        }
+                        
+                        return AddProperty (name, unevaluatedValue);
+                }
+
+                internal ProjectPropertyGroupElement (ProjectRootElement containingProject)
+                {
+                        ContainingProject = containingProject;
+                }
+
+                public ICollection<ProjectPropertyElement> Properties {
+                        get { return new CollectionFromEnumerable<ProjectPropertyElement> (
+                                new FilteredEnumerable<ProjectPropertyElement> (Children)); }
+                }
+
+                public ICollection<ProjectPropertyElement> PropertiesReversed {
+                        get { return new CollectionFromEnumerable<ProjectPropertyElement> (
+                                new FilteredEnumerable<ProjectPropertyElement> (ChildrenReversed)); }
+                }
+
+                internal override string XmlName {
+                        get { return "PropertyGroup"; }
+                }
+
+                internal override ProjectElement LoadChildElement (string name)
+                {
+                        return AddProperty (name, null);
+                }
+        }
+}
diff --git a/mcs/class/Microsoft.Build/Microsoft.Build.Construction/ProjectRootElement.cs b/mcs/class/Microsoft.Build/Microsoft.Build.Construction/ProjectRootElement.cs
new file mode 100644
index 0000000..ddbed1f
--- /dev/null
+++ b/mcs/class/Microsoft.Build/Microsoft.Build.Construction/ProjectRootElement.cs
@@ -0,0 +1,593 @@
+//
+// ProjectRootElement.cs
+//
+// Author:
+//   Leszek Ciesielski (skolima at gmail.com)
+//
+// (C) 2011 Leszek Ciesielski
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System.Collections.Generic;
+
+using Microsoft.Build.Evaluation;
+using Microsoft.Build.Internal;
+using System.Text;
+using System;
+using System.Xml;
+using System.IO;
+using System.Linq;
+using System.Globalization;
+using Microsoft.Build.Exceptions;
+
+namespace Microsoft.Build.Construction
+{
+        [System.Diagnostics.DebuggerDisplayAttribute("{FullPath} #Children={Count} DefaultTargets={DefaultTargets} "
+                                                     + "ToolsVersion={ToolsVersion} InitialTargets={InitialTargets}")]
+        public class ProjectRootElement : ProjectElementContainer
+        {
+                public override string Condition { get { return null; } set { throw new InvalidOperationException (
+                        "Can not set Condition."); } }
+                string defaultTargets;
+                public string DefaultTargets {
+                        get { return defaultTargets ?? String.Empty; }
+                        set { defaultTargets = value; }
+                }
+
+                string fullPath;
+                public string FullPath {
+                        get { return fullPath; }
+                        set {
+                                fullPath = Path.GetFullPath (value);
+                                DirectoryPath = Path.GetDirectoryName (fullPath);
+                        }
+                }
+
+                string directoryPath;
+                public string DirectoryPath {
+                        get { return directoryPath ?? String.Empty; }
+                        internal set { directoryPath = value; }
+                }
+
+                public ICollection<ProjectPropertyElement> Properties {
+                        get { return new CollectionFromEnumerable<ProjectPropertyElement> (
+                                new FilteredEnumerable<ProjectPropertyElement> (AllChildren)); }
+                }
+
+                public ICollection<ProjectChooseElement> ChooseElements {
+                        get { return new CollectionFromEnumerable<ProjectChooseElement> (
+                                new FilteredEnumerable<ProjectChooseElement> (Children)); }
+                }
+
+                public Encoding Encoding {
+                        get { return Encoding.UTF8; }
+                }
+
+                public bool HasUnsavedChanges {
+                        get { return true; }
+                }
+
+                public ICollection<ProjectImportGroupElement> ImportGroups {
+                        get { return new CollectionFromEnumerable<ProjectImportGroupElement> (
+                                new FilteredEnumerable<ProjectImportGroupElement> (Children)); }
+                }
+
+                public ICollection<ProjectImportGroupElement> ImportGroupsReversed {
+                        get { return new CollectionFromEnumerable<ProjectImportGroupElement> (
+                                new FilteredEnumerable<ProjectImportGroupElement> (ChildrenReversed)); }
+                }
+
+                public ICollection<ProjectImportElement> Imports {
+                        get { return new CollectionFromEnumerable<ProjectImportElement> (
+                                new FilteredEnumerable<ProjectImportElement> (AllChildren)); }
+                }
+
+                string initialTargets;
+                public string InitialTargets {
+                        get { return initialTargets ?? String.Empty; }
+                        set { initialTargets = value; }
+                }
+
+                public ICollection<ProjectItemDefinitionGroupElement> ItemDefinitionGroups {
+                        get { return new CollectionFromEnumerable<ProjectItemDefinitionGroupElement> (
+                                new FilteredEnumerable<ProjectItemDefinitionGroupElement> (Children)); }
+                }
+
+                public ICollection<ProjectItemDefinitionGroupElement> ItemDefinitionGroupsReversed {
+                        get { return new CollectionFromEnumerable<ProjectItemDefinitionGroupElement> (
+                                new FilteredEnumerable<ProjectItemDefinitionGroupElement> (ChildrenReversed)); }
+                }
+
+                public ICollection<ProjectItemDefinitionElement> ItemDefinitions {
+                        get { return new CollectionFromEnumerable<ProjectItemDefinitionElement> (
+                                new FilteredEnumerable<ProjectItemDefinitionElement> (AllChildren)); }
+                }
+
+                public ICollection<ProjectItemGroupElement> ItemGroups {
+                        get { return new CollectionFromEnumerable<ProjectItemGroupElement> (
+                                new FilteredEnumerable<ProjectItemGroupElement> (Children)); }
+                }
+
+                public ICollection<ProjectItemGroupElement> ItemGroupsReversed {
+                        get { return new CollectionFromEnumerable<ProjectItemGroupElement> (
+                                new FilteredEnumerable<ProjectItemGroupElement> (ChildrenReversed)); }
+                }
+
+                public ICollection<ProjectItemElement> Items {
+                        get { return new CollectionFromEnumerable<ProjectItemElement> (
+                                new FilteredEnumerable<ProjectItemElement> (AllChildren)); }
+                }
+
+                public DateTime LastWriteTimeWhenRead {
+                        get { return DateTime.MinValue; }
+                }
+
+                public ICollection<ProjectPropertyGroupElement> PropertyGroups {
+                        get { return new CollectionFromEnumerable<ProjectPropertyGroupElement> (
+                                new FilteredEnumerable<ProjectPropertyGroupElement> (Children)); }
+                }
+
+                public ICollection<ProjectPropertyGroupElement> PropertyGroupsReversed {
+                        get { return new CollectionFromEnumerable<ProjectPropertyGroupElement> (
+                                new FilteredEnumerable<ProjectPropertyGroupElement> (ChildrenReversed)); }
+                }
+
+                public string RawXml {
+                        get {
+                                using (var writer = new StringWriter (CultureInfo.InvariantCulture)) {
+                                        Save (writer);
+                                        return writer.ToString ();
+                                }
+                        }
+                }
+
+                public ICollection<ProjectTargetElement> Targets {
+                        get { return new CollectionFromEnumerable<ProjectTargetElement> (
+                                new FilteredEnumerable<ProjectTargetElement> (Children)); }
+                }
+
+                public DateTime TimeLastChanged {
+                        get { return DateTime.Now; }
+                }
+
+                string toolsVersion;
+                public string ToolsVersion {
+                        get { return toolsVersion ?? "4.0"; }
+                        set { toolsVersion = value; }
+                }
+
+                public ICollection<ProjectUsingTaskElement> UsingTasks {
+                        get { return new CollectionFromEnumerable<ProjectUsingTaskElement> (
+                                new FilteredEnumerable<ProjectUsingTaskElement> (Children)); }
+                }
+
+                public int Version {
+                        get { return 0; }
+                }
+
+                ProjectRootElement (ProjectCollection projectCollection)
+                {
+                }
+
+                public static ProjectRootElement Create ()
+                {
+                        return Create (ProjectCollection.GlobalProjectCollection);
+                }
+
+                public static ProjectRootElement Create (ProjectCollection projectCollection)
+                {
+                        return new ProjectRootElement (projectCollection);
+                }
+
+                public static ProjectRootElement Create (string path)
+                {
+                        return Create (path, ProjectCollection.GlobalProjectCollection);
+                }
+
+                public static ProjectRootElement Create (XmlReader xmlReader)
+                {
+                        return Create (xmlReader, ProjectCollection.GlobalProjectCollection);
+                }
+
+                public static ProjectRootElement Create (string path, ProjectCollection projectCollection)
+                {
+                        var result = Create (projectCollection);
+                        result.FullPath = path;
+                        return result;
+                }
+
+                public static ProjectRootElement Create (XmlReader xmlReader, ProjectCollection projectCollection)
+                {
+                        // yes, this should create en empty project
+                        var result = Create (projectCollection);
+                        return result;
+                }
+
+                public ProjectImportElement AddImport (string project)
+                {
+                        var import = CreateImportElement (project);
+                        AppendChild (import);
+                        return import;
+                }
+
+                public ProjectImportGroupElement AddImportGroup ()
+                {
+                        var importGroup = CreateImportGroupElement ();
+                        AppendChild (importGroup);
+                        return importGroup;
+                }
+
+                public ProjectItemElement AddItem (string itemType, string include)
+                {
+                        return AddItem (itemType, include, null);
+                }
+
+                public ProjectItemElement AddItem (string itemType, string include,
+                                                   IEnumerable<KeyValuePair<string, string>> metadata)
+                {
+                        var @group = ItemGroups.
+                                Where (p => string.IsNullOrEmpty (p.Condition)
+                                       && p.Items.Where (s => s.ItemType.Equals (itemType,
+                                                StringComparison.OrdinalIgnoreCase)).FirstOrDefault () != null).
+                                        FirstOrDefault ();
+                        if (@group == null)
+                                @group = AddItemGroup ();
+                        return @group.AddItem (itemType, include, metadata);
+                }
+
+                public ProjectItemDefinitionElement AddItemDefinition (string itemType)
+                {
+                        var @group = ItemDefinitionGroups.
+                                Where (p => string.IsNullOrEmpty (p.Condition)
+                                       && p.ItemDefinitions.Where (s => s.ItemType.Equals (itemType,
+                                                StringComparison.OrdinalIgnoreCase)).FirstOrDefault () != null).
+                                        FirstOrDefault ();
+                        if (@group == null)
+                                @group = AddItemDefinitionGroup ();
+                        return @group.AddItemDefinition (itemType);
+                }
+
+                public ProjectItemDefinitionGroupElement AddItemDefinitionGroup ()
+                {
+                        var @group = CreateItemDefinitionGroupElement ();
+                        ProjectElementContainer last = ItemDefinitionGroupsReversed.FirstOrDefault ();
+                        if (last == null)
+                                last = PropertyGroupsReversed.FirstOrDefault ();
+                        InsertAfterChild (@group, last);
+                        return @group;
+                }
+
+                public ProjectItemGroupElement AddItemGroup ()
+                {
+                        var @group = CreateItemGroupElement ();
+                        ProjectElementContainer last = ItemGroupsReversed.FirstOrDefault ();
+                        if (last == null)
+                                last = PropertyGroupsReversed.FirstOrDefault ();
+                        InsertAfterChild (@group, last);
+                        return @group;
+                }
+
+                public ProjectPropertyElement AddProperty (string name, string value)
+                {
+                        ProjectPropertyGroupElement parentGroup = null;
+                        foreach (var @group in PropertyGroups) {
+                                if (string.IsNullOrEmpty (@group.Condition)) {
+                                        if (parentGroup == null)
+                                                parentGroup = @group;
+                                        var property = @group.Properties.
+                                                Where (p => string.IsNullOrEmpty (p.Condition)
+                                                       && p.Name.Equals (name, StringComparison.OrdinalIgnoreCase)).
+                                                        FirstOrDefault ();
+                                        if (property != null) {
+                                                property.Value = value;
+                                                return property;
+                                        }
+                                }
+                        }
+                        if (parentGroup == null)
+                                parentGroup = AddPropertyGroup ();
+                        return parentGroup.AddProperty (name, value);
+                }
+
+                public ProjectPropertyGroupElement AddPropertyGroup ()
+                {
+                        var @group = CreatePropertyGroupElement ();
+                        var last = PropertyGroupsReversed.FirstOrDefault ();
+                        InsertAfterChild (@group, last);
+                        return @group;
+                }
+
+                public ProjectTargetElement AddTarget (string name)
+                {
+                        var target = CreateTargetElement (name);
+                        AppendChild (target);
+                        return target;
+                }
+
+                public ProjectUsingTaskElement AddUsingTask (string name, string assemblyFile, string assemblyName)
+                {
+                        var usingTask = CreateUsingTaskElement (name, assemblyFile, assemblyName);
+                        AppendChild (usingTask);
+                        return usingTask;
+                }
+
+                public ProjectChooseElement CreateChooseElement ()
+                {
+                        return new ProjectChooseElement (this);
+                }
+
+                public ProjectImportElement CreateImportElement (string project)
+                {
+                        return new ProjectImportElement (project, this);
+                }
+
+                public ProjectImportGroupElement CreateImportGroupElement ()
+                {
+                        return new ProjectImportGroupElement (this);
+                }
+
+                public ProjectItemDefinitionElement CreateItemDefinitionElement (string itemType)
+                {
+                        return new ProjectItemDefinitionElement (itemType, this);
+                }
+
+                public ProjectItemDefinitionGroupElement CreateItemDefinitionGroupElement ()
+                {
+                        return new ProjectItemDefinitionGroupElement (this);
+                }
+
+                public ProjectItemElement CreateItemElement (string itemType)
+                {
+                        return new ProjectItemElement (itemType, this);
+                }
+
+                public ProjectItemElement CreateItemElement (string itemType, string include)
+                {
+                        var item = CreateItemElement (itemType);
+                        item.Include = include;
+                        return item;
+                }
+
+                public ProjectItemGroupElement CreateItemGroupElement ()
+                {
+                        return new ProjectItemGroupElement (this);
+                }
+
+                public ProjectMetadataElement CreateMetadataElement (string name)
+                {
+                        return new ProjectMetadataElement (name, this);
+                }
+
+                public ProjectMetadataElement CreateMetadataElement (string name, string unevaluatedValue)
+                {
+                        var metadata = CreateMetadataElement (name);
+                        metadata.Value = unevaluatedValue;
+                        return metadata;
+                }
+
+                public ProjectOnErrorElement CreateOnErrorElement (string executeTargets)
+                {
+                        return new ProjectOnErrorElement (executeTargets, this);
+                }
+
+                public ProjectOtherwiseElement CreateOtherwiseElement ()
+                {
+                        return new ProjectOtherwiseElement (this);
+                }
+
+                public ProjectOutputElement CreateOutputElement (string taskParameter, string itemType,
+                                                                 string propertyName)
+                {
+                        return new ProjectOutputElement (taskParameter, itemType, propertyName, this);
+                }
+
+                public ProjectExtensionsElement CreateProjectExtensionsElement ()
+                {
+                        return new ProjectExtensionsElement (this);
+                }
+
+                public ProjectPropertyElement CreatePropertyElement (string name)
+                {
+                        return new ProjectPropertyElement (name, this);
+                }
+
+                public ProjectPropertyGroupElement CreatePropertyGroupElement ()
+                {
+                        return new ProjectPropertyGroupElement (this);
+                }
+
+                public ProjectTargetElement CreateTargetElement (string name)
+                {
+                        return new ProjectTargetElement (name, this);
+                }
+
+                public ProjectTaskElement CreateTaskElement (string name)
+                {
+                        return new ProjectTaskElement (name, this);
+                }
+
+                public ProjectUsingTaskBodyElement CreateUsingTaskBodyElement (string evaluate, string body)
+                {
+                        return new ProjectUsingTaskBodyElement (evaluate, body, this);
+                }
+
+                public ProjectUsingTaskElement CreateUsingTaskElement (string taskName, string assemblyFile,
+                                                                       string assemblyName)
+                {
+                        return new ProjectUsingTaskElement (taskName, assemblyFile, assemblyName, this);
+                }
+
+                public ProjectUsingTaskParameterElement CreateUsingTaskParameterElement (string name, string output,
+                                                                                         string required,
+                                                                                         string parameterType)
+                {
+                        return new ProjectUsingTaskParameterElement (name, output, required, parameterType, this);
+                }
+
+                public UsingTaskParameterGroupElement CreateUsingTaskParameterGroupElement ()
+                {
+                        return new UsingTaskParameterGroupElement (this);
+                }
+
+                public ProjectWhenElement CreateWhenElement (string condition)
+                {
+                        return new ProjectWhenElement (condition, this);
+                }
+
+                public static ProjectRootElement Open (string path)
+                {
+                        return Open (path, ProjectCollection.GlobalProjectCollection);
+                }
+
+                public static ProjectRootElement Open (string path, ProjectCollection projectCollection)
+                {
+                        var result = Create (path, projectCollection);
+                        using (var reader = XmlReader.Create (path))
+                                result.Load (reader);
+                        return result;
+                }
+
+                public void Save ()
+                {
+                        Save (Encoding);
+                }
+
+                public void Save (Encoding saveEncoding)
+                {
+                        using (var writer = new StreamWriter (File.Create (FullPath), saveEncoding)) {
+                                Save (writer);
+                        }
+                }
+
+                public void Save (string path)
+                {
+                        Save (path, Encoding);
+                }
+
+                public void Save (TextWriter writer)
+                {
+                        using (var xmlWriter = XmlWriter.Create (writer, new XmlWriterSettings { Indent = true,
+                                NewLineChars = "\r\n" })) {
+                                Save (xmlWriter);
+                        }
+                }
+
+                public void Save (string path, Encoding encoding)
+                {
+                        FullPath = path;
+                        Save (encoding);
+                }
+
+                public static ProjectRootElement TryOpen (string path)
+                {
+                        return TryOpen (path, ProjectCollection.GlobalProjectCollection);
+                }
+
+                public static ProjectRootElement TryOpen (string path, ProjectCollection projectCollection)
+                {
+                        // this should be non-null only if the project is already cached
+                        // and caching is not yet implemented
+                        return null;
+                }
+
+                internal override void Load (XmlReader reader)
+                {
+                        try {
+                                base.Load (reader);
+                        } catch (XmlException ex) {
+                                throw new InvalidProjectFileException (FullPath, ex.LineNumber, ex.LinePosition, 0, 0,
+                                        ex.Message, null, null, null);
+                        }
+                }
+
+                internal override ProjectElement LoadChildElement (string name)
+                {
+                        switch (name) {
+                        case "PropertyGroup":
+                                var prop = CreatePropertyGroupElement ();
+                                AppendChild (prop);
+                                return prop;
+                        case "ItemGroup":
+                                var item = CreateItemGroupElement ();
+                                AppendChild (item);
+                                return item;
+                        case "Import":
+                                return AddImport (null);
+                        case "Target":
+                                return AddTarget (null);
+                        case "ItemDefinitionGroup":
+                                var def = CreateItemDefinitionGroupElement ();
+                                AppendChild (def);
+                                return def;
+                        case "UsingTask":
+                                return AddUsingTask (null, null, null);
+                        case "Choose":
+                                var choose = CreateChooseElement ();
+                                AppendChild (choose);
+                                return choose;
+                        case "ProjectExtensions":
+                                var ext = CreateProjectExtensionsElement ();
+                                AppendChild (ext);
+                                return ext;
+                        default:
+                                throw new InvalidProjectFileException (string.Format (
+                                        "Child \"{0}\" is not a known node type.", name));
+                        }
+                }
+
+                internal override void LoadAttribute (string name, string value)
+                {
+                        switch (name) {
+                        case "ToolsVersion":
+                                ToolsVersion = value;
+                                break;
+                        case "DefaultTargets":
+                                DefaultTargets = value;
+                                break;
+                        case "InitialTargets":
+                                InitialTargets = value;
+                                break;
+                        default:
+                                base.LoadAttribute (name, value);
+                                break;
+                        }
+                }
+
+                internal override void Save (XmlWriter writer)
+                {
+                        writer.WriteStartElement (XmlName, "http://schemas.microsoft.com/developer/msbuild/2003");
+                        SaveValue (writer);
+                        writer.WriteEndElement ();
+                }
+
+                internal override void SaveValue (XmlWriter writer)
+                {
+                        SaveAttribute (writer, "ToolsVersion", ToolsVersion);
+                        SaveAttribute (writer, "DefaultTargets", DefaultTargets);
+                        SaveAttribute (writer, "InitialTargets", InitialTargets);
+                        base.SaveValue (writer);
+                }
+
+                internal override string XmlName {
+                        get { return "Project"; }
+                }
+        }
+}
diff --git a/mcs/class/Microsoft.Build/Microsoft.Build.Construction/ProjectTargetElement.cs b/mcs/class/Microsoft.Build/Microsoft.Build.Construction/ProjectTargetElement.cs
new file mode 100644
index 0000000..66129eb
--- /dev/null
+++ b/mcs/class/Microsoft.Build/Microsoft.Build.Construction/ProjectTargetElement.cs
@@ -0,0 +1,174 @@
+//
+// ProjectTargetElement.cs
+//
+// Author:
+//   Leszek Ciesielski (skolima at gmail.com)
+//
+// (C) 2011 Leszek Ciesielski
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Microsoft.Build.Internal;
+
+namespace Microsoft.Build.Construction
+{
+        [System.Diagnostics.DebuggerDisplayAttribute ("Name={Name} #Children={Count} Condition={Condition}")]
+        public class ProjectTargetElement : ProjectElementContainer
+        {
+                internal ProjectTargetElement (string name, ProjectRootElement containingProject)
+                        : this(containingProject)
+                {
+                        Name = name;
+                }
+                internal ProjectTargetElement (ProjectRootElement containingProject)
+                {
+                        ContainingProject = containingProject;
+                }
+                string afterTargets;
+                public string AfterTargets {
+                        get { return afterTargets ?? String.Empty; }
+                        set { afterTargets = value; }
+                }
+                string beforeTargets;
+                public string BeforeTargets {
+                        get { return beforeTargets ?? String.Empty; }
+                        set { beforeTargets = value; }
+                }
+                string dependsOnTargets;
+                public string DependsOnTargets {
+                        get { return dependsOnTargets ?? String.Empty; }
+                        set { dependsOnTargets = value; }
+                }
+                string inputs;
+                public string Inputs { get { return inputs ?? String.Empty; } set { inputs = value; } }
+                public ICollection<ProjectItemGroupElement> ItemGroups {
+                        get { return new CollectionFromEnumerable<ProjectItemGroupElement> (
+                                new FilteredEnumerable<ProjectItemGroupElement> (Children)); }
+                }
+                string keepDuplicateOutputs;
+                public string KeepDuplicateOutputs {
+                        get { return keepDuplicateOutputs ?? String.Empty; }
+                        set { keepDuplicateOutputs = value; }
+                }
+                string name;
+                public string Name { get { return name ?? String.Empty; } set { name = value; } }
+                public ICollection<ProjectOnErrorElement> OnErrors {
+                        get { return new CollectionFromEnumerable<ProjectOnErrorElement> (
+                                new FilteredEnumerable<ProjectOnErrorElement> (Children)); }
+                }
+                string outputs;
+                public string Outputs { get { return outputs ?? String.Empty; } set { outputs = value; } }
+                public ICollection<ProjectPropertyGroupElement> PropertyGroups {
+                        get { return new CollectionFromEnumerable<ProjectPropertyGroupElement> (
+                                new FilteredEnumerable<ProjectPropertyGroupElement> (Children)); }
+                }
+                string returns;
+                public string Returns { get { return returns ?? String.Empty; } set { returns = value; } }
+                public ICollection<ProjectTaskElement> Tasks {
+                        get { return new CollectionFromEnumerable<ProjectTaskElement> (
+                                new FilteredEnumerable<ProjectTaskElement> (Children)); }
+                }
+                public ProjectItemGroupElement AddItemGroup ()
+                {
+                        var item = ContainingProject.CreateItemGroupElement ();
+                        AppendChild (item);
+                        return item;
+                }
+                public ProjectPropertyGroupElement AddPropertyGroup ()
+                {
+                        var property = ContainingProject.CreatePropertyGroupElement ();
+                        AppendChild (property);
+                        return property;
+                }
+                public ProjectTaskElement AddTask (string taskName)
+                {
+                        var task = ContainingProject.CreateTaskElement (taskName);
+                        AppendChild (task);
+                        return task;
+                }
+                internal override string XmlName {
+                        get { return "Target"; }
+                }
+
+                internal override ProjectElement LoadChildElement (string name)
+                {
+                        switch (name) {
+                        case "OnError":
+                                var error = new ProjectOnErrorElement (ContainingProject);
+                                AppendChild (error);
+                                return error;
+                        case "PropertyGroup":
+                                return AddPropertyGroup ();
+                        case "ItemGroup":
+                                return AddItemGroup ();
+                        default:
+                                return AddTask (name);
+                        }
+                }
+                internal override void LoadAttribute (string name, string value)
+                {
+                        switch (name) {
+                        case "Name":
+                                Name = value;
+                                break;
+                        case "DependsOnTargets":
+                                DependsOnTargets = value;
+                                break;
+                        case "Returns":
+                                Returns = value;
+                                break;
+                        case "Inputs":
+                                Inputs = value;
+                                break;
+                        case "Outputs":
+                                Outputs = value;
+                                break;
+                        case "BeforeTargets":
+                                BeforeTargets = value;
+                                break;
+                        case "AfterTargets":
+                                AfterTargets = value;
+                                break;
+                        case "KeepDuplicateOutputs":
+                                KeepDuplicateOutputs = value;
+                                break;
+                        default:
+                                base.LoadAttribute (name, value);
+                                break;
+                        }
+                }
+                internal override void SaveValue (System.Xml.XmlWriter writer)
+                {
+                        SaveAttribute (writer, "Name", Name);
+                        SaveAttribute (writer, "DependsOnTargets", DependsOnTargets);
+                        SaveAttribute (writer, "Returns", Returns);
+                        SaveAttribute (writer, "Inputs", Inputs);
+                        SaveAttribute (writer, "Outputs", Outputs);
+                        SaveAttribute (writer, "BeforeTargets", BeforeTargets);
+                        SaveAttribute (writer, "AfterTargets", AfterTargets);
+                        SaveAttribute (writer, "KeepDuplicateOutputs", KeepDuplicateOutputs);
+                        base.SaveValue (writer);
+                }
+        }
+}
diff --git a/mcs/class/Microsoft.Build/Microsoft.Build.Construction/ProjectTaskElement.cs b/mcs/class/Microsoft.Build/Microsoft.Build.Construction/ProjectTaskElement.cs
new file mode 100644
index 0000000..00e0654
--- /dev/null
+++ b/mcs/class/Microsoft.Build/Microsoft.Build.Construction/ProjectTaskElement.cs
@@ -0,0 +1,153 @@
+//
+// ProjectTaskElement.cs
+//
+// Author:
+//   Leszek Ciesielski (skolima at gmail.com)
+//
+// (C) 2011 Leszek Ciesielski
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Xml;
+using Microsoft.Build.Exceptions;
+using Microsoft.Build.Internal;
+
+namespace Microsoft.Build.Construction
+{
+        [System.Diagnostics.DebuggerDisplayAttribute ("{Name} Condition={Condition} ContinueOnError={ContinueOnError} "
+                                                      + "#Outputs={Count}")]
+        public class ProjectTaskElement : ProjectElementContainer
+        {
+                internal ProjectTaskElement (string taskName, ProjectRootElement containingProject)
+                        : this(containingProject)
+                {
+                        Name = taskName;
+                }
+                internal ProjectTaskElement (ProjectRootElement containingProject)
+                {
+                        ContainingProject = containingProject;
+                }
+                string continueOnError;
+                public string ContinueOnError {
+                        get { return continueOnError ?? String.Empty; }
+                        set { continueOnError = value; }
+                }
+                string name;
+                public string Name { get { return name ?? String.Empty; } private set { name = value; } }
+                public ICollection<ProjectOutputElement> Outputs {
+                        get { return new CollectionFromEnumerable<ProjectOutputElement> (
+                                new FilteredEnumerable<ProjectOutputElement> (AllChildren)); }
+                }
+                public IDictionary<string, string> Parameters {
+                        get { return parameters; }
+                }
+                public ProjectOutputElement AddOutputItem (string taskParameter, string itemType)
+                {
+                        return AddOutputItem (taskParameter, itemType, null);
+                }
+                public ProjectOutputElement AddOutputItem (string taskParameter, string itemType, string condition)
+                {
+                        var output = new ProjectOutputElement (taskParameter, itemType, null, ContainingProject);
+                        if( condition != null)
+                                output.Condition = condition;
+                        AppendChild (output);
+                        return output;
+                }
+                public ProjectOutputElement AddOutputProperty (string taskParameter, string propertyName)
+                {
+                        return AddOutputProperty (taskParameter, propertyName, null);
+                }
+                public ProjectOutputElement AddOutputProperty (string taskParameter, string propertyName,
+                                                               string condition)
+                {
+                        var output = new ProjectOutputElement (taskParameter, null, propertyName, ContainingProject);
+                        if( condition != null)
+                                output.Condition = condition;
+                        AppendChild (output);
+                        return output;
+                }
+                public string GetParameter (string name)
+                {
+                        string value;
+                        if (parameters.TryGetValue (name, out value))
+                                return value;
+                        return string.Empty;
+                }
+                public void RemoveAllParameters ()
+                {
+                        parameters.Clear ();
+                }
+                public void RemoveParameter (string name)
+                {
+                        parameters.Remove (name);
+                }
+                public void SetParameter (string name, string unevaluatedValue)
+                {
+                        parameters[name] = unevaluatedValue;
+                }
+                internal override string XmlName {
+                        get { return Name; }
+                }
+                internal override ProjectElement LoadChildElement (string name)
+                {
+                        switch (name) {
+                        case "Output":
+                                var output = ContainingProject.CreateOutputElement (null, null, null);
+                                AppendChild (output);
+                                return output;
+                        default:
+                                throw new InvalidProjectFileException (string.Format (
+                                        "Child \"{0}\" is not a known node type.", name));
+                        }
+                }
+                internal override void LoadAttribute (string name, string value)
+                {
+                        switch (name) {
+                        case "ContinueOnError":
+                                ContinueOnError = value;
+                                break;
+                        case "xmlns":
+                                break;
+                        case "Label":
+                                Label = value;
+                                break;
+                        case "Condition":
+                                Condition = value;
+                                break;
+                        default:
+                                SetParameter (name, value);
+                                break;
+                        }
+                }
+                internal override void SaveValue (XmlWriter writer)
+                {
+                        SaveAttribute (writer, "ContinueOnError", ContinueOnError);
+                        foreach (var parameter in parameters) {
+                                SaveAttribute (writer, parameter.Key, parameter.Value);
+                        }
+                        base.SaveValue (writer);
+                }
+                private Dictionary<string, string> parameters = new Dictionary<string, string> ();
+        }
+}
diff --git a/mcs/class/Microsoft.Build/Microsoft.Build.Construction/ProjectUsingTaskBodyElement.cs b/mcs/class/Microsoft.Build/Microsoft.Build.Construction/ProjectUsingTaskBodyElement.cs
new file mode 100644
index 0000000..eecc92a
--- /dev/null
+++ b/mcs/class/Microsoft.Build/Microsoft.Build.Construction/ProjectUsingTaskBodyElement.cs
@@ -0,0 +1,75 @@
+//
+// ProjectUsingTaskBodyElement.cs
+//
+// Author:
+//   Leszek Ciesielski (skolima at gmail.com)
+//
+// (C) 2011 Leszek Ciesielski
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Xml;
+namespace Microsoft.Build.Construction
+{
+        [System.Diagnostics.DebuggerDisplayAttribute ("Evaluate={Evaluate} TaskBody={TaskBody}")]
+        public class ProjectUsingTaskBodyElement : ProjectElement
+        {
+                internal ProjectUsingTaskBodyElement (string evaluate, string body, ProjectRootElement containingProject)
+                {
+                        Evaluate = evaluate;
+                        TaskBody = body;
+                        ContainingProject = containingProject;
+                }
+                string evaluate;
+                public string Evaluate { get { return evaluate ?? String.Empty; } set { evaluate = value; } }
+                public override string Condition { get { return null; } set { throw new InvalidOperationException (
+                        "Can not set Condition."); } }
+                string taskBody;
+                public string TaskBody { get { return taskBody ?? String.Empty; } set { taskBody = value; } }
+                internal override string XmlName {
+                        get { return "Task"; }
+                }
+                internal override void SaveValue (XmlWriter writer)
+                {
+                        base.SaveValue (writer);
+                        SaveAttribute (writer, "Evaluate", Evaluate);
+                        if (!string.IsNullOrWhiteSpace (TaskBody))
+                                writer.WriteRaw (TaskBody);
+                }
+                internal override void LoadAttribute (string name, string value)
+                {
+                        switch (name) {
+                        case "Evaluate":
+                                Evaluate = value;
+                                break;
+                        default:
+                                base.LoadAttribute (name, value);
+                                break;
+                        }
+                }
+                internal override void LoadValue (XmlReader reader)
+                {
+                        reader.MoveToElement ();
+                        TaskBody = reader.ReadInnerXml ();
+                }
+        }
+}
diff --git a/mcs/class/Microsoft.Build/Microsoft.Build.Construction/ProjectUsingTaskElement.cs b/mcs/class/Microsoft.Build/Microsoft.Build.Construction/ProjectUsingTaskElement.cs
new file mode 100644
index 0000000..83a5d60
--- /dev/null
+++ b/mcs/class/Microsoft.Build/Microsoft.Build.Construction/ProjectUsingTaskElement.cs
@@ -0,0 +1,123 @@
+//
+// ProjectUsingTaskElement.cs
+//
+// Author:
+//   Leszek Ciesielski (skolima at gmail.com)
+//
+// (C) 2011 Leszek Ciesielski
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using Microsoft.Build.Exceptions;
+
+namespace Microsoft.Build.Construction
+{
+        [System.Diagnostics.DebuggerDisplayAttribute ("TaskName={TaskName} AssemblyName={AssemblyName} "
+                                                      + "AssemblyFile={AssemblyFile} Condition={Condition} "
+                                                      + "Runtime={RequiredRuntime} Platform={RequiredPlatform}")]
+        public class ProjectUsingTaskElement : ProjectElementContainer
+        {
+                internal ProjectUsingTaskElement (string taskName, string assemblyFile, string assemblyName,
+                                                ProjectRootElement containingProject)
+                {
+                        TaskName = taskName;
+                        AssemblyFile = assemblyFile;
+                        AssemblyName = assemblyName;
+                        ContainingProject = containingProject;
+                }
+                string assemblyFile;
+                public string AssemblyFile {
+                        get { return assemblyFile ?? String.Empty; }
+                        set { assemblyFile = value; }
+                }
+                string assemblyName;
+                public string AssemblyName {
+                        get { return assemblyName ?? String.Empty; }
+                        set { assemblyName = value; }
+                }
+                public UsingTaskParameterGroupElement ParameterGroup {
+                        get { return FirstChild as UsingTaskParameterGroupElement; }
+                }
+                public ProjectUsingTaskBodyElement TaskBody {
+                        get { return LastChild as ProjectUsingTaskBodyElement; }
+                }
+                string taskFactory;
+                public string TaskFactory { get { return taskFactory ?? String.Empty; } set { taskFactory = value; } }
+                string taskName;
+                public string TaskName { get { return taskName ?? String.Empty; } set { taskName = value; } }
+                public UsingTaskParameterGroupElement AddParameterGroup ()
+                {
+                        var @group = ContainingProject.CreateUsingTaskParameterGroupElement ();
+                        PrependChild (@group);
+                        return @group;
+                }
+                public ProjectUsingTaskBodyElement AddUsingTaskBody (string evaluate, string taskBody)
+                {
+                        var body = ContainingProject.CreateUsingTaskBodyElement (evaluate, taskBody);
+                        AppendChild (body);
+                        return body;
+                }
+                internal override void LoadAttribute (string name, string value)
+                {
+                        switch (name) {
+                        case "AssemblyName":
+                                AssemblyName = value;
+                                break;
+                        case "AssemblyFile":
+                                AssemblyFile = value;
+                                break;
+                        case "TaskFactory":
+                                TaskFactory = value;
+                                break;
+                        case "TaskName":
+                                TaskName = value;
+                                break;
+                        default:
+                                base.LoadAttribute (name, value);
+                                break;
+                        }
+                }
+                internal override void SaveValue (System.Xml.XmlWriter writer)
+                {
+                        SaveAttribute (writer, "AssemblyName", AssemblyName);
+                        SaveAttribute (writer, "AssemblyFile", AssemblyFile);
+                        SaveAttribute (writer, "TaskFactory", TaskFactory);
+                        SaveAttribute (writer, "TaskName", TaskName);
+                        base.SaveValue (writer);
+                }
+                internal override string XmlName {
+                        get { return "UsingTask"; }
+                }
+                internal override ProjectElement LoadChildElement (string name)
+                {
+                        switch (name) {
+                        case "ParameterGroup":
+                                return AddParameterGroup ();
+                        case "Task":
+                                return AddUsingTaskBody (null, null);
+                        default:
+                                throw new InvalidProjectFileException (string.Format (
+                                        "Child \"{0}\" is not a known node type.", name));
+                        }
+                }
+        }
+}
diff --git a/mcs/class/Microsoft.Build/Microsoft.Build.Construction/ProjectUsingTaskParameterElement.cs b/mcs/class/Microsoft.Build/Microsoft.Build.Construction/ProjectUsingTaskParameterElement.cs
new file mode 100644
index 0000000..845b8b7
--- /dev/null
+++ b/mcs/class/Microsoft.Build/Microsoft.Build.Construction/ProjectUsingTaskParameterElement.cs
@@ -0,0 +1,86 @@
+//
+// ProjectUsingTaskParameterElement.cs
+//
+// Author:
+//   Leszek Ciesielski (skolima at gmail.com)
+//
+// (C) 2011 Leszek Ciesielski
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Xml;
+namespace Microsoft.Build.Construction
+{
+        [System.Diagnostics.DebuggerDisplayAttribute ("Name={Name} ParameterType={ParameterType} Output={Output}")]
+        public class ProjectUsingTaskParameterElement : ProjectElement
+        {
+                internal ProjectUsingTaskParameterElement (string name, string output, string required,
+                                                         string parameterType, ProjectRootElement containingProject)
+                {
+                        Name = name;
+                        Output = output;
+                        Required = required;
+                        ParameterType = parameterType;
+                        ContainingProject = containingProject;
+                }
+                string name;
+                public string Name { get { return name ?? String.Empty; } set { name = value; } }
+                public override string Condition { get { return null; } set { throw new InvalidOperationException (
+                        "Can not set Condition."); } }
+                string output;
+                public string Output { get { return output ?? String.Empty; } set { output = value; } }
+                string parameterType;
+                public string ParameterType {
+                        get { return parameterType ?? String.Empty; }
+                        set { parameterType = value; }
+                }
+                string required;
+                public string Required { get { return required ?? String.Empty; } set { required = value; } }
+                internal override string XmlName {
+                        get { return Name; }
+                }
+                internal override void LoadAttribute (string name, string value)
+                {
+                        switch (name) {
+                        case "ParameterType":
+                                ParameterType = value;
+                                break;
+                        case "Output":
+                                Output = value;
+                                break;
+                        case "Required":
+                                Required = value;
+                                break;
+                        default:
+                                base.LoadAttribute (name, value);
+                                break;
+                        }
+                }
+                internal override void SaveValue (XmlWriter writer)
+                {
+                        base.SaveValue (writer);
+                        SaveAttribute (writer, "ParameterType", ParameterType);
+                        SaveAttribute (writer, "Required", Required);
+                        SaveAttribute (writer, "Output", Output);
+                }
+        }
+}
diff --git a/mcs/class/Microsoft.Build/Microsoft.Build.Construction/ProjectWhenElement.cs b/mcs/class/Microsoft.Build/Microsoft.Build.Construction/ProjectWhenElement.cs
new file mode 100644
index 0000000..68040f5
--- /dev/null
+++ b/mcs/class/Microsoft.Build/Microsoft.Build.Construction/ProjectWhenElement.cs
@@ -0,0 +1,81 @@
+//
+// ProjectWhenElement.cs
+//
+// Author:
+//   Leszek Ciesielski (skolima at gmail.com)
+//
+// (C) 2011 Leszek Ciesielski
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Microsoft.Build.Exceptions;
+using Microsoft.Build.Internal;
+
+namespace Microsoft.Build.Construction
+{
+        [System.Diagnostics.DebuggerDisplayAttribute ("#Children={Count} Condition={Condition}")]
+        public class ProjectWhenElement : ProjectElementContainer
+        {
+                internal ProjectWhenElement (string condition, ProjectRootElement containingProject)
+                {
+                        Condition = condition;
+                        ContainingProject = containingProject;
+                }
+                public ICollection<ProjectPropertyGroupElement> PropertyGroups {
+                        get { return new CollectionFromEnumerable<ProjectPropertyGroupElement> (
+                                new FilteredEnumerable<ProjectPropertyGroupElement> (Children)); }
+                }
+                public ICollection<ProjectItemGroupElement> ItemGroups {
+                        get { return new CollectionFromEnumerable<ProjectItemGroupElement> (
+                                new FilteredEnumerable<ProjectItemGroupElement> (Children)); }
+                }
+                public ICollection<ProjectChooseElement> ChooseElements {
+                        get { return new CollectionFromEnumerable<ProjectChooseElement> (
+                                new FilteredEnumerable<ProjectChooseElement> (Children));}
+                }
+                internal override string XmlName {
+                        get { return "When"; }
+                }
+                internal override ProjectElement LoadChildElement (string name)
+                {
+                        switch (name) {
+                        case "PropertyGroup":
+                                var property = ContainingProject.CreatePropertyGroupElement ();
+                                AppendChild (property);
+                                return property;
+                        case "ItemGroup":
+                                var item = ContainingProject.CreateItemGroupElement ();
+                                AppendChild (item);
+                                return item;
+                        case "When":
+                                var when = ContainingProject.CreateWhenElement (null);
+                                AppendChild (when);
+                                return when;
+                        default:
+                                throw new InvalidProjectFileException (string.Format (
+                                        "Child \"{0}\" is not a known node type.", name));
+                        }
+                }
+        }
+}
diff --git a/mcs/class/Microsoft.Build/Microsoft.Build.Construction/UsingTaskParameterGroupElement.cs b/mcs/class/Microsoft.Build/Microsoft.Build.Construction/UsingTaskParameterGroupElement.cs
new file mode 100644
index 0000000..8dd1394
--- /dev/null
+++ b/mcs/class/Microsoft.Build/Microsoft.Build.Construction/UsingTaskParameterGroupElement.cs
@@ -0,0 +1,69 @@
+//
+// UsingTaskParameterGroupElement.cs
+//
+// Author:
+//   Leszek Ciesielski (skolima at gmail.com)
+//
+// (C) 2011 Leszek Ciesielski
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Microsoft.Build.Internal;
+
+namespace Microsoft.Build.Construction
+{
+        [System.Diagnostics.DebuggerDisplayAttribute ("#Parameters={Count}")]
+        public class UsingTaskParameterGroupElement : ProjectElementContainer
+        {
+                internal UsingTaskParameterGroupElement (ProjectRootElement containingProject)
+                {
+                        ContainingProject = containingProject;
+                }
+                public override string Condition { get { return null; } set { throw new InvalidOperationException(
+                        "Can not set Condition."); } }
+                public ICollection<ProjectUsingTaskParameterElement> Parameters {
+                        get { return new CollectionFromEnumerable<ProjectUsingTaskParameterElement> (
+                                new FilteredEnumerable<ProjectUsingTaskParameterElement> (Children)); }
+                }
+                public ProjectUsingTaskParameterElement AddParameter (string name)
+                {
+                        return AddParameter (name, null, null, null);
+                }
+                public ProjectUsingTaskParameterElement AddParameter (string name, string output, string required,
+                                                                      string parameterType)
+                {
+                        var parameter = ContainingProject.CreateUsingTaskParameterElement (name, output, required,
+                                parameterType);
+                        AppendChild (parameter);
+                        return parameter;
+                }
+                internal override string XmlName {
+                        get { return "ParameterGroup"; }
+                }
+                internal override ProjectElement LoadChildElement (string name)
+                {
+                        return AddParameter (name);
+                }
+        }
+}
diff --git a/mcs/class/Microsoft.Build/Microsoft.Build.Evaluation/Project.cs b/mcs/class/Microsoft.Build/Microsoft.Build.Evaluation/Project.cs
new file mode 100644
index 0000000..3ad3c33
--- /dev/null
+++ b/mcs/class/Microsoft.Build/Microsoft.Build.Evaluation/Project.cs
@@ -0,0 +1,396 @@
+//
+// Project.cs
+//
+// Author:
+//   Leszek Ciesielski (skolima at gmail.com)
+//   Rolf Bjarne Kvinge (rolf at xamarin.com)
+//
+// (C) 2011 Leszek Ciesielski
+// Copyright (C) 2011 Xamarin Inc. (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.IO;
+using System.Linq;
+using System.Text;
+using Microsoft.Build.Construction;
+using Microsoft.Build.Internal;
+using Microsoft.Build.Execution;
+using Microsoft.Build.Framework;
+using Microsoft.Build.Logging;
+
+namespace Microsoft.Build.Evaluation
+{
+        [DebuggerDisplay("{FullPath} EffectiveToolsVersion={ToolsVersion} #GlobalProperties="
+                         +"{data.globalProperties.Count} #Properties={data.Properties.Count} #ItemTypes="
+                         +"{data.ItemTypes.Count} #ItemDefinitions={data.ItemDefinitions.Count} #Items="
+                         +"{data.Items.Count} #Targets={data.Targets.Count}")]
+        public class Project
+        {
+                public Project (ProjectRootElement xml) : this(xml, null, null)
+                {
+                }
+                public Project (ProjectRootElement xml, IDictionary<string, string> globalProperties,
+                                string toolsVersion)
+                        : this(xml, globalProperties, toolsVersion, ProjectCollection.GlobalProjectCollection)
+                {
+                }
+                public Project (ProjectRootElement xml, IDictionary<string, string> globalProperties,
+                                string toolsVersion, ProjectCollection projectCollection)
+                        : this(xml, globalProperties, toolsVersion, projectCollection, ProjectLoadSettings.Default)
+                {
+                }
+
+                public Project (ProjectRootElement xml, IDictionary<string, string> globalProperties,
+                                string toolsVersion, ProjectCollection projectCollection,
+                                ProjectLoadSettings loadSettings)
+                {
+                        ProjectCollection = projectCollection;
+                        Xml = xml;
+                        GlobalProperties = globalProperties;
+                        ToolsVersion = toolsVersion;
+                }
+
+                public Project (string projectFile) : this(projectFile, null, null)
+                {
+                }
+
+                public Project (string projectFile, IDictionary<string, string> globalProperties,
+                                string toolsVersion)
+                        : this(projectFile, globalProperties, toolsVersion, ProjectCollection.GlobalProjectCollection, ProjectLoadSettings.Default)
+                {
+                }
+
+                public Project (string projectFile, IDictionary<string, string> globalProperties,
+                                string toolsVersion, ProjectCollection projectCollection)
+                        : this(projectFile, globalProperties, toolsVersion, projectCollection, ProjectLoadSettings.Default)
+                {
+                }
+
+                public Project (string projectFile, IDictionary<string, string> globalProperties,
+                                string toolsVersion, ProjectCollection projectCollection,
+                                ProjectLoadSettings loadSettings)
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public IDictionary<string, string> GlobalProperties { get; private set; }
+                public ProjectCollection ProjectCollection { get; private set; }
+                public string ToolsVersion { get; private set; }
+                public ProjectRootElement Xml { get; private set; }
+
+                public ICollection<ProjectItem> GetItemsIgnoringCondition (string itemType)
+                {
+                        return new CollectionFromEnumerable<ProjectItem> (
+                                new FilteredEnumerable<ProjectItemElement> (Xml.Items).
+                                Where (p => p.ItemType.Equals (itemType, StringComparison.OrdinalIgnoreCase)).
+                                Select (p => new ProjectItem(p)));
+                }
+                public void RemoveItems (IEnumerable<ProjectItem> items)
+                {
+                        var removal = new List<ProjectItem> (items);
+                        foreach (var item in removal) {
+                                var parent = item.Xml.Parent;
+                                parent.RemoveChild (item.Xml);
+                                if (parent.Count == 0)
+                                        parent.Parent.RemoveChild (parent);
+                        }
+                }
+
+                public IList<ProjectItem> AddItem (string itemType, string unevaluatedInclude)
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public IList<ProjectItem> AddItem (string itemType, string unevaluatedInclude,
+                        IEnumerable<KeyValuePair<string, string>> metadata)
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public IList<ProjectItem> AddItemFast (string itemType, string unevaluatedInclude)
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public IList<ProjectItem> AddItemFast (string itemType, string unevaluatedInclude,
+                        IEnumerable<KeyValuePair<string, string>> metadata)
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public bool Build ()
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public bool Build (IEnumerable<ILogger> loggers)
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public bool Build (string target)
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public bool Build (string[] targets)
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public bool Build (ILogger logger)
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public bool Build (string[] targets, IEnumerable<ILogger> loggers)
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public bool Build (IEnumerable<ILogger> loggers, IEnumerable<ForwardingLoggerRecord> remoteLoggers)
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public bool Build (string target, IEnumerable<ILogger> loggers)
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public bool Build (string[] targets, IEnumerable<ILogger> loggers, IEnumerable<ForwardingLoggerRecord> remoteLoggers)
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public bool Build (string target, IEnumerable<ILogger> loggers, IEnumerable<ForwardingLoggerRecord> remoteLoggers)
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public ProjectInstance CreateProjectInstance ()
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public string ExpandString (string unexpandedValue)
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public static string GetEvaluatedItemIncludeEscaped (ProjectItem item)
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public static string GetEvaluatedItemIncludeEscaped (ProjectItemDefinition item)
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public ICollection<ProjectItem> GetItems (string itemType)
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public ICollection<ProjectItem> GetItemsByEvaluatedInclude (string evaluatedInclude)
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public IEnumerable<ProjectElement> GetLogicalProject ()
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public static string GetMetadataValueEscaped (ProjectMetadata metadatum)
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public static string GetMetadataValueEscaped (ProjectItem item, string name)
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public static string GetMetadataValueEscaped (ProjectItemDefinition item, string name)
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public string GetPropertyValue (string name)
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public static string GetPropertyValueEscaped (ProjectProperty property)
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public ProjectProperty GetProperty (string name)
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public void MarkDirty ()
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public void ReevaluateIfNecessary ()
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public bool RemoveGlobalProperty (string name)
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public bool RemoveItem (ProjectItem item)
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public bool RemoveProperty (ProjectProperty property)
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public void Save ()
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public void Save (TextWriter writer)
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public void Save (string path)
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public void Save (Encoding encoding)
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public void Save (string path, Encoding encoding)
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public void SaveLogicalProject (TextWriter writer)
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public bool SetGlobalProperty (string name, string escapedValue)
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public ProjectProperty SetProperty (string name, string unevaluatedValue)
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public ICollection<ProjectMetadata> AllEvaluatedItemDefinitionMetadata {
+                        get { throw new NotImplementedException (); }
+                }
+
+                public ICollection<ProjectItem> AllEvaluatedItems {
+                        get { throw new NotImplementedException (); }
+                }
+
+                public ICollection<ProjectProperty> AllEvaluatedProperties {
+                        get { throw new NotImplementedException (); }
+                }
+
+                public IDictionary<string, List<string>> ConditionedProperties {
+                        get { throw new NotImplementedException (); }
+                }
+
+                public string DirectoryPath {
+                        get { throw new NotImplementedException (); }
+                }
+
+                public bool DisableMarkDirty { get; set; }
+
+                public int EvaluationCounter {
+                        get { throw new NotImplementedException (); }
+                }
+
+                public string FullPath {
+                        get { throw new NotImplementedException (); }
+                        set { throw new NotImplementedException (); }
+                }
+
+                public IList<ResolvedImport> Imports {
+                        get { throw new NotImplementedException (); }
+                }
+
+                public IList<ResolvedImport> ImportsIncludingDuplicates {
+                        get { throw new NotImplementedException (); }
+                }
+
+                public bool IsBuildEnabled {
+                        get { throw new NotImplementedException (); }
+                }
+
+                public bool IsDirty {
+                        get { throw new NotImplementedException (); }
+                }
+
+                public IDictionary<string, ProjectItemDefinition> ItemDefinitions {
+                        get { throw new NotImplementedException (); }
+                }
+
+                public ICollection<ProjectItem> Items {
+                        get { throw new NotImplementedException (); }
+                }
+
+                public ICollection<ProjectItem> ItemsIgnoringCondition {
+                        get { throw new NotImplementedException (); }
+                }
+
+                public ICollection<string> ItemTypes {
+                        get { throw new NotImplementedException (); }
+                }
+
+                public ICollection<ProjectProperty> Properties {
+                        get { throw new NotImplementedException (); }
+                }
+
+                public bool SkipEvaluation { get; set; }
+
+                public IDictionary<string, ProjectTargetInstance> Targets {
+                        get { throw new NotImplementedException (); }
+                }
+        }
+}
diff --git a/mcs/class/Microsoft.Build/Microsoft.Build.Evaluation/ProjectCollection.cs b/mcs/class/Microsoft.Build/Microsoft.Build.Evaluation/ProjectCollection.cs
new file mode 100644
index 0000000..17c6d82
--- /dev/null
+++ b/mcs/class/Microsoft.Build/Microsoft.Build.Evaluation/ProjectCollection.cs
@@ -0,0 +1,101 @@
+//
+// ProjectCollection.cs
+//
+// Author:
+//   Leszek Ciesielski (skolima at gmail.com)
+//   Rolf Bjarne Kvinge (rolf at xamarin.com)
+//
+// (C) 2011 Leszek Ciesielski
+// Copyright (C) 2011 Xamarin Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using Microsoft.Build.Framework;
+using Microsoft.Build.Logging;
+
+using System;
+using System.Collections.Generic;
+
+namespace Microsoft.Build.Evaluation
+{
+        public class ProjectCollection : IDisposable
+        {
+                public ProjectCollection ()
+                {
+                }
+
+                public ProjectCollection (IDictionary<string, string> globalProperties)
+                        : this (globalProperties, null, ToolsetDefinitionLocations.Registry | ToolsetDefinitionLocations.ConfigurationFile)
+                {
+                }
+
+                public ProjectCollection (ToolsetDefinitionLocations toolsetDefinitionLocations)
+                        : this (null, null, toolsetDefinitionLocations)
+                {
+                }
+
+                public ProjectCollection (IDictionary<string, string> globalProperties, IEnumerable<ILogger> loggers,
+                                ToolsetDefinitionLocations toolsetDefinitionLocations)
+                        : this (globalProperties, loggers, null, toolsetDefinitionLocations, 1, false)
+                {
+                }
+
+                public ProjectCollection (IDictionary<string, string> globalProperties,
+                                IEnumerable<ILogger> loggers, IEnumerable<ForwardingLoggerRecord> remoteLoggers,
+                                ToolsetDefinitionLocations toolsetDefinitionLocations,
+                                int maxNodeCount, bool onlyLogCriticalEvents)
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public static string Escape (string unescapedString)
+                {
+                        return unescapedString;
+                }
+
+                public static ProjectCollection GlobalProjectCollection {
+                        get { return globalProjectCollection; }
+                }
+
+                public void Dispose ()
+                {
+                        Dispose (true);
+                        GC.SuppressFinalize (this);
+                }
+
+                protected virtual void Dispose (bool disposing)
+                {
+                        if (disposing) {
+                        }
+                }
+
+                static ProjectCollection globalProjectCollection = new ProjectCollection ();
+
+                public ICollection<Project> GetLoadedProjects (string fullPath)
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public ToolsetDefinitionLocations ToolsetLocations {
+                        get { throw new NotImplementedException (); }
+                }
+        }
+}
diff --git a/mcs/class/Microsoft.Build/Microsoft.Build.Evaluation/ProjectItem.cs b/mcs/class/Microsoft.Build/Microsoft.Build.Evaluation/ProjectItem.cs
new file mode 100644
index 0000000..7795319
--- /dev/null
+++ b/mcs/class/Microsoft.Build/Microsoft.Build.Evaluation/ProjectItem.cs
@@ -0,0 +1,116 @@
+//
+// ProjectItem.cs
+//
+// Author:
+//   Leszek Ciesielski (skolima at gmail.com)
+//   Rolf Bjarne Kvinge (rolf at xamarin.com)
+//
+// (C) 2011 Leszek Ciesielski
+// Copyright (C) 2011 Xamarin Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+
+using Microsoft.Build.Construction;
+
+namespace Microsoft.Build.Evaluation
+{
+        [DebuggerDisplay("{ItemType}={EvaluatedInclude} [{UnevaluatedInclude}] #DirectMetadata={DirectMetadataCount}")]
+        public class ProjectItem
+        {
+                internal ProjectItem (ProjectItemElement xml)
+                {
+                        Xml = xml;
+                }
+
+                public ProjectMetadata GetMetadata (string name)
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public string GetMetadataValue (string name)
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public bool HasMetadata (string name)
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public bool RemoveMetadata (string name)
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public void Rename (string name)
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public void SetMetadataValue (string name, string unevaluatedValue)
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public IEnumerable<ProjectMetadata> DirectMetadata {
+                        get { throw new NotImplementedException (); }
+                }
+
+                public int DirectMetadataCount {
+                        get { throw new NotImplementedException (); }
+                }
+
+                public string EvaluatedInclude {
+                        get { throw new NotImplementedException (); }
+                }
+
+                public bool IsImported {
+                        get { throw new NotImplementedException (); }
+                }
+
+                public string ItemType {
+                        get { throw new NotImplementedException (); }
+                }
+
+                public ICollection<ProjectMetadata> Metadata {
+                        get { throw new NotImplementedException (); }
+                }
+
+                public int MetadataCount {
+                        get { throw new NotImplementedException (); }
+                }
+
+                public Project Project {
+                        get { throw new NotImplementedException (); }
+                }
+
+                public string UnevaluatedInclude {
+                        get { throw new NotImplementedException (); }
+                }
+
+                public ProjectItemElement Xml { get; private set; }
+
+        }
+}
diff --git a/mcs/class/Microsoft.Build/Microsoft.Build.Evaluation/ProjectItemDefinition.cs b/mcs/class/Microsoft.Build/Microsoft.Build.Evaluation/ProjectItemDefinition.cs
new file mode 100644
index 0000000..13ef541
--- /dev/null
+++ b/mcs/class/Microsoft.Build/Microsoft.Build.Evaluation/ProjectItemDefinition.cs
@@ -0,0 +1,40 @@
+// ProjectItemDefinition.cs
+//
+// Author:
+//   Rolf Bjarne Kvinge (rolf at xamarin.com)
+//
+// Copyright (C) 2011 Xamarin Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+namespace Microsoft.Build.Evaluation
+{
+        public class ProjectItemDefinition
+        {
+                private ProjectItemDefinition ()
+                {
+                        throw new NotImplementedException ();
+                }
+        }
+}
+
diff --git a/mcs/class/Microsoft.Build/Microsoft.Build.Evaluation/ProjectLoadSettings.cs b/mcs/class/Microsoft.Build/Microsoft.Build.Evaluation/ProjectLoadSettings.cs
new file mode 100644
index 0000000..e2adbb4
--- /dev/null
+++ b/mcs/class/Microsoft.Build/Microsoft.Build.Evaluation/ProjectLoadSettings.cs
@@ -0,0 +1,41 @@
+//
+// ProjectLoadSettings.cs
+//
+// Author:
+//   Leszek Ciesielski (skolima at gmail.com)
+//
+// (C) 2011 Leszek Ciesielski
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+namespace Microsoft.Build.Evaluation
+{
+        [Flags]
+        public enum ProjectLoadSettings
+        {
+                Default = 0,
+                IgnoreMissingImports = 1,
+                RecordDuplicateButNotCircularImports = 2,
+                RejectCircularImports = 4
+        }
+}
diff --git a/mcs/class/Microsoft.Build/Microsoft.Build.Evaluation/ProjectMetadata.cs b/mcs/class/Microsoft.Build/Microsoft.Build.Evaluation/ProjectMetadata.cs
new file mode 100644
index 0000000..45001f6
--- /dev/null
+++ b/mcs/class/Microsoft.Build/Microsoft.Build.Evaluation/ProjectMetadata.cs
@@ -0,0 +1,74 @@
+// Toolset.cs
+//
+// Author:
+//   Rolf Bjarne Kvinge (rolf at xamarin.com)
+//
+// Copyright (C) 2011 Xamarin Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using Microsoft.Build.Construction;
+
+using System;
+
+namespace Microsoft.Build.Evaluation
+{
+        public class ProjectMetadata
+        {
+                private ProjectMetadata ()
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public string EvaluatedValue {
+                        get { throw new NotImplementedException (); }
+                }
+
+                public bool IsImported {
+                        get { throw new NotImplementedException (); }
+                }
+
+                public string ItemType {
+                        get { throw new NotImplementedException (); }
+                }
+
+                public string Name {
+                        get { throw new NotImplementedException (); }
+                }
+
+                public ProjectMetadata Predecessor {
+                        get { throw new NotImplementedException (); }
+                }
+
+                public Project Project {
+                        get { throw new NotImplementedException (); }
+                }
+
+                public string UnevaluatedValue {
+                        get { throw new NotImplementedException (); }
+                }
+
+                public ProjectMetadataElement Xml {
+                        get { throw new NotImplementedException (); }
+                }
+        }
+}
+
diff --git a/mcs/class/Microsoft.Build/Microsoft.Build.Evaluation/ProjectProperty.cs b/mcs/class/Microsoft.Build/Microsoft.Build.Evaluation/ProjectProperty.cs
new file mode 100644
index 0000000..dfcd02a
--- /dev/null
+++ b/mcs/class/Microsoft.Build/Microsoft.Build.Evaluation/ProjectProperty.cs
@@ -0,0 +1,41 @@
+// ProjectProperty.cs
+//
+// Author:
+//   Rolf Bjarne Kvinge (rolf at xamarin.com)
+//
+// Copyright (C) 2011 Xamarin Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+namespace Microsoft.Build.Evaluation
+{
+        public class ProjectProperty
+        {
+                public string EvaluatedValue {
+                        get {
+                                throw new NotImplementedException ();
+                        }
+                }
+        }
+}
+
diff --git a/mcs/class/Microsoft.Build/Microsoft.Build.Evaluation/ResolvedImport.cs b/mcs/class/Microsoft.Build/Microsoft.Build.Evaluation/ResolvedImport.cs
new file mode 100644
index 0000000..1e82c01
--- /dev/null
+++ b/mcs/class/Microsoft.Build/Microsoft.Build.Evaluation/ResolvedImport.cs
@@ -0,0 +1,49 @@
+// ResolvedImport.cs
+//
+// Author:
+//   Rolf Bjarne Kvinge (rolf at xamarin.com)
+//
+// Copyright (C) 2011 Xamarin Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using Microsoft.Build.Construction;
+
+using System;
+
+namespace Microsoft.Build.Evaluation
+{
+        [System.Runtime.InteropServices.StructLayout (System.Runtime.InteropServices.LayoutKind.Sequential)]
+        public struct ResolvedImport
+        {
+                private ProjectImportElement import;
+                private ProjectRootElement root;
+
+                public ProjectImportElement ImportingElement {
+                        get { return import; }
+                }
+
+                public ProjectRootElement ImportedProject {
+                        get { return root; }
+                }
+        }
+}
+
diff --git a/mcs/class/Microsoft.Build/Microsoft.Build.Evaluation/Toolset.cs b/mcs/class/Microsoft.Build/Microsoft.Build.Evaluation/Toolset.cs
new file mode 100644
index 0000000..9da377b
--- /dev/null
+++ b/mcs/class/Microsoft.Build/Microsoft.Build.Evaluation/Toolset.cs
@@ -0,0 +1,63 @@
+// Toolset.cs
+//
+// Author:
+//   Rolf Bjarne Kvinge (rolf at xamarin.com)
+//
+// Copyright (C) 2011 Xamarin Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Collections.Generic;
+
+using Microsoft.Build.Execution;
+
+namespace Microsoft.Build.Evaluation
+{
+        public class Toolset
+        {
+                public Toolset (string toolsVersion, string toolsPath,
+                                ProjectCollection projectCollection, string msbuildOverrideTasksPath)
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public Toolset (string toolsVersion, string toolsPath,
+                                IDictionary<string, string> buildProperties, ProjectCollection projectCollection,
+                                string msbuildOverrideTasksPath)
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public IDictionary<string, ProjectPropertyInstance> Properties {
+                        get { throw new NotImplementedException (); }
+                }
+
+                public string ToolsPath {
+                        get { throw new NotImplementedException (); }
+                }
+
+                public string ToolsVersion {
+                        get { throw new NotImplementedException (); }
+                }
+        }
+}
+
diff --git a/mcs/class/Microsoft.Build/Microsoft.Build.Evaluation/ToolsetDefinitionLocations.cs b/mcs/class/Microsoft.Build/Microsoft.Build.Evaluation/ToolsetDefinitionLocations.cs
new file mode 100644
index 0000000..8cee0b0
--- /dev/null
+++ b/mcs/class/Microsoft.Build/Microsoft.Build.Evaluation/ToolsetDefinitionLocations.cs
@@ -0,0 +1,40 @@
+// ToolsetDefinitionLocations.cs
+//
+// Author:
+//   Rolf Bjarne Kvinge (rolf at xamarin.com)
+//
+// Copyright (C) 2011 Xamarin Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+namespace Microsoft.Build.Evaluation
+{
+        [Flags ()]
+        public enum ToolsetDefinitionLocations
+        {
+                None,
+                ConfigurationFile,
+                Registry,
+        }
+}
+
diff --git a/mcs/class/Microsoft.Build/Microsoft.Build.Exceptions/InvalidProjectFileException.cs b/mcs/class/Microsoft.Build/Microsoft.Build.Exceptions/InvalidProjectFileException.cs
new file mode 100644
index 0000000..ea2a51d
--- /dev/null
+++ b/mcs/class/Microsoft.Build/Microsoft.Build.Exceptions/InvalidProjectFileException.cs
@@ -0,0 +1,94 @@
+//
+// InvalidProjectFileException.cs
+//
+// Author:
+//   Leszek Ciesielski (skolima at gmail.com)
+//
+// (C) 2011 Leszek Ciesielski
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Runtime.Serialization;
+
+namespace Microsoft.Build.Exceptions
+{
+        [Serializable]
+        public sealed class InvalidProjectFileException : Exception
+        {
+                public InvalidProjectFileException ()
+                {
+                }
+                public InvalidProjectFileException (string message) : base(message)
+                {
+                }
+                private InvalidProjectFileException (SerializationInfo info, StreamingContext context)
+                        : base(info, context)
+                {
+                        ProjectFile = info.GetString ("projectFile");
+                        LineNumber = info.GetInt32 ("lineNumber");
+                        ColumnNumber = info.GetInt32 ("columnNumber");
+                        EndLineNumber = info.GetInt32 ("endLineNumber");
+                        EndColumnNumber = info.GetInt32 ("endColumnNumber");
+                        ErrorSubcategory = info.GetString ("errorSubcategory");
+                        ErrorCode = info.GetString ("errorCode");
+                        HelpKeyword = info.GetString ("helpKeyword");
+                        HasBeenLogged = info.GetBoolean ("hasBeenLogged");
+                }
+                public InvalidProjectFileException (string message, Exception innerException)
+                        : base(message, innerException)
+                {
+                }
+                public InvalidProjectFileException (string projectFile, int lineNumber, int columnNumber,
+                                                    int endLineNumber, int endColumnNumber, string message,
+                                                    string errorSubcategory, string errorCode, string helpKeyword)
+                {
+                }
+                public override void GetObjectData (SerializationInfo info, StreamingContext context)
+                {
+                        base.GetObjectData (info, context);
+                        info.AddValue ("projectFile", ProjectFile);
+                        info.AddValue ("lineNumber", LineNumber);
+                        info.AddValue ("columnNumber", ColumnNumber);
+                        info.AddValue ("endLineNumber", EndLineNumber);
+                        info.AddValue ("endColumnNumber", EndColumnNumber);
+                        info.AddValue ("errorSubcategory", ErrorSubcategory);
+                        info.AddValue ("errorCode", ErrorCode);
+                        info.AddValue ("helpKeyword", HelpKeyword);
+                        info.AddValue ("hasBeenLogged", HasBeenLogged);
+                }
+                public string BaseMessage {
+                        get { return base.Message; }
+                }
+                public int ColumnNumber { get; private set; }
+                public int EndColumnNumber { get; private set; }
+                public int EndLineNumber { get; private set; }
+                public string ErrorCode { get; private set; }
+                public string ErrorSubcategory { get; private set; }
+                public bool HasBeenLogged { get; private set; }
+                public string HelpKeyword { get; private set; }
+                public int LineNumber { get; private set; }
+                public override string Message {
+                        get { return ProjectFile == null ? base.Message : base.Message + " " + ProjectFile; }
+                }
+                public string ProjectFile { get; private set; }
+        }
+}
diff --git a/mcs/class/Microsoft.Build/Microsoft.Build.Execution/BuildManager.cs b/mcs/class/Microsoft.Build/Microsoft.Build.Execution/BuildManager.cs
new file mode 100644
index 0000000..3b4384b
--- /dev/null
+++ b/mcs/class/Microsoft.Build/Microsoft.Build.Execution/BuildManager.cs
@@ -0,0 +1,91 @@
+// BuildManager.cs
+//
+// Author:
+//   Rolf Bjarne Kvinge (rolf at xamarin.com)
+//
+// Copyright (C) 2011 Xamarin Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using Microsoft.Build.Evaluation;
+
+using System;
+
+namespace Microsoft.Build.Execution
+{
+        public class BuildManager
+        {
+                public BuildManager ()
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public BuildManager (string hostName)
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public void BeginBuild (BuildParameters parameters)
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public BuildResult Build (BuildParameters parameters, BuildRequestData requestData)
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public BuildResult BuildRequest (BuildRequestData requestData)
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public void CancelAllSubmissions ()
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public void EndBuild ()
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public ProjectInstance GetProjectInstanceForBuild (Project project)
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public BuildSubmission PendBuildRequest (BuildRequestData requestData)
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public void ResetCaches ()
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public static BuildManager DefaultBuildManager {
+                        get { throw new NotImplementedException (); }
+                }
+        }
+}
+
diff --git a/mcs/class/Microsoft.Build/Microsoft.Build.Execution/BuildParameters.cs b/mcs/class/Microsoft.Build/Microsoft.Build.Execution/BuildParameters.cs
new file mode 100644
index 0000000..2694491
--- /dev/null
+++ b/mcs/class/Microsoft.Build/Microsoft.Build.Execution/BuildParameters.cs
@@ -0,0 +1,159 @@
+// BuildParameters.cs
+//
+// Author:
+//   Rolf Bjarne Kvinge (rolf at xamarin.com)
+//
+// Copyright (C) 2011 Xamarin Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using Microsoft.Build.Evaluation;
+using Microsoft.Build.Framework;
+using Microsoft.Build.Logging;
+
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Threading;
+
+namespace Microsoft.Build.Execution
+{
+        public class BuildParameters
+        {
+                public BuildParameters ()
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public BuildParameters (ProjectCollection projectCollection)
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public BuildParameters Clone ()
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public Toolset GetToolset (string toolsVersion)
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public ThreadPriority BuildThreadPriority {
+                        get { throw new NotImplementedException (); }
+                        set { throw new NotImplementedException (); }
+                }
+
+                public CultureInfo Culture {
+                        get { throw new NotImplementedException (); }
+                        set { throw new NotImplementedException (); }
+                }
+
+                public string DefaultToolsVersion {
+                        get { throw new NotImplementedException (); }
+                        set { throw new NotImplementedException (); }
+                }
+
+                public bool DetailedSummary {
+                        get { throw new NotImplementedException (); }
+                        set { throw new NotImplementedException (); }
+                }
+
+                public bool EnableNodeReuse {
+                        get { throw new NotImplementedException (); }
+                        set { throw new NotImplementedException (); }
+                }
+
+                public IDictionary<string, string> EnvironmentProperties {
+                        get { throw new NotImplementedException (); }
+                }
+
+                public IEnumerable<ForwardingLoggerRecord> ForwardingLoggers {
+                        get { throw new NotImplementedException (); }
+                        set { throw new NotImplementedException (); }
+                }
+
+                public IDictionary<string, string> GlobalProperties {
+                        get { throw new NotImplementedException (); }
+                        set { throw new NotImplementedException (); }
+                }
+
+                public HostServices HostServices {
+                        get { throw new NotImplementedException (); }
+                        set { throw new NotImplementedException (); }
+                }
+
+                public bool LegacyThreadingSemantics { get; set; }
+
+                public IEnumerable<ILogger> Loggers {
+                        get { throw new NotImplementedException (); }
+                        set { throw new NotImplementedException (); }
+                }
+
+                public int MaxNodeCount {
+                        get { throw new NotImplementedException (); }
+                        set { throw new NotImplementedException (); }
+                }
+
+                public int MemoryUseLimit {
+                        get { throw new NotImplementedException (); }
+                        set { throw new NotImplementedException (); }
+                }
+
+                public string NodeExeLocation {
+                        get { throw new NotImplementedException (); }
+                        set { throw new NotImplementedException (); }
+                }
+
+                public bool OnlyLogCriticalEvents {
+                        get { throw new NotImplementedException (); }
+                        set { throw new NotImplementedException (); }
+                }
+
+                public bool ResetCaches { get; set; }
+
+                public bool SaveOperatingEnvironment {
+                        get { throw new NotImplementedException (); }
+                        set { throw new NotImplementedException (); }
+                }
+
+                public ToolsetDefinitionLocations ToolsetDefinitionLocations {
+                        get { throw new NotImplementedException (); }
+                        set { throw new NotImplementedException (); }
+                }
+
+                public ICollection<Toolset> Toolsets {
+                        get { throw new NotImplementedException (); }
+                }
+
+                public CultureInfo UICulture {
+                        get { throw new NotImplementedException (); }
+                        set { throw new NotImplementedException (); }
+                }
+
+                public bool UseSynchronousLogging {
+                        get { throw new NotImplementedException (); }
+                        set { throw new NotImplementedException (); }
+                }
+        }
+}
+
diff --git a/mcs/class/Microsoft.Build/Microsoft.Build.Execution/BuildRequestData.cs b/mcs/class/Microsoft.Build/Microsoft.Build.Execution/BuildRequestData.cs
new file mode 100644
index 0000000..2380077
--- /dev/null
+++ b/mcs/class/Microsoft.Build/Microsoft.Build.Execution/BuildRequestData.cs
@@ -0,0 +1,76 @@
+//
+// BuildRequestData.cs
+//
+// Author:
+//   Rolf Bjarne Kvinge (rolf at xamarin.com)
+//
+// Copyright (C) 2011 Xamarin Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Collections.Generic;
+
+namespace Microsoft.Build.Execution
+{
+        public class BuildRequestData
+        {
+                public BuildRequestData (ProjectInstance projectInstance, string[] targetsToBuild)
+                        : this (projectInstance, targetsToBuild, null, BuildRequestDataFlags.None)
+                {
+                }
+
+                public BuildRequestData (ProjectInstance projectInstance, string[] targetsToBuild, HostServices hostServices)
+                        : this (projectInstance, targetsToBuild, hostServices, BuildRequestDataFlags.None)
+                {
+                }
+
+                public BuildRequestData (ProjectInstance projectInstance, string[] targetsToBuild, HostServices hostServices,
+                                BuildRequestDataFlags flags)
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public BuildRequestData (string projectFullPath, IDictionary<string, string> globalProperties,
+                                string toolsVersion, string[] targetsToBuild, HostServices hostServices)
+                        : this (projectFullPath, globalProperties, toolsVersion, targetsToBuild, hostServices, BuildRequestDataFlags.None)
+                {
+                }
+
+                public BuildRequestData (string projectFullPath, IDictionary<string, string> globalProperties,
+                                string toolsVersion, string[] targetsToBuild, HostServices hostServices, BuildRequestDataFlags flags)
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public string ExplicitlySpecifiedToolsVersion { get; private set; }
+                public BuildRequestDataFlags Flags { get; private set; }
+                public HostServices HostServices { get; private set; }
+                public string ProjectFullPath { get; private set; }
+                public ProjectInstance ProjectInstance { get; private set; }
+                public ICollection<string> TargetNames { get; private set; }
+
+                ICollection<ProjectPropertyInstance> GlobalProperties {
+                        get { throw new NotImplementedException (); }
+                }
+        }
+}
+
diff --git a/mcs/class/Microsoft.Build/Microsoft.Build.Execution/BuildRequestDataFlags.cs b/mcs/class/Microsoft.Build/Microsoft.Build.Execution/BuildRequestDataFlags.cs
new file mode 100644
index 0000000..6439f46
--- /dev/null
+++ b/mcs/class/Microsoft.Build/Microsoft.Build.Execution/BuildRequestDataFlags.cs
@@ -0,0 +1,40 @@
+//
+// BuildRequestDataFlags.cs
+//
+// Author:
+//   Rolf Bjarne Kvinge (rolf at xamarin.com)
+//
+// Copyright (C) 2011 Xamarin Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+namespace Microsoft.Build.Execution
+{
+        [Flags]
+        public enum BuildRequestDataFlags
+        {
+                None,
+                ReplaceExistingProjectInstance,
+        }
+}
+
diff --git a/mcs/class/Microsoft.Build/Microsoft.Build.Execution/BuildResult.cs b/mcs/class/Microsoft.Build/Microsoft.Build.Execution/BuildResult.cs
new file mode 100644
index 0000000..7286a24
--- /dev/null
+++ b/mcs/class/Microsoft.Build/Microsoft.Build.Execution/BuildResult.cs
@@ -0,0 +1,93 @@
+// BuildResult.cs
+//
+// Author:
+//   Rolf Bjarne Kvinge (rolf at xamarin.com)
+//
+// Copyright (C) 2011 Xamarin Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Collections.Generic;
+
+namespace Microsoft.Build.Execution
+{
+        public class BuildResult
+        {
+                public void AddResultsForTarget (string target, TargetResult result)
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public bool HasResultsForTarget (string target)
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public void MergeResults (BuildResult results)
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public bool CircularDependency {
+                        get { throw new NotImplementedException (); }
+                }
+
+                public int ConfigurationId {
+                        get { throw new NotImplementedException (); }
+                }
+
+                public Exception Exception {
+                        get { throw new NotImplementedException (); }
+                        set { throw new NotImplementedException (); }
+                }
+
+                public int GlobalRequestId {
+                        get { throw new NotImplementedException (); }
+                }
+
+                public ITargetResult this [string target] {
+                        get { throw new NotImplementedException (); }
+                }
+
+                public int NodeRequestId {
+                        get { throw new NotImplementedException (); }
+                }
+
+                public BuildResultCode OverallResult {
+                        get { throw new NotImplementedException (); }
+                }
+
+                public int ParentGlobalRequestId {
+                        get { throw new NotImplementedException (); }
+                }
+
+                public IDictionary<string, TargetResult> ResultsByTarget {
+                        get { throw new NotImplementedException (); }
+                }
+
+                public int SubmissionId {
+                        get { throw new NotImplementedException (); }
+                }
+
+        }
+}
+
diff --git a/mcs/class/Microsoft.Build/Microsoft.Build.Execution/BuildResultCode.cs b/mcs/class/Microsoft.Build/Microsoft.Build.Execution/BuildResultCode.cs
new file mode 100644
index 0000000..31c8744
--- /dev/null
+++ b/mcs/class/Microsoft.Build/Microsoft.Build.Execution/BuildResultCode.cs
@@ -0,0 +1,36 @@
+// BuildResultCode.cs
+//
+// Author:
+//   Rolf Bjarne Kvinge (rolf at xamarin.com)
+//
+// Copyright (C) 2011 Xamarin Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+namespace Microsoft.Build.Execution
+{
+        public enum BuildResultCode
+        {
+                Success,
+                Failure
+        }
+}
+
diff --git a/mcs/class/Microsoft.Build/Microsoft.Build.Execution/BuildSubmission.cs b/mcs/class/Microsoft.Build/Microsoft.Build.Execution/BuildSubmission.cs
new file mode 100644
index 0000000..3a8a612
--- /dev/null
+++ b/mcs/class/Microsoft.Build/Microsoft.Build.Execution/BuildSubmission.cs
@@ -0,0 +1,40 @@
+// BuildSubmission.cs
+//
+// Author:
+//   Rolf Bjarne Kvinge (rolf at xamarin.com)
+//
+// Copyright (C) 2011 Xamarin Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+namespace Microsoft.Build.Execution
+{
+        public class BuildSubmission
+        {
+                private BuildSubmission ()
+                {
+                        throw new NotImplementedException ();
+                }
+        }
+}
+
diff --git a/mcs/class/Microsoft.Build/Microsoft.Build.Execution/HostServices.cs b/mcs/class/Microsoft.Build/Microsoft.Build.Execution/HostServices.cs
new file mode 100644
index 0000000..2389bdf
--- /dev/null
+++ b/mcs/class/Microsoft.Build/Microsoft.Build.Execution/HostServices.cs
@@ -0,0 +1,67 @@
+//
+// HostServices.cs
+//
+// Author:
+//   Rolf Bjarne Kvinge (rolf at xamarin.com)
+//
+// Copyright (C) 2011 Xamarin Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using Microsoft.Build.Framework;
+using System;
+
+namespace Microsoft.Build.Execution
+{
+        public class HostServices
+        {
+                public ITaskHost GetHostObject (string projectFile, string targetName, string taskName)
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public NodeAffinity GetNodeAffinity (string projectFile)
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public void OnRenameProject (string oldFullPath, string newFullPath)
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public void RegisterHostObject (string projectFile, string targetName, string taskName, ITaskHost hostObject)
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public void SetNodeAffinity (string projectFile, NodeAffinity nodeAffinity)
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public void UnregisterProject (string projectFullPath)
+                {
+                        throw new NotImplementedException ();
+                }
+        }
+}
+
diff --git a/mcs/class/Microsoft.Build/Microsoft.Build.Execution/ITargetResult.cs b/mcs/class/Microsoft.Build/Microsoft.Build.Execution/ITargetResult.cs
new file mode 100644
index 0000000..57e2e6d
--- /dev/null
+++ b/mcs/class/Microsoft.Build/Microsoft.Build.Execution/ITargetResult.cs
@@ -0,0 +1,40 @@
+// ITargetResult.cs
+//
+// Author:
+//   Rolf Bjarne Kvinge (rolf at xamarin.com)
+//
+// Copyright (C) 2011 Xamarin Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using Microsoft.Build.Framework;
+
+using System;
+
+namespace Microsoft.Build.Execution
+{
+        public interface ITargetResult
+        {
+                Exception Exception { get; }
+                ITaskItem[] Items { get; }
+                TargetResultCode ResultCode { get; }
+        }
+}
diff --git a/mcs/class/Microsoft.Build/Microsoft.Build.Execution/NodeAffinity.cs b/mcs/class/Microsoft.Build/Microsoft.Build.Execution/NodeAffinity.cs
new file mode 100644
index 0000000..4fce387
--- /dev/null
+++ b/mcs/class/Microsoft.Build/Microsoft.Build.Execution/NodeAffinity.cs
@@ -0,0 +1,40 @@
+//
+// NodeAffinity.cs
+//
+// Author:
+//   Rolf Bjarne Kvinge (rolf at xamarin.com)
+//
+// Copyright (C) 2011 Xamarin Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+namespace Microsoft.Build.Execution
+{
+        public enum NodeAffinity
+        {
+                InProc,
+                OutOfProc,
+                Any,
+        }
+}
+
diff --git a/mcs/class/Microsoft.Build/Microsoft.Build.Execution/ProjectInstance.cs b/mcs/class/Microsoft.Build/Microsoft.Build.Execution/ProjectInstance.cs
new file mode 100644
index 0000000..66767da
--- /dev/null
+++ b/mcs/class/Microsoft.Build/Microsoft.Build.Execution/ProjectInstance.cs
@@ -0,0 +1,68 @@
+//
+// ProjectInstance.cs
+//
+// Author:
+//   Rolf Bjarne Kvinge (rolf at xamarin.com)
+//
+// Copyright (C) 2011 Xamarin Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Collections.Generic;
+
+using Microsoft.Build.Construction;
+using Microsoft.Build.Evaluation;
+
+namespace Microsoft.Build.Execution
+{
+        public class ProjectInstance
+        {
+                public ProjectInstance (ProjectRootElement xml)
+                        : this (xml, null, null, ProjectCollection.GlobalProjectCollection)
+                {
+                }
+
+                public ProjectInstance (string projectFile)
+                        : this (projectFile, null, null, ProjectCollection.GlobalProjectCollection)
+                {
+                }
+
+                public ProjectInstance (string projectFile, IDictionary<string, string> globalProperties,
+                                string toolsVersion)
+                        : this (projectFile, globalProperties, toolsVersion, ProjectCollection.GlobalProjectCollection)
+                {
+                }
+
+                public ProjectInstance (ProjectRootElement xml, IDictionary<string, string> globalProperties,
+                                string toolsVersion, ProjectCollection projectCollection)
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public ProjectInstance (string projectFile, IDictionary<string, string> globalProperties,
+                                string toolsVersion, ProjectCollection projectCollection)
+                {
+                        throw new NotImplementedException ();
+                }
+        }
+}
+
diff --git a/mcs/class/Microsoft.Build/Microsoft.Build.Execution/ProjectItemInstance.cs b/mcs/class/Microsoft.Build/Microsoft.Build.Execution/ProjectItemInstance.cs
new file mode 100644
index 0000000..0e27811
--- /dev/null
+++ b/mcs/class/Microsoft.Build/Microsoft.Build.Execution/ProjectItemInstance.cs
@@ -0,0 +1,177 @@
+//
+// ProjectItemInstance.cs
+//
+// Author:
+//   Rolf Bjarne Kvinge (rolf at xamarin.com)
+//
+// Copyright (C) 2011 Xamarin Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using Microsoft.Build.Framework;
+using System;
+using System.Collections.Generic;
+
+namespace Microsoft.Build.Execution
+{
+        public class ProjectItemInstance
+                : ITaskItem2
+        {
+                private ProjectItemInstance ()
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public ProjectMetadataInstance GetMetadata (string name)
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public string GetMetadataValue (string name)
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public bool HasMetadata (string name)
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public void RemoveMetadata (string metadataName)
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public void SetMetadata (IEnumerable<KeyValuePair<string, string>> metadataDictionary)
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public ProjectMetadataInstance SetMetadata (string name, string evaluatedValue)
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public int DirectMetadataCount {
+                        get { throw new NotImplementedException (); }
+                }
+
+                public string EvaluatedInclude {
+                        get { throw new NotImplementedException (); }
+                        set { throw new NotImplementedException (); }
+                }
+
+                public string ItemType {
+                        get { throw new NotImplementedException (); }
+                }
+
+                public IEnumerable<ProjectMetadataInstance> Metadata {
+                        get { throw new NotImplementedException (); }
+                }
+
+                public int MetadataCount {
+                        get { throw new NotImplementedException (); }
+                }
+
+                public ICollection<string> MetadataNames {
+                        get { throw new NotImplementedException (); }
+                }
+
+                public ProjectInstance Project {
+                        get { throw new NotImplementedException (); }
+                }
+
+                #region ITaskItem2 implementation
+                string ITaskItem2.GetMetadataValueEscaped (string metadataName)
+                {
+                        throw new NotImplementedException ();
+                }
+
+                void ITaskItem2.SetMetadataValueLiteral (string metadataName, string metadataValue)
+                {
+                        throw new NotImplementedException ();
+                }
+
+                System.Collections.IDictionary ITaskItem2.CloneCustomMetadataEscaped ()
+                {
+                        throw new NotImplementedException ();
+                }
+
+                string ITaskItem2.EvaluatedIncludeEscaped {
+                        get {
+                                throw new NotImplementedException ();
+                        }
+                        set {
+                                throw new NotImplementedException ();
+                        }
+                }
+                #endregion
+
+                #region ITaskItem implementation
+                System.Collections.IDictionary ITaskItem.CloneCustomMetadata ()
+                {
+                        throw new NotImplementedException ();
+                }
+
+                void ITaskItem.CopyMetadataTo (ITaskItem destinationItem)
+                {
+                        throw new NotImplementedException ();
+                }
+
+                string ITaskItem.GetMetadata (string metadataName)
+                {
+                        throw new NotImplementedException ();
+                }
+
+                void ITaskItem.RemoveMetadata (string metadataName)
+                {
+                        throw new NotImplementedException ();
+                }
+
+                void ITaskItem.SetMetadata (string metadataName, string metadataValue)
+                {
+                        throw new NotImplementedException ();
+                }
+
+                string ITaskItem.ItemSpec {
+                        get {
+                                throw new NotImplementedException ();
+                        }
+                        set {
+                                throw new NotImplementedException ();
+                        }
+                }
+
+                int ITaskItem.MetadataCount {
+                        get {
+                                throw new NotImplementedException ();
+                        }
+                }
+
+                System.Collections.ICollection ITaskItem.MetadataNames {
+                        get {
+                                throw new NotImplementedException ();
+                        }
+                }
+                #endregion
+        }
+}
+
diff --git a/mcs/class/Microsoft.Build/Microsoft.Build.Execution/ProjectMetadataInstance.cs b/mcs/class/Microsoft.Build/Microsoft.Build.Execution/ProjectMetadataInstance.cs
new file mode 100644
index 0000000..b0386fe
--- /dev/null
+++ b/mcs/class/Microsoft.Build/Microsoft.Build.Execution/ProjectMetadataInstance.cs
@@ -0,0 +1,41 @@
+//
+// ProjectMetadataInstance.cs
+//
+// Author:
+//   Rolf Bjarne Kvinge (rolf at xamarin.com)
+//
+// Copyright (C) 2011 Xamarin Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+namespace Microsoft.Build.Execution
+{
+        public class ProjectMetadataInstance
+        {
+                private ProjectMetadataInstance ()
+                {
+                        throw new NotImplementedException ();
+                }
+        }
+}
+
diff --git a/mcs/class/Microsoft.Build/Microsoft.Build.Execution/ProjectPropertyInstance.cs b/mcs/class/Microsoft.Build/Microsoft.Build.Execution/ProjectPropertyInstance.cs
new file mode 100644
index 0000000..3b6b32c
--- /dev/null
+++ b/mcs/class/Microsoft.Build/Microsoft.Build.Execution/ProjectPropertyInstance.cs
@@ -0,0 +1,41 @@
+//
+// ProjectPropertyInstance.cs
+//
+// Author:
+//   Rolf Bjarne Kvinge (rolf at xamarin.com)
+//
+// Copyright (C) 2011 Xamarin Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+namespace Microsoft.Build.Execution
+{
+        public class ProjectPropertyInstance
+        {
+                private ProjectPropertyInstance ()
+                {
+                        throw new NotImplementedException ();
+                }
+        }
+}
+
diff --git a/mcs/class/Microsoft.Build/Microsoft.Build.Execution/ProjectTargetInstance.cs b/mcs/class/Microsoft.Build/Microsoft.Build.Execution/ProjectTargetInstance.cs
new file mode 100644
index 0000000..a95ee16
--- /dev/null
+++ b/mcs/class/Microsoft.Build/Microsoft.Build.Execution/ProjectTargetInstance.cs
@@ -0,0 +1,40 @@
+// ProjectTargetInstance.cs
+//
+// Author:
+//   Rolf Bjarne Kvinge (rolf at xamarin.com)
+//
+// Copyright (C) 2011 Xamarin Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+namespace Microsoft.Build.Execution
+{
+        public sealed class ProjectTargetInstance
+        {
+                private ProjectTargetInstance ()
+                {
+                        throw new NotImplementedException ();
+                }
+        }
+}
+
diff --git a/mcs/class/Microsoft.Build/Microsoft.Build.Execution/TargetResult.cs b/mcs/class/Microsoft.Build/Microsoft.Build.Execution/TargetResult.cs
new file mode 100644
index 0000000..863966b
--- /dev/null
+++ b/mcs/class/Microsoft.Build/Microsoft.Build.Execution/TargetResult.cs
@@ -0,0 +1,55 @@
+// TargetResult.cs
+//
+// Author:
+//   Rolf Bjarne Kvinge (rolf at xamarin.com)
+//
+// Copyright (C) 2011 Xamarin Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using Microsoft.Build.Framework;
+
+using System;
+
+namespace Microsoft.Build.Execution
+{
+        public class TargetResult : ITargetResult
+        {
+                internal TargetResult ()
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public Exception Exception {
+                        get { throw new NotImplementedException (); }
+                }
+
+                public ITaskItem[] Items {
+                        get { throw new NotImplementedException (); }
+                }
+
+
+                public TargetResultCode ResultCode {
+                        get { throw new NotImplementedException (); }
+                }
+        }
+}
+
diff --git a/mcs/class/Microsoft.Build/Microsoft.Build.Execution/TargetResultCode.cs b/mcs/class/Microsoft.Build/Microsoft.Build.Execution/TargetResultCode.cs
new file mode 100644
index 0000000..de612c4
--- /dev/null
+++ b/mcs/class/Microsoft.Build/Microsoft.Build.Execution/TargetResultCode.cs
@@ -0,0 +1,37 @@
+// TargetResultCode.cs
+//
+// Author:
+//   Rolf Bjarne Kvinge (rolf at xamarin.com)
+//
+// Copyright (C) 2011 Xamarin Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+namespace Microsoft.Build.Execution
+{
+        public enum TargetResultCode : byte
+        {
+                Skipped,
+                Success,
+                Failure,
+        }
+}
+
diff --git a/mcs/class/Microsoft.Build/Microsoft.Build.Internal/CollectionFromEnumerable.cs b/mcs/class/Microsoft.Build/Microsoft.Build.Internal/CollectionFromEnumerable.cs
new file mode 100644
index 0000000..3c2f6f7
--- /dev/null
+++ b/mcs/class/Microsoft.Build/Microsoft.Build.Internal/CollectionFromEnumerable.cs
@@ -0,0 +1,104 @@
+//
+// CollectionFromEnumerable.cs
+//
+// Author:
+//   Leszek Ciesielski (skolima at gmail.com)
+//
+// (C) 2011 Leszek Ciesielski
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Microsoft.Build.Internal
+{
+        internal class CollectionFromEnumerable<T> : ICollection<T>
+        {
+                IEnumerable<T> backingEnumerable;
+
+                public CollectionFromEnumerable (IEnumerable<T> enumerable)
+                {
+                        backingEnumerable = enumerable;
+                }
+
+                public void Add (T item)
+                {
+                        throw new InvalidOperationException ("This collection is read-only.");
+                }
+
+                public void Clear ()
+                {
+                        throw new InvalidOperationException ("This collection is read-only.");
+                }
+
+                public bool Contains (T item)
+                {
+                        List<T> backingList = backingEnumerable as List<T>;
+                        if (backingList != null)
+                                return backingList.Contains (item);
+                        return backingEnumerable.Contains (item);
+                }
+
+                public void CopyTo (T[] array, int arrayIndex)
+                {
+                        List<T> backingList = backingEnumerable as List<T>;
+                        if (backingList != null) {
+                                backingList.CopyTo (array, arrayIndex);
+                                return;
+                        }
+                        int i = arrayIndex;
+                        foreach (var item in backingEnumerable) {
+                                array[i++] = item;
+                        }
+                }
+
+                public int Count {
+                        get {
+                                var backingList = backingEnumerable as List<T>;
+                                if(backingList == null)
+                                        backingEnumerable = backingList = new List<T> (backingEnumerable);
+                                return backingList.Count;
+                        }
+                }
+
+                public bool IsReadOnly {
+                        get { return true; }
+                }
+
+                public bool Remove (T item)
+                {
+                        throw new InvalidOperationException ("This collection is read-only.");
+                }
+
+                public IEnumerator<T> GetEnumerator ()
+                {
+                        return backingEnumerable.GetEnumerator ();
+                }
+
+                System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator ()
+                {
+                        return backingEnumerable.GetEnumerator ();
+                }
+        }
+}
diff --git a/mcs/class/Microsoft.Build/Microsoft.Build.Internal/FilteredEnumerable.cs b/mcs/class/Microsoft.Build/Microsoft.Build.Internal/FilteredEnumerable.cs
new file mode 100644
index 0000000..1b8f1b7
--- /dev/null
+++ b/mcs/class/Microsoft.Build/Microsoft.Build.Internal/FilteredEnumerable.cs
@@ -0,0 +1,60 @@
+//
+// FilteredEnumerable.cs
+//
+// Author:
+//   Leszek Ciesielski (skolima at gmail.com)
+//
+// (C) 2011 Leszek Ciesielski
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Microsoft.Build.Internal
+{
+        internal class FilteredEnumerable<T> : IEnumerable<T> where T : class
+        {
+                System.Collections.IEnumerable backingEnumerable;
+
+                public FilteredEnumerable (System.Collections.IEnumerable enumerable)
+                {
+                        backingEnumerable = enumerable;
+                }
+
+                public IEnumerator<T> GetEnumerator ()
+                {
+                        foreach (var item in backingEnumerable) {
+                                var typedItem = item as T;
+                                if (typedItem != null)
+                                        yield return typedItem;
+                        }
+
+                }
+
+                System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator ()
+                {
+                        return GetEnumerator ();
+                }
+        }
+}
diff --git a/mcs/class/Microsoft.Build/Microsoft.Build.Internal/ReverseEnumerable.cs b/mcs/class/Microsoft.Build/Microsoft.Build.Internal/ReverseEnumerable.cs
new file mode 100644
index 0000000..322b7a6
--- /dev/null
+++ b/mcs/class/Microsoft.Build/Microsoft.Build.Internal/ReverseEnumerable.cs
@@ -0,0 +1,53 @@
+//
+// ReverseEnumerable.cs
+//
+// Author:
+//   Leszek Ciesielski (skolima at gmail.com)
+//
+// (C) 2011 Leszek Ciesielski
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System.Collections.Generic;
+
+namespace Microsoft.Build.Internal
+{
+        internal class ReverseEnumerable<T> : IEnumerable<T>
+        {
+                LinkedList<T> backingList;
+
+                public ReverseEnumerable (LinkedList<T> list)
+                {
+                        backingList = list;
+                }
+
+                public IEnumerator<T> GetEnumerator ()
+                {
+                        for (var node = backingList.Last; node != null; node = node.Previous)
+                                yield return node.Value;
+                }
+
+                System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator ()
+                {
+                        return GetEnumerator ();
+                }
+        }
+}
diff --git a/mcs/class/Microsoft.Build/Microsoft.Build.Logging/ColorResetter.cs b/mcs/class/Microsoft.Build/Microsoft.Build.Logging/ColorResetter.cs
new file mode 100644
index 0000000..5bd3da3
--- /dev/null
+++ b/mcs/class/Microsoft.Build/Microsoft.Build.Logging/ColorResetter.cs
@@ -0,0 +1,32 @@
+// ColorResetter.cs
+//
+// Author:
+//   Rolf Bjarne Kvinge (rolf at xamarin.com)
+//
+// Copyright (C) 2011 Xamarin Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+namespace Microsoft.Build.Logging
+{
+        public delegate void ColorResetter ();
+}
+
diff --git a/mcs/class/Microsoft.Build/Microsoft.Build.Logging/ColorSetter.cs b/mcs/class/Microsoft.Build/Microsoft.Build.Logging/ColorSetter.cs
new file mode 100644
index 0000000..7e510e7
--- /dev/null
+++ b/mcs/class/Microsoft.Build/Microsoft.Build.Logging/ColorSetter.cs
@@ -0,0 +1,32 @@
+// ColorSetter.cs
+//
+// Author:
+//   Rolf Bjarne Kvinge (rolf at xamarin.com)
+//
+// Copyright (C) 2011 Xamarin Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+namespace Microsoft.Build.Logging
+{
+        public delegate void ColorSetter (System.ConsoleColor color);
+}
+
diff --git a/mcs/class/Microsoft.Build/Microsoft.Build.Logging/ConsoleLogger.cs b/mcs/class/Microsoft.Build/Microsoft.Build.Logging/ConsoleLogger.cs
new file mode 100644
index 0000000..161476c
--- /dev/null
+++ b/mcs/class/Microsoft.Build/Microsoft.Build.Logging/ConsoleLogger.cs
@@ -0,0 +1,89 @@
+// ConsoleLogger.cs
+//
+// Author:
+//   Rolf Bjarne Kvinge (rolf at xamarin.com)
+//
+// Copyright (C) 2011 Xamarin Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using Microsoft.Build.Framework;
+
+using System;
+
+namespace Microsoft.Build.Logging
+{
+        public class ConsoleLogger : INodeLogger
+        {
+                public ConsoleLogger ()
+                        : this (LoggerVerbosity.Normal)
+                {
+                }
+
+                public ConsoleLogger (LoggerVerbosity verbosity)
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public ConsoleLogger (LoggerVerbosity verbosity, WriteHandler write, ColorSetter colorSet, ColorResetter colorReset)
+                {
+                        throw new NotImplementedException ();
+                }
+
+                #region INodeLogger implementation
+                public void Initialize (IEventSource eventSource, int nodeCount)
+                {
+                        throw new NotImplementedException ();
+                }
+                #endregion
+
+                #region ILogger implementation
+                public void Initialize (IEventSource eventSource)
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public void Shutdown ()
+                {
+                        throw new NotImplementedException ();
+                }
+
+                public string Parameters {
+                        get {
+                                throw new NotImplementedException ();
+                        }
+                        set {
+                                throw new NotImplementedException ();
+                        }
+                }
+
+                public LoggerVerbosity Verbosity {
+                        get {
+                                throw new NotImplementedException ();
+                        }
+                        set {
+                                throw new NotImplementedException ();
+                        }
+                }
+                #endregion
+        }
+}
+
diff --git a/mcs/class/Microsoft.Build/Microsoft.Build.Logging/FileLogger.cs b/mcs/class/Microsoft.Build/Microsoft.Build.Logging/FileLogger.cs
new file mode 100644
index 0000000..331d29a
--- /dev/null
+++ b/mcs/class/Microsoft.Build/Microsoft.Build.Logging/FileLogger.cs
@@ -0,0 +1,36 @@
+// FileLogger.cs
+//
+// Author:
+//   Rolf Bjarne Kvinge (rolf at xamarin.com)
+//
+// Copyright (C) 2011 Xamarin Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+namespace Microsoft.Build.Logging
+{
+        public class FileLogger
+        {
+        }
+}
+
diff --git a/mcs/class/Microsoft.Build/Microsoft.Build.Logging/ForwardingLoggerRecord.cs b/mcs/class/Microsoft.Build/Microsoft.Build.Logging/ForwardingLoggerRecord.cs
new file mode 100644
index 0000000..84be38d
--- /dev/null
+++ b/mcs/class/Microsoft.Build/Microsoft.Build.Logging/ForwardingLoggerRecord.cs
@@ -0,0 +1,45 @@
+// ForwardingLoggerRecord.cs
+//
+// Author:
+//   Rolf Bjarne Kvinge (rolf at xamarin.com)
+//
+// Copyright (C) 2011 Xamarin Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using Microsoft.Build.Framework;
+
+namespace Microsoft.Build.Logging
+{
+        public class ForwardingLoggerRecord
+        {
+                public ForwardingLoggerRecord (ILogger centralLogger, LoggerDescription forwardingLoggerDescription)
+                {
+                        this.CentralLogger = centralLogger;
+                        this.ForwardingLoggerDescription = forwardingLoggerDescription;
+                }
+
+                public ILogger CentralLogger { get; private set; }
+                public LoggerDescription ForwardingLoggerDescription { get; private set; }
+        }
+}
+
diff --git a/mcs/class/Microsoft.Build/Microsoft.Build.Logging/LoggerDescription.cs b/mcs/class/Microsoft.Build/Microsoft.Build.Logging/LoggerDescription.cs
new file mode 100644
index 0000000..5115402
--- /dev/null
+++ b/mcs/class/Microsoft.Build/Microsoft.Build.Logging/LoggerDescription.cs
@@ -0,0 +1,43 @@
+// LoggerDescription.cs
+//
+// Author:
+//   Rolf Bjarne Kvinge (rolf at xamarin.com)
+//
+// Copyright (C) 2011 Xamarin Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using Microsoft.Build.Framework;
+
+namespace Microsoft.Build.Logging
+{
+        public class LoggerDescription
+        {
+                public LoggerDescription (string loggerClassName, string loggerAssemblyName,
+                        string loggerAssemblyFile, string loggerSwitchParameters,
+                        LoggerVerbosity verbosity)
+                {
+                        throw new NotImplementedException ();
+                }
+        }
+}
+
diff --git a/mcs/class/Microsoft.Build/Microsoft.Build.Logging/WriteHandler.cs b/mcs/class/Microsoft.Build/Microsoft.Build.Logging/WriteHandler.cs
new file mode 100644
index 0000000..29ce75c
--- /dev/null
+++ b/mcs/class/Microsoft.Build/Microsoft.Build.Logging/WriteHandler.cs
@@ -0,0 +1,32 @@
+// WriteHandler.cs
+//
+// Author:
+//   Rolf Bjarne Kvinge (rolf at xamarin.com)
+//
+// Copyright (C) 2011 Xamarin Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+namespace Microsoft.Build.Logging
+{
+        public delegate void WriteHandler (string message);
+}
+
diff --git a/mcs/class/Microsoft.Build/Microsoft.Build.dll.sources b/mcs/class/Microsoft.Build/Microsoft.Build.dll.sources
new file mode 100644
index 0000000..1cc5529
--- /dev/null
+++ b/mcs/class/Microsoft.Build/Microsoft.Build.dll.sources
@@ -0,0 +1,66 @@
+Assembly/AssemblyInfo.cs
+../../build/common/Consts.cs
+../../build/common/MonoTODOAttribute.cs
+Microsoft.Build.Construction/ProjectChooseElement.cs
+Microsoft.Build.Construction/ProjectCommentElement.cs
+Microsoft.Build.Construction/ProjectElementContainer.cs
+Microsoft.Build.Construction/ProjectElement.cs
+Microsoft.Build.Construction/ProjectExtensionsElement.cs
+Microsoft.Build.Construction/ProjectImportElement.cs
+Microsoft.Build.Construction/ProjectImportGroupElement.cs
+Microsoft.Build.Construction/ProjectItemDefinitionElement.cs
+Microsoft.Build.Construction/ProjectItemDefinitionGroupElement.cs
+Microsoft.Build.Construction/ProjectItemElement.cs
+Microsoft.Build.Construction/ProjectItemGroupElement.cs
+Microsoft.Build.Construction/ProjectMetadataElement.cs
+Microsoft.Build.Construction/ProjectOnErrorElement.cs
+Microsoft.Build.Construction/ProjectOtherwiseElement.cs
+Microsoft.Build.Construction/ProjectOutputElement.cs
+Microsoft.Build.Construction/ProjectPropertyElement.cs
+Microsoft.Build.Construction/ProjectPropertyGroupElement.cs
+Microsoft.Build.Construction/ProjectRootElement.cs
+Microsoft.Build.Construction/ProjectTargetElement.cs
+Microsoft.Build.Construction/ProjectTaskElement.cs
+Microsoft.Build.Construction/ProjectUsingTaskBodyElement.cs
+Microsoft.Build.Construction/ProjectUsingTaskElement.cs
+Microsoft.Build.Construction/ProjectUsingTaskParameterElement.cs
+Microsoft.Build.Construction/ProjectWhenElement.cs
+Microsoft.Build.Construction/UsingTaskParameterGroupElement.cs
+Microsoft.Build.Evaluation/Project.cs
+Microsoft.Build.Evaluation/ProjectCollection.cs
+Microsoft.Build.Evaluation/ProjectItem.cs
+Microsoft.Build.Evaluation/ProjectItemDefinition.cs
+Microsoft.Build.Evaluation/ProjectLoadSettings.cs 
+Microsoft.Build.Evaluation/ProjectMetadata.cs
+Microsoft.Build.Evaluation/ProjectProperty.cs
+Microsoft.Build.Evaluation/ResolvedImport.cs
+Microsoft.Build.Evaluation/Toolset.cs
+Microsoft.Build.Evaluation/ToolsetDefinitionLocations.cs
+Microsoft.Build.Exceptions/InvalidProjectFileException.cs
+Microsoft.Build.Execution/BuildManager.cs
+Microsoft.Build.Execution/BuildParameters.cs
+Microsoft.Build.Execution/BuildRequestData.cs
+Microsoft.Build.Execution/BuildRequestDataFlags.cs
+Microsoft.Build.Execution/BuildResult.cs
+Microsoft.Build.Execution/BuildResultCode.cs 
+Microsoft.Build.Execution/BuildSubmission.cs
+Microsoft.Build.Execution/HostServices.cs
+Microsoft.Build.Execution/ITargetResult.cs
+Microsoft.Build.Execution/NodeAffinity.cs
+Microsoft.Build.Execution/ProjectInstance.cs
+Microsoft.Build.Execution/ProjectItemInstance.cs
+Microsoft.Build.Execution/ProjectMetadataInstance.cs
+Microsoft.Build.Execution/ProjectPropertyInstance.cs
+Microsoft.Build.Execution/ProjectTargetInstance.cs
+Microsoft.Build.Execution/TargetResult.cs                           
+Microsoft.Build.Execution/TargetResultCode.cs
+Microsoft.Build.Internal/CollectionFromEnumerable.cs
+Microsoft.Build.Internal/FilteredEnumerable.cs
+Microsoft.Build.Internal/ReverseEnumerable.cs
+Microsoft.Build.Logging/ColorResetter.cs
+Microsoft.Build.Logging/ColorSetter.cs
+Microsoft.Build.Logging/ConsoleLogger.cs
+Microsoft.Build.Logging/FileLogger.cs
+Microsoft.Build.Logging/ForwardingLoggerRecord.cs
+Microsoft.Build.Logging/LoggerDescription.cs
+Microsoft.Build.Logging/WriteHandler.cs
diff --git a/mcs/class/Mono.Data.Sqlite/ChangeLog b/mcs/class/Mono.Data.Sqlite/ChangeLog
index db58942..16b81fc 100644
--- a/mcs/class/Mono.Data.Sqlite/ChangeLog
+++ b/mcs/class/Mono.Data.Sqlite/ChangeLog
@@ -1,3 +1,17 @@
+2011-11-02  Rolf Bjarne Kvinge  <rolf at xamarin.com>
+
+	[Mono.Data.Sqlite] Use a prebuilt resources file like
+	Managed.Windows.Forms does.
+
+	This makes it possible to build the monotouch profile, since
+	generating the resources file requires a System.Windows.Forms.dll,
+	which monotouch doesn't have.
+
+2011-09-15  Sebastien Pouliot  <sebastien at xamarin.com>
+
+	Allow commit/rollback/update events to work under MonoTouch. Fix
+	bug #233
+
 2010-12-29  Marek Safar  <marek.safar at gmail.com>
 
 	Fixed Mono.Data.Sqlite dependencies
diff --git a/mcs/class/Mono.Data.Sqlite/Makefile b/mcs/class/Mono.Data.Sqlite/Makefile
index 50bf887..6593318 100644
--- a/mcs/class/Mono.Data.Sqlite/Makefile
+++ b/mcs/class/Mono.Data.Sqlite/Makefile
@@ -7,6 +7,8 @@ OTHER_RESOURCES = $(wildcard resources/*.bmp)
 
 RESOURCES = $(RESX_RESOURCES) $(OTHER_RESOURCES)
 
+PREBUILT = $(RESX_RESOURCES:=.prebuilt)
+
 LIBRARY = Mono.Data.Sqlite.dll
 LIB_MCS_FLAGS = /unsafe /r:System.dll /r:System.Data.dll /r:System.Transactions.dll /r:System.Xml.dll \
 	$(RESOURCES:%=-resource:%) -d:SQLITE_STANDARD
@@ -19,8 +21,11 @@ EXTRA_DISTFILES = Test/SqliteTest.cs \
 	resources/ChangeLog	\
 	resources/DataTypes.xml	\
 	resources/MetaDataCollections.xml \
+	$(PREBUILT) \
 	$(wildcard resources/*.bmp)
 
+CLEAN_FILES = $(RESX_RESOURCES)
+
 test-local: test.db 
 
 test.db: Test/test.sql
@@ -31,5 +36,9 @@ include ../../build/library.make
 
 $(the_lib): $(RESOURCES)
 
+$(PREBUILT): %.prebuilt: %
+	cp $* $@
+
 $(RESX_RESOURCES): %.resources: %.resx
-	$(RESGEN) $<
+	$(RESGEN) $< || cp $@.prebuilt $@
+
diff --git a/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite.dll.sources b/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite.dll.sources
index 7ee134b..206efb2 100644
--- a/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite.dll.sources
+++ b/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite.dll.sources
@@ -2,6 +2,7 @@ Assembly/AssemblyInfo.cs
 ../../build/common/Consts.cs
 ../../build/common/Locale.cs
 ../../build/common/MonoTODOAttribute.cs
+Mono.Data.Sqlite_2.0/MonoPInvokeCallbackAttribute.cs
 Mono.Data.Sqlite_2.0/SQLite3.cs
 Mono.Data.Sqlite_2.0/SQLite3_UTF16.cs
 Mono.Data.Sqlite_2.0/SQLiteBase.cs
diff --git a/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/ChangeLog b/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/ChangeLog
index d1fb597..2aa4283 100644
--- a/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/ChangeLog
+++ b/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/ChangeLog
@@ -1,3 +1,13 @@
+2011-09-24  Sebastien Pouliot  <sebastien at xamarin.com>
+
+	Provide binding for sqlite3_config to allow setting the threading
+	model. Fix bug #652
+
+2011-09-15  Sebastien Pouliot  <sebastien at xamarin.com>
+
+	Allow commit/rollback/update events to work under MonoTouch. Fix
+	bug #233
+
 2009-07-10  Atsushi Enomoto  <atsushi at ximian.com>
 
 	* SQLiteConnection.cs : remove Console.WriteLine().
diff --git a/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/ChangeLog b/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/ChangeLog.old
similarity index 100%
copy from mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/ChangeLog
copy to mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/ChangeLog.old
diff --git a/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/MonoPInvokeCallbackAttribute.cs b/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/MonoPInvokeCallbackAttribute.cs
new file mode 100644
index 0000000..305c09b
--- /dev/null
+++ b/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/MonoPInvokeCallbackAttribute.cs
@@ -0,0 +1,36 @@
+//
+// MonoPInvokeCallbackAttribute.cs: necessary for AOT ports of Mono
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if MONOTOUCH
+
+using System;
+
+namespace MonoTouch {
+
+	[AttributeUsage (AttributeTargets.Method)]
+	sealed class MonoPInvokeCallbackAttribute : Attribute {
+			public MonoPInvokeCallbackAttribute (Type t) {}
+	}
+}
+
+#endif
\ No newline at end of file
diff --git a/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/SQLite3.cs b/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/SQLite3.cs
index a5cbda5..4823ba2 100644
--- a/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/SQLite3.cs
+++ b/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/SQLite3.cs
@@ -29,6 +29,9 @@ namespace Mono.Data.Sqlite
 #if !PLATFORM_COMPACTFRAMEWORK
     private bool _buildingSchema = false;
 #endif
+#if MONOTOUCH
+    GCHandle gch;
+#endif
     /// <summary>
     /// The user-defined functions registered on this connection
     /// </summary>
@@ -37,12 +40,19 @@ namespace Mono.Data.Sqlite
     internal SQLite3(SQLiteDateFormats fmt)
       : base(fmt)
     {
+#if MONOTOUCH
+      gch = GCHandle.Alloc (this);
+#endif
     }
 
     protected override void Dispose(bool bDisposing)
     {
       if (bDisposing)
         Close();
+#if MONOTOUCH
+      if (gch.IsAllocated)
+        gch.Free ();
+#endif
     }
 
     // It isn't necessary to cleanup any functions we've registered.  If the connection
@@ -866,7 +876,60 @@ namespace Mono.Data.Sqlite
       int n = UnsafeNativeMethods.sqlite3_rekey(_sql, newPasswordBytes, (newPasswordBytes == null) ? 0 : newPasswordBytes.Length);
       if (n > 0) throw new SqliteException(n, SQLiteLastError());
     }
+		
+#if MONOTOUCH
+    SQLiteUpdateCallback update_callback;
+    SQLiteCommitCallback commit_callback;
+    SQLiteRollbackCallback rollback_callback;
+		
+    [MonoTouch.MonoPInvokeCallback (typeof (SQLiteUpdateCallback))]
+    static void update (IntPtr puser, int type, IntPtr database, IntPtr table, Int64 rowid)
+    {
+      SQLite3 instance = GCHandle.FromIntPtr (puser).Target as SQLite3;
+      instance.update_callback (puser, type, database, table, rowid);
+    }
+			
+    internal override void SetUpdateHook (SQLiteUpdateCallback func)
+    {
+      update_callback = func;
+      if (func == null)
+        UnsafeNativeMethods.sqlite3_update_hook (_sql, null, IntPtr.Zero);
+      else
+        UnsafeNativeMethods.sqlite3_update_hook (_sql, update, GCHandle.ToIntPtr (gch));
+    }
 
+    [MonoTouch.MonoPInvokeCallback (typeof (SQLiteCommitCallback))]
+    static int commit (IntPtr puser)
+    {
+      SQLite3 instance = GCHandle.FromIntPtr (puser).Target as SQLite3;
+      return instance.commit_callback (puser);
+    }
+		
+    internal override void SetCommitHook (SQLiteCommitCallback func)
+    {
+      commit_callback = func;
+      if (func == null)
+        UnsafeNativeMethods.sqlite3_commit_hook (_sql, null, IntPtr.Zero);
+      else
+        UnsafeNativeMethods.sqlite3_commit_hook (_sql, commit, GCHandle.ToIntPtr (gch));
+    }
+
+    [MonoTouch.MonoPInvokeCallback (typeof (SQLiteRollbackCallback))]
+    static void rollback (IntPtr puser)
+    {
+      SQLite3 instance = GCHandle.FromIntPtr (puser).Target as SQLite3;
+      instance.rollback_callback (puser);
+    }
+
+    internal override void SetRollbackHook (SQLiteRollbackCallback func)
+    {
+      rollback_callback = func;
+      if (func == null)
+        UnsafeNativeMethods.sqlite3_rollback_hook (_sql, null, IntPtr.Zero);
+      else
+        UnsafeNativeMethods.sqlite3_rollback_hook (_sql, rollback, GCHandle.ToIntPtr (gch));
+    }
+#else
     internal override void SetUpdateHook(SQLiteUpdateCallback func)
     {
       UnsafeNativeMethods.sqlite3_update_hook(_sql, func, IntPtr.Zero);
@@ -881,7 +944,7 @@ namespace Mono.Data.Sqlite
     {
       UnsafeNativeMethods.sqlite3_rollback_hook(_sql, func, IntPtr.Zero);
     }
-
+#endif
     /// <summary>
     /// Helper function to retrieve a column of data from an active statement.
     /// </summary>
diff --git a/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/SQLiteBase.cs b/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/SQLiteBase.cs
index 4192f8c..f15961d 100644
--- a/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/SQLiteBase.cs
+++ b/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/SQLiteBase.cs
@@ -253,4 +253,11 @@ namespace Mono.Data.Sqlite
     SharedCache = 0x01000000,
     Default = 0x06,
   }
+
+  // subset of the options available in http://www.sqlite.org/c3ref/c_config_getmalloc.html
+  public enum SQLiteConfig {
+    SingleThread = 1,
+    MultiThread = 2,
+    Serialized = 3,
+  }
 }
diff --git a/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/SQLiteConnection.cs b/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/SQLiteConnection.cs
index be663d7..c38f418 100644
--- a/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/SQLiteConnection.cs
+++ b/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/SQLiteConnection.cs
@@ -2287,6 +2287,13 @@ namespace Mono.Data.Sqlite
     {
       _rollbackHandler(this, EventArgs.Empty);
     }
+
+    // http://www.sqlite.org/c3ref/config.html
+    public static void SetConfig (SQLiteConfig config)
+    {
+      int n = UnsafeNativeMethods.sqlite3_config (config);
+      if (n > 0) throw new SqliteException (n, null);
+    }
   }
 
   /// <summary>
diff --git a/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/UnsafeNativeMethods.cs b/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/UnsafeNativeMethods.cs
index 0823acf..bb01c8a 100644
--- a/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/UnsafeNativeMethods.cs
+++ b/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/UnsafeNativeMethods.cs
@@ -686,6 +686,13 @@ namespace Mono.Data.Sqlite
 #endif
     internal static extern int sqlite3_exec(IntPtr db, byte[] strSql, IntPtr pvCallback, IntPtr pvParam, out IntPtr errMsg);
 
+#if !PLATFORM_COMPACTFRAMEWORK
+    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
+#else
+    [DllImport(SQLITE_DLL)]
+#endif
+    internal static extern int sqlite3_config (SQLiteConfig config);
+
     #endregion
   }
 
diff --git a/mcs/class/Mono.Data.Sqlite/resources/ChangeLog b/mcs/class/Mono.Data.Sqlite/resources/ChangeLog
index 1437c11..dff6879 100644
--- a/mcs/class/Mono.Data.Sqlite/resources/ChangeLog
+++ b/mcs/class/Mono.Data.Sqlite/resources/ChangeLog
@@ -1,3 +1,12 @@
+2011-11-02  Rolf Bjarne Kvinge  <rolf at xamarin.com>
+
+	[Mono.Data.Sqlite] Use a prebuilt resources file like
+	Managed.Windows.Forms does.
+
+	This makes it possible to build the monotouch profile, since
+	generating the resources file requires a System.Windows.Forms.dll,
+	which monotouch doesn't have.
+
 2007-02-03  Marek Habersack  <grendello at gmail.com>
 
 	* SR.resx: New file
diff --git a/mcs/class/Mono.Data.Sqlite/resources/ChangeLog b/mcs/class/Mono.Data.Sqlite/resources/ChangeLog.old
similarity index 100%
copy from mcs/class/Mono.Data.Sqlite/resources/ChangeLog
copy to mcs/class/Mono.Data.Sqlite/resources/ChangeLog.old
diff --git a/mcs/class/Mono.Data.Sqlite/resources/SR.resources.prebuilt b/mcs/class/Mono.Data.Sqlite/resources/SR.resources.prebuilt
new file mode 100644
index 0000000..2b09f9e
Binary files /dev/null and b/mcs/class/Mono.Data.Sqlite/resources/SR.resources.prebuilt differ
diff --git a/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/ChangeLog b/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/ChangeLog
index 48beb38..f3b3285 100644
--- a/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/ChangeLog
+++ b/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/ChangeLog
@@ -1,3 +1,8 @@
+2011-11-08  Neale Ferguson  <neale at sinenomine.net>
+
+	Fixes bug 1916 - incorrect appending of string to buffer when
+	remaining buffer size is less than string size.
+
 2011-05-05  Veerapuram Varadhan  <v.varadhan at gmail.com>
 
 	** Fixes #681916
diff --git a/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/ChangeLog b/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/ChangeLog.old
similarity index 100%
copy from mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/ChangeLog
copy to mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/ChangeLog.old
diff --git a/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsComm.cs b/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsComm.cs
index cd2c597..2f5eb56 100644
--- a/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsComm.cs
+++ b/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsComm.cs
@@ -391,28 +391,9 @@ namespace Mono.Data.Tds.Protocol {
 			if (tdsVersion < TdsVersion.tds70) { 
 				Append (encoder.GetBytes (s));
 			} else {
-				int cindex = 0, index;
-				int ssize = sizeof (short);
-				int lenToWrite = s.Length * ssize;
-				// if nextOutBufferLength points to the last buffer in outBuffer, 
-				// we would get a DivisionByZero while calculating remBufLen
-				if (outBufferLength - nextOutBufferIndex < ssize)
-					SendIfFull (ssize);
-				
-				int remBufLen = outBufferLength - nextOutBufferIndex;
-				int count = lenToWrite/remBufLen;
-				
-				if (lenToWrite % remBufLen > 0)
-					count++;
-			
-				for (int i = 0; i < count; i++) {
-					index = System.Math.Min (remBufLen/ssize, lenToWrite/ssize);
-					for (int j = 0; j < index*ssize; j+=2, cindex++)
-						AppendInternal ((short)s[cindex]);
-					
-					lenToWrite -= index*ssize;
-					// Just make sure to flush the buffer
-					SendIfFull ((lenToWrite+1)*ssize);
+				for (int i = 0; i < s.Length; i++) {
+					SendIfFull (sizeof(short));
+					AppendInternal ((short)s[i]);
 				}
 			}
 		}	
diff --git a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/ArrayMirror.cs b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/ArrayMirror.cs
index c58b2f0..57a7951 100644
--- a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/ArrayMirror.cs
+++ b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/ArrayMirror.cs
@@ -13,6 +13,9 @@ namespace Mono.Debugger.Soft
 		internal ArrayMirror (VirtualMachine vm, long id) : base (vm, id) {
 		}
 
+		internal ArrayMirror (VirtualMachine vm, long id, TypeMirror type, AppDomainMirror domain) : base (vm, id, type, domain) {
+		}
+
 		public int Length {
 			get {
 				GetLengths ();
diff --git a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/ChangeLog b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/ChangeLog
index e9d8a48..4e42278 100644
--- a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/ChangeLog
+++ b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/ChangeLog
@@ -1,3 +1,23 @@
+2011-09-29  Rodrigo Kumpera  <kumpera at gmail.com>
+
+	Request ObjectMirror type and domain in a single request.
+
+2011-08-24  Rodrigo Kumpera  <kumpera at gmail.com>
+
+	Cache thread id.
+
+2011-08-24  Rodrigo Kumpera  <kumpera at gmail.com>
+
+	Cache source files.
+
+2011-08-23  Rodrigo Kumpera  <kumpera at gmail.com>
+
+	Cache ObjectMirror type and domain.
+
+2011-08-23  Rodrigo Kumpera  <kumpera at gmail.com>
+
+	Avoid looking up the ctor mirror twice.
+
 2011-04-27  Martin Baulig  <martin at novell.com>
 
 	Add socket timeouts to the soft debugger.
diff --git a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/Connection.cs b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/Connection.cs
index 823b95b..6d392a0 100644
--- a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/Connection.cs
+++ b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/Connection.cs
@@ -102,6 +102,11 @@ namespace Mono.Debugger.Soft
 		public bool is_thread_pool;
 	}
 
+	struct ObjectRefInfo {
+		public long type_id;
+		public long domain_id;
+	}
+
 	enum ValueTypeId {
 		VALUE_TYPE_ID_NULL = 0xf0,
 		VALUE_TYPE_ID_TYPE = 0xf1
@@ -317,8 +322,8 @@ namespace Mono.Debugger.Soft
 		 * features might not be available. This allows older clients to communicate
 		 * with newer runtimes, and vice versa.
 		 */
-		public const int MAJOR_VERSION = 2;
-		public const int MINOR_VERSION = 3;
+		internal const int MAJOR_VERSION = 2;
+		internal const int MINOR_VERSION = 5;
 
 		enum WPSuspendPolicy {
 			NONE = 0,
@@ -478,7 +483,8 @@ namespace Mono.Debugger.Soft
 			IS_COLLECTED = 3,
 			GET_ADDRESS = 4,
 			GET_DOMAIN = 5,
-			SET_VALUES = 6
+			SET_VALUES = 6,
+			GET_INFO = 7,
 		}
 
 		class Header {
@@ -1902,6 +1908,15 @@ namespace Mono.Debugger.Soft
 			return SendReceive (CommandSet.OBJECT_REF, (int)CmdObjectRef.GET_ADDRESS, new PacketWriter ().WriteId (id)).ReadLong ();
 		}			
 
+		internal ObjectRefInfo Object_GetInfo (long id) {
+			ObjectRefInfo res = new ObjectRefInfo ();
+			PacketReader r = SendReceive (CommandSet.OBJECT_REF, (int)CmdObjectRef.GET_INFO, new PacketWriter ().WriteId (id));
+
+			res.type_id = r.ReadId ();
+			res.domain_id = r.ReadId ();
+			return res;
+		}
+
 	}
 
 	/* This is the interface exposed by the debugger towards the debugger agent */
diff --git a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/CustomAttributeDataMirror.cs b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/CustomAttributeDataMirror.cs
index 69f039b..d1ab7e6 100644
--- a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/CustomAttributeDataMirror.cs
+++ b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/CustomAttributeDataMirror.cs
@@ -133,7 +133,7 @@ namespace Mono.Debugger.Soft {
 					if (named_args [j] == null)
 						throw new NotImplementedException ();
 				}
-				res [i] = new CustomAttributeDataMirror (vm.GetMethod (attr.ctor_id), ctor_args, named_args);
+				res [i] = new CustomAttributeDataMirror (ctor, ctor_args, named_args);
 			}
 
 			return res;
diff --git a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/ObjectMirror.cs b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/ObjectMirror.cs
index 8b0db99..f252fb6 100644
--- a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/ObjectMirror.cs
+++ b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/ObjectMirror.cs
@@ -6,19 +6,44 @@ using System.Threading;
 namespace Mono.Debugger.Soft
 {
 	public class ObjectMirror : Value {
+		TypeMirror type;
+		AppDomainMirror domain;
 	
 		internal ObjectMirror (VirtualMachine vm, long id) : base (vm, id) {
 		}
 	
+		internal ObjectMirror (VirtualMachine vm, long id, TypeMirror type, AppDomainMirror domain) : base (vm, id) {
+			this.type = type;
+			this.domain = domain;
+		}
+
+		void GetInfo () {
+			var info = vm.conn.Object_GetInfo (id);
+			type = vm.GetType (info.type_id);
+			domain = vm.GetDomain (info.domain_id);
+		}
+
 		public TypeMirror Type {
 			get {
-				return vm.GetType (vm.conn.Object_GetType (id));
+				if (type == null) {
+					if (vm.conn.Version.AtLeast (2, 5))
+						GetInfo ();
+					else
+				 		type = vm.GetType (vm.conn.Object_GetType (id));
+				}
+				return type;
 			}
 		}
 
 		public AppDomainMirror Domain {
 			get {
-				return vm.GetDomain (vm.conn.Object_GetDomain (id));
+				if (domain == null) {
+					if (vm.conn.Version.AtLeast (2, 5))
+						GetInfo ();
+					else
+						domain = vm.GetDomain (vm.conn.Object_GetDomain (id));
+				}
+				return domain;
 			}
 		}
 
diff --git a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/StringMirror.cs b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/StringMirror.cs
index 30cc9a4..e2e65f6 100644
--- a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/StringMirror.cs
+++ b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/StringMirror.cs
@@ -8,6 +8,9 @@ namespace Mono.Debugger.Soft
 		internal StringMirror (VirtualMachine vm, long id) : base (vm, id) {
 		}
 
+		internal StringMirror (VirtualMachine vm, long id, TypeMirror type, AppDomainMirror domain) : base (vm, id, type, domain) {
+		}
+
 		public string Value {
 			get {
 				return vm.conn.String_GetValue (id);
diff --git a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/ThreadMirror.cs b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/ThreadMirror.cs
index 617613d..6eebafd 100644
--- a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/ThreadMirror.cs
+++ b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/ThreadMirror.cs
@@ -10,6 +10,9 @@ namespace Mono.Debugger.Soft
 		internal ThreadMirror (VirtualMachine vm, long id) : base (vm, id) {
 		}
 
+		internal ThreadMirror (VirtualMachine vm, long id, TypeMirror type, AppDomainMirror domain) : base (vm, id, type, domain) {
+		}
+
 		// FIXME: Cache, invalidate when the thread/runtime is resumed
 		public StackFrame[] GetFrames () {
 			FrameInfo[] frame_info = vm.conn.Thread_GetFrameInfo (id, 0, -1);
@@ -52,13 +55,16 @@ namespace Mono.Debugger.Soft
 			}
 		}
 
+		long? thread_id;
 		/*
 		 * Return a unique identifier for this thread, multiple ThreadMirror objects
 		 * may have the same ThreadId because of appdomains.
 		 */
 		public long ThreadId {
 			get {
-				return vm.conn.Thread_GetId (id);
+				if (thread_id == null)
+				 	thread_id = vm.conn.Thread_GetId (id);
+				return (long)thread_id;
 			}
 		}
 
diff --git a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/TypeMirror.cs b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/TypeMirror.cs
index d17fac5..fac5133 100644
--- a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/TypeMirror.cs
+++ b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/TypeMirror.cs
@@ -525,8 +525,18 @@ namespace Mono.Debugger.Soft
 			return GetSourceFiles (false);
 		}
 
+		string[] source_files;
+		string[] source_files_full_path;
 		public string[] GetSourceFiles (bool return_full_paths) {
-			return vm.conn.Type_GetSourceFiles (id, return_full_paths);
+			string[] res = return_full_paths ? source_files_full_path : source_files;
+			if (res == null) {
+				res = vm.conn.Type_GetSourceFiles (id, return_full_paths);
+				if (return_full_paths)
+					source_files_full_path = res;
+				else
+					source_files = res;
+			}
+			return res;
 		}
 
 		public C.TypeDefinition Metadata {
diff --git a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/VirtualMachine.cs b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/VirtualMachine.cs
index 14c20a7..b82bf7b 100644
--- a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/VirtualMachine.cs
+++ b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/VirtualMachine.cs
@@ -430,13 +430,13 @@ namespace Mono.Debugger.Soft
 					TypeMirror t = GetType (type_id);
 
 					if (t.Assembly == d.Corlib && t.Namespace == "System.Threading" && t.Name == "Thread")
-						obj = new ThreadMirror (this, id);
+						obj = new ThreadMirror (this, id, t, d);
 					else if (t.Assembly == d.Corlib && t.Namespace == "System" && t.Name == "String")
-						obj = new StringMirror (this, id);
+						obj = new StringMirror (this, id, t, d);
 					else if (typeof (T) == typeof (ArrayMirror))
-						obj = new ArrayMirror (this, id);
+						obj = new ArrayMirror (this, id, t, d);
 					else
-						obj = new ObjectMirror (this, id);
+						obj = new ObjectMirror (this, id, t, d);
 					objects [id] = obj;
 				}
 				return (T)obj;
diff --git a/mcs/class/Mono.Debugger.Soft/Test/ChangeLog b/mcs/class/Mono.Debugger.Soft/Test/ChangeLog
index 82fe9f5..c7d3d0b 100644
--- a/mcs/class/Mono.Debugger.Soft/Test/ChangeLog
+++ b/mcs/class/Mono.Debugger.Soft/Test/ChangeLog
@@ -1,3 +1,7 @@
+2011-09-29  Rodrigo Kumpera  <kumpera at gmail.com>
+
+	Request ObjectMirror type and domain in a single request.
+
 2011-03-07  Zoltan Varga  <vargaz at gmail.com>
 
 	Avoid an assert when returning nullable null's from sdb invokes.
diff --git a/mcs/class/Mono.Debugger.Soft/Test/dtest.cs b/mcs/class/Mono.Debugger.Soft/Test/dtest.cs
index bce4e71..19c86dc 100644
--- a/mcs/class/Mono.Debugger.Soft/Test/dtest.cs
+++ b/mcs/class/Mono.Debugger.Soft/Test/dtest.cs
@@ -1196,9 +1196,14 @@ public class DebuggerTests
 		// child should be gc'd now
 		Assert.IsTrue (child.IsCollected);
 
+		/*
+		 * No longer works since Type is read eagerly
+		 */
+		/*
 		AssertThrows<ObjectCollectedException> (delegate () {
 			TypeMirror t = child.Type;
 			});
+		*/
 
 		AssertThrows<ObjectCollectedException> (delegate () {
 				long addr = child.Address;
diff --git a/mcs/class/System.Core/ChangeLog b/mcs/class/System.Core/ChangeLog
index 640e60e..9ef6d2a 100644
--- a/mcs/class/System.Core/ChangeLog
+++ b/mcs/class/System.Core/ChangeLog
@@ -1,3 +1,7 @@
+2011-12-05  Duncan Mak  <duncan.mak at xamarin.com>
+
+	Add TimeZoneInfo.MonoTouch.cs so that it's included in dist
+
 2011-01-07  Jérémie Laval  <jeremie.laval at gmail.com>
 
 	Directly use ConcurrentDictionary with PLinq set operations
diff --git a/mcs/class/System.Core/Microsoft.Win32.SafeHandles/ChangeLog b/mcs/class/System.Core/Microsoft.Win32.SafeHandles/ChangeLog
old mode 100755
new mode 100644
index 10c7624..a0f26ac
--- a/mcs/class/System.Core/Microsoft.Win32.SafeHandles/ChangeLog
+++ b/mcs/class/System.Core/Microsoft.Win32.SafeHandles/ChangeLog
@@ -1,3 +1,8 @@
+2011-10-31  Rodrigo Kumpera  <kumpera at gmail.com>
+
+	Move all Mono.Unix deps into a single place and put a skeleton of
+	MOBILE support for mmap'd files.
+
 2009-12-13  Miguel de Icaza  <miguel at novell.com>
 
 	* SafeMemoryMappedViewHandle.cs (ReleaseHandle): implement. 
diff --git a/mcs/class/System.Core/Microsoft.Win32.SafeHandles/ChangeLog b/mcs/class/System.Core/Microsoft.Win32.SafeHandles/ChangeLog.old
similarity index 100%
copy from mcs/class/System.Core/Microsoft.Win32.SafeHandles/ChangeLog
copy to mcs/class/System.Core/Microsoft.Win32.SafeHandles/ChangeLog.old
diff --git a/mcs/class/System.Core/Microsoft.Win32.SafeHandles/SafeMemoryMappedViewHandle.cs b/mcs/class/System.Core/Microsoft.Win32.SafeHandles/SafeMemoryMappedViewHandle.cs
index 1dc6db6..33837f6 100644
--- a/mcs/class/System.Core/Microsoft.Win32.SafeHandles/SafeMemoryMappedViewHandle.cs
+++ b/mcs/class/System.Core/Microsoft.Win32.SafeHandles/SafeMemoryMappedViewHandle.cs
@@ -43,10 +43,8 @@ namespace Microsoft.Win32.SafeHandles
 		}
 
 		protected override bool ReleaseHandle () {
-			if (this.handle != (IntPtr) (-1)){
-				if (MonoUtil.IsUnix)
-					return MemoryMappedFile.UnmapPosix (this.handle, ByteLength);
-			}
+			if (this.handle != (IntPtr) (-1))
+				return MemoryMapImpl.Unmap (this.handle, ByteLength);
 			throw new NotImplementedException ();
 		}
 	}
diff --git a/mcs/class/System.Core/System.Collections.Generic/ChangeLog b/mcs/class/System.Core/System.Collections.Generic/ChangeLog
index 1d7dca9..5a6507d 100644
--- a/mcs/class/System.Core/System.Collections.Generic/ChangeLog
+++ b/mcs/class/System.Core/System.Collections.Generic/ChangeLog
@@ -1,3 +1,7 @@
+2011-11-21  Neale Ferguson  <neale at sinenomine.net>
+
+	Implement serialization
+
 2011-01-25  Geoff Norton  <grompf at sublimeintervention.com>
 
 	Further .NET 4.0 ification of the mobile profile
diff --git a/mcs/class/System.Core/System.Collections.Generic/HashSet.cs b/mcs/class/System.Core/System.Collections.Generic/HashSet.cs
index 7f8bac2..39047dc 100644
--- a/mcs/class/System.Core/System.Collections.Generic/HashSet.cs
+++ b/mcs/class/System.Core/System.Collections.Generic/HashSet.cs
@@ -572,22 +572,51 @@ namespace System.Collections.Generic {
 			return setComparer;
 		}
 
-		[MonoTODO]
 		[SecurityPermission (SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.SerializationFormatter)]
 		public virtual void GetObjectData (SerializationInfo info, StreamingContext context)
 		{
-			throw new NotImplementedException ();
+			if (info == null) {
+				throw new ArgumentNullException("info");
+			}
+			info.AddValue("Version", generation);
+			info.AddValue("Comparer", comparer, typeof(IEqualityComparer<T>));
+			info.AddValue("Capacity", (table == null) ? 0 : table.Length);
+			if (table != null) {
+				T[] tableArray = new T[table.Length];
+				CopyTo(tableArray);
+				info.AddValue("Elements", tableArray, typeof(T[]));
+			}
 		}
 
-		[MonoTODO]
 		public virtual void OnDeserialization (object sender)
 		{
-			if (si == null)
-				return;
+			if (si != null)
+			{
+				generation = (int) si.GetValue("Version", typeof(int));
+				comparer = (IEqualityComparer<T>) si.GetValue("Comparer", 
+									      typeof(IEqualityComparer<T>));
+				int capacity = (int) si.GetValue("Capacity", typeof(int));
+
+				empty_slot = NO_SLOT;
+				if (capacity > 0) {
+					table = new int[capacity];
+					slots = new T[capacity];
+
+					T[] tableArray = (T[]) si.GetValue("Elements", typeof(T[]));
+					if (tableArray == null) 
+						throw new SerializationException("Missing Elements");
+
+					for (int iElement = 0; iElement < tableArray.Length; iElement++) {
+						Add(tableArray[iElement]);
+					}
+				} else 
+					table = null;
 
-			throw new NotImplementedException ();
+				si = null;
+			}
 		}
 
+
 		IEnumerator<T> IEnumerable<T>.GetEnumerator ()
 		{
 			return new Enumerator (this);
diff --git a/mcs/class/System.Core/System.IO.MemoryMappedFiles/ChangeLog b/mcs/class/System.Core/System.IO.MemoryMappedFiles/ChangeLog
index da07be7..841b5dc 100644
--- a/mcs/class/System.Core/System.IO.MemoryMappedFiles/ChangeLog
+++ b/mcs/class/System.Core/System.IO.MemoryMappedFiles/ChangeLog
@@ -1,3 +1,12 @@
+2011-11-03  Rodrigo Kumpera  <kumpera at gmail.com>
+
+	Implement a mobile ready version of memory mapped files.
+
+2011-10-31  Rodrigo Kumpera  <kumpera at gmail.com>
+
+	Move all Mono.Unix deps into a single place and put a skeleton of
+	MOBILE support for mmap'd files.
+
 2010-12-15  Marek Safar  <marek.safar at gmail.com>
 
 	Some .net 4.0 api compatibility fixes
diff --git a/mcs/class/System.Core/System.IO.MemoryMappedFiles/MemoryMappedFile.cs b/mcs/class/System.Core/System.IO.MemoryMappedFiles/MemoryMappedFile.cs
index 94ac3a4..b7cec7d 100644
--- a/mcs/class/System.Core/System.IO.MemoryMappedFiles/MemoryMappedFile.cs
+++ b/mcs/class/System.Core/System.IO.MemoryMappedFiles/MemoryMappedFile.cs
@@ -26,53 +26,26 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if NET_4_0
+#if NET_4_0 || MOBILE
 
 using System;
 using System.IO;
 using System.Collections.Generic;
 using Microsoft.Win32.SafeHandles;
+using System.Runtime.InteropServices;
+
+
+#if !MOBILE
 using Mono.Unix.Native;
 using Mono.Unix;
-using System.Runtime.InteropServices;
+#else
+using System.Runtime.CompilerServices;
+#endif
 
 namespace System.IO.MemoryMappedFiles
 {
-	public class MemoryMappedFile : IDisposable {
-		MemoryMappedFileAccess fileAccess;
-		string name;
-		long fileCapacity;
-
-		//
-		// We allow the use of either the FileStream/keepOpen combo
-		// or a Unix file descriptor.  This way we avoid the dependency on
-		// Mono's io-layer having the Unix file descriptors mapped to
-		// the same io-layer handle
-		//
-		FileStream stream;
-		bool keepOpen;
-		int unix_fd;
-
-		public static MemoryMappedFile CreateFromFile (string path)
-		{
-			return CreateFromFile (path, FileMode.Open, null, 0, MemoryMappedFileAccess.ReadWrite);
-		}
-
-		public static MemoryMappedFile CreateFromFile (string path, FileMode mode)
-		{
-			return CreateFromFile (path, mode, null, 0, MemoryMappedFileAccess.ReadWrite);
-		}
-
-		public static MemoryMappedFile CreateFromFile (string path, FileMode mode, string mapName)
-		{
-			return CreateFromFile (path, mode, mapName, 0, MemoryMappedFileAccess.ReadWrite);
-		}
-
-		public static MemoryMappedFile CreateFromFile (string path, FileMode mode, string mapName, long capacity)
-		{
-			return CreateFromFile (path, mode, mapName, capacity, MemoryMappedFileAccess.ReadWrite);
-		}
-
+#if !MOBILE
+	internal static class MemoryMapImpl {
 		//
 		// Turns the FileMode into the first half of open(2) flags
 		//
@@ -120,16 +93,32 @@ namespace System.IO.MemoryMappedFiles
 			}
 		}
 
-		public static MemoryMappedFile CreateFromFile (string path, FileMode mode, string mapName, long capacity, MemoryMappedFileAccess access)
+		static MmapProts ToUnixProts (MemoryMappedFileAccess access)
 		{
-			if (path == null)
-				throw new ArgumentNullException ("path");
-			if (path.Length == 0)
-				throw new ArgumentException ("path");
-			if (mapName != null && mapName.Length == 0)
-				throw new ArgumentException ("mapName");
+			switch (access){
+			case MemoryMappedFileAccess.ReadWrite:
+				return MmapProts.PROT_WRITE | MmapProts.PROT_READ;
+				
+			case MemoryMappedFileAccess.Write:
+				return MmapProts.PROT_WRITE;
+				
+			case MemoryMappedFileAccess.CopyOnWrite:
+				return MmapProts.PROT_WRITE | MmapProts.PROT_READ;
+				
+			case MemoryMappedFileAccess.ReadExecute:
+				return MmapProts.PROT_EXEC;
+				
+			case MemoryMappedFileAccess.ReadWriteExecute:
+				return MmapProts.PROT_WRITE | MmapProts.PROT_READ | MmapProts.PROT_EXEC;
+				
+			case MemoryMappedFileAccess.Read:
+			default:
+				return MmapProts.PROT_READ;
+			}
+		}
 
-			int fd;
+		internal static int Open (string path, FileMode mode, long capacity, MemoryMappedFileAccess access)
+		{
 			if (MonoUtil.IsUnix){
 				Stat buf;
 				if (Syscall.stat (path, out buf) == -1)
@@ -137,20 +126,71 @@ namespace System.IO.MemoryMappedFiles
 
 				if ((capacity == 0 && buf.st_size == 0) || (capacity > buf.st_size))
 					throw new ArgumentException ("capacity");
-				
-				fd = Syscall.open (path, ToUnixMode (mode) | ToUnixMode (access), FilePermissions.DEFFILEMODE);
+
+				int fd = Syscall.open (path, ToUnixMode (mode) | ToUnixMode (access), FilePermissions.DEFFILEMODE);
 
 				if (fd == -1)
 					UnixMarshal.ThrowExceptionForLastError ();
+				return fd;
 			} else
 				throw new NotImplementedException ();
+		}
+		
+		internal static void CloseFD (int fd) {
+			Syscall.close (fd);
+		}
+
+		internal static void Flush (int fd) {
+			if (MonoUtil.IsUnix)
+				Syscall.fsync (fd);
+			else
+				throw new NotImplementedException ("Not implemented on Windows");
 			
-			return new MemoryMappedFile () {
-				unix_fd = fd,
-				fileAccess = access,
-				name = mapName,
-				fileCapacity = capacity
-			};
+		}
+
+		static int pagesize;
+
+		internal static unsafe void Map (int file_handle, long offset, ref long size, MemoryMappedFileAccess access, out IntPtr map_addr, out int offset_diff)
+		{
+			if (!MonoUtil.IsUnix)
+				throw new NotImplementedException ("Not implemented on windows.");
+
+			if (pagesize == 0)
+				pagesize = Syscall.getpagesize ();
+
+			Stat buf;
+			Syscall.fstat (file_handle, out buf);
+			long fsize = buf.st_size;
+
+			if (size == 0 || size > fsize)
+				size = fsize;
+			
+			// Align offset
+			long real_offset = offset & ~(pagesize - 1);
+
+			offset_diff = (int)(offset - real_offset);
+
+			// FIXME: Need to determine the unix fd for the file, Handle is only
+			// equal to it by accident
+			//
+			// The new API no longer uses FileStream everywhere, but exposes instead
+			// the filename (with one exception), we could move this API to use
+			// file descriptors instead of the FileStream plus its Handle.
+			//
+			map_addr = Syscall.mmap (IntPtr.Zero, (ulong) size,
+						 ToUnixProts (access),
+						 access == MemoryMappedFileAccess.CopyOnWrite ? MmapFlags.MAP_PRIVATE : MmapFlags.MAP_SHARED,
+						 file_handle, real_offset);
+
+			if (map_addr == (IntPtr)(-1))
+				throw new IOException ("mmap failed for fd#" + file_handle + "(" + offset + ", " + size + ")");
+		}
+
+		internal static bool Unmap (IntPtr map_addr, ulong map_size)
+		{
+			if (!MonoUtil.IsUnix)
+				return false;
+			return Syscall.munmap (map_addr, map_size) == 0;
 		}
 
 		static void ConfigureUnixFD (IntPtr handle, HandleInheritability h)
@@ -165,6 +205,282 @@ namespace System.IO.MemoryMappedFiles
 		{
 			SetHandleInformation (handle, 1 /* FLAG_INHERIT */, h == HandleInheritability.None ? 0 : 1);
 		}
+		
+		internal static void ConfigureFD (IntPtr handle, HandleInheritability inheritability)
+		{
+			if (MonoUtil.IsUnix)
+				ConfigureUnixFD (handle, inheritability);
+			else
+				ConfigureWindowsFD (handle, inheritability);
+		}
+
+	}
+#else
+	internal static class MemoryMapImpl {
+		[DllImport ("libc")]
+		static extern int fsync (int fd);
+
+		[DllImport ("libc")]
+		static extern int close (int fd);
+
+		[DllImport ("libc")]
+		static extern int fcntl (int fd, int cmd, int arg0);
+
+		//XXX check if android off_t is 64bits or not. on iOS / darwin it is.
+		[DllImport ("libc")]
+		static extern IntPtr mmap (IntPtr addr, IntPtr len, int prot, int flags, int fd, long offset);
+
+		[DllImport ("libc")]
+		static extern int munmap (IntPtr addr, IntPtr size);
+
+		[DllImport ("libc", SetLastError=true)]
+		static extern int open (string path, int flags, int access);
+
+		[DllImport ("libc")]
+		static extern int getpagesize ();
+
+		[MethodImplAttribute (MethodImplOptions.InternalCall)]
+		static extern long mono_filesize_from_path (string str);
+
+		[MethodImplAttribute (MethodImplOptions.InternalCall)]
+		static extern long mono_filesize_from_fd (int fd);
+
+		//Values valid on iOS/OSX and android ndk r6
+		const int F_GETFD = 1;
+		const int F_SETFD = 2;
+		const int FD_CLOEXEC = 1;
+		const int DEFFILEMODE = 0x666;
+
+		const int O_RDONLY = 0x0;
+		const int O_WRONLY = 0x1;
+		const int O_RDWR   = 0x2;
+
+		const int PROT_READ  = 0x1;
+		const int PROT_WRITE = 0x2;
+		const int PROT_EXEC  = 0x4;
+
+		const int MAP_PRIVATE = 0x2;
+		const int MAP_SHARED  = 0x1;
+
+		const int EINVAL = 22;
+
+#if MONODROID
+		const int O_CREAT = 0x040;
+		const int O_TRUNC = 0x080;
+		const int O_EXCL  = 0x200;
+
+		const int ENAMETOOLONG = 63;
+#else
+		/* MONOTOUCH */
+		const int O_CREAT = 0x0200;
+		const int O_TRUNC = 0x0400;
+		const int O_EXCL  = 0x0800;
+
+		const int ENAMETOOLONG = 36;
+#endif
+
+		static int ToUnixMode (FileMode mode)
+		{
+			switch (mode) {
+			case FileMode.CreateNew:
+				return O_CREAT | O_EXCL;
+				
+			case FileMode.Create:
+				return O_CREAT | O_TRUNC;
+				
+			case FileMode.OpenOrCreate:
+				return O_CREAT;
+				
+			case FileMode.Truncate:
+				return O_TRUNC;
+			default:
+			case FileMode.Open:
+				return 0;
+			}
+		}
+
+		//
+		// Turns the MemoryMappedFileAccess into the second half of open(2) flags
+		//
+		static int ToUnixMode (MemoryMappedFileAccess access)
+		{
+			switch (access) {
+			case MemoryMappedFileAccess.CopyOnWrite:
+			case MemoryMappedFileAccess.ReadWriteExecute:
+			case MemoryMappedFileAccess.ReadWrite:
+				return O_RDWR;
+				
+			case MemoryMappedFileAccess.Write:
+				return O_WRONLY;
+
+			case MemoryMappedFileAccess.ReadExecute:
+			case MemoryMappedFileAccess.Read:
+			default:
+				return O_RDONLY;
+			}
+		}
+
+		static int ToUnixProts (MemoryMappedFileAccess access)
+		{
+			switch (access){
+			case MemoryMappedFileAccess.ReadWrite:
+				return PROT_WRITE | PROT_READ;
+				
+			case MemoryMappedFileAccess.Write:
+				return PROT_WRITE;
+				
+			case MemoryMappedFileAccess.CopyOnWrite:
+				return PROT_WRITE | PROT_READ;
+				
+			case MemoryMappedFileAccess.ReadExecute:
+				return PROT_EXEC;
+				
+			case MemoryMappedFileAccess.ReadWriteExecute:
+				return PROT_WRITE | PROT_READ | PROT_EXEC;
+				
+			case MemoryMappedFileAccess.Read:
+			default:
+				return PROT_READ;
+			}
+		}
+
+		static void ThrowErrorFromErrno (int errno) 
+		{
+			switch (errno) {
+			case EINVAL:		throw new ArgumentException ();
+			case ENAMETOOLONG:	throw new PathTooLongException ();
+			default: throw new IOException ("Failed with errno " + errno);
+			}
+		}
+
+		internal static int Open (string path, FileMode mode, long capacity, MemoryMappedFileAccess access)
+		{
+			long file_size = mono_filesize_from_path (path);
+			if (file_size < 0)
+				throw new FileNotFoundException (path);
+
+			if ((capacity == 0 && file_size == 0) || (capacity > file_size))
+				throw new ArgumentException ("capacity");
+
+			int fd = open (path, ToUnixMode (mode) | ToUnixMode (access), DEFFILEMODE);
+
+			if (fd == -1)
+				ThrowErrorFromErrno (Marshal.GetLastWin32Error ());
+			return fd;
+		}
+
+		internal static void CloseFD (int fd)
+		{
+			close (fd);
+		}
+
+		internal static void Flush (int fd)
+		{
+			fsync (fd);
+		}
+
+		internal static bool Unmap (IntPtr map_addr, ulong map_size)
+		{
+			return munmap (map_addr, (IntPtr)map_size) == 0;
+		}
+
+		static int pagesize;
+
+		internal static unsafe void Map (int file_handle, long offset, ref long size, MemoryMappedFileAccess access, out IntPtr map_addr, out int offset_diff)
+		{
+			if (pagesize == 0)
+				pagesize = getpagesize ();
+
+			long fsize = mono_filesize_from_fd (file_handle);
+			if (fsize < 0)
+				throw new FileNotFoundException ();
+
+			if (size == 0 || size > fsize)
+				size = fsize;
+			
+			// Align offset
+			long real_offset = offset & ~(pagesize - 1);
+
+			offset_diff = (int)(offset - real_offset);
+
+			map_addr = mmap (IntPtr.Zero, (IntPtr) size,
+						 ToUnixProts (access),
+						 access == MemoryMappedFileAccess.CopyOnWrite ? MAP_PRIVATE : MAP_SHARED,
+						 file_handle, real_offset);
+
+			if (map_addr == (IntPtr)(-1))
+				throw new IOException ("mmap failed for fd#" + file_handle + "(" + offset + ", " + size + ")");
+		}
+
+		internal static void ConfigureFD (IntPtr handle, HandleInheritability inheritability)
+		{
+			int fd = (int)handle;
+			int flags = fcntl (fd, F_GETFD, 0);
+			if (inheritability == HandleInheritability.None)
+				flags &= ~FD_CLOEXEC;
+			else
+				flags |= FD_CLOEXEC;
+			fcntl (fd, F_SETFD, flags);
+		}
+
+	}
+#endif
+
+	public class MemoryMappedFile : IDisposable {
+		MemoryMappedFileAccess fileAccess;
+		string name;
+		long fileCapacity;
+
+		//
+		// We allow the use of either the FileStream/keepOpen combo
+		// or a Unix file descriptor.  This way we avoid the dependency on
+		// Mono's io-layer having the Unix file descriptors mapped to
+		// the same io-layer handle
+		//
+		FileStream stream;
+		bool keepOpen;
+		int unix_fd;
+
+		public static MemoryMappedFile CreateFromFile (string path)
+		{
+			return CreateFromFile (path, FileMode.Open, null, 0, MemoryMappedFileAccess.ReadWrite);
+		}
+
+		public static MemoryMappedFile CreateFromFile (string path, FileMode mode)
+		{
+			return CreateFromFile (path, mode, null, 0, MemoryMappedFileAccess.ReadWrite);
+		}
+
+		public static MemoryMappedFile CreateFromFile (string path, FileMode mode, string mapName)
+		{
+			return CreateFromFile (path, mode, mapName, 0, MemoryMappedFileAccess.ReadWrite);
+		}
+
+		public static MemoryMappedFile CreateFromFile (string path, FileMode mode, string mapName, long capacity)
+		{
+			return CreateFromFile (path, mode, mapName, capacity, MemoryMappedFileAccess.ReadWrite);
+		}
+
+		public static MemoryMappedFile CreateFromFile (string path, FileMode mode, string mapName, long capacity, MemoryMappedFileAccess access)
+		{
+			if (path == null)
+				throw new ArgumentNullException ("path");
+			if (path.Length == 0)
+				throw new ArgumentException ("path");
+			if (mapName != null && mapName.Length == 0)
+				throw new ArgumentException ("mapName");
+			if (mode == FileMode.Append)
+				throw new ArgumentException ("mode");			
+
+			int fd = MemoryMapImpl.Open (path, mode, capacity, access);
+			
+			return new MemoryMappedFile () {
+				unix_fd = fd,
+				fileAccess = access,
+				name = mapName,
+				fileCapacity = capacity
+			};
+		}
 
 		[MonoLimitation ("memoryMappedFileSecurity is currently ignored")]
 		public static MemoryMappedFile CreateFromFile (FileStream fileStream, string mapName, long capacity, MemoryMappedFileAccess access,
@@ -178,10 +494,7 @@ namespace System.IO.MemoryMappedFiles
 			if ((capacity == 0 && fileStream.Length == 0) || (capacity > fileStream.Length))
 				throw new ArgumentException ("capacity");
 
-			if (MonoUtil.IsUnix)
-				ConfigureUnixFD (fileStream.Handle, inheritability);
-			else
-				ConfigureWindowsFD (fileStream.Handle, inheritability);
+			MemoryMapImpl.ConfigureFD (fileStream.Handle, inheritability);
 				
 			return new MemoryMappedFile () {
 				stream = fileStream,
@@ -296,11 +609,12 @@ namespace System.IO.MemoryMappedFiles
 					if (keepOpen == false)
 						stream.Close ();
 					unix_fd = -1;
+					stream = null;
+				}
+				if (unix_fd != -1) {
+					MemoryMapImpl.CloseFD (unix_fd);
+					unix_fd = -1;
 				}
-				if (unix_fd != -1)
-					Syscall.close (unix_fd);
-				unix_fd = -1;
-				stream = null;
 			}
 		}
 
@@ -322,71 +636,6 @@ namespace System.IO.MemoryMappedFiles
 				throw new NotImplementedException ();
 			}
 		}
-
-		static int pagesize;
-
-		static MmapProts ToUnixProts (MemoryMappedFileAccess access)
-		{
-			switch (access){
-			case MemoryMappedFileAccess.ReadWrite:
-				return MmapProts.PROT_WRITE | MmapProts.PROT_READ;
-				
-			case MemoryMappedFileAccess.Write:
-				return MmapProts.PROT_WRITE;
-				
-			case MemoryMappedFileAccess.CopyOnWrite:
-				return MmapProts.PROT_WRITE | MmapProts.PROT_READ;
-				
-			case MemoryMappedFileAccess.ReadExecute:
-				return MmapProts.PROT_EXEC;
-				
-			case MemoryMappedFileAccess.ReadWriteExecute:
-				return MmapProts.PROT_WRITE | MmapProts.PROT_READ | MmapProts.PROT_EXEC;
-				
-			case MemoryMappedFileAccess.Read:
-			default:
-				return MmapProts.PROT_READ;
-			}
-		}
-
-		internal static unsafe void MapPosix (int file_handle, long offset, ref long size, MemoryMappedFileAccess access, out IntPtr map_addr, out int offset_diff)
-		{
-			if (pagesize == 0)
-				pagesize = Syscall.getpagesize ();
-
-			Stat buf;
-			Syscall.fstat (file_handle, out buf);
-			long fsize = buf.st_size;
-
-			if (size == 0 || size > fsize)
-				size = fsize;
-			
-			// Align offset
-			long real_offset = offset & ~(pagesize - 1);
-
-			offset_diff = (int)(offset - real_offset);
-
-			// FIXME: Need to determine the unix fd for the file, Handle is only
-			// equal to it by accident
-			//
-			// The new API no longer uses FileStream everywhere, but exposes instead
-			// the filename (with one exception), we could move this API to use
-			// file descriptors instead of the FileStream plus its Handle.
-			//
-			map_addr = Syscall.mmap (IntPtr.Zero, (ulong) size,
-						 ToUnixProts (access),
-						 access == MemoryMappedFileAccess.CopyOnWrite ? MmapFlags.MAP_PRIVATE : MmapFlags.MAP_SHARED,
-						 file_handle, real_offset);
-
-			if (map_addr == (IntPtr)(-1))
-				throw new IOException ("mmap failed for fd#" + file_handle + "(" + offset + ", " + size + ")");
-		}
-
-		internal static bool UnmapPosix (IntPtr map_addr, ulong map_size)
-		{
-			return Syscall.munmap (map_addr, map_size) == 0;
-		}
-
 	}
 }
 
diff --git a/mcs/class/System.Core/System.IO.MemoryMappedFiles/MemoryMappedFileAccess.cs b/mcs/class/System.Core/System.IO.MemoryMappedFiles/MemoryMappedFileAccess.cs
index eaf4473..c2137e4 100644
--- a/mcs/class/System.Core/System.IO.MemoryMappedFiles/MemoryMappedFileAccess.cs
+++ b/mcs/class/System.Core/System.IO.MemoryMappedFiles/MemoryMappedFileAccess.cs
@@ -26,7 +26,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if NET_4_0
+#if NET_4_0 || MOBILE
 
 using System;
 using System.IO;
diff --git a/mcs/class/System.Core/System.IO.MemoryMappedFiles/MemoryMappedFileOptions.cs b/mcs/class/System.Core/System.IO.MemoryMappedFiles/MemoryMappedFileOptions.cs
index ced4a16..e23f5d2 100644
--- a/mcs/class/System.Core/System.IO.MemoryMappedFiles/MemoryMappedFileOptions.cs
+++ b/mcs/class/System.Core/System.IO.MemoryMappedFiles/MemoryMappedFileOptions.cs
@@ -26,7 +26,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if NET_4_0
+#if NET_4_0 || MOBILE
 
 using System;
 using System.IO;
diff --git a/mcs/class/System.Core/System.IO.MemoryMappedFiles/MemoryMappedFileRights.cs b/mcs/class/System.Core/System.IO.MemoryMappedFiles/MemoryMappedFileRights.cs
index 517ed6c..1d06928 100644
--- a/mcs/class/System.Core/System.IO.MemoryMappedFiles/MemoryMappedFileRights.cs
+++ b/mcs/class/System.Core/System.IO.MemoryMappedFiles/MemoryMappedFileRights.cs
@@ -26,7 +26,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if NET_4_0
+#if NET_4_0 || MOBILE
 
 using System;
 using System.IO;
diff --git a/mcs/class/System.Core/System.IO.MemoryMappedFiles/MemoryMappedFileSecurity.cs b/mcs/class/System.Core/System.IO.MemoryMappedFiles/MemoryMappedFileSecurity.cs
index 47299e2..7b9e637 100644
--- a/mcs/class/System.Core/System.IO.MemoryMappedFiles/MemoryMappedFileSecurity.cs
+++ b/mcs/class/System.Core/System.IO.MemoryMappedFiles/MemoryMappedFileSecurity.cs
@@ -26,7 +26,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if NET_4_0
+#if NET_4_0 || MOBILE
 
 using System.Security.AccessControl;
 
diff --git a/mcs/class/System.Core/System.IO.MemoryMappedFiles/MemoryMappedViewAccessor.cs b/mcs/class/System.Core/System.IO.MemoryMappedFiles/MemoryMappedViewAccessor.cs
index 02453c8..2889302 100644
--- a/mcs/class/System.Core/System.IO.MemoryMappedFiles/MemoryMappedViewAccessor.cs
+++ b/mcs/class/System.Core/System.IO.MemoryMappedFiles/MemoryMappedViewAccessor.cs
@@ -26,13 +26,12 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if NET_4_0
+#if NET_4_0 || MOBILE
 
 using System;
 using System.IO;
 using System.Collections.Generic;
 using Microsoft.Win32.SafeHandles;
-using Mono.Unix.Native;
 
 namespace System.IO.MemoryMappedFiles
 {
@@ -44,10 +43,7 @@ namespace System.IO.MemoryMappedFiles
 		internal MemoryMappedViewAccessor (int file_handle, long offset, long size, MemoryMappedFileAccess access)
 		{
 			this.file_handle = file_handle;
-			if (MonoUtil.IsUnix)
-				CreatePosix (offset, size, access);
-			else
-				throw new NotImplementedException ("Not implemented on windows.");
+			Create (offset, size, access);
 		}
 
 		static FileAccess ToFileAccess (MemoryMappedFileAccess access)
@@ -68,11 +64,11 @@ namespace System.IO.MemoryMappedFiles
 			}
 		}
 		
-		unsafe void CreatePosix (long offset, long size, MemoryMappedFileAccess access)
+		unsafe void Create (long offset, long size, MemoryMappedFileAccess access)
 		{
 			int offset_diff;
 
-			MemoryMappedFile.MapPosix (file_handle, offset, ref size, access, out mmap_addr, out offset_diff);
+			MemoryMapImpl.Map (file_handle, offset, ref size, access, out mmap_addr, out offset_diff);
 
 			handle = new SafeMemoryMappedViewHandle ((IntPtr)((long)mmap_addr + offset_diff), size);
 			Initialize (handle, 0, size, ToFileAccess (access));
@@ -95,10 +91,7 @@ namespace System.IO.MemoryMappedFiles
 
 		public void Flush ()
 		{
-			if (MonoUtil.IsUnix)
-				Syscall.fsync (file_handle);
-			else
-				throw new NotImplementedException ("Not implemented on Windows");
+			MemoryMapImpl.Flush (file_handle);
 		}
 	}
 }
diff --git a/mcs/class/System.Core/System.IO.MemoryMappedFiles/MemoryMappedViewStream.cs b/mcs/class/System.Core/System.IO.MemoryMappedFiles/MemoryMappedViewStream.cs
index 3abd26c..2309618 100644
--- a/mcs/class/System.Core/System.IO.MemoryMappedFiles/MemoryMappedViewStream.cs
+++ b/mcs/class/System.Core/System.IO.MemoryMappedFiles/MemoryMappedViewStream.cs
@@ -26,11 +26,10 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if NET_4_0
+#if NET_4_0 || MOBILE
 
 using System;
 using System.IO;
-using Mono.Unix.Native;
 
 namespace System.IO.MemoryMappedFiles
 {
@@ -43,17 +42,14 @@ namespace System.IO.MemoryMappedFiles
 		internal MemoryMappedViewStream (int fd, long offset, long size, MemoryMappedFileAccess access) {
 			this.fd = fd;
 			monitor = new Object ();
-			if (MonoUtil.IsUnix)
-				CreateStreamPosix (fd, offset, size, access);
-			else
-				throw new NotImplementedException ("Not implemented on windows.");
+			CreateStream (fd, offset, size, access);
 		}
 
-		unsafe void CreateStreamPosix (int fd, long offset, long size, MemoryMappedFileAccess access)
+		unsafe void CreateStream (int fd, long offset, long size, MemoryMappedFileAccess access)
 		{
 			int offset_diff;
 			mmap_size = (ulong) size;
-			MemoryMappedFile.MapPosix (fd, offset, ref size, access, out mmap_addr, out offset_diff);
+			MemoryMapImpl.Map (fd, offset, ref size, access, out mmap_addr, out offset_diff);
 			FileAccess faccess;
 
 			switch (access) {
@@ -77,7 +73,7 @@ namespace System.IO.MemoryMappedFiles
 			base.Dispose (disposing);
 			lock (monitor) {
 				if (mmap_addr != (IntPtr)(-1)) {
-					MemoryMappedFile.UnmapPosix (mmap_addr, mmap_size);
+					MemoryMapImpl.Unmap (mmap_addr, mmap_size);
 					mmap_addr = (IntPtr)(-1);
 				}
 			}
@@ -85,10 +81,7 @@ namespace System.IO.MemoryMappedFiles
 
 		public override void Flush ()
 		{
-			if (MonoUtil.IsUnix)
-				Syscall.fsync (fd);
-			else
-				throw new NotImplementedException ("Not implemented on Windows");
+			MemoryMapImpl.Flush (fd);
 		}
 	}
 }
diff --git a/mcs/class/System.Core/System.Linq.Expressions/ChangeLog b/mcs/class/System.Core/System.Linq.Expressions/ChangeLog
index 4bcbadc..630c857 100644
--- a/mcs/class/System.Core/System.Linq.Expressions/ChangeLog
+++ b/mcs/class/System.Core/System.Linq.Expressions/ChangeLog
@@ -1,3 +1,8 @@
+2011-12-02  Jb Evain  <jbevain at gmail.com>
+
+	Test for assignability of arrays to generic interfaces. Fixes
+	#2304.
+
 2011-03-15  Jb Evain  <jbevain at gmail.com>
 
 	Handle conversion to System.Enum
diff --git a/mcs/class/System.Core/System.Linq.Expressions/Extensions.cs b/mcs/class/System.Core/System.Linq.Expressions/Extensions.cs
index 3af0f52..0f4eadf 100644
--- a/mcs/class/System.Core/System.Linq.Expressions/Extensions.cs
+++ b/mcs/class/System.Core/System.Linq.Expressions/Extensions.cs
@@ -27,6 +27,7 @@
 //
 
 using System;
+using System.Collections.Generic;
 using System.Reflection;
 using System.Reflection.Emit;
 using System.Runtime.CompilerServices;
@@ -69,8 +70,9 @@ namespace System.Linq.Expressions {
 
 		public static bool IsAssignableTo (this Type self, Type type)
 		{
-			return type.IsAssignableFrom (self) ||
-				ArrayTypeIsAssignableTo (self, type);
+			return type.IsAssignableFrom (self)
+				|| ArrayTypeAreAssignable (self, type)
+				|| ArrayTypeIsAssignableToInterface (self, type);		
 		}
 
 		public static Type GetFirstGenericArgument (this Type self)
@@ -114,7 +116,7 @@ namespace System.Linq.Expressions {
 			return types;
 		}
 
-		static bool ArrayTypeIsAssignableTo (Type type, Type candidate)
+		static bool ArrayTypeAreAssignable (Type type, Type candidate)
 		{
 			if (!type.IsArray || !candidate.IsArray)
 				return false;
@@ -125,6 +127,17 @@ namespace System.Linq.Expressions {
 			return type.GetElementType ().IsAssignableTo (candidate.GetElementType ());
 		}
 
+		static bool ArrayTypeIsAssignableToInterface (Type type, Type candidate)
+		{
+			if (!type.IsArray)
+				return false;
+
+			if (!(candidate.IsGenericInstanceOf (typeof (IList<>)) || candidate.IsGenericInstanceOf (typeof (ICollection<>)) || candidate.IsGenericInstanceOf (typeof (IEnumerable<>))))
+				return false;
+
+			return type.GetElementType () == candidate.GetFirstGenericArgument ();
+		}
+
 		public static void OnFieldOrProperty (this MemberInfo self,
 			Action<FieldInfo> onfield, Action<PropertyInfo> onprop)
 		{
diff --git a/mcs/class/System.Core/System.Threading/ChangeLog b/mcs/class/System.Core/System.Threading/ChangeLog
index 8e9be18..54d0dd4 100644
--- a/mcs/class/System.Core/System.Threading/ChangeLog
+++ b/mcs/class/System.Core/System.Threading/ChangeLog
@@ -1,3 +1,12 @@
+2011-11-04  Jeremie Laval  <jeremie.laval at gmail.com>
+
+	Add RwWrite flag to status check when already owning upgradeable
+	lock. Fix #802.
+
+2011-11-01  Jeremie Laval  <jeremie.laval at gmail.com>
+
+	Set success boolean in all cases and avoid state masking. Fix #124
+
 2011-04-05  Jérémie Laval  <jeremie.laval at gmail.com>
 
 	Protect entering ReaderWriterLockSlim upgradable mode against
diff --git a/mcs/class/System.Core/System.Threading/ReaderWriterLockSlim.cs b/mcs/class/System.Core/System.Threading/ReaderWriterLockSlim.cs
index 0dece58..d5447eb 100644
--- a/mcs/class/System.Core/System.Threading/ReaderWriterLockSlim.cs
+++ b/mcs/class/System.Core/System.Threading/ReaderWriterLockSlim.cs
@@ -148,8 +148,9 @@ namespace System.Threading {
 				try {}
 				finally {
 					Interlocked.Add (ref rwlock, RwRead);
-					ctstate.LockState ^= LockState.Read;
+					ctstate.LockState |= LockState.Read;
 					++ctstate.ReaderRecursiveCount;
+					success = true;
 				}
 
 				return true;
@@ -258,7 +259,7 @@ namespace System.Threading {
 					}
 				}
 
-				int stateCheck = isUpgradable ? RwWaitUpgrade : RwWait;
+				int stateCheck = isUpgradable ? RwWaitUpgrade + RwWait : RwWait;
 				long start = millisecondsTimeout == -1 ? 0 : sw.ElapsedMilliseconds;
 
 				do {
@@ -394,7 +395,8 @@ namespace System.Threading {
 					TryEnterReadLock (ComputeTimeout (millisecondsTimeout, start), ref success);
 				} finally {
 					if (success) {
-						ctstate.LockState = LockState.Upgradable;
+						ctstate.LockState |= LockState.Upgradable;
+						ctstate.LockState &= ~LockState.Read;
 						--ctstate.ReaderRecursiveCount;
 						++ctstate.UpgradeableRecursiveCount;
 					} else {
@@ -432,11 +434,12 @@ namespace System.Threading {
 					upgradableTaken.Value = false;
 					upgradableEvent.Set ();
 
-					ctstate.LockState ^= LockState.Upgradable;
+					ctstate.LockState &= ~LockState.Upgradable;
 					if (Interlocked.Add (ref rwlock, -RwRead) >> RwReadBit == 0)
 						readerDoneEvent.Set ();
 				}
 			}
+
 		}
 
 		public void Dispose ()
@@ -539,7 +542,7 @@ namespace System.Threading {
 			// Detect and prevent recursion
 			LockState ctstate = state.LockState;
 
-			if (ctstate != LockState.None && noRecursion && (ctstate != LockState.Upgradable || validState == LockState.Upgradable))
+			if (ctstate != LockState.None && noRecursion && (!ctstate.Has (LockState.Upgradable) || validState == LockState.Upgradable))
 				throw new LockRecursionException ("The current thread has already a lock and recursion isn't supported");
 
 			if (noRecursion)
diff --git a/mcs/class/System.Core/System/ChangeLog b/mcs/class/System.Core/System/ChangeLog
index c02ae68..bbc8109 100644
--- a/mcs/class/System.Core/System/ChangeLog
+++ b/mcs/class/System.Core/System/ChangeLog
@@ -1,3 +1,17 @@
+2011-11-08  Sebastien Pouliot  <sebastien at xamarin.com>
+
+	fix typo in monotouch build
+
+2011-11-07  Sebastien Pouliot  <sebastien at xamarin.com>
+
+	MonoTouch specific initialization for TimeZone (devices). Fix bug
+	#1790
+
+2011-09-09  Sebastien Pouliot  <sebastien at xamarin.com>
+
+	Ensure we can roundtrip 'Local' (special case) timezone. Fix bug
+	#326
+
 2011-03-10  Duane Wandless  <dwandless at pixmaclt10.local>
 
 	GetApplicableRule returns NULL in TimeZoneInfo.cs yet the code
diff --git a/mcs/class/System.Core/System/TimeZoneInfo.MonoTouch.cs b/mcs/class/System.Core/System/TimeZoneInfo.MonoTouch.cs
new file mode 100644
index 0000000..f2732be
--- /dev/null
+++ b/mcs/class/System.Core/System/TimeZoneInfo.MonoTouch.cs
@@ -0,0 +1,92 @@
+//
+// System.TimeZoneInfo helper for MonoTouch
+// 	because the devices cannot access the file system to read the data
+//
+// Authors:
+//	Sebastien Pouliot  <sebastien at xamarin.com>
+//
+// Copyright 2011 Xamarin Inc.
+//
+// The class can be either constructed from a string (from user code)
+// or from a handle (from iphone-sharp.dll internal calls).  This
+// delays the creation of the actual managed string until actually
+// required
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if (INSIDE_CORLIB && MONOTOUCH)
+
+using System;
+using System.Collections.ObjectModel;
+using System.IO;
+using System.Reflection;
+
+namespace System {
+
+	public partial class TimeZoneInfo {
+		
+		static Type nstimezone;
+		
+		static Type NSTimeZone {
+			get {
+				if (nstimezone == null)
+					nstimezone = Type.GetType ("MonoTouch.Foundation.NSTimeZone, monotouch, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null");
+				return nstimezone;
+			}
+		}
+		
+		static ReadOnlyCollection<string> GetMonoTouchNames ()
+		{
+			try {
+				var p = NSTimeZone.GetProperty ("KnownTimeZoneNames", BindingFlags.Static | BindingFlags.Public);
+				var m = p.GetGetMethod ();
+				return (ReadOnlyCollection<string>) m.Invoke (null, null);
+			}
+			catch (TargetInvocationException tie) {
+				throw tie.InnerException;
+			}
+		}
+		
+		static Stream GetMonoTouchDefault ()
+		{
+			try {
+				var m = NSTimeZone.GetMethod ("_GetDefault", BindingFlags.Static | BindingFlags.NonPublic);
+				return (Stream) m.Invoke (null, null);
+			}
+			catch (TargetInvocationException tie) {
+				throw tie.InnerException;
+			}
+		}
+
+		static Stream GetMonoTouchData (string name)
+		{
+			try {
+				var m = NSTimeZone.GetMethod ("_GetData", BindingFlags.Static | BindingFlags.NonPublic);
+				return (Stream) m.Invoke (null, new object[] { name });
+			}
+			catch (TargetInvocationException tie) {
+				throw tie.InnerException;
+			}
+		}
+	}
+}
+
+#endif
diff --git a/mcs/class/System.Core/System/TimeZoneInfo.cs b/mcs/class/System.Core/System/TimeZoneInfo.cs
index 03a50dd..7af6938 100644
--- a/mcs/class/System.Core/System/TimeZoneInfo.cs
+++ b/mcs/class/System.Core/System/TimeZoneInfo.cs
@@ -86,6 +86,10 @@ namespace System
 				if (local == null) {
 #if MONODROID
 					local = ZoneInfoDB.Default;
+#elif MONOTOUCH
+					using (Stream stream = GetMonoTouchDefault ()) {
+						return BuildFromStream ("Local", stream);
+					}
 #elif LIBC
 					try {
 						local = FindSystemTimeZoneByFileName ("Local", "/etc/localtime");	
@@ -328,27 +332,41 @@ namespace System
 #endif
 #if MONODROID
 			return ZoneInfoDB.GetTimeZone (id);
+#else
+			// Local requires special logic that already exists in the Local property (bug #326)
+			if (id == "Local")
+				return Local;
+#if MONOTOUCH
+			using (Stream stream = GetMonoTouchData (id)) {
+				return BuildFromStream (id, stream);
+			}
 #elif LIBC
 			string filepath = Path.Combine (TimeZoneDirectory, id);
 			return FindSystemTimeZoneByFileName (id, filepath);
-#else
+#endif
 			throw new NotImplementedException ();
 #endif
 		}
 
 #if LIBC
-		const int BUFFER_SIZE = 16384; //Big enough for any tz file (on Oct 2008, all tz files are under 10k)
 		private static TimeZoneInfo FindSystemTimeZoneByFileName (string id, string filepath)
 		{
 			if (!File.Exists (filepath))
 				throw new TimeZoneNotFoundException ();
 
-			byte [] buffer = new byte [BUFFER_SIZE];
-			int length;
 			using (FileStream stream = File.OpenRead (filepath)) {
-				length = stream.Read (buffer, 0, BUFFER_SIZE);
+				return BuildFromStream (id, stream);
 			}
-
+		}
+#endif
+#if LIBC || MONOTOUCH
+		const int BUFFER_SIZE = 16384; //Big enough for any tz file (on Oct 2008, all tz files are under 10k)
+		
+		private static TimeZoneInfo BuildFromStream (string id, Stream stream) 
+		{
+			byte [] buffer = new byte [BUFFER_SIZE];
+			int length = stream.Read (buffer, 0, BUFFER_SIZE);
+			
 			if (!ValidTZFile (buffer, length))
 				throw new InvalidTimeZoneException ("TZ file too big for the buffer");
 
@@ -537,6 +555,14 @@ namespace System
 			foreach (string id in ZoneInfoDB.GetAvailableIds ()) {
 				systemTimeZones.Add (ZoneInfoDB.GetTimeZone (id));
 			}
+#elif MONOTOUCH
+				if (systemTimeZones.Count == 0) {
+					foreach (string name in GetMonoTouchNames ()) {
+						using (Stream stream = GetMonoTouchData (name)) {
+							systemTimeZones.Add (BuildFromStream (name, stream));
+						}
+					}
+				}
 #elif LIBC
 				string[] continents = new string [] {"Africa", "America", "Antarctica", "Arctic", "Asia", "Atlantic", "Brazil", "Canada", "Chile", "Europe", "Indian", "Mexico", "Mideast", "Pacific", "US"};
 				foreach (string continent in continents) {
diff --git a/mcs/class/System.Core/Test/System.Threading/ChangeLog b/mcs/class/System.Core/Test/System.Threading/ChangeLog
index 52d06b8..e77d1ce 100644
--- a/mcs/class/System.Core/Test/System.Threading/ChangeLog
+++ b/mcs/class/System.Core/Test/System.Threading/ChangeLog
@@ -1,3 +1,12 @@
+2011-11-04  Jeremie Laval  <jeremie.laval at gmail.com>
+
+	Add RwWrite flag to status check when already owning upgradeable
+	lock. Fix #802.
+
+2011-11-01  Jeremie Laval  <jeremie.laval at gmail.com>
+
+	Set success boolean in all cases and avoid state masking. Fix #124
+
 2010-12-01  Jérémie Laval  <jeremie.laval at gmail.com>
 
 	[ReaderWriterLockSlim] Fix for #656353. Add corresponding unit
diff --git a/mcs/class/System.Core/Test/System.Threading/ReaderWriterLockSlimTest.cs b/mcs/class/System.Core/Test/System.Threading/ReaderWriterLockSlimTest.cs
index d5d52de..6710c5c 100644
--- a/mcs/class/System.Core/Test/System.Threading/ReaderWriterLockSlimTest.cs
+++ b/mcs/class/System.Core/Test/System.Threading/ReaderWriterLockSlimTest.cs
@@ -29,6 +29,7 @@
 using System;
 using NUnit.Framework;
 using System.Threading;
+using System.Threading.Tasks;
 using System.Linq;
 
 namespace MonoTests.System.Threading
@@ -405,6 +406,30 @@ namespace MonoTests.System.Threading
 		}
 
 		[Test]
+		public void EnterWriteLockWhileInUpgradeAndOtherWaiting ()
+		{
+			var v = new ReaderWriterLockSlim ();
+
+			var task2 = new Task(() => {
+                v.EnterWriteLock();
+                v.ExitWriteLock();
+            });
+
+            var task1 = new Task(() =>
+            {
+                v.EnterUpgradeableReadLock ();
+                task2.Start ();
+                Thread.Sleep (100);
+                v.EnterWriteLock ();
+                v.ExitWriteLock ();
+                v.ExitUpgradeableReadLock ();
+            });
+            task1.Start ();
+
+            Assert.IsTrue (task1.Wait (500));
+		}
+
+		[Test]
 		public void RecursiveReadLockTest ()
 		{
 			var v = new ReaderWriterLockSlim (LockRecursionPolicy.SupportsRecursion);
@@ -633,6 +658,44 @@ namespace MonoTests.System.Threading
 		}
 
 		[Test]
+		public void RecursiveWriteUpgradeReadTest ()
+		{
+			var rwlock = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion);
+
+			rwlock.EnterWriteLock ();
+			Assert.IsTrue (rwlock.IsWriteLockHeld);
+			rwlock.EnterUpgradeableReadLock ();
+			Assert.IsTrue (rwlock.IsUpgradeableReadLockHeld);
+			rwlock.EnterReadLock ();
+			Assert.IsTrue (rwlock.IsReadLockHeld);
+			rwlock.ExitUpgradeableReadLock();
+			Assert.IsFalse (rwlock.IsUpgradeableReadLockHeld);
+			Assert.IsTrue (rwlock.IsReadLockHeld);
+			Assert.IsTrue (rwlock.IsWriteLockHeld);
+
+			rwlock.ExitReadLock ();
+			Assert.IsTrue (rwlock.IsWriteLockHeld);
+		}
+
+		[Test]
+		public void RecursiveWriteUpgradeTest ()
+		{
+			ReaderWriterLockSlim rwlock = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion);
+
+			rwlock.EnterWriteLock ();
+			Assert.IsTrue (rwlock.IsWriteLockHeld);
+			rwlock.EnterUpgradeableReadLock ();
+			Assert.IsTrue (rwlock.IsUpgradeableReadLockHeld);
+			rwlock.ExitUpgradeableReadLock ();
+			Assert.IsFalse (rwlock.IsUpgradeableReadLockHeld);
+			Assert.IsTrue (rwlock.IsWriteLockHeld);
+			rwlock.ExitWriteLock ();
+			Assert.IsFalse (rwlock.IsWriteLockHeld);
+			rwlock.EnterWriteLock ();
+			Assert.IsTrue (rwlock.IsWriteLockHeld);
+		}
+
+		[Test]
 		public void RecursiveWriteReadAcquisitionInterleaving ()
 		{
 			var v = new ReaderWriterLockSlim (LockRecursionPolicy.SupportsRecursion);
diff --git a/mcs/class/System.Core/Test/System/ChangeLog b/mcs/class/System.Core/Test/System/ChangeLog
index b13abb8..8fa44ee 100644
--- a/mcs/class/System.Core/Test/System/ChangeLog
+++ b/mcs/class/System.Core/Test/System/ChangeLog
@@ -1,3 +1,8 @@
+2011-09-09  Sebastien Pouliot  <sebastien at xamarin.com>
+
+	Ensure we can roundtrip 'Local' (special case) timezone. Fix bug
+	#326
+
 2008-05-26  Stephane Delcroix  <sdelcroix at novell.com>
 
 	* Timezonetsnfo.cs: test for bnc #391011
diff --git a/mcs/class/System.Core/Test/System/ChangeLog b/mcs/class/System.Core/Test/System/ChangeLog.old
similarity index 100%
copy from mcs/class/System.Core/Test/System/ChangeLog
copy to mcs/class/System.Core/Test/System/ChangeLog.old
diff --git a/mcs/class/System.Core/Test/System/TimeZoneInfoTest.cs b/mcs/class/System.Core/Test/System/TimeZoneInfoTest.cs
index 1daacca..9a605c5 100644
--- a/mcs/class/System.Core/Test/System/TimeZoneInfoTest.cs
+++ b/mcs/class/System.Core/Test/System/TimeZoneInfoTest.cs
@@ -540,6 +540,20 @@ namespace MonoTests.System
 				TimeZoneInfo vatican = TimeZoneInfo.FindSystemTimeZoneById ("Europe/Vatican");
 				Assert.IsTrue (rome.HasSameRules (vatican));
 			}
+
+			[Test]
+			public void FindSystemTimeZoneById_Local_Roundtrip ()
+			{
+				Assert.AreEqual (TimeZoneInfo.Local.Id, TimeZoneInfo.FindSystemTimeZoneById (TimeZoneInfo.Local.Id).Id);
+			}
+
+			[Test]
+			public void Test326 ()
+			{
+				DateTime utc = DateTime.UtcNow;
+			        DateTime local = TimeZoneInfo.ConvertTime (utc, TimeZoneInfo.Utc, TimeZoneInfo.FindSystemTimeZoneById (TimeZoneInfo.Local.Id));
+				Assert.AreEqual (local, utc + TimeZoneInfo.Local.GetUtcOffset (utc), "ConvertTime/Local");
+			}
 		
 		#if SLOW_TESTS
 			[Test]
diff --git a/mcs/class/System.Core/monotouch_System.Core.dll.sources b/mcs/class/System.Core/monotouch_System.Core.dll.sources
index f8de2aa..9e25856 100644
--- a/mcs/class/System.Core/monotouch_System.Core.dll.sources
+++ b/mcs/class/System.Core/monotouch_System.Core.dll.sources
@@ -3,3 +3,4 @@ System.Linq.jvm/Conversion.cs
 System.Linq.jvm/ExpressionInterpreter.cs
 System.Linq.jvm/Runner.cs
 System.Linq.jvm/Math.cs
+System/TimeZoneInfo.MonoTouch.cs
diff --git a/mcs/class/System.Data.Services.Client/Assembly/AssemblyInfo.cs b/mcs/class/System.Data.Services.Client/Assembly/AssemblyInfo.cs
index 2d625fb..247a5f0 100644
--- a/mcs/class/System.Data.Services.Client/Assembly/AssemblyInfo.cs
+++ b/mcs/class/System.Data.Services.Client/Assembly/AssemblyInfo.cs
@@ -41,9 +41,9 @@ using System.Runtime.InteropServices;
 using System.Runtime.Versioning;
 
 [assembly: AssemblyDelaySign (true)]
+[assembly: AssemblyKeyFile ("../ecma.pub")]
 
 #if NET_4_0
-[assembly: AssemblyKeyFile ("../ecma.pub")]
 [assembly: System.Security.SecurityCritical]
 [assembly: ComVisible(false)]
 [assembly: CLSCompliant(false)]
@@ -61,7 +61,6 @@ using System.Runtime.Versioning;
 
 [assembly: Debuggable (DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
 [assembly: NeutralResourcesLanguage ("en-US")]
-[assembly: AssemblyTargetedPatchBand ("1.0.21-0")]
 [assembly: CompilationRelaxations (CompilationRelaxations.NoStringInterning)]
 [assembly: SecurityRules (SecurityRuleSet.Level1, SkipVerificationInFullTrust=true)]
 
@@ -70,17 +69,10 @@ internal static class FX35Assembly
     internal const string Version = "4.0.0.0";
 }
 
-internal static class ThisAssembly
-{
-
-}
-
 internal static class AssemblyRef
 {
     internal const string MicrosoftPublicKeyToken = "b03f5f7f11d50a3a";
 
     internal const string EcmaPublicKeyToken = "b77a5c561934e089";
 }
-#else
-[assembly: AssemblyKeyFile ("../msfinal.pub")]
 #endif
diff --git a/mcs/class/System.Data/ChangeLog b/mcs/class/System.Data/ChangeLog
index 15adab4..4f4c360 100644
--- a/mcs/class/System.Data/ChangeLog
+++ b/mcs/class/System.Data/ChangeLog
@@ -1,3 +1,26 @@
+2011-09-09  Miguel de Icaza  <miguel at gnome.org>
+
+	Various fixes to the Expression parser, the fixes include:
+
+	* Fixes to the SUBSTRING and TRIM function to allow a wider range
+	of functions to be passed as parameters. This fixes xamarin #665
+
+	* Fix to the Parser.jay grammar to eliminate the reduce/reduce
+	conflicts.
+
+	* Dropping the string concatenation code and instead use the
+	existing arithmetic addition operator which also fixes the
+	concatenation operation in the presence of null values
+
+	* Adds the null literal
+
+	With the associated test cases.
+
+2011-08-30  Chris Toshok  <toshok at gmail.com>
+
+	prepend $(CURDIR) to jay input files so that the debugging info
+	references the right .jay
+
 2010-09-08  Jb Evain  <jbevain at gmail.com>
 
 	Fix the monodroid and monotouch profile builds
diff --git a/mcs/class/System.Data/Makefile b/mcs/class/System.Data/Makefile
index 0a307fa..2c43f38 100644
--- a/mcs/class/System.Data/Makefile
+++ b/mcs/class/System.Data/Makefile
@@ -63,7 +63,7 @@ EXTRA_DISTFILES = \
 BUILT_SOURCES = Mono.Data.SqlExpressions/Parser.cs
 
 Mono.Data.SqlExpressions/Parser.cs: Mono.Data.SqlExpressions/Parser.jay $(topdir)/jay/skeleton.cs
-	$(topdir)/jay/jay -ct < $(topdir)/jay/skeleton.cs $< >$@
+	$(topdir)/jay/jay -vct < $(topdir)/jay/skeleton.cs $(CURDIR)/$< >$@
 
 include ../../build/library.make
 
diff --git a/mcs/class/System.Data/Mono.Data.SqlExpressions/ChangeLog b/mcs/class/System.Data/Mono.Data.SqlExpressions/ChangeLog
index 55aca6a..db93fcc 100644
--- a/mcs/class/System.Data/Mono.Data.SqlExpressions/ChangeLog
+++ b/mcs/class/System.Data/Mono.Data.SqlExpressions/ChangeLog
@@ -1,3 +1,21 @@
+2011-09-09  Miguel de Icaza  <miguel at gnome.org>
+
+	Various fixes to the Expression parser, the fixes include:
+
+	* Fixes to the SUBSTRING and TRIM function to allow a wider range
+	of functions to be passed as parameters. This fixes xamarin #665
+
+	* Fix to the Parser.jay grammar to eliminate the reduce/reduce
+	conflicts.
+
+	* Dropping the string concatenation code and instead use the
+	existing arithmetic addition operator which also fixes the
+	concatenation operation in the presence of null values
+
+	* Adds the null literal
+
+	With the associated test cases.
+
 2009-10-28  Marek Habersack  <mhabersack at novell.com>
 
 	* Tokenizer.cs, Parser.jay: a work around for 3 reduce/reduce
diff --git a/mcs/class/System.Data/Mono.Data.SqlExpressions/ChangeLog b/mcs/class/System.Data/Mono.Data.SqlExpressions/ChangeLog.old
similarity index 100%
copy from mcs/class/System.Data/Mono.Data.SqlExpressions/ChangeLog
copy to mcs/class/System.Data/Mono.Data.SqlExpressions/ChangeLog.old
diff --git a/mcs/class/System.Data/Mono.Data.SqlExpressions/Parser.jay b/mcs/class/System.Data/Mono.Data.SqlExpressions/Parser.jay
index 613e4e2..135b936 100644
--- a/mcs/class/System.Data/Mono.Data.SqlExpressions/Parser.jay
+++ b/mcs/class/System.Data/Mono.Data.SqlExpressions/Parser.jay
@@ -6,6 +6,7 @@
 //   Juraj Skripsky (juraj at hotfeet.ch)
 //
 // (C) 2004 HotFeet GmbH (http://www.hotfeet.ch)
+// Copyright 2011 Xamarin Inc (http://www.xamarin.com)
 //
 
 using System;
@@ -190,6 +191,7 @@ LiteralValue
 	| NumberLiteral	{ $$ = new Literal ($1); }
 	| DateLiteral		{ $$ = new Literal ($1); }
 	| BoolLiteral
+	| NULL          { $$ = new Literal (null); }
 	;
 
 BoolLiteral
@@ -271,28 +273,20 @@ AggFunctionName
 	;
 
 StringExpr
-	: PAROPEN StringExpr PARCLOSE
-	{
-		$$ = (IExpression)$2;
-	}
-	| SingleColumnValue
+	: SingleColumnValue
 	| StringLiteral { $$ = new Literal ($1); }
-	| StringFunction
+	| Function
 	;
 
 StringFunction
-	: TRIM PAROPEN StringExpr PARCLOSE
+	: TRIM PAROPEN ArithExpr PARCLOSE
 	{
 		$$ = new TrimFunction ((IExpression)$3);
 	}
-	| SUBSTRING PAROPEN StringExpr COMMA ArithExpr COMMA ArithExpr PARCLOSE
+	| SUBSTRING PAROPEN ArithExpr COMMA ArithExpr COMMA ArithExpr PARCLOSE
 	{
 		$$ = new SubstringFunction ((IExpression)$3, (IExpression)$5, (IExpression)$7);
 	}
-	| StringExpr PLUS StringExpr
-	{
-		$$ = new ConcatFunction ((IExpression)$1, (IExpression)$3);
-	}
 	;
 
 CalcFunction
diff --git a/mcs/class/System.Data/Mono.Data.SqlExpressions/StringFunctions.cs b/mcs/class/System.Data/Mono.Data.SqlExpressions/StringFunctions.cs
index 6d7c541..e64f8eb 100644
--- a/mcs/class/System.Data/Mono.Data.SqlExpressions/StringFunctions.cs
+++ b/mcs/class/System.Data/Mono.Data.SqlExpressions/StringFunctions.cs
@@ -55,42 +55,6 @@ namespace Mono.Data.SqlExpressions {
 		}
 	}
 
-	internal class ConcatFunction : StringFunction
-	{
-		readonly IExpression _add;
-		public ConcatFunction (IExpression e, IExpression add)
-			: base (e)
-		{
-			_add = add;
-		}
-
-		public override bool Equals(object obj)
-		{
-			if (!base.Equals (obj))
-				return false;
-
-			if (!(obj is ConcatFunction))
-				return false;
-
-			ConcatFunction other = (ConcatFunction) obj;
-			return _add.Equals (other._add);
-		}
-
-		public override int GetHashCode()
-		{
-			int hashCode = base.GetHashCode ();
-			hashCode ^= _add.GetHashCode ();
-			return hashCode;
-		}
-
-		override public object Eval (DataRow row) {
-			string str = (string) base.Eval (row);
-			string x = (string) _add.Eval (row);
-
-			return str + x;
-		}
-	}
-	
 	internal class SubstringFunction : StringFunction {
 		IExpression start;
 		IExpression len;
diff --git a/mcs/class/System.Data/System.Data/ChangeLog b/mcs/class/System.Data/System.Data/ChangeLog
index 0e3ffe4..a75e244 100644
--- a/mcs/class/System.Data/System.Data/ChangeLog
+++ b/mcs/class/System.Data/System.Data/ChangeLog
@@ -1,3 +1,35 @@
+2011-11-16  Rolf Bjarne Kvinge  <rolf at xamarin.com>
+
+	[System.Data] Fix sorting in DataView when changing sort
+	value/default sort several times.
+
+2011-09-13  Rolf Bjarne Kvinge  <rolf at xamarin.com>
+
+	[System.Data] Delay column expression evaluation after all the
+	columns have been cloned when cloning a table. Fixes #666.
+
+	When cloning a table we loop over all the columns and clone them,
+	but if a column contains an expression with a reference to a later
+	column, we'll throw an exception unless we delay the expression
+	compilation until all the columns have been added to the new table
+	clone.
+
+	So I've split out the expression compilation logic from the
+	Expression property setter, and now the column Clone method only
+	sets the field. The Clone caller is responsible for calling
+	CompileExpression on the cloned column after adding all the cloned
+	columns to the cloned table.
+
+2011-09-13  Rolf Bjarne Kvinge  <rolf at xamarin.com>
+
+	[System.Data] Properly clone a column's extended properties when
+	cloning a table. Fixes #668.
+
+2011-08-31  Atsushi Eno  <atsushi at ximian.com>
+
+	DiffLoader didn't handle encoded name and caused mismatch between
+	.NET.
+
 2010-09-08  Jb Evain  <jbevain at gmail.com>
 
 	Enable the System.Data build for monodroid
diff --git a/mcs/class/System.Data/System.Data/DataColumn.cs b/mcs/class/System.Data/System.Data/DataColumn.cs
index 95667fc..df25fb6 100644
--- a/mcs/class/System.Data/System.Data/DataColumn.cs
+++ b/mcs/class/System.Data/System.Data/DataColumn.cs
@@ -17,6 +17,7 @@
 
 //
 // Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2011 Xamarin Inc (http://www.xamarin.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
@@ -475,43 +476,53 @@ namespace System.Data {
 				if (value == null)
 					value = String.Empty;
 
-				if (value != String.Empty) {
-					if (AutoIncrement || Unique)
-						throw new ArgumentException ("Cannot create an expression on a column that has AutoIncrement or Unique.");
-
-					if (Table != null) {
-						for (int i = 0; i < Table.Constraints.Count; i++) {
-							if (Table.Constraints [i].IsColumnContained (this))
-								throw new ArgumentException (
-									String.Format (
-										"Cannot set Expression property on column {0}, because it is a part of a constraint.",
-										ColumnName));
-						}
-					}
+				CompileExpression (value);
+				_expression = value;
+			}
+		}
 
-					Parser parser = new Parser ();
-					IExpression compiledExpression = parser.Compile (value);
+		internal void CompileExpression ()
+		{
+			CompileExpression (_expression);
+		}
 
-					if (Table != null) {
-						if (compiledExpression.DependsOn (this))
-							throw new ArgumentException ("Cannot set Expression property due to circular reference in the expression.");
-						// Check if expression is ok
-						if (Table.Rows.Count == 0)
-							compiledExpression.Eval (Table.NewRow ());
-						else
-							compiledExpression.Eval (Table.Rows [0]);
-					}
-					ReadOnly = true;
-					_compiledExpression = compiledExpression;
-				} else {
-					_compiledExpression = null;
-					if (Table != null) {
-						int defaultValuesRowIndex = Table.DefaultValuesRowIndex;
-						if (defaultValuesRowIndex != -1)
-							DataContainer.FillValues (defaultValuesRowIndex);
+		internal void CompileExpression (string expression)
+		{
+			if (expression != String.Empty) {
+				if (AutoIncrement || Unique)
+					throw new ArgumentException ("Cannot create an expression on a column that has AutoIncrement or Unique.");
+
+				if (Table != null) {
+					for (int i = 0; i < Table.Constraints.Count; i++) {
+						if (Table.Constraints [i].IsColumnContained (this))
+							throw new ArgumentException (
+								String.Format (
+									"Cannot set Expression property on column {0}, because it is a part of a constraint.",
+									ColumnName));
 					}
 				}
-				_expression = value;
+
+				Parser parser = new Parser ();
+				IExpression compiledExpression = parser.Compile (expression);
+
+				if (Table != null) {
+					if (compiledExpression.DependsOn (this))
+						throw new ArgumentException ("Cannot set Expression property due to circular reference in the expression.");
+					// Check if expression is ok
+					if (Table.Rows.Count == 0)
+						compiledExpression.Eval (Table.NewRow ());
+					else
+						compiledExpression.Eval (Table.Rows [0]);
+				}
+				ReadOnly = true;
+				_compiledExpression = compiledExpression;
+			} else {
+				_compiledExpression = null;
+				if (Table != null) {
+					int defaultValuesRowIndex = Table.DefaultValuesRowIndex;
+					if (defaultValuesRowIndex != -1)
+						DataContainer.FillValues (defaultValuesRowIndex);
+				}
 			}
 		}
 
@@ -701,16 +712,12 @@ namespace System.Data {
 			//Copy.Container
 			copy.DataType = DataType;
 			copy._defaultValue = _defaultValue;
-			// Use the property to set the expression as it updates compiledExpression, if any.
-			copy.Expression = _expression;
+			// Do not use the Expression property to set the expression, the caller of Clone 
+			// must explicitly call CompileExpression on the returned DataColumn to update compiledExpression (if any).
+			copy._expression = _expression;
 			//Copy.ExtendedProperties
-			if (_extendedProperties.Count > 0) {
-				Array extPropArray = Array.CreateInstance (typeof (object), _extendedProperties.Count);
-				_extendedProperties.CopyTo (extPropArray, 0);
-				for (var i = 0; i < _extendedProperties.Count; i++)
-					copy.ExtendedProperties.Add (extPropArray.GetValue(i), 
-					                             ExtendedProperties[extPropArray.GetValue(i)]);
-			}
+			foreach (object key in _extendedProperties.Keys)
+				copy.ExtendedProperties.Add (key, ExtendedProperties[key]);
 			copy._maxLength = _maxLength;
 			copy._nameSpace = _nameSpace;
 			copy._prefix = _prefix;
diff --git a/mcs/class/System.Data/System.Data/DataTable.cs b/mcs/class/System.Data/System.Data/DataTable.cs
index 21f5430..740dfbf 100644
--- a/mcs/class/System.Data/System.Data/DataTable.cs
+++ b/mcs/class/System.Data/System.Data/DataTable.cs
@@ -880,6 +880,8 @@ namespace System.Data {
 				if (isEmpty || !Copy.Columns.Contains (column.ColumnName))
 					Copy.Columns.Add (column.Clone ());
 			}
+			foreach (DataColumn column in Copy.Columns)
+				column.CompileExpression ();
 
 			CopyConstraints (Copy);
 			// add primary key to the copy
diff --git a/mcs/class/System.Data/System.Data/DataView.cs b/mcs/class/System.Data/System.Data/DataView.cs
index f1e17ad..ec3903b 100644
--- a/mcs/class/System.Data/System.Data/DataView.cs
+++ b/mcs/class/System.Data/System.Data/DataView.cs
@@ -268,7 +268,7 @@ namespace System.Data
 					initSort = value;
 					return;
 				}
-				if (value == sort)
+				if (value == Sort)
 					return;
 
 				if (value == null || value.Length == 0) {
diff --git a/mcs/class/System.Data/System.Data/XmlDiffLoader.cs b/mcs/class/System.Data/System.Data/XmlDiffLoader.cs
index 61f4f7a..c9add77 100644
--- a/mcs/class/System.Data/System.Data/XmlDiffLoader.cs
+++ b/mcs/class/System.Data/System.Data/XmlDiffLoader.cs
@@ -351,6 +351,7 @@ namespace System.Data {
 
 		DataTable GetTable (string name)
 		{
+			name = XmlConvert.DecodeName (name);
 			if (DSet != null) 
 				return DSet.Tables [name];
 			else if (name == table.TableName) 
diff --git a/mcs/class/System.Data/Test/System.Data/ChangeLog b/mcs/class/System.Data/Test/System.Data/ChangeLog
index 06655e9..cd0ea67 100644
--- a/mcs/class/System.Data/Test/System.Data/ChangeLog
+++ b/mcs/class/System.Data/Test/System.Data/ChangeLog
@@ -1,3 +1,53 @@
+2011-11-16  Rolf Bjarne Kvinge  <rolf at xamarin.com>
+
+	[System.Data] Fix sorting in DataView when changing sort
+	value/default sort several times.
+
+2011-09-13  Rolf Bjarne Kvinge  <rolf at xamarin.com>
+
+	[System.Data] Delay column expression evaluation after all the
+	columns have been cloned when cloning a table. Fixes #666.
+
+	When cloning a table we loop over all the columns and clone them,
+	but if a column contains an expression with a reference to a later
+	column, we'll throw an exception unless we delay the expression
+	compilation until all the columns have been added to the new table
+	clone.
+
+	So I've split out the expression compilation logic from the
+	Expression property setter, and now the column Clone method only
+	sets the field. The Clone caller is responsible for calling
+	CompileExpression on the cloned column after adding all the cloned
+	columns to the cloned table.
+
+2011-09-13  Rolf Bjarne Kvinge  <rolf at xamarin.com>
+
+	[System.Data] Properly clone a column's extended properties when
+	cloning a table. Fixes #668.
+
+2011-09-09  Miguel de Icaza  <miguel at gnome.org>
+
+	Various fixes to the Expression parser, the fixes include:
+
+	* Fixes to the SUBSTRING and TRIM function to allow a wider range
+	of functions to be passed as parameters. This fixes xamarin #665
+
+	* Fix to the Parser.jay grammar to eliminate the reduce/reduce
+	conflicts.
+
+	* Dropping the string concatenation code and instead use the
+	existing arithmetic addition operator which also fixes the
+	concatenation operation in the presence of null values
+
+	* Adds the null literal
+
+	With the associated test cases.
+
+2011-08-31  Atsushi Eno  <atsushi at ximian.com>
+
+	DiffLoader didn't handle encoded name and caused mismatch between
+	.NET.
+
 2011-03-15  Veerapuram Varadhan  <v.varadhan at gmail.com>
 
 	* DataSetTest2.cs (WriteXmlSchema_Relations_ForeignKeys): Add
diff --git a/mcs/class/System.Data/Test/System.Data/ChangeLog b/mcs/class/System.Data/Test/System.Data/ChangeLog.old
similarity index 100%
copy from mcs/class/System.Data/Test/System.Data/ChangeLog
copy to mcs/class/System.Data/Test/System.Data/ChangeLog.old
diff --git a/mcs/class/System.Data/Test/System.Data/DataColumnTest.cs b/mcs/class/System.Data/Test/System.Data/DataColumnTest.cs
index e3ed816..ac7ceeb 100644
--- a/mcs/class/System.Data/Test/System.Data/DataColumnTest.cs
+++ b/mcs/class/System.Data/Test/System.Data/DataColumnTest.cs
@@ -10,9 +10,10 @@
 // (C) Copyright 2002 Rodrigo Moya
 // (C) Copyright 2003 Daniel Morgan
 // (C) Copyright 2003 Martin Willemoes Hansen
-//
+// (C) Copyright 2011 Xamarin Inc
 
 //
+// Copyright 2011 Xamarin Inc (http://www.xamarin.com)
 // Copyright (C) 2004 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
@@ -913,5 +914,46 @@ namespace MonoTests.System.Data
 				Assert.Fail ("SetOrdinalTest failed");
 			}
 		}
+
+		[Test]
+		public void Xamarin665 ()
+		{
+			var t = new DataTable() ;
+			var c1 = t.Columns.Add ("c1");
+			var c2 = t.Columns.Add ("c2");
+			c2.Expression = "TRIM(ISNULL(c1,' '))";
+			c2.Expression = "SUBSTRING(ISNULL(c1,' '), 1, 10)";
+		}
+
+		DataColumn MakeColumn (string col, string test)
+		{
+			return new DataColumn () {
+				ColumnName = col,
+				Expression = test
+			};
+		}
+
+#if false
+// Check Windows output for the row [0] value
+		[Test]
+		public void NullStrings ()
+		{
+			var a = MakeColumn ("nullbar", "null+'bar'");
+			var b = MakeColumn ("barnull", "'bar'+null");
+			var c = MakeColumn ("foobar", "'foo'+'bar'");
+
+		        var table = new DataTable();
+		        
+		        table.Columns.Add(a);
+		        table.Columns.Add(b);
+		        table.Columns.Add(c);
+		
+		        var row = table.NewRow();
+		        table.Rows.Add(row);
+			Assert.AreEqual (row [0], DBNull.Value, "#1");
+			Assert.AreEqual (row [1], DBNull.Value, "#2");
+			Assert.AreEqual (row [2], "foobar", "#3");
+		}
+#endif
 	}
 }
diff --git a/mcs/class/System.Data/Test/System.Data/DataSetTest.cs b/mcs/class/System.Data/Test/System.Data/DataSetTest.cs
index b6a49ea..27054b3 100644
--- a/mcs/class/System.Data/Test/System.Data/DataSetTest.cs
+++ b/mcs/class/System.Data/Test/System.Data/DataSetTest.cs
@@ -2563,6 +2563,30 @@ namespace MonoTests.System.Data
 			Assert.AreEqual (2, dsLoad.Tables[2].Columns.Count, "T3-Columns");
 		}
 
+		[Test]
+		public void ReadDiff ()
+		{
+			DataSet dsTest = new DataSet ("MonoTouchTest");
+			var dt = new DataTable ("123");
+			dt.Columns.Add (new DataColumn ("Value1"));
+			dt.Columns.Add (new DataColumn ("Value2"));
+			dsTest.Tables.Add (dt);
+			dsTest.ReadXml (new StringReader (@"
+<diffgr:diffgram
+   xmlns:msdata='urn:schemas-microsoft-com:xml-msdata'
+   xmlns:diffgr='urn:schemas-microsoft-com:xml-diffgram-v1'>
+  <MonoTouchTest>
+    <_x0031_23 diffgr:id='1231' msdata:rowOrder='0'>
+      <Value1>Row1Value1</Value1>
+      <Value2>Row1Value2</Value2>
+    </_x0031_23>
+  </MonoTouchTest>
+</diffgr:diffgram>
+"));
+			Assert.AreEqual ("123", dsTest.Tables [0].TableName, "#1");
+			Assert.AreEqual (1, dsTest.Tables [0].Rows.Count, "#2");
+		}
+
 		private void CompareTables (DataSet dsLoad) {
 			Assert.AreEqual (ds.Tables.Count, dsLoad.Tables.Count, "NumTables");
 			for (int tc = 0; tc < dsLoad.Tables.Count; tc++) {
diff --git a/mcs/class/System.Data/Test/System.Data/DataTableTest.cs b/mcs/class/System.Data/Test/System.Data/DataTableTest.cs
index acad4bf..c397ce6 100644
--- a/mcs/class/System.Data/Test/System.Data/DataTableTest.cs
+++ b/mcs/class/System.Data/Test/System.Data/DataTableTest.cs
@@ -11,6 +11,7 @@
 
 //
 // Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2011 Xamarin Inc. (http://www.xamarin.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
@@ -1044,6 +1045,43 @@ namespace MonoTests.System.Data
 		}
 
 		[Test]
+		public void CloneExtendedProperties ()
+		{
+			// bug 668
+			DataTable t1 = new DataTable ("t1");
+			DataColumn c1 = t1.Columns.Add ("c1");
+			c1.ExtendedProperties.Add ("Company", "Xamarin");
+			
+			DataTable t2 = t1.Clone ();
+			Assert.AreEqual ("Xamarin", t1.Columns["c1"].ExtendedProperties["Company"], "CEP1");
+			Assert.AreEqual ("Xamarin", t2.Columns["c1"].ExtendedProperties["Company"], "CEP2");
+		}
+	
+		[Test]
+		[ExpectedException (typeof (EvaluateException))]
+		public void CloneExtendedProperties1 ()
+		{
+			// Xamarin bug 666
+			DataTable table1 = new DataTable("Table1") ;
+
+			DataColumn c1 = table1.Columns.Add("c1", typeof(string), "'hello ' + c2") ; /* Should cause an exception */
+		}
+
+		[Test]
+		public void CloneExtendedProperties2 ()
+		{
+			// Xamarin bug 666
+			DataTable table1 = new 	DataTable("Table1") ;
+
+			DataColumn c1 = table1.Columns.Add("c1") ;
+			DataColumn c2 = table1.Columns.Add("c2") ;
+
+			c1.Expression = "'hello ' + c2";
+
+			DataTable t2 = table1.Clone(); // this should not cause an exception
+		}
+
+		[Test]
 		public void LoadDataException ()
 		{
 			DataTable table = new DataTable ();
diff --git a/mcs/class/System.Data/Test/System.Data/DataViewTest.cs b/mcs/class/System.Data/Test/System.Data/DataViewTest.cs
index f9be000..bf9834d 100644
--- a/mcs/class/System.Data/Test/System.Data/DataViewTest.cs
+++ b/mcs/class/System.Data/Test/System.Data/DataViewTest.cs
@@ -128,6 +128,16 @@ namespace MonoTests.System.Data
 		}
 
 		[Test]
+		public void TestSort ()
+		{
+			DataView dv = new DataView ();
+			dv.Sort = "abc";
+			dv.Sort = string.Empty;
+			dv.Sort = "abc";
+			AssertEquals ("test#01", "abc", dv.Sort);
+		}
+
+		[Test]
 		public void DataView ()
 		{
 			DataView dv1,dv2,dv3;
diff --git a/mcs/class/System.Numerics/Makefile b/mcs/class/System.Numerics/Makefile
index 2e6dea1..7ee1c10 100644
--- a/mcs/class/System.Numerics/Makefile
+++ b/mcs/class/System.Numerics/Makefile
@@ -8,7 +8,7 @@ TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
 
 EXTRA_DISTFILES =
 
-VALID_PROFILE := $(filter 4.0, $(FRAMEWORK_VERSION))
+VALID_PROFILE := $(filter 4.0 2.1, $(FRAMEWORK_VERSION))
 
 ifndef VALID_PROFILE
 LIBRARY_NAME = dummy-System.Numerics.dll
diff --git a/mcs/class/System.Runtime.Serialization/System.Runtime.Serialization/ChangeLog b/mcs/class/System.Runtime.Serialization/System.Runtime.Serialization/ChangeLog
index 3e98a4d..749d1d2 100644
--- a/mcs/class/System.Runtime.Serialization/System.Runtime.Serialization/ChangeLog
+++ b/mcs/class/System.Runtime.Serialization/System.Runtime.Serialization/ChangeLog
@@ -1,3 +1,8 @@
+2011-10-24  Atsushi Eno  <atsushieno at veritas-vos-liberabit.com>
+
+	Give prefix "i" for xsi:nil. Patch by Alexander Riman, fixes pt.2
+	of #1198.
+
 2011-06-28  Atsushi Eno  <atsushi at ximian.com>
 
 	Implement support for generic data contract type name with "{x}".
diff --git a/mcs/class/System.Runtime.Serialization/System.Runtime.Serialization/XmlFormatterSerializer.cs b/mcs/class/System.Runtime.Serialization/System.Runtime.Serialization/XmlFormatterSerializer.cs
index 0e0ef6d..a816839 100644
--- a/mcs/class/System.Runtime.Serialization/System.Runtime.Serialization/XmlFormatterSerializer.cs
+++ b/mcs/class/System.Runtime.Serialization/System.Runtime.Serialization/XmlFormatterSerializer.cs
@@ -86,7 +86,7 @@ namespace System.Runtime.Serialization
 		public void Serialize (Type type, object graph)
 		{
 			if (graph == null)
-				writer.WriteAttributeString ("nil", XmlSchema.InstanceNamespace, "true");
+				writer.WriteAttributeString ("i", "nil", XmlSchema.InstanceNamespace, "true");
 #if !MOONLIGHT
 			else if (type == typeof (XmlElement))
 				((XmlElement) graph).WriteTo (Writer);
diff --git a/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/ChangeLog b/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/ChangeLog
index 6d8f63a..c3e09bf 100644
--- a/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/ChangeLog
+++ b/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/ChangeLog
@@ -1,3 +1,8 @@
+2011-11-24  Miguel de Icaza  <miguel at gnome.org>
+
+	Extend JsonSerializerReader to support nullables and parse a wider
+	range of Date formats, fixes x#163
+
 2011-04-06  Atsushi Eno  <atsushi at ximian.com>
 
 	Looks like .NET accepts non-integer numbers as int. Smells bogus
diff --git a/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs b/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs
index dff81a1..9e3b60a 100644
--- a/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs
+++ b/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs
@@ -72,6 +72,9 @@ namespace System.Runtime.Serialization.Json
 			if (serialized_object_count ++ == serializer.MaxItemsInObjectGraph)
 				throw SerializationError (String.Format ("The object graph exceeded the maximum object count '{0}' specified in the serializer", serializer.MaxItemsInObjectGraph));
 
+			if (type.IsGenericType && type.GetGenericTypeDefinition () == typeof (Nullable<>))
+				type = Nullable.GetUnderlyingType (type);
+			
 			bool isNull = reader.GetAttribute ("type") == "null";
 
 			switch (Type.GetTypeCode (type)) {
@@ -121,7 +124,29 @@ namespace System.Runtime.Serialization.Json
 				var s = reader.ReadElementContentAsString ();
 				if (s.Length < 2 || !s.StartsWith ("/Date(", StringComparison.Ordinal) || !s.EndsWith (")/", StringComparison.Ordinal))
 					throw new XmlException ("Invalid JSON DateTime format. The value format should be '/Date(UnixTime)/'");
-				return new DateTime (1970, 1, 1).AddMilliseconds (long.Parse (s.Substring (6, s.Length - 8)));
+
+				// The date can contain [SIGN]LONG, [SIGN]LONG+HOURSMINUTES or [SIGN]LONG-HOURSMINUTES
+				// the format for HOURSMINUTES is DDDD
+				int tidx = s.IndexOf ('-', 8);
+				if (tidx == -1)
+					tidx = s.IndexOf ('+', 8);
+				int minutes = 0;
+				if (tidx == -1){
+					s = s.Substring (6, s.Length - 8);
+				} else {
+					int offset;
+					int.TryParse (s.Substring (tidx+1, s.Length-3-tidx), out offset);
+
+					minutes = (offset % 100) + (offset / 100) * 60;
+					if (s [tidx] == '-')
+						minutes = -minutes;
+
+					s = s.Substring (6, tidx-6);
+				}
+				var date = new DateTime (1970, 1, 1).AddMilliseconds (long.Parse (s));
+				if (minutes != 0)
+					date = date.AddMinutes (minutes);
+				return date;
 			default:
 				if (type == typeof (Guid)) {
 					return new Guid (reader.ReadElementContentAsString ());
diff --git a/mcs/class/System.ServiceModel.Web/System.ServiceModel.Dispatcher/ChangeLog b/mcs/class/System.ServiceModel.Web/System.ServiceModel.Dispatcher/ChangeLog
index 5442797..21fe906 100644
--- a/mcs/class/System.ServiceModel.Web/System.ServiceModel.Dispatcher/ChangeLog
+++ b/mcs/class/System.ServiceModel.Web/System.ServiceModel.Dispatcher/ChangeLog
@@ -1,3 +1,55 @@
+2011-10-26  Atsushi Eno  <atsushieno at veritas-vos-liberabit.com>
+
+	Fix NET_2_1 builds.
+
+2011-10-16  Miguel de Icaza  <miguel at gnome.org>
+
+	Apply patch from Mario Kosmiskaso fix bug 1209: Patch to correctly
+	expose WebOperationContext.IncomingResponse
+
+	There was apparently no point in the call flow when the reponse
+	message was set in the context, resulting in
+	WebOperationContext.IncomingResponse always being null.
+
+	After patching WebMessageFormatter to set the response in the
+	context (if available) the value of
+	WebOperationContext.IncomingResponse was still null. A bit more
+	investigation showed that IncomingWebResponseContext would
+	construct a HttpResponseMessageProperty encapsulating the
+	OperationContext at the time the request was made but before the
+	response was received and cache that object. That caused the
+	HttpResponseMessageProperty to always have a null value for the
+	response. The second part of the patch changes this behavior and
+	always creates a new HttpResponseMessageProperty on GET.
+
+2011-08-24  Atsushi Eno  <atsushi at ximian.com>
+
+	Revert GET switch for serializing requests. BodyWriter handles it
+	better.
+
+2011-08-24  Atsushi Eno  <atsushi at ximian.com>
+
+	for GET request, just skip the member. It does not contain xml for
+	null.
+
+2011-08-24  Atsushi Eno  <atsushi at ximian.com>
+
+	Skip serialization when the return type is void.
+
+	This batch should fix bug #206.
+
+2011-08-24  Atsushi Eno  <atsushi at ximian.com>
+
+	Differentiate GET query parameter binding from another request
+	binding.
+
+	This is one core of the bugfix for #206.
+
+2011-08-23  Atsushi Eno  <atsushi at ximian.com>
+
+	UriTemplate should not be mandatory, make it optional. Fix unit
+	test.
+
 2011-06-28  Atsushi Eno  <atsushi at ximian.com>
 
 	Implement support for Stream param with WebHttpBinding raw content
diff --git a/mcs/class/System.ServiceModel.Web/System.ServiceModel.Dispatcher/WebMessageFormatter.cs b/mcs/class/System.ServiceModel.Web/System.ServiceModel.Dispatcher/WebMessageFormatter.cs
index 10a98ce..fde0297 100644
--- a/mcs/class/System.ServiceModel.Web/System.ServiceModel.Dispatcher/WebMessageFormatter.cs
+++ b/mcs/class/System.ServiceModel.Web/System.ServiceModel.Dispatcher/WebMessageFormatter.cs
@@ -3,8 +3,10 @@
 //
 // Author:
 //	Atsushi Enomoto  <atsushi at ximian.com>
+//	Atsushi Enomoto  <atsushi at xamarin.com>
 //
 // Copyright (C) 2008,2009 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2011 Xamarin, Inc (http://xamarin.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
@@ -45,6 +47,24 @@ using XmlObjectSerializer = System.Object;
 
 namespace System.ServiceModel.Dispatcher
 {
+	// This set of classes is to work as message formatters for 
+	// WebHttpBehavior. There are couple of aspects to differentiate
+	// implementations:
+	// - request/reply and client/server
+	//   by WebMessageFormatter hierarchy
+	//   - WebClientMessageFormatter - for client
+	//     - RequestClientFormatter - for request
+	//     - ReplyClientFormatter - for response
+	//   - WebDispatchMessageFormatter - for server
+	//     - RequestDispatchFormatter - for request
+	//     - ReplyDispatchFormatter - for response
+	//
+	// FIXME: below items need more work
+	// - HTTP method differences
+	//  - GET (WebGet)
+	//  - POST (other way)
+	// - output format: Stream, JSON, XML ...
+
 	internal abstract class WebMessageFormatter
 	{
 		OperationDescription operation;
@@ -182,6 +202,9 @@ namespace System.ServiceModel.Dispatcher
 
 		protected XmlObjectSerializer GetSerializer (WebContentFormat msgfmt, bool isWrapped, MessagePartDescription part)
 		{
+			if (part.Type == typeof (void))
+				return null; // no serialization should be done.
+
 			switch (msgfmt) {
 			case WebContentFormat.Xml:
 				if (xml_serializer == null)
@@ -208,6 +231,9 @@ namespace System.ServiceModel.Dispatcher
 			// FIXME: handle ref/out parameters
 
 			var reader = message.GetReaderAtBodyContents ();
+			reader.MoveToContent ();
+
+			bool wasEmptyElement = reader.IsEmptyElement;
 
 			if (isWrapped) {
 				if (fmt == WebContentFormat.Json)
@@ -216,9 +242,9 @@ namespace System.ServiceModel.Dispatcher
 					reader.ReadStartElement (md.Body.WrapperName, md.Body.WrapperNamespace);
 			}
 
-			var ret = ReadObjectBody (serializer, reader);
+			var ret = (serializer == null) ? null : ReadObjectBody (serializer, reader);
 
-			if (isWrapped)
+			if (isWrapped && !wasEmptyElement)
 				reader.ReadEndElement ();
 
 			return ret;
@@ -291,6 +317,8 @@ namespace System.ServiceModel.Dispatcher
 
 		internal abstract class WebClientMessageFormatter : WebMessageFormatter, IClientMessageFormatter
 		{
+			IClientMessageFormatter default_formatter;
+
 			protected WebClientMessageFormatter (OperationDescription operation, ServiceEndpoint endpoint, QueryStringConverter converter, WebHttpBehavior behavior)
 				: base (operation, endpoint, converter, behavior)
 			{
@@ -306,11 +334,11 @@ namespace System.ServiceModel.Dispatcher
 
 				MessageDescription md = GetMessageDescription (MessageDirection.Input);
 
-				if (parameters.Length != md.Body.Parts.Count)
-					throw new ArgumentException ("Parameter array length does not match the number of message body parts");
-
+				Message ret;
+				Uri to;
 				object msgpart = null;
 
+
 				for (int i = 0; i < parameters.Length; i++) {
 					var p = md.Body.Parts [i];
 					string name = p.Name.ToUpper (CultureInfo.InvariantCulture);
@@ -325,10 +353,9 @@ namespace System.ServiceModel.Dispatcher
 							throw new  NotImplementedException (String.Format ("More than one parameters including {0} that are not contained in the URI template {1} was found.", p.Name, UriTemplate));
 					}
 				}
+				ret = Message.CreateMessage (messageVersion, (string) null, msgpart);
 
-				Uri to = UriTemplate.BindByName (Endpoint.Address.Uri, c);
-
-				Message ret = Message.CreateMessage (messageVersion, (string) null, msgpart);
+				to = UriTemplate.BindByName (Endpoint.Address.Uri, c);
 				ret.Headers.To = to;
 
 				var hp = new HttpRequestMessageProperty ();
@@ -359,6 +386,13 @@ namespace System.ServiceModel.Dispatcher
 					throw new ArgumentNullException ("parameters");
 				CheckMessageVersion (message.Version);
 
+#if !NET_2_1
+				if (OperationContext.Current != null) {
+					// Set response in the context
+					OperationContext.Current.IncomingMessage = message;
+				}
+#endif
+
 				if (message.IsEmpty)
 					return null; // empty message, could be returned by HttpReplyChannel.
 
@@ -546,11 +580,8 @@ namespace System.ServiceModel.Dispatcher
 				var fmt = wp != null ? wp.Format : WebContentFormat.Xml;
 
 				Uri to = message.Headers.To;
-				UriTemplateMatch match = UriTemplate.Match (Endpoint.Address.Uri, to);
-				if (match == null)
-					// not sure if it could happen
-					throw new SystemException (String.Format ("INTERNAL ERROR: UriTemplate does not match with the request: {0} / {1}", UriTemplate, to));
-				if (iwc != null)
+				UriTemplateMatch match = to == null ? null : UriTemplate.Match (Endpoint.Address.Uri, to);
+				if (match != null && iwc != null)
 					iwc.UriTemplateMatch = match;
 
 				MessageDescription md = GetMessageDescription (MessageDirection.Input);
@@ -558,15 +589,20 @@ namespace System.ServiceModel.Dispatcher
 				for (int i = 0; i < parameters.Length; i++) {
 					var p = md.Body.Parts [i];
 					string name = p.Name.ToUpperInvariant ();
-					var str = match.BoundVariables [name];
-					if (str != null)
-						parameters [i] = Converter.ConvertStringToValue (str, p.Type);
-					else if (fmt == WebContentFormat.Raw && p.Type == typeof (Stream)) {
+					if (fmt == WebContentFormat.Raw && p.Type == typeof (Stream)) {
 						var rmsg = (RawMessage) message;
 						parameters [i] = rmsg.Stream;
 					} else {
-						var serializer = GetSerializer (fmt, IsRequestBodyWrapped, p);
-						parameters [i] = DeserializeObject (serializer, message, md, IsRequestBodyWrapped, fmt);
+						var str = match.BoundVariables [name];
+						if (str != null)
+							parameters [i] = Converter.ConvertStringToValue (str, p.Type);
+						else {
+							if (info.Method != "GET") {
+								var serializer = GetSerializer (fmt, IsRequestBodyWrapped, p);
+								parameters [i] = DeserializeObject (serializer, message, md, IsRequestBodyWrapped, fmt);
+							}
+							// for GET Uri template parameters, there is no <anyType xsi:nil='true' />. So just skip the member.
+						}
 					}
 				}
 			}
diff --git a/mcs/class/System.ServiceModel.Web/System.ServiceModel.Web/ChangeLog b/mcs/class/System.ServiceModel.Web/System.ServiceModel.Web/ChangeLog
index 11396cd..853762f 100644
--- a/mcs/class/System.ServiceModel.Web/System.ServiceModel.Web/ChangeLog
+++ b/mcs/class/System.ServiceModel.Web/System.ServiceModel.Web/ChangeLog
@@ -1,3 +1,35 @@
+2011-10-16  Miguel de Icaza  <miguel at gnome.org>
+
+	Apply patch from Mario Kosmiskaso fix bug 1209: Patch to correctly
+	expose WebOperationContext.IncomingResponse
+
+	There was apparently no point in the call flow when the reponse
+	message was set in the context, resulting in
+	WebOperationContext.IncomingResponse always being null.
+
+	After patching WebMessageFormatter to set the response in the
+	context (if available) the value of
+	WebOperationContext.IncomingResponse was still null. A bit more
+	investigation showed that IncomingWebResponseContext would
+	construct a HttpResponseMessageProperty encapsulating the
+	OperationContext at the time the request was made but before the
+	response was received and cache that object. That caused the
+	HttpResponseMessageProperty to always have a null value for the
+	response. The second part of the patch changes this behavior and
+	always creates a new HttpResponseMessageProperty on GET.
+
+2011-10-16  Miguel de Icaza  <miguel at gnome.org>
+
+	Apply patch from Mario Kosmiskaso fix bug 1205: Check reference
+	before copying values from Headers
+
+	OutgoingWebRequestContext throws a NullReferenceException when
+	making a REST call. The exception is thrown because there are no
+	Headers in the context.
+
+	Attached patch simply tests for null before copying values from
+	Headers.
+
 2011-04-08  Atsushi Eno  <atsushi at ximian.com>
 
 	Implement 4.0 WebOperationContext.Create[Atom10|Json]Response()
diff --git a/mcs/class/System.ServiceModel.Web/System.ServiceModel.Web/IncomingWebResponseContext.cs b/mcs/class/System.ServiceModel.Web/System.ServiceModel.Web/IncomingWebResponseContext.cs
index af254f9..dde1575 100644
--- a/mcs/class/System.ServiceModel.Web/System.ServiceModel.Web/IncomingWebResponseContext.cs
+++ b/mcs/class/System.ServiceModel.Web/System.ServiceModel.Web/IncomingWebResponseContext.cs
@@ -34,14 +34,20 @@ namespace System.ServiceModel.Web
 {
 	public class IncomingWebResponseContext
 	{
-		HttpResponseMessageProperty hp;
+		OperationContext ctx;
+
+		HttpResponseMessageProperty hp {
+			get {
+				if (ctx.IncomingMessageProperties != null)
+					return (HttpResponseMessageProperty) ctx.IncomingMessageProperties [HttpResponseMessageProperty.Name];
+				else
+					return new HttpResponseMessageProperty ();
+			}
+		}
 
 		internal IncomingWebResponseContext (OperationContext context)
 		{
-			if (context.IncomingMessageProperties != null)
-				hp = (HttpResponseMessageProperty) context.IncomingMessageProperties [HttpResponseMessageProperty.Name];
-			else
-				hp = new HttpResponseMessageProperty ();
+			ctx = context;
 		}
 
 		public long ContentLength {
diff --git a/mcs/class/System.ServiceModel.Web/System.ServiceModel.Web/OutgoingWebRequestContext.cs b/mcs/class/System.ServiceModel.Web/System.ServiceModel.Web/OutgoingWebRequestContext.cs
index cb592be..b3154c3 100644
--- a/mcs/class/System.ServiceModel.Web/System.ServiceModel.Web/OutgoingWebRequestContext.cs
+++ b/mcs/class/System.ServiceModel.Web/System.ServiceModel.Web/OutgoingWebRequestContext.cs
@@ -62,8 +62,9 @@ namespace System.ServiceModel.Web
 
 		internal void Apply (HttpRequestMessageProperty hp)
 		{
-			foreach (var key in Headers.AllKeys)
-				hp.Headers [key] = Headers [key];
+			if (Headers != null)
+				foreach (var key in Headers.AllKeys)
+					hp.Headers [key] = Headers [key];
 			if (Accept != null)
 				hp.Headers ["Accept"] = Accept;
 			if (ContentLength > 0)
diff --git a/mcs/class/System.ServiceModel.Web/System/ChangeLog b/mcs/class/System.ServiceModel.Web/System/ChangeLog
index 6ccfb50..02f72a2 100644
--- a/mcs/class/System.ServiceModel.Web/System/ChangeLog
+++ b/mcs/class/System.ServiceModel.Web/System/ChangeLog
@@ -1,3 +1,7 @@
+2011-08-24  Atsushi Eno  <atsushi at ximian.com>
+
+	When there was no path parameter, it ignored the whole path part.
+
 2011-05-23  Atsushi Eno  <atsushi at ximian.com>
 
 	Support named wildcard in UriTemplate matching. Fixed bug #693996.
diff --git a/mcs/class/System.ServiceModel.Web/System/UriTemplate.cs b/mcs/class/System.ServiceModel.Web/System/UriTemplate.cs
index 08e7059..5277d5b 100644
--- a/mcs/class/System.ServiceModel.Web/System/UriTemplate.cs
+++ b/mcs/class/System.ServiceModel.Web/System/UriTemplate.cs
@@ -163,6 +163,15 @@ namespace System
 
 		void BindByName (ref int src, StringBuilder sb, ReadOnlyCollection<string> names, NameValueCollection nvc, IDictionary<string,string> dic, bool omitDefaults, bool query)
 		{
+			if (query) {
+				int idx = template.IndexOf ('?', src);
+				if (idx > 0) {
+					sb.Append (template.Substring (src, idx - src));
+					src = idx;
+					// note that it doesn't append '?'. It is added only when there is actual parameter binding.
+				}
+			}
+
 			foreach (string name in names) {
 				int s = template.IndexOf ('{', src);
 				int e = template.IndexOf ('}', s + 1);
@@ -173,18 +182,19 @@ namespace System
 #endif
 				if (dic != null)
 					dic.TryGetValue (name, out value);
+
 				if (query) {
 					if (value != null || (!omitDefaults && Defaults.TryGetValue (name, out value))) {
 						sb.Append (template.Substring (src, s - src));
 						sb.Append (value);
 					}
-				} else
-					if (value == null && (omitDefaults || !Defaults.TryGetValue(name, out value)))
-						throw new ArgumentException(string.Format("The argument name value collection does not contain non-nul vaalue for '{0}'", name), "parameters");
-					else {
-						sb.Append (template.Substring (src, s - src));
-						sb.Append (value);
-					}
+				} else {
+					if (value == null && (omitDefaults || !Defaults.TryGetValue (name, out value)))
+						throw new ArgumentException (string.Format("The argument name value collection does not contain non-null value for '{0}'", name), "parameters");
+
+					sb.Append (template.Substring (src, s - src));
+					sb.Append (value);
+				}
 				src = e + 1;
 			}
 		}
diff --git a/mcs/class/System.ServiceModel.Web/Test/System.Runtime.Serialization.Json/ChangeLog b/mcs/class/System.ServiceModel.Web/Test/System.Runtime.Serialization.Json/ChangeLog
index 98edae2..2d13547 100644
--- a/mcs/class/System.ServiceModel.Web/Test/System.Runtime.Serialization.Json/ChangeLog
+++ b/mcs/class/System.ServiceModel.Web/Test/System.Runtime.Serialization.Json/ChangeLog
@@ -1,3 +1,8 @@
+2011-11-24  Miguel de Icaza  <miguel at gnome.org>
+
+	Extend JsonSerializerReader to support nullables and parse a wider
+	range of Date formats, fixes x#163
+
 2011-04-05  Atsushi Eno  <atsushi at ximian.com>
 
 	Auto-detect text encoding from input stream for JsonReader. Fix
diff --git a/mcs/class/System.ServiceModel.Web/Test/System.Runtime.Serialization.Json/DataContractJsonSerializerTest.cs b/mcs/class/System.ServiceModel.Web/Test/System.Runtime.Serialization.Json/DataContractJsonSerializerTest.cs
index 3debe78..2a75876 100644
--- a/mcs/class/System.ServiceModel.Web/Test/System.Runtime.Serialization.Json/DataContractJsonSerializerTest.cs
+++ b/mcs/class/System.ServiceModel.Web/Test/System.Runtime.Serialization.Json/DataContractJsonSerializerTest.cs
@@ -1362,6 +1362,29 @@ namespace MonoTests.System.Runtime.Serialization.Json
 			Assert.AreEqual (query.StartDate, q.StartDate, "#2");
 			Assert.AreEqual (query.EndDate, q.EndDate, "#3");
 		}
+
+		[DataContract(Name = "DateTest")]
+		public class DateTest
+		{
+			[DataMember(Name = "should_have_value")]
+			public DateTime? ShouldHaveValue { get; set; }
+		}
+
+		//
+		// This tests both the extended format "number-0500" as well
+		// as the nullable field in the structure
+		[Test]
+		public void BugXamarin163 ()
+		{
+			string json = @"{""should_have_value"":""\/Date(1277355600000-0500)\/""}";
+
+			byte[] bytes = global::System.Text.Encoding.UTF8.GetBytes(json);
+			Stream inputStream = new MemoryStream(bytes);
+			
+			DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(DateTest));
+			DateTest t = serializer.ReadObject(inputStream) as DateTest;
+			Assert.AreEqual (634129344000000000, t.ShouldHaveValue.Value.Ticks, "#1");
+		}
 		
 		[Test]
 		public void DeserializeNullMember ()
diff --git a/mcs/class/System.ServiceModel.Web/Test/System.ServiceModel.Description/ChangeLog b/mcs/class/System.ServiceModel.Web/Test/System.ServiceModel.Description/ChangeLog
index fabe6d7..087cc62 100644
--- a/mcs/class/System.ServiceModel.Web/Test/System.ServiceModel.Description/ChangeLog
+++ b/mcs/class/System.ServiceModel.Web/Test/System.ServiceModel.Description/ChangeLog
@@ -1,3 +1,14 @@
+2011-08-24  Atsushi Eno  <atsushi at ximian.com>
+
+	Skip serialization when the return type is void.
+
+	This batch should fix bug #206.
+
+2011-08-23  Atsushi Eno  <atsushi at ximian.com>
+
+	UriTemplate should not be mandatory, make it optional. Fix unit
+	test.
+
 2010-10-15  Frank Wilhelm  <fwilhelm at nowisys.de>
 
 	Make Validate() less restrictive for contracts with explicit
diff --git a/mcs/class/System.ServiceModel.Web/Test/System.ServiceModel.Description/WebHttpBehaviorTest.cs b/mcs/class/System.ServiceModel.Web/Test/System.ServiceModel.Description/WebHttpBehaviorTest.cs
index 7d4a9c1..bba9cb3 100644
--- a/mcs/class/System.ServiceModel.Web/Test/System.ServiceModel.Description/WebHttpBehaviorTest.cs
+++ b/mcs/class/System.ServiceModel.Web/Test/System.ServiceModel.Description/WebHttpBehaviorTest.cs
@@ -241,7 +241,6 @@ namespace MonoTests.System.ServiceModel.Description
 			var se = new ServiceEndpoint (cd, new WebHttpBinding (), new EndpointAddress ("http://localhost:8080/"));
 			var wmebe = new WebMessageEncodingBindingElement ();
 			var wme = wmebe.CreateMessageEncoderFactory ().Encoder;
-	Console.WriteLine (wme.MediaType);
 			var msg = wme.ReadMessage (ms, 100, null); // "application/xml" causes error.
 			var formatter = new WebHttpBehaviorExt ().DoGetRequestDispatchFormatter (od, se);
 			object [] pars = new object [1];
diff --git a/mcs/class/System.ServiceModel.Web/Test/System.ServiceModel.Dispatcher/ChangeLog b/mcs/class/System.ServiceModel.Web/Test/System.ServiceModel.Dispatcher/ChangeLog
index ef36f4f..b00dbf5 100644
--- a/mcs/class/System.ServiceModel.Web/Test/System.ServiceModel.Dispatcher/ChangeLog
+++ b/mcs/class/System.ServiceModel.Web/Test/System.ServiceModel.Dispatcher/ChangeLog
@@ -1,3 +1,9 @@
+2011-08-24  Atsushi Eno  <atsushi at ximian.com>
+
+	Skip serialization when the return type is void.
+
+	This batch should fix bug #206.
+
 2011-01-20  Atsushi Eno  <atsushi at ximian.com>
 
 	Read body content if required. Fixed all issues in bug #656020.
diff --git a/mcs/class/System.ServiceModel.Web/Test/System.ServiceModel.Dispatcher/WebHttpDispatchOperationSelectorTest.cs b/mcs/class/System.ServiceModel.Web/Test/System.ServiceModel.Dispatcher/WebHttpDispatchOperationSelectorTest.cs
index 64e875b..4507383 100644
--- a/mcs/class/System.ServiceModel.Web/Test/System.ServiceModel.Dispatcher/WebHttpDispatchOperationSelectorTest.cs
+++ b/mcs/class/System.ServiceModel.Web/Test/System.ServiceModel.Dispatcher/WebHttpDispatchOperationSelectorTest.cs
@@ -256,6 +256,7 @@ namespace MonoTests.System.ServiceModel.Dispatcher
 		{
 			var host = new WebServiceHost (typeof (Hello));
 			host.AddServiceEndpoint (typeof (IHello), new WebHttpBinding (), "http://localhost:37564/");
+			host.Description.Behaviors.Find<ServiceDebugBehavior> ().IncludeExceptionDetailInFaults = true;
 			host.Open ();
 			try {
 				// run client
diff --git a/mcs/class/System.ServiceModel.Web/Test/System/ChangeLog b/mcs/class/System.ServiceModel.Web/Test/System/ChangeLog
index 8c1e4d7..cb23d19 100644
--- a/mcs/class/System.ServiceModel.Web/Test/System/ChangeLog
+++ b/mcs/class/System.ServiceModel.Web/Test/System/ChangeLog
@@ -1,3 +1,7 @@
+2011-08-24  Atsushi Eno  <atsushi at ximian.com>
+
+	When there was no path parameter, it ignored the whole path part.
+
 2011-05-23  Atsushi Eno  <atsushi at ximian.com>
 
 	Support named wildcard in UriTemplate matching. Fixed bug #693996.
diff --git a/mcs/class/System.ServiceModel.Web/Test/System/UriTemplateTest.cs b/mcs/class/System.ServiceModel.Web/Test/System/UriTemplateTest.cs
index 73893cb..3392c36 100644
--- a/mcs/class/System.ServiceModel.Web/Test/System/UriTemplateTest.cs
+++ b/mcs/class/System.ServiceModel.Web/Test/System/UriTemplateTest.cs
@@ -229,6 +229,15 @@ namespace MonoTests.System
 		}
 
 		[Test]
+		public void BindByName3 ()
+		{
+			var t = new UriTemplate ("Login?clientLoginData={clientLoginData}&credentials={credentials}");
+			var n = new NameValueCollection ();
+			var u = t.BindByName (new Uri ("http://localhost"), n);
+			Assert.AreEqual ("http://localhost/Login", u.ToString (), "#1");
+		}
+
+		[Test]
 		public void BindByNameManySlashes ()
 		{
 			var t = new UriTemplate ("////{foo}/{bar}/");
diff --git a/mcs/class/System.ServiceModel/ChangeLog b/mcs/class/System.ServiceModel/ChangeLog
index 033b644..b3f5711 100644
--- a/mcs/class/System.ServiceModel/ChangeLog
+++ b/mcs/class/System.ServiceModel/ChangeLog
@@ -1,3 +1,8 @@
+2011-08-29  Sebastien Pouliot  <sebastien at xamarin.com>
+
+	Fix bug #380. Patch from bnc#605795 were not committed to master
+	but part of MonoTouch 3.x (ended up missing in MT4)
+
 2011-08-02  Atsushi Eno  <atsushi at ximian.com>
 
 	part of fix bug #41. MessageParameterAttribute is considered for
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/ChangeLog b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/ChangeLog
index 287c3b3..2f4c9df 100644
--- a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/ChangeLog
+++ b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/ChangeLog
@@ -1,3 +1,47 @@
+2011-10-21  Miguel de Icaza  <miguel at gnome.org>
+
+	Make this build on the MOBILE profile
+
+2011-10-16  Miguel de Icaza  <miguel at gnome.org>
+
+	Apply patch from Mario Kosmiskaso fix bug 1207: Throw the correct
+	exception when a REST request returns a 404
+
+	.NET throws a EndpointNotFoundException encapsulating a
+	WebException when a REST request returns a 404.
+
+	The attached patch tests for a 404 and throws the same exception
+	chain thrown by .NET.
+
+2011-10-16  Miguel de Icaza  <miguel at gnome.org>
+
+	Apply patch from Mario Kosmiskaso fix bug 1207: Check reference
+	before copying values from Headers
+
+	OutgoingWebRequestContext throws a NullReferenceException when
+	making a REST call. The exception is thrown because there are no
+	Headers in the context.
+
+	Attached patch simply tests for null before copying values from
+	Headers.
+
+2011-10-16  Miguel de Icaza  <miguel at gnome.org>
+
+	Apply patch from Mario Kosmiskaso fix bug 1204: Add certificate to
+	the HttpWebRequest if configured
+
+	System.ServiceModel.Channels.HttpRequestChannel never added the
+	configured certificate to the HttpWebRequest which prevented
+	client side authentication.
+
+	The attached patch does exactly that if a certificate has been
+	configured.
+
+2011-10-16  Miguel de Icaza  <miguel at gnome.org>
+
+	Fix bug 1203, relaxes the test for the protocol to allow https
+	endpoints
+
 2011-08-02  Atsushi Eno  <atsushieno at gmail.com>
 
 	Merge pull request #143 from mistoll/master
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/HttpChannelFactory.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/HttpChannelFactory.cs
index 55ab555..0fe6bbf 100644
--- a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/HttpChannelFactory.cs
+++ b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/HttpChannelFactory.cs
@@ -69,7 +69,8 @@ namespace System.ServiceModel.Channels
 		{
 			ThrowIfDisposedOrNotOpen ();
 
-			if (Transport.Scheme != address.Uri.Scheme)
+			//if (Transport.Scheme != address.Uri.Scheme)
+			if (!address.Uri.Scheme.StartsWith(Transport.Scheme))
 				throw new ArgumentException (String.Format ("Argument EndpointAddress has unsupported URI scheme: {0}", address.Uri.Scheme));
 
 			if (MessageEncoder.MessageVersion.Addressing.Equals (AddressingVersion.None) &&
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/HttpRequestChannel.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/HttpRequestChannel.cs
index 227d191..cf3b376 100644
--- a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/HttpRequestChannel.cs
+++ b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/HttpRequestChannel.cs
@@ -1,5 +1,5 @@
 //
-// HttpRequestChannel.cs
+// HttpRequestChannel.cs 
 //
 // Author:
 //	Atsushi Enomoto <atsushi at ximian.com>
@@ -163,6 +163,10 @@ namespace System.ServiceModel.Channels
 				if (hp.SuppressEntityBody)
 					suppressEntityBody = true;
 			}
+#if !NET_2_1
+			if (source.ClientCredentials.ClientCertificate.Certificate != null) 
+				((HttpWebRequest)web_request).ClientCertificates.Add (source.ClientCredentials.ClientCertificate.Certificate);
+#endif
 
 			if (!suppressEntityBody && String.Compare (web_request.Method, "GET", StringComparison.OrdinalIgnoreCase) != 0) {
 				MemoryStream buffer = new MemoryStream ();
@@ -218,6 +222,29 @@ namespace System.ServiceModel.Channels
 					channelResult.Complete (we);
 					return;
 				}
+
+
+				var hrr2 = (HttpWebResponse) res;
+				
+				if ((int) hrr2.StatusCode >= 400 && (int) hrr2.StatusCode < 500) {
+					Exception exception = new WebException (
+						String.Format ("There was an error on processing web request: Status code {0}({1}): {2}",
+							       (int) hrr2.StatusCode, hrr2.StatusCode, hrr2.StatusDescription), null,
+						WebExceptionStatus.ProtocolError, hrr2); 
+					
+					if ((int) hrr2.StatusCode == 404) {
+						// Throw the same exception .NET does
+						exception = new EndpointNotFoundException (
+							"There was no endpoint listening at {0} that could accept the message. This is often caused by an incorrect address " +
+							"or SOAP action. See InnerException, if present, for more details.",
+							exception);
+					}
+					
+					channelResult.Complete (exception);
+					return;
+				}
+
+
 				try {
 					// The response might contain SOAP fault. It might not.
 					resstr = res.GetResponseStream ();
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Description/ChangeLog b/mcs/class/System.ServiceModel/System.ServiceModel.Description/ChangeLog
index be77bbc..f9d1404 100644
--- a/mcs/class/System.ServiceModel/System.ServiceModel.Description/ChangeLog
+++ b/mcs/class/System.ServiceModel/System.ServiceModel.Description/ChangeLog
@@ -1,3 +1,8 @@
+2011-08-24  Atsushi Eno  <atsushi at ximian.com>
+
+	ReturnValue in MessageDescription was missing when there was
+	MessageContract.
+
 2011-08-03  Atsushi Eno  <atsushieno at veritas-vos-liberabit.com>
 
 	Fix build, merge some missing changes to MessagePartDescription.
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Description/ContractDescriptionGenerator.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Description/ContractDescriptionGenerator.cs
index 27874bb..5c80629 100644
--- a/mcs/class/System.ServiceModel/System.ServiceModel.Description/ContractDescriptionGenerator.cs
+++ b/mcs/class/System.ServiceModel/System.ServiceModel.Description/ContractDescriptionGenerator.cs
@@ -3,8 +3,10 @@
 //
 // Author:
 //	Atsushi Enomoto <atsushi at ximian.com>
+//	Atsushi Enomoto <atsushi at xamarin.com>
 //
 // Copyright (C) 2005-2007 Novell, Inc.  http://www.novell.com
+// Copyright (C) 2011 Xamarin, Inc. http://xamarin.com
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
@@ -413,9 +415,21 @@ namespace System.ServiceModel.Description
 					cd.Namespace.Length == 0 ? "urn:" : cd.Namespace.EndsWith ("/") ? "" : "/", cd.Name, "/",
 					od.Name, isRequest ? String.Empty : "Response");
 
+			MessageDescription md;
 			if (mca != null)
-				return CreateMessageDescription (messageType, cd.Namespace, action, isRequest, isCallback, mca);
-			return CreateMessageDescription (oca, plist, od.Name, cd.Namespace, action, isRequest, isCallback, retType, mi.ReturnTypeCustomAttributes);
+				md = CreateMessageDescription (messageType, cd.Namespace, action, isRequest, isCallback, mca);
+			else
+				md = CreateMessageDescription (oca, plist, od.Name, cd.Namespace, action, isRequest, isCallback, retType);
+
+			// ReturnValue
+			if (!isRequest) {
+				MessagePartDescription mp = CreatePartCore (GetMessageParameterAttribute (mi.ReturnTypeCustomAttributes), od.Name + "Result", md.Body.WrapperNamespace);
+				mp.Index = 0;
+				mp.Type = mca != null ? typeof (void) : retType;
+				md.Body.ReturnValue = mp;
+			}
+
+			return md;
 		}
 
 		public static MessageDescription CreateMessageDescription (
@@ -456,6 +470,13 @@ namespace System.ServiceModel.Description
 					pd.MemberInfo = bmi;
 					md.Headers.Add (pd);
 				}
+				var mpa = bmi.GetCustomAttribute<MessagePropertyAttribute> (false);
+				if (mpa != null) {
+					var pd = new MessagePropertyDescription (mpa.Name ?? mname);
+					pd.Type = MessageFilterOutByRef (mtype);
+					pd.MemberInfo = bmi;
+					md.Properties.Add (pd);
+				}
 				var mba = GetMessageBodyMemberAttribute (bmi);
 				if (mba != null) {
 					var pd = CreatePartCore (mba, mname, defaultNamespace);
@@ -467,12 +488,11 @@ namespace System.ServiceModel.Description
 				}
 			}
 
-			// FIXME: fill headers and properties.
 			return md;
 		}
 
 		public static MessageDescription CreateMessageDescription (
-			OperationContractAttribute oca, ParameterInfo[] plist, string name, string defaultNamespace, string action, bool isRequest, bool isCallback, Type retType, ICustomAttributeProvider retTypeAttributes)
+			OperationContractAttribute oca, ParameterInfo[] plist, string name, string defaultNamespace, string action, bool isRequest, bool isCallback, Type retType)
 		{
 			var dir = isRequest ^ isCallback ? MessageDirection.Input : MessageDirection.Output;
 			MessageDescription md = new MessageDescription (action, dir) { IsRequest = isRequest };
@@ -505,16 +525,6 @@ namespace System.ServiceModel.Description
 				mb.Parts.Add (pd);			
 			}
 
-			// ReturnValue
-			if (!isRequest) {
-				MessagePartDescription mp = CreatePartCore (GetMessageParameterAttribute (retTypeAttributes), name + "Result", mb.WrapperNamespace);
-				mp.Index = 0;
-				mp.Type = retType;
-				mb.ReturnValue = mp;
-			}
-
-			// FIXME: fill properties.
-
 			return md;
 		}
 
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/BaseMessagesFormatter.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/BaseMessagesFormatter.cs
index 28c4417..43b3260 100644
--- a/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/BaseMessagesFormatter.cs
+++ b/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/BaseMessagesFormatter.cs
@@ -306,8 +306,9 @@ namespace System.ServiceModel.Dispatcher
 			foreach (MessagePartDescription partDesc in l)
 				if (partDesc.MemberInfo is FieldInfo)
 					((FieldInfo) partDesc.MemberInfo).SetValue (msgObject, parts [partDesc.Index]);
-				else
+				else if (partDesc.MemberInfo is PropertyInfo)
 					((PropertyInfo) partDesc.MemberInfo).SetValue (msgObject, parts [partDesc.Index], null);
+				// otherwise, it could be null (in case of undefined return value in MessageContract)
 		}
 
 		void MessageObjectToParts (MessageDescription md, object msgObject, Dictionary<MessageHeaderDescription,object> headers, object [] parts)
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/ChangeLog b/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/ChangeLog
index 10c6b0e..dc00edc 100644
--- a/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/ChangeLog
+++ b/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/ChangeLog
@@ -1,3 +1,20 @@
+2011-09-07  Sebastien Pouliot  <sebastien at xamarin.com>
+
+	Add null-check on 'partDesc'. Fix bug #612 (WCF regression)
+
+2011-08-24  Atsushi Eno  <atsushi at ximian.com>
+
+	When there is void return, the common message formatter should
+	ignore it.
+
+	This case occurs when MessageContract is used and there is no
+	member for the return value.
+
+2011-08-24  Atsushi Eno  <atsushi at ximian.com>
+
+	This filter should ignore port, and should not filter out
+	anonymous URIs.
+
 2011-08-02  Nicolas GRAZIANO  <nicolas.graziano at ineo-gdfsuez.com>
 
 	TypedMessageConverter do not take into account the xml attribute
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/PrefixEndpointAddressMessageFilter.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/PrefixEndpointAddressMessageFilter.cs
index 719dff4..8832f24 100644
--- a/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/PrefixEndpointAddressMessageFilter.cs
+++ b/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/PrefixEndpointAddressMessageFilter.cs
@@ -68,8 +68,12 @@ namespace System.ServiceModel.Dispatcher
 		public override bool Match (Message message)
 		{
 			Uri to = message.Headers.To;
-			bool path = ((CultureInfo.InvariantCulture.CompareInfo.IsPrefix (to.AbsolutePath, address.Uri.AbsolutePath, CompareOptions.Ordinal)) && 
-					(to.Port == address.Uri.Port));
+			if (to == null)
+				return false;
+			if (to.ToString () == Constants.WsaAnonymousUri || to.Equals (EndpointAddress.AnonymousUri) || to.Equals (EndpointAddress.NoneUri))
+				return true;
+
+			bool path = CultureInfo.InvariantCulture.CompareInfo.IsPrefix (to.AbsolutePath, address.Uri.AbsolutePath, CompareOptions.Ordinal);
 			bool host = IncludeHostNameInComparison
 					? (String.CompareOrdinal (to.Host, address.Uri.Host) == 0)
 					: true;
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/XmlMessagesFormatter.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/XmlMessagesFormatter.cs
index 859daca..9c1df61 100644
--- a/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/XmlMessagesFormatter.cs
+++ b/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/XmlMessagesFormatter.cs
@@ -7,6 +7,7 @@
 //
 // Copyright (C) 2005-2010 Novell, Inc.  http://www.novell.com
 // Copyright (C) 2008 Mainsoft Co. http://www.mainsoft.com
+// Copyright (C) 2011 Xamarin Inc. http://www.xamarin.com
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
@@ -65,7 +66,7 @@ namespace System.ServiceModel.Dispatcher
 			m.IsReturnValue = isReturnValue;
 			m.MemberName = partDesc.Name;
 			m.MemberType = partDesc.Type;
-			m.XmlAttributes = new XmlAttributes(partDesc.MemberInfo);
+			m.XmlAttributes = partDesc.MemberInfo == null ? new XmlAttributes () : new XmlAttributes (partDesc.MemberInfo);
 			return m;
 		}
 
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel/BasicHttpBinding.cs b/mcs/class/System.ServiceModel/System.ServiceModel/BasicHttpBinding.cs
index d462b0f..977f60f 100644
--- a/mcs/class/System.ServiceModel/System.ServiceModel/BasicHttpBinding.cs
+++ b/mcs/class/System.ServiceModel/System.ServiceModel/BasicHttpBinding.cs
@@ -273,43 +273,26 @@ namespace System.ServiceModel
 			h.ExtendedProtectionPolicy = Security.Transport.ExtendedProtectionPolicy;
 #endif
 
-#if !NET_2_1
-			switch (Security.Mode) {
-			case BasicHttpSecurityMode.Transport:
-				switch (Security.Transport.ClientCredentialType) {
-				case HttpClientCredentialType.Basic:
-					h.AuthenticationScheme = AuthenticationSchemes.Basic;
-					break;
-				case HttpClientCredentialType.Ntlm:
-					h.AuthenticationScheme = AuthenticationSchemes.Ntlm;
-					break;
-				case HttpClientCredentialType.Windows:
-					h.AuthenticationScheme = AuthenticationSchemes.Negotiate;
-					break;
-				case HttpClientCredentialType.Digest:
-					h.AuthenticationScheme = AuthenticationSchemes.Digest;
-					break;
-				case HttpClientCredentialType.Certificate:
-					var https = (HttpsTransportBindingElement) h;
-					https.RequireClientCertificate = true;
-					break;
-				}
+#if !NET_2_1 || MOBILE
+			switch (Security.Transport.ClientCredentialType) {
+			case HttpClientCredentialType.Basic:
+				h.AuthenticationScheme = AuthenticationSchemes.Basic;
 				break;
-			case BasicHttpSecurityMode.TransportCredentialOnly:
-				switch (Security.Transport.ClientCredentialType) {
-				case HttpClientCredentialType.Basic:
-					h.AuthenticationScheme = AuthenticationSchemes.Basic;
-					break;
-				case HttpClientCredentialType.Ntlm:
-					h.AuthenticationScheme = AuthenticationSchemes.Ntlm;
-					break;
-				case HttpClientCredentialType.Windows:
-					h.AuthenticationScheme = AuthenticationSchemes.Negotiate;
-					break;
-				case HttpClientCredentialType.Digest:
-					h.AuthenticationScheme = AuthenticationSchemes.Digest;
+			case HttpClientCredentialType.Ntlm:
+				h.AuthenticationScheme = AuthenticationSchemes.Ntlm;
+				break;
+			case HttpClientCredentialType.Windows:
+				h.AuthenticationScheme = AuthenticationSchemes.Negotiate;
+				break;
+			case HttpClientCredentialType.Digest:
+				h.AuthenticationScheme = AuthenticationSchemes.Digest;
+				break;
+			case HttpClientCredentialType.Certificate:
+				switch (Security.Mode) {
+				case BasicHttpSecurityMode.Transport:
+					(h as HttpsTransportBindingElement).RequireClientCertificate = true;
 					break;
-				case HttpClientCredentialType.Certificate:
+				case BasicHttpSecurityMode.TransportCredentialOnly:
 					throw new InvalidOperationException ("Certificate-based client authentication is not supported by 'TransportCredentialOnly' mode.");
 				}
 				break;
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel/BasicHttpMessageSecurity.cs b/mcs/class/System.ServiceModel/System.ServiceModel/BasicHttpMessageSecurity.cs
index 66db062..db677d2 100644
--- a/mcs/class/System.ServiceModel/System.ServiceModel/BasicHttpMessageSecurity.cs
+++ b/mcs/class/System.ServiceModel/System.ServiceModel/BasicHttpMessageSecurity.cs
@@ -25,6 +25,9 @@
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
+
+#if !MOONLIGHT
+
 using System;
 using System.Net.Security;
 using System.ServiceModel.Security;
@@ -37,14 +40,16 @@ namespace System.ServiceModel
 		internal BasicHttpMessageSecurity ()
 		{
 		}
-
+		
+#if !MOBILE
 		SecurityAlgorithmSuite alg = SecurityAlgorithmSuite.Default;
-		BasicHttpMessageCredentialType ctype;
 
 		public SecurityAlgorithmSuite AlgorithmSuite {
 			get { return alg; }
 			set { alg = value; }
 		}
+#endif
+		BasicHttpMessageCredentialType ctype;
 
 		public BasicHttpMessageCredentialType ClientCredentialType {
 			get { return ctype; }
@@ -52,3 +57,5 @@ namespace System.ServiceModel
 		}
 	}
 }
+
+#endif
\ No newline at end of file
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel/BasicHttpSecurity_2_1.cs b/mcs/class/System.ServiceModel/System.ServiceModel/BasicHttpSecurity_2_1.cs
deleted file mode 100644
index 558b840..0000000
--- a/mcs/class/System.ServiceModel/System.ServiceModel/BasicHttpSecurity_2_1.cs
+++ /dev/null
@@ -1,48 +0,0 @@
-//
-// BasicHttpSecurity_2_1.cs
-//
-// Author:
-//	Atsushi Enomoto <atsushi at ximian.com>
-//
-// Copyright (C) 2008 Novell, Inc.  http://www.novell.com
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-// 
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-// 
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-using System;
-using System.Net.Security;
-using System.ServiceModel.Channels;
-
-namespace System.ServiceModel
-{
-	public sealed class BasicHttpSecurity
-	{
-		internal BasicHttpSecurity (BasicHttpSecurityMode mode)
-		{
-			this.mode = mode;
-		}
-
-		BasicHttpSecurityMode mode;
-
-		public BasicHttpSecurityMode Mode {
-			get { return mode; }
-			set { mode = value; }
-		}
-	}
-}
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel/ChangeLog b/mcs/class/System.ServiceModel/System.ServiceModel/ChangeLog
index 79cd13b..ba79e9b 100644
--- a/mcs/class/System.ServiceModel/System.ServiceModel/ChangeLog
+++ b/mcs/class/System.ServiceModel/System.ServiceModel/ChangeLog
@@ -1,3 +1,44 @@
+2011-11-09  Miguel de Icaza  <miguel at gnome.org>
+
+	Add locking around the ServiceModel.Logger, fixes a race reported
+	on the mono-devel list
+
+2011-10-16  Miguel de Icaza  <miguel at gnome.org>
+
+	Apply patch from Mario Kosmiskaso fix bug 1210: Correctly
+	propagate the Operation Context on async calls
+
+	The OperationContext is a [ThreadStatic] variable therefore when a
+	REST call is made asynchronously the worker thread will not see a
+	context set and will not expose any data through the context.
+
+	A possible solution (which I implemented in the attached patch) is
+	for ClientRealProxy to set the context in the channel prior to
+	executing the call (either sync or async). The
+	ClientRuntimeChannel needs to then properly set and reset the
+	context in the worker thread.
+
+	Because WCF operations marked [OperationContract(AsyncPattern =
+	true)] using IAsyncResult only generate an outgoing call on
+	End<OperationName> the ClientRuntimeChannel.EndProcess must not
+	reset the context as it's currently doing. The context can only be
+	reset after calling EndInvoke because the request will be only
+	generated at this point.
+
+2011-10-05  Rolf Bjarne Kvinge  <rolf at xamarin.com>
+
+	[System.ServiceModel] Write EndPointAddress properly in the 2.1
+	profile. Fixes #1244
+
+2011-08-29  Sebastien Pouliot  <sebastien at xamarin.com>
+
+	Fix bug #380. Patch from bnc#605795 were not committed to master
+	but part of MonoTouch 3.x (ended up missing in MT4)
+
+2011-08-24  Atsushi Eno  <atsushi at ximian.com>
+
+	Do not try to output empty message body to logs.
+
 2011-08-03  Atsushi Eno  <atsushieno at veritas-vos-liberabit.com>
 
 	Fix NET_2_1 builds (regression from the previous
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel/ClientRealProxy.cs b/mcs/class/System.ServiceModel/System.ServiceModel/ClientRealProxy.cs
index 34bc11e..94bda4b 100644
--- a/mcs/class/System.ServiceModel/System.ServiceModel/ClientRealProxy.cs
+++ b/mcs/class/System.ServiceModel/System.ServiceModel/ClientRealProxy.cs
@@ -103,6 +103,7 @@ namespace System.ServiceModel
 					// sync invocation
 					pl = new object [inmsg.MethodBase.GetParameters ().Length];
 					Array.Copy (inmsg.Args, pl, inmsg.ArgCount);
+					channel.Context = OperationContext.Current;
 					ret = channel.Process (inmsg.MethodBase, od.Name, pl);
 					method = od.SyncMethod;
 				} else if (inmsg.MethodBase.Equals (od.BeginMethod)) {
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel/ClientRuntimeChannel.cs b/mcs/class/System.ServiceModel/System.ServiceModel/ClientRuntimeChannel.cs
index 4a30904..ea8299a 100644
--- a/mcs/class/System.ServiceModel/System.ServiceModel/ClientRuntimeChannel.cs
+++ b/mcs/class/System.ServiceModel/System.ServiceModel/ClientRuntimeChannel.cs
@@ -46,6 +46,8 @@ namespace System.ServiceModel.MonoInternal
 	{
 		ContractDescription Contract { get; }
 
+		OperationContext Context { set; }
+
 		object Process (MethodBase method, string operationName, object [] parameters);
 
 		IAsyncResult BeginProcess (MethodBase method, string operationName, object [] parameters, AsyncCallback callback, object asyncState);
@@ -147,6 +149,10 @@ namespace System.ServiceModel.MonoInternal
 			get { return channel as IDuplexChannel; }
 		}
 
+		public OperationContext Context {
+			set { context = value; }
+		}
+
 		#region IClientChannel
 
 		bool did_interactive_initialization;
@@ -450,19 +456,26 @@ namespace System.ServiceModel.MonoInternal
 
 		public object EndProcess (MethodBase method, string operationName, object [] parameters, IAsyncResult result)
 		{
-			context = null;
+				
 			if (result == null)
 				throw new ArgumentNullException ("result");
 			if (parameters == null)
 				throw new ArgumentNullException ("parameters");
 			// FIXME: the method arguments should be verified to be 
 			// identical to the arguments in the corresponding begin method.
-			return _processDelegate.EndInvoke (result);
+			object asyncResult = _processDelegate.EndInvoke (result);
+			context = null;
+			return asyncResult;
 		}
 
 		public object Process (MethodBase method, string operationName, object [] parameters)
 		{
+			var previousContext = OperationContext.Current;
 			try {
+				// Inherit the context from the calling thread
+				if (this.context != null) 
+					OperationContext.Current = this.context;
+
 				return DoProcess (method, operationName, parameters);
 			} catch (Exception ex) {
 #if MOONLIGHT // just for debugging
@@ -470,6 +483,9 @@ namespace System.ServiceModel.MonoInternal
 				Console.WriteLine (ex);
 #endif
 				throw;
+			} finally {
+				// Reset the context before the thread goes back into the pool
+				OperationContext.Current = previousContext;
 			}
 		}
 
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel/EndpointAddress.cs b/mcs/class/System.ServiceModel/System.ServiceModel/EndpointAddress.cs
index 5acfbdf..7c09860 100644
--- a/mcs/class/System.ServiceModel/System.ServiceModel/EndpointAddress.cs
+++ b/mcs/class/System.ServiceModel/System.ServiceModel/EndpointAddress.cs
@@ -339,7 +339,13 @@ namespace System.ServiceModel
 			if (writer == null)
 				throw new ArgumentNullException ("writer");
 #if NET_2_1
-			writer.WriteString (Uri.AbsoluteUri);
+			if (addressingVersion == AddressingVersion.None) {
+				writer.WriteString (Uri.AbsoluteUri);
+			} else {
+				writer.WriteStartElement ("Address", addressingVersion.Namespace);
+				writer.WriteString (Uri.AbsoluteUri);
+				writer.WriteEndElement ();
+			}
 #else
 			if (addressingVersion == AddressingVersion.None)
 				writer.WriteString (Uri.AbsoluteUri);
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel/Logger.cs b/mcs/class/System.ServiceModel/System.ServiceModel/Logger.cs
index 29b4c61..f98136d 100644
--- a/mcs/class/System.ServiceModel/System.ServiceModel/Logger.cs
+++ b/mcs/class/System.ServiceModel/System.ServiceModel/Logger.cs
@@ -139,18 +139,20 @@ namespace System.ServiceModel
 
 		static void Log (TraceEventType eventType, string message, params object [] args)
 		{
-			event_id++;
+			lock (log_writer){
+				event_id++;
 #if NET_2_1
-			log_writer.Write ("[{0}] ", event_id);
+				log_writer.Write ("[{0}] ", event_id);
 #endif
-			TraceCore (TraceEventType.Information, event_id,
-				false, Guid.Empty, // FIXME
-				message, args);
-			log_writer.WriteLine (message, args);
-			log_writer.Flush ();
+				TraceCore (TraceEventType.Information, event_id,
+					false, Guid.Empty, // FIXME
+					message, args);
+				log_writer.WriteLine (message, args);
+				log_writer.Flush ();
 #if !NET_2_1
-			source.TraceEvent (eventType, event_id, message, args);
+				source.TraceEvent (eventType, event_id, message, args);
 #endif
+			}
 		}
 		
 		#endregion
@@ -183,23 +185,25 @@ namespace System.ServiceModel
 			xw.WriteEndAttribute ();
 			xw.WriteAttributeString ("Source", log.Source.ToString ());
 			xw.WriteAttributeString ("Type", log.Type.FullName);
-			log.Message.CreateMessage ().WriteMessage (xw);
+			var msg = log.Message.CreateMessage ();
+			if (!msg.IsEmpty)
+				msg.WriteMessage (xw);
 			xw.WriteEndElement ();
 			xw.Close ();
 
 			event_id++;
-
+			lock (log_writer){
 #if NET_2_1
-			log_writer.Write ("[{0}] ", event_id);
+				log_writer.Write ("[{0}] ", event_id);
 
-			TraceCore (TraceEventType.Information, event_id, /*FIXME*/false, /*FIXME*/Guid.Empty, sw);
+				TraceCore (TraceEventType.Information, event_id, /*FIXME*/false, /*FIXME*/Guid.Empty, sw);
 #else
-			TraceCore (TraceEventType.Information, event_id, /*FIXME*/false, /*FIXME*/Guid.Empty, doc.CreateNavigator ());
+				TraceCore (TraceEventType.Information, event_id, /*FIXME*/false, /*FIXME*/Guid.Empty, doc.CreateNavigator ());
 
-			message_source.TraceData (TraceEventType.Information, event_id, doc.CreateNavigator ());
+				message_source.TraceData (TraceEventType.Information, event_id, doc.CreateNavigator ());
 #endif
-
-			log_writer.Flush ();
+				log_writer.Flush ();
+			}
 		}
 
 		#endregion
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel/ServiceRuntimeChannel.cs b/mcs/class/System.ServiceModel/System.ServiceModel/ServiceRuntimeChannel.cs
index 745dab3..0fe0d47 100644
--- a/mcs/class/System.ServiceModel/System.ServiceModel/ServiceRuntimeChannel.cs
+++ b/mcs/class/System.ServiceModel/System.ServiceModel/ServiceRuntimeChannel.cs
@@ -79,6 +79,10 @@ namespace System.ServiceModel.MonoInternal
 			get { return contract; }
 		}
 
+		public OperationContext Context {
+			set {  }
+		}
+
 		Action<TimeSpan> session_shutdown_delegate;
 
 		public void CloseOutputSession (TimeSpan timeout)
diff --git a/mcs/class/System.ServiceModel/Test/System.ServiceModel.Description/ChangeLog b/mcs/class/System.ServiceModel/Test/System.ServiceModel.Description/ChangeLog
index f43aa87..afefd3a 100644
--- a/mcs/class/System.ServiceModel/Test/System.ServiceModel.Description/ChangeLog
+++ b/mcs/class/System.ServiceModel/Test/System.ServiceModel.Description/ChangeLog
@@ -1,3 +1,8 @@
+2011-08-24  Atsushi Eno  <atsushi at ximian.com>
+
+	ReturnValue in MessageDescription was missing when there was
+	MessageContract.
+
 2011-08-02  Nicolas GRAZIANO  <nicolas.graziano at ineo-gdfsuez.com>
 
 	TypedMessageConverter do not take into account the xml attribute
diff --git a/mcs/class/System.ServiceModel/Test/System.ServiceModel.Description/ContractDescriptionTest.cs b/mcs/class/System.ServiceModel/Test/System.ServiceModel.Description/ContractDescriptionTest.cs
index f35568a..e43c837 100644
--- a/mcs/class/System.ServiceModel/Test/System.ServiceModel.Description/ContractDescriptionTest.cs
+++ b/mcs/class/System.ServiceModel/Test/System.ServiceModel.Description/ContractDescriptionTest.cs
@@ -5,6 +5,7 @@
 //	Atsushi Enomoto <atsushi at ximian.com>
 //
 // Copyright (C) 2005 Novell, Inc.  http://www.novell.com
+// Copyright (C) 2011 Xamarin, Inc. http://xamarin.com
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
@@ -555,6 +556,24 @@ namespace MonoTests.System.ServiceModel.Description
 						Assert.IsNotNull (md.Body.ReturnValue, od.Name);
 		}
 
+		[Test]
+		public void BugX206Contract ()
+		{
+			var cd = ContractDescription.GetContract (typeof (BugX206Service));
+			bool examined = false;
+			foreach (var md in cd.Operations.First ().Messages) {
+				if (md.Direction == MessageDirection.Input)
+					continue;
+				var pd = md.Body.ReturnValue;
+				Assert.IsNotNull (pd, "#1");
+				Assert.AreEqual ("DoWorkResult", pd.Name, "#2");
+				Assert.IsNull (pd.MemberInfo, "#3");
+				Assert.AreEqual (typeof (void), pd.Type, "#4");
+				examined = true;
+			}
+			Assert.IsTrue (examined, "end");
+		}
+
 		// It is for testing attribute search in interfaces.
 		public class Foo : IFoo
 		{
@@ -916,5 +935,18 @@ namespace MonoTests.System.ServiceModel.Description
 			[XmlSerializerFormat]
 			string Echo (string input);
 		}
+
+		[ServiceContract]
+		public interface BugX206Service
+		{
+			[OperationContract]
+			BugX206Response DoWork ();
+		}
+
+		[MessageContract (IsWrapped = true)]
+		public partial class BugX206Response
+		{
+		}
+
 	}
 }
diff --git a/mcs/class/System.ServiceModel/Test/System.ServiceModel.Dispatcher/ChangeLog b/mcs/class/System.ServiceModel/Test/System.ServiceModel.Dispatcher/ChangeLog
index b0eccf5..ed10654 100644
--- a/mcs/class/System.ServiceModel/Test/System.ServiceModel.Dispatcher/ChangeLog
+++ b/mcs/class/System.ServiceModel/Test/System.ServiceModel.Dispatcher/ChangeLog
@@ -1,3 +1,8 @@
+2011-08-24  Atsushi Eno  <atsushi at ximian.com>
+
+	This filter should ignore port, and should not filter out
+	anonymous URIs.
+
 2011-02-25  Atsushi Eno  <atsushi at ximian.com>
 
 	Fix 2.0 test build (disable it).
diff --git a/mcs/class/System.ServiceModel/Test/System.ServiceModel.Dispatcher/PrefixEndpointAddressMessageFilterTest.cs b/mcs/class/System.ServiceModel/Test/System.ServiceModel.Dispatcher/PrefixEndpointAddressMessageFilterTest.cs
index f531500..1788451 100644
--- a/mcs/class/System.ServiceModel/Test/System.ServiceModel.Dispatcher/PrefixEndpointAddressMessageFilterTest.cs
+++ b/mcs/class/System.ServiceModel/Test/System.ServiceModel.Dispatcher/PrefixEndpointAddressMessageFilterTest.cs
@@ -54,7 +54,6 @@ namespace MonoTests.System.ServiceModel.Dispatcher
 		}
 
 		[Test]
-		[Category ("NotWorking")]
 		public void Match ()
 		{
 			PrefixEndpointAddressMessageFilter f =
diff --git a/mcs/class/System.ServiceModel/moonlight_raw_System.ServiceModel.dll.sources b/mcs/class/System.ServiceModel/moonlight_raw_System.ServiceModel.dll.sources
index 9ca8cd0..00bce15 100755
--- a/mcs/class/System.ServiceModel/moonlight_raw_System.ServiceModel.dll.sources
+++ b/mcs/class/System.ServiceModel/moonlight_raw_System.ServiceModel.dll.sources
@@ -173,7 +173,8 @@ System.ServiceModel.Security/UserNamePasswordClientCredential.cs
 System.ServiceModel/ActionNotSupportedException.cs
 System.ServiceModel/AllEnums.cs
 System.ServiceModel/BasicHttpBinding.cs
-System.ServiceModel/BasicHttpSecurity_2_1.cs
+System.ServiceModel/BasicHttpSecurity.cs
+System.ServiceModel/BasicHttpMessageSecurity.cs
 System.ServiceModel/ChannelFactory.cs
 System.ServiceModel/ChannelFactory_1.cs
 System.ServiceModel/ClientBase.cs
@@ -200,6 +201,7 @@ System.ServiceModel/FaultException.cs
 System.ServiceModel/FaultException_1.cs
 System.ServiceModel/FaultReason.cs
 System.ServiceModel/FaultReasonText.cs
+System.ServiceModel/HttpTransportSecurity.cs
 System.ServiceModel/IClientChannel.cs
 System.ServiceModel/ICommunicationObject.cs
 System.ServiceModel/IContextChannel.cs
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/ChangeLog b/mcs/class/System.Web.Services/System.Web.Services.Protocols/ChangeLog
index 6278561..22477ec 100644
--- a/mcs/class/System.Web.Services/System.Web.Services.Protocols/ChangeLog
+++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/ChangeLog
@@ -1,3 +1,8 @@
+2011-12-13  Rolf Bjarne Kvinge  <rolf at xamarin.com>
+
+	[System.Web.Services] Make sure we don't keep results forever when
+	doing async requests. Fixes #2473.
+
 2010-09-08  Jb Evain  <jbevain at gmail.com>
 
 	Enable the System.Web.Services build for monodroid
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapHttpClientProtocol.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapHttpClientProtocol.cs
index 61d54ca..cc5b01e 100644
--- a/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapHttpClientProtocol.cs
+++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapHttpClientProtocol.cs
@@ -409,6 +409,7 @@ namespace System.Web.Services.Protocols
 			InvokeAsyncInfo info = (InvokeAsyncInfo) ar.AsyncState;
 			SoapWebClientAsyncResult sar = (SoapWebClientAsyncResult) ar;
 			InvokeCompletedEventArgs args = new InvokeCompletedEventArgs (sar.Exception, false, info.UserState, (object[]) sar.Result);
+			UnregisterMapping (ar.AsyncState);
 			if (info.Context != null)
 				info.Context.Send (info.Callback, args);
 			else
diff --git a/mcs/class/System.Web/System.Web.Compilation/ChangeLog b/mcs/class/System.Web/System.Web.Compilation/ChangeLog
index f104d22..e902a02 100644
--- a/mcs/class/System.Web/System.Web.Compilation/ChangeLog
+++ b/mcs/class/System.Web/System.Web.Compilation/ChangeLog
@@ -1,3 +1,12 @@
+2011-09-13  Gonzalo Paniagua Javier  <gonzalo.mono at gmail.com>
+
+	Stop lying in the comments
+
+2011-09-13  Gonzalo Paniagua Javier  <gonzalo.mono at gmail.com>
+
+	Report compilation errors when the type named in 'class' can't be
+	loaded.
+
 2011-06-13  Marek Habersack  <grendel at twistedcode.net>
 
 	[asp.net] Construct properly rooted paths when assigning values
diff --git a/mcs/class/System.Web/System.Web.Compilation/GenericBuildProvider.cs b/mcs/class/System.Web/System.Web.Compilation/GenericBuildProvider.cs
index a13a768..f9692a8 100644
--- a/mcs/class/System.Web/System.Web.Compilation/GenericBuildProvider.cs
+++ b/mcs/class/System.Web/System.Web.Compilation/GenericBuildProvider.cs
@@ -146,13 +146,15 @@ namespace System.Web.Compilation
 			if (NeedsLoadFromBin && _compiler != null)
 				return LoadTypeFromBin (_compiler, Parser);
 			
-			// This is not called if compilation failed.
-			// Returning null makes the caller throw an InvalidCastException
+			Type type = null;
 			Assembly assembly = results != null ? results.CompiledAssembly : null;
-			if (assembly == null)
-				return null;
-			
-			return assembly.GetType (GetClassType (_compiler, Parser));
+			if (assembly != null) {
+				type = assembly.GetType (GetClassType (_compiler, Parser));
+			}
+			if (type == null) {
+				throw new HttpException (500, String.Format ("Type {0} could not be loaded", GetClassType (_compiler, Parser)));
+			}
+			return type;
 		}
 
 		// This is intended to be used by builders which may need to do special processing
diff --git a/mcs/class/System.Web/System.Web.Handlers/AssemblyResourceLoader.cs b/mcs/class/System.Web/System.Web.Handlers/AssemblyResourceLoader.cs
index ab5cfcb..a09d22f 100644
--- a/mcs/class/System.Web/System.Web.Handlers/AssemblyResourceLoader.cs
+++ b/mcs/class/System.Web/System.Web.Handlers/AssemblyResourceLoader.cs
@@ -324,7 +324,7 @@ namespace System.Web.Handlers
 					atime = QueryParamSeparator + "t=" + DateTime.UtcNow.Ticks;
 			}
 #endif
-			string d = assemblyNameHash + "_" + resourceNameHash +  (debug ? "_t" : "_f");
+			string d = HttpUtility.UrlEncode (assemblyNameHash + "_" + resourceNameHash +  (debug ? "_t" : "_f"));
 			string href = HandlerFileName + "?d=" + d + atime + extra;
 			HttpContext ctx = HttpContext.Current;
 			HttpRequest req = ctx != null ? ctx.Request : null;
diff --git a/mcs/class/System.Web/System.Web.Handlers/ChangeLog b/mcs/class/System.Web/System.Web.Handlers/ChangeLog
index f18fd37..48b1c92 100644
--- a/mcs/class/System.Web/System.Web.Handlers/ChangeLog
+++ b/mcs/class/System.Web/System.Web.Handlers/ChangeLog
@@ -1,3 +1,10 @@
+2011-10-16  Gonzalo Paniagua Javier  <gonzalo.mono at gmail.com>
+
+	Don't 404 when any of the hashes has a / in it
+
+	This fixes "random" problems getting resources served by
+	WebResource.axd.
+
 2011-04-21  Marek Habersack  <grendel at twistedcode.net>
 
 	[asp.net] Implemented composite scripts support in
diff --git a/mcs/class/System.Web/System.Web.SessionState_2.0/ChangeLog b/mcs/class/System.Web/System.Web.SessionState_2.0/ChangeLog
index 12fcb2b..aeada23 100644
--- a/mcs/class/System.Web/System.Web.SessionState_2.0/ChangeLog
+++ b/mcs/class/System.Web/System.Web.SessionState_2.0/ChangeLog
@@ -1,3 +1,7 @@
+2011-11-05  Robert Jordan  <robertj at gmx.net>
+
+	[Web] Fix obvious typo in DELETE FROM WHERE statement.
+
 2011-05-24  Marek Habersack  <grendel at twistedcode.net>
 
 	[asp.net] Don't throw an exception if a session item being
diff --git a/mcs/class/System.Web/System.Web.SessionState_2.0/SessionSQLServerHandler.cs b/mcs/class/System.Web/System.Web.SessionState_2.0/SessionSQLServerHandler.cs
index a18cc9a..58b23fa 100644
--- a/mcs/class/System.Web/System.Web.SessionState_2.0/SessionSQLServerHandler.cs
+++ b/mcs/class/System.Web/System.Web.SessionState_2.0/SessionSQLServerHandler.cs
@@ -448,7 +448,7 @@ namespace System.Web.SessionState
 			DbProviderFactory factory = ProviderFactory;
 			DbConnection conn = CreateConnection (factory);
 			DbCommand cmd = CreateCommand (factory, conn,
-						       "DELETE * FROM Sessions WHERE SessionId = @SessionId AND ApplicationName = @ApplicationName AND LockId = @LockId");
+						       "DELETE FROM Sessions WHERE SessionId = @SessionId AND ApplicationName = @ApplicationName AND LockId = @LockId");
 
 			DbParameterCollection parameters = cmd.Parameters;
 			parameters.Add (CreateParameter <string> (factory, "@SessionId", id, 80));
diff --git a/mcs/class/System.Web/System.Web/ChangeLog b/mcs/class/System.Web/System.Web/ChangeLog
index 0e34106..aef9707 100644
--- a/mcs/class/System.Web/System.Web/ChangeLog
+++ b/mcs/class/System.Web/System.Web/ChangeLog
@@ -1,3 +1,20 @@
+2011-09-30  Gonzalo Paniagua Javier  <gonzalo.mono at gmail.com>
+
+	Plug an unmanaged memory leak
+
+	If Flush() was called with final_flush set to true, we were
+	leaking the unmanaged memory in the output stream (if allocated).
+
+	It was "only" an AS leak.
+
+	Thanks to Kumpera for the help debugging this.
+
+2011-09-21  Gonzalo Paniagua Javier  <gonzalo.mono at gmail.com>
+
+	Return the right empty collection in ParseQueryString.
+
+	Fixes Xamarin bug #970.
+
 2011-04-21  Marek Habersack  <grendel at twistedcode.net>
 
 	[asp.net] Inform user about all exceptions thrown during
diff --git a/mcs/class/System.Web/System.Web/HttpResponse.cs b/mcs/class/System.Web/System.Web/HttpResponse.cs
index 2e633d9..6a310ec 100644
--- a/mcs/class/System.Web/System.Web/HttpResponse.cs
+++ b/mcs/class/System.Web/System.Web/HttpResponse.cs
@@ -1365,10 +1365,11 @@ namespace System.Web
 
 		internal void ReleaseResources ()
 		{
+			if (output_stream != null)
+				output_stream.ReleaseResources (true);
 			if (completed)
 				return;
 			
-			output_stream.ReleaseResources (true);
 			Close ();
 			completed = true;
 		}
diff --git a/mcs/class/System.Web/System.Web/HttpUtility.cs b/mcs/class/System.Web/System.Web/HttpUtility.cs
index e79883d..e05ae97 100644
--- a/mcs/class/System.Web/System.Web/HttpUtility.cs
+++ b/mcs/class/System.Web/System.Web/HttpUtility.cs
@@ -654,7 +654,7 @@ namespace System.Web {
 			if (encoding == null)
 				throw new ArgumentNullException ("encoding");
 			if (query.Length == 0 || (query.Length == 1 && query[0] == '?'))
-				return new NameValueCollection ();
+				return new HttpQSCollection ();
 			if (query[0] == '?')
 				query = query.Substring (1);
 				
diff --git a/mcs/class/System.XML/ChangeLog b/mcs/class/System.XML/ChangeLog
index 0500107..d38619b 100644
--- a/mcs/class/System.XML/ChangeLog
+++ b/mcs/class/System.XML/ChangeLog
@@ -1,3 +1,8 @@
+2011-08-30  Chris Toshok  <toshok at gmail.com>
+
+	prepend $(CURDIR) to jay input files so that the debugging info
+	references the right .jay
+
 2010-12-16  Marek Safar  <marek.safar at gmail.com>
 
 	Switch to single mcs compiler for all managed code build
diff --git a/mcs/class/System.XML/Makefile b/mcs/class/System.XML/Makefile
index 418e94f..e30541c 100644
--- a/mcs/class/System.XML/Makefile
+++ b/mcs/class/System.XML/Makefile
@@ -77,14 +77,14 @@ EXTRA_DISTFILES = \
 	$(nist_dom_files:%=Test/System.Xml/nist_dom/%)
 
 System.Xml.XPath/Parser.cs: System.Xml.XPath/Parser.jay $(topdir)/jay/skeleton.cs
-	$(topdir)/jay/jay -ct < $(topdir)/jay/skeleton.cs $< >$@
+	$(topdir)/jay/jay -ct < $(topdir)/jay/skeleton.cs $(CURDIR)/$< >$@
 
 Mono.Xml.Xsl/PatternParser.jay: System.Xml.XPath/Parser.jay $(topdir)/jay/skeleton.cs
 	sed "s/\%start Expr/\%start Pattern/" $< >$@
 
 Mono.Xml.Xsl/PatternParser.cs: Mono.Xml.Xsl/PatternParser.jay $(topdir)/jay/skeleton.cs
 	echo "#define XSLT_PATTERN" > $@
-	$(topdir)/jay/jay -ct $< < $(topdir)/jay/skeleton.cs >>$@
+	$(topdir)/jay/jay -ct $(CURDIR)/$< < $(topdir)/jay/skeleton.cs >>$@
 
 Mono.Xml.Xsl/PatternTokenizer.cs: System.Xml.XPath/Tokenizer.cs
 	echo "#define XSLT_PATTERN" > $@
diff --git a/mcs/class/System.XML/Mono.Xml.XPath/ChangeLog b/mcs/class/System.XML/Mono.Xml.XPath/ChangeLog
index 0f5192a..8277a1e 100644
--- a/mcs/class/System.XML/Mono.Xml.XPath/ChangeLog
+++ b/mcs/class/System.XML/Mono.Xml.XPath/ChangeLog
@@ -1,3 +1,7 @@
+2011-08-30  Atsushi Eno  <atsushieno at veritas-vos-liberabit.com>
+
+	LineInfo on namespace nodes were missing.
+
 2010-07-06  Atsushi Enomoto <atsushi at ximian.com>
 
 	* DTMXPathDocumentWriter2.cs : implement some writer methods.
diff --git a/mcs/class/System.XML/Mono.Xml.XPath/ChangeLog b/mcs/class/System.XML/Mono.Xml.XPath/ChangeLog.old
similarity index 100%
copy from mcs/class/System.XML/Mono.Xml.XPath/ChangeLog
copy to mcs/class/System.XML/Mono.Xml.XPath/ChangeLog.old
diff --git a/mcs/class/System.XML/Mono.Xml.XPath/DTMXPathDocumentBuilder2.cs b/mcs/class/System.XML/Mono.Xml.XPath/DTMXPathDocumentBuilder2.cs
index aacd990..b2c5b3d 100644
--- a/mcs/class/System.XML/Mono.Xml.XPath/DTMXPathDocumentBuilder2.cs
+++ b/mcs/class/System.XML/Mono.Xml.XPath/DTMXPathDocumentBuilder2.cs
@@ -578,6 +578,10 @@ namespace Mono.Xml.XPath
 			namespaces [nsIndex].Name = name;
 			namespaces [nsIndex].Namespace = ns;
 			namespaces [nsIndex].NextNamespace = nextNs;
+			if (lineInfo != null && lineInfo.HasLineInfo ()) {
+				namespaces [nsIndex].LineNumber = lineInfo.LineNumber;
+				namespaces [nsIndex].LinePosition = lineInfo.LinePosition;
+			}
 		}
 	}
 }
diff --git a/mcs/class/System.XML/Mono.Xml.XPath/DTMXPathNavigator2.cs b/mcs/class/System.XML/Mono.Xml.XPath/DTMXPathNavigator2.cs
index c10f321..3afdbb1 100644
--- a/mcs/class/System.XML/Mono.Xml.XPath/DTMXPathNavigator2.cs
+++ b/mcs/class/System.XML/Mono.Xml.XPath/DTMXPathNavigator2.cs
@@ -118,14 +118,16 @@ namespace Mono.Xml.XPath
 		int IXmlLineInfo.LineNumber {
 			get {
 				return currentIsAttr ? attributes [currentAttr].LineNumber :
-					nodes [currentNode].LineNumber;
+					currentIsNode ? nodes [currentNode].LineNumber :
+					namespaces [currentNs].LineNumber;
 			}
 		}
 
 		int IXmlLineInfo.LinePosition {
 			get {
 				return currentIsAttr ? attributes [currentAttr].LinePosition :
-					nodes [currentNode].LinePosition;
+					currentIsNode ? nodes [currentNode].LinePosition :
+					namespaces [currentNs].LinePosition;
 			}
 		}
 
diff --git a/mcs/class/System.XML/Mono.Xml.XPath/DTMXPathNode2.cs b/mcs/class/System.XML/Mono.Xml.XPath/DTMXPathNode2.cs
index b094972..9022b18 100644
--- a/mcs/class/System.XML/Mono.Xml.XPath/DTMXPathNode2.cs
+++ b/mcs/class/System.XML/Mono.Xml.XPath/DTMXPathNode2.cs
@@ -100,5 +100,7 @@ namespace Mono.Xml.XPath
 		public int NextNamespace;
 		public int Name;
 		public int Namespace;
+		public int LineNumber;
+		public int LinePosition;
 	}
 }
diff --git a/mcs/class/System.XML/System.Xml.Serialization/ChangeLog b/mcs/class/System.XML/System.Xml.Serialization/ChangeLog
index f7839cb..ef50e9b 100644
--- a/mcs/class/System.XML/System.Xml.Serialization/ChangeLog
+++ b/mcs/class/System.XML/System.Xml.Serialization/ChangeLog
@@ -1,3 +1,16 @@
+2011-10-25  Lluis Sanchez  <lluis at xamarin.com>
+
+	[System.Xml] Fix handling of XmlSchemaForm when importing elements
+
+	When the schema for is not explicitly set for an element, get the
+	default form specified in the schema, and use 'unqualified' if
+	there is no other default. This fixes bug #41.
+
+2011-10-17  Miguel de Icaza  <miguel at gnome.org>
+
+	Fix for 1461: Microsoft's generated deserializer call
+	CollapseWhitespace extensively
+
 2011-08-03  Atsushi Eno  <atsushieno at gmail.com>
 
 	Merge pull request #146 from
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlSchemaImporter.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlSchemaImporter.cs
index f6e26f8..ec37b2f 100644
--- a/mcs/class/System.XML/System.Xml.Serialization/XmlSchemaImporter.cs
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlSchemaImporter.cs
@@ -1581,12 +1581,30 @@ namespace System.Xml.Serialization
 			einfo.ElementName = name;
 			einfo.Namespace = ns;
 			einfo.IsNullable = isNillable;
-			einfo.Form = form;
+			einfo.Form = GetForm (form, ns, true);
 			if (typeData.IsComplexType)
 				einfo.MappedType = emap;
 			einfo.ExplicitOrder = order;
 			return einfo;
 		}
+		
+		XmlSchemaForm GetForm (XmlSchemaForm form, string ns, bool forElement)
+		{
+			// Returns the schema form for an element or attribute, taking
+			// into account the schema defaults. If the form has not been explicitly
+			// set and there is no default, use Unqualified as default.
+			
+			if (form != XmlSchemaForm.None)
+				return form;
+			XmlSchema s = schemas [ns];
+			if (s == null)
+				return XmlSchemaForm.Unqualified;
+			XmlSchemaForm schemaForm = forElement ? s.ElementFormDefault : s.AttributeFormDefault;
+			if (schemaForm != XmlSchemaForm.None)
+				return schemaForm;
+			else
+				return XmlSchemaForm.Unqualified;
+		}
 
 		XmlTypeMapElementInfo CreateTextElementInfo (string ns, XmlTypeMapMember member, TypeData typeData)
 		{
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReader.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReader.cs
index 059d962..bc19123 100644
--- a/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReader.cs
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReader.cs
@@ -1155,10 +1155,9 @@ namespace System.Xml.Serialization
 			set { throw new NotImplementedException(); }
 		}
 
-		[MonoTODO]
 		protected string CollapseWhitespace (string value)
 		{
-			throw new NotImplementedException ();
+			return value == null ? null : value.Trim ();
 		}
 				
 		[MonoTODO]
diff --git a/mcs/class/System.XML/System.Xml/ChangeLog b/mcs/class/System.XML/System.Xml/ChangeLog
index cc97f81..dc4a12e 100644
--- a/mcs/class/System.XML/System.Xml/ChangeLog
+++ b/mcs/class/System.XML/System.Xml/ChangeLog
@@ -1,3 +1,12 @@
+2011-09-13  Gonzalo Paniagua Javier  <gonzalo.mono at gmail.com>
+
+	Delay initialization of the stream until first read
+
+	This way uri-based resources are not fetched before they are
+	supposed to.
+
+	Fixes Xamarin bug #762.
+
 2011-05-19  Atsushi Eno  <atsushi at ximian.com>
 
 	Allow DocumentType in ImportNode().
diff --git a/mcs/class/System.XML/System.Xml/XmlTextReader.cs b/mcs/class/System.XML/System.Xml/XmlTextReader.cs
index d244974..ae54a23 100644
--- a/mcs/class/System.XML/System.Xml/XmlTextReader.cs
+++ b/mcs/class/System.XML/System.Xml/XmlTextReader.cs
@@ -111,13 +111,13 @@ namespace System.Xml
 
 		public XmlTextReader (string url, XmlNameTable nt)
 		{
-			string uriString;
-			Stream stream = GetStreamFromUrl (url, out uriString);
+			reader_uri = resolver.ResolveUri (null, url);
+			string uriString = (reader_uri == null) ? String.Empty : reader_uri.ToString ();
 			XmlParserContext ctx = new XmlParserContext (nt,
 				new XmlNamespaceManager (nt),
 				String.Empty,
 				XmlSpace.None);
-			this.InitializeContext (uriString, ctx, new XmlStreamReader (stream), XmlNodeType.Document);
+			this.InitializeContext (uriString, ctx, null, XmlNodeType.Document);
 		}
 
 		public XmlTextReader (TextReader input, XmlNameTable nt)
@@ -138,6 +138,7 @@ namespace System.Xml
 			}
 			this.XmlResolver = resolver;
 			string uriString;
+
 			Stream stream = GetStreamFromUrl (url, out uriString);
 			this.InitializeContext (uriString, context, new XmlStreamReader (stream), fragType);
 		}
@@ -180,7 +181,12 @@ namespace System.Xml
 			InitializeContext (url, context, fragment, fragType);
 		}
 
-		private Stream GetStreamFromUrl (string url, out string absoluteUriString)
+		Uri ResolveUri (string url)
+		{
+			return resolver.ResolveUri (null, url);
+		}
+
+		Stream GetStreamFromUrl (string url, out string absoluteUriString)
 		{
 #if NET_2_1
 			if (url == null)
@@ -188,7 +194,7 @@ namespace System.Xml
 			if (url.Length == 0)
 				throw new ArgumentException ("url");
 #endif
-			Uri uri = resolver.ResolveUri (null, url);
+			Uri uri = ResolveUri (url);
 			absoluteUriString = uri != null ? uri.ToString () : String.Empty;
 			return resolver.GetEntity (uri, null, typeof (Stream)) as Stream;
 		}
@@ -928,6 +934,7 @@ namespace System.Xml
 
 		private StringBuilder valueBuffer;
 
+		Uri reader_uri;
 		private TextReader reader;
 		private char [] peekChars;
 		private int peekCharsIndex;
@@ -1239,6 +1246,12 @@ namespace System.Xml
 
 		private bool ReadTextReader (int remained)
 		{
+			if (reader == null && reader_uri != null) {
+				Uri uri = reader_uri;
+				reader_uri = null;
+				string uriString;
+				reader = new XmlStreamReader (GetStreamFromUrl (uri.ToString (), out uriString));
+			}
 			if (peekCharsLength < 0) {	// initialized buffer
 				peekCharsLength = reader.Read (peekChars, 0, peekChars.Length);
 				return peekCharsLength > 0;
diff --git a/mcs/class/System.Xml.Linq/System.Xml.Linq/ChangeLog b/mcs/class/System.Xml.Linq/System.Xml.Linq/ChangeLog
index 5fd56e6..e9ea32a 100644
--- a/mcs/class/System.Xml.Linq/System.Xml.Linq/ChangeLog
+++ b/mcs/class/System.Xml.Linq/System.Xml.Linq/ChangeLog
@@ -1,3 +1,15 @@
+2011-09-19  Sebastien Pouliot  <sebastien at xamarin.com>
+
+	fix previous fix (wrt #808)
+
+2011-09-18  Sebastien Pouliot  <sebastien at xamarin.com>
+
+	Fix typo (bug #808)
+
+2011-08-30  Atsushi Eno  <atsushieno at veritas-vos-liberabit.com>
+
+	Implement IXmlLineInfo on XLinq node reader.
+
 2011-07-26  Atsushi Eno  <atsushieno at veritas-vos-liberabit.com>
 
 	Fix bug #16: use Owner node instead of Parent. Patch by Martin
diff --git a/mcs/class/System.Xml.Linq/System.Xml.Linq/XElement.cs b/mcs/class/System.Xml.Linq/System.Xml.Linq/XElement.cs
index bf3483e..4514398 100644
--- a/mcs/class/System.Xml.Linq/System.Xml.Linq/XElement.cs
+++ b/mcs/class/System.Xml.Linq/System.Xml.Linq/XElement.cs
@@ -327,8 +327,8 @@ namespace System.Xml.Linq
 		public XName Name {
 			get { return name; }
 			set {
-				if (name == null)
-					throw new ArgumentNullException ("value");
+				if (value == null)
+					throw new ArgumentNullException ("Name");
 				name = value;
 			}
 		}
diff --git a/mcs/class/System.Xml.Linq/System.Xml.Linq/XNodeReader.cs b/mcs/class/System.Xml.Linq/System.Xml.Linq/XNodeReader.cs
index 942f177..e4fb891 100644
--- a/mcs/class/System.Xml.Linq/System.Xml.Linq/XNodeReader.cs
+++ b/mcs/class/System.Xml.Linq/System.Xml.Linq/XNodeReader.cs
@@ -31,7 +31,7 @@ using XPI = System.Xml.Linq.XProcessingInstruction;
 
 namespace System.Xml.Linq
 {
-	internal class XNodeReader : XmlReader
+	internal class XNodeReader : XmlReader, IXmlLineInfo
 	{
 		ReadState state = ReadState.Initial;
 		XNode node, start;
@@ -46,6 +46,24 @@ namespace System.Xml.Linq
 			start = node;
 		}
 
+		int IXmlLineInfo.LineNumber {
+			get {
+				var o = (XObject) GetCurrentAttribute () ?? node;
+				return o != null ? o.LineNumber : 0;
+			}
+		}
+		int IXmlLineInfo.LinePosition {
+			get {
+				var o = (XObject) GetCurrentAttribute () ?? node;
+				return o != null ? o.LinePosition : 0;
+			}
+		}
+		bool IXmlLineInfo.HasLineInfo ()
+		{
+				var o = (XObject) GetCurrentAttribute () ?? node;
+				return o != null ? ((IXmlLineInfo) o).HasLineInfo () : false;
+		}
+	
 		public override int AttributeCount {
 			get {
 				if (state != ReadState.Interactive || end_element)
diff --git a/mcs/class/System/System.Net.Configuration/BypassElement.cs b/mcs/class/System/System.Net.Configuration/BypassElement.cs
index a017ae8..2f85be7 100644
--- a/mcs/class/System/System.Net.Configuration/BypassElement.cs
+++ b/mcs/class/System/System.Net.Configuration/BypassElement.cs
@@ -49,7 +49,7 @@ namespace System.Net.Configuration
 
 		static BypassElement ()
 		{
-			addressProp = new ConfigurationProperty ("Address", typeof (string),
+			addressProp = new ConfigurationProperty ("address", typeof (string),
 								 null, ConfigurationPropertyOptions.IsRequired | ConfigurationPropertyOptions.IsKey);
 
 			properties = new ConfigurationPropertyCollection ();
diff --git a/mcs/class/System/System.Net.Configuration/ChangeLog b/mcs/class/System/System.Net.Configuration/ChangeLog
index f62b5c1..b0eafc5 100644
--- a/mcs/class/System/System.Net.Configuration/ChangeLog
+++ b/mcs/class/System/System.Net.Configuration/ChangeLog
@@ -1,3 +1,13 @@
+2011-10-11  QuickJack  <test051102 at hotmail.com>
+
+	Edited mcs/class/System/System.Net.Configuration/BypassElement.cs
+	via GitHub
+
+2011-10-11  QuickJack  <test051102 at hotmail.com>
+
+	Edited mcs/class/System/System.Net.Configuration/ProxyElement.cs
+	via GitHub
+
 2010-10-08  Gonzalo Paniagua Javier  <gonzalo.mono at gmail.com>
 
 	Add support for EnableSsl in smtp config.
diff --git a/mcs/class/System/System.Net.Configuration/ProxyElement.cs b/mcs/class/System/System.Net.Configuration/ProxyElement.cs
index e5163ae..0a336ce 100644
--- a/mcs/class/System/System.Net.Configuration/ProxyElement.cs
+++ b/mcs/class/System/System.Net.Configuration/ProxyElement.cs
@@ -58,7 +58,7 @@ namespace System.Net.Configuration
 			bypassOnLocalProp = new ConfigurationProperty ("bypassonlocal", typeof (BypassOnLocalValues), BypassOnLocalValues.Unspecified);
 			proxyAddressProp = new ConfigurationProperty ("proxyaddress", typeof (Uri), null);
 			scriptLocationProp = new ConfigurationProperty ("scriptLocation", typeof (Uri), null);
-			useSystemDefaultProp = new ConfigurationProperty ("UseSystemDefault", typeof (UseSystemDefaultValues), UseSystemDefaultValues.Unspecified);
+			useSystemDefaultProp = new ConfigurationProperty ("usesystemdefault", typeof (UseSystemDefaultValues), UseSystemDefaultValues.Unspecified);
 
 			properties = new ConfigurationPropertyCollection ();
 								    
diff --git a/mcs/class/System/System.Net.NetworkInformation/ChangeLog b/mcs/class/System/System.Net.NetworkInformation/ChangeLog
index c63afb0..4c5a227 100644
--- a/mcs/class/System/System.Net.NetworkInformation/ChangeLog
+++ b/mcs/class/System/System.Net.NetworkInformation/ChangeLog
@@ -1,3 +1,13 @@
+2011-12-13  Gonzalo Paniagua Javier  <gonzalo at xamarin.com>
+
+	Fix MAC address for Mac/iOS
+
+	The position of the first byte to copy was wrong. Fixes bug #2012.
+
+2011-11-04  Rodrigo Kumpera  <kumpera at gmail.com>
+
+	Fix marshaling of Win32_IN6_ADDR.
+
 2011-07-05  Jeffrey Stedfast  <jeff at xamarin.com>
 
 	Implemented a shared way to detect MacOSX for System.dll
diff --git a/mcs/class/System/System.Net.NetworkInformation/IPGlobalProperties.cs b/mcs/class/System/System.Net.NetworkInformation/IPGlobalProperties.cs
index fa94ef6..5946766 100644
--- a/mcs/class/System/System.Net.NetworkInformation/IPGlobalProperties.cs
+++ b/mcs/class/System/System.Net.NetworkInformation/IPGlobalProperties.cs
@@ -583,7 +583,7 @@ namespace System.Net.NetworkInformation {
 		struct Win32_IN6_ADDR
 		{
 			[FieldOffset (0)]
-			[MarshalAs ((short) UnmanagedType.U1, SizeConst = 16)]
+			[MarshalAs ( UnmanagedType.ByValArray, SizeConst = 16)]
 			public byte [] Bytes;
 		}
 
diff --git a/mcs/class/System/System.Net.NetworkInformation/NetworkInterface.cs b/mcs/class/System/System.Net.NetworkInformation/NetworkInterface.cs
index 8503167..89b7bff 100644
--- a/mcs/class/System/System.Net.NetworkInformation/NetworkInterface.cs
+++ b/mcs/class/System/System.Net.NetworkInformation/NetworkInterface.cs
@@ -469,7 +469,7 @@ namespace System.Net.NetworkInformation {
 							MacOsStructs.sockaddr_dl sockaddrdl = (MacOsStructs.sockaddr_dl) Marshal.PtrToStructure (addr.ifa_addr, typeof (MacOsStructs.sockaddr_dl));
 
 							macAddress = new byte [(int) sockaddrdl.sdl_alen];
-							Array.Copy (sockaddrdl.sdl_data, sockaddrdl.sdl_alen, macAddress, 0, Math.Min (macAddress.Length, sockaddrdl.sdl_data.Length - sockaddrdl.sdl_alen));
+							Array.Copy (sockaddrdl.sdl_data, sockaddrdl.sdl_nlen, macAddress, 0, Math.Min (macAddress.Length, sockaddrdl.sdl_data.Length - macAddress.Length));
 							index = sockaddrdl.sdl_index;
 
 							int hwtype = (int) sockaddrdl.sdl_type;
diff --git a/mcs/class/System/System.Net.Sockets/ChangeLog b/mcs/class/System/System.Net.Sockets/ChangeLog
index a61e2ff..a2b81f2 100644
--- a/mcs/class/System/System.Net.Sockets/ChangeLog
+++ b/mcs/class/System/System.Net.Sockets/ChangeLog
@@ -1,3 +1,18 @@
+2011-09-29  Gonzalo Paniagua Javier  <gonzalo.mono at gmail.com>
+
+	Merge pull request #167 from konrad-kruczynski/send_async_fix
+
+	Fix for Xamarin bug #531.
+
+2011-09-13  Gonzalo Paniagua Javier  <gonzalo.mono at gmail.com>
+
+	Internal worker is kept while there is an ongoing operation
+
+	When there is an ongoing operation we can't dispose the internal
+	worker because it might be used by the IO threadpool.
+
+	Fixes Novell bug #691076 and Xamarin bug #766.
+
 2011-08-07  Bassam Tabbara  <bassam at symform.com>
 
 	Networkstream now throws IOException('connection closed') if the
diff --git a/mcs/class/System/System.Net.Sockets/SocketAsyncEventArgs.cs b/mcs/class/System/System.Net.Sockets/SocketAsyncEventArgs.cs
index 18db222..c68243d 100644
--- a/mcs/class/System/System.Net.Sockets/SocketAsyncEventArgs.cs
+++ b/mcs/class/System/System.Net.Sockets/SocketAsyncEventArgs.cs
@@ -2,9 +2,10 @@
 //
 // Authors:
 //	Marek Habersack (mhabersack at novell.com)
-//	Gonzalo Paniagua Javier (gonzalo at novell.com)
+//	Gonzalo Paniagua Javier (gonzalo at xamarin.com)
 //
 // Copyright (c) 2008,2010 Novell, Inc. (http://www.novell.com)
+// Copyright (c) 2011 Xamarin, Inc. (http://xamarin.com)
 //
 
 //
@@ -37,6 +38,8 @@ namespace System.Net.Sockets
 {
 	public class SocketAsyncEventArgs : EventArgs, IDisposable
 	{
+		bool disposed;
+		int in_progress;
 		internal Socket.Worker Worker;
 		EndPoint remote_ep;
 #if MOONLIGHT || NET_4_0
@@ -147,7 +150,11 @@ namespace System.Net.Sockets
 
 		void Dispose (bool disposing)
 		{
+			disposed = true;
+
 			if (disposing) {
+				if (disposed || Interlocked.CompareExchange (ref in_progress, 0, 0) != 0)
+					return;
 				if (Worker != null) {
 					Worker.Dispose ();
 					Worker = null;
@@ -171,6 +178,10 @@ namespace System.Net.Sockets
 
 		internal void SetLastOperation (SocketAsyncOperation op)
 		{
+			if (disposed)
+				throw new ObjectDisposedException ("System.Net.Sockets.SocketAsyncEventArgs");
+			if (Interlocked.Exchange (ref in_progress, 1) != 0)
+				throw new InvalidOperationException ("Operation already in progress");
 			LastOperation = op;
 		}
 
@@ -219,6 +230,8 @@ namespace System.Net.Sockets
 		static void DispatcherCB (IAsyncResult ares)
 		{
 			SocketAsyncEventArgs args = (SocketAsyncEventArgs) ares.AsyncState;
+			if (Interlocked.Exchange (ref args.in_progress, 0) != 1)
+				throw new InvalidOperationException ("No operation in progress");
 			SocketAsyncOperation op = args.LastOperation;
 			// Notes;
 			// 	-SocketOperation.AcceptReceive not used in SocketAsyncEventArgs
diff --git a/mcs/class/System/System.Net.Sockets/Socket_2_1.cs b/mcs/class/System/System.Net.Sockets/Socket_2_1.cs
index 3a0f4de..8f94abf 100644
--- a/mcs/class/System/System.Net.Sockets/Socket_2_1.cs
+++ b/mcs/class/System/System.Net.Sockets/Socket_2_1.cs
@@ -709,6 +709,7 @@ namespace System.Net.Sockets {
 						return; // Have to finish writing everything. See bug #74475.
 					}
 					result.Total = send_so_far;
+					send_so_far = 0;
 				}
 				result.Complete ();
 			}
@@ -730,7 +731,9 @@ namespace System.Net.Sockets {
 						return; // Have to finish writing everything. See bug #74475.
 					}
 					result.Total = send_so_far;
+					send_so_far = 0;
 				} catch (Exception e) {
+					send_so_far = 0;
 					result.Complete (e);
 					return;
 				}
diff --git a/mcs/class/System/System.Net/ChangeLog b/mcs/class/System/System.Net/ChangeLog
index a3bbe0a..7d454ec 100644
--- a/mcs/class/System/System.Net/ChangeLog
+++ b/mcs/class/System/System.Net/ChangeLog
@@ -1,3 +1,19 @@
+2011-10-17  Gonzalo Paniagua Javier  <gonzalo.mono at gmail.com>
+
+	Return the correct length for input streams
+
+2011-10-11  QuickJack  <test051102 at hotmail.com>
+
+	Edited mcs/class/System/System.Net/WebRequest.cs via GitHub
+
+2011-10-11  QuickJack  <test051102 at hotmail.com>
+
+	Edited mcs/class/System/System.Net/WebRequest.cs via GitHub
+
+2011-09-23  Rolf Bjarne Kvinge  <rolf at xamarin.com>
+
+	[System] Added NetworkCredential.SecurePassword.
+
 2011-08-17  Miguel de Icaza  <miguel at gnome.org>
 
 	updated copyrights
diff --git a/mcs/class/System/System.Net/NetworkCredential.cs b/mcs/class/System/System.Net/NetworkCredential.cs
index 0b591a8..055eb6c 100644
--- a/mcs/class/System/System.Net/NetworkCredential.cs
+++ b/mcs/class/System/System.Net/NetworkCredential.cs
@@ -2,9 +2,11 @@
 // System.Net.NetworkCredential.cs
 //
 // Author: Duncan Mak (duncan at ximian.com)
+// Author: Rolf Bjarne KVinge (rolf at xamarin.com)
 //
 // (C) Ximian, Inc.
 // Copyright (C) 2010 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2011 Xamarin Inc (http://www.xamarin.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
@@ -26,6 +28,8 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+using System.Security;
+
 namespace System.Net
 {
 	public class NetworkCredential : ICredentials
@@ -38,6 +42,10 @@ namespace System.Net
 		string password;
 		string domain;
 		
+#if NET_4_0
+		SecureString securePassword;
+#endif
+
 		// Constructors
 		public NetworkCredential ()
 		{
@@ -73,6 +81,19 @@ namespace System.Net
 			set { password = value; }
 		}
 
+#if NET_4_0
+		public SecureString SecurePassword {
+			get { return securePassword; }
+			set {
+				if (value == null) {
+					securePassword = new SecureString ();
+				} else {
+					securePassword = value;
+				}
+			}
+		}
+#endif
+
 		public NetworkCredential GetCredential (Uri uri, string authType)
 		{
 			return this;
diff --git a/mcs/class/System/System.Net/WebConnectionStream.cs b/mcs/class/System/System.Net/WebConnectionStream.cs
index c890e48..d9723c8 100644
--- a/mcs/class/System/System.Net/WebConnectionStream.cs
+++ b/mcs/class/System/System.Net/WebConnectionStream.cs
@@ -44,6 +44,7 @@ namespace System.Net
 		byte [] readBuffer;
 		int readBufferOffset;
 		int readBufferSize;
+		int stream_length; // -1 when CL not present
 		int contentLength;
 		int totalRead;
 		internal long totalWritten;
@@ -91,6 +92,10 @@ namespace System.Net
 			} else {
 				contentLength = Int32.MaxValue;
 			}
+
+			// Negative numbers?
+			if (!Int32.TryParse (clength, out stream_length))
+				stream_length = -1;
 		}
 
 		public WebConnectionStream (WebConnection cnc, HttpWebRequest request)
@@ -803,7 +808,11 @@ namespace System.Net
 		}
 
 		public override long Length {
-			get { throw new NotSupportedException (); }
+			get {
+				if (!isRead)
+					throw new NotSupportedException ();
+				return stream_length;
+			}
 		}
 
 		public override long Position {
diff --git a/mcs/class/System/System.Net/WebRequest.cs b/mcs/class/System/System.Net/WebRequest.cs
index 5e63342..8d010e7 100644
--- a/mcs/class/System/System.Net/WebRequest.cs
+++ b/mcs/class/System/System.Net/WebRequest.cs
@@ -265,6 +265,9 @@ namespace System.Net
 			
 			if (pe.BypassOnLocal != ProxyElement.BypassOnLocalValues.Unspecified)
 				p.BypassProxyOnLocal = (pe.BypassOnLocal == ProxyElement.BypassOnLocalValues.True);
+				
+			foreach(BypassElement elem in sec.BypassList)
+				p.BypassArrayList.Add(elem.Address);
 			
 			return p;
 #else
@@ -356,7 +359,19 @@ namespace System.Net
 							uri = builder.Uri;
 						}
 					}
-					return new WebProxy (uri);
+					
+					string[] bypassList=null;
+				        string bypass = Environment.GetEnvironmentVariable ("no_proxy");
+				
+				        if (bypass == null)
+				        	bypass = Environment.GetEnvironmentVariable ("NO_PROXY");
+				
+				        if (bypass != null) {
+				                bypass = bypass.Remove (bypass.IndexOf("*.local"), 7);
+				                bypassList = bypass.Split (new char[]{','}, StringSplitOptions.RemoveEmptyEntries);
+				            }
+				
+				        return new WebProxy (uri, false, bypassList);
 				} catch (UriFormatException) { }
 			}
 			
diff --git a/mcs/class/System/System.Security.Cryptography.X509Certificates/ChangeLog b/mcs/class/System/System.Security.Cryptography.X509Certificates/ChangeLog
index 364f067..a02aaa7 100644
--- a/mcs/class/System/System.Security.Cryptography.X509Certificates/ChangeLog
+++ b/mcs/class/System/System.Security.Cryptography.X509Certificates/ChangeLog
@@ -1,3 +1,8 @@
+2011-10-18  Sebastien Pouliot  <sebastien at xamarin.com>
+
+	Ensure private key flow from the mono store into the
+	X509Certificate2 instance. Patch from bug #1201
+
 2011-08-17  Miguel de Icaza  <miguel at gnome.org>
 
 	updated copyrights
diff --git a/mcs/class/System/System.Security.Cryptography.X509Certificates/X509Store.cs b/mcs/class/System/System.Security.Cryptography.X509Certificates/X509Store.cs
index f3e377e..e4e567f 100644
--- a/mcs/class/System/System.Security.Cryptography.X509Certificates/X509Store.cs
+++ b/mcs/class/System/System.Security.Cryptography.X509Certificates/X509Store.cs
@@ -225,7 +225,9 @@ namespace System.Security.Cryptography.X509Certificates {
 			_flags = flags;
 
 			foreach (MX.X509Certificate x in store.Certificates) {
-				Certificates.Add (new X509Certificate2 (x.RawData));
+				var cert2 = new X509Certificate2 (x.RawData);
+				cert2.PrivateKey = x.RSA;
+				Certificates.Add (cert2);
 			}
 		}
 
diff --git a/mcs/class/WindowsBase/ChangeLog b/mcs/class/WindowsBase/ChangeLog
index c7added..51a75a2 100644
--- a/mcs/class/WindowsBase/ChangeLog
+++ b/mcs/class/WindowsBase/ChangeLog
@@ -1,3 +1,35 @@
+2011-10-18  Alan McGovern  <alan.mcgovern at gmail.com>
+
+	[WindowsBase] Add better support for Default/Override
+	content_types
+
+	System.IO.Packaging already had full support for parsing
+	[Content_Types].xml if it contained both <Override> and <Default>
+	nodes when specifying content types for files. However we had
+	taken a shortcut before by explicitly writing the content type of
+	each file using an <Override> attribute for every file. We now
+	properly write a <Default> element and only use <Override>
+	attributes when required.
+
+2011-10-11  Jérémie Laval  <jeremie.laval at gmail.com>
+
+	[WindowsBase] Don't treat special file [Content-Types].xml as a
+	part, ends up as a duplicate when writing back a package
+
+2011-10-18  Alan McGovern  <alan.mcgovern at gmail.com>
+
+	[System.IO.Packaging] Fix some dispose related issues
+
+	Ensure we can call dispose multiple times without blowing up. Also
+	ensure that we do not close streams which are passed in by the
+	user. We should only close streams which are implicitly created by
+	the API. This is a modification of the patch proposed for bug
+	#1464, which is now fixed by this commit.
+
+2011-09-23  Rolf Bjarne Kvinge  <rolf at xamarin.com>
+
+	[WindowsBase] Relationship ids must be valid XML identifiers.
+
 2011-08-17  Alan McGovern  <alan.mcgovern at gmail.com>
 
 	[System.IO.Packaging] Fix calling convention related issues
diff --git a/mcs/class/WindowsBase/System.IO.Packaging/Package.cs b/mcs/class/WindowsBase/System.IO.Packaging/Package.cs
index 5a0204d..d7b71c3 100644
--- a/mcs/class/WindowsBase/System.IO.Packaging/Package.cs
+++ b/mcs/class/WindowsBase/System.IO.Packaging/Package.cs
@@ -18,10 +18,12 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 // Copyright (c) 2007 Novell, Inc. (http://www.novell.com)
+// Copyright (c) 2011 Xamarin Inc. (http://www.xamarin.com)
 //
 // Authors:
 //	Chris Toshok (toshok at ximian.com)
 //	Alan McGovern (amcgovern at novell.com)
+//	Rolf Bjarne Kvinge (rolf at xamarin.com)
 //
 
 using System;
@@ -42,6 +44,9 @@ namespace System.IO.Packaging {
 		PackageRelationshipCollection relationshipsCollection = new PackageRelationshipCollection ();
 		Uri Uri = new Uri ("/", UriKind.Relative);
 		
+		bool Disposed {
+			get; set;
+		}
 
 		public FileAccess FileOpenAccess {
 			get; private set;
@@ -111,8 +116,7 @@ namespace System.IO.Packaging {
 		public void Close ()
 		{
 			// FIXME: Ensure that Flush is actually called before dispose
-			Flush ();
-			Dispose (true);
+			((IDisposable) this).Dispose ();
 		}
 
 		public PackagePart CreatePart (Uri partUri, string contentType)
@@ -219,8 +223,11 @@ namespace System.IO.Packaging {
 		
 		void IDisposable.Dispose ()
 		{
-			Flush ();
-			Dispose (true);
+			if (!Disposed) {
+				Flush ();
+				Dispose (true);
+				Disposed = true;
+			}
 		}
 
 		protected virtual void Dispose (bool disposing)
@@ -337,7 +344,7 @@ namespace System.IO.Packaging {
 		string NextId ()
 		{
 			while (true) {
-				string s = RelationshipId.ToString ();
+				string s = "Re" + RelationshipId.ToString ();
 				if (!Relationships.ContainsKey (s))
 					return s;
 				
@@ -368,7 +375,12 @@ namespace System.IO.Packaging {
 
 		public static Package Open (Stream stream, FileMode packageMode, FileAccess packageAccess)
 		{
-			return OpenCore (stream, packageMode, packageAccess);
+			return Open (stream, packageMode, packageAccess, false);
+		}
+		
+		static Package Open (Stream stream, FileMode packageMode, FileAccess packageAccess, bool ownsStream)
+		{
+			return OpenCore (stream, packageMode, packageAccess, ownsStream);
 		}
 
 		public static Package Open (string path, FileMode packageMode, FileAccess packageAccess)
@@ -392,10 +404,10 @@ namespace System.IO.Packaging {
 				throw new FileFormatException ("Stream length cannot be zero with FileMode.Open");
 
 			Stream s = File.Open (path, packageMode, packageAccess, packageShare);
-			return Open (s, packageMode, packageAccess);
+			return Open (s, packageMode, packageAccess, true);
 		}
 
-		static Package OpenCore (Stream stream, FileMode packageMode, FileAccess packageAccess)
+		static Package OpenCore (Stream stream, FileMode packageMode, FileAccess packageAccess, bool ownsStream)
 		{
 			if ((packageAccess & FileAccess.Read) == FileAccess.Read && !stream.CanRead)
 				throw new IOException ("Stream does not support reading");
@@ -430,7 +442,7 @@ namespace System.IO.Packaging {
 				}
 			}
 			
-			return new ZipPackage (packageAccess, stream);
+			return new ZipPackage (packageAccess, ownsStream, stream);
 		}
 		
 		public virtual bool PartExists (Uri partUri)
diff --git a/mcs/class/WindowsBase/System.IO.Packaging/ZipPackage.cs b/mcs/class/WindowsBase/System.IO.Packaging/ZipPackage.cs
index 0a11336..435e1d5 100644
--- a/mcs/class/WindowsBase/System.IO.Packaging/ZipPackage.cs
+++ b/mcs/class/WindowsBase/System.IO.Packaging/ZipPackage.cs
@@ -49,6 +49,10 @@ namespace System.IO.Packaging {
 		private const string ContentNamespace = "http://schemas.openxmlformats.org/package/2006/content-types";
 		private const string ContentUri = "[Content_Types].xml";
 		
+		bool OwnsStream {
+			get; set;
+		}
+		
 		Dictionary<Uri, ZipPackagePart> parts;
 		internal Dictionary<Uri, MemoryStream> PartStreams = new Dictionary<Uri, MemoryStream> (new  UriComparer());
 
@@ -62,15 +66,17 @@ namespace System.IO.Packaging {
 			}
 		}
 		
-		internal ZipPackage (FileAccess access, Stream stream)
+		internal ZipPackage (FileAccess access, bool ownsStream, Stream stream)
 			: base (access)
 		{
+			OwnsStream = ownsStream;
 			PackageStream = stream;
 		}
 
-		internal ZipPackage (FileAccess access, Stream stream, bool streaming)
+		internal ZipPackage (FileAccess access, bool ownsStream, Stream stream, bool streaming)
 			: base (access, streaming)
 		{
+			OwnsStream = ownsStream;
 			PackageStream = stream;
 		}
 		
@@ -79,7 +85,10 @@ namespace System.IO.Packaging {
 			foreach (Stream s in PartStreams.Values)
 				s.Close ();
 			
-			PackageStream.Close ();
+			base.Dispose (disposing);
+			
+			if (OwnsStream)
+				PackageStream.Close ();
 		}
 
 		protected override void FlushCore ()
@@ -157,6 +166,9 @@ namespace System.IO.Packaging {
 
 					// The file names in the zip archive are not prepended with '/'
 					foreach (string file in archive.GetFiles ()) {
+						if (file.Equals (ContentUri, StringComparison.Ordinal))
+							continue;
+
 						XmlNode node;
 						CompressionOption compression = archive.GetCompressionLevel (file);
 
@@ -193,6 +205,8 @@ namespace System.IO.Packaging {
 		{
 			XmlDocument doc = new XmlDocument ();
 			XmlNamespaceManager manager = new XmlNamespaceManager (doc.NameTable);
+			Dictionary<string, string> mimes = new Dictionary<string, string> ();
+			
 			manager.AddNamespace ("content", ContentNamespace);
 
 			doc.AppendChild(doc.CreateNode (XmlNodeType.XmlDeclaration, "", ""));
@@ -201,19 +215,35 @@ namespace System.IO.Packaging {
 			doc.AppendChild (root);
 			foreach (ZipPackagePart part in Parts.Values)
 			{
-				XmlNode node = doc.CreateNode (XmlNodeType.Element, "Override", ContentNamespace);
-				
-				XmlAttribute contentType = doc.CreateAttribute ("ContentType");
-				contentType.Value = part.ContentType;
+				XmlNode node = null;
+				string existingMimeType;
+									
+				var extension = Path.GetExtension (part.Uri.OriginalString);
+				if (extension.Length > 0)
+					extension = extension.Substring (1);
 				
-				XmlAttribute name = doc.CreateAttribute ("PartName");
-				name.Value = part.Uri.ToString ();
+				if (!mimes.TryGetValue (extension, out existingMimeType)) {
+					node = doc.CreateNode (XmlNodeType.Element, "Default", ContentNamespace);
+					
+					XmlAttribute ext = doc.CreateAttribute ("Extension");
+					ext.Value = extension;
+					node.Attributes.Append (ext);
+					mimes [extension] = part.ContentType;
+				} else if (part.ContentType != existingMimeType) {
+					node = doc.CreateNode (XmlNodeType.Element, "Override", ContentNamespace);
+					
+					XmlAttribute name = doc.CreateAttribute ("PartName");
+					name.Value = part.Uri.ToString ();
+					node.Attributes.Append (name);
+				}
 				
-
-				node.Attributes.Append (contentType);
-				node.Attributes.Append (name);
-
-				root.AppendChild (node);				
+				if (node != null) {
+					XmlAttribute contentType = doc.CreateAttribute ("ContentType");
+					contentType.Value = part.ContentType;
+					node.Attributes.Prepend (contentType);
+	
+					root.AppendChild (node);
+				}
 			}
 
 			using (XmlTextWriter writer = new XmlTextWriter (s, System.Text.Encoding.UTF8))
diff --git a/mcs/class/WindowsBase/Test/System.IO.Packaging/PackagePartTest.cs b/mcs/class/WindowsBase/Test/System.IO.Packaging/PackagePartTest.cs
index 97aaa5b..07015c2 100644
--- a/mcs/class/WindowsBase/Test/System.IO.Packaging/PackagePartTest.cs
+++ b/mcs/class/WindowsBase/Test/System.IO.Packaging/PackagePartTest.cs
@@ -119,7 +119,45 @@ namespace System.IO.Packaging.Tests {
             Assert.AreEqual (package, part.Package, "Wrong package3");
             Assert.AreEqual ("/third", part.Uri.ToString (), "Wrong package selected3");
         }
-
+		
+		[Test]
+		public void SameExtensionDifferentContentTypeTest ()
+		{
+			// FIXME: Ideally we should be opening the zip and checking
+			// exactly what was written to verify it's correct
+			using (var stream = new MemoryStream ()) {
+				var package = Package.Open (stream, FileMode.OpenOrCreate);
+				package.CreatePart (uris [0], contentType + "1");
+				package.CreatePart (uris [1], contentType + "2");
+				package.CreatePart (uris [2], contentType + "2");
+				package.Close ();
+				
+				package = Package.Open (new MemoryStream (stream.ToArray ()));
+				Assert.AreEqual (contentType + "1", package.GetPart (uris [0]).ContentType, "#1");
+				Assert.AreEqual (contentType + "2", package.GetPart (uris [1]).ContentType, "#2");
+				Assert.AreEqual (contentType + "2", package.GetPart (uris [2]).ContentType, "#3");
+			}
+		}
+		
+		[Test]
+		public void SameExtensionSameContentTypeTest ()
+		{
+			// FIXME: Ideally we should be opening the zip and checking
+			// exactly what was written to verify it's correct
+			using (var stream = new MemoryStream ()) {
+				var package = Package.Open (stream, FileMode.OpenOrCreate);
+				package.CreatePart (uris [0], contentType);
+				package.CreatePart (uris [1], contentType);
+				package.CreatePart (uris [2], contentType);
+				package.Close ();
+				
+				package = Package.Open (new MemoryStream (stream.ToArray ()));
+				Assert.AreEqual (contentType, package.GetPart (uris [0]).ContentType, "#1");
+				Assert.AreEqual (contentType, package.GetPart (uris [1]).ContentType, "#2");
+				Assert.AreEqual (contentType, package.GetPart (uris [2]).ContentType, "#3");
+			}
+		}
+		
         [Test]
         public void CheckPartRelationships ()
         {
@@ -325,11 +363,9 @@ namespace System.IO.Packaging.Tests {
         }
 
         [Test]
-        [ExpectedException (typeof (ArgumentException))]
-        [Ignore ("Proper validation of the Uris is not performed")]
         public void CheckContentTypes ()
         {
-            package.PartExists(new Uri ("/[Content_Types].xml", UriKind.Relative));
+	        Assert.IsFalse (package.PartExists(new Uri ("[Content_Types].xml", UriKind.Relative)));
         }
     }
 }
diff --git a/mcs/class/WindowsBase/Test/System.IO.Packaging/PackageRelationshipTests.cs b/mcs/class/WindowsBase/Test/System.IO.Packaging/PackageRelationshipTests.cs
index 037a8d2..8c4b031 100644
--- a/mcs/class/WindowsBase/Test/System.IO.Packaging/PackageRelationshipTests.cs
+++ b/mcs/class/WindowsBase/Test/System.IO.Packaging/PackageRelationshipTests.cs
@@ -18,9 +18,11 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 // Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
+// Copyright (c) 2011 Xamarin Inc. (http://www.xamarin.com)
 //
 // Authors:
 //    Alan McGovern (amcgovern at novell.com)
+//    Rolf Bjarne Kvinge (rolf at xamarin.com)
 //
 
 
@@ -76,6 +78,7 @@ namespace System.IO.Packaging.Tests {
             Assert.AreEqual (package, r.Package, "#5");
             Assert.IsTrue (package == r.Package, "#6");
             Assert.IsTrue (!string.IsNullOrEmpty (r.Id), "#7");
+            Assert.IsTrue (char.IsLetter (r.Id [0]), "#8");
         }
 
         [Test]
diff --git a/mcs/class/WindowsBase/Test/System.IO.Packaging/PackageTest.cs b/mcs/class/WindowsBase/Test/System.IO.Packaging/PackageTest.cs
index 136510f..9b34575 100644
--- a/mcs/class/WindowsBase/Test/System.IO.Packaging/PackageTest.cs
+++ b/mcs/class/WindowsBase/Test/System.IO.Packaging/PackageTest.cs
@@ -115,7 +115,45 @@ namespace System.IO.Packaging.Tests {
             package.Close ();
             package = Package.Open (path);
         }
-
+		
+		[Test]
+		public void Close_FileStreamNotClosed ()
+		{
+			using (var stream = new FileStream (path, FileMode.OpenOrCreate, FileAccess.ReadWrite)) {
+				var package = Package.Open (stream, FileMode.OpenOrCreate);
+				package.CreatePart (uris [0], contentType);
+				package.Close ();
+				stream.Read (new byte [1024], 0, 1024);
+			}
+		}
+		
+		[Test]
+		public void Close_MemoryStreamNotClosed ()
+		{
+			using (var stream = new MemoryStream ()) {
+				var package = Package.Open (stream, FileMode.OpenOrCreate);
+				package.CreatePart (uris [0], contentType);
+				package.Close ();
+				stream.Read (new byte [1024], 0, 1024);
+			}
+		}
+		
+		[Test]
+		public void Close_Twice ()
+		{
+			var package = Package.Open (new MemoryStream (), FileMode.OpenOrCreate);
+			package.Close ();
+			package.Close ();
+		}
+		
+		[Test]
+		public void Dispose_Twice ()
+		{
+			var package = Package.Open (new MemoryStream (), FileMode.OpenOrCreate);
+			((IDisposable) package).Dispose ();
+			((IDisposable) package).Dispose ();
+		}
+		
         [Test]
         public void CreatePath ()
         {
diff --git a/mcs/class/corlib/ChangeLog b/mcs/class/corlib/ChangeLog
index a6083bf..3df9cf4 100644
--- a/mcs/class/corlib/ChangeLog
+++ b/mcs/class/corlib/ChangeLog
@@ -1,3 +1,45 @@
+2011-11-21  Jonathan Pryor  <jonpryor at vt.edu>
+
+	[corlib] On Android, alias stdout/stderr to logcat.
+
+	In Mono for Android, stdout and stderr (file descriptors 1 and 2)
+	are only visible when debugging within MonoDevelop and/or Visual
+	Studio, which is rather annoying.
+
+	This was changed in Mono for Android 1.9.2, by using
+	Console.SetOut() and Console.SetError() to send stdout/stderr
+	message to both stdout/stderr and to the Android Debug Log (`adb
+	logcat`), allowing e.g. Console.WriteLine() output to be viewed
+	outside of a debugger.
+
+	Problem: in order to capture user-generated messages at their
+	earliest point, Console.SetOut()/etc. must be called at the
+	earliest point in Mono for Android initialization, even if
+	Console.WriteLine() is never used. Worse, this adds ~180ms of
+	startup overhead on a Nexus One.
+
+	The fix here is to move the std*/logcat duplication logic into
+	mscorlib.dll, so that we can configure things within the
+	System.Console static constructor. This moves the initialization
+	penalty onto users of System.Console (instead of all users).
+
+2011-11-07  Sebastien Pouliot  <sebastien at xamarin.com>
+
+	MonoTouch specific initialization for TimeZone (devices). Fix bug
+	#1790
+
+2011-11-07  Jérémie Laval  <jeremie.laval at gmail.com>
+
+	Import TPL unit test from master
+
+2011-11-07  Jérémie Laval  <jeremie.laval at gmail.com>
+
+	Import TPL changes from master
+
+2011-09-11  Jérémie Laval  <jeremie.laval at gmail.com>
+
+	Backport System.Threading.Tasks from master to mono-2-10
+
 2011-02-05  Gonzalo Paniagua Javier  <gonzalo.mono at gmail.com>
 
 	[threadpool] Added dynamic concurrent queue implementation
diff --git a/mcs/class/corlib/System.Collections.Concurrent/ChangeLog b/mcs/class/corlib/System.Collections.Concurrent/ChangeLog
index ef0b635..c2637f3 100644
--- a/mcs/class/corlib/System.Collections.Concurrent/ChangeLog
+++ b/mcs/class/corlib/System.Collections.Concurrent/ChangeLog
@@ -1,3 +1,12 @@
+2011-11-07  Jérémie Laval  <jeremie.laval at gmail.com>
+
+	Import TPL changes from master
+
+2011-09-25  Jérémie Laval  <jeremie.laval at gmail.com>
+
+	Fix double adding in ConcurrentDictionary ctor with IEnumerable
+	seed.
+
 2011-01-25  Geoff Norton  <grompf at sublimeintervention.com>
 
 	Add pfx to the mobile profile
diff --git a/mcs/class/corlib/System.Collections.Concurrent/ConcurrentDictionary.cs b/mcs/class/corlib/System.Collections.Concurrent/ConcurrentDictionary.cs
index 97f16c6..46c32b3 100644
--- a/mcs/class/corlib/System.Collections.Concurrent/ConcurrentDictionary.cs
+++ b/mcs/class/corlib/System.Collections.Concurrent/ConcurrentDictionary.cs
@@ -50,8 +50,6 @@ namespace System.Collections.Concurrent
 		public ConcurrentDictionary (IEnumerable<KeyValuePair<TKey, TValue>> collection)
 			: this (collection, EqualityComparer<TKey>.Default)
 		{
-			foreach (KeyValuePair<TKey, TValue> pair in collection)
-				Add (pair.Key, pair.Value);
 		}
 
 		public ConcurrentDictionary (IEqualityComparer<TKey> comparer)
diff --git a/mcs/class/corlib/System.Collections.Concurrent/ConcurrentOrderedList.cs b/mcs/class/corlib/System.Collections.Concurrent/ConcurrentOrderedList.cs
index fd12335..ab9a45c 100644
--- a/mcs/class/corlib/System.Collections.Concurrent/ConcurrentOrderedList.cs
+++ b/mcs/class/corlib/System.Collections.Concurrent/ConcurrentOrderedList.cs
@@ -30,9 +30,18 @@ using System.Collections;
 using System.Collections.Generic;
 using System.Runtime.Serialization;
 
+#if INSIDE_MONO_PARALLEL
+using System.Collections.Concurrent;
+
+namespace Mono.Collections.Concurrent
+#else
 namespace System.Collections.Concurrent
+#endif
 {
-	internal class ConcurrentOrderedList<T>
+#if INSIDE_MONO_PARALLEL
+	public
+#endif
+	class ConcurrentOrderedList<T>: ICollection<T>, IEnumerable<T>
 	{
 		class Node
 		{
@@ -58,6 +67,8 @@ namespace System.Collections.Concurrent
 
 		IEqualityComparer<T> comparer;
 
+		int count;
+
 		public ConcurrentOrderedList () : this (EqualityComparer<T>.Default)
 		{
 			
@@ -65,6 +76,9 @@ namespace System.Collections.Concurrent
 
 		public ConcurrentOrderedList (IEqualityComparer<T> comparer)
 		{
+			if (comparer == null)
+				throw new ArgumentNullException ("comparer");
+
 			this.comparer = comparer;
 
 			head = new Node ();
@@ -78,7 +92,12 @@ namespace System.Collections.Concurrent
 			node.Data = data;
 			node.Key = comparer.GetHashCode (data);
 
-			return ListInsert (node);
+			if (ListInsert (node)) {
+				Interlocked.Increment (ref count);
+				return true;
+			}
+
+			return false;
 		}
 
 		public bool TryRemove (T data)
@@ -89,7 +108,17 @@ namespace System.Collections.Concurrent
 
 		public bool TryRemoveHash (int key, out T data)
 		{
-			return ListDelete (key, out data);
+			if (ListDelete (key, out data)) {
+				Interlocked.Decrement (ref count);
+				return true;
+			}
+
+			return false;
+		}
+
+		public bool TryPop (out T data)
+		{
+			return ListPop (out data);
 		}
 
 		public bool Contains (T data)
@@ -99,7 +128,7 @@ namespace System.Collections.Concurrent
 
 		public bool ContainsHash (int key)
 		{
-			Node node;			
+			Node node;
 
 			if (!ListFind (key, out node))
 				return false;
@@ -111,7 +140,7 @@ namespace System.Collections.Concurrent
 		public bool TryGetFromHash (int key, out T data)
 		{
 			data = default (T);
-			Node node;			
+			Node node;
 
 			if (!ListFind (key, out node))
 				return false;
@@ -120,6 +149,40 @@ namespace System.Collections.Concurrent
 			return true;
 		}
 
+		public void Clear ()
+		{
+			head.Next = tail;
+		}
+
+		public void CopyTo (T[] array, int startIndex)
+		{
+			if (array == null)
+				throw new ArgumentNullException ("array");
+			if (startIndex < 0)
+				throw new ArgumentOutOfRangeException ("startIndex");
+			if (count > array.Length - startIndex)
+				throw new ArgumentException ("array", "The number of elements is greater than the available space from startIndex to the end of the destination array.");
+
+			foreach (T item in this) {
+				if (startIndex >= array.Length)
+					break;
+
+				array[startIndex++] = item;
+			}
+		}
+
+		public IEqualityComparer<T> Comparer {
+			get {
+				return comparer;
+			}
+		}
+
+		public int Count {
+			get {
+				return count;
+			}
+		}
+
 		Node ListSearch (int key, ref Node left)
 		{
 			Node leftNodeNext = null, rightNode = null;
@@ -180,6 +243,30 @@ namespace System.Collections.Concurrent
 			
 			return true;
 		}
+
+		bool ListPop (out T data)
+		{
+			Node rightNode = null, rightNodeNext = null, leftNode = head;
+			data = default (T);
+
+			do {
+				rightNode = head.Next;
+				if (rightNode == tail)
+					return false;
+
+				data = rightNode.Data;
+
+				rightNodeNext = rightNode.Next;
+				if (!rightNodeNext.Marked)
+					if (Interlocked.CompareExchange (ref rightNode.Next, new Node (rightNodeNext), rightNodeNext) == rightNodeNext)
+						break;
+			} while (true);
+
+			if (Interlocked.CompareExchange (ref leftNode.Next, rightNodeNext, rightNode) != rightNodeNext)
+				ListSearch (rightNode.Key, ref leftNode);
+
+			return true;
+		}
 		
 		bool ListInsert (Node newNode)
 		{
@@ -206,6 +293,47 @@ namespace System.Collections.Concurrent
 			
 			return rightNode != tail && rightNode.Key == key;
 		}
+
+		IEnumerator<T> IEnumerable<T>.GetEnumerator ()
+		{
+			return GetEnumeratorInternal ();
+		}
+
+		IEnumerator IEnumerable.GetEnumerator ()
+		{
+			return GetEnumeratorInternal ();
+		}
+
+		IEnumerator<T> GetEnumeratorInternal ()
+		{
+			Node node = head.Next;
+
+			while (node != tail) {
+				while (node.Marked) {
+					node = node.Next;
+					if (node == tail)
+						yield break;
+				}
+				yield return node.Data;
+				node = node.Next;
+			}
+		}
+
+		bool ICollection<T>.IsReadOnly {
+			get {
+				return false;
+			}
+		}
+
+		void ICollection<T>.Add (T item)
+		{
+			TryAdd (item);
+		}
+
+		bool ICollection<T>.Remove (T item)
+		{
+			return TryRemove (item);
+		}
 	}
 }
 
diff --git a/mcs/class/corlib/System.Collections.Generic/ChangeLog b/mcs/class/corlib/System.Collections.Generic/ChangeLog
index ee353c5..12a96c4 100644
--- a/mcs/class/corlib/System.Collections.Generic/ChangeLog
+++ b/mcs/class/corlib/System.Collections.Generic/ChangeLog
@@ -1,3 +1,11 @@
+2011-12-19  Zoltan Varga  <vargaz at gmail.com>
+
+	Fix List.LastIndexOf () on empty lists. Fixes #2558.
+
+2011-11-07  Sebastien Pouliot  <sebastien at xamarin.com>
+
+	Workaround AOT limitation for bug #1443. Patch by Rodrigo Kumpera
+
 2011-06-30  Jb Evain  <jbevain at gmail.com>
 
 	Fix handling of null in the non generic implementation of
diff --git a/mcs/class/corlib/System.Collections.Generic/Dictionary.cs b/mcs/class/corlib/System.Collections.Generic/Dictionary.cs
index 65d88db..e6fb904 100644
--- a/mcs/class/corlib/System.Collections.Generic/Dictionary.cs
+++ b/mcs/class/corlib/System.Collections.Generic/Dictionary.cs
@@ -301,17 +301,25 @@ namespace System.Collections.Generic {
 				throw new ArgumentException ("Destination array cannot hold the requested elements!");
 		}
 
-		delegate TRet Transform<TRet> (TKey key, TValue value);
+		void CopyKeys (TKey[] array, int index)
+		{
+			for (int i = 0; i < touchedSlots; i++) {
+				if ((linkSlots [i].HashCode & HASH_FLAG) != 0)
+					array [index++] = keySlots [i];
+			}
+		}
 
-		void Do_CopyTo<TRet, TElem> (TElem [] array, int index, Transform<TRet> transform)
-			where TRet : TElem
+		void CopyValues (TValue[] array, int index)
 		{
 			for (int i = 0; i < touchedSlots; i++) {
 				if ((linkSlots [i].HashCode & HASH_FLAG) != 0)
-					array [index++] = transform (keySlots [i], valueSlots [i]);
+					array [index++] = valueSlots [i];
 			}
 		}
 
+		delegate TRet Transform<TRet> (TKey key, TValue value);
+
+
 		static KeyValuePair<TKey, TValue> make_pair (TKey key, TValue value)
 		{
 			return new KeyValuePair<TKey, TValue> (key, value);
@@ -330,7 +338,10 @@ namespace System.Collections.Generic {
 		void CopyTo (KeyValuePair<TKey, TValue> [] array, int index)
 		{
 			CopyToCheck (array, index);
-			Do_CopyTo<KeyValuePair<TKey, TValue>, KeyValuePair<TKey, TValue>> (array, index, make_pair);
+			for (int i = 0; i < touchedSlots; i++) {
+				if ((linkSlots [i].HashCode & HASH_FLAG) != 0)
+					array [index++] = new KeyValuePair<TKey, TValue> (keySlots [i], valueSlots [i]);
+			}
 		}
 
 		void Do_ICollectionCopyTo<TRet> (Array array, int index, Transform<TRet> transform)
@@ -346,7 +357,11 @@ namespace System.Collections.Generic {
 				// BOOTSTRAP: gmcs 2.4.x seems to have trouble compiling the alternative
 				throw new Exception ();
 #else
-				Do_CopyTo ((object []) array, index, transform);
+				object[] dest = (object[])array;
+				for (int i = 0; i < touchedSlots; i++) {
+					if ((linkSlots [i].HashCode & HASH_FLAG) != 0)
+						dest [index++] = transform (keySlots [i], valueSlots [i]);
+				}
 #endif
 
 			} catch (Exception e) {
@@ -770,7 +785,10 @@ namespace System.Collections.Generic {
 			CopyToCheck (array, index);
 			DictionaryEntry [] entries = array as DictionaryEntry [];
 			if (entries != null) {
-				Do_CopyTo (entries, index, delegate (TKey key, TValue value) { return new DictionaryEntry (key, value); });
+				for (int i = 0; i < touchedSlots; i++) {
+					if ((linkSlots [i].HashCode & HASH_FLAG) != 0)
+						entries [index++] = new DictionaryEntry (keySlots [i], valueSlots [i]);
+				}
 				return;
 			}
 
@@ -970,7 +988,7 @@ namespace System.Collections.Generic {
 			public void CopyTo (TKey [] array, int index)
 			{
 				dictionary.CopyToCheck (array, index);
-				dictionary.Do_CopyTo<TKey, TKey> (array, index, pick_key);
+				dictionary.CopyKeys (array, index);
 			}
 
 			public Enumerator GetEnumerator ()
@@ -1087,7 +1105,7 @@ namespace System.Collections.Generic {
 			public void CopyTo (TValue [] array, int index)
 			{
 				dictionary.CopyToCheck (array, index);
-				dictionary.Do_CopyTo<TValue, TValue> (array, index, pick_value);
+				dictionary.CopyValues (array, index);
 			}
 
 			public Enumerator GetEnumerator ()
diff --git a/mcs/class/corlib/System.Collections.Generic/List.cs b/mcs/class/corlib/System.Collections.Generic/List.cs
index 7646b77..c666eea 100644
--- a/mcs/class/corlib/System.Collections.Generic/List.cs
+++ b/mcs/class/corlib/System.Collections.Generic/List.cs
@@ -467,6 +467,8 @@ namespace System.Collections.Generic {
 
 		public int LastIndexOf (T item)
 		{
+			if (_size == 0)
+				return -1;
 			return Array.LastIndexOf<T> (_items, item, _size - 1, _size);
 		}
 		
diff --git a/mcs/class/corlib/System.Globalization/ChangeLog b/mcs/class/corlib/System.Globalization/ChangeLog
index 2179827..d26bb46 100644
--- a/mcs/class/corlib/System.Globalization/ChangeLog
+++ b/mcs/class/corlib/System.Globalization/ChangeLog
@@ -1,3 +1,7 @@
+2011-09-12  Sebastien Pouliot  <sebastien at xamarin.com>
+
+	More fixes for running unit tests under NET_2_1 profile
+
 2011-01-25  Geoff Norton  <grompf at sublimeintervention.com>
 
 	Further .NET 4.0 ification of the mobile profile
diff --git a/mcs/class/corlib/System.Globalization/TextInfo.cs b/mcs/class/corlib/System.Globalization/TextInfo.cs
index d77993b..0fa0bf5 100644
--- a/mcs/class/corlib/System.Globalization/TextInfo.cs
+++ b/mcs/class/corlib/System.Globalization/TextInfo.cs
@@ -162,7 +162,7 @@ namespace System.Globalization {
 		public string CultureName {
 			get {
 				if (customCultureName == null)
-					customCultureName = ci.Name;
+					customCultureName = ci == null ? String.Empty : ci.Name;
 				return customCultureName;
 			}
 		}
diff --git a/mcs/class/corlib/System.IO/BinaryReader.cs b/mcs/class/corlib/System.IO/BinaryReader.cs
index d6dd9c9..23e9777 100644
--- a/mcs/class/corlib/System.IO/BinaryReader.cs
+++ b/mcs/class/corlib/System.IO/BinaryReader.cs
@@ -92,7 +92,7 @@ namespace System.IO {
 			charBuffer = null;
 		}
 
-#if NET_4_0
+#if NET_4_0 || NET_2_1
 		public void Dispose ()
 #else
 		void IDisposable.Dispose() 
diff --git a/mcs/class/corlib/System.IO/ChangeLog b/mcs/class/corlib/System.IO/ChangeLog
index df7a035..3b2e2c7 100644
--- a/mcs/class/corlib/System.IO/ChangeLog
+++ b/mcs/class/corlib/System.IO/ChangeLog
@@ -1,3 +1,65 @@
+2011-11-21  Jonathan Pryor  <jonpryor at vt.edu>
+
+	[MonoDroid] Only alias stdout/stderr on Android devices.
+
+	Mono for Android uses Mono 2.10 + smcs to build code, which thus
+	uses an smcs built against the Mono for Android profile
+	assemblies, which would thus be built with MONODROID defined. Thus
+	(understandably) dies at runtime with a DllNotFoundException, as
+	liblog.so can't be found.
+
+	Fix smcs.
+
+2011-11-21  Jonathan Pryor  <jonpryor at vt.edu>
+
+	[corlib] On Android, alias stdout/stderr to logcat.
+
+	In Mono for Android, stdout and stderr (file descriptors 1 and 2)
+	are only visible when debugging within MonoDevelop and/or Visual
+	Studio, which is rather annoying.
+
+	This was changed in Mono for Android 1.9.2, by using
+	Console.SetOut() and Console.SetError() to send stdout/stderr
+	message to both stdout/stderr and to the Android Debug Log (`adb
+	logcat`), allowing e.g. Console.WriteLine() output to be viewed
+	outside of a debugger.
+
+	Problem: in order to capture user-generated messages at their
+	earliest point, Console.SetOut()/etc. must be called at the
+	earliest point in Mono for Android initialization, even if
+	Console.WriteLine() is never used. Worse, this adds ~180ms of
+	startup overhead on a Nexus One.
+
+	The fix here is to move the std*/logcat duplication logic into
+	mscorlib.dll, so that we can configure things within the
+	System.Console static constructor. This moves the initialization
+	penalty onto users of System.Console (instead of all users).
+
+2011-08-02  Alan McGovern  <alan.mcgovern at gmail.com>
+
+	[System.IO.Path] Fix potential infinite loop in
+	Path.GetTempFileName
+
+	Refactor this method so that it only attempts alternative
+	filenames if the filename just attempted already exists. This way
+	we will never end up looping forever being unable to create the
+	required file. Previously if we opened the maximum allowed files
+	and then called GetTempFileName we'd loop forever throwing an
+	IOException in the FileStream constructor every time.
+
+2011-09-18  Sebastien Pouliot  <sebastien at xamarin.com>
+
+	Expose Dispose under the NET_2_1 based profiles. Fix bug #154
+
+2011-09-09  Sebastien Pouliot  <sebastien at xamarin.com>
+
+	Throwing IsolatedStorageException is a Moonlight-behavior and
+	should not have been exposed to other 2.1 profiles
+
+2011-08-31  Atsushi Eno  <atsushi at ximian.com>
+
+	Fix invalid path check for Windows regarding ':'.
+
 2011-08-07  Bassam Tabbara  <bassam at symform.com>
 
 	Remove Console.WriteLine from DriveInfo.GetDrives()
diff --git a/mcs/class/corlib/System.IO/FileStream.cs b/mcs/class/corlib/System.IO/FileStream.cs
index 2073d7f..7ad1956 100644
--- a/mcs/class/corlib/System.IO/FileStream.cs
+++ b/mcs/class/corlib/System.IO/FileStream.cs
@@ -220,7 +220,7 @@ namespace System.IO
 			}
 
 			if (access < FileAccess.Read || access > FileAccess.ReadWrite) {
-#if NET_2_1
+#if MOONLIGHT
 				if (anonymous)
 					throw new IsolatedStorageException ("Enum value for FileAccess was out of legal range.");
 				else
@@ -229,7 +229,7 @@ namespace System.IO
 			}
 
 			if (share < FileShare.None || share > (FileShare.ReadWrite | FileShare.Delete)) {
-#if NET_2_1
+#if MOONLIGHT
 				if (anonymous)
 					throw new IsolatedStorageException ("Enum value for FileShare was out of legal range.");
 				else
@@ -275,7 +275,7 @@ namespace System.IO
 					// don't leak the path information for isolated storage
 					string msg = Locale.GetText ("Could not find a part of the path \"{0}\".");
 					string fname = (anonymous) ? dname : Path.GetFullPath (path);
-#if NET_2_1
+#if MOONLIGHT
 					// don't use GetSecureFileName for the directory name
 					throw new IsolatedStorageException (String.Format (msg, fname));
 #else
@@ -289,7 +289,7 @@ namespace System.IO
 				// don't leak the path information for isolated storage
 				string msg = Locale.GetText ("Could not find file \"{0}\".");
 				string fname = GetSecureFileName (path);
-#if NET_2_1
+#if MOONLIGHT
 				throw new IsolatedStorageException (String.Format (msg, fname));
 #else
 				throw new FileNotFoundException (String.Format (msg, fname), fname);
diff --git a/mcs/class/corlib/System.IO/FileSystemInfo.cs b/mcs/class/corlib/System.IO/FileSystemInfo.cs
index 46f67bd..9000e47 100644
--- a/mcs/class/corlib/System.IO/FileSystemInfo.cs
+++ b/mcs/class/corlib/System.IO/FileSystemInfo.cs
@@ -256,6 +256,11 @@ namespace System.IO {
 				throw new ArgumentException ("An empty file name is not valid.");
 			if (path.IndexOfAny (Path.InvalidPathChars) != -1)
 				throw new ArgumentException ("Illegal characters in path.");
+			if (Environment.IsRunningOnWindows) {
+				int idx = path.IndexOf (':');
+				if (idx >= 0 && idx != 1)
+					throw new ArgumentException ("path");
+			}
 		}
 
 		internal MonoIOStat stat;
diff --git a/mcs/class/corlib/System.IO/LogcatTextWriter.cs b/mcs/class/corlib/System.IO/LogcatTextWriter.cs
new file mode 100644
index 0000000..da9e307
--- /dev/null
+++ b/mcs/class/corlib/System.IO/LogcatTextWriter.cs
@@ -0,0 +1,78 @@
+#if MONODROID
+
+using System;
+using System.IO;
+using System.Text;
+using System.Runtime.InteropServices;
+
+namespace System.IO {
+
+	class LogcatTextWriter : TextWriter {
+
+		const string LibLog = "/system/lib/liblog.so";
+
+		TextWriter stdout;
+		readonly string appname;
+		StringBuilder line = new StringBuilder ();
+
+		public LogcatTextWriter (string appname, TextWriter stdout)
+		{
+			this.appname = appname;
+			this.stdout = stdout;
+		}
+
+		public override Encoding Encoding {
+			get {return Encoding.UTF8;}
+		}
+
+		public override void Write (string s)
+		{
+			foreach (char c in s)
+				Write (c);
+		}
+
+		public override void Write (char value)
+		{
+			if (value == '\n')
+				WriteLine ();
+			else
+				line.Append (value);
+		}
+
+		public override void WriteLine ()
+		{
+			var o = line.ToString ();
+			line.Clear ();
+
+			Log (LogLevel.Info, appname, o);
+			stdout.WriteLine (o);
+		}
+
+		enum LogLevel {
+			Unknown,
+			Default,
+			Verbose,
+			Debug,
+			Info,
+			Warn,
+			Error,
+			Fatal,
+			Silent
+		}
+
+		public static bool IsRunningOnAndroid ()
+		{
+			return File.Exists (LibLog);
+		}
+
+		[DllImport (LibLog)]
+		static extern void __android_log_print (LogLevel level, string appname, string format, string args, IntPtr zero);
+
+		static void Log (LogLevel level, string appname, string log)
+		{
+			__android_log_print (level, appname, "%s", log, IntPtr.Zero);
+		}
+	}
+}
+
+#endif  // MONODROID
diff --git a/mcs/class/corlib/System.IO/MonoIO.cs b/mcs/class/corlib/System.IO/MonoIO.cs
index 399bdfc..ce16f66 100644
--- a/mcs/class/corlib/System.IO/MonoIO.cs
+++ b/mcs/class/corlib/System.IO/MonoIO.cs
@@ -41,6 +41,8 @@ using System.IO.IsolatedStorage;
 namespace System.IO
 {
 	unsafe internal sealed class MonoIO {
+		internal static int FileAlreadyExistsHResult = unchecked ((int) 0x80070000) | (int)MonoIOError.ERROR_FILE_EXISTS;
+
 		public static readonly FileAttributes
 			InvalidFileAttributes = (FileAttributes)(-1);
 
@@ -61,7 +63,7 @@ namespace System.IO
 				return new UnauthorizedAccessException ("Access to the path is denied.");
 			case MonoIOError.ERROR_FILE_EXISTS:
 				string message = "Cannot create a file that already exist.";
-				return new IOException (message, unchecked ((int) 0x80070000) | (int) error);
+				return new IOException (message, FileAlreadyExistsHResult);
 			default:
 				/* Add more mappings here if other
 				 * errors trigger the named but empty
@@ -82,7 +84,7 @@ namespace System.IO
 			// FIXME: add more exception mappings here
 			case MonoIOError.ERROR_FILE_NOT_FOUND:
 				message = String.Format ("Could not find file \"{0}\"", path);
-#if NET_2_1
+#if MOONLIGHT
 				return new IsolatedStorageException (message);
 #else
 				return new FileNotFoundException (message, path);
@@ -93,7 +95,7 @@ namespace System.IO
 				
 			case MonoIOError.ERROR_PATH_NOT_FOUND:
 				message = String.Format ("Could not find a part of the path \"{0}\"", path);
-#if NET_2_1
+#if MOONLIGHT
 				return new IsolatedStorageException (message);
 #else
 				return new DirectoryNotFoundException (message);
diff --git a/mcs/class/corlib/System.IO/Path.cs b/mcs/class/corlib/System.IO/Path.cs
index 510859a..cd4244e 100644
--- a/mcs/class/corlib/System.IO/Path.cs
+++ b/mcs/class/corlib/System.IO/Path.cs
@@ -439,6 +439,7 @@ namespace System.IO {
 			string path;
 			Random rnd;
 			int num = 0;
+			int count = 0;
 
 			SecurityManager.EnsureElevatedPermissions (); // this is a no-op outside moonlight
 
@@ -452,19 +453,9 @@ namespace System.IO {
 					f = new FileStream (path, FileMode.CreateNew, FileAccess.ReadWrite, FileShare.Read,
 							    8192, false, (FileOptions) 1);
 				}
-				catch (SecurityException) {
-					// avoid an endless loop
-					throw;
-				}
-				catch (UnauthorizedAccessException) {
-					// This can happen if we don't have write permission to /tmp
-					throw;
-				}
-				catch (DirectoryNotFoundException) {
-					// This happens when TMPDIR does not exist
-					throw;
-				}
-				catch {
+				catch (IOException ex){
+					if (ex.hresult != MonoIO.FileAlreadyExistsHResult || count ++ > 65536)
+						throw;
 				}
 			} while (f == null);
 			
@@ -841,6 +832,11 @@ namespace System.IO {
 				throw new ArgumentException (Locale.GetText ("Path is empty"));
 			if (path.IndexOfAny (Path.InvalidPathChars) != -1)
 				throw new ArgumentException (Locale.GetText ("Path contains invalid chars"));
+			if (Environment.IsRunningOnWindows) {
+				int idx = path.IndexOf (':');
+				if (idx >= 0 && idx != 1)
+					throw new ArgumentException (parameterName);
+			}
 #if MOONLIGHT
 			// On Moonlight (SL4+) there are some limitations in "Elevated Trust"
 			if (SecurityManager.HasElevatedPermissions) {
diff --git a/mcs/class/corlib/System.Reflection/Assembly.cs b/mcs/class/corlib/System.Reflection/Assembly.cs
index e7f34d9..b46e4f4 100644
--- a/mcs/class/corlib/System.Reflection/Assembly.cs
+++ b/mcs/class/corlib/System.Reflection/Assembly.cs
@@ -281,8 +281,13 @@ namespace System.Reflection {
 					"name");
 
 			ManifestResourceInfo info = GetManifestResourceInfo (name);
-			if (info == null)
-				return null;
+			if (info == null) {
+				Assembly a = AppDomain.CurrentDomain.DoResourceResolve (name, this);
+				if (a != null && a != this)
+					return a.GetManifestResourceStream (name);
+				else
+					return null;
+			}
 
 			if (info.ReferencedAssembly != null)
 				return info.ReferencedAssembly.GetManifestResourceStream (name);
diff --git a/mcs/class/corlib/System.Reflection/ChangeLog b/mcs/class/corlib/System.Reflection/ChangeLog
index 1aed42f..2a89ef3 100644
--- a/mcs/class/corlib/System.Reflection/ChangeLog
+++ b/mcs/class/corlib/System.Reflection/ChangeLog
@@ -1,3 +1,7 @@
+2011-09-04  Zoltan Varga  <vargaz at gmail.com>
+
+	Implement AppDomain.ResourceResolve. Fixes #579.
+
 2011-04-11  Zoltan Varga  <vargaz at gmail.com>
 
 	Revert "Add checks to ParameterBuilder.SetConstant () to avoid an
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/ChangeLog b/mcs/class/corlib/System.Runtime.InteropServices/ChangeLog
index 73f497b..fcb0072 100644
--- a/mcs/class/corlib/System.Runtime.InteropServices/ChangeLog
+++ b/mcs/class/corlib/System.Runtime.InteropServices/ChangeLog
@@ -1,3 +1,9 @@
+2011-10-04  Sebastien Pouliot  <sebastien at xamarin.com>
+
+	Internalize [ComImport] in MONOTOUCH profile since it can make the
+	(unlinked) application code crash (and we better spot this at
+	compile time). Fix assistly #2357
+
 2011-01-22  Gonzalo Paniagua Javier  <gonzalo.mono at gmail.com>
 
 	Fix Dispose()
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/ComImportAttribute.cs b/mcs/class/corlib/System.Runtime.InteropServices/ComImportAttribute.cs
index 5722304..7bf558e 100644
--- a/mcs/class/corlib/System.Runtime.InteropServices/ComImportAttribute.cs
+++ b/mcs/class/corlib/System.Runtime.InteropServices/ComImportAttribute.cs
@@ -4,10 +4,8 @@
 // Name: Duncan Mak  (duncan at ximian.com)
 //
 // (C) Ximian, Inc.
-//
-
-//
 // Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+// Copyright 2011 Xamarin Inc. All rights reserved.
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
@@ -29,15 +27,21 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-using System;
-
 namespace System.Runtime.InteropServices {
 
 	[AttributeUsage (AttributeTargets.Class |
 			 AttributeTargets.Interface, Inherited=false)]
 	[ComVisible (true)]
-	public sealed class ComImportAttribute : Attribute
-	{
+#if MONOTOUCH
+	// code with [ComImport] will assert when running on device (AOT)
+	// the linker removes the attribute but it's not used, by default, on 
+	// user code. ref: assistly #2357
+	internal
+#else
+	public 
+#endif
+	sealed class ComImportAttribute : Attribute {
+
 		public ComImportAttribute ()
 		{
 		}
diff --git a/mcs/class/corlib/System.Security.Cryptography/ChangeLog b/mcs/class/corlib/System.Security.Cryptography/ChangeLog
index 2d5f66b..784536e 100644
--- a/mcs/class/corlib/System.Security.Cryptography/ChangeLog
+++ b/mcs/class/corlib/System.Security.Cryptography/ChangeLog
@@ -1,3 +1,9 @@
+2011-09-08  Sebastien Pouliot  <sebastien at xamarin.com>
+
+	Return null instead of catching Activator exception (and return
+	null). What was a corner case before is now very common when the
+	linker is used (e.g. monotouch, m4a). Reported in assistly #1741
+
 2011-08-05  Miguel de Icaza  <miguel at gnome.org>
 
 	Merge pull request #129 from grumpydev/CryptoFixo
diff --git a/mcs/class/corlib/System.Security.Cryptography/CryptoConfig.cs b/mcs/class/corlib/System.Security.Cryptography/CryptoConfig.cs
index 8a923c7..c9b002c 100644
--- a/mcs/class/corlib/System.Security.Cryptography/CryptoConfig.cs
+++ b/mcs/class/corlib/System.Security.Cryptography/CryptoConfig.cs
@@ -8,6 +8,7 @@
 // (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
 // Copyright (C) Tim Coleman, 2004
 // Copyright (C) 2004-2007,2011 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2011 Xamarin Inc. http://www.xamarin.com
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
@@ -489,6 +490,8 @@ public partial      class CryptoConfig {
 			if (algo == null)
 				algo = name;
 			algoClass = Type.GetType (algo);
+			if (algoClass == null)
+				return null;
 			// call the constructor for the type
 			return Activator.CreateInstance (algoClass, args);
 		}
diff --git a/mcs/class/corlib/System.Text/ChangeLog b/mcs/class/corlib/System.Text/ChangeLog
index ec42a0f..35db456 100644
--- a/mcs/class/corlib/System.Text/ChangeLog
+++ b/mcs/class/corlib/System.Text/ChangeLog
@@ -1,3 +1,8 @@
+2011-08-31  Atsushi Eno  <atsushi at ximian.com>
+
+	EncoderReplacementFallbackBuffer.Reset() did not really reset its
+	internals.
+
 2011-01-25  Geoff Norton  <grompf at sublimeintervention.com>
 
 	Further .NET 4.0 ification of the mobile profile
diff --git a/mcs/class/corlib/System.Text/EncoderReplacementFallbackBuffer.cs b/mcs/class/corlib/System.Text/EncoderReplacementFallbackBuffer.cs
index 82beb9a..2eae1af 100644
--- a/mcs/class/corlib/System.Text/EncoderReplacementFallbackBuffer.cs
+++ b/mcs/class/corlib/System.Text/EncoderReplacementFallbackBuffer.cs
@@ -94,6 +94,7 @@ namespace System.Text
 
 		public override void Reset ()
 		{
+			fallback_assigned = false;
 			current = 0;
 		}
 	}
diff --git a/mcs/class/corlib/System.Threading.Tasks/ChangeLog b/mcs/class/corlib/System.Threading.Tasks/ChangeLog
index b29320b..a4fd3ae 100644
--- a/mcs/class/corlib/System.Threading.Tasks/ChangeLog
+++ b/mcs/class/corlib/System.Threading.Tasks/ChangeLog
@@ -1,3 +1,37 @@
+2011-11-07  Jérémie Laval  <jeremie.laval at gmail.com>
+
+	Import TPL changes from master
+
+2011-09-19  Jérémie Laval  <jeremie.laval at gmail.com>
+
+	Fix for #892
+
+2011-09-19  Jérémie Laval  <jeremie.laval at gmail.com>
+
+	Fix more argument checking for Task<T>
+
+2011-09-19  Jérémie Laval  <jeremie.laval at gmail.com>
+
+	Check that supplied function argument in a Task<T> ctor isn't null
+
+2011-09-13  Jérémie Laval  <jeremie.laval at gmail.com>
+
+	Add missing files.
+
+2011-09-11  Jérémie Laval  <jeremie.laval at gmail.com>
+
+	Backport System.Threading.Tasks from master to mono-2-10
+
+2011-09-06  Jérémie Laval  <jeremie.laval at gmail.com>
+
+	Use a TaskCompletionSource in non-generic ContinueWhenAny case.
+	Fix #647.
+
+2011-08-28  Jérémie Laval  <jeremie.laval at gmail.com>
+
+	Check that CancellationToken coming from
+	OperationCanceledException isn't None. Fix #472.
+
 2011-08-20  Jérémie Laval  <jeremie.laval at gmail.com>
 
 	Throw when a non-finished task is started
diff --git a/mcs/class/corlib/System.Threading.Tasks/EventSlots.cs b/mcs/class/corlib/System.Threading.Tasks/EventSlots.cs
new file mode 100644
index 0000000..3da451a
--- /dev/null
+++ b/mcs/class/corlib/System.Threading.Tasks/EventSlots.cs
@@ -0,0 +1,63 @@
+//
+// EventSlots.cs
+//
+// Authors:
+//    Jérémie Laval <jeremie dot laval at xamarin dot com>
+//
+// Copyright 2011 Xamarin Inc (http://www.xamarin.com).
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+//
+
+#if NET_4_0 || MOBILE
+
+namespace System.Threading.Tasks
+{
+	class ManualEventSlot : IContinuation
+	{
+		ManualResetEventSlim evt;
+		public ManualEventSlot (ManualResetEventSlim evt)
+		{
+			this.evt = evt;
+		}
+
+		public void Execute ()
+		{
+			evt.Set ();
+		}
+	}
+
+	class CountdownEventSlot : IContinuation
+	{
+		CountdownEvent evt;
+		public CountdownEventSlot (CountdownEvent evt)
+		{
+			this.evt = evt;
+		}
+
+		public void Execute ()
+		{
+			evt.Signal ();
+		}
+	}
+}
+
+#endif
+
diff --git a/mcs/class/corlib/System.Threading.Tasks/Future.cs b/mcs/class/corlib/System.Threading.Tasks/Future.cs
deleted file mode 100644
index f9937df..0000000
--- a/mcs/class/corlib/System.Threading.Tasks/Future.cs
+++ /dev/null
@@ -1,185 +0,0 @@
-// Future.cs
-//
-// Copyright (c) 2008 Jérémie "Garuma" Laval
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-//
-
-#if NET_4_0 || MOBILE
-using System;
-
-namespace System.Threading.Tasks
-{
-	[System.Diagnostics.DebuggerDisplay ("Id = {Id}, Status = {Status}, Method = {DebuggerDisplayMethodDescription}, Result = {DebuggerDisplayResultDescription}")]
-	[System.Diagnostics.DebuggerTypeProxy ("System.Threading.Tasks.SystemThreadingTasks_FutureDebugView`1")]
-	public class Task<TResult>: Task
-	{
-		TResult value;
-		static TaskFactory<TResult> factory = new TaskFactory<TResult> ();
-		
-		Func<object, TResult> function;
-		object state;
-		
-		[System.Diagnostics.DebuggerBrowsable (System.Diagnostics.DebuggerBrowsableState.Never)]
-		public TResult Result {
-			get {
-				if (function != null)
-					Wait ();
-				else if (Exception != null)
-					throw Exception;
-				return value;
-			}
-			internal set {
-				this.value = value;
-			}
-		}
-		
-		public static new TaskFactory<TResult> Factory {
-			get {
-				return factory;
-			}
-		}
-		
-		public Task (Func<TResult> function) : this (function, TaskCreationOptions.None)
-		{
-			
-		}
-		
-		public Task (Func<TResult> function, CancellationToken cancellationToken)
-			: this (function == null ? (Func<object, TResult>)null : (o) => function(), null, cancellationToken, TaskCreationOptions.None)
-		{
-			
-		}
-		
-		public Task (Func<TResult> function, TaskCreationOptions creationOptions)
-			: this (function == null ? (Func<object, TResult>)null : (o) => function(), null, CancellationToken.None, creationOptions)
-		{
-			
-		}
-		
-		public Task (Func<TResult> function, CancellationToken cancellationToken, TaskCreationOptions creationOptions)
-			: this (function == null ? (Func<object, TResult>)null : (o) => function(), null, cancellationToken, creationOptions)
-		{
-			
-		}
-		
-		public Task (Func<object, TResult> function, object state) : this (function, state, TaskCreationOptions.None)
-		{
-			
-		}
-		
-		public Task (Func<object, TResult> function, object state, CancellationToken cancellationToken)
-			: this (function, state, cancellationToken, TaskCreationOptions.None)
-		{
-			
-		}
-		
-		public Task (Func<object, TResult> function, object state, TaskCreationOptions creationOptions)
-			: this (function, state, CancellationToken.None, creationOptions)
-		{
-			
-		}
-		
-		public Task (Func<object, TResult> function, object state, CancellationToken cancellationToken, TaskCreationOptions creationOptions)
-			: base (null, state, cancellationToken, creationOptions)
-		{
-			this.function = function;
-			this.state = state;
-		}
-		
-		internal override void InnerInvoke ()
-		{
-			if (function != null)
-				value = function (state);
-			
-			function = null;
-			state = null;
-		}
-		
-		public Task ContinueWith (Action<Task<TResult>> continuationAction)
-		{
-			return ContinueWith (continuationAction, TaskContinuationOptions.None);
-		}
-		
-		public Task ContinueWith (Action<Task<TResult>> continuationAction, TaskContinuationOptions continuationOptions)
-		{
-			return ContinueWith (continuationAction, CancellationToken.None, continuationOptions, TaskScheduler.Current);
-		}
-		
-		public Task ContinueWith (Action<Task<TResult>> continuationAction, CancellationToken cancellationToken)
-		{
-			return ContinueWith (continuationAction, cancellationToken, TaskContinuationOptions.None, TaskScheduler.Current);
-		}
-		
-		public Task ContinueWith (Action<Task<TResult>> continuationAction, TaskScheduler scheduler)
-		{
-			return ContinueWith (continuationAction, CancellationToken.None, TaskContinuationOptions.None, scheduler);
-		}
-		
-		public Task ContinueWith (Action<Task<TResult>> continuationAction, CancellationToken cancellationToken,
-		                          TaskContinuationOptions continuationOptions, TaskScheduler scheduler)
-		{
-			if (continuationAction == null)
-				throw new ArgumentNullException ("continuationFunction");
-			if (scheduler == null)
-				throw new ArgumentNullException ("scheduler");
-
-			Task t = new Task ((o) => continuationAction ((Task<TResult>)o), this, cancellationToken, GetCreationOptions (continuationOptions));
-			ContinueWithCore (t, continuationOptions, scheduler);
-			
-			return t;
-		}
-		
-		public Task<TNewResult> ContinueWith<TNewResult> (Func<Task<TResult>, TNewResult> continuationFunction)
-		{
-			return ContinueWith<TNewResult> (continuationFunction, TaskContinuationOptions.None);
-		}
-		
-		public Task<TNewResult> ContinueWith<TNewResult> (Func<Task<TResult>, TNewResult> continuationFunction, CancellationToken cancellationToken)
-		{
-			return ContinueWith<TNewResult> (continuationFunction, cancellationToken, TaskContinuationOptions.None, TaskScheduler.Current);
-		}
-		
-		public Task<TNewResult> ContinueWith<TNewResult> (Func<Task<TResult>, TNewResult> continuationFunction, TaskContinuationOptions continuationOptions)
-		{
-			return ContinueWith<TNewResult> (continuationFunction, CancellationToken.None, continuationOptions, TaskScheduler.Current);
-		}
-		
-		public Task<TNewResult> ContinueWith<TNewResult> (Func<Task<TResult>, TNewResult> continuationFunction, TaskScheduler scheduler)
-		{
-			return ContinueWith<TNewResult> (continuationFunction, CancellationToken.None, TaskContinuationOptions.None, scheduler);
-		}
-		
-		public Task<TNewResult> ContinueWith<TNewResult> (Func<Task<TResult>, TNewResult> continuationFunction,
-		                                                  CancellationToken cancellationToken,
-		                                                  TaskContinuationOptions continuationOptions,
-		                                                  TaskScheduler scheduler)
-		{
-			Task<TNewResult> t = new Task<TNewResult> ((o) => continuationFunction ((Task<TResult>)o),
-			                                           this,
-			                                           cancellationToken,
-			                                           GetCreationOptions (continuationOptions));
-			ContinueWithCore (t, continuationOptions, scheduler);
-			
-			return t;
-		}
-	}
-}
-#endif
diff --git a/mcs/class/corlib/System.Threading.Tasks/Scheduler.cs b/mcs/class/corlib/System.Threading.Tasks/Scheduler.cs
deleted file mode 100644
index eb3f884..0000000
--- a/mcs/class/corlib/System.Threading.Tasks/Scheduler.cs
+++ /dev/null
@@ -1,137 +0,0 @@
-// Scheduler.cs
-//
-// Copyright (c) 2008 Jérémie "Garuma" Laval
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-//
-
-#if NET_4_0 || MOBILE
-using System;
-using System.Collections.Concurrent;
-
-namespace System.Threading.Tasks
-{
-	internal class Scheduler: TaskScheduler
-	{
-		readonly IProducerConsumerCollection<Task> workQueue;
-		readonly ThreadWorker[]        workers;
-		readonly ManualResetEvent      pulseHandle = new ManualResetEvent (false);
-
-		public Scheduler ()
-			: this (Environment.ProcessorCount, ThreadPriority.Normal)
-		{
-			
-		}
-		
-		public Scheduler (int maxWorker, ThreadPriority priority)
-		{
-			workQueue = new ConcurrentQueue<Task> ();
-			workers = new ThreadWorker [maxWorker];
-			
-			for (int i = 0; i < maxWorker; i++) {
-				workers [i] = new ThreadWorker (workers, i, workQueue, priority, pulseHandle);
-				workers [i].Pulse ();
-			}
-		}
-
-		protected internal override void QueueTask (Task t)
-		{
-			// Add to the shared work pool
-			workQueue.TryAdd (t);
-			// Wake up some worker if they were asleep
-			PulseAll ();
-		}
-
-		internal override void ParticipateUntil (Task task)
-		{
-			if (task.IsCompleted)
-				return;
-
-			ManualResetEventSlim evt = new ManualResetEventSlim (false);
-			task.ContinueWith (_ => evt.Set (), TaskContinuationOptions.ExecuteSynchronously);
-			if (evt.IsSet)
-				return;
-			
-			ParticipateUntilInternal (task, evt, -1);
-		}
-		
-		internal override bool ParticipateUntil (Task task, ManualResetEventSlim evt, int millisecondsTimeout)
-		{
-			if (task.IsCompleted)
-				return false;
-
-			bool isFromPredicate = true;
-			task.ContinueWith (_ => { isFromPredicate = false; evt.Set (); }, TaskContinuationOptions.ExecuteSynchronously);
-			
-			ParticipateUntilInternal (task, evt, millisecondsTimeout);
-
-			return isFromPredicate;
-		}
-		
-		// Called with Task.WaitAll(someTasks) or Task.WaitAny(someTasks) so that we can remove ourselves
-		// also when our wait condition is ok
-		public void ParticipateUntilInternal (Task self, ManualResetEventSlim evt, int millisecondsTimeout)
-		{
-			if (millisecondsTimeout == -1)
-				millisecondsTimeout = int.MaxValue;
-			ThreadWorker.WorkerMethod (self, evt, millisecondsTimeout, workQueue, workers, pulseHandle);
-		}
-
-		static bool TaskCompletedPredicate (Task self)
-		{
-			return self.IsCompleted;
-		}
-		
-		internal override void PulseAll ()
-		{
-			pulseHandle.Set ();
-		}
-		
-		public void Dispose ()
-		{
-			foreach (ThreadWorker w in workers)
-				w.Dispose ();
-		}
-		#region Scheduler dummy stubs
-		protected override System.Collections.Generic.IEnumerable<Task> GetScheduledTasks ()
-		{
-			throw new System.NotImplementedException();
-		}
-
-		protected internal override bool TryDequeue (Task task)
-		{
-			throw new System.NotImplementedException();
-		}
-
-		protected override bool TryExecuteTaskInline (Task task, bool taskWasPreviouslyQueued)
-		{
-			task.Execute (null);
-			return true;
-		}
-		
-		public override int MaximumConcurrencyLevel {
-			get {
-				return base.MaximumConcurrencyLevel;
-			}
-		}
-		#endregion
-	}
-}
-#endif
diff --git a/mcs/class/corlib/System.Threading.Tasks/SchedulerProxy.cs b/mcs/class/corlib/System.Threading.Tasks/SchedulerProxy.cs
deleted file mode 100644
index d17bb32..0000000
--- a/mcs/class/corlib/System.Threading.Tasks/SchedulerProxy.cs
+++ /dev/null
@@ -1,117 +0,0 @@
-// 
-// SchedulerProxy.cs
-//  
-// Author:
-//       Jérémie "Garuma" Laval <jeremie.laval at gmail.com>
-// 
-// Copyright (c) 2009 Jérémie "Garuma" Laval
-// 
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-// 
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-// 
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-#if NET_4_0 || MOBILE
-using System;
-using System.Threading;
-using System.Reflection;
-
-namespace System.Threading.Tasks
-{
-	internal class SchedulerProxy
-	{
-		TaskScheduler scheduler;
-
-		Action<Task> participateUntil1;
-		Func<Task, ManualResetEventSlim, int, bool> participateUntil2;
-
-		public SchedulerProxy (TaskScheduler scheduler)
-		{
-			this.scheduler = scheduler;
-			FindMonoSpecificImpl ();
-		}
-
-		void FindMonoSpecificImpl ()
-		{
-			// participateUntil1
-			FetchMethod<Action<Task>> ("MonoParticipateUntil",
-			                           new[] { typeof(Task) },
-			                           ref participateUntil1);
-			// participateUntil2
-			FetchMethod<Func<Task, ManualResetEventSlim, int, bool>> ("MonoParticipateUntil",
-			                                                          new[] { typeof(Task), typeof(ManualResetEventSlim), typeof(int) },
-			                                                          ref participateUntil2);
-		}
-
-		void FetchMethod<TDelegate> (string name, Type[] types, ref TDelegate field) where TDelegate : class
-		{
-			var method = scheduler.GetType ().GetMethod (name,
-			                                             BindingFlags.Instance | BindingFlags.Public,
-			                                             null,
-			                                             types,
-			                                             null);
-			if (method == null)
-				return;
-			field = Delegate.CreateDelegate (typeof(TDelegate), scheduler, method) as TDelegate;
-		}
-
-		public void ParticipateUntil (Task task)
-		{
-			if (participateUntil1 != null) {
-				participateUntil1 (task);
-				return;
-			}
-
-			if (task.Status == TaskStatus.WaitingToRun)
-				task.Execute (null);
-
-			if (task.IsCompleted)
-				return;
-
-			ManualResetEventSlim evt = new ManualResetEventSlim (false);
-			task.ContinueWith (_ => evt.Set (), TaskContinuationOptions.ExecuteSynchronously);
-
-			ParticipateUntil (evt, -1);
-		}
-		
-		public bool ParticipateUntil (Task task, ManualResetEventSlim evt, int millisecondsTimeout)
-		{
-			if (task.IsCompleted)
-				return false;
-
-			if (participateUntil2 != null)
-				return participateUntil2 (task, evt, millisecondsTimeout);
-
-			bool fromPredicate = true;
-			task.ContinueWith (_ => { fromPredicate = false; evt.Set (); }, TaskContinuationOptions.ExecuteSynchronously);
-
-			ParticipateUntil (evt, millisecondsTimeout);
-
-			return fromPredicate;
-		}
-
-		void ParticipateUntil (ManualResetEventSlim evt, int millisecondsTimeout)
-		{
-			evt.Wait (millisecondsTimeout);
-		}
-
-		public void PulseAll ()
-		{
-			
-		}
-	}
-}
-#endif
diff --git a/mcs/class/corlib/System.Threading.Tasks/SynchronizationContextScheduler.cs b/mcs/class/corlib/System.Threading.Tasks/SynchronizationContextScheduler.cs
index 4fdf0d6..e72fdd2 100644
--- a/mcs/class/corlib/System.Threading.Tasks/SynchronizationContextScheduler.cs
+++ b/mcs/class/corlib/System.Threading.Tasks/SynchronizationContextScheduler.cs
@@ -31,14 +31,15 @@ using System.Threading;
 
 namespace System.Threading.Tasks
 {
-	public class SynchronizationContextScheduler : TaskScheduler
+	sealed class SynchronizationContextScheduler : TaskScheduler
 	{
 		readonly SynchronizationContext ctx;
-		static readonly SendOrPostCallback callback = TaskLaunchWrapper;
+		readonly SendOrPostCallback callback;
 
 		public SynchronizationContextScheduler (SynchronizationContext ctx)
 		{
 			this.ctx = ctx;
+			this.callback = TaskLaunchWrapper;
 		}
 
 		protected internal override void QueueTask (Task task)
@@ -46,9 +47,9 @@ namespace System.Threading.Tasks
 			ctx.Post (callback, task);
 		}
 
-		static void TaskLaunchWrapper (object obj)
+		void TaskLaunchWrapper (object obj)
 		{
-			((Task)obj).Execute (null);
+			TryExecuteTask ((Task)obj);
 		}
 
 		protected override System.Collections.Generic.IEnumerable<Task> GetScheduledTasks ()
@@ -63,15 +64,8 @@ namespace System.Threading.Tasks
 
 		protected override bool TryExecuteTaskInline (Task task, bool taskWasPreviouslyQueued)
 		{
-			if (task.IsCompleted)
-				return false;
-
-			if (task.Status == TaskStatus.WaitingToRun) {
-				task.Execute (null);
-				return true;
-			}
-
-			return false;
+			ctx.Send (callback, task);
+			return true;
 		}
 
 		public override int MaximumConcurrencyLevel {
diff --git a/mcs/class/corlib/System.Threading.Tasks/Task.cs b/mcs/class/corlib/System.Threading.Tasks/Task.cs
index 392aed5..b479035 100644
--- a/mcs/class/corlib/System.Threading.Tasks/Task.cs
+++ b/mcs/class/corlib/System.Threading.Tasks/Task.cs
@@ -1,6 +1,12 @@
+//
 // Task.cs
 //
+// Authors:
+//    Marek Safar  <marek.safar at gmail.com>
+//    Jérémie Laval <jeremie dot laval at xamarin dot com>
+//
 // Copyright (c) 2008 Jérémie "Garuma" Laval
+// Copyright 2011 Xamarin Inc (http://www.xamarin.com).
 //
 // Permission is hereby granted, free of charge, to any person obtaining a copy
 // of this software and associated documentation files (the "Software"), to deal
@@ -27,13 +33,17 @@
 using System;
 using System.Threading;
 using System.Collections.Concurrent;
+using System.Collections.Generic;
+using System.Runtime.CompilerServices;
 
 namespace System.Threading.Tasks
 {
-	[System.Diagnostics.DebuggerDisplay ("Id = {Id}, Status = {Status}, Method = {DebuggerDisplayMethodDescription}")]
-	[System.Diagnostics.DebuggerTypeProxy ("System.Threading.Tasks.SystemThreadingTasks_TaskDebugView")]
+	[System.Diagnostics.DebuggerDisplay ("Id = {Id}, Status = {Status}")]
+	[System.Diagnostics.DebuggerTypeProxy (typeof (TaskDebuggerView))]
 	public class Task : IDisposable, IAsyncResult
 	{
+		const TaskCreationOptions TaskCreationOptionsContinuation = (TaskCreationOptions) (1 << 10);
+
 		// With this attribute each thread has its own value so that it's correct for our Schedule code
 		// and for Parent property.
 		[System.ThreadStatic]
@@ -44,54 +54,65 @@ namespace System.Threading.Tasks
 		Task parent;
 		
 		static int          id = -1;
-		static TaskFactory  defaultFactory = new TaskFactory ();
-		
-		CountdownEvent childTasks = new CountdownEvent (1);
+		static readonly TaskFactory defaultFactory = new TaskFactory ();
+
+		CountdownEvent childTasks;
 		
 		int                 taskId;
 		TaskCreationOptions taskCreationOptions;
 		
-		TaskScheduler       scheduler;
+		internal TaskScheduler       scheduler;
 
-		ManualResetEventSlim schedWait = new ManualResetEventSlim (false);
-		
-		volatile AggregateException  exception;
-		volatile bool                exceptionObserved;
+		TaskExceptionSlot exSlot;
 
 		TaskStatus          status;
-		
-		Action<object> action;
+
+		TaskActionInvoker invoker;
 		object         state;
-		AtomicBooleanValue executing;
+		internal AtomicBooleanValue executing;
 
-		ConcurrentQueue<EventHandler> completed = new ConcurrentQueue<EventHandler> ();
+		TaskCompletionQueue<IContinuation> continuations;
 
 		CancellationToken token;
+		CancellationTokenRegistration? cancellationRegistration;
+
+		internal const TaskCreationOptions WorkerTaskNotSupportedOptions = TaskCreationOptions.LongRunning | TaskCreationOptions.PreferFairness;
 
 		const TaskCreationOptions MaxTaskCreationOptions =
+#if NET_4_5
+			TaskCreationOptions.DenyChildAttach | TaskCreationOptions.HideScheduler |
+#endif
 			TaskCreationOptions.PreferFairness | TaskCreationOptions.LongRunning | TaskCreationOptions.AttachedToParent;
 
-		public Task (Action action) : this (action, TaskCreationOptions.None)
+		public Task (Action action)
+			: this (action, TaskCreationOptions.None)
 		{
 			
 		}
 		
-		public Task (Action action, TaskCreationOptions creationOptions) : this (action, CancellationToken.None, creationOptions)
+		public Task (Action action, TaskCreationOptions creationOptions)
+			: this (action, CancellationToken.None, creationOptions)
 		{
 			
 		}
 		
-		public Task (Action action, CancellationToken cancellationToken) : this (action, cancellationToken, TaskCreationOptions.None)
+		public Task (Action action, CancellationToken cancellationToken)
+			: this (action, cancellationToken, TaskCreationOptions.None)
 		{
 			
 		}
 		
 		public Task (Action action, CancellationToken cancellationToken, TaskCreationOptions creationOptions)
-			: this ((o) => { if (action != null) action (); }, null, cancellationToken, creationOptions)
+			: this (TaskActionInvoker.Create (action), null, cancellationToken, creationOptions, current)
 		{
+			if (action == null)
+				throw new ArgumentNullException ("action");
+			if (creationOptions > MaxTaskCreationOptions || creationOptions < TaskCreationOptions.None)
+				throw new ArgumentOutOfRangeException ("creationOptions");
 		}
 		
-		public Task (Action<object> action, object state) : this (action, state, TaskCreationOptions.None)
+		public Task (Action<object> action, object state)
+			: this (action, state, TaskCreationOptions.None)
 		{	
 		}
 		
@@ -104,31 +125,33 @@ namespace System.Threading.Tasks
 			: this (action, state, cancellationToken, TaskCreationOptions.None)
 		{	
 		}
-		
+
 		public Task (Action<object> action, object state, CancellationToken cancellationToken, TaskCreationOptions creationOptions)
+			: this (TaskActionInvoker.Create (action), state, cancellationToken, creationOptions, current)
 		{
+			if (action == null)
+				throw new ArgumentNullException ("action");
 			if (creationOptions > MaxTaskCreationOptions || creationOptions < TaskCreationOptions.None)
 				throw new ArgumentOutOfRangeException ("creationOptions");
+		}
 
+		internal Task (TaskActionInvoker invoker, object state, CancellationToken cancellationToken,
+		               TaskCreationOptions creationOptions, Task parent)
+		{
+			this.invoker = invoker;
 			this.taskCreationOptions = creationOptions;
-			this.action              = action == null ? EmptyFunc : action;
 			this.state               = state;
 			this.taskId              = Interlocked.Increment (ref id);
 			this.status              = cancellationToken.IsCancellationRequested ? TaskStatus.Canceled : TaskStatus.Created;
 			this.token               = cancellationToken;
+			this.parent              = parent;
 
 			// Process taskCreationOptions
-			if (CheckTaskOptions (taskCreationOptions, TaskCreationOptions.AttachedToParent)) {
-				parent = current;
-				if (parent != null)
-					parent.AddChild ();
-			}
-		}
-		
-		~Task ()
-		{
-			if (exception != null && !exceptionObserved)
-				throw exception;
+			if (CheckTaskOptions (taskCreationOptions, TaskCreationOptions.AttachedToParent) && parent != null)
+				parent.AddChild ();
+
+			if (token.CanBeCanceled)
+				cancellationRegistration = token.Register (l => ((Task) l).CancelReal (), this);
 		}
 
 		bool CheckTaskOptions (TaskCreationOptions opt, TaskCreationOptions member)
@@ -136,10 +159,6 @@ namespace System.Threading.Tasks
 			return (opt & member) == member;
 		}
 
-		static void EmptyFunc (object o)
-		{
-		}
-
 		#region Start
 		public void Start ()
 		{
@@ -148,8 +167,15 @@ namespace System.Threading.Tasks
 		
 		public void Start (TaskScheduler scheduler)
 		{
+			if (scheduler == null)
+				throw new ArgumentNullException ("scheduler");
+
 			if (status >= TaskStatus.WaitingToRun)
 				throw new InvalidOperationException ("The Task is not in a valid state to be started.");
+
+			if (IsContinuation)
+				throw new InvalidOperationException ("Start may not be called on a continuation task");
+
 			SetupScheduler (scheduler);
 			Schedule ();
 		}
@@ -157,8 +183,7 @@ namespace System.Threading.Tasks
 		internal void SetupScheduler (TaskScheduler scheduler)
 		{
 			this.scheduler = scheduler;
-			status = TaskStatus.WaitingForActivation;
-			schedWait.Set ();
+			Status = TaskStatus.WaitingForActivation;
 		}
 		
 		public void RunSynchronously ()
@@ -168,9 +193,24 @@ namespace System.Threading.Tasks
 		
 		public void RunSynchronously (TaskScheduler scheduler)
 		{
-			if (scheduler.TryExecuteTask (this))
-				return;
+			if (scheduler == null)
+				throw new ArgumentNullException ("scheduler");
+
+			if (Status > TaskStatus.WaitingForActivation)
+				throw new InvalidOperationException ("The task is not in a valid state to be started");
+
+			SetupScheduler (scheduler);
+			var saveStatus = status;
+			Status = TaskStatus.WaitingToRun;
 
+			try {
+				if (scheduler.RunInline (this))
+					return;
+			} catch (Exception inner) {
+				throw new TaskSchedulerException (inner);
+			}
+
+			Status = saveStatus;
 			Start (scheduler);
 			Wait ();
 		}
@@ -199,7 +239,17 @@ namespace System.Threading.Tasks
 		
 		public Task ContinueWith (Action<Task> continuationAction, CancellationToken cancellationToken, TaskContinuationOptions continuationOptions, TaskScheduler scheduler)
 		{
-			Task continuation = new Task ((o) => continuationAction ((Task)o), this, cancellationToken, GetCreationOptions (continuationOptions));
+			if (continuationAction == null)
+				throw new ArgumentNullException ("continuationAction");
+			if (scheduler == null)
+				throw new ArgumentNullException ("scheduler");
+
+			return ContinueWith (TaskActionInvoker.Create (continuationAction), cancellationToken, continuationOptions, scheduler);
+		}
+
+		internal Task ContinueWith (TaskActionInvoker invoker, CancellationToken cancellationToken, TaskContinuationOptions continuationOptions, TaskScheduler scheduler)
+		{
+			var continuation = new Task (invoker, null, cancellationToken, GetCreationOptions (continuationOptions), this);
 			ContinueWithCore (continuation, continuationOptions, scheduler);
 
 			return continuation;
@@ -233,106 +283,54 @@ namespace System.Threading.Tasks
 			if (scheduler == null)
 				throw new ArgumentNullException ("scheduler");
 
-			Task<TResult> t = new Task<TResult> ((o) => continuationFunction ((Task)o), this, cancellationToken, GetCreationOptions (continuationOptions));
-			
-			ContinueWithCore (t, continuationOptions, scheduler);
-			
-			return t;
+			return ContinueWith<TResult> (TaskActionInvoker.Create (continuationFunction), cancellationToken, continuationOptions, scheduler);
 		}
-		
-		internal void ContinueWithCore (Task continuation, TaskContinuationOptions continuationOptions, TaskScheduler scheduler)
+
+		internal Task<TResult> ContinueWith<TResult> (TaskActionInvoker invoker, CancellationToken cancellationToken, TaskContinuationOptions continuationOptions, TaskScheduler scheduler)
 		{
-			ContinueWithCore (continuation, continuationOptions, scheduler, null);
+			var continuation = new Task<TResult> (invoker, null, cancellationToken, GetCreationOptions (continuationOptions), this);
+			ContinueWithCore (continuation, continuationOptions, scheduler);
+
+			return continuation;
 		}
-		
-		internal void ContinueWithCore (Task continuation, TaskContinuationOptions kind,
-		                                TaskScheduler scheduler, Func<bool> predicate)
+	
+		internal void ContinueWithCore (Task continuation, TaskContinuationOptions options, TaskScheduler scheduler)
 		{
+			const TaskContinuationOptions wrongRan = TaskContinuationOptions.NotOnRanToCompletion | TaskContinuationOptions.OnlyOnRanToCompletion;
+			const TaskContinuationOptions wrongCanceled = TaskContinuationOptions.NotOnCanceled | TaskContinuationOptions.OnlyOnCanceled;
+			const TaskContinuationOptions wrongFaulted = TaskContinuationOptions.NotOnFaulted | TaskContinuationOptions.OnlyOnFaulted;
+
+			if (((options & wrongRan) == wrongRan) || ((options & wrongCanceled) == wrongCanceled) || ((options & wrongFaulted) == wrongFaulted))
+				throw new ArgumentException ("continuationOptions", "Some options are mutually exclusive");
+
 			// Already set the scheduler so that user can call Wait and that sort of stuff
 			continuation.scheduler = scheduler;
-			continuation.schedWait.Set ();
-			continuation.status = TaskStatus.WaitingForActivation;
-			
-			AtomicBoolean launched = new AtomicBoolean ();
-			EventHandler action = delegate (object sender, EventArgs e) {
-				if (launched.TryRelaxedSet ()) {
-					if (predicate != null && !predicate ())
-						return;
-
-					if (!ContinuationStatusCheck (kind)) {
-						continuation.CancelReal ();
-						continuation.Dispose ();
-						
-						return;
-					}
-					
-					CheckAndSchedule (continuation, kind, scheduler, sender == null);
-				}
-			};
-			
+			continuation.Status = TaskStatus.WaitingForActivation;
+			continuation.taskCreationOptions |= TaskCreationOptionsContinuation;
+
+			ContinueWith (new TaskContinuation (continuation, options));
+		}
+		
+		internal void ContinueWith (IContinuation continuation)
+		{
 			if (IsCompleted) {
-				action (null, EventArgs.Empty);
+				continuation.Execute ();
 				return;
 			}
 			
-			completed.Enqueue (action);
+			continuations.Add (continuation);
 			
 			// Retry in case completion was achieved but event adding was too late
-			if (IsCompleted)
-				action (null, EventArgs.Empty);
+			if (IsCompleted && continuations.Remove (continuation))
+				continuation.Execute ();
 		}
 
-		
-		bool ContinuationStatusCheck (TaskContinuationOptions kind)
+		void RemoveContinuation (IContinuation continuation)
 		{
-			if (kind == TaskContinuationOptions.None)
-				return true;
-			
-			int kindCode = (int)kind;
-			
-			if (kindCode >= ((int)TaskContinuationOptions.NotOnRanToCompletion)) {
-				// Remove other options
-				kind &= ~(TaskContinuationOptions.PreferFairness
-				          | TaskContinuationOptions.LongRunning
-				          | TaskContinuationOptions.AttachedToParent
-				          | TaskContinuationOptions.ExecuteSynchronously);
-
-				if (status == TaskStatus.Canceled) {
-					if (kind == TaskContinuationOptions.NotOnCanceled)
-						return false;
-					if (kind == TaskContinuationOptions.OnlyOnFaulted)
-						return false;
-					if (kind == TaskContinuationOptions.OnlyOnRanToCompletion)
-						return false;
-				} else if (status == TaskStatus.Faulted) {
-					if (kind == TaskContinuationOptions.NotOnFaulted)
-						return false;
-					if (kind == TaskContinuationOptions.OnlyOnCanceled)
-						return false;
-					if (kind == TaskContinuationOptions.OnlyOnRanToCompletion)
-						return false;
-				} else if (status == TaskStatus.RanToCompletion) {
-					if (kind == TaskContinuationOptions.NotOnRanToCompletion)
-						return false;
-					if (kind == TaskContinuationOptions.OnlyOnFaulted)
-						return false;
-					if (kind == TaskContinuationOptions.OnlyOnCanceled)
-						return false;
-				}
-			}
-			
-			return true;
+			continuations.Remove (continuation);
 		}
-		
-		void CheckAndSchedule (Task continuation, TaskContinuationOptions options, TaskScheduler scheduler, bool fromCaller)
-		{
-			if ((options & TaskContinuationOptions.ExecuteSynchronously) > 0)
-				continuation.ThreadStart ();
-			else
-				continuation.Start (scheduler);
-		}
-		
-		internal TaskCreationOptions GetCreationOptions (TaskContinuationOptions kind)
+
+		static internal TaskCreationOptions GetCreationOptions (TaskContinuationOptions kind)
 		{
 			TaskCreationOptions options = TaskCreationOptions.None;
 			if ((kind & TaskContinuationOptions.AttachedToParent) > 0)
@@ -348,8 +346,8 @@ namespace System.Threading.Tasks
 		
 		#region Internal and protected thingies
 		internal void Schedule ()
-		{	
-			status = TaskStatus.WaitingToRun;
+		{
+			Status = TaskStatus.WaitingToRun;
 			
 			// If worker is null it means it is a local one, revert to the old behavior
 			// If TaskScheduler.Current is not being used, the scheduler was explicitly provided, so we must use that
@@ -373,6 +371,11 @@ namespace System.Threading.Tasks
 			if (!executing.TryRelaxedSet ())
 				return;
 
+			// Disable CancellationToken direct cancellation
+			if (cancellationRegistration != null) {
+				cancellationRegistration.Value.Dispose ();
+				cancellationRegistration = null;
+			}
 			current = this;
 			TaskScheduler.Current = scheduler;
 			
@@ -383,7 +386,7 @@ namespace System.Threading.Tasks
 				try {
 					InnerInvoke ();
 				} catch (OperationCanceledException oce) {
-					if (oce.CancellationToken == token)
+					if (token != CancellationToken.None && oce.CancellationToken == token)
 						CancelReal ();
 					else
 						HandleGenericException (oce);
@@ -396,69 +399,134 @@ namespace System.Threading.Tasks
 			
 			Finish ();
 		}
-		
+
+		internal bool TrySetCanceled ()
+		{
+			if (IsCompleted)
+				return false;
+			
+			if (!executing.TryRelaxedSet ()) {
+				var sw = new SpinWait ();
+				while (!IsCompleted)
+					sw.SpinOnce ();
+
+				return false;
+			}
+			
+			CancelReal ();
+			return true;
+		}
+
+		internal bool TrySetException (AggregateException aggregate)
+		{
+			if (IsCompleted)
+				return false;
+			
+			if (!executing.TryRelaxedSet ()) {
+				var sw = new SpinWait ();
+				while (!IsCompleted)
+					sw.SpinOnce ();
+
+				return false;
+			}
+			
+			HandleGenericException (aggregate);
+			return true;
+		}
+/*
 		internal void Execute (Action<Task> childAdder)
 		{
 			childWorkAdder = childAdder;
+			Execute ();
+		}
+*/		
+		internal void Execute ()
+		{
 			ThreadStart ();
 		}
 		
 		internal void AddChild ()
 		{
+			if (childTasks == null)
+				Interlocked.CompareExchange (ref childTasks, new CountdownEvent (1), null);
 			childTasks.AddCount ();
 		}
 
-		internal void ChildCompleted ()
+		internal void ChildCompleted (AggregateException childEx)
 		{
-			childTasks.Signal ();
-			if (childTasks.IsSet && status == TaskStatus.WaitingForChildrenToComplete) {
-				status = TaskStatus.RanToCompletion;
-				
+			if (childEx != null) {
+				if (ExceptionSlot.ChildExceptions == null)
+					Interlocked.CompareExchange (ref ExceptionSlot.ChildExceptions, new ConcurrentQueue<AggregateException> (), null);
+				ExceptionSlot.ChildExceptions.Enqueue (childEx);
+			}
+
+			if (childTasks.Signal () && status == TaskStatus.WaitingForChildrenToComplete) {
+				Status = TaskStatus.RanToCompletion;
+				ProcessChildExceptions ();
 				ProcessCompleteDelegates ();
 			}
 		}
 
-		internal virtual void InnerInvoke ()
+		void InnerInvoke ()
 		{
-			if (action != null)
-				action (state);
-			// Set action to null so that the GC can collect the delegate and thus
-			// any big object references that the user might have captured in an anonymous method
-			action = null;
-			state = null;
+			if (IsContinuation) {
+				invoker.Invoke (parent, state, this);
+			} else {
+				invoker.Invoke (this, state, this);
+			}
 		}
 		
 		internal void Finish ()
 		{
-			// If there wasn't any child created in the task we set the CountdownEvent
-			childTasks.Signal ();
+			// If there was children created and they all finished, we set the countdown
+			if (childTasks != null)
+				childTasks.Signal ();
 			
 			// Don't override Canceled or Faulted
 			if (status == TaskStatus.Running) {
-				if (childTasks.IsSet)
-					status = TaskStatus.RanToCompletion;
+				if (childTasks == null || childTasks.IsSet)
+					Status = TaskStatus.RanToCompletion;
 				else
-					status = TaskStatus.WaitingForChildrenToComplete;
+					Status = TaskStatus.WaitingForChildrenToComplete;
 			}
 		
-			if (status != TaskStatus.WaitingForChildrenToComplete)
+			// Completions are already processed when task is canceled or faulted
+			if (status == TaskStatus.RanToCompletion)
 				ProcessCompleteDelegates ();
-			
+
 			// Reset the current thingies
 			current = null;
 			TaskScheduler.Current = null;
+
+			if (cancellationRegistration.HasValue)
+				cancellationRegistration.Value.Dispose ();
 			
 			// Tell parent that we are finished
-			if (CheckTaskOptions (taskCreationOptions, TaskCreationOptions.AttachedToParent) && parent != null){
-				parent.ChildCompleted ();
+			if (CheckTaskOptions (taskCreationOptions, TaskCreationOptions.AttachedToParent) && parent != null) {
+				parent.ChildCompleted (this.Exception);
 			}
 		}
 
 		void ProcessCompleteDelegates ()
 		{
-			EventHandler handler;
-			while (completed.TryDequeue (out handler))
-				handler (this, EventArgs.Empty);
+			if (continuations.HasElements) {
+				IContinuation continuation;
+				while (continuations.TryGetNextCompletion (out continuation))
+					continuation.Execute ();
+			}
+		}
+
+		void ProcessChildExceptions ()
+		{
+			if (exSlot == null || exSlot.ChildExceptions == null)
+				return;
+
+			if (ExceptionSlot.Exception == null)
+				exSlot.Exception = new AggregateException ();
+
+			AggregateException childEx;
+			while (exSlot.ChildExceptions.TryDequeue (out childEx))
+				exSlot.Exception.AddChildException (childEx);
 		}
 		#endregion
 		
@@ -466,38 +534,31 @@ namespace System.Threading.Tasks
 		
 		internal void CancelReal ()
 		{
-			status = TaskStatus.Canceled;
+			Status = TaskStatus.Canceled;
+			ProcessCompleteDelegates ();
 		}
 
-		internal void HandleGenericException (Exception e)
+		void HandleGenericException (Exception e)
 		{
 			HandleGenericException (new AggregateException (e));
 		}
 
-		internal void HandleGenericException (AggregateException e)
+		void HandleGenericException (AggregateException e)
 		{
-			exception = e;
-			status = TaskStatus.Faulted;
-			if (scheduler != null && scheduler.FireUnobservedEvent (exception).Observed)
-				exceptionObserved = true;
+			ExceptionSlot.Exception = e;
+			Thread.MemoryBarrier ();
+			Status = TaskStatus.Faulted;
+			ProcessCompleteDelegates ();
 		}
 		
 		public void Wait ()
 		{
-			if (scheduler == null)
-				schedWait.Wait ();
-			
-			if (!IsCompleted)
-				scheduler.ParticipateUntil (this);
-			if (exception != null)
-				throw exception;
-			if (IsCanceled)
-				throw new AggregateException (new TaskCanceledException (this));
+			Wait (Timeout.Infinite, CancellationToken.None);
 		}
 
 		public void Wait (CancellationToken cancellationToken)
 		{
-			Wait (-1, cancellationToken);
+			Wait (Timeout.Infinite, cancellationToken);
 		}
 		
 		public bool Wait (TimeSpan timeout)
@@ -515,107 +576,109 @@ namespace System.Threading.Tasks
 			if (millisecondsTimeout < -1)
 				throw new ArgumentOutOfRangeException ("millisecondsTimeout");
 
-			if (millisecondsTimeout == -1 && token == CancellationToken.None) {
-				Wait ();
-				return true;
-			}
-
-			Watch watch = Watch.StartNew ();
-
-			if (scheduler == null) {
-				schedWait.Wait (millisecondsTimeout, cancellationToken);
-				millisecondsTimeout = ComputeTimeout (millisecondsTimeout, watch);
-			}
+			bool result = true;
 
-			ManualResetEventSlim predicateEvt = new ManualResetEventSlim (false);
-			if (cancellationToken != CancellationToken.None) {
-				cancellationToken.Register (predicateEvt.Set);
-				cancellationToken.ThrowIfCancellationRequested ();
+			if (!IsCompleted) {
+				// If the task is ready to be run and we were supposed to wait on it indefinitely, just run it
+				if (Status == TaskStatus.WaitingToRun && millisecondsTimeout == -1 && scheduler != null)
+					Execute ();
+
+				if (!IsCompleted) {
+					var evt = new ManualResetEventSlim ();
+					var slot = new ManualEventSlot (evt);
+					try {
+						ContinueWith (slot);
+						result = evt.Wait (millisecondsTimeout, cancellationToken);
+					} finally {
+						if (!result)
+							RemoveContinuation (slot);
+						evt.Dispose ();
+					}
+				}
 			}
 
-			bool result = scheduler.ParticipateUntil (this, predicateEvt, millisecondsTimeout);
+			if (IsCanceled)
+				throw new AggregateException (new TaskCanceledException (this));
 
+			var exception = Exception;
 			if (exception != null)
 				throw exception;
-			if (IsCanceled)
-				throw new AggregateException (new TaskCanceledException (this));
-			
-			return !result;
+
+			return result;
 		}
 		
 		public static void WaitAll (params Task[] tasks)
 		{
-			if (tasks == null)
-				throw new ArgumentNullException ("tasks");
-			
-			foreach (var t in tasks) {
-				if (t == null)
-					throw new ArgumentNullException ("tasks", "the tasks argument contains a null element");
-				t.Wait ();
-			}
+			WaitAll (tasks, Timeout.Infinite, CancellationToken.None);
 		}
 
 		public static void WaitAll (Task[] tasks, CancellationToken cancellationToken)
 		{
-			if (tasks == null)
-				throw new ArgumentNullException ("tasks");
-			
-			foreach (var t in tasks) {
-				if (t == null)
-					throw new ArgumentNullException ("tasks", "the tasks argument contains a null element");
-
-				t.Wait (cancellationToken);
-			}
+			WaitAll (tasks, Timeout.Infinite, cancellationToken);
 		}
 		
 		public static bool WaitAll (Task[] tasks, TimeSpan timeout)
 		{
-			if (tasks == null)
-				throw new ArgumentNullException ("tasks");
-			
-			bool result = true;
-			foreach (var t in tasks) {
-				if (t == null)
-					throw new ArgumentNullException ("tasks", "the tasks argument contains a null element");
-
-				result &= t.Wait (timeout);
-			}
-			return result;
+			return WaitAll (tasks, CheckTimeout (timeout), CancellationToken.None);
 		}
 		
 		public static bool WaitAll (Task[] tasks, int millisecondsTimeout)
 		{
-			if (tasks == null)
-				throw new ArgumentNullException ("tasks");
-			
-			bool result = true;
-			foreach (var t in tasks) {
-				if (t == null)
-					throw new ArgumentNullException ("tasks", "the tasks argument contains a null element");
-
-				result &= t.Wait (millisecondsTimeout);
-			}
-			return result;
+			return WaitAll (tasks, millisecondsTimeout, CancellationToken.None);
 		}
 		
 		public static bool WaitAll (Task[] tasks, int millisecondsTimeout, CancellationToken cancellationToken)
 		{
 			if (tasks == null)
 				throw new ArgumentNullException ("tasks");
-			
+
 			bool result = true;
 			foreach (var t in tasks) {
 				if (t == null)
 					throw new ArgumentNullException ("tasks", "the tasks argument contains a null element");
 
-				result &= t.Wait (millisecondsTimeout, cancellationToken);
+				result &= t.Status == TaskStatus.RanToCompletion;
+			}
+
+			if (!result) {
+				var evt = new CountdownEvent (tasks.Length);
+				var slot = new CountdownEventSlot (evt);
+				try {
+					foreach (var t in tasks)
+						t.ContinueWith (slot);
+
+					result = evt.Wait (millisecondsTimeout, cancellationToken);
+				} finally {
+					List<Exception> exceptions = null;
+
+					foreach (var t in tasks) {
+						if (result) {
+							if (t.Status == TaskStatus.RanToCompletion)
+								continue;
+							if (exceptions == null)
+								exceptions = new List<Exception> ();
+							if (t.Exception != null)
+								exceptions.AddRange (t.Exception.InnerExceptions);
+							else
+								exceptions.Add (new TaskCanceledException (t));
+						} else {
+							t.RemoveContinuation (slot);
+						}
+					}
+
+					evt.Dispose ();
+
+					if (exceptions != null)
+						throw new AggregateException (exceptions);
+				}
 			}
+
 			return result;
 		}
 		
 		public static int WaitAny (params Task[] tasks)
 		{
-			return WaitAny (tasks, -1, CancellationToken.None);
+			return WaitAny (tasks, Timeout.Infinite, CancellationToken.None);
 		}
 
 		public static int WaitAny (Task[] tasks, TimeSpan timeout)
@@ -625,90 +688,54 @@ namespace System.Threading.Tasks
 		
 		public static int WaitAny (Task[] tasks, int millisecondsTimeout)
 		{
-			if (millisecondsTimeout < -1)
-				throw new ArgumentOutOfRangeException ("millisecondsTimeout");
-
-			if (millisecondsTimeout == -1)
-				return WaitAny (tasks);
-
 			return WaitAny (tasks, millisecondsTimeout, CancellationToken.None);
 		}
 
 		public static int WaitAny (Task[] tasks, CancellationToken cancellationToken)
 		{
-			return WaitAny (tasks, -1, cancellationToken);
+			return WaitAny (tasks, Timeout.Infinite, cancellationToken);
 		}
 
 		public static int WaitAny (Task[] tasks, int millisecondsTimeout, CancellationToken cancellationToken)
 		{
 			if (tasks == null)
 				throw new ArgumentNullException ("tasks");
-			if (tasks.Length == 0)
-				throw new ArgumentException ("tasks is empty", "tasks");
-			if (tasks.Length == 1) {
-				tasks[0].Wait (millisecondsTimeout, cancellationToken);
-				return 0;
-			}
-			
-			int numFinished = 0;
-			int indexFirstFinished = -1;
-			int index = 0;
-			TaskScheduler sched = null;
-			Task task = null;
-			Watch watch = Watch.StartNew ();
-			ManualResetEventSlim predicateEvt = new ManualResetEventSlim (false);
-
-			foreach (Task t in tasks) {
-				int indexResult = index++;
-				t.ContinueWith (delegate {
-					if (numFinished >= 1)
-						return;
-					int result = Interlocked.Increment (ref numFinished);
-
-					// Check if we are the first to have finished
-					if (result == 1)
-						indexFirstFinished = indexResult;
-
-					// Stop waiting
-					predicateEvt.Set ();
-				}, TaskContinuationOptions.ExecuteSynchronously);
-
-				if (sched == null && t.scheduler != null) {
-					task = t;
-					sched = t.scheduler;
-				}
-			}
-
-			// If none of task have a scheduler we are forced to wait for at least one to start
-			if (sched == null) {
-				var handles = Array.ConvertAll (tasks, t => t.schedWait.WaitHandle);
-				int shandle = -1;
-				if ((shandle = WaitHandle.WaitAny (handles, millisecondsTimeout)) == WaitHandle.WaitTimeout)
-					return -1;
-				sched = tasks[shandle].scheduler;
-				task = tasks[shandle];
-				millisecondsTimeout = ComputeTimeout (millisecondsTimeout, watch);
-			}
+			if (millisecondsTimeout < -1)
+				throw new ArgumentOutOfRangeException ("millisecondsTimeout");
+			CheckForNullTasks (tasks);
 
-			// One task already finished
-			if (indexFirstFinished != -1)
-				return indexFirstFinished;
+			if (tasks.Length > 0) {
+				var evt = new ManualResetEventSlim ();
+				var slot = new ManualEventSlot (evt);
+				bool result = false;
+				try {
+					for (int i = 0; i < tasks.Length; i++) {
+						var t = tasks[i];
+						if (t.IsCompleted)
+							return i;
+						t.ContinueWith (slot);
+					}
 
-			if (cancellationToken != CancellationToken.None) {
-				cancellationToken.Register (predicateEvt.Set);
-				cancellationToken.ThrowIfCancellationRequested ();
+					if (!(result = evt.Wait (millisecondsTimeout, cancellationToken)))
+						return -1;
+				} finally {
+					if (!result)
+						foreach (var t in tasks)
+							t.RemoveContinuation (slot);
+					evt.Dispose ();
+				}
 			}
 
-			sched.ParticipateUntil (task, predicateEvt, millisecondsTimeout);
-
-			// Index update is still not done
-			if (indexFirstFinished == -1) {
-				SpinWait wait = new SpinWait ();
-				while (indexFirstFinished == -1)
-					wait.SpinOnce ();
+			int firstFinished = -1;
+			for (int i = 0; i < tasks.Length; i++) {
+				var t = tasks[i];
+				if (t.IsCompleted) {
+					firstFinished = i;
+					break;
+				}
 			}
 
-			return indexFirstFinished;
+			return firstFinished;
 		}
 
 		static int CheckTimeout (TimeSpan timeout)
@@ -720,11 +747,12 @@ namespace System.Threading.Tasks
 			}
 		}
 
-		static int ComputeTimeout (int millisecondsTimeout, Watch watch)
+		static void CheckForNullTasks (Task[] tasks)
 		{
-			return millisecondsTimeout == -1 ? -1 : (int)Math.Max (watch.ElapsedMilliseconds - millisecondsTimeout, 1);
+			foreach (var t in tasks)
+				if (t == null)
+					throw new ArgumentNullException ("tasks", "the tasks argument contains a null element");
 		}
-
 		#endregion
 		
 		#region Dispose
@@ -741,12 +769,180 @@ namespace System.Threading.Tasks
 			// Set action to null so that the GC can collect the delegate and thus
 			// any big object references that the user might have captured in a anonymous method
 			if (disposing) {
-				action = null;
+				invoker = null;
 				state = null;
+				if (cancellationRegistration != null)
+					cancellationRegistration.Value.Dispose ();
 			}
 		}
 		#endregion
 		
+#if NET_4_5
+
+		public ConfiguredTaskAwaitable ConfigureAwait (bool continueOnCapturedContext)
+		{
+			return new ConfiguredTaskAwaitable (this, continueOnCapturedContext);
+		}
+
+		public Task ContinueWith (Action<Task, object> continuationAction, object state)
+		{
+			return ContinueWith (continuationAction, state, CancellationToken.None, TaskContinuationOptions.None, TaskScheduler.Current);
+		}
+
+		public Task ContinueWith (Action<Task, object> continuationAction, object state, CancellationToken cancellationToken)
+		{
+			return ContinueWith (continuationAction, state, cancellationToken, TaskContinuationOptions.None, TaskScheduler.Current);
+		}
+
+		public Task ContinueWith (Action<Task, object> continuationAction, object state, TaskContinuationOptions continuationOptions)
+		{
+			return ContinueWith (continuationAction, state, CancellationToken.None, continuationOptions, TaskScheduler.Current);
+		}
+
+		public Task ContinueWith (Action<Task, object> continuationAction, object state, TaskScheduler scheduler)
+		{
+			return ContinueWith (continuationAction, state, CancellationToken.None, TaskContinuationOptions.None, scheduler);
+		}
+
+		public Task ContinueWith (Action<Task, object> continuationAction, object state, CancellationToken cancellationToken,
+								  TaskContinuationOptions continuationOptions, TaskScheduler scheduler)
+		{
+			if (continuationAction == null)
+				throw new ArgumentNullException ("continuationAction");
+			if (scheduler == null)
+				throw new ArgumentNullException ("scheduler");
+
+			Task continuation = new Task (TaskActionInvoker.Create (continuationAction),
+										  state, cancellationToken,
+										  GetCreationOptions (continuationOptions),
+										  this);
+			ContinueWithCore (continuation, continuationOptions, scheduler);
+
+			return continuation;
+		}
+
+		public Task<TResult> ContinueWith<TResult> (Func<Task, object, TResult> continuationFunction, object state)
+		{
+			return ContinueWith<TResult> (continuationFunction, state, CancellationToken.None, TaskContinuationOptions.None, TaskScheduler.Current);
+		}
+
+		public Task<TResult> ContinueWith<TResult> (Func<Task, object, TResult> continuationFunction, object state, TaskContinuationOptions continuationOptions)
+		{
+			return ContinueWith<TResult> (continuationFunction, state, CancellationToken.None, continuationOptions, TaskScheduler.Current);
+		}
+
+		public Task<TResult> ContinueWith<TResult> (Func<Task, object, TResult> continuationFunction, object state, CancellationToken cancellationToken)
+		{
+			return ContinueWith<TResult> (continuationFunction, state, cancellationToken, TaskContinuationOptions.None, TaskScheduler.Current);
+		}
+
+		public Task<TResult> ContinueWith<TResult> (Func<Task, object, TResult> continuationFunction, object state, TaskScheduler scheduler)
+		{
+			return ContinueWith<TResult> (continuationFunction, state, CancellationToken.None, TaskContinuationOptions.None, scheduler);
+		}
+
+		public Task<TResult> ContinueWith<TResult> (Func<Task, object, TResult> continuationFunction, object state, CancellationToken cancellationToken,
+													TaskContinuationOptions continuationOptions, TaskScheduler scheduler)
+		{
+			if (continuationFunction == null)
+				throw new ArgumentNullException ("continuationFunction");
+			if (scheduler == null)
+				throw new ArgumentNullException ("scheduler");
+
+			var t = new Task<TResult> (TaskActionInvoker.Create (continuationFunction),
+												 state,
+												 cancellationToken,
+												 GetCreationOptions (continuationOptions),
+												 this);
+
+			ContinueWithCore (t, continuationOptions, scheduler);
+
+			return t;
+		}
+
+		public static Task<TResult> FromResult<TResult> (TResult result)
+		{
+			var tcs = new TaskCompletionSource<TResult> ();
+			tcs.SetResult (result);
+			return tcs.Task;
+		}
+
+		public TaskAwaiter GetAwaiter ()
+		{
+			return new TaskAwaiter (this);
+		}
+
+		public static Task Run (Action action)
+		{
+			return Run (action, CancellationToken.None);
+		}
+
+		public static Task Run (Action action, CancellationToken cancellationToken)
+		{
+			if (cancellationToken.IsCancellationRequested)
+				return TaskConstants.Canceled;
+
+			var t = new Task (action, cancellationToken, TaskCreationOptions.DenyChildAttach);
+			t.Start ();
+			return t;
+		}
+
+		public static Task Run (Func<Task> function)
+		{
+			return Run (function, CancellationToken.None);
+		}
+
+		public static Task Run (Func<Task> function, CancellationToken cancellationToken)
+		{
+			if (cancellationToken.IsCancellationRequested)
+				return TaskConstants.Canceled;
+
+			var t = new Task<Task> (function, cancellationToken);
+			t.Start ();
+			return t;
+		}
+
+		public static Task<TResult> Run<TResult> (Func<TResult> function)
+		{
+			return Run (function, CancellationToken.None);
+		}
+
+		public static Task<TResult> Run<TResult> (Func<TResult> function, CancellationToken cancellationToken)
+		{
+			if (cancellationToken.IsCancellationRequested)
+				return TaskConstants<TResult>.Canceled;
+
+			var t = new Task<TResult> (function, cancellationToken, TaskCreationOptions.DenyChildAttach);
+			t.Start ();
+			return t;
+		}
+
+		public static Task<TResult> Run<TResult> (Func<Task<TResult>> function)
+		{
+			return Run (function, CancellationToken.None);
+		}
+
+		public static Task<TResult> Run<TResult> (Func<Task<TResult>> function, CancellationToken cancellationToken)
+		{
+			if (cancellationToken.IsCancellationRequested)
+				return TaskConstants<TResult>.Canceled;
+
+			var t = Task<Task<TResult>>.Factory.StartNew (function, cancellationToken, TaskCreationOptions.DenyChildAttach, TaskScheduler.Default);
+			return GetTaskResult (t);
+		}
+
+		async static Task<TResult> GetTaskResult<TResult> (Task<Task<TResult>> task)
+		{
+			var r = await task.ConfigureAwait (false);
+			return r.Result;
+		}
+		
+		public static YieldAwaitable Yield ()
+		{
+			return new YieldAwaitable ();
+		}
+#endif
+
 		#region Properties
 		public static TaskFactory Factory {
 			get {
@@ -763,12 +959,13 @@ namespace System.Threading.Tasks
 		
 		public AggregateException Exception {
 			get {
-				exceptionObserved = true;
-				
-				return exception;	
+				if (exSlot == null)
+					return null;
+				exSlot.Observed = true;
+				return exSlot.Exception;
 			}
 			internal set {
-				exception = value;
+				ExceptionSlot.Exception = value;
 			}
 		}
 		
@@ -780,8 +977,7 @@ namespace System.Threading.Tasks
 
 		public bool IsCompleted {
 			get {
-				return status == TaskStatus.RanToCompletion ||
-					status == TaskStatus.Canceled || status == TaskStatus.Faulted;
+				return status >= TaskStatus.RanToCompletion;
 			}
 		}
 		
@@ -793,7 +989,7 @@ namespace System.Threading.Tasks
 
 		public TaskCreationOptions CreationOptions {
 			get {
-				return taskCreationOptions;
+				return taskCreationOptions & MaxTaskCreationOptions;
 			}
 		}
 		
@@ -803,6 +999,16 @@ namespace System.Threading.Tasks
 			}
 			internal set {
 				status = value;
+				Thread.MemoryBarrier ();
+			}
+		}
+
+		TaskExceptionSlot ExceptionSlot {
+			get {
+				if (exSlot != null)
+					return exSlot;
+				Interlocked.CompareExchange (ref exSlot, new TaskExceptionSlot (this), null);
+				return exSlot;
 			}
 		}
 
@@ -830,11 +1036,25 @@ namespace System.Threading.Tasks
 			}
 		}
 
+		bool IsContinuation {
+			get {
+				return (taskCreationOptions & TaskCreationOptionsContinuation) != 0;
+			}
+		}
+
 		internal Task Parent {
 			get {
 				return parent;
 			}
 		}
+		
+		internal string DisplayActionMethod {
+			get {
+				Delegate d = invoker.Action;
+				return d == null ? "<none>" : d.Method.ToString ();
+			}
+		}
+		
 		#endregion
 	}
 }
diff --git a/mcs/class/corlib/System.Threading.Tasks/TaskActionInvoker.cs b/mcs/class/corlib/System.Threading.Tasks/TaskActionInvoker.cs
new file mode 100644
index 0000000..a6a47a4
--- /dev/null
+++ b/mcs/class/corlib/System.Threading.Tasks/TaskActionInvoker.cs
@@ -0,0 +1,484 @@
+//
+// TaskActionInvoker.cs
+//
+// Authors:
+//    Marek Safar  <marek.safar at gmail.com>
+//
+// Copyright 2011 Xamarin Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+//
+
+#if NET_4_0 || MOBILE
+
+namespace System.Threading.Tasks
+{
+	abstract class TaskActionInvoker
+	{
+		public static readonly TaskActionInvoker Empty = new EmptyTaskActionInvoker ();
+		
+		sealed class EmptyTaskActionInvoker : TaskActionInvoker
+		{
+			public override Delegate Action {
+				get {
+					return null;
+				}
+			}
+
+			public override void Invoke (Task owner, object state, Task context)
+			{
+			}
+		}
+
+		sealed class ActionInvoke : TaskActionInvoker
+		{
+			readonly Action action;
+
+			public ActionInvoke (Action action)
+			{
+				this.action = action;
+			}
+
+			public override Delegate Action {
+				get {
+					return action;
+				}
+			}
+
+			public override void Invoke (Task owner, object state, Task context)
+			{
+				action ();
+			}
+		}
+
+		sealed class ActionObjectInvoke : TaskActionInvoker
+		{
+			readonly Action<object> action;
+
+			public ActionObjectInvoke (Action<object> action)
+			{
+				this.action = action;
+			}
+
+			public override Delegate Action {
+				get {
+					return action;
+				}
+			}
+
+			public override void Invoke (Task owner, object state, Task context)
+			{
+				action (state);
+			}
+		}
+
+		sealed class ActionTaskInvoke : TaskActionInvoker
+		{
+			readonly Action<Task> action;
+
+			public ActionTaskInvoke (Action<Task> action)
+			{
+				this.action = action;
+			}
+
+			public override Delegate Action {
+				get {
+					return action;
+				}
+			}
+
+			public override void Invoke (Task owner, object state, Task context)
+			{
+				action (owner);
+			}
+		}
+
+		sealed class ActionTasksInvoke : TaskActionInvoker
+		{
+			readonly Action<Task[]> action;
+			readonly Task[] tasks;
+
+			public ActionTasksInvoke (Action<Task[]> action, Task[] tasks)
+			{
+				this.action = action;
+				this.tasks = tasks;
+			}
+
+			public override Delegate Action {
+				get {
+					return action;
+				}
+			}
+
+			public override void Invoke (Task owner, object state, Task context)
+			{
+				action (tasks);
+			}
+		}
+
+		sealed class ActionTaskObjectInvoke : TaskActionInvoker
+		{
+			readonly Action<Task, object> action;
+
+			public ActionTaskObjectInvoke (Action<Task, object> action)
+			{
+				this.action = action;
+			}
+
+			public override Delegate Action {
+				get {
+					return action;
+				}
+			}
+
+			public override void Invoke (Task owner, object state, Task context)
+			{
+				action (owner, state);
+			}
+		}
+
+		sealed class ActionTaskObjectInvoke<TResult> : TaskActionInvoker
+		{
+			readonly Action<Task<TResult>, object> action;
+
+			public ActionTaskObjectInvoke (Action<Task<TResult>, object> action)
+			{
+				this.action = action;
+			}
+
+			public override Delegate Action {
+				get {
+					return action;
+				}
+			}
+
+			public override void Invoke (Task owner, object state, Task context)
+			{
+				action ((Task<TResult>) owner, state);
+			}
+		}
+
+		sealed class ActionTaskInvoke<TResult> : TaskActionInvoker
+		{
+			readonly Action<Task<TResult>> action;
+
+			public ActionTaskInvoke (Action<Task<TResult>> action)
+			{
+				this.action = action;
+			}
+
+			public override Delegate Action {
+				get {
+					return action;
+				}
+			}
+
+			public override void Invoke (Task owner, object state, Task context)
+			{
+				action ((Task<TResult>) owner);
+			}
+		}
+
+		sealed class ActionTaskSelected : TaskActionInvoker
+		{
+			readonly Action<Task> action;
+			readonly Task[] tasks;
+
+			public ActionTaskSelected (Action<Task> action, Task[] tasks)
+			{
+				this.action = action;
+				this.tasks = tasks;
+			}
+
+			public override Delegate Action {
+				get {
+					return action;
+				}
+			}
+
+			public override void Invoke (Task owner, object state, Task context)
+			{
+				var result = ((Task<int>) owner).Result;
+				action (tasks [result]);
+			}
+		}
+
+		sealed class FuncInvoke<TResult> : TaskActionInvoker
+		{
+			readonly Func<TResult> action;
+
+			public FuncInvoke (Func<TResult> action)
+			{
+				this.action = action;
+			}
+
+			public override Delegate Action {
+				get {
+					return action;
+				}
+			}
+
+			public override void Invoke (Task owner, object state, Task context)
+			{
+				((Task<TResult>) context).Result = action ();
+			}
+		}
+
+		sealed class FuncTaskInvoke<TResult> : TaskActionInvoker
+		{
+			readonly Func<Task, TResult> action;
+
+			public FuncTaskInvoke (Func<Task, TResult> action)
+			{
+				this.action = action;
+			}
+
+			public override Delegate Action {
+				get {
+					return action;
+				}
+			}
+
+			public override void Invoke (Task owner, object state, Task context)
+			{
+				((Task<TResult>) context).Result = action (owner);
+			}
+		}
+
+		sealed class FuncTasksInvoke<TResult> : TaskActionInvoker
+		{
+			readonly Func<Task[], TResult> action;
+			readonly Task[] tasks;
+
+			public FuncTasksInvoke (Func<Task[], TResult> action, Task[] tasks)
+			{
+				this.action = action;
+				this.tasks = tasks;
+			}
+
+			public override Delegate Action {
+				get {
+					return action;
+				}
+			}
+
+			public override void Invoke (Task owner, object state, Task context)
+			{
+				((Task<TResult>) context).Result = action (tasks);
+			}
+		}
+
+		sealed class FuncTaskSelected<TResult> : TaskActionInvoker
+		{
+			readonly Func<Task, TResult> action;
+			readonly Task[] tasks;
+
+			public FuncTaskSelected (Func<Task, TResult> action, Task[] tasks)
+			{
+				this.action = action;
+				this.tasks = tasks;
+			}
+
+			public override Delegate Action {
+				get {
+					return action;
+				}
+			}
+
+			public override void Invoke (Task owner, object state, Task context)
+			{
+				var result = ((Task<int>) owner).Result;
+				((Task<TResult>) context).Result = action (tasks[result]);
+			}
+		}
+
+		sealed class FuncTaskInvoke<TResult, TNewResult> : TaskActionInvoker
+		{
+			readonly Func<Task<TResult>, TNewResult> action;
+
+			public FuncTaskInvoke (Func<Task<TResult>, TNewResult> action)
+			{
+				this.action = action;
+			}
+
+			public override Delegate Action {
+				get {
+					return action;
+				}
+			}
+
+			public override void Invoke (Task owner, object state, Task context)
+			{
+				((Task<TNewResult>) context).Result = action ((Task<TResult>) owner);
+			}
+		}
+
+		sealed class FuncObjectInvoke<TResult> : TaskActionInvoker
+		{
+			readonly Func<object, TResult> action;
+
+			public FuncObjectInvoke (Func<object, TResult> action)
+			{
+				this.action = action;
+			}
+
+			public override Delegate Action {
+				get {
+					return action;
+				}
+			}
+
+			public override void Invoke (Task owner, object state, Task context)
+			{
+				((Task<TResult>) context).Result = action (state);
+			}
+		}
+
+		sealed class FuncTaskObjectInvoke<TResult> : TaskActionInvoker
+		{
+			readonly Func<Task, object, TResult> action;
+
+			public FuncTaskObjectInvoke (Func<Task, object, TResult> action)
+			{
+				this.action = action;
+			}
+
+			public override Delegate Action {
+				get {
+					return action;
+				}
+			}
+
+			public override void Invoke (Task owner, object state, Task context)
+			{
+				((Task<TResult>) context).Result = action (owner, state);
+			}
+		}
+
+		sealed class FuncTaskObjectInvoke<TResult, TNewResult> : TaskActionInvoker
+		{
+			readonly Func<Task<TResult>, object, TNewResult> action;
+
+			public FuncTaskObjectInvoke (Func<Task<TResult>, object, TNewResult> action)
+			{
+				this.action = action;
+			}
+
+			public override Delegate Action {
+				get {
+					return action;
+				}
+			}
+
+			public override void Invoke (Task owner, object state, Task context)
+			{
+				((Task<TNewResult>) context).Result = action ((Task<TResult>) owner, state);
+			}
+		}
+
+		public static TaskActionInvoker Create (Action action)
+		{
+			return new ActionInvoke (action);
+		}
+
+		public static TaskActionInvoker Create (Action<object> action)
+		{
+			return new ActionObjectInvoke (action);
+		}
+
+		public static TaskActionInvoker Create (Action<Task> action)
+		{
+			return new ActionTaskInvoke (action);
+		}
+
+		public static TaskActionInvoker Create (Action<Task, object> action)
+		{
+			return new ActionTaskObjectInvoke (action);
+		}
+
+		public static TaskActionInvoker Create<TResult> (Action<Task<TResult>> action)
+		{
+			return new ActionTaskInvoke<TResult> (action);
+		}
+
+		public static TaskActionInvoker Create<TResult> (Action<Task<TResult>, object> action)
+		{
+			return new ActionTaskObjectInvoke<TResult> (action);
+		}
+
+		public static TaskActionInvoker Create<TResult> (Func<TResult> action)
+		{
+			return new FuncInvoke<TResult> (action);
+		}
+
+		public static TaskActionInvoker Create<TResult> (Func<object, TResult> action)
+		{
+			return new FuncObjectInvoke<TResult> (action);
+		}
+
+		public static TaskActionInvoker Create<TResult> (Func<Task, TResult> action)
+		{
+			return new FuncTaskInvoke<TResult> (action);
+		}
+
+		public static TaskActionInvoker Create<TResult> (Func<Task, object, TResult> action)
+		{
+			return new FuncTaskObjectInvoke<TResult> (action);
+		}
+
+		public static TaskActionInvoker Create<TResult, TNewResult> (Func<Task<TResult>, TNewResult> action)
+		{
+			return new FuncTaskInvoke<TResult, TNewResult> (action);
+		}
+
+		public static TaskActionInvoker Create<TResult, TNewResult> (Func<Task<TResult>, object, TNewResult> action)
+		{
+			return new FuncTaskObjectInvoke<TResult, TNewResult> (action);
+		}
+
+		public static TaskActionInvoker Create (Action<Task[]> action, Task[] tasks)
+		{
+			return new ActionTasksInvoke (action, tasks);
+		}
+
+		public static TaskActionInvoker Create<TResult> (Func<Task[], TResult> action, Task[] tasks)
+		{
+			return new FuncTasksInvoke<TResult> (action, tasks);
+		}
+
+		#region Used by WhenAny
+
+		public static TaskActionInvoker Create (Action<Task> action, Task[] tasks)
+		{
+			return new ActionTaskSelected (action, tasks);
+		}
+
+		public static TaskActionInvoker Create<TResult> (Func<Task, TResult> action, Task[] tasks)
+		{
+			return new FuncTaskSelected<TResult> (action, tasks);
+		}
+
+		#endregion
+
+		public abstract Delegate Action { get; }
+		public abstract void Invoke (Task owner, object state, Task context);
+	}
+}
+#endif
diff --git a/mcs/class/corlib/System.Threading.Tasks/TaskCompletionQueue.cs b/mcs/class/corlib/System.Threading.Tasks/TaskCompletionQueue.cs
new file mode 100644
index 0000000..ed9e594
--- /dev/null
+++ b/mcs/class/corlib/System.Threading.Tasks/TaskCompletionQueue.cs
@@ -0,0 +1,80 @@
+//
+// TaskCompletionQueue.cs
+//
+// Authors:
+//    Jérémie Laval <jeremie dot laval at xamarin dot com>
+//
+// Copyright 2011 Xamarin Inc (http://www.xamarin.com).
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+//
+
+#if NET_4_0 || MOBILE
+
+using System;
+using System.Threading;
+using System.Collections.Generic;
+using System.Collections.Concurrent;
+
+namespace System.Threading.Tasks
+{
+	internal struct TaskCompletionQueue<TCompletion> where TCompletion : class
+	{
+		TCompletion single;
+		ConcurrentOrderedList<TCompletion> completed;
+
+		public void Add (TCompletion continuation)
+		{
+			if (single == null && Interlocked.CompareExchange (ref single, continuation, null) == null)
+				return;
+			if (completed == null)
+				Interlocked.CompareExchange (ref completed, new ConcurrentOrderedList<TCompletion> (), null);
+			completed.TryAdd (continuation);
+		}
+
+		public bool Remove (TCompletion continuation)
+		{
+			TCompletion temp = single;
+			if (temp != null && temp == continuation && Interlocked.CompareExchange (ref single, null, continuation) == continuation)
+				return true;
+			if (completed != null)
+				return completed.TryRemove (continuation);
+			return false;
+		}
+
+		public bool HasElements {
+			get {
+				return single != null || (completed != null && completed.Count != 0);
+			}
+		}
+
+		public bool TryGetNextCompletion (out TCompletion continuation)
+		{
+			continuation = null;
+
+			if (single != null && (continuation = Interlocked.Exchange (ref single, null)) != null)
+				return true;
+
+			return completed != null && completed.TryPop (out continuation);
+		}
+	}
+}
+
+#endif
diff --git a/mcs/class/corlib/System.Threading.Tasks/TaskCompletionSource.cs b/mcs/class/corlib/System.Threading.Tasks/TaskCompletionSource.cs
index 74525bc..807ef02 100644
--- a/mcs/class/corlib/System.Threading.Tasks/TaskCompletionSource.cs
+++ b/mcs/class/corlib/System.Threading.Tasks/TaskCompletionSource.cs
@@ -1,10 +1,12 @@
 // 
 // TaskCompletionSource.cs
 //  
-// Author:
+// Authors:
 //       Jérémie "Garuma" Laval <jeremie.laval at gmail.com>
+//       Marek Safar <marek.safar at gmail.com>
 // 
 // Copyright (c) 2009 Jérémie "Garuma" Laval
+// Copyright 2011 Xamarin, Inc (http://www.xamarin.com)
 // 
 // Permission is hereby granted, free of charge, to any person obtaining a copy
 // of this software and associated documentation files (the "Software"), to deal
@@ -33,110 +35,92 @@ namespace System.Threading.Tasks
 	public class TaskCompletionSource<TResult>
 	{
 		readonly Task<TResult> source;
-		SpinLock opLock = new SpinLock (false);
 
 		public TaskCompletionSource ()
+			: this (null, TaskCreationOptions.None)
 		{
-			source = new Task<TResult> (null);
-			source.SetupScheduler (TaskScheduler.Current);
 		}
 		
 		public TaskCompletionSource (object state)
+			: this (state, TaskCreationOptions.None)
 		{
-			source = new Task<TResult> (null, state);
-			source.SetupScheduler (TaskScheduler.Current);
 		}
 		
 		public TaskCompletionSource (TaskCreationOptions creationOptions)
+			: this (null, creationOptions)
 		{
-			source = new Task<TResult> (null, creationOptions);
-			source.SetupScheduler (TaskScheduler.Current);
 		}
 		
 		public TaskCompletionSource (object state, TaskCreationOptions creationOptions)
 		{
-			source = new Task<TResult> (null, state, creationOptions);
+			if ((creationOptions & System.Threading.Tasks.Task.WorkerTaskNotSupportedOptions) != 0)
+				throw new ArgumentOutOfRangeException ("creationOptions");
+
+			source = new Task<TResult> (TaskActionInvoker.Empty, state, CancellationToken.None, creationOptions, null);
 			source.SetupScheduler (TaskScheduler.Current);
 		}
 		
 		public void SetCanceled ()
 		{
-			if (!ApplyOperation (source.CancelReal))
+			if (!TrySetCanceled ())
 				ThrowInvalidException ();
 		}
 		
 		public void SetException (Exception exception)
 		{
+			if (exception == null)
+				throw new ArgumentNullException ("exception");
+			
 			SetException (new Exception[] { exception });
 		}
 		
 		public void SetException (IEnumerable<Exception> exceptions)
 		{
-			if (!ApplyOperation (() => source.HandleGenericException (new AggregateException (exceptions))))
+			if (!TrySetException (exceptions))
 				ThrowInvalidException ();
 		}
 		
 		public void SetResult (TResult result)
 		{
-			if (!ApplyOperation (() => source.Result = result))
+			if (!TrySetResult (result))
 				ThrowInvalidException ();
 		}
 				
-		void ThrowInvalidException ()
+		static void ThrowInvalidException ()
 		{
 			throw new InvalidOperationException ("The underlying Task is already in one of the three final states: RanToCompletion, Faulted, or Canceled.");
 		}
 		
 		public bool TrySetCanceled ()
 		{
-			return ApplyOperation (source.CancelReal);
+			return source.TrySetCanceled ();
 		}
 		
 		public bool TrySetException (Exception exception)
 		{
+			if (exception == null)
+				throw new ArgumentNullException ("exception");
+			
 			return TrySetException (new Exception[] { exception });
 		}
 		
 		public bool TrySetException (IEnumerable<Exception> exceptions)
 		{
-			return ApplyOperation (() => source.HandleGenericException (new AggregateException (exceptions)));
-		}
-		
-		public bool TrySetResult (TResult result)
-		{
-			return ApplyOperation (() => source.Result = result);
-		}
-				
-		bool ApplyOperation (Action action)
-		{
-			bool taken = false;
-			try {
-				opLock.Enter (ref taken);
-				if (CheckInvalidState ())
-					return false;
-			
-				source.Status = TaskStatus.Running;
+			if (exceptions == null)
+				throw new ArgumentNullException ("exceptions");
 
-				if (action != null)
-					action ();
+			var aggregate = new AggregateException (exceptions);
+			if (aggregate.InnerExceptions.Count == 0)
+				throw new ArgumentNullException ("exceptions");
 
-				source.Finish ();
-			
-				return true;
-			} finally {
-				if (taken)
-					opLock.Exit ();
-			}
+			return source.TrySetException (aggregate);
 		}
 		
-		bool CheckInvalidState ()
+		public bool TrySetResult (TResult result)
 		{
-			return source.Status == TaskStatus.RanToCompletion ||
-				   source.Status == TaskStatus.Faulted || 
-				   source.Status == TaskStatus.Canceled;
-					
+			return source.TrySetResult (result);
 		}
-		
+
 		public Task<TResult> Task {
 			get {
 				return source;
diff --git a/mcs/class/corlib/System.Threading.Tasks/TaskConstants.cs b/mcs/class/corlib/System.Threading.Tasks/TaskConstants.cs
new file mode 100644
index 0000000..f7d3b7c
--- /dev/null
+++ b/mcs/class/corlib/System.Threading.Tasks/TaskConstants.cs
@@ -0,0 +1,51 @@
+//
+// TaskConstants.cs
+//
+// Authors:
+//    Jérémie Laval <jeremie dot laval at xamarin dot com>
+//
+// Copyright 2011 Xamarin Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+//
+
+#if NET_4_5
+
+namespace System.Threading.Tasks
+{
+	static class TaskConstants
+	{
+		public static readonly Task Finished;
+		public static readonly Task Canceled;
+
+		static TaskConstants ()
+		{
+			var tcs = new TaskCompletionSource<object> ();
+			tcs.SetResult (null);
+			Finished = tcs.Task;
+
+			tcs = new TaskCompletionSource<object> ();
+			tcs.SetCanceled ();
+			Canceled = tcs.Task;
+		}
+	}
+}
+
+#endif
diff --git a/mcs/class/corlib/System.Threading.Tasks/TaskConstants_T.cs b/mcs/class/corlib/System.Threading.Tasks/TaskConstants_T.cs
new file mode 100644
index 0000000..8b81389
--- /dev/null
+++ b/mcs/class/corlib/System.Threading.Tasks/TaskConstants_T.cs
@@ -0,0 +1,48 @@
+//
+// TaskConstants_T.cs
+//
+// Authors:
+//    Jérémie Laval <jeremie dot laval at xamarin dot com>
+//
+// Copyright 2011 Xamarin Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+//
+
+#if NET_4_5 || MOBILE
+using System;
+using System.Runtime.CompilerServices;
+
+namespace System.Threading.Tasks
+{
+	internal class TaskConstants<T>
+	{
+		internal static readonly Task<T> Canceled;
+
+		static TaskConstants ()
+		{
+			var tcs = new TaskCompletionSource<T> ();
+			tcs.SetCanceled ();
+			Canceled = tcs.Task;
+		}
+	}
+}
+
+#endif
diff --git a/mcs/class/corlib/System.Threading.Tasks/TaskContinuation.cs b/mcs/class/corlib/System.Threading.Tasks/TaskContinuation.cs
new file mode 100644
index 0000000..fbcbf2f
--- /dev/null
+++ b/mcs/class/corlib/System.Threading.Tasks/TaskContinuation.cs
@@ -0,0 +1,140 @@
+//
+// TaskContinuation.cs
+//
+// Authors:
+//    Jérémie Laval <jeremie dot laval at xamarin dot com>
+//    Marek Safar  <marek.safar at gmail.com>
+//
+// Copyright 2011 Xamarin Inc (http://www.xamarin.com).
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+//
+
+#if NET_4_0 || MOBILE
+
+namespace System.Threading.Tasks
+{
+	interface IContinuation
+	{
+		void Execute ();
+	}
+
+	class TaskContinuation : IContinuation
+	{
+		readonly Task task;
+		readonly TaskContinuationOptions continuationOptions;
+
+		public TaskContinuation (Task task, TaskContinuationOptions continuationOptions)
+		{
+			this.task = task;
+			this.continuationOptions = continuationOptions;
+		}
+
+		bool ContinuationStatusCheck (TaskContinuationOptions kind)
+		{
+			if (kind == TaskContinuationOptions.None)
+				return true;
+
+			int kindCode = (int) kind;
+			var status = task.Parent.Status;
+
+			if (kindCode >= ((int) TaskContinuationOptions.NotOnRanToCompletion)) {
+				// Remove other options
+				kind &= ~(TaskContinuationOptions.PreferFairness
+						  | TaskContinuationOptions.LongRunning
+						  | TaskContinuationOptions.AttachedToParent
+						  | TaskContinuationOptions.ExecuteSynchronously);
+
+				if (status == TaskStatus.Canceled) {
+					if (kind == TaskContinuationOptions.NotOnCanceled)
+						return false;
+					if (kind == TaskContinuationOptions.OnlyOnFaulted)
+						return false;
+					if (kind == TaskContinuationOptions.OnlyOnRanToCompletion)
+						return false;
+				} else if (status == TaskStatus.Faulted) {
+					if (kind == TaskContinuationOptions.NotOnFaulted)
+						return false;
+					if (kind == TaskContinuationOptions.OnlyOnCanceled)
+						return false;
+					if (kind == TaskContinuationOptions.OnlyOnRanToCompletion)
+						return false;
+				} else if (status == TaskStatus.RanToCompletion) {
+					if (kind == TaskContinuationOptions.NotOnRanToCompletion)
+						return false;
+					if (kind == TaskContinuationOptions.OnlyOnFaulted)
+						return false;
+					if (kind == TaskContinuationOptions.OnlyOnCanceled)
+						return false;
+				}
+			}
+
+			return true;
+		}
+
+		public void Execute ()
+		{
+			if (!ContinuationStatusCheck (continuationOptions)) {
+				task.CancelReal ();
+				task.Dispose ();
+				return;
+			}
+
+			if ((continuationOptions & TaskContinuationOptions.ExecuteSynchronously) != 0)
+				task.RunSynchronously (task.scheduler);
+			else
+				task.Schedule ();
+		}
+	}
+
+	class ActionContinuation : IContinuation
+	{
+		readonly Action action;
+
+		public ActionContinuation (Action action)
+		{
+			this.action = action;
+		}
+
+		public void Execute ()
+		{
+			action ();
+		}
+	}
+
+	class SynchronizationContextContinuation : IContinuation
+	{
+		readonly Action action;
+		readonly SynchronizationContext ctx;
+
+		public SynchronizationContextContinuation (Action action, SynchronizationContext ctx)
+		{
+			this.action = action;
+			this.ctx = ctx;
+		}
+
+		public void Execute ()
+		{
+			ctx.Post (l => ((Action) l) (), action);
+		}
+	}
+}
+
+#endif
diff --git a/mcs/class/corlib/System.Threading.Tasks/TaskCreationOptions.cs b/mcs/class/corlib/System.Threading.Tasks/TaskCreationOptions.cs
index cd4553d..b82652f 100644
--- a/mcs/class/corlib/System.Threading.Tasks/TaskCreationOptions.cs
+++ b/mcs/class/corlib/System.Threading.Tasks/TaskCreationOptions.cs
@@ -1,6 +1,11 @@
+//
 // TaskCreationOptions.cs
 //
+// Authors:
+//   Marek Safar (marek.safar at gmail.com)
+//
 // Copyright (c) 2008 Jérémie "Garuma" Laval
+// Copyright 2011 Xamarin Inc.
 //
 // Permission is hereby granted, free of charge, to any person obtaining a copy
 // of this software and associated documentation files (the "Software"), to deal
@@ -23,17 +28,20 @@
 //
 
 #if NET_4_0 || MOBILE
-using System;
 
 namespace System.Threading.Tasks
 {
-	[FlagsAttribute, System.SerializableAttribute]
+	[FlagsAttribute, SerializableAttribute]
 	public enum TaskCreationOptions
 	{
 		None             = 0x0,
 		PreferFairness   = 0x1,
 		LongRunning      = 0x2,
-		AttachedToParent = 0x4
+		AttachedToParent = 0x4,
+#if NET_4_5
+		DenyChildAttach  = 0x8,
+		HideScheduler    = 0x10
+#endif
 	}
 }
 #endif
diff --git a/mcs/class/corlib/System.Threading.Tasks/TaskDebuggerView.cs b/mcs/class/corlib/System.Threading.Tasks/TaskDebuggerView.cs
new file mode 100644
index 0000000..4b4413e
--- /dev/null
+++ b/mcs/class/corlib/System.Threading.Tasks/TaskDebuggerView.cs
@@ -0,0 +1,86 @@
+//
+// TaskDebuggerView.cs
+//
+// Authors:
+//	Marek Safar  <marek.safar at gmail.com>
+//
+// Copyright 2011 Xamarin, Inc (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_4_0 || MOBILE
+
+using System;
+using System.Diagnostics;
+
+namespace System.Threading.Tasks
+{
+	//
+	// Custom debugger type proxy for tasks
+	//
+	sealed class TaskDebuggerView
+	{
+		readonly Task task;
+		
+		public TaskDebuggerView (Task task)
+		{
+			this.task = task;
+		}
+		
+		public object AsyncState {
+			get {
+				return task.AsyncState;
+			}
+		}
+		
+		public TaskCreationOptions CreationOptions {
+			get {
+				return task.CreationOptions;
+			}
+		}
+		
+		public Exception Exception {
+			get {
+				return task.Exception;
+			}
+		}
+		
+		public int Id {
+			get {
+				return task.Id;
+			}
+		}
+		
+		public string Method {
+			get {
+				return task.DisplayActionMethod;
+			}
+		}
+		
+		public TaskStatus Status {
+			get {
+				return task.Status;
+			}
+		}
+	}
+}
+
+#endif
\ No newline at end of file
diff --git a/mcs/class/corlib/System.Threading.Tasks/TaskExceptionSlot.cs b/mcs/class/corlib/System.Threading.Tasks/TaskExceptionSlot.cs
new file mode 100644
index 0000000..4d7797c
--- /dev/null
+++ b/mcs/class/corlib/System.Threading.Tasks/TaskExceptionSlot.cs
@@ -0,0 +1,61 @@
+//
+// Task.cs
+//
+// Authors:
+//    Marek Safar  <marek.safar at gmail.com>
+//    Jérémie Laval <jeremie dot laval at xamarin dot com>
+//
+// Copyright (c) 2008 Jérémie "Garuma" Laval
+// Copyright 2011 Xamarin Inc (http://www.xamarin.com).
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+//
+
+#if NET_4_0 || MOBILE
+
+using System;
+using System.Collections.Concurrent;
+
+namespace System.Threading.Tasks
+{
+	internal class TaskExceptionSlot
+	{
+		public volatile AggregateException  Exception;
+		public volatile bool                Observed;
+		public ConcurrentQueue<AggregateException> ChildExceptions;
+
+		Task parent;
+
+		public TaskExceptionSlot (Task parent)
+		{
+			this.parent = parent;
+		}
+
+		~TaskExceptionSlot ()
+		{
+			if (Exception != null && !Observed && !TaskScheduler.FireUnobservedEvent (parent, Exception).Observed) {
+				parent = null;
+				throw Exception;
+			}
+		}
+	}
+}
+
+#endif
diff --git a/mcs/class/corlib/System.Threading.Tasks/TaskFactory.cs b/mcs/class/corlib/System.Threading.Tasks/TaskFactory.cs
index 253bbe2..62b66ca 100644
--- a/mcs/class/corlib/System.Threading.Tasks/TaskFactory.cs
+++ b/mcs/class/corlib/System.Threading.Tasks/TaskFactory.cs
@@ -1,10 +1,12 @@
 // 
 // TaskFactory.cs
 //  
-// Author:
+// Authors:
 //       Jérémie "Garuma" Laval <jeremie.laval at gmail.com>
+//       Marek Safar <marek.safar at gmail.com>
 // 
 // Copyright (c) 2009 Jérémie "Garuma" Laval
+// Copyright 2011 Xamarin, Inc (http://www.xamarin.com)
 // 
 // Permission is hereby granted, free of charge, to any person obtaining a copy
 // of this software and associated documentation files (the "Software"), to deal
@@ -26,27 +28,22 @@
 
 #if NET_4_0 || MOBILE
 
-using System;
-using System.Threading;
-
 namespace System.Threading.Tasks
 {
-	
 	public class TaskFactory
 	{
-		TaskScheduler scheduler;
+		readonly TaskScheduler scheduler;
 		TaskCreationOptions creationOptions;
 		TaskContinuationOptions continuationOptions;
 		CancellationToken cancellationToken;
 		
-		#region ctors
 		public TaskFactory ()
-			: this (CancellationToken.None, TaskCreationOptions.None, TaskContinuationOptions.None, TaskScheduler.Current)
+			: this (CancellationToken.None, TaskCreationOptions.None, TaskContinuationOptions.None, null)
 		{
 		}
 
 		public TaskFactory (CancellationToken cancellationToken)
-			: this (cancellationToken, TaskCreationOptions.None, TaskContinuationOptions.None, TaskScheduler.Current)
+			: this (cancellationToken, TaskCreationOptions.None, TaskContinuationOptions.None, null)
 		{	
 		}
 
@@ -56,7 +53,7 @@ namespace System.Threading.Tasks
 		}
 		
 		public TaskFactory (TaskCreationOptions creationOptions, TaskContinuationOptions continuationOptions)
-			: this (CancellationToken.None, creationOptions, continuationOptions, TaskScheduler.Current)
+			: this (CancellationToken.None, creationOptions, continuationOptions, null)
 		{	
 		}
 		
@@ -67,50 +64,98 @@ namespace System.Threading.Tasks
 			this.scheduler = scheduler;
 			this.creationOptions = creationOptions;
 			this.continuationOptions = continuationOptions;
+
+			CheckContinuationOptions (continuationOptions);
+		}
+		
+		public TaskScheduler Scheduler {
+			get {
+				return scheduler;
+			}
+		}
+		
+		public TaskContinuationOptions ContinuationOptions {
+			get {
+				return continuationOptions;
+			}
+		}
+		
+		public TaskCreationOptions CreationOptions {
+			get {
+				return creationOptions;
+			}
+		}
+		
+		public CancellationToken CancellationToken {
+			get {
+				return cancellationToken;
+			}
+		}
+
+		internal static void CheckContinuationOptions (TaskContinuationOptions continuationOptions)
+		{
+			if ((continuationOptions & (TaskContinuationOptions.OnlyOnRanToCompletion | TaskContinuationOptions.NotOnRanToCompletion)) != 0)
+				throw new ArgumentOutOfRangeException ("continuationOptions");
+
+			const TaskContinuationOptions long_running = TaskContinuationOptions.LongRunning | TaskContinuationOptions.ExecuteSynchronously;
+			if ((continuationOptions & long_running) == long_running)
+				throw new ArgumentOutOfRangeException ("continuationOptions", "Synchronous continuations cannot be long running");
 		}
-		#endregion
 		
 		#region StartNew for Task
 		public Task StartNew (Action action)
 		{
-			return StartNew (action, cancellationToken, creationOptions, scheduler);
+			return StartNew (action, cancellationToken, creationOptions, GetScheduler ());
 		}
 		
 		public Task StartNew (Action action, CancellationToken cancellationToken)
 		{
-			return StartNew (action, cancellationToken, creationOptions, scheduler);
+			return StartNew (action, cancellationToken, creationOptions, GetScheduler ());
 		}
 		
 		public Task StartNew (Action action, TaskCreationOptions creationOptions)
 		{
-			return StartNew (action, cancellationToken, creationOptions, scheduler);
+			return StartNew (action, cancellationToken, creationOptions, GetScheduler ());
+		}
+
+		public Task StartNew (Action action, CancellationToken cancellationToken, TaskCreationOptions creationOptions, TaskScheduler scheduler)
+		{
+			Task t = new Task (action, cancellationToken, creationOptions);
+
+			//
+			// Don't start cancelled task it would throw an exception
+			//
+			if (!t.IsCompleted)
+				t.Start (scheduler);
+
+			return t;
 		}
 		
 		public Task StartNew (Action<object> action, object state)
 		{
-			return StartNew (action, state, cancellationToken, creationOptions, scheduler);
+			return StartNew (action, state, cancellationToken, creationOptions, GetScheduler ());
 		}
 		
 		public Task StartNew (Action<object> action, object state, CancellationToken cancellationToken)
 		{
-			return StartNew (action, state, cancellationToken, creationOptions, scheduler);
+			return StartNew (action, state, cancellationToken, creationOptions, GetScheduler ());
 		}
 		
 		public Task StartNew (Action<object> action, object state, TaskCreationOptions creationOptions)
 		{
-			return StartNew (action, state, cancellationToken, creationOptions, scheduler);
-		}
-		
-		public Task StartNew (Action action, CancellationToken cancellationToken, TaskCreationOptions creationOptions, TaskScheduler scheduler)
-		{
-			return StartNew ((o) => action (), null, cancellationToken, creationOptions, scheduler);
+			return StartNew (action, state, cancellationToken, creationOptions, GetScheduler ());
 		}
 		
 		public Task StartNew (Action<object> action, object state, CancellationToken cancellationToken, TaskCreationOptions creationOptions,
 		                      TaskScheduler scheduler)
 		{
 			Task t = new Task (action, state, cancellationToken, creationOptions);
-			t.Start (scheduler);
+
+			//
+			// Don't start cancelled task it would throw an exception
+			//
+			if (!t.IsCompleted)
+				t.Start (scheduler);
 			
 			return t;
 		}
@@ -119,18 +164,18 @@ namespace System.Threading.Tasks
 		#region StartNew for Task<TResult>	
 		public Task<TResult> StartNew<TResult> (Func<TResult> function)
 		{
-			return StartNew<TResult> (function, cancellationToken, creationOptions, scheduler);
+			return StartNew<TResult> (function, cancellationToken, creationOptions, GetScheduler ());
 		}
 		
 		public Task<TResult> StartNew<TResult> (Func<TResult> function, TaskCreationOptions creationOptions)
 		{
-			return StartNew<TResult> (function, cancellationToken, creationOptions, scheduler);
+			return StartNew<TResult> (function, cancellationToken, creationOptions, GetScheduler ());
 
 		}
 		
 		public Task<TResult> StartNew<TResult> (Func<TResult> function, CancellationToken cancellationToken)
 		{
-			return StartNew<TResult> (function, cancellationToken, creationOptions, scheduler);
+			return StartNew<TResult> (function, cancellationToken, creationOptions, GetScheduler ());
 		}
 		
 		public Task<TResult> StartNew<TResult> (Func<TResult> function,
@@ -138,22 +183,30 @@ namespace System.Threading.Tasks
 		                                        TaskCreationOptions creationOptions,
 		                                        TaskScheduler scheduler)
 		{
-			return StartNew<TResult> ((o) => function (), null, cancellationToken, creationOptions, scheduler);
+			var t = new Task<TResult> (function, cancellationToken, creationOptions);
+
+			//
+			// Don't start cancelled task it would throw an exception
+			//
+			if (!t.IsCompleted)
+				t.Start (scheduler);
+
+			return t;
 		}
 		
 		public Task<TResult> StartNew<TResult> (Func<object, TResult> function, object state)
 		{
-			return StartNew<TResult> (function, state, cancellationToken, creationOptions, scheduler);
+			return StartNew<TResult> (function, state, cancellationToken, creationOptions, GetScheduler ());
 		}
 		
 		public Task<TResult> StartNew<TResult> (Func<object, TResult> function, object state, CancellationToken cancellationToken)
 		{
-			return StartNew<TResult> (function, state, cancellationToken, creationOptions, scheduler);
+			return StartNew<TResult> (function, state, cancellationToken, creationOptions, GetScheduler ());
 		}
 		
 		public Task<TResult> StartNew<TResult> (Func<object, TResult> function, object state, TaskCreationOptions creationOptions)
 		{
-			return StartNew<TResult> (function, state, cancellationToken, creationOptions, scheduler);
+			return StartNew<TResult> (function, state, cancellationToken, creationOptions, GetScheduler ());
 		}
 		
 		public Task<TResult> StartNew<TResult> (Func<object, TResult> function, object state,
@@ -172,56 +225,65 @@ namespace System.Threading.Tasks
 		
 		public Task ContinueWhenAny (Task[] tasks, Action<Task> continuationAction)
 		{
-			return ContinueWhenAny (tasks, continuationAction, cancellationToken, continuationOptions, scheduler);
+			return ContinueWhenAny (tasks, continuationAction, cancellationToken, continuationOptions, GetScheduler ());
 		}
 		
 		public Task ContinueWhenAny (Task[] tasks, Action<Task> continuationAction, CancellationToken cancellationToken)
 		{
-			return ContinueWhenAny (tasks, continuationAction, cancellationToken, continuationOptions, scheduler);
+			return ContinueWhenAny (tasks, continuationAction, cancellationToken, continuationOptions, GetScheduler ());
 		}
 		
 		public Task ContinueWhenAny (Task[] tasks, Action<Task> continuationAction, TaskContinuationOptions continuationOptions)
 		{
-			return ContinueWhenAny (tasks, continuationAction, cancellationToken, continuationOptions, scheduler);
+			return ContinueWhenAny (tasks, continuationAction, cancellationToken, continuationOptions, GetScheduler ());
 		}
 
-		public Task ContinueWhenAny (Task[] tasks,
-		                             Action<Task> continuationAction,
-		                             CancellationToken cancellationToken,
-		                             TaskContinuationOptions continuationOptions,
-		                             TaskScheduler scheduler)
+		public Task ContinueWhenAny (Task[] tasks, Action<Task> continuationAction, CancellationToken cancellationToken, TaskContinuationOptions continuationOptions, TaskScheduler scheduler)
 		{
-			var ourTasks = (Task[])tasks.Clone ();
-			AtomicBoolean trigger = new AtomicBoolean ();
-			Task commonContinuation = new Task (null);
-			
-			foreach (Task t in ourTasks) {
-				Task cont = new Task ((o) => continuationAction ((Task)o), t, cancellationToken, creationOptions);
-				t.ContinueWithCore (cont, continuationOptions, scheduler, trigger.TrySet);
-				cont.ContinueWithCore (commonContinuation, TaskContinuationOptions.None, scheduler);
+			if (tasks == null)
+				throw new ArgumentNullException ("tasks");
+
+			if (tasks.Length == 0)
+				throw new ArgumentException ("The tasks argument contains no tasks", "tasks");
+
+			foreach (var ta in tasks) {
+				if (ta == null)
+					throw new ArgumentException ("The tasks argument constains a null value", "tasks");
 			}
-			
-			return commonContinuation;
+
+			if (continuationAction == null)
+				throw new ArgumentNullException ("continuationAction");
+
+			var t = new Task<int> (l => {
+				var data = (Tuple<Task[], CancellationToken>) l;
+				return Task.WaitAny (data.Item1, data.Item2);
+			}, Tuple.Create (tasks, cancellationToken));
+
+			var cont = t.ContinueWith (TaskActionInvoker.Create (continuationAction, tasks), cancellationToken, continuationOptions, scheduler);
+
+			t.Start (scheduler);
+
+			return cont;
 		}
 		
 		public Task ContinueWhenAny<TAntecedentResult> (Task<TAntecedentResult>[] tasks,
 		                                                Action<Task<TAntecedentResult>> continuationAction)
 		{
-			return ContinueWhenAny (tasks, continuationAction, cancellationToken, continuationOptions, scheduler);
+			return ContinueWhenAny (tasks, continuationAction, cancellationToken, continuationOptions, GetScheduler ());
 		}
 		
 		public Task ContinueWhenAny<TAntecedentResult> (Task<TAntecedentResult>[] tasks,
 		                                                Action<Task<TAntecedentResult>> continuationAction,
 		                                                CancellationToken cancellationToken)
 		{
-			return ContinueWhenAny (tasks, continuationAction, cancellationToken, continuationOptions, scheduler);
+			return ContinueWhenAny (tasks, continuationAction, cancellationToken, continuationOptions, GetScheduler ());
 		}
 		
 		public Task ContinueWhenAny<TAntecedentResult> (Task<TAntecedentResult>[] tasks,
 		                                                Action<Task<TAntecedentResult>> continuationAction,
 		                                                TaskContinuationOptions continuationOptions)
 		{
-			return ContinueWhenAny (tasks, continuationAction, cancellationToken, continuationOptions, scheduler);
+			return ContinueWhenAny (tasks, continuationAction, cancellationToken, continuationOptions, GetScheduler ());
 		}
 
 		public Task ContinueWhenAny<TAntecedentResult> (Task<TAntecedentResult>[] tasks,
@@ -237,21 +299,21 @@ namespace System.Threading.Tasks
 
 		public Task<TResult> ContinueWhenAny<TResult> (Task[] tasks, Func<Task, TResult> continuationFunction)
 		{
-			return ContinueWhenAny (tasks, continuationFunction, cancellationToken, continuationOptions, scheduler);
+			return ContinueWhenAny (tasks, continuationFunction, cancellationToken, continuationOptions, GetScheduler ());
 		}
 
 		public Task<TResult> ContinueWhenAny<TResult> (Task[] tasks,
 		                                               Func<Task, TResult> continuationFunction,
 		                                               CancellationToken cancellationToken)
 		{
-			return ContinueWhenAny (tasks, continuationFunction, cancellationToken, continuationOptions, scheduler);
+			return ContinueWhenAny (tasks, continuationFunction, cancellationToken, continuationOptions, GetScheduler ());
 		}
 
 		public Task<TResult> ContinueWhenAny<TResult> (Task[] tasks,
 		                                               Func<Task, TResult> continuationFunction,
 		                                               TaskContinuationOptions continuationOptions)
 		{
-			return ContinueWhenAny (tasks, continuationFunction, cancellationToken, continuationOptions, scheduler);
+			return ContinueWhenAny (tasks, continuationFunction, cancellationToken, continuationOptions, GetScheduler ());
 		}
 
 		public Task<TResult> ContinueWhenAny<TResult> (Task[] tasks,
@@ -260,36 +322,36 @@ namespace System.Threading.Tasks
 		                                               TaskContinuationOptions continuationOptions,
 		                                               TaskScheduler scheduler)
 		{
-			var ourTasks = (Task[])tasks.Clone ();
-			AtomicBoolean trigger = new AtomicBoolean ();
-			TaskCompletionSource<TResult> source = new TaskCompletionSource<TResult> ();
+			var t = new Task<int> (l => {
+				var data = (Tuple<Task[], CancellationToken>) l;
+				return Task.WaitAny (data.Item1, data.Item2);
+			}, Tuple.Create (tasks, cancellationToken));
 
-			foreach (Task t in ourTasks) {
-				Task cont = new Task ((o) => source.SetResult (continuationFunction ((Task)o)), t, cancellationToken, creationOptions);
-				t.ContinueWithCore (cont, continuationOptions, scheduler, trigger.TrySet);
-			}
+			var cont = t.ContinueWith<TResult> (TaskActionInvoker.Create (continuationFunction, tasks), cancellationToken, continuationOptions, scheduler);
 
-			return source.Task;
+			t.Start (scheduler);
+
+			return cont;
 		}
 
 		public Task<TResult> ContinueWhenAny<TAntecedentResult, TResult> (Task<TAntecedentResult>[] tasks,
 		                                                                  Func<Task<TAntecedentResult>, TResult> continuationFunction)
 		{
-			return ContinueWhenAny (tasks, continuationFunction, cancellationToken, continuationOptions, scheduler);
+			return ContinueWhenAny (tasks, continuationFunction, cancellationToken, continuationOptions, GetScheduler ());
 		}
 
 		public Task<TResult> ContinueWhenAny<TAntecedentResult, TResult> (Task<TAntecedentResult>[] tasks,
 		                                                                  Func<Task<TAntecedentResult>, TResult> continuationFunction,
 		                                                                  CancellationToken cancellationToken)
 		{
-			return ContinueWhenAny (tasks, continuationFunction, cancellationToken, continuationOptions, scheduler);
+			return ContinueWhenAny (tasks, continuationFunction, cancellationToken, continuationOptions, GetScheduler ());
 		}
 
 		public Task<TResult> ContinueWhenAny<TAntecedentResult, TResult> (Task<TAntecedentResult>[] tasks,
 		                                                                  Func<Task<TAntecedentResult>, TResult> continuationFunction,
 		                                                                  TaskContinuationOptions continuationOptions)
 		{
-			return ContinueWhenAny (tasks, continuationFunction, cancellationToken, continuationOptions, scheduler);
+			return ContinueWhenAny (tasks, continuationFunction, cancellationToken, continuationOptions, GetScheduler ());
 		}
 
 		public Task<TResult> ContinueWhenAny<TAntecedentResult, TResult> (Task<TAntecedentResult>[] tasks,
@@ -307,49 +369,51 @@ namespace System.Threading.Tasks
 		
 		public Task ContinueWhenAll (Task[] tasks, Action<Task[]> continuationAction)
 		{
-			return ContinueWhenAll (tasks, continuationAction, cancellationToken, continuationOptions, scheduler);
+			return ContinueWhenAll (tasks, continuationAction, cancellationToken, continuationOptions, GetScheduler ());
 		}
 		
 		public Task ContinueWhenAll (Task[] tasks, Action<Task[]> continuationAction, CancellationToken cancellationToken)
 		{
-			return ContinueWhenAll (tasks, continuationAction, cancellationToken, continuationOptions, scheduler);
+			return ContinueWhenAll (tasks, continuationAction, cancellationToken, continuationOptions, GetScheduler ());
 		}
 		
 		public Task ContinueWhenAll (Task[] tasks, Action<Task[]> continuationAction,
 		                             TaskContinuationOptions continuationOptions)
 		{
-			return ContinueWhenAll (tasks, continuationAction, cancellationToken, continuationOptions, scheduler);
+			return ContinueWhenAll (tasks, continuationAction, cancellationToken, continuationOptions, GetScheduler ());
 		}
 		
 		public Task ContinueWhenAll (Task[] tasks, Action<Task[]> continuationAction, CancellationToken cancellationToken,
 		                             TaskContinuationOptions continuationOptions, TaskScheduler scheduler)
 		{
-			var ourTasks = (Task[])tasks.Clone ();
-			CountdownEvent evt = new CountdownEvent (ourTasks.Length);
-			Task cont = new Task ((o) => continuationAction ((Task[])o), ourTasks, cancellationToken, creationOptions);
-			
-			foreach (Task t in ourTasks)
-				t.ContinueWithCore (cont, continuationOptions, scheduler, evt.Signal);
-			
+			var t = new Task (l => {
+				var data = (Tuple<Task[], CancellationToken>) l;
+				Task.WaitAll (data.Item1, data.Item2);
+			}, Tuple.Create (tasks, cancellationToken));
+
+			var cont = t.ContinueWith (TaskActionInvoker.Create (continuationAction, tasks), cancellationToken, continuationOptions, scheduler);
+
+			t.Start (scheduler);
+
 			return cont;
 		}
 		
 		public Task ContinueWhenAll<TAntecedentResult> (Task<TAntecedentResult>[] tasks,
 		                                                Action<Task<TAntecedentResult>[]> continuationAction)
 		{
-			return ContinueWhenAll (tasks, continuationAction, cancellationToken, continuationOptions, scheduler);
+			return ContinueWhenAll (tasks, continuationAction, cancellationToken, continuationOptions, GetScheduler ());
 		}
 		
 		public Task ContinueWhenAll<TAntecedentResult> (Task<TAntecedentResult>[] tasks,
 		                                                Action<Task<TAntecedentResult>[]> continuationAction, CancellationToken cancellationToken)
 		{
-			return ContinueWhenAll (tasks, continuationAction, cancellationToken, continuationOptions, scheduler);
+			return ContinueWhenAll (tasks, continuationAction, cancellationToken, continuationOptions, GetScheduler ());
 		}
 		
 		public Task ContinueWhenAll<TAntecedentResult> (Task<TAntecedentResult>[] tasks, Action<Task<TAntecedentResult>[]> continuationAction,
 		                                                TaskContinuationOptions continuationOptions)
 		{
-			return ContinueWhenAll (tasks, continuationAction, cancellationToken, continuationOptions, scheduler);
+			return ContinueWhenAll (tasks, continuationAction, cancellationToken, continuationOptions, GetScheduler ());
 		}
 		
 		public Task ContinueWhenAll<TAntecedentResult> (Task<TAntecedentResult>[] tasks, 
@@ -363,53 +427,55 @@ namespace System.Threading.Tasks
 		
 		public Task<TResult> ContinueWhenAll<TResult> (Task[] tasks, Func<Task[], TResult> continuationFunction)
 		{
-			return ContinueWhenAll<TResult> (tasks, continuationFunction, cancellationToken, continuationOptions, scheduler);
+			return ContinueWhenAll<TResult> (tasks, continuationFunction, cancellationToken, continuationOptions, GetScheduler ());
 		}
 		
 		public Task<TResult> ContinueWhenAll<TResult> (Task[] tasks, Func<Task[], TResult> continuationFunction,
 		                                               TaskContinuationOptions continuationOptions)
 		{
-			return ContinueWhenAll<TResult> (tasks, continuationFunction, cancellationToken, continuationOptions, scheduler);
+			return ContinueWhenAll<TResult> (tasks, continuationFunction, cancellationToken, continuationOptions, GetScheduler ());
 		}
 		
 		public Task<TResult> ContinueWhenAll<TResult> (Task[] tasks, Func<Task[], TResult> continuationFunction,
 		                                               CancellationToken cancellationToken)
 		{
-			return ContinueWhenAll<TResult> (tasks, continuationFunction, cancellationToken, continuationOptions, scheduler);
+			return ContinueWhenAll<TResult> (tasks, continuationFunction, cancellationToken, continuationOptions, GetScheduler ());
 		}
 		
 		public Task<TResult> ContinueWhenAll<TResult> (Task[] tasks, Func<Task[], TResult> continuationFunction,
 		                                               CancellationToken cancellationToken,
 		                                               TaskContinuationOptions continuationOptions, TaskScheduler scheduler)
 		{
-			var ourTasks = (Task[])tasks.Clone ();
-			CountdownEvent evt = new CountdownEvent (ourTasks.Length);
-			Task<TResult> cont = new Task<TResult> ((o) => continuationFunction ((Task[])o), ourTasks, cancellationToken, creationOptions);
-			
-			foreach (Task t in ourTasks)
-				t.ContinueWithCore (cont, continuationOptions, scheduler, evt.Signal);
-			
+			var t = new Task (l => {
+				var data = (Tuple<Task[], CancellationToken>) l;
+				Task.WaitAll (data.Item1, data.Item2);
+			}, Tuple.Create (tasks, cancellationToken));
+
+			var cont = t.ContinueWith<TResult> (TaskActionInvoker.Create (continuationFunction, tasks), cancellationToken, continuationOptions, scheduler);
+
+			t.Start (scheduler);
+
 			return cont;
 		}
 		
 		public Task<TResult> ContinueWhenAll<TAntecedentResult, TResult> (Task<TAntecedentResult>[] tasks,
 		                                                                  Func<Task<TAntecedentResult>[], TResult> continuationFunction)
 		{
-			return ContinueWhenAll<TAntecedentResult, TResult> (tasks, continuationFunction, cancellationToken, continuationOptions, scheduler);
+			return ContinueWhenAll<TAntecedentResult, TResult> (tasks, continuationFunction, cancellationToken, continuationOptions, GetScheduler ());
 		}
 		
 		public Task<TResult> ContinueWhenAll<TAntecedentResult, TResult> (Task<TAntecedentResult>[] tasks, 
 		                                                                  Func<Task<TAntecedentResult>[], TResult> continuationFunction,
 		                                                                  TaskContinuationOptions continuationOptions)
 		{
-			return ContinueWhenAll<TAntecedentResult, TResult> (tasks, continuationFunction, cancellationToken, continuationOptions, scheduler);
+			return ContinueWhenAll<TAntecedentResult, TResult> (tasks, continuationFunction, cancellationToken, continuationOptions, GetScheduler ());
 		}
 		
 		public Task<TResult> ContinueWhenAll<TAntecedentResult, TResult> (Task<TAntecedentResult>[] tasks,
 		                                                                  Func<Task<TAntecedentResult>[], TResult> continuationFunction,
 		                                                                  CancellationToken cancellationToken)
 		{
-			return ContinueWhenAll<TAntecedentResult, TResult> (tasks, continuationFunction, cancellationToken, continuationOptions, scheduler);
+			return ContinueWhenAll<TAntecedentResult, TResult> (tasks, continuationFunction, cancellationToken, continuationOptions, GetScheduler ());
 		}
 		
 		public Task<TResult> ContinueWhenAll<TAntecedentResult, TResult> (Task<TAntecedentResult>[] tasks, 
@@ -425,547 +491,170 @@ namespace System.Threading.Tasks
 		}
 
 		#endregion
+
+		#region FromAsync IAsyncResult
 		
-		#region FromAsync
 		public Task FromAsync (IAsyncResult asyncResult, Action<IAsyncResult> endMethod)
 		{
-			return FromAsync (asyncResult, endMethod, creationOptions, scheduler);
+			return FromAsync (asyncResult, endMethod, creationOptions);
 		}
 		
-		public Task FromAsync (IAsyncResult asyncResult, Action<IAsyncResult> endMethod,
-		                       TaskCreationOptions creationOptions)
+		public Task FromAsync (IAsyncResult asyncResult, Action<IAsyncResult> endMethod, TaskCreationOptions creationOptions)
 		{
-			return FromAsync (asyncResult, endMethod, creationOptions, scheduler);
+			return FromAsync (asyncResult, endMethod, creationOptions, GetScheduler ());
 		}
-		
-		public Task FromAsync (IAsyncResult asyncResult, Action<IAsyncResult> endMethod,
-		                       TaskCreationOptions creationOptions, TaskScheduler scheduler)
+
+		public Task FromAsync (IAsyncResult asyncResult, Action<IAsyncResult> endMethod, TaskCreationOptions creationOptions, TaskScheduler scheduler)
 		{
-			return FromAsync<object> (asyncResult, (ar) => { endMethod (ar); return null; }, creationOptions, scheduler);
+			if (endMethod == null)
+				throw new ArgumentNullException ("endMethod");
+
+			return TaskFactory<object>.FromIAsyncResult (asyncResult,
+				l => {
+					endMethod (asyncResult);
+					return null;
+				}, creationOptions, scheduler);
 		}
 		
 		public Task<TResult> FromAsync<TResult> (IAsyncResult asyncResult, Func<IAsyncResult, TResult> endMethod)
 		{
-			return FromAsync<TResult> (asyncResult, endMethod, creationOptions, scheduler);
+			return FromAsync<TResult> (asyncResult, endMethod, creationOptions);
 		}
 		
-		public Task<TResult> FromAsync<TResult> (IAsyncResult asyncResult, Func<IAsyncResult, TResult> endMethod,
-		                                         TaskCreationOptions creationOptions)
+		public Task<TResult> FromAsync<TResult> (IAsyncResult asyncResult, Func<IAsyncResult, TResult> endMethod, TaskCreationOptions creationOptions)
 		{
-			return FromAsync<TResult> (asyncResult, endMethod, creationOptions, scheduler);
+			return FromAsync<TResult> (asyncResult, endMethod, creationOptions, GetScheduler ());
 		}
 		
-		public Task<TResult> FromAsync<TResult> (IAsyncResult asyncResult, Func<IAsyncResult, TResult> endMethod,
-		                                         TaskCreationOptions creationOptions, TaskScheduler scheduler)
+		public Task<TResult> FromAsync<TResult> (IAsyncResult asyncResult, Func<IAsyncResult, TResult> endMethod, TaskCreationOptions creationOptions, TaskScheduler scheduler)
 		{
-			var completionSource = new TaskCompletionSource<TResult> ();
+			return TaskFactory<TResult>.FromIAsyncResult (asyncResult, endMethod, creationOptions, scheduler);
+		}
 
-			ThreadPool.RegisterWaitForSingleObject (asyncResult.AsyncWaitHandle,
-			                                        (o, b) => {
-				                                        try {
-					                                        completionSource.SetResult (endMethod (asyncResult));
-				                                        } catch (Exception e) {
-					                                        completionSource.SetException (e);
-				                                        }
-			                                        },
-			                                        null,
-			                                        -1,
-			                                        true);
+		#endregion
 
-			return completionSource.Task;
-		}
-		
-		public Task FromAsync (Func<AsyncCallback, Object, IAsyncResult> beginMethod,
-		                       Action<IAsyncResult> endMethod,
-		                       object state)
+		#region FromAsync Begin/End Method
+
+		public Task FromAsync (Func<AsyncCallback, object, IAsyncResult> beginMethod, Action<IAsyncResult> endMethod, object state)
 		{
 			return FromAsync (beginMethod, endMethod, state, creationOptions);
 		}
-		
-		public Task FromAsync (Func<AsyncCallback, Object, IAsyncResult> beginMethod,
-		                       Action<IAsyncResult> endMethod,
-		                       object state, TaskCreationOptions creationOptions)
+
+		public Task FromAsync (Func<AsyncCallback, object, IAsyncResult> beginMethod, Action<IAsyncResult> endMethod,
+							   object state, TaskCreationOptions creationOptions)
 		{
-			return FromAsync (beginMethod, (ar) => { endMethod (ar); return (object)null; }, state, creationOptions);
+			return TaskFactory<object>.FromAsyncBeginEnd (beginMethod,
+				l => { endMethod (l); return null; },
+				state, creationOptions);
 		}
-		
-		public Task FromAsync<TArg1> (Func<TArg1, AsyncCallback, Object, IAsyncResult> beginMethod, Action<IAsyncResult> endMethod,
-		                              TArg1 arg1, object state)
+
+		public Task FromAsync<TArg1> (Func<TArg1, AsyncCallback, object, IAsyncResult> beginMethod, Action<IAsyncResult> endMethod,
+			                          TArg1 arg1, object state)
 		{
 			return FromAsync (beginMethod, endMethod, arg1, state, creationOptions);
 		}
-		
-		public Task FromAsync<TArg1> (Func<TArg1, AsyncCallback, Object, IAsyncResult> beginMethod, Action<IAsyncResult> endMethod,
+
+		public Task FromAsync<TArg1> (Func<TArg1, AsyncCallback, object, IAsyncResult> beginMethod, Action<IAsyncResult> endMethod,
 		                              TArg1 arg1, object state, TaskCreationOptions creationOptions)
 		{
-			return FromAsync (beginMethod, (ar) => { endMethod (ar); return (object)null; }, arg1, state, creationOptions);
+			if (endMethod == null)
+				throw new ArgumentNullException ("endMethod");
+
+			return TaskFactory<object>.FromAsyncBeginEnd (beginMethod,
+				l => { endMethod (l); return null; },
+				arg1, state, creationOptions);
 		}
-		
-		public Task FromAsync<TArg1, TArg2> (Func<TArg1, TArg2, AsyncCallback, Object, IAsyncResult> beginMethod,
+
+		public Task FromAsync<TArg1, TArg2> (Func<TArg1, TArg2, AsyncCallback, object, IAsyncResult> beginMethod,
 		                                     Action<IAsyncResult> endMethod,
 		                                     TArg1 arg1, TArg2 arg2, object state)
 		{
 			return FromAsync (beginMethod, endMethod, arg1, arg2, state, creationOptions);
 		}
-		
-		public Task FromAsync<TArg1, TArg2> (Func<TArg1, TArg2, AsyncCallback, Object, IAsyncResult> beginMethod,
+
+		public Task FromAsync<TArg1, TArg2> (Func<TArg1, TArg2, AsyncCallback, object, IAsyncResult> beginMethod,
 		                                     Action<IAsyncResult> endMethod,
 		                                     TArg1 arg1, TArg2 arg2, object state, TaskCreationOptions creationOptions)
 		{
-			return FromAsync (beginMethod, (ar) => { endMethod (ar); return (object)null; }, arg1, arg2, state, creationOptions);
+			if (endMethod == null)
+				throw new ArgumentNullException ("endMethod");
+
+			return TaskFactory<object>.FromAsyncBeginEnd (beginMethod,
+				l => { endMethod (l); return null; },
+				arg1, arg2, state, creationOptions);
 		}
-		
-		public Task FromAsync<TArg1, TArg2, TArg3> (Func<TArg1, TArg2, TArg3, AsyncCallback, Object, IAsyncResult> beginMethod, Action<IAsyncResult> endMethod,
+
+		public Task FromAsync<TArg1, TArg2, TArg3> (Func<TArg1, TArg2, TArg3, AsyncCallback, object, IAsyncResult> beginMethod, Action<IAsyncResult> endMethod,
 		                                            TArg1 arg1, TArg2 arg2, TArg3 arg3, object state)
 		{
 			return FromAsync (beginMethod, endMethod, arg1, arg2, arg3, state, creationOptions);
 		}
-		
-		public Task FromAsync<TArg1, TArg2, TArg3> (Func<TArg1, TArg2, TArg3, AsyncCallback, Object, IAsyncResult> beginMethod, Action<IAsyncResult> endMethod,
+
+		public Task FromAsync<TArg1, TArg2, TArg3> (Func<TArg1, TArg2, TArg3, AsyncCallback, object, IAsyncResult> beginMethod, Action<IAsyncResult> endMethod,
 		                                            TArg1 arg1, TArg2 arg2, TArg3 arg3, object state, TaskCreationOptions creationOptions)
 		{
-			return FromAsync (beginMethod, (ar) => { endMethod (ar); return (object)null; }, arg1, arg2, arg3, state, creationOptions);
-		}		
-		
-		public Task<TResult> FromAsync<TResult> (Func<AsyncCallback, Object, IAsyncResult> beginMethod,
-		                                         Func<IAsyncResult, TResult> endMethod,
+			if (endMethod == null)
+				throw new ArgumentNullException ("endMethod");
+
+			return TaskFactory<object>.FromAsyncBeginEnd (beginMethod,
+				l => { endMethod (l); return null; },
+				arg1, arg2, arg3, state, creationOptions);
+		}
+
+		public Task<TResult> FromAsync<TResult> (Func<AsyncCallback, object, IAsyncResult> beginMethod, Func<IAsyncResult, TResult> endMethod,
 		                                         object state)
 		{
 			return FromAsync (beginMethod, endMethod, state, creationOptions);
 		}
-		
-		public Task<TResult> FromAsync<TResult> (Func<AsyncCallback, Object, IAsyncResult> beginMethod,
-		                                         Func<IAsyncResult, TResult> endMethod,
+
+		public Task<TResult> FromAsync<TResult> (Func<AsyncCallback, object, IAsyncResult> beginMethod, Func<IAsyncResult, TResult> endMethod,
 		                                         object state, TaskCreationOptions creationOptions)
 		{
-			var completionSource = new TaskCompletionSource<TResult> (creationOptions);
-			beginMethod ((ar) => {
-				try {
-					completionSource.SetResult (endMethod (ar));
-				} catch (Exception e) {
-					completionSource.SetException (e);
-				}
-			}, state);
-
-			return completionSource.Task;
+			return TaskFactory<TResult>.FromAsyncBeginEnd (beginMethod, endMethod, state, creationOptions);
 		}
-		
-		public Task<TResult> FromAsync<TArg1, TResult> (Func<TArg1, AsyncCallback, Object, IAsyncResult> beginMethod,
-		                                                Func<IAsyncResult, TResult> endMethod,
+
+		public Task<TResult> FromAsync<TArg1, TResult> (Func<TArg1, AsyncCallback, object, IAsyncResult> beginMethod, Func<IAsyncResult, TResult> endMethod,
 		                                                TArg1 arg1, object state)
 		{
 			return FromAsync (beginMethod, endMethod, arg1, state, creationOptions);
 		}
-		
-		public Task<TResult> FromAsync<TArg1, TResult> (Func<TArg1, AsyncCallback, Object, IAsyncResult> beginMethod,
-		                                                Func<IAsyncResult, TResult> endMethod,
+
+		public Task<TResult> FromAsync<TArg1, TResult> (Func<TArg1, AsyncCallback, object, IAsyncResult> beginMethod, Func<IAsyncResult, TResult> endMethod,
 		                                                TArg1 arg1, object state, TaskCreationOptions creationOptions)
 		{
-			var completionSource = new TaskCompletionSource<TResult> (creationOptions);
-			beginMethod (arg1, (ar) => {
-				try {
-					completionSource.SetResult (endMethod (ar));
-				} catch (Exception e) {
-					completionSource.SetException (e);
-				}
-			}, state);
-
-			return completionSource.Task;
+			return TaskFactory<TResult>.FromAsyncBeginEnd (beginMethod, endMethod, arg1, state, creationOptions);
 		}
 
-		public Task<TResult> FromAsync<TArg1, TArg2, TResult> (Func<TArg1, TArg2, AsyncCallback, Object, IAsyncResult> beginMethod,
+		public Task<TResult> FromAsync<TArg1, TArg2, TResult> (Func<TArg1, TArg2, AsyncCallback, object, IAsyncResult> beginMethod,
 		                                                       Func<IAsyncResult, TResult> endMethod,
 		                                                       TArg1 arg1, TArg2 arg2, object state)
 		{
 			return FromAsync (beginMethod, endMethod, arg1, arg2, state, creationOptions);
 		}
-		
-		public Task<TResult> FromAsync<TArg1, TArg2, TResult> (Func<TArg1, TArg2, AsyncCallback, Object, IAsyncResult> beginMethod,
-		                                                       Func<IAsyncResult, TResult> endMethod,
+
+		public Task<TResult> FromAsync<TArg1, TArg2, TResult> (Func<TArg1, TArg2, AsyncCallback, object, IAsyncResult> beginMethod, Func<IAsyncResult, TResult> endMethod,
 		                                                       TArg1 arg1, TArg2 arg2, object state, TaskCreationOptions creationOptions)
 		{
-			var completionSource = new TaskCompletionSource<TResult> (creationOptions);
-			beginMethod (arg1, arg2, (ar) => {
-				try {
-					completionSource.SetResult (endMethod (ar));
-				} catch (Exception e) {
-					completionSource.SetException (e);
-				}
-			}, state);
-
-			return completionSource.Task;
+			return TaskFactory<TResult>.FromAsyncBeginEnd (beginMethod, endMethod, arg1, arg2, state, creationOptions);
 		}
-		
-		public Task<TResult> FromAsync<TArg1, TArg2, TArg3, TResult> (Func<TArg1, TArg2, TArg3, AsyncCallback, Object, IAsyncResult> beginMethod,
-		                                                              Func<IAsyncResult, TResult> endMethod,
+
+		public Task<TResult> FromAsync<TArg1, TArg2, TArg3, TResult> (Func<TArg1, TArg2, TArg3, AsyncCallback, object, IAsyncResult> beginMethod, Func<IAsyncResult, TResult> endMethod,
 		                                                              TArg1 arg1, TArg2 arg2, TArg3 arg3, object state)
 		{
 			return FromAsync (beginMethod, endMethod, arg1, arg2, arg3, state, creationOptions);
 		}
-		
-		public Task<TResult> FromAsync<TArg1, TArg2, TArg3, TResult> (Func<TArg1, TArg2, TArg3, AsyncCallback, Object, IAsyncResult> beginMethod,
-		                                                              Func<IAsyncResult, TResult> endMethod,
-		                                                              TArg1 arg1, TArg2 arg2, TArg3 arg3, object state,
-		                                                              TaskCreationOptions creationOptions)
-		{
-			var completionSource = new TaskCompletionSource<TResult> (creationOptions);
-			beginMethod (arg1, arg2, arg3, (ar) => {
-				try {
-					completionSource.SetResult (endMethod (ar));
-				} catch (Exception e) {
-					completionSource.SetException (e);
-				}
-			}, state);
 
-			return completionSource.Task;
-		}
-		#endregion
-		
-		public TaskScheduler Scheduler {
-			get {
-				return scheduler;
-			}
-		}
-		
-		public TaskContinuationOptions ContinuationOptions {
-			get {
-				return continuationOptions;
-			}
-		}
-		
-		public TaskCreationOptions CreationOptions {
-			get {
-				return creationOptions;
-			}
-		}
-		
-		public CancellationToken CancellationToken {
-			get {
-				return cancellationToken;
-			}
-		}
-	}
-	
-	public class TaskFactory<TResult>
-	{
-		TaskScheduler scheduler;
-		TaskCreationOptions creationOptions;
-		TaskContinuationOptions continuationOptions;
-		CancellationToken cancellationToken;
-		
-		TaskFactory parent;
-		
-		#region ctors
-		public TaskFactory ()
-			: this (CancellationToken.None, TaskCreationOptions.None, TaskContinuationOptions.None, TaskScheduler.Current)
-		{	
-		}
-		
-		public TaskFactory (TaskScheduler scheduler)
-			: this (CancellationToken.None, TaskCreationOptions.None, TaskContinuationOptions.None, scheduler)
-		{	
-		}
-		
-		public TaskFactory (CancellationToken cancellationToken)
-			: this (cancellationToken, TaskCreationOptions.None, TaskContinuationOptions.None, TaskScheduler.Current)
-		{	
-		}
-		
-		public TaskFactory (TaskCreationOptions creationOptions, TaskContinuationOptions continuationOptions)
-			: this (CancellationToken.None, creationOptions, continuationOptions, TaskScheduler.Current)
-		{	
-		}
-		
-		public TaskFactory (CancellationToken cancellationToken, TaskCreationOptions creationOptions, TaskContinuationOptions continuationOptions,
-		                    TaskScheduler scheduler)
-		{
-			this.cancellationToken = cancellationToken;
-			this.scheduler = scheduler;
-			this.creationOptions = creationOptions;
-			this.continuationOptions = continuationOptions;
-			
-			this.parent = new TaskFactory (cancellationToken, creationOptions, continuationOptions, scheduler);
-		}
-		
-		#endregion
-		
-		#region StartNew for Task<TResult>	
-		public Task<TResult> StartNew (Func<TResult> function)
-		{
-			return StartNew (function, cancellationToken, creationOptions, scheduler);
-		}
-		
-		public Task<TResult> StartNew (Func<TResult> function, TaskCreationOptions creationOptions)
-		{
-			return StartNew (function, cancellationToken, creationOptions, scheduler);
-		}
-		
-		public Task<TResult> StartNew (Func<TResult> function, CancellationToken cancellationToken)
-		{
-			return StartNew (function, cancellationToken, creationOptions, scheduler);
-		}
-		
-		public Task<TResult> StartNew (Func<TResult> function, 
-		                               CancellationToken cancellationToken,
-		                               TaskCreationOptions creationOptions,
-		                               TaskScheduler scheduler)
-		{
-			return StartNew ((o) => function (), null, cancellationToken, creationOptions, scheduler);
-		}
-		
-		public Task<TResult> StartNew (Func<object, TResult> function, object state)
-		{
-			return StartNew (function, state, cancellationToken, creationOptions, scheduler);
-		}
-		
-		public Task<TResult> StartNew (Func<object, TResult> function, object state, TaskCreationOptions creationOptions)
+		public Task<TResult> FromAsync<TArg1, TArg2, TArg3, TResult> (Func<TArg1, TArg2, TArg3, AsyncCallback, object, IAsyncResult> beginMethod, Func<IAsyncResult, TResult> endMethod,
+		                                                              TArg1 arg1, TArg2 arg2, TArg3 arg3, object state, TaskCreationOptions creationOptions)
 		{
-			return StartNew (function, state, cancellationToken, creationOptions, scheduler);
-		}
-		
-		public Task<TResult> StartNew (Func<object, TResult> function, object state, CancellationToken cancellationToken)
-		{
-			return StartNew (function, state, cancellationToken, creationOptions, scheduler);
-		}
-		
-		public Task<TResult> StartNew (Func<object, TResult> function, object state, 
-		                               CancellationToken cancellationToken,
-		                               TaskCreationOptions creationOptions,
-		                               TaskScheduler scheduler)
-		{
-			return parent.StartNew<TResult> (function, state, cancellationToken, creationOptions, scheduler);
-		}
-		#endregion
-		
-		#region Continue
-
-		public Task<TResult> ContinueWhenAny (Task[] tasks,
-		                                      Func<Task, TResult> continuationFunction)
-		{
-			return ContinueWhenAny (tasks, continuationFunction, cancellationToken, continuationOptions, scheduler);
-		}
-
-		public Task<TResult> ContinueWhenAny (Task[] tasks,
-		                                      Func<Task, TResult> continuationFunction,
-		                                      CancellationToken cancellationToken)
-		{
-			return ContinueWhenAny (tasks, continuationFunction, cancellationToken, continuationOptions, scheduler);
-		}
-
-		public Task<TResult> ContinueWhenAny (Task[] tasks,
-		                                      Func<Task, TResult> continuationFunction,
-		                                      TaskContinuationOptions continuationOptions)
-		{
-			return ContinueWhenAny (tasks, continuationFunction, cancellationToken, continuationOptions, scheduler);
-		}
-
-		public Task<TResult> ContinueWhenAny (Task[] tasks,
-		                                      Func<Task, TResult> continuationFunction,
-		                                      CancellationToken cancellationToken,
-		                                      TaskContinuationOptions continuationOptions,
-		                                      TaskScheduler scheduler)
-		{
-			return parent.ContinueWhenAny (tasks, continuationFunction, cancellationToken, continuationOptions, scheduler);
-		}
-
-		public Task<TResult> ContinueWhenAny<TAntecedentResult> (Task<TAntecedentResult>[] tasks,
-		                                                         Func<Task<TAntecedentResult>, TResult> continuationFunction)
-		{
-			return ContinueWhenAny (tasks, continuationFunction, cancellationToken, continuationOptions, scheduler);
-		}
-
-		public Task<TResult> ContinueWhenAny<TAntecedentResult> (Task<TAntecedentResult>[] tasks,
-		                                                         Func<Task<TAntecedentResult>, TResult> continuationFunction,
-		                                                         CancellationToken cancellationToken)
-		{
-			return ContinueWhenAny (tasks, continuationFunction, cancellationToken, continuationOptions, scheduler);
-		}
-
-		public Task<TResult> ContinueWhenAny<TAntecedentResult> (Task<TAntecedentResult>[] tasks,
-		                                                         Func<Task<TAntecedentResult>, TResult> continuationFunction,
-		                                                         TaskContinuationOptions continuationOptions)
-		{
-			return ContinueWhenAny (tasks, continuationFunction, cancellationToken, continuationOptions, scheduler);
-		}
-
-		public Task<TResult> ContinueWhenAny<TAntecedentResult> (Task<TAntecedentResult>[] tasks,
-		                                                         Func<Task<TAntecedentResult>, TResult> continuationFunction,
-		                                                         CancellationToken cancellationToken,
-		                                                         TaskContinuationOptions continuationOptions,
-		                                                         TaskScheduler scheduler)
-		{
-			return parent.ContinueWhenAny (tasks, continuationFunction, cancellationToken, continuationOptions, scheduler);
-		}
-		
-		public Task<TResult> ContinueWhenAll (Task[] tasks,
-		                                      Func<Task[], TResult> continuationFunction)
-		{
-			return ContinueWhenAll (tasks, continuationFunction, cancellationToken, continuationOptions, scheduler);
-		}
-		
-		public Task<TResult> ContinueWhenAll (Task[] tasks,
-		                                      Func<Task[], TResult> continuationFunction,
-		                                      TaskContinuationOptions continuationOptions)
-		{
-			return ContinueWhenAll (tasks, continuationFunction, cancellationToken, continuationOptions, scheduler);
-		}
-		
-		public Task<TResult> ContinueWhenAll (Task[] tasks,
-		                                      Func<Task[], TResult> continuationFunction,
-		                                      CancellationToken cancellationToken)
-		{
-			return ContinueWhenAll (tasks, continuationFunction, cancellationToken, continuationOptions, scheduler);
-		}
-		
-		public Task<TResult> ContinueWhenAll (Task[] tasks,
-		                                      Func<Task[], TResult> continuationFunction,
-		                                      CancellationToken cancellationToken,
-		                                      TaskContinuationOptions continuationOptions, TaskScheduler scheduler)
-		{
-			return parent.ContinueWhenAll (tasks, continuationFunction, cancellationToken, continuationOptions, scheduler);
-		}
-		
-		public Task<TResult> ContinueWhenAll<TAntecedentResult> (Task<TAntecedentResult>[] tasks,
-		                                                         Func<Task<TAntecedentResult>[], TResult> continuationFunction)
-		{
-			return ContinueWhenAll (tasks, continuationFunction, cancellationToken, continuationOptions, scheduler);
-		}
-		
-		public Task<TResult> ContinueWhenAll<TAntecedentResult> (Task<TAntecedentResult>[] tasks,
-		                                                         Func<Task<TAntecedentResult>[], TResult> continuationFunction,
-		                                                         TaskContinuationOptions continuationOptions)
-		{
-			return ContinueWhenAll (tasks, continuationFunction, cancellationToken, continuationOptions, scheduler);
-		}
-		
-		public Task<TResult> ContinueWhenAll<TAntecedentResult> (Task<TAntecedentResult>[] tasks,
-		                                                         Func<Task<TAntecedentResult>[], TResult> continuationFunction,
-		                                                         CancellationToken cancellationToken)
-		{
-			return ContinueWhenAll (tasks, continuationFunction, cancellationToken, continuationOptions, scheduler);
-		}
-		
-		public Task<TResult> ContinueWhenAll<TAntecedentResult> (Task<TAntecedentResult>[] tasks,
-		                                                         Func<Task<TAntecedentResult>[], TResult> continuationFunction,
-		                                                         CancellationToken cancellationToken,
-		                                                         TaskContinuationOptions continuationOptions, TaskScheduler scheduler)
-		{
-			return parent.ContinueWhenAll (tasks, continuationFunction, cancellationToken, continuationOptions, scheduler);
+			return TaskFactory<TResult>.FromAsyncBeginEnd (beginMethod, endMethod, arg1, arg2, arg3, state, creationOptions);
 		}
 
 		#endregion
-		
-		#region FromAsync
-		const string errorMsg = "Mono's thread pool doesn't support this operation yet";
-		
-		[MonoLimitation(errorMsg)]
-		public Task<TResult> FromAsync (IAsyncResult asyncResult, Func<IAsyncResult, TResult> endMethod)
-		{
-			return FromAsync (asyncResult, endMethod, creationOptions);
-		}
-		
-		[MonoLimitation(errorMsg)]
-		public Task<TResult> FromAsync (IAsyncResult asyncResult, Func<IAsyncResult, TResult> endMethod,
-		                                TaskCreationOptions creationOptions)
-		{
-			return FromAsync (asyncResult, endMethod, creationOptions);
-		}
-		
-		[MonoLimitation(errorMsg)]
-		public Task<TResult> FromAsync (IAsyncResult asyncResult, Func<IAsyncResult, TResult> endMethod,
-		                                TaskCreationOptions creationOptions, TaskScheduler scheduler)
-		{
-			throw new NotSupportedException (errorMsg);
-		}
-		
-		[MonoLimitation(errorMsg)]
-		public Task<TResult> FromAsync (Func<AsyncCallback, Object, IAsyncResult> beginMethod,
-		                                Func<IAsyncResult, TResult> endMethod,
-		                                object state)
-		{
-			throw new NotSupportedException (errorMsg);
-		}
-		
-		[MonoLimitation(errorMsg)]
-		public Task<TResult> FromAsync (Func<AsyncCallback, Object, IAsyncResult> beginMethod,
-		                                Func<IAsyncResult, TResult> endMethod,
-		                                object state, TaskCreationOptions creationOptions)
-		{
-			throw new NotSupportedException (errorMsg);
-		}
-		
-		[MonoLimitation(errorMsg)]
-		public Task<TResult> FromAsync<TArg1> (Func<TArg1, AsyncCallback, Object, IAsyncResult> beginMethod,
-		                                       Func<IAsyncResult, TResult> endMethod,
-		                                       TArg1 arg1, object state)
-		{
-			throw new NotSupportedException (errorMsg);
-		}
-		
-		[MonoLimitation(errorMsg)]
-		public Task<TResult> FromAsync<TArg1> (Func<TArg1, AsyncCallback, Object, IAsyncResult> beginMethod,
-		                                       Func<IAsyncResult, TResult> endMethod,
-		                                       TArg1 arg1, object state, TaskCreationOptions creationOptions)
-		{
-			throw new NotSupportedException (errorMsg);
-		}
-		
-		[MonoLimitation(errorMsg)]
-		public Task<TResult> FromAsync<TArg1, TArg2> (Func<TArg1, TArg2, AsyncCallback, Object, IAsyncResult> beginMethod,
-		                                              Func<IAsyncResult, TResult> endMethod,
-		                                              TArg1 arg1, TArg2 arg2, object state)
-		{
-			throw new NotSupportedException (errorMsg);
-		}
-		
-		[MonoLimitation(errorMsg)]
-		public Task<TResult> FromAsync<TArg1, TArg2> (Func<TArg1, TArg2, AsyncCallback, Object, IAsyncResult> beginMethod,
-		                                              Func<IAsyncResult, TResult> endMethod,
-		                                              TArg1 arg1, TArg2 arg2, object state, TaskCreationOptions creationOptions)
-		{
-			throw new NotSupportedException (errorMsg);
-		}
-		
-		[MonoLimitation(errorMsg)]
-		public Task<TResult> FromAsync<TArg1, TArg2, TArg3> (Func<TArg1, TArg2, TArg3, AsyncCallback, Object, IAsyncResult> beginMethod,
-		                                                     Func<IAsyncResult, TResult> endMethod,
-		                                                     TArg1 arg1, TArg2 arg2, TArg3 arg3, object state)
-		{
-			throw new NotSupportedException (errorMsg);
-		}
-		
-		[MonoLimitation(errorMsg)]
-		public Task<TResult> FromAsync<TArg1, TArg2, TArg3> (Func<TArg1, TArg2, TArg3, AsyncCallback, Object, IAsyncResult> beginMethod,
-		                                                     Func<IAsyncResult, TResult> endMethod,
-		                                                     TArg1 arg1, TArg2 arg2, TArg3 arg3, object state,
-		                                                     TaskCreationOptions creationOptions)
+
+		TaskScheduler GetScheduler ()
 		{
-			throw new NotSupportedException (errorMsg);
-		}
-		#endregion
-		
-		public TaskScheduler Scheduler {
-			get {
-				return scheduler;
-			}
-		}
-		
-		public TaskContinuationOptions ContinuationOptions {
-			get {
-				return continuationOptions;
-			}
-		}
-		
-		public TaskCreationOptions CreationOptions {
-			get {
-				return creationOptions;
-			}
-		}
-		
-		public CancellationToken CancellationToken {
-			get {
-				return cancellationToken;
-			}
+			return scheduler ?? TaskScheduler.Current;
 		}
 	}
 }
diff --git a/mcs/class/corlib/System.Threading.Tasks/TaskFactory_T.cs b/mcs/class/corlib/System.Threading.Tasks/TaskFactory_T.cs
new file mode 100644
index 0000000..af9ff6f
--- /dev/null
+++ b/mcs/class/corlib/System.Threading.Tasks/TaskFactory_T.cs
@@ -0,0 +1,458 @@
+// 
+// TaskFactory_T.cs
+//  
+// Authors:
+//       Jérémie "Garuma" Laval <jeremie.laval at gmail.com>
+//       Marek Safar <marek.safar at gmail.com>
+// 
+// Copyright (c) 2009 Jérémie "Garuma" Laval
+// Copyright 2011 Xamarin, Inc (http://www.xamarin.com)
+// 
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+// 
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#if NET_4_0 || MOBILE
+
+namespace System.Threading.Tasks
+{
+	public class TaskFactory<TResult>
+	{
+		readonly TaskScheduler scheduler;
+		TaskCreationOptions creationOptions;
+		TaskContinuationOptions continuationOptions;
+		CancellationToken cancellationToken;
+		
+		TaskFactory parent;
+
+		public TaskFactory ()
+			: this (CancellationToken.None)
+		{	
+		}
+		
+		public TaskFactory (TaskScheduler scheduler)
+			: this (CancellationToken.None, TaskCreationOptions.None, TaskContinuationOptions.None, scheduler)
+		{	
+		}
+		
+		public TaskFactory (CancellationToken cancellationToken)
+			: this (cancellationToken, TaskCreationOptions.None, TaskContinuationOptions.None, null)
+		{	
+		}
+		
+		public TaskFactory (TaskCreationOptions creationOptions, TaskContinuationOptions continuationOptions)
+			: this (CancellationToken.None, creationOptions, continuationOptions, null)
+		{	
+		}
+		
+		public TaskFactory (CancellationToken cancellationToken, TaskCreationOptions creationOptions, TaskContinuationOptions continuationOptions, TaskScheduler scheduler)
+		{
+			this.cancellationToken = cancellationToken;
+			this.scheduler = scheduler;
+			this.creationOptions = creationOptions;
+			this.continuationOptions = continuationOptions;
+
+			TaskFactory.CheckContinuationOptions (continuationOptions);
+			
+			this.parent = new TaskFactory (cancellationToken, creationOptions, continuationOptions, scheduler);
+		}
+
+		public TaskScheduler Scheduler {
+			get {
+				return scheduler;
+			}
+		}
+		
+		public TaskContinuationOptions ContinuationOptions {
+			get {
+				return continuationOptions;
+			}
+		}
+		
+		public TaskCreationOptions CreationOptions {
+			get {
+				return creationOptions;
+			}
+		}
+		
+		public CancellationToken CancellationToken {
+			get {
+				return cancellationToken;
+			}
+		}
+		
+		#region StartNew for Task<TResult>	
+		public Task<TResult> StartNew (Func<TResult> function)
+		{
+			return StartNew (function, cancellationToken, creationOptions, GetScheduler ());
+		}
+		
+		public Task<TResult> StartNew (Func<TResult> function, TaskCreationOptions creationOptions)
+		{
+			return StartNew (function, cancellationToken, creationOptions, GetScheduler ());
+		}
+		
+		public Task<TResult> StartNew (Func<TResult> function, CancellationToken cancellationToken)
+		{
+			return StartNew (function, cancellationToken, creationOptions, GetScheduler ());
+		}
+		
+		public Task<TResult> StartNew (Func<TResult> function, 
+		                               CancellationToken cancellationToken,
+		                               TaskCreationOptions creationOptions,
+		                               TaskScheduler scheduler)
+		{
+			return StartNew ((o) => function (), null, cancellationToken, creationOptions, scheduler);
+		}
+		
+		public Task<TResult> StartNew (Func<object, TResult> function, object state)
+		{
+			return StartNew (function, state, cancellationToken, creationOptions, GetScheduler ());
+		}
+		
+		public Task<TResult> StartNew (Func<object, TResult> function, object state, TaskCreationOptions creationOptions)
+		{
+			return StartNew (function, state, cancellationToken, creationOptions, GetScheduler ());
+		}
+		
+		public Task<TResult> StartNew (Func<object, TResult> function, object state, CancellationToken cancellationToken)
+		{
+			return StartNew (function, state, cancellationToken, creationOptions, GetScheduler ());
+		}
+		
+		public Task<TResult> StartNew (Func<object, TResult> function, object state, 
+		                               CancellationToken cancellationToken,
+		                               TaskCreationOptions creationOptions,
+		                               TaskScheduler scheduler)
+		{
+			return parent.StartNew<TResult> (function, state, cancellationToken, creationOptions, scheduler);
+		}
+		#endregion
+		
+		#region Continue
+
+		public Task<TResult> ContinueWhenAny (Task[] tasks,
+		                                      Func<Task, TResult> continuationFunction)
+		{
+			return ContinueWhenAny (tasks, continuationFunction, cancellationToken, continuationOptions, GetScheduler ());
+		}
+
+		public Task<TResult> ContinueWhenAny (Task[] tasks,
+		                                      Func<Task, TResult> continuationFunction,
+		                                      CancellationToken cancellationToken)
+		{
+			return ContinueWhenAny (tasks, continuationFunction, cancellationToken, continuationOptions, GetScheduler ());
+		}
+
+		public Task<TResult> ContinueWhenAny (Task[] tasks,
+		                                      Func<Task, TResult> continuationFunction,
+		                                      TaskContinuationOptions continuationOptions)
+		{
+			return ContinueWhenAny (tasks, continuationFunction, cancellationToken, continuationOptions, GetScheduler ());
+		}
+
+		public Task<TResult> ContinueWhenAny (Task[] tasks,
+		                                      Func<Task, TResult> continuationFunction,
+		                                      CancellationToken cancellationToken,
+		                                      TaskContinuationOptions continuationOptions,
+		                                      TaskScheduler scheduler)
+		{
+			return parent.ContinueWhenAny (tasks, continuationFunction, cancellationToken, continuationOptions, scheduler);
+		}
+
+		public Task<TResult> ContinueWhenAny<TAntecedentResult> (Task<TAntecedentResult>[] tasks,
+		                                                         Func<Task<TAntecedentResult>, TResult> continuationFunction)
+		{
+			return ContinueWhenAny (tasks, continuationFunction, cancellationToken, continuationOptions, GetScheduler ());
+		}
+
+		public Task<TResult> ContinueWhenAny<TAntecedentResult> (Task<TAntecedentResult>[] tasks,
+		                                                         Func<Task<TAntecedentResult>, TResult> continuationFunction,
+		                                                         CancellationToken cancellationToken)
+		{
+			return ContinueWhenAny (tasks, continuationFunction, cancellationToken, continuationOptions, GetScheduler ());
+		}
+
+		public Task<TResult> ContinueWhenAny<TAntecedentResult> (Task<TAntecedentResult>[] tasks,
+		                                                         Func<Task<TAntecedentResult>, TResult> continuationFunction,
+		                                                         TaskContinuationOptions continuationOptions)
+		{
+			return ContinueWhenAny (tasks, continuationFunction, cancellationToken, continuationOptions, GetScheduler ());
+		}
+
+		public Task<TResult> ContinueWhenAny<TAntecedentResult> (Task<TAntecedentResult>[] tasks,
+		                                                         Func<Task<TAntecedentResult>, TResult> continuationFunction,
+		                                                         CancellationToken cancellationToken,
+		                                                         TaskContinuationOptions continuationOptions,
+		                                                         TaskScheduler scheduler)
+		{
+			return parent.ContinueWhenAny (tasks, continuationFunction, cancellationToken, continuationOptions, scheduler);
+		}
+		
+		public Task<TResult> ContinueWhenAll (Task[] tasks, Func<Task[], TResult> continuationFunction)
+		{
+			return ContinueWhenAll (tasks, continuationFunction, cancellationToken, continuationOptions, GetScheduler ());
+		}
+		
+		public Task<TResult> ContinueWhenAll (Task[] tasks,
+		                                      Func<Task[], TResult> continuationFunction,
+		                                      TaskContinuationOptions continuationOptions)
+		{
+			return ContinueWhenAll (tasks, continuationFunction, cancellationToken, continuationOptions, GetScheduler ());
+		}
+		
+		public Task<TResult> ContinueWhenAll (Task[] tasks,
+		                                      Func<Task[], TResult> continuationFunction,
+		                                      CancellationToken cancellationToken)
+		{
+			return ContinueWhenAll (tasks, continuationFunction, cancellationToken, continuationOptions, GetScheduler ());
+		}
+		
+		public Task<TResult> ContinueWhenAll (Task[] tasks,
+		                                      Func<Task[], TResult> continuationFunction,
+		                                      CancellationToken cancellationToken,
+		                                      TaskContinuationOptions continuationOptions, TaskScheduler scheduler)
+		{
+			return parent.ContinueWhenAll (tasks, continuationFunction, cancellationToken, continuationOptions, scheduler);
+		}
+		
+		public Task<TResult> ContinueWhenAll<TAntecedentResult> (Task<TAntecedentResult>[] tasks,
+		                                                         Func<Task<TAntecedentResult>[], TResult> continuationFunction)
+		{
+			return ContinueWhenAll (tasks, continuationFunction, cancellationToken, continuationOptions, GetScheduler ());
+		}
+		
+		public Task<TResult> ContinueWhenAll<TAntecedentResult> (Task<TAntecedentResult>[] tasks,
+		                                                         Func<Task<TAntecedentResult>[], TResult> continuationFunction,
+		                                                         TaskContinuationOptions continuationOptions)
+		{
+			return ContinueWhenAll (tasks, continuationFunction, cancellationToken, continuationOptions, GetScheduler ());
+		}
+		
+		public Task<TResult> ContinueWhenAll<TAntecedentResult> (Task<TAntecedentResult>[] tasks,
+		                                                         Func<Task<TAntecedentResult>[], TResult> continuationFunction,
+		                                                         CancellationToken cancellationToken)
+		{
+			return ContinueWhenAll (tasks, continuationFunction, cancellationToken, continuationOptions, GetScheduler ());
+		}
+		
+		public Task<TResult> ContinueWhenAll<TAntecedentResult> (Task<TAntecedentResult>[] tasks,
+		                                                         Func<Task<TAntecedentResult>[], TResult> continuationFunction,
+		                                                         CancellationToken cancellationToken,
+		                                                         TaskContinuationOptions continuationOptions, TaskScheduler scheduler)
+		{
+			return parent.ContinueWhenAll (tasks, continuationFunction, cancellationToken, continuationOptions, scheduler);
+		}
+
+		#endregion
+		
+		#region FromAsync
+		
+		public Task<TResult> FromAsync (IAsyncResult asyncResult, Func<IAsyncResult, TResult> endMethod)
+		{
+			return FromAsync (asyncResult, endMethod, creationOptions);
+		}
+		
+		public Task<TResult> FromAsync (IAsyncResult asyncResult, Func<IAsyncResult, TResult> endMethod, TaskCreationOptions creationOptions)
+		{
+			return FromAsync (asyncResult, endMethod, creationOptions, GetScheduler ());
+		}
+		
+		public Task<TResult> FromAsync (IAsyncResult asyncResult, Func<IAsyncResult, TResult> endMethod, TaskCreationOptions creationOptions, TaskScheduler scheduler)
+		{
+			return FromIAsyncResult (asyncResult, endMethod, creationOptions, scheduler);
+		}
+
+		internal static Task<TResult> FromIAsyncResult (IAsyncResult asyncResult, Func<IAsyncResult, TResult> endMethod, TaskCreationOptions creationOptions, TaskScheduler scheduler)
+		{
+			if (asyncResult == null)
+			    throw new ArgumentNullException ("asyncResult");
+
+			if (endMethod == null)
+			    throw new ArgumentNullException ("endMethod");
+
+			if (scheduler == null)
+				throw new ArgumentNullException ("scheduler");
+
+			if ((creationOptions & Task.WorkerTaskNotSupportedOptions) != 0)
+				throw new ArgumentOutOfRangeException ("creationOptions");
+
+			var source = new CancellationTokenSource ();
+			var task = new Task<TResult> (l => {
+				try {
+					return endMethod (asyncResult);
+				} catch (OperationCanceledException) {
+					source.Cancel ();
+					source.Token.ThrowIfCancellationRequested ();
+				}
+				return default (TResult);
+			}, null, source.Token, creationOptions);
+
+			// Take quick path for completed operations
+			if (asyncResult.IsCompleted) {
+				task.RunSynchronously (scheduler);
+			} else {
+				ThreadPool.RegisterWaitForSingleObject (asyncResult.AsyncWaitHandle,
+				                                        (s, t) => task.RunSynchronously (scheduler),
+				                                        null, Timeout.Infinite, true);
+			}
+
+			return task;
+		}
+
+		public Task<TResult> FromAsync (Func<AsyncCallback, object, IAsyncResult> beginMethod, Func<IAsyncResult, TResult> endMethod,
+		                                object state)
+		{
+			return FromAsync (beginMethod, endMethod, state, creationOptions);
+		}
+
+		public Task<TResult> FromAsync (Func<AsyncCallback, object, IAsyncResult> beginMethod, Func<IAsyncResult, TResult> endMethod,
+		                                object state, TaskCreationOptions creationOptions)
+		{
+			return FromAsyncBeginEnd (beginMethod, endMethod, state, creationOptions);
+		}
+
+		internal static Task<TResult> FromAsyncBeginEnd (Func<AsyncCallback, object, IAsyncResult> beginMethod, Func<IAsyncResult, TResult> endMethod,
+		                                                 object state, TaskCreationOptions creationOptions)
+		{
+			if (beginMethod == null)
+				throw new ArgumentNullException ("beginMethod");
+
+			if (endMethod == null)
+				throw new ArgumentNullException ("endMethod");
+
+			if ((creationOptions & Task.WorkerTaskNotSupportedOptions) != 0)
+				throw new ArgumentOutOfRangeException ("creationOptions");
+
+			var tcs = new TaskCompletionSource<TResult> (state, creationOptions);
+			beginMethod (l => InnerInvoke (tcs, endMethod, l), state);
+
+			return tcs.Task;
+		}
+
+		public Task<TResult> FromAsync<TArg1> (Func<TArg1, AsyncCallback, object, IAsyncResult> beginMethod, Func<IAsyncResult, TResult> endMethod,
+		                                       TArg1 arg1, object state)
+		{
+			return FromAsync (beginMethod, endMethod, arg1, state, creationOptions);
+		}
+
+		public Task<TResult> FromAsync<TArg1> (Func<TArg1, AsyncCallback, object, IAsyncResult> beginMethod, Func<IAsyncResult, TResult> endMethod,
+		                                       TArg1 arg1, object state, TaskCreationOptions creationOptions)
+		{
+			return FromAsyncBeginEnd (beginMethod, endMethod, arg1, state, creationOptions);
+		}
+
+		internal static Task<TResult> FromAsyncBeginEnd<TArg1> (Func<TArg1, AsyncCallback, object, IAsyncResult> beginMethod,
+		                                                        Func<IAsyncResult, TResult> endMethod,
+		                                                        TArg1 arg1, object state, TaskCreationOptions creationOptions)
+		{
+			if (beginMethod == null)
+				throw new ArgumentNullException ("beginMethod");
+
+			if (endMethod == null)
+				throw new ArgumentNullException ("endMethod");
+
+			if ((creationOptions & Task.WorkerTaskNotSupportedOptions) != 0)
+				throw new ArgumentOutOfRangeException ("creationOptions");
+
+			var tcs = new TaskCompletionSource<TResult> (state, creationOptions);
+			beginMethod (arg1, l => InnerInvoke (tcs, endMethod, l), state);
+
+			return tcs.Task;
+		}
+
+		public Task<TResult> FromAsync<TArg1, TArg2> (Func<TArg1, TArg2, AsyncCallback, object, IAsyncResult> beginMethod, Func<IAsyncResult, TResult> endMethod,
+		                                              TArg1 arg1, TArg2 arg2, object state)
+		{
+			return FromAsync (beginMethod, endMethod, arg1, arg2, state, creationOptions);
+		}
+
+		public Task<TResult> FromAsync<TArg1, TArg2> (Func<TArg1, TArg2, AsyncCallback, object, IAsyncResult> beginMethod, Func<IAsyncResult, TResult> endMethod,
+		                                              TArg1 arg1, TArg2 arg2, object state, TaskCreationOptions creationOptions)
+		{
+			return FromAsyncBeginEnd (beginMethod, endMethod, arg1, arg2, state, creationOptions);
+		}
+
+		internal static Task<TResult> FromAsyncBeginEnd<TArg1, TArg2> (Func<TArg1, TArg2, AsyncCallback, object, IAsyncResult> beginMethod, Func<IAsyncResult, TResult> endMethod,
+										  TArg1 arg1, TArg2 arg2, object state, TaskCreationOptions creationOptions)
+		{
+			if (beginMethod == null)
+				throw new ArgumentNullException ("beginMethod");
+
+			if (endMethod == null)
+				throw new ArgumentNullException ("endMethod");
+
+			if ((creationOptions & Task.WorkerTaskNotSupportedOptions) != 0)
+				throw new ArgumentOutOfRangeException ("creationOptions");
+
+			var tcs = new TaskCompletionSource<TResult> (state, creationOptions);
+			beginMethod (arg1, arg2, l => InnerInvoke (tcs, endMethod, l), state);
+
+			return tcs.Task;
+		}
+
+		public Task<TResult> FromAsync<TArg1, TArg2, TArg3> (Func<TArg1, TArg2, TArg3, AsyncCallback, object, IAsyncResult> beginMethod, Func<IAsyncResult, TResult> endMethod,
+		                                                     TArg1 arg1, TArg2 arg2, TArg3 arg3, object state)
+		{
+			return FromAsync (beginMethod, endMethod, arg1, arg2, arg3, state, creationOptions);
+		}
+
+		public Task<TResult> FromAsync<TArg1, TArg2, TArg3> (Func<TArg1, TArg2, TArg3, AsyncCallback, object, IAsyncResult> beginMethod, Func<IAsyncResult, TResult> endMethod,
+		                                                     TArg1 arg1, TArg2 arg2, TArg3 arg3, object state,
+		                                                     TaskCreationOptions creationOptions)
+		{
+			return FromAsyncBeginEnd (beginMethod, endMethod, arg1, arg2, arg3, state, creationOptions);
+		}
+
+		internal static Task<TResult> FromAsyncBeginEnd<TArg1, TArg2, TArg3> (Func<TArg1, TArg2, TArg3, AsyncCallback, object, IAsyncResult> beginMethod, Func<IAsyncResult, TResult> endMethod,
+										  TArg1 arg1, TArg2 arg2, TArg3 arg3, object state, TaskCreationOptions creationOptions)
+		{
+			if (beginMethod == null)
+				throw new ArgumentNullException ("beginMethod");
+
+			if (endMethod == null)
+				throw new ArgumentNullException ("endMethod");
+
+			if ((creationOptions & Task.WorkerTaskNotSupportedOptions) != 0)
+				throw new ArgumentOutOfRangeException ("creationOptions");
+
+			var tcs = new TaskCompletionSource<TResult> (state, creationOptions);
+			beginMethod (arg1, arg2, arg3, l => InnerInvoke (tcs, endMethod, l), state);
+
+			return tcs.Task;
+		}
+
+		#endregion
+
+		TaskScheduler GetScheduler ()
+		{
+			return scheduler ?? TaskScheduler.Current;
+		}
+
+		static void InnerInvoke (TaskCompletionSource<TResult> tcs, Func<IAsyncResult, TResult> endMethod, IAsyncResult l)
+		{
+			try {
+				tcs.SetResult (endMethod (l));
+			} catch (OperationCanceledException) {
+				tcs.SetCanceled ();
+			} catch (Exception e) {
+				tcs.SetException (e);
+			}
+		}
+	}
+}
+#endif
diff --git a/mcs/class/corlib/System.Threading.Tasks/TaskScheduler.cs b/mcs/class/corlib/System.Threading.Tasks/TaskScheduler.cs
index 58d9916..a56b24e 100644
--- a/mcs/class/corlib/System.Threading.Tasks/TaskScheduler.cs
+++ b/mcs/class/corlib/System.Threading.Tasks/TaskScheduler.cs
@@ -35,9 +35,7 @@ namespace System.Threading.Tasks
 	[System.Diagnostics.DebuggerTypeProxy ("System.Threading.Tasks.TaskScheduler+SystemThreadingTasks_TaskSchedulerDebugView")]
 	public abstract class TaskScheduler
 	{
-		static TaskScheduler defaultScheduler =
-			Environment.GetEnvironmentVariable ("USE_OLD_TASK_SCHED") != null ? (TaskScheduler)new Scheduler () : (TaskScheduler)new TpScheduler ();
-		SchedulerProxy proxy;
+		static TaskScheduler defaultScheduler = new TpScheduler ();
 		
 		[ThreadStatic]
 		static TaskScheduler currentScheduler;
@@ -50,9 +48,8 @@ namespace System.Threading.Tasks
 		protected TaskScheduler ()
 		{
 			this.id = Interlocked.Increment (ref lastId);
-			this.proxy = new SchedulerProxy (this);
 		}
-
+		
 		public static TaskScheduler FromCurrentSynchronizationContext ()
 		{
 			var syncCtx = SynchronizationContext.Current;
@@ -89,21 +86,6 @@ namespace System.Threading.Tasks
 			}
 		}
 
-		internal virtual void ParticipateUntil (Task task)
-		{
-			proxy.ParticipateUntil (task);
-		}
-
-		internal virtual bool ParticipateUntil (Task task, ManualResetEventSlim predicateEvt, int millisecondsTimeout)
-		{
-			return proxy.ParticipateUntil (task, predicateEvt, millisecondsTimeout);
-		}
-
-		internal virtual void PulseAll ()
-		{
-			proxy.PulseAll ();
-		}
-
 		protected abstract IEnumerable<Task> GetScheduledTasks ();
 		protected internal abstract void QueueTask (Task task);
 		protected internal virtual bool TryDequeue (Task task)
@@ -117,7 +99,7 @@ namespace System.Threading.Tasks
 				return false;
 
 			if (task.Status == TaskStatus.WaitingToRun) {
-				task.Execute (null);
+				task.Execute ();
 				return true;
 			}
 
@@ -125,8 +107,18 @@ namespace System.Threading.Tasks
 		}
 
 		protected abstract bool TryExecuteTaskInline (Task task, bool taskWasPreviouslyQueued);
-		
-		internal UnobservedTaskExceptionEventArgs FireUnobservedEvent (AggregateException e)
+
+		internal bool RunInline (Task task)
+		{
+			if (!TryExecuteTaskInline (task, false))
+				return false;
+
+			if (!task.IsCompleted)
+				throw new InvalidOperationException ("The TryExecuteTaskInline call to the underlying scheduler succeeded, but the task body was not invoked");
+			return true;
+		}
+
+		internal static UnobservedTaskExceptionEventArgs FireUnobservedEvent (Task task, AggregateException e)
 		{
 			UnobservedTaskExceptionEventArgs args = new UnobservedTaskExceptionEventArgs (e);
 			
@@ -134,7 +126,7 @@ namespace System.Threading.Tasks
 			if (temp == null)
 				return args;
 			
-			temp (this, args);
+			temp (task, args);
 			
 			return args;
 		}
diff --git a/mcs/class/corlib/System.Threading.Tasks/TaskSchedulerException.cs b/mcs/class/corlib/System.Threading.Tasks/TaskSchedulerException.cs
index 1d4149c..3f5b08c 100644
--- a/mcs/class/corlib/System.Threading.Tasks/TaskSchedulerException.cs
+++ b/mcs/class/corlib/System.Threading.Tasks/TaskSchedulerException.cs
@@ -30,7 +30,7 @@ namespace System.Threading.Tasks
 {
 	public class TaskSchedulerException : Exception
 	{
-		const string exceptionDefaultMessage = "TaskScheduler exception";
+		const string exceptionDefaultMessage = "An exception was thrown by a TaskScheduler";
 	  
 		public TaskSchedulerException () : base (exceptionDefaultMessage)
 		{
diff --git a/mcs/class/corlib/System.Threading.Tasks/Task_T.cs b/mcs/class/corlib/System.Threading.Tasks/Task_T.cs
new file mode 100644
index 0000000..a9f9900
--- /dev/null
+++ b/mcs/class/corlib/System.Threading.Tasks/Task_T.cs
@@ -0,0 +1,325 @@
+//
+// Task_T.cs
+//
+// Authors:
+//    Marek Safar  <marek.safar at gmail.com>
+//
+// Copyright (c) 2008 Jérémie "Garuma" Laval
+// Copyright 2011 Xamarin Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+//
+
+#if NET_4_0 || MOBILE
+
+using System.Runtime.CompilerServices;
+
+namespace System.Threading.Tasks
+{
+	[System.Diagnostics.DebuggerDisplay ("Id = {Id}, Status = {Status}, Result = {ResultAsString}")]
+	[System.Diagnostics.DebuggerTypeProxy (typeof (TaskDebuggerView))]
+	public class Task<TResult> : Task
+	{
+		static readonly TaskFactory<TResult> factory = new TaskFactory<TResult> ();
+
+		TResult value;
+		
+		[System.Diagnostics.DebuggerBrowsable (System.Diagnostics.DebuggerBrowsableState.Never)]
+		public TResult Result {
+			get {
+				if (!IsCompleted)
+					Wait ();
+				if (IsCanceled)
+					throw new AggregateException (new TaskCanceledException (this));
+				if (Exception != null)
+					throw Exception;
+				return value;
+			}
+			internal set {
+				this.value = value;
+			}
+		}
+
+		string ResultAsString {
+			get {
+				if ((Status & (TaskStatus.RanToCompletion)) != 0)
+					return "" + value;
+				
+				return "<value not available>";
+			}
+		}
+		
+		public static new TaskFactory<TResult> Factory {
+			get {
+				return factory;
+			}
+		}
+		
+		public Task (Func<TResult> function)
+			: this (function, TaskCreationOptions.None)
+		{
+			
+		}
+		
+		public Task (Func<TResult> function, CancellationToken cancellationToken)
+			: this (function, cancellationToken, TaskCreationOptions.None)
+		{
+			
+		}
+		
+		public Task (Func<TResult> function, TaskCreationOptions creationOptions)
+			: this (function, CancellationToken.None, creationOptions)
+		{
+			
+		}
+		
+		public Task (Func<TResult> function, CancellationToken cancellationToken, TaskCreationOptions creationOptions)
+			: base (TaskActionInvoker.Create (function), null, cancellationToken, creationOptions, null)
+		{
+			if (function == null)
+				throw new ArgumentNullException ("function");
+		}
+		
+		public Task (Func<object, TResult> function, object state)
+			: this (function, state, TaskCreationOptions.None)
+		{
+			
+		}
+		
+		public Task (Func<object, TResult> function, object state, CancellationToken cancellationToken)
+			: this (function, state, cancellationToken, TaskCreationOptions.None)
+		{
+			
+		}
+		
+		public Task (Func<object, TResult> function, object state, TaskCreationOptions creationOptions)
+			: this (function, state, CancellationToken.None, creationOptions)
+		{
+			
+		}
+
+		public Task (Func<object, TResult> function, object state, CancellationToken cancellationToken, TaskCreationOptions creationOptions)
+			: base (TaskActionInvoker.Create (function), state, cancellationToken, creationOptions, null)
+		{
+			if (function == null)
+				throw new ArgumentNullException ("function");
+		}
+
+		internal Task (TaskActionInvoker invoker, object state, CancellationToken cancellationToken, TaskCreationOptions creationOptions, Task parent)
+			: base (invoker, state, cancellationToken, creationOptions, parent)
+		{
+		}
+
+		public Task ContinueWith (Action<Task<TResult>> continuationAction)
+		{
+			return ContinueWith (continuationAction, TaskContinuationOptions.None);
+		}
+		
+		public Task ContinueWith (Action<Task<TResult>> continuationAction, TaskContinuationOptions continuationOptions)
+		{
+			return ContinueWith (continuationAction, CancellationToken.None, continuationOptions, TaskScheduler.Current);
+		}
+		
+		public Task ContinueWith (Action<Task<TResult>> continuationAction, CancellationToken cancellationToken)
+		{
+			return ContinueWith (continuationAction, cancellationToken, TaskContinuationOptions.None, TaskScheduler.Current);
+		}
+		
+		public Task ContinueWith (Action<Task<TResult>> continuationAction, TaskScheduler scheduler)
+		{
+			return ContinueWith (continuationAction, CancellationToken.None, TaskContinuationOptions.None, scheduler);
+		}
+		
+		public Task ContinueWith (Action<Task<TResult>> continuationAction, CancellationToken cancellationToken,
+		                          TaskContinuationOptions continuationOptions, TaskScheduler scheduler)
+		{
+			if (continuationAction == null)
+				throw new ArgumentNullException ("continuationAction");
+			if (scheduler == null)
+				throw new ArgumentNullException ("scheduler");
+
+			Task t = new Task (TaskActionInvoker.Create (continuationAction),
+			                   null,
+			                   cancellationToken,
+			                   GetCreationOptions (continuationOptions),
+			                   this);
+			ContinueWithCore (t, continuationOptions, scheduler);
+			
+			return t;
+		}
+
+		public Task<TNewResult> ContinueWith<TNewResult> (Func<Task<TResult>, TNewResult> continuationFunction)
+		{
+			return ContinueWith<TNewResult> (continuationFunction, CancellationToken.None, TaskContinuationOptions.None, TaskScheduler.Current);
+		}
+		
+		public Task<TNewResult> ContinueWith<TNewResult> (Func<Task<TResult>, TNewResult> continuationFunction, CancellationToken cancellationToken)
+		{
+			return ContinueWith<TNewResult> (continuationFunction, cancellationToken, TaskContinuationOptions.None, TaskScheduler.Current);
+		}
+		
+		public Task<TNewResult> ContinueWith<TNewResult> (Func<Task<TResult>, TNewResult> continuationFunction, TaskContinuationOptions continuationOptions)
+		{
+			return ContinueWith<TNewResult> (continuationFunction, CancellationToken.None, continuationOptions, TaskScheduler.Current);
+		}
+		
+		public Task<TNewResult> ContinueWith<TNewResult> (Func<Task<TResult>, TNewResult> continuationFunction, TaskScheduler scheduler)
+		{
+			return ContinueWith<TNewResult> (continuationFunction, CancellationToken.None, TaskContinuationOptions.None, scheduler);
+		}
+		
+		public Task<TNewResult> ContinueWith<TNewResult> (Func<Task<TResult>, TNewResult> continuationFunction,
+		                                                  CancellationToken cancellationToken,
+		                                                  TaskContinuationOptions continuationOptions,
+		                                                  TaskScheduler scheduler)
+		{
+			if (continuationFunction == null)
+				throw new ArgumentNullException ("continuationFunction");
+			if (scheduler == null)
+				throw new ArgumentNullException ("scheduler");
+
+			var t = new Task<TNewResult> (TaskActionInvoker.Create (continuationFunction),
+			                                           null,
+			                                           cancellationToken,
+			                                           GetCreationOptions (continuationOptions),
+			                                           this);
+			ContinueWithCore (t, continuationOptions, scheduler);
+			
+			return t;
+		}
+
+		internal bool TrySetResult (TResult result)
+		{
+			if (IsCompleted)
+				return false;
+			
+			if (!executing.TryRelaxedSet ()) {
+				var sw = new SpinWait ();
+				while (!IsCompleted)
+					sw.SpinOnce ();
+
+				return false;
+			}
+			
+			Status = TaskStatus.Running;
+
+			this.value = result;
+			Thread.MemoryBarrier ();
+
+			Finish ();
+
+			return true;
+		}
+		
+#if NET_4_5
+
+		public Task ContinueWith (Action<Task<TResult>, object> continuationAction, object state)
+		{
+			return ContinueWith (continuationAction, state, CancellationToken.None, TaskContinuationOptions.None, TaskScheduler.Current);
+		}
+
+		public Task ContinueWith (Action<Task<TResult>, object> continuationAction, object state, CancellationToken cancellationToken)
+		{
+			return ContinueWith (continuationAction, state, cancellationToken, TaskContinuationOptions.None, TaskScheduler.Current);
+		}
+
+		public Task ContinueWith (Action<Task<TResult>, object> continuationAction, object state, TaskContinuationOptions continuationOptions)
+		{
+			return ContinueWith (continuationAction, state, CancellationToken.None, continuationOptions, TaskScheduler.Current);
+		}
+
+		public Task ContinueWith (Action<Task<TResult>, object> continuationAction, object state, TaskScheduler scheduler)
+		{
+			return ContinueWith (continuationAction, state, CancellationToken.None, TaskContinuationOptions.None, scheduler);
+		}
+
+		public Task ContinueWith (Action<Task<TResult>, object> continuationAction, object state, CancellationToken cancellationToken,
+								  TaskContinuationOptions continuationOptions, TaskScheduler scheduler)
+		{
+			if (continuationAction == null)
+				throw new ArgumentNullException ("continuationAction");
+			if (scheduler == null)
+				throw new ArgumentNullException ("scheduler");
+
+			var t = new Task (TaskActionInvoker.Create (continuationAction),
+							   state,
+							   cancellationToken,
+							   GetCreationOptions (continuationOptions),
+							   this);
+
+			ContinueWithCore (t, continuationOptions, scheduler);
+
+			return t;
+		}
+
+		public Task<TNewResult> ContinueWith<TNewResult> (Func<Task<TResult>, object, TNewResult> continuationFunction, object state)
+		{
+			return ContinueWith<TNewResult> (continuationFunction, state, CancellationToken.None, TaskContinuationOptions.None, TaskScheduler.Current);
+		}
+
+		public Task<TNewResult> ContinueWith<TNewResult> (Func<Task<TResult>, object, TNewResult> continuationFunction, object state, CancellationToken cancellationToken)
+		{
+			return ContinueWith<TNewResult> (continuationFunction, state, cancellationToken, TaskContinuationOptions.None, TaskScheduler.Current);
+		}
+
+		public Task<TNewResult> ContinueWith<TNewResult> (Func<Task<TResult>, object, TNewResult> continuationFunction, object state, TaskContinuationOptions continuationOptions)
+		{
+			return ContinueWith<TNewResult> (continuationFunction, state, CancellationToken.None, continuationOptions, TaskScheduler.Current);
+		}
+
+		public Task<TNewResult> ContinueWith<TNewResult> (Func<Task<TResult>, object, TNewResult> continuationFunction, object state, TaskScheduler scheduler)
+		{
+			return ContinueWith<TNewResult> (continuationFunction, state, CancellationToken.None, TaskContinuationOptions.None, scheduler);
+		}
+
+		public Task<TNewResult> ContinueWith<TNewResult> (Func<Task<TResult>, object, TNewResult> continuationFunction, object state,
+														  CancellationToken cancellationToken,
+														  TaskContinuationOptions continuationOptions,
+														  TaskScheduler scheduler)
+		{
+			if (continuationFunction == null)
+				throw new ArgumentNullException ("continuationFunction");
+			if (scheduler == null)
+				throw new ArgumentNullException ("scheduler");
+
+			var t = new Task<TNewResult> (TaskActionInvoker.Create (continuationFunction),
+							   state,
+							   cancellationToken,
+							   GetCreationOptions (continuationOptions),
+							   this);
+
+			ContinueWithCore (t, continuationOptions, scheduler);
+
+			return t;
+		}
+
+		public new ConfiguredTaskAwaitable<TResult> ConfigureAwait (bool continueOnCapturedContext)
+		{
+			return new ConfiguredTaskAwaitable<TResult> (this, continueOnCapturedContext);
+		}
+
+		public new TaskAwaiter<TResult> GetAwaiter ()
+		{
+			return new TaskAwaiter<TResult> (this);
+		}
+#endif
+	}
+}
+#endif
diff --git a/mcs/class/corlib/System.Threading.Tasks/ThreadWorker.cs b/mcs/class/corlib/System.Threading.Tasks/ThreadWorker.cs
deleted file mode 100644
index 998a058..0000000
--- a/mcs/class/corlib/System.Threading.Tasks/ThreadWorker.cs
+++ /dev/null
@@ -1,341 +0,0 @@
-// ThreadWorker.cs
-//
-// Copyright (c) 2008 Jérémie "Garuma" Laval
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-//
-
-#if NET_4_0 || MOBILE
-using System;
-using System.Threading;
-using System.Collections.Concurrent;
-
-namespace System.Threading.Tasks
-{
-	internal class ThreadWorker : IDisposable
-	{
-		Thread workerThread;
-
-		/* This field is used when a TheadWorker have to call Task.Wait
-		 * which bring him back here with the static WorkerMethod although
-		 * it's more optimized for him to continue calling its own WorkerMethod
-		 */
-		[ThreadStatic]
-		static ThreadWorker autoReference;
-		
-		readonly IDequeOperations<Task> dDeque;
-		readonly ThreadWorker[]         others;
-		readonly ManualResetEvent       waitHandle;
-		readonly IProducerConsumerCollection<Task> sharedWorkQueue;
-		readonly ThreadPriority         threadPriority;
-
-		// Flag to tell if workerThread is running
-		int started = 0; 
-		
-		readonly int  workerLength;
-		readonly int  workerPosition;
-		const    int  maxRetry = 5;
-		
-		const int sleepThreshold = 100;
-		int deepSleepTime = 8;
-		
-		public ThreadWorker (ThreadWorker[] others,
-		                     int workerPosition,
-		                     IProducerConsumerCollection<Task> sharedWorkQueue,
-		                     ThreadPriority priority,
-		                     ManualResetEvent handle)
-		{
-			this.others          = others;
-			this.dDeque          = new CyclicDeque<Task> ();
-			this.sharedWorkQueue = sharedWorkQueue;
-			this.workerLength    = others.Length;
-			this.workerPosition  = workerPosition;
-			this.waitHandle      = handle;
-			this.threadPriority  = priority;
-
-			InitializeUnderlyingThread ();
-		}
-		
-		void InitializeUnderlyingThread ()
-		{
-			this.workerThread = new Thread (WorkerMethodWrapper);
-	
-			this.workerThread.IsBackground = true;
-			this.workerThread.Priority = threadPriority;
-			this.workerThread.Name = "ParallelFxThreadWorker";
-		}
-
-		public void Dispose ()
-		{
-			Stop ();
-			if (workerThread.ThreadState != ThreadState.Stopped)
-				workerThread.Abort ();
-		}
-		
-		public void Pulse ()
-		{
-			if (started == 1)
-				return;
-
-			// If the thread was stopped then set it in use and restart it
-			int result = Interlocked.Exchange (ref started, 1);
-			if (result != 0)
-				return;
-
-			if (this.workerThread.ThreadState != ThreadState.Unstarted) {
-				InitializeUnderlyingThread ();
-			}
-
-			workerThread.Start ();
-		}
-		
-		public void Stop ()
-		{
-			// Set the flag to stop so that the while in the thread will stop
-			// doing its infinite loop.
-			started = 0;
-		}
-		
-		// This is the actual method called in the Thread
-		void WorkerMethodWrapper ()
-		{
-			int sleepTime = 0;
-			autoReference = this;
-			
-			// Main loop
-			while (started == 1) {
-				bool result = false;
-
-				result = WorkerMethod ();
-				if (!result)
-					waitHandle.Reset ();
-
-				Thread.Yield ();
-
-				if (result) {
-					deepSleepTime = 8;
-					sleepTime = 0;
-					continue;
-				}
-
-				// If we are spinning too much, have a deeper sleep
-				if (++sleepTime > sleepThreshold && sharedWorkQueue.Count == 0) {
-					waitHandle.WaitOne ((deepSleepTime =  deepSleepTime >= 0x4000 ? 0x4000 : deepSleepTime << 1));
-				}
-			}
-
-			started = 0;
-		}
-		
-		// Main method, used to do all the logic of retrieving, processing and stealing work.
-		bool WorkerMethod ()
-		{
-			bool result = false;
-			bool hasStolenFromOther;
-			do {
-				hasStolenFromOther = false;
-				
-				Task value;
-				
-				// We fill up our work deque concurrently with other ThreadWorker
-				while (sharedWorkQueue.Count > 0) {
-					while (sharedWorkQueue.TryTake (out value)) {
-						dDeque.PushBottom (value);
-						waitHandle.Set ();
-					}
-
-					// Now we process our work
-					while (dDeque.PopBottom (out value) == PopResult.Succeed) {
-						waitHandle.Set ();
-						if (value != null) {
-							value.Execute (ChildWorkAdder);
-							result = true;
-						}
-					}
-				}
-
-				// When we have finished, steal from other worker
-				ThreadWorker other;
-				
-				// Repeat the operation a little so that we can let other things process.
-				for (int j = 0; j < maxRetry; ++j) {
-					int len = workerLength + workerPosition;
-					// Start stealing with the ThreadWorker at our right to minimize contention
-					for (int it = workerPosition + 1; it < len; ++it) {
-						int i = it % workerLength;
-						if ((other = others [i]) == null || other == this)
-							continue;
-						
-						// Maybe make this steal more than one item at a time, see TODO.
-						if (other.dDeque.PopTop (out value) == PopResult.Succeed) {
-							waitHandle.Set ();
-							hasStolenFromOther = true;
-							if (value != null) {
-								value.Execute (ChildWorkAdder);
-								result = true;
-							}
-						}
-					}
-				}
-			} while (sharedWorkQueue.Count > 0 || hasStolenFromOther);
-			
-			return result;
-		}
-		
-		// Almost same as above but with an added predicate and treating one item at a time. 
-		// It's used by Scheduler Participate(...) method for special waiting case like
-		// Task.WaitAll(someTasks) or Task.WaitAny(someTasks)
-		// Predicate should be really fast and not blocking as it is called a good deal of time
-		// Also, the method skip tasks that are LongRunning to avoid blocking (Task are not LongRunning by default)
-		public static void WorkerMethod (Task self,
-		                                 ManualResetEventSlim predicateEvt,
-		                                 int millisecondsTimeout,
-		                                 IProducerConsumerCollection<Task> sharedWorkQueue,
-		                                 ThreadWorker[] others,
-		                                 ManualResetEvent evt)
-		{
-			const int stage1 = 5, stage2 = 0;
-			int tries = 8;
-			WaitHandle[] handles = null;
-			Watch watch = Watch.StartNew ();
-
-			while (!predicateEvt.IsSet && watch.ElapsedMilliseconds < millisecondsTimeout) {
-				Task value;
-				
-				// If we are in fact a normal ThreadWorker, use our own deque
-				if (autoReference != null) {
-					while (autoReference.dDeque.PopBottom (out value) == PopResult.Succeed && value != null) {
-						evt.Set ();
-						if (CheckTaskFitness (self, value))
-							value.Execute (autoReference.ChildWorkAdder);
-						else {
-							sharedWorkQueue.TryAdd (value);
-							evt.Set ();
-						}
-
-						if (predicateEvt.IsSet || watch.ElapsedMilliseconds > millisecondsTimeout)
-							return;
-					}
-				}
-
-				int count = sharedWorkQueue.Count;
-
-				// Dequeue only one item as we have restriction
-				while (--count >= 0 && sharedWorkQueue.TryTake (out value) && value != null) {
-					evt.Set ();
-					if (CheckTaskFitness (self, value))
-						value.Execute (null);
-					else {
-						if (autoReference == null)
-							sharedWorkQueue.TryAdd (value);
-						else
-							autoReference.dDeque.PushBottom (value);
-						evt.Set ();
-					}
-
-					if (predicateEvt.IsSet || watch.ElapsedMilliseconds > millisecondsTimeout)
-						return;
-				}
-
-				// First check to see if we comply to predicate
-				if (predicateEvt.IsSet || watch.ElapsedMilliseconds > millisecondsTimeout)
-					return;
-				
-				// Try to complete other work by stealing since our desired tasks may be in other worker
-				ThreadWorker other;
-				for (int i = 0; i < others.Length; i++) {
-					if ((other = others [i]) == autoReference || other == null)
-						continue;
-
-					if (other.dDeque.PopTop (out value) == PopResult.Succeed && value != null) {
-						evt.Set ();
-						if (CheckTaskFitness (self, value))
-							value.Execute (null);
-						else {
-							if (autoReference == null)
-								sharedWorkQueue.TryAdd (value);
-							else
-								autoReference.dDeque.PushBottom (value);
-							evt.Set ();
-						}
-					}
-
-					if (predicateEvt.IsSet || watch.ElapsedMilliseconds > millisecondsTimeout)
-						return;
-				}
-
-				if (--tries > stage1)
-					Thread.Yield ();
-				else if (tries >= stage2)
-					predicateEvt.Wait (ComputeTimeout (100, millisecondsTimeout, watch));
-				else {
-					if (tries == stage2 - 1)
-						handles = new [] { predicateEvt.WaitHandle, evt };
-					WaitHandle.WaitAny (handles, ComputeTimeout (1000, millisecondsTimeout, watch));
-				}
-			}
-		}
-
-		internal void ChildWorkAdder (Task t)
-		{
-			dDeque.PushBottom (t);
-			waitHandle.Set ();
-		}
-		
-		static bool CheckTaskFitness (Task self, Task t)
-		{
-			return ((t.CreationOptions & TaskCreationOptions.LongRunning) == 0 && t.Id < self.Id) || t.Parent == self || t == self;
-		}
-
-		static int ComputeTimeout (int proposedTimeout, int timeout, Watch watch)
-		{
-			return timeout == -1 ? proposedTimeout : Math.Min (proposedTimeout, Math.Max (0, (int)(timeout - watch.ElapsedMilliseconds)));
-		}
-		
-		public bool Finished {
-			get {
-				return started == 0;
-			}
-		}
-
-		public int Id {
-			get {
-				return workerThread.ManagedThreadId;
-			}
-		}
-		
-		public bool Equals (ThreadWorker other)
-		{
-			return (other == null) ? false : object.ReferenceEquals (this.dDeque, other.dDeque);	
-		}
-		
-		public override bool Equals (object obj)
-		{
-			ThreadWorker temp = obj as ThreadWorker;
-			return temp == null ? false : Equals (temp);
-		}
-		
-		public override int GetHashCode ()
-		{
-			return workerThread.ManagedThreadId.GetHashCode ();
-		}
-	}
-}
-#endif
diff --git a/mcs/class/corlib/System.Threading.Tasks/TpScheduler.cs b/mcs/class/corlib/System.Threading.Tasks/TpScheduler.cs
index c589bb2..0b1788c 100644
--- a/mcs/class/corlib/System.Threading.Tasks/TpScheduler.cs
+++ b/mcs/class/corlib/System.Threading.Tasks/TpScheduler.cs
@@ -34,15 +34,13 @@ namespace System.Threading.Tasks
 
 		protected internal override void QueueTask (Task task)
 		{
-			ThreadPool.QueueUserWorkItem (callback, task);
+			ThreadPool.UnsafeQueueUserWorkItem (callback, task);
 		}
 
 		static void TaskExecuterCallback (object obj)
 		{
-			Task task = obj as Task;
-			if (task == null)
-				return;
-			task.Execute (null);
+			Task task = (Task)obj;
+			task.Execute ();
 		}
 
 		protected override System.Collections.Generic.IEnumerable<Task> GetScheduledTasks ()
diff --git a/mcs/class/corlib/System.Threading/ChangeLog b/mcs/class/corlib/System.Threading/ChangeLog
index 6a43ea3..d05c294 100644
--- a/mcs/class/corlib/System.Threading/ChangeLog
+++ b/mcs/class/corlib/System.Threading/ChangeLog
@@ -1,3 +1,18 @@
+2011-11-29  Sebastien Pouliot  <sebastien at xamarin.com>
+
+	Ensure that [Parameterized]ThreadStart code is always wrapped in a
+	NSAutoreleasePool for MonoTouch. Fix bug #1999
+
+2011-10-05  Sebastien Pouliot  <sebastien at xamarin.com>
+
+	Ensure consistency when 'emitContext == true' is used in MONOTOUCH
+	profile (since it won't work when the linker is enabled). Fix bug
+	#1144
+
+2011-08-29  Sebastien Pouliot  <sebastien at xamarin.com>
+
+	Fix build. Adding #if MOBILE is just not enough ;-)
+
 2011-05-02  Jb Evain  <jbevain at gmail.com>
 
 	Fix non net_4_0 profiles build
diff --git a/mcs/class/corlib/System.Threading/LockRecursionException.cs b/mcs/class/corlib/System.Threading/LockRecursionException.cs
index 43bc3ed..160b9cd 100644
--- a/mcs/class/corlib/System.Threading/LockRecursionException.cs
+++ b/mcs/class/corlib/System.Threading/LockRecursionException.cs
@@ -25,7 +25,7 @@
  */
 
 
-#if NET_4_0
+#if NET_4_0 || MOBILE
 
 using System;
 using System.Runtime.Serialization;
@@ -34,7 +34,9 @@ using System.Runtime.CompilerServices;
 namespace System.Threading
 {
 	[Serializable]
+#if !MOBILE
 	[TypeForwardedFrom (Consts.AssemblySystemCore_3_5)]
+#endif
 	public class LockRecursionException : Exception
 	{
 		public LockRecursionException () 
diff --git a/mcs/class/corlib/System.Threading/Monitor.cs b/mcs/class/corlib/System.Threading/Monitor.cs
index 4188c0a..e8d4732 100644
--- a/mcs/class/corlib/System.Threading/Monitor.cs
+++ b/mcs/class/corlib/System.Threading/Monitor.cs
@@ -159,7 +159,13 @@ namespace System.Threading
 
 		public static bool Wait(object obj, int millisecondsTimeout, bool exitContext) {
 			try {
-				if (exitContext) SynchronizationAttribute.ExitContext ();
+				if (exitContext) {
+#if MONOTOUCH
+					throw new NotSupportedException ("exitContext == true is not supported");
+#else
+					SynchronizationAttribute.ExitContext ();
+#endif
+				}
 				return Wait (obj, millisecondsTimeout);
 			}
 			finally {
@@ -169,7 +175,13 @@ namespace System.Threading
 
 		public static bool Wait(object obj, TimeSpan timeout, bool exitContext) {
 			try {
-				if (exitContext) SynchronizationAttribute.ExitContext ();
+				if (exitContext) {
+#if MONOTOUCH
+					throw new NotSupportedException ("exitContext == true is not supported");
+#else
+					SynchronizationAttribute.ExitContext ();
+#endif
+				}
 				return Wait (obj, timeout);
 			}
 			finally {
diff --git a/mcs/class/corlib/System.Threading/SpinLock.cs b/mcs/class/corlib/System.Threading/SpinLock.cs
index a14899c..59ac22b 100644
--- a/mcs/class/corlib/System.Threading/SpinLock.cs
+++ b/mcs/class/corlib/System.Threading/SpinLock.cs
@@ -22,7 +22,7 @@
 //
 //
 
-#if NET_4_0
+#if NET_4_0 || MOBILE
 
 using System;
 using System.Collections.Concurrent;
diff --git a/mcs/class/corlib/System.Threading/Thread.cs b/mcs/class/corlib/System.Threading/Thread.cs
index aac6aed..9d12c34 100644
--- a/mcs/class/corlib/System.Threading/Thread.cs
+++ b/mcs/class/corlib/System.Threading/Thread.cs
@@ -633,7 +633,7 @@ namespace System.Threading {
 		}
 
 #if MOONLIGHT
-		private void StartSafe ()
+		private void StartInternal ()
 		{
 			current_thread = this;
 
@@ -670,9 +670,32 @@ namespace System.Threading {
 				}
 			}
 		}
-#endif
-
-		private void StartUnsafe ()
+#elif MONOTOUCH
+		static ConstructorInfo nsautoreleasepool_ctor;
+		
+		IDisposable GetNSAutoreleasePool ()
+		{
+			if (nsautoreleasepool_ctor == null) {
+				Type t = Type.GetType ("MonoTouch.Foundation.NSAutoreleasePool, monotouch, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null");
+				nsautoreleasepool_ctor = t.GetConstructor (Type.EmptyTypes);
+			}
+			return (IDisposable) nsautoreleasepool_ctor.Invoke (null);
+		}
+		
+		private void StartInternal ()
+		{
+			using (var pool = GetNSAutoreleasePool ()) {
+				current_thread = this;
+			
+				if (threadstart is ThreadStart) {
+					((ThreadStart) threadstart) ();
+				} else {
+					((ParameterizedThreadStart) threadstart) (start_obj);
+				}
+			}
+		}
+#else
+		private void StartInternal ()
 		{
 			current_thread = this;
 
@@ -682,7 +705,7 @@ namespace System.Threading {
 				((ParameterizedThreadStart) threadstart) (start_obj);
 			}
 		}
-
+#endif
 		public void Start() {
 			// propagate informations from the original thread to the new thread
 			if (!ExecutionContext.IsFlowSuppressed ())
@@ -690,11 +713,7 @@ namespace System.Threading {
 			Internal._serialized_principal = CurrentThread.Internal._serialized_principal;
 
 			// Thread_internal creates and starts the new thread, 
-#if MOONLIGHT
-			if (Thread_internal((ThreadStart) StartSafe) == (IntPtr) 0)
-#else
-			if (Thread_internal((ThreadStart) StartUnsafe) == (IntPtr) 0)
-#endif
+			if (Thread_internal((ThreadStart) StartInternal) == (IntPtr) 0)
 				throw new SystemException ("Thread creation failed.");
 		}
 
diff --git a/mcs/class/corlib/System.Threading/WaitHandle.cs b/mcs/class/corlib/System.Threading/WaitHandle.cs
index 0380b5e..d343a59 100644
--- a/mcs/class/corlib/System.Threading/WaitHandle.cs
+++ b/mcs/class/corlib/System.Threading/WaitHandle.cs
@@ -115,7 +115,13 @@ namespace System.Threading
 				throw new ArgumentOutOfRangeException ("millisecondsTimeout");
 
 			try {
-				if (exitContext) SynchronizationAttribute.ExitContext ();
+				if (exitContext) {
+#if MONOTOUCH
+					throw new NotSupportedException ("exitContext == true is not supported");
+#else
+					SynchronizationAttribute.ExitContext ();
+#endif
+				}
 				return(WaitAll_internal(waitHandles, millisecondsTimeout, false));
 			}
 			finally {
@@ -134,7 +140,13 @@ namespace System.Threading
 				throw new ArgumentOutOfRangeException ("timeout");
 
 			try {
-				if (exitContext) SynchronizationAttribute.ExitContext ();
+				if (exitContext) {
+#if MONOTOUCH
+					throw new NotSupportedException ("exitContext == true is not supported");
+#else
+					SynchronizationAttribute.ExitContext ();
+#endif
+				}
 				return (WaitAll_internal (waitHandles, (int) ms, exitContext));
 			}
 			finally {
@@ -164,7 +176,13 @@ namespace System.Threading
 				throw new ArgumentOutOfRangeException ("millisecondsTimeout");
 
 			try {
-				if (exitContext) SynchronizationAttribute.ExitContext ();
+				if (exitContext) {
+#if MONOTOUCH
+					throw new NotSupportedException ("exitContext == true is not supported");
+#else
+					SynchronizationAttribute.ExitContext ();
+#endif
+				}
 				return(WaitAny_internal(waitHandles, millisecondsTimeout, exitContext));
 			}
 			finally {
@@ -195,7 +213,13 @@ namespace System.Threading
 				throw new ArgumentOutOfRangeException ("timeout");
 
 			try {
-				if (exitContext) SynchronizationAttribute.ExitContext ();
+				if (exitContext) {
+#if MONOTOUCH
+					throw new NotSupportedException ("exitContext == true is not supported");
+#else
+					SynchronizationAttribute.ExitContext ();
+#endif
+				}
 				return (WaitAny_internal(waitHandles, (int) ms, exitContext));
 			}
 			finally {
@@ -341,8 +365,13 @@ namespace System.Threading
 
 			bool release = false;
 			try {
-				if (exitContext)
+				if (exitContext) {
+#if MONOTOUCH
+					throw new NotSupportedException ("exitContext == true is not supported");
+#else
 					SynchronizationAttribute.ExitContext ();
+#endif
+				}
 				safe_wait_handle.DangerousAddRef (ref release);
 				return (WaitOne_internal(safe_wait_handle.DangerousGetHandle (), millisecondsTimeout, exitContext));
 			} finally {
@@ -372,8 +401,13 @@ namespace System.Threading
 
 			bool release = false;
 			try {
-				if (exitContext)
+				if (exitContext) {
+#if MONOTOUCH
+					throw new NotSupportedException ("exitContext == true is not supported");
+#else
 					SynchronizationAttribute.ExitContext ();
+#endif
+				}
 				safe_wait_handle.DangerousAddRef (ref release);
 				return (WaitOne_internal(safe_wait_handle.DangerousGetHandle (), (int) ms, exitContext));
 			}
diff --git a/mcs/class/corlib/System/AggregateException.cs b/mcs/class/corlib/System/AggregateException.cs
index 57cb590..329c849 100644
--- a/mcs/class/corlib/System/AggregateException.cs
+++ b/mcs/class/corlib/System/AggregateException.cs
@@ -121,6 +121,16 @@ namespace System
 				return innerExceptions.AsReadOnly ();
 			}
 		}
+
+		internal void AddChildException (AggregateException childEx)
+		{
+			if (innerExceptions == null)
+				innerExceptions = new List<Exception> ();
+			if (childEx == null)
+				return;
+
+			innerExceptions.Add (childEx);
+		}
 		
 		public override string ToString ()
 		{
diff --git a/mcs/class/corlib/System/AppDomain.cs b/mcs/class/corlib/System/AppDomain.cs
index a07175d..d4ac713 100644
--- a/mcs/class/corlib/System/AppDomain.cs
+++ b/mcs/class/corlib/System/AppDomain.cs
@@ -1316,6 +1316,25 @@ namespace System {
 			}
 		}
 
+		internal Assembly DoResourceResolve (string name, Assembly requesting) {
+			if (ResourceResolve == null)
+				return null;
+
+			Delegate[] invocation_list = ResourceResolve.GetInvocationList ();
+
+			foreach (Delegate eh in invocation_list) {
+				ResolveEventHandler handler = (ResolveEventHandler) eh;
+#if NET_4_0
+				Assembly assembly = handler (this, new ResolveEventArgs (name, requesting));
+#else
+				Assembly assembly = handler (this, new ResolveEventArgs (name));
+#endif
+				if (assembly != null)
+					return assembly;
+			}
+			return null;
+		}
+
 		private void DoDomainUnload ()
 		{
 			if (DomainUnload != null)
diff --git a/mcs/class/corlib/System/ChangeLog b/mcs/class/corlib/System/ChangeLog
index 6b7354a..bffcaee 100644
--- a/mcs/class/corlib/System/ChangeLog
+++ b/mcs/class/corlib/System/ChangeLog
@@ -1,3 +1,55 @@
+2011-11-21  Jonathan Pryor  <jonpryor at vt.edu>
+
+	[MonoDroid] Only alias stdout/stderr on Android devices.
+
+	Mono for Android uses Mono 2.10 + smcs to build code, which thus
+	uses an smcs built against the Mono for Android profile
+	assemblies, which would thus be built with MONODROID defined. Thus
+	(understandably) dies at runtime with a DllNotFoundException, as
+	liblog.so can't be found.
+
+	Fix smcs.
+
+2011-11-21  Jonathan Pryor  <jonpryor at vt.edu>
+
+	[corlib] On Android, alias stdout/stderr to logcat.
+
+	In Mono for Android, stdout and stderr (file descriptors 1 and 2)
+	are only visible when debugging within MonoDevelop and/or Visual
+	Studio, which is rather annoying.
+
+	This was changed in Mono for Android 1.9.2, by using
+	Console.SetOut() and Console.SetError() to send stdout/stderr
+	message to both stdout/stderr and to the Android Debug Log (`adb
+	logcat`), allowing e.g. Console.WriteLine() output to be viewed
+	outside of a debugger.
+
+	Problem: in order to capture user-generated messages at their
+	earliest point, Console.SetOut()/etc. must be called at the
+	earliest point in Mono for Android initialization, even if
+	Console.WriteLine() is never used. Worse, this adds ~180ms of
+	startup overhead on a Nexus One.
+
+	The fix here is to move the std*/logcat duplication logic into
+	mscorlib.dll, so that we can configure things within the
+	System.Console static constructor. This moves the initialization
+	penalty onto users of System.Console (instead of all users).
+
+2011-09-29  Jeffrey Stedfast  <jeff at xamarin.com>
+
+	[TimeZone] Fixed race condition with renewing the CurrentTimeZone
+	object.
+
+	Fixes bug #1055.
+
+2011-09-11  Jérémie Laval  <jeremie.laval at gmail.com>
+
+	Backport System.Threading.Tasks from master to mono-2-10
+
+2011-09-04  Zoltan Varga  <vargaz at gmail.com>
+
+	Implement AppDomain.ResourceResolve. Fixes #579.
+
 2011-08-17  Miguel de Icaza  <miguel at gnome.org>
 
 	updated copyrights
diff --git a/mcs/class/corlib/System/Console.cs b/mcs/class/corlib/System/Console.cs
index 8b68f4f..fd4f5d4 100644
--- a/mcs/class/corlib/System/Console.cs
+++ b/mcs/class/corlib/System/Console.cs
@@ -154,6 +154,13 @@ namespace System
 			}
 #endif
 
+#if MONODROID
+			if (LogcatTextWriter.IsRunningOnAndroid ()) {
+				stdout = TextWriter.Synchronized (new LogcatTextWriter ("mono-stdout", stdout));
+				stderr = TextWriter.Synchronized (new LogcatTextWriter ("mono-stderr", stderr));
+			}
+#endif  // MONODROID
+
 			GC.SuppressFinalize (stdout);
 			GC.SuppressFinalize (stderr);
 			GC.SuppressFinalize (stdin);
diff --git a/mcs/class/corlib/System/TimeZone.cs b/mcs/class/corlib/System/TimeZone.cs
index 1a68247..cb7caef 100644
--- a/mcs/class/corlib/System/TimeZone.cs
+++ b/mcs/class/corlib/System/TimeZone.cs
@@ -56,6 +56,8 @@ namespace System
 		static TimeZone currentTimeZone;
 
 		[NonSerialized]
+		static object tz_lock = new object ();
+		[NonSerialized]
 		static long timezone_check;
 
 		// Constructor
@@ -67,13 +69,18 @@ namespace System
 		public static TimeZone CurrentTimeZone {
 			get {
 				long now = DateTime.GetNow ();
+				TimeZone tz;
 				
-				if (currentTimeZone == null || (now - timezone_check) > TimeSpan.TicksPerMinute) {
-					currentTimeZone = new CurrentSystemTimeZone (now);
-					timezone_check = now;
+				lock (tz_lock) {
+					if (currentTimeZone == null || (now - timezone_check) > TimeSpan.TicksPerMinute) {
+						currentTimeZone = new CurrentSystemTimeZone (now);
+						timezone_check = now;
+					}
+					
+					tz = currentTimeZone;
 				}
 				
-				return currentTimeZone;
+				return tz;
 			}
 		}
 
diff --git a/mcs/class/corlib/Test/System.Collections.Concurrent/ChangeLog b/mcs/class/corlib/Test/System.Collections.Concurrent/ChangeLog
index c999fb4..3b662be 100644
--- a/mcs/class/corlib/Test/System.Collections.Concurrent/ChangeLog
+++ b/mcs/class/corlib/Test/System.Collections.Concurrent/ChangeLog
@@ -1,3 +1,8 @@
+2011-09-25  Jérémie Laval  <jeremie.laval at gmail.com>
+
+	Fix double adding in ConcurrentDictionary ctor with IEnumerable
+	seed.
+
 2011-01-07  Jérémie Laval  <jeremie.laval at gmail.com>
 
 	Remove now unused internal classes
diff --git a/mcs/class/corlib/Test/System.Collections.Concurrent/ConcurrentDictionaryTests.cs b/mcs/class/corlib/Test/System.Collections.Concurrent/ConcurrentDictionaryTests.cs
index e0a52d4..d28ff2c 100644
--- a/mcs/class/corlib/Test/System.Collections.Concurrent/ConcurrentDictionaryTests.cs
+++ b/mcs/class/corlib/Test/System.Collections.Concurrent/ConcurrentDictionaryTests.cs
@@ -24,6 +24,7 @@
 //
 
 using System;
+using System.Linq;
 using System.Threading;
 using MonoTests.System.Threading.Tasks;
 using System.Collections.Generic;
@@ -260,6 +261,21 @@ namespace MonoTests.System.Collections.Concurrent
 			Assert.AreEqual ("class1", classMap[class1], "class 1 check");
 			Assert.AreEqual ("class2", classMap[class2], "class 2 check");
 		}
+
+		[Test]
+		public void InitWithEnumerableTest ()
+		{
+			int[] data = {1,2,3,4,5,6,7,8,9,10};
+			var ndic = data.ToDictionary (x => x);
+			var cdic = new ConcurrentDictionary<int, int> (ndic);
+
+			foreach (var index in data) {
+				Assert.IsTrue (cdic.ContainsKey (index));
+				int val;
+				Assert.IsTrue (cdic.TryGetValue (index, out val));
+				Assert.AreEqual (index, val);
+			}
+		}
 	}
 }
 #endif
diff --git a/mcs/class/corlib/Test/System.Collections.Generic/ChangeLog b/mcs/class/corlib/Test/System.Collections.Generic/ChangeLog
index 8718607..86f9dcf 100644
--- a/mcs/class/corlib/Test/System.Collections.Generic/ChangeLog
+++ b/mcs/class/corlib/Test/System.Collections.Generic/ChangeLog
@@ -1,3 +1,12 @@
+2011-12-19  Zoltan Varga  <vargaz at gmail.com>
+
+	Fix List.LastIndexOf () on empty lists. Fixes #2558.
+
+2011-09-09  Sebastien Pouliot  <sebastien at xamarin.com>
+
+	Adjust corlib unit tests to reduce failures when executed on the
+	NET_2_1 profile
+
 2011-02-22  Rodrigo Kumpera  <kumpera at gmail.com>
 
 	Properly check arguments in List<T> ICollection.CopyTo.
diff --git a/mcs/class/corlib/Test/System.Collections.Generic/ComparerTest.cs b/mcs/class/corlib/Test/System.Collections.Generic/ComparerTest.cs
index 6e4d805..bb543b3 100644
--- a/mcs/class/corlib/Test/System.Collections.Generic/ComparerTest.cs
+++ b/mcs/class/corlib/Test/System.Collections.Generic/ComparerTest.cs
@@ -40,7 +40,7 @@ namespace MonoTests.System.Collections.Generic
 	public class ComparerTest
 	{
 
-#if !NET_4_0 // FIXME: the blob contains the 2.0 mscorlib version
+#if !NET_4_0 && !NET_2_1 // FIXME: the blob contains the 2.0 mscorlib version
 
 		[Test] // bug #80929
 		public void SerializeDefault ()
diff --git a/mcs/class/corlib/Test/System.Collections.Generic/ListTest.cs b/mcs/class/corlib/Test/System.Collections.Generic/ListTest.cs
index 1a86658..d33699e 100644
--- a/mcs/class/corlib/Test/System.Collections.Generic/ListTest.cs
+++ b/mcs/class/corlib/Test/System.Collections.Generic/ListTest.cs
@@ -337,7 +337,7 @@ namespace MonoTests.System.Collections.Generic {
 			Assert.AreEqual (- (l.Count + 1), l.BinarySearch (int.MaxValue));
 		}
 
-#if !NET_4_0 // FIXME: the blob contains the 2.0 mscorlib version
+#if !NET_4_0 && !NET_2_1 // FIXME: the blob contains the 2.0 mscorlib version
 
 		[Test]
 		[Category ("TargetJvmNotWorking")]
@@ -1307,6 +1307,12 @@ namespace MonoTests.System.Collections.Generic {
 				Assert.IsTrue (e is ArgumentException, "#10");
 			}
 		}
+
+		[Test]
+		public void LastIndexOfEmpty_2558 () {
+			var l = new List<int> ();
+			Assert.AreEqual (-1, l.IndexOf (-1));
+		}
 	}
 }
 #endif
diff --git a/mcs/class/corlib/Test/System.IO.IsolatedStorage/ChangeLog b/mcs/class/corlib/Test/System.IO.IsolatedStorage/ChangeLog
index 3fb0f4a..0562a29 100644
--- a/mcs/class/corlib/Test/System.IO.IsolatedStorage/ChangeLog
+++ b/mcs/class/corlib/Test/System.IO.IsolatedStorage/ChangeLog
@@ -1,3 +1,8 @@
+2011-09-09  Sebastien Pouliot  <sebastien at xamarin.com>
+
+	Adjust corlib unit tests to reduce failures when executed on the
+	NET_2_1 profile
+
 2010-06-16  Carlos Alberto Cortez <calberto.cortez at gmail.com>
 
 	* IsolatedStorageFileTest.cs: New test for two instances calling
diff --git a/mcs/class/corlib/Test/System.IO.IsolatedStorage/ChangeLog b/mcs/class/corlib/Test/System.IO.IsolatedStorage/ChangeLog.old
similarity index 100%
copy from mcs/class/corlib/Test/System.IO.IsolatedStorage/ChangeLog
copy to mcs/class/corlib/Test/System.IO.IsolatedStorage/ChangeLog.old
diff --git a/mcs/class/corlib/Test/System.IO.IsolatedStorage/IsolatedStorageFileTest.cs b/mcs/class/corlib/Test/System.IO.IsolatedStorage/IsolatedStorageFileTest.cs
index befc725..a7fa213 100644
--- a/mcs/class/corlib/Test/System.IO.IsolatedStorage/IsolatedStorageFileTest.cs
+++ b/mcs/class/corlib/Test/System.IO.IsolatedStorage/IsolatedStorageFileTest.cs
@@ -127,12 +127,14 @@ namespace MonoTests.System.IO.IsolatedStorageTest {
 			IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForAssembly ();
 			Assert.AreEqual (Int64.MaxValue, isf.MaximumSize, "MaximumSize");
 			Assert.AreEqual (IsolatedStorageScope.User | IsolatedStorageScope.Assembly, isf.Scope, "Scope");
+#if !NET_2_1
 			Assert.IsTrue ((isf.AssemblyIdentity is Url), "AssemblyIdentity");
 			// note: mono transforms the CodeBase into uppercase
 			// for net 1.1 which uses file:// and not file:///
 			string codebase = Assembly.GetExecutingAssembly ().CodeBase.ToUpper ().Substring (8);
 			Assert.IsTrue ((isf.AssemblyIdentity.ToString ().ToUpper ().IndexOf (codebase) > 0), "Url");
 			Assert.IsTrue ((isf.AssemblyIdentity.ToString ().ToUpper ().IndexOf (codebase) > 0), "Url");
+#endif
 			Assert.IsTrue ((isf.CurrentSize >= 0), "CurrentSize");
 		}
 
@@ -160,6 +162,7 @@ namespace MonoTests.System.IO.IsolatedStorageTest {
 			IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForDomain ();
 			Assert.AreEqual (Int64.MaxValue, isf.MaximumSize, "MaximumSize");
 			Assert.AreEqual (IsolatedStorageScope.User | IsolatedStorageScope.Domain | IsolatedStorageScope.Assembly, isf.Scope, "Scope");
+#if !NET_2_1
 			Assert.IsTrue ((isf.AssemblyIdentity is Url), "AssemblyIdentity");
 			// note: mono transforms the CodeBase into uppercase
 			// for net 1.1 which uses file:// and not file:///
@@ -170,6 +173,7 @@ namespace MonoTests.System.IO.IsolatedStorageTest {
 			// so we're using the first parameter to GetCommandLineArgs
 			string exe = Environment.GetCommandLineArgs ()[0].Replace ("\\", "/").ToUpper ();
 			Assert.IsTrue ((isf.DomainIdentity.ToString ().ToUpper ().IndexOf (exe) > 0), exe + "\n" + isf.DomainIdentity.ToString ().ToUpper ()); //"Url - Domain");
+#endif
 			Assert.IsTrue ((isf.CurrentSize >= 0), "CurrentSize");
 		}
 
@@ -196,12 +200,15 @@ namespace MonoTests.System.IO.IsolatedStorageTest {
 		{
 			IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication ();
 			Assert.AreEqual (Int64.MaxValue, isf.MaximumSize, "MaximumSize");
+#if !NET_2_1
 			Assert.AreEqual (IsolatedStorageScope.User | IsolatedStorageScope.Assembly, isf.Scope, "Scope");
 			Assert.IsTrue ((isf.AssemblyIdentity is Url), "AssemblyIdentity");
 			Assert.IsTrue ((isf.AssemblyIdentity.ToString ().IndexOf (Assembly.GetExecutingAssembly ().CodeBase) > 0), "Url");
+#endif
 			Assert.IsTrue ((isf.CurrentSize >= 0), "CurrentSize");
 		}
-
+		
+#if !NET_2_1
 		[Test]
 		[ExpectedException (typeof (IsolatedStorageException))]
 		public void GetUserStoreForApplication_AssemblyIdentity ()
@@ -218,6 +225,7 @@ namespace MonoTests.System.IO.IsolatedStorageTest {
 			object o = isf.DomainIdentity;
 		}
 #endif
+#endif
 
 #if NET_4_0
 		// This is supposed to be working only in SL.
@@ -235,11 +243,13 @@ namespace MonoTests.System.IO.IsolatedStorageTest {
 			IsolatedStorageScope scope = IsolatedStorageScope.User | IsolatedStorageScope.Domain | IsolatedStorageScope.Assembly;
 			IsolatedStorageFile isf = IsolatedStorageFile.GetStore (scope, typeof (Zone), typeof (Zone));
 			Assert.AreEqual (Int64.MaxValue, isf.MaximumSize, "MaximumSize");
+#if !NET_2_1
 			Assert.AreEqual (IsolatedStorageScope.User | IsolatedStorageScope.Domain | IsolatedStorageScope.Assembly, isf.Scope, "Scope");
 			Assert.IsTrue ((isf.AssemblyIdentity is Zone), "AssemblyIdentity");
 			Assert.IsTrue ((isf.AssemblyIdentity.ToString ().IndexOf ("MyComputer") > 0), "Zone - Assembly");
 			Assert.IsTrue ((isf.DomainIdentity is Zone), "DomainIdentity");
 			Assert.IsTrue ((isf.DomainIdentity.ToString ().IndexOf ("MyComputer") > 0), "Zone - Domain");
+#endif
 			Assert.IsTrue ((isf.CurrentSize >= 0), "CurrentSize");
 		}
 
@@ -258,12 +268,14 @@ namespace MonoTests.System.IO.IsolatedStorageTest {
 			IsolatedStorageFile isf = IsolatedStorageFile.GetStore (scope, typeof (StrongName), typeof (Url));
 			Assert.AreEqual (Int64.MaxValue, isf.MaximumSize, "MaximumSize");
 			Assert.AreEqual (scope, isf.Scope, "Scope");
+#if !NET_2_1
 			Assert.IsTrue ((isf.AssemblyIdentity is Url), "AssemblyIdentity");
 			// note: mono transforms the CodeBase into uppercase
 			// for net 1.1 which uses file:// and not file:///
 			string codebase = Assembly.GetExecutingAssembly ().CodeBase.ToUpper ().Substring (8);
 			Assert.IsTrue ((isf.AssemblyIdentity.ToString ().ToUpper ().IndexOf (codebase) > 0), "Url");
 			// DomainIdentity throws a InvalidOperationException
+#endif
 			Assert.IsTrue ((isf.CurrentSize >= 0), "CurrentSize");
 		}
 
@@ -348,10 +360,12 @@ namespace MonoTests.System.IO.IsolatedStorageTest {
 
 			// Maximum size for Internet isn't (by default) Int64.MaxValue
 			Assert.AreEqual (scope, isf.Scope, "Scope");
+#if !NET_2_1
 			Assert.IsTrue ((isf.AssemblyIdentity is Zone), "AssemblyIdentity");
 			Assert.IsTrue ((isf.AssemblyIdentity.ToString ().IndexOf ("Intranet") > 0), "Zone - Assembly");
 			Assert.IsTrue ((isf.DomainIdentity is Zone), "DomainIdentity");
 			Assert.IsTrue ((isf.DomainIdentity.ToString ().IndexOf ("Internet") > 0), isf.DomainIdentity.ToString ()); //"Zone - Domain");
+#endif
 			Assert.IsTrue ((isf.CurrentSize >= 0), "CurrentSize");
 		}
 
@@ -439,7 +453,7 @@ namespace MonoTests.System.IO.IsolatedStorageTest {
 				try {
 					isf.CreateDirectory (path);
 				}
-#if NET_4_0
+#if NET_4_0 || NET_2_1
 				catch (IsolatedStorageException ex) {
 					Assert.IsFalse (ex.Message.IndexOf (path) >= 0, "Message");
 					Assert.IsNull (ex.InnerException, "InnerException");
@@ -480,7 +494,7 @@ namespace MonoTests.System.IO.IsolatedStorageTest {
 		}
 
 		[Test]
-#if NET_4_0
+#if NET_4_0 || NET_2_1
 		[ExpectedException (typeof (ArgumentException))]
 #else
 		[ExpectedException (typeof (SecurityException))]
@@ -580,8 +594,10 @@ namespace MonoTests.System.IO.IsolatedStorageTest {
 		{
 			IsolatedStorageScope scope = IsolatedStorageScope.User | IsolatedStorageScope.Roaming | IsolatedStorageScope.Assembly | IsolatedStorageScope.Domain;
 			IsolatedStorageFile isf = IsolatedStorageFile.GetStore (scope, null, null);
+#if !NET_2_1
 			Assert.AreEqual (typeof (Url), isf.AssemblyIdentity.GetType (), "AssemblyIdentity");
 			Assert.AreEqual (typeof (Url), isf.DomainIdentity.GetType (), "DomainIdentity");
+#endif
 		}
 
 		[Test]
diff --git a/mcs/class/corlib/Test/System.IO/ChangeLog b/mcs/class/corlib/Test/System.IO/ChangeLog
index d36603a..aee740a 100644
--- a/mcs/class/corlib/Test/System.IO/ChangeLog
+++ b/mcs/class/corlib/Test/System.IO/ChangeLog
@@ -1,3 +1,7 @@
+2011-09-09  Sebastien Pouliot  <sebastien at xamarin.com>
+
+	fix FileStream test failures under Mac OSX
+
 2011-03-08  Gonzalo Paniagua Javier  <gonzalo.mono at gmail.com>
 
 	Avoid null refs when capacity set to 0
diff --git a/mcs/class/corlib/Test/System.IO/FileStreamTest.cs b/mcs/class/corlib/Test/System.IO/FileStreamTest.cs
index 9324c91..9a29383 100644
--- a/mcs/class/corlib/Test/System.IO/FileStreamTest.cs
+++ b/mcs/class/corlib/Test/System.IO/FileStreamTest.cs
@@ -12,6 +12,7 @@
 using NUnit.Framework;
 using System;
 using System.IO;
+using System.Runtime.InteropServices;
 using System.Text;
 
 namespace MonoTests.System.IO
@@ -21,6 +22,10 @@ namespace MonoTests.System.IO
 	{
 		string TempFolder = Path.Combine (Path.GetTempPath (), "MonoTests.System.IO.Tests");
 		static readonly char DSC = Path.DirectorySeparatorChar;
+		static bool MacOSX = false;
+
+		[DllImport ("libc")]
+		static extern int uname (IntPtr buf);
 
 		[TearDown]
 		public void TearDown ()
@@ -36,6 +41,12 @@ namespace MonoTests.System.IO
 				Directory.Delete (TempFolder, true);
 
 			Directory.CreateDirectory (TempFolder);
+			
+			// from XplatUI.cs
+			IntPtr buf = Marshal.AllocHGlobal (8192);
+			if (uname (buf) == 0)
+				MacOSX = Marshal.PtrToStringAnsi (buf) == "Darwin";
+			Marshal.FreeHGlobal (buf);
 		}
 
 		public void TestCtr ()
@@ -102,6 +113,9 @@ namespace MonoTests.System.IO
 				Assert.Fail ("#B1");
 			} catch (FileNotFoundException ex) {
 				Assert.AreEqual (typeof (FileNotFoundException), ex.GetType (), "#B2");
+				// under OSX 'var' is a symlink to 'private/var'
+				if (MacOSX)
+					path = "/private" + path;
 				Assert.AreEqual (path, ex.FileName, "#B3");
 				Assert.IsNull (ex.InnerException, "#B4");
 				Assert.IsNotNull (ex.Message, "#B5");
@@ -147,6 +161,9 @@ namespace MonoTests.System.IO
 				Assert.Fail ("#B1");
 			} catch (FileNotFoundException ex) {
 				Assert.AreEqual (typeof (FileNotFoundException), ex.GetType (), "#B2");
+				// under OSX 'var' is a symlink to 'private/var'
+				if (MacOSX)
+					path = "/private" + path;
 				Assert.AreEqual (path, ex.FileName, "#B3");
 				Assert.IsNull (ex.InnerException, "#B4");
 				Assert.IsNotNull (ex.Message, "#B5");
diff --git a/mcs/class/corlib/Test/System.Reflection.Emit/ChangeLog b/mcs/class/corlib/Test/System.Reflection.Emit/ChangeLog
index a504917..2796a92 100644
--- a/mcs/class/corlib/Test/System.Reflection.Emit/ChangeLog
+++ b/mcs/class/corlib/Test/System.Reflection.Emit/ChangeLog
@@ -1,3 +1,7 @@
+2011-09-12  Sebastien Pouliot  <sebastien at xamarin.com>
+
+	More fixes for running unit tests under NET_2_1 profile
+
 2011-04-11  Zoltan Varga  <vargaz at gmail.com>
 
 	Revert "Add checks to ParameterBuilder.SetConstant () to avoid an
diff --git a/mcs/class/corlib/Test/System.Reflection.Emit/MethodBuilderTest.cs b/mcs/class/corlib/Test/System.Reflection.Emit/MethodBuilderTest.cs
index 402631f..651cd50 100644
--- a/mcs/class/corlib/Test/System.Reflection.Emit/MethodBuilderTest.cs
+++ b/mcs/class/corlib/Test/System.Reflection.Emit/MethodBuilderTest.cs
@@ -658,7 +658,7 @@ namespace MonoTests.System.Reflection.Emit
 				Assert.AreEqual ("FOO", ((ObsoleteAttribute) attrs [0]).Message, "#B3");
 			}
 		}
-
+#if !NET_2_1
 		[Test]
 		[ExpectedException (typeof (InvalidOperationException))]
 		public void TestAddDeclarativeSecurityAlreadyCreated ()
@@ -717,7 +717,7 @@ namespace MonoTests.System.Reflection.Emit
 			mb.AddDeclarativeSecurity (SecurityAction.Demand, set);
 			mb.AddDeclarativeSecurity (SecurityAction.Demand, set);
 		}
-
+#endif
 		[AttributeUsage (AttributeTargets.Parameter)]
 		class ParamAttribute : Attribute
 		{
diff --git a/mcs/class/corlib/Test/System.Reflection/ChangeLog b/mcs/class/corlib/Test/System.Reflection/ChangeLog
index 8bb3cbf..c1e6082 100644
--- a/mcs/class/corlib/Test/System.Reflection/ChangeLog
+++ b/mcs/class/corlib/Test/System.Reflection/ChangeLog
@@ -1,3 +1,8 @@
+2011-09-09  Sebastien Pouliot  <sebastien at xamarin.com>
+
+	Adjust corlib unit tests to reduce failures when executed on the
+	NET_2_1 profile
+
 2011-08-11  Marek Habersack  <grendel at twistedcode.net>
 
 	[runtime] Fix for Xamarin bug #99. Don't fail to parse assembly
diff --git a/mcs/class/corlib/Test/System.Reflection/MonoGenericClassTest.cs b/mcs/class/corlib/Test/System.Reflection/MonoGenericClassTest.cs
index 9116054..008c536 100644
--- a/mcs/class/corlib/Test/System.Reflection/MonoGenericClassTest.cs
+++ b/mcs/class/corlib/Test/System.Reflection/MonoGenericClassTest.cs
@@ -69,12 +69,12 @@ namespace MonoTests.System.Reflection.Emit
 #if NET_4_0
 			Assert.AreEqual ("foo.type[[System.Double, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]", inst.FullName, "#3");
 			Assert.AreEqual ("foo.type[[System.Double, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], MonoTests.System.Reflection.Emit.MonoGenericClassTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", inst.AssemblyQualifiedName, "#4");
-
+#elif NET_2_1
+			Assert.AreEqual ("foo.type[[System.Double, mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.String, mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]", inst.FullName, "#3");
+			Assert.AreEqual ("foo.type[[System.Double, mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.String, mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], MonoTests.System.Reflection.Emit.MonoGenericClassTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", inst.AssemblyQualifiedName, "#4");
 #else
-
 			Assert.AreEqual ("foo.type[[System.Double, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]", inst.FullName, "#3");
 			Assert.AreEqual ("foo.type[[System.Double, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], MonoTests.System.Reflection.Emit.MonoGenericClassTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", inst.AssemblyQualifiedName, "#4");
-
 #endif
 			Assert.AreEqual ("foo.type[System.Double,System.String]", inst.ToString (), "#5");
 		}
diff --git a/mcs/class/corlib/Test/System.Reflection/ParameterInfoTest.cs b/mcs/class/corlib/Test/System.Reflection/ParameterInfoTest.cs
index fd6f488..20e5b8c 100644
--- a/mcs/class/corlib/Test/System.Reflection/ParameterInfoTest.cs
+++ b/mcs/class/corlib/Test/System.Reflection/ParameterInfoTest.cs
@@ -73,7 +73,7 @@ namespace MonoTests.System.Reflection
 			}
 		}
 
-#if NET_2_0
+#if NET_2_0 && !NET_2_1
 		public enum ParamEnum {
 			None = 0,
 			Foo = 1,
diff --git a/mcs/class/corlib/Test/System.Runtime.CompilerServices/ChangeLog b/mcs/class/corlib/Test/System.Runtime.CompilerServices/ChangeLog
index 72cca2d..a65648b 100644
--- a/mcs/class/corlib/Test/System.Runtime.CompilerServices/ChangeLog
+++ b/mcs/class/corlib/Test/System.Runtime.CompilerServices/ChangeLog
@@ -1,3 +1,7 @@
+2011-11-22  Rodrigo Kumpera  <kumpera at gmail.com>
+
+	Scan all ephemeron arrays during nursery collections.
+
 2011-01-05  Rodrigo Kumpera  <kumpera at gmail.com>
 
 	Fix test suite as boehm doesn't support ephemerons
diff --git a/mcs/class/corlib/Test/System.Runtime.CompilerServices/ConditionalWeakTableTest.cs b/mcs/class/corlib/Test/System.Runtime.CompilerServices/ConditionalWeakTableTest.cs
index 09626d2..2e80f7f 100644
--- a/mcs/class/corlib/Test/System.Runtime.CompilerServices/ConditionalWeakTableTest.cs
+++ b/mcs/class/corlib/Test/System.Runtime.CompilerServices/ConditionalWeakTableTest.cs
@@ -52,7 +52,8 @@ namespace MonoTests.System.Runtime.CompilerServices {
 		}
 	}
 
-	public class Key {}
+	class Key { public int Foo; }
+	class Val { public int Foo; }
 
 	[Test]
 	public void GetValue () {
@@ -442,6 +443,37 @@ namespace MonoTests.System.Runtime.CompilerServices {
 
 		Assert.AreEqual (20, reachable, "#1");
 	}
+
+	[Test]
+	public void OldGenKeysMakeNewGenObjectsReachable ()
+	{
+		if (GC.MaxGeneration == 0) /*Boehm doesn't handle ephemerons */
+		return;
+		ConditionalWeakTable<object, Val> table = new ConditionalWeakTable<object, Val>();
+		List<Key> keys = new List<Key>();
+
+		//
+		// This list references all keys for the duration of the program, so none 
+		// should be collected ever.
+		//
+		for (int x = 0; x < 1000; x++) 
+		keys.Add(new Key() { Foo = x });
+
+		for (int i = 0; i < 10000; ++i) {
+			// Insert all keys into the ConditionalWeakTable
+			foreach (var key in keys)
+			table.Add(key, new Val() { Foo = key.Foo });
+
+			// Look up all keys to verify that they are still there
+			Val val;
+			foreach (var key in keys)
+				Assert.IsTrue (table.TryGetValue(key, out val), "#1-" + i);
+
+			// Remove all keys from the ConditionalWeakTable
+			foreach (var key in keys)
+				Assert.IsTrue (!table.Remove(key), "#2-" + i);
+		}
+	}
 	}
 }
 
diff --git a/mcs/class/corlib/Test/System.Runtime.InteropServices/ChangeLog b/mcs/class/corlib/Test/System.Runtime.InteropServices/ChangeLog
index 36bb88a..4df9941 100644
--- a/mcs/class/corlib/Test/System.Runtime.InteropServices/ChangeLog
+++ b/mcs/class/corlib/Test/System.Runtime.InteropServices/ChangeLog
@@ -1,3 +1,8 @@
+2011-09-09  Sebastien Pouliot  <sebastien at xamarin.com>
+
+	Adjust corlib unit tests to reduce failures when executed on the
+	NET_2_1 profile
+
 2010-11-25  Rodrigo Kumpera  <kumpera at gmail.com>
 
 	Add regression test for #655669
diff --git a/mcs/class/corlib/Test/System.Runtime.InteropServices/RuntimeEnvironmentTest.cs b/mcs/class/corlib/Test/System.Runtime.InteropServices/RuntimeEnvironmentTest.cs
index 3cb9898..e1b841c 100644
--- a/mcs/class/corlib/Test/System.Runtime.InteropServices/RuntimeEnvironmentTest.cs
+++ b/mcs/class/corlib/Test/System.Runtime.InteropServices/RuntimeEnvironmentTest.cs
@@ -55,6 +55,9 @@ namespace MonoTests.System.Runtime.InteropServices {
 		}
 
 		[Test]
+#if NET_2_1
+		[Ignore ("There's no GAC for the NET_2_1 based profiles (Moonlight, MonoTouch and Mono for Android")]
+#endif
 		public void FromGlobalAccessCache ()
 		{
 			Assembly corlib = typeof (int).Assembly;
diff --git a/mcs/class/corlib/Test/System.Security.Cryptography.X509Certificates/ChangeLog b/mcs/class/corlib/Test/System.Security.Cryptography.X509Certificates/ChangeLog
index f07c1ba..02a50b2 100644
--- a/mcs/class/corlib/Test/System.Security.Cryptography.X509Certificates/ChangeLog
+++ b/mcs/class/corlib/Test/System.Security.Cryptography.X509Certificates/ChangeLog
@@ -1,3 +1,8 @@
+2011-09-09  Sebastien Pouliot  <sebastien at xamarin.com>
+
+	Adjust corlib unit tests to reduce failures when executed on the
+	NET_2_1 profile
+
 2009-06-25  Zoltan Varga  <vargaz at gmail.com>
 
 	* *.cs: Convert all tests to new-style nunit classes/methods.	
diff --git a/mcs/class/corlib/Test/System.Security.Cryptography.X509Certificates/ChangeLog b/mcs/class/corlib/Test/System.Security.Cryptography.X509Certificates/ChangeLog.old
similarity index 100%
copy from mcs/class/corlib/Test/System.Security.Cryptography.X509Certificates/ChangeLog
copy to mcs/class/corlib/Test/System.Security.Cryptography.X509Certificates/ChangeLog.old
diff --git a/mcs/class/corlib/Test/System.Security.Cryptography.X509Certificates/X509CapiTest.cs b/mcs/class/corlib/Test/System.Security.Cryptography.X509Certificates/X509CapiTest.cs
index 5947bd3..a307461 100644
--- a/mcs/class/corlib/Test/System.Security.Cryptography.X509Certificates/X509CapiTest.cs
+++ b/mcs/class/corlib/Test/System.Security.Cryptography.X509Certificates/X509CapiTest.cs
@@ -103,6 +103,9 @@ namespace MonoTests.System.Security.Cryptography.X509Certificates {
 		}
 
 		[Test]
+#if NET_2_1
+		[Ignore ("This constructor always throw a NotSupportedException under NET_2_1 and is useless without CryptoAPI (i.e. outside Windows)")]
+#endif
 		public void ConstructorIntPtr ()
 		{
 			byte[] cert = { 0x30,0x82,0x01,0xFF,0x30,0x82,0x01,0x6C,0x02,0x05,0x02,0x72,0x00,0x06,0xE8,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x02,0x05,0x00,0x30,0x5F,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x20,0x30,0x1E,0x06,0x03,0x55,0x04,0x0A,0x13,0x17,0x52,0x53,0x41,0x20,0x44,0x61,0x74,0x61,0x20,0x53,0x65,0x63,0x75,0x72,0x69,0x74,0x79,0x2C,0x20,0x49,0x6E,0x63,0x2E,0x31,0x2E,0x30,0x2C,0x06,0x03,0x55,0x04,0x0B,0x13,0x25,0x53,0x65,0x63,0x75,0x72,0x65,0x20,0x53,0x65,0x72,0x76,
diff --git a/mcs/class/corlib/Test/System.Security.Cryptography/ChangeLog b/mcs/class/corlib/Test/System.Security.Cryptography/ChangeLog
index e718b5c..80a0ccc 100644
--- a/mcs/class/corlib/Test/System.Security.Cryptography/ChangeLog
+++ b/mcs/class/corlib/Test/System.Security.Cryptography/ChangeLog
@@ -1,3 +1,8 @@
+2011-09-09  Sebastien Pouliot  <sebastien at xamarin.com>
+
+	Adjust corlib unit tests to reduce failures when executed on the
+	NET_2_1 profile
+
 2011-08-05  Miguel de Icaza  <miguel at gnome.org>
 
 	Merge pull request #129 from grumpydev/CryptoFixo
diff --git a/mcs/class/corlib/Test/System.Security.Cryptography/CryptoConfigTest.cs b/mcs/class/corlib/Test/System.Security.Cryptography/CryptoConfigTest.cs
index db368d0..f5b2d3e 100644
--- a/mcs/class/corlib/Test/System.Security.Cryptography/CryptoConfigTest.cs
+++ b/mcs/class/corlib/Test/System.Security.Cryptography/CryptoConfigTest.cs
@@ -136,6 +136,9 @@ public class CryptoConfigTest {
 	// additional names (URL) used for XMLDSIG (System.Security.Cryptography.Xml)
 	// URL taken from http://www.w3.org/TR/2002/REC-xmldsig-core-20020212/
 	[Test]
+#if NET_2_1
+	[Ignore ("System.Security.dll is not part of Moonlight, MonoTouch and Mono for Android")]
+#endif
 	public void CreateFromURL () 
 	{
 		// URL used in SignatureMethod element
diff --git a/mcs/class/corlib/Test/System.Security/ChangeLog b/mcs/class/corlib/Test/System.Security/ChangeLog
index c48ed92..f320bde 100644
--- a/mcs/class/corlib/Test/System.Security/ChangeLog
+++ b/mcs/class/corlib/Test/System.Security/ChangeLog
@@ -1,3 +1,8 @@
+2011-09-09  Sebastien Pouliot  <sebastien at xamarin.com>
+
+	Adjust corlib unit tests to reduce failures when executed on the
+	NET_2_1 profile
+
 2009-06-20  Zoltan Varga  <vargaz at gmail.com>
 
 	* *.cs: Convert all tests to new-style nunit classes/methods.
diff --git a/mcs/class/corlib/Test/System.Security/ChangeLog b/mcs/class/corlib/Test/System.Security/ChangeLog.old
similarity index 100%
copy from mcs/class/corlib/Test/System.Security/ChangeLog
copy to mcs/class/corlib/Test/System.Security/ChangeLog.old
diff --git a/mcs/class/corlib/Test/System.Security/HostSecurityManagerTest.cs b/mcs/class/corlib/Test/System.Security/HostSecurityManagerTest.cs
index 321e085..91a65d3 100644
--- a/mcs/class/corlib/Test/System.Security/HostSecurityManagerTest.cs
+++ b/mcs/class/corlib/Test/System.Security/HostSecurityManagerTest.cs
@@ -26,7 +26,8 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if NET_2_0
+// NET_2_1 profile lacks some (of the few) CAS features required to execute those tests
+#if NET_2_0 && !NET_2_1
 
 using NUnit.Framework;
 using System;
diff --git a/mcs/class/corlib/Test/System.Text/ChangeLog b/mcs/class/corlib/Test/System.Text/ChangeLog
index b011418..6f88316 100644
--- a/mcs/class/corlib/Test/System.Text/ChangeLog
+++ b/mcs/class/corlib/Test/System.Text/ChangeLog
@@ -1,3 +1,7 @@
+2011-08-31  Atsushi Eno  <atsushi at ximian.com>
+
+	Add test for bug #545.
+
 2010-08-10  Atsushi Eno  <atsushi at ximian.com>
 
 	EncoderFallback support in UTF8Encoding. Fixed bug #565129 and
diff --git a/mcs/class/corlib/Test/System.Text/EncoderReplacementFallbackBufferTest.cs b/mcs/class/corlib/Test/System.Text/EncoderReplacementFallbackBufferTest.cs
index fa50146..897674d 100644
--- a/mcs/class/corlib/Test/System.Text/EncoderReplacementFallbackBufferTest.cs
+++ b/mcs/class/corlib/Test/System.Text/EncoderReplacementFallbackBufferTest.cs
@@ -2,9 +2,10 @@
 // EncoderReplacementFallbackBuffer.cs
 //
 // Author:
-//	Atsushi Enomoto  <atsushi at ximian.com>
+//	Atsushi Enomoto  <atsushi at ximian.com> <atsushi at xamarin.com>
 //
 // Copyright (C) 2005 Novell, Inc.  http://www.novell.com
+// Copyright (C) 2011 Xamain, Inc.  http://xamarin.com
 //
 
 #if NET_2_0
@@ -85,6 +86,13 @@ namespace MonoTests.System.Text
 			Assert.IsFalse (b.MovePrevious (), "#8");
 //			Assert.AreEqual ('?', b.GetNextChar (), "#9");
 		}
+
+		[Test]
+		public void Reset ()
+		{
+			// Xamarin bug #545
+			Encoding.UTF8.GetBytes ("\uDE7E\uDE7E");
+		}
 	}
 }
 
diff --git a/mcs/class/corlib/Test/System.Threading.Tasks/ChangeLog b/mcs/class/corlib/Test/System.Threading.Tasks/ChangeLog
index f7e5c1a..26c831c 100644
--- a/mcs/class/corlib/Test/System.Threading.Tasks/ChangeLog
+++ b/mcs/class/corlib/Test/System.Threading.Tasks/ChangeLog
@@ -1,3 +1,28 @@
+2011-11-10  Jérémie Laval  <jeremie.laval at gmail.com>
+
+	Add missing Task_T_Test file
+
+2011-11-07  Jérémie Laval  <jeremie.laval at gmail.com>
+
+	Import TPL unit test from master
+
+2011-09-19  Jérémie Laval  <jeremie.laval at gmail.com>
+
+	Fix for #892
+
+2011-09-13  Jérémie Laval  <jeremie.laval at gmail.com>
+
+	Add missing files.
+
+2011-09-11  Jérémie Laval  <jeremie.laval at gmail.com>
+
+	Backport System.Threading.Tasks from master to mono-2-10
+
+2011-08-28  Jérémie Laval  <jeremie.laval at gmail.com>
+
+	Check that CancellationToken coming from
+	OperationCanceledException isn't None. Fix #472.
+
 2011-08-20  Jérémie Laval  <jeremie.laval at gmail.com>
 
 	Throw when a non-finished task is started
diff --git a/mcs/class/corlib/Test/System.Threading.Tasks/FutureTests.cs b/mcs/class/corlib/Test/System.Threading.Tasks/FutureTests.cs
index 9548b5e..49ce4a0 100644
--- a/mcs/class/corlib/Test/System.Threading.Tasks/FutureTests.cs
+++ b/mcs/class/corlib/Test/System.Threading.Tasks/FutureTests.cs
@@ -66,7 +66,7 @@ namespace MonoTests.System.Threading.Tasks
 		static Task<int> CreateNestedFuture(int level)
 		{
 			if (level == 0)
-				return Task.Factory.StartNew(() => { Thread.Sleep (10); return 1; });
+				return Task.Factory.StartNew(() => { Thread.Sleep (1); return 1; });
 
 			var t = CreateNestedFuture(level - 1);
 			return Task.Factory.StartNew(() => t.Result + 1);
@@ -75,14 +75,15 @@ namespace MonoTests.System.Threading.Tasks
 		[Test]
 		public void NestedFutureTest ()
 		{
-			var t = CreateNestedFuture(10);
-			var t2 = CreateNestedFuture(100);
-			var t3 = CreateNestedFuture(100);
-			var t4 = CreateNestedFuture(100);
-			Assert.AreEqual (11, t.Result);
-			Assert.AreEqual (101, t2.Result);
-			Assert.AreEqual (101, t3.Result);
-			Assert.AreEqual (101, t4.Result);
+			ParallelTestHelper.Repeat (delegate {
+				var t = CreateNestedFuture(10);
+				var t2 = CreateNestedFuture(100);
+				var t3 = CreateNestedFuture(100);
+
+				Assert.AreEqual (11, t.Result);
+				Assert.AreEqual (101, t2.Result);
+				Assert.AreEqual (101, t3.Result);
+		   }, 50);
 		}
 
 		[Test]
diff --git a/mcs/class/corlib/Test/System.Threading.Tasks/ParallelTests.cs b/mcs/class/corlib/Test/System.Threading.Tasks/ParallelTests.cs
index 3aef814..140ffaa 100644
--- a/mcs/class/corlib/Test/System.Threading.Tasks/ParallelTests.cs
+++ b/mcs/class/corlib/Test/System.Threading.Tasks/ParallelTests.cs
@@ -88,8 +88,8 @@ namespace MonoTests.System.Threading.Tasks
 		[Test]
 		public void ParallelForNestedTest ()
 		{
-			bool[] launched = new bool[100 * 20 * 10];
-			Parallel.For (0, 100, delegate (int i) {
+			bool[] launched = new bool[6 * 20 * 10];
+			Parallel.For (0, 6, delegate (int i) {
 				Parallel.For (0, 20, delegate (int j) {
 					Parallel.For (0, 10, delegate (int k) {
 							launched[i * 20 * 10 + j * 10 + k] = true;
diff --git a/mcs/class/corlib/Test/System.Threading.Tasks/TaskCompletionSourceTests.cs b/mcs/class/corlib/Test/System.Threading.Tasks/TaskCompletionSourceTests.cs
index 8dd7db5..093df3c 100644
--- a/mcs/class/corlib/Test/System.Threading.Tasks/TaskCompletionSourceTests.cs
+++ b/mcs/class/corlib/Test/System.Threading.Tasks/TaskCompletionSourceTests.cs
@@ -1,4 +1,3 @@
-#if NET_4_0
 // 
 // TaskCompletionSourceTests.cs
 //  
@@ -25,6 +24,8 @@
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
 
+#if NET_4_0
+
 using System;
 using System.Threading;
 using System.Threading.Tasks;
@@ -43,14 +44,30 @@ namespace MonoTests.System.Threading.Tasks
 		public void Setup ()
 		{
 			state = new object ();
-			completionSource = new TaskCompletionSource<int> (state, TaskCreationOptions.LongRunning);
+			completionSource = new TaskCompletionSource<int> (state, TaskCreationOptions.None);
 		}
 		
 		[Test]
 		public void CreationCheckTest ()
 		{
 			Assert.IsNotNull (completionSource.Task, "#1");
-			Assert.AreEqual (TaskCreationOptions.LongRunning, completionSource.Task.CreationOptions, "#2");
+			Assert.AreEqual (TaskCreationOptions.None, completionSource.Task.CreationOptions, "#2");
+		}
+
+		[Test]
+		public void CtorInvalidOptions ()
+		{
+			try {
+				new TaskCompletionSource<long> (TaskCreationOptions.LongRunning);
+				Assert.Fail ("#1");
+			} catch (ArgumentOutOfRangeException) {
+			}
+
+			try {
+				new TaskCompletionSource<long> (TaskCreationOptions.PreferFairness);
+				Assert.Fail ("#2");
+			} catch (ArgumentOutOfRangeException) {
+			}
 		}
 		
 		[Test]
@@ -75,8 +92,17 @@ namespace MonoTests.System.Threading.Tasks
 			Assert.AreEqual (TaskStatus.Canceled, completionSource.Task.Status, "#3");
 			Assert.IsFalse (completionSource.TrySetResult (42), "#4");
 			Assert.AreEqual (TaskStatus.Canceled, completionSource.Task.Status, "#5");
+
+			try {
+				Console.WriteLine (completionSource.Task.Result);
+				Assert.Fail ("#6");
+			} catch (AggregateException e) {
+				var details = (TaskCanceledException) e.InnerException;
+				Assert.AreEqual (completionSource.Task, details.Task, "#6e");
+				Assert.IsNull (details.Task.Exception, "#6e2");
+			}
 		}
-		
+
 		[Test]
 		public void SetExceptionTest ()
 		{
@@ -96,6 +122,24 @@ namespace MonoTests.System.Threading.Tasks
 			Assert.IsFalse (completionSource.TrySetCanceled (), "#8");
 			Assert.AreEqual (TaskStatus.Faulted, completionSource.Task.Status, "#9");
 		}
+
+		[Test]
+		public void SetExceptionInvalid ()
+		{
+			try {
+				completionSource.TrySetException (new ApplicationException[0]);
+				Assert.Fail ("#1");
+			} catch (ArgumentException) {
+			}
+
+			try {
+				completionSource.TrySetException (new [] { new ApplicationException (), null });
+				Assert.Fail ("#2");
+			} catch (ArgumentException) {
+			}
+
+			Assert.AreEqual (TaskStatus.WaitingForActivation, completionSource.Task.Status, "r1");
+		}
 		
 		[Test, ExpectedException (typeof (InvalidOperationException))]
 		public void SetResultExceptionTest ()
@@ -152,6 +196,16 @@ namespace MonoTests.System.Threading.Tasks
 			Assert.AreEqual (thrown, f.Exception.InnerException);
 			Assert.AreEqual (thrown, ex.InnerException);
 		}
+
+		[Test]
+		public void WaitingTest ()
+		{
+			var tcs = new TaskCompletionSource<int> ();
+			var task = tcs.Task;
+			bool result = task.Wait (50);
+
+			Assert.IsFalse (result);
+		}
 	}
 }
 #endif
diff --git a/mcs/class/corlib/Test/System.Threading.Tasks/TaskFactoryTest.cs b/mcs/class/corlib/Test/System.Threading.Tasks/TaskFactoryTest.cs
index cb3cc10..2bef86d 100644
--- a/mcs/class/corlib/Test/System.Threading.Tasks/TaskFactoryTest.cs
+++ b/mcs/class/corlib/Test/System.Threading.Tasks/TaskFactoryTest.cs
@@ -1,7 +1,12 @@
-#if NET_4_0
+//
 // TaskFactoryTest.cs
 //
+// Authors:
+//       Jérémie "Garuma" Laval <jeremie.laval at gmail.com>
+//       Marek Safar <marek.safar at gmail.com>
+// 
 // Copyright (c) 2010 Jérémie "Garuma" Laval
+// Copyright 2011 Xamarin, Inc (http://www.xamarin.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining a copy
 // of this software and associated documentation files (the "Software"), to deal
@@ -23,9 +28,12 @@
 //
 //
 
+#if NET_4_0 || MOBILE
+
 using System;
 using System.Threading;
 using System.Threading.Tasks;
+using System.Collections.Generic;
 
 using NUnit.Framework;
 
@@ -34,14 +42,98 @@ namespace MonoTests.System.Threading.Tasks
 	[TestFixture]
 	public class TaskFactoryTests
 	{
+		class CompletedAsyncResult : IAsyncResult
+		{
+			public object AsyncState
+			{
+				get { throw new NotImplementedException (); }
+			}
+
+			public WaitHandle AsyncWaitHandle
+			{
+				get { throw new NotImplementedException (); }
+			}
+
+			public bool CompletedSynchronously
+			{
+				get { throw new NotImplementedException (); }
+			}
+
+			public bool IsCompleted
+			{
+				get { return true; }
+			}
+		}
+
+		class TestAsyncResult : IAsyncResult
+		{
+			WaitHandle wh = new ManualResetEvent (true);
+
+			public object AsyncState
+			{
+				get { throw new NotImplementedException (); }
+			}
+
+			public WaitHandle AsyncWaitHandle
+			{
+				get
+				{
+					return wh;
+				}
+			}
+
+			public bool CompletedSynchronously
+			{
+				get { throw new NotImplementedException (); }
+			}
+
+			public bool IsCompleted
+			{
+				get { return false; }
+			}
+		}
+
+		class TestScheduler : TaskScheduler
+		{
+			public bool ExecutedInline { get; set; }
+
+			protected override void QueueTask (Task task)
+			{
+				throw new NotImplementedException ();
+			}
+
+			protected override bool TryDequeue (Task task)
+			{
+				throw new NotImplementedException ();
+			}
+
+			protected override bool TryExecuteTaskInline (Task task, bool taskWasPreviouslyQueued)
+			{
+				if (taskWasPreviouslyQueued)
+					throw new ArgumentException ("taskWasPreviouslyQueued");
+
+				if (task.Status != TaskStatus.WaitingToRun)
+					throw new ArgumentException ("task.Status");
+
+				ExecutedInline = true;
+				return TryExecuteTask (task);
+			}
+
+			protected override IEnumerable<Task> GetScheduledTasks ()
+			{
+				throw new NotImplementedException ();
+			}
+		}
+
+
 		TaskFactory factory;
-		
+
 		[SetUp]
 		public void Setup ()
 		{
 			this.factory = Task.Factory;
 		}
-		
+
 		[Test]
 		public void StartNewTest ()
 		{
@@ -49,79 +141,130 @@ namespace MonoTests.System.Threading.Tasks
 			factory.StartNew (() => result = true).Wait ();
 			Assert.IsTrue (result);
 		}
-		
+
+		[Test]
+		public void NoDefaultScheduler ()
+		{
+			Assert.IsNull (factory.Scheduler, "#1");
+		}
+
 		[Test]
-		public void ContinueWhenAllTest ()
+		public void ContinueWhenAll_Simple ()
 		{
-			bool r1 = false, r2 = false, r3 = false;
-			
+			var mre = new ManualResetEventSlim (false);
+
 			Task[] tasks = new Task[3];
-			tasks[0] = new Task (() => { Thread.Sleep (100); r1 = true; });
-			tasks[1] = new Task (() => { Thread.Sleep (500); r2 = true; });
-			tasks[2] = new Task (() => { Thread.Sleep (300); r3 = true; });
-			
-			bool result = false;
-			
-			Task cont = factory.ContinueWhenAll (tasks, (ts) => { if (r1 && r2 && r3) result = true; });
-			
-			foreach (Task t in tasks)
-				t.Start ();
-			
-			cont.Wait ();
-			
-			Assert.IsTrue (r1, "#1");
-			Assert.IsTrue (r2, "#2");
-			Assert.IsTrue (r3, "#3");
-			Assert.IsTrue (result, "#4");
-		}
-		
-		[Test]
-		public void ContinueWhenAnyTest ()
-		{
-			bool r = false, result = false, finished = false;
-			
-			Task[] tasks = new Task[2];
-			tasks[0] = new Task (() => { Thread.Sleep (300); r = true; });
-			tasks[1] = new Task (() => { SpinWait sw; while (!finished) sw.SpinOnce (); });
-			//tasks[2] = new Task (() => { SpinWait sw; while (!finished) sw.SpinOnce (); });
-			
-			Task cont = factory.ContinueWhenAny (tasks, (t) => { if (r) result = t == tasks[0]; finished = true; });
-			
+			tasks[0] = new Task (() => { Thread.Sleep (0); Assert.IsTrue (mre.Wait (3000)); });
+			tasks[1] = new Task (() => { Assert.IsTrue (mre.Wait (3000)); });
+			tasks[2] = new Task (() => { Assert.IsTrue (mre.Wait (3000)); });
+
+			bool ran = false;
+			Task cont = factory.ContinueWhenAll (tasks, ts => {
+				Assert.AreEqual (tasks, ts, "#0");
+				ran = true;
+			});
+
 			foreach (Task t in tasks)
 				t.Start ();
-			
-			cont.Wait ();
-			
-			Assert.IsTrue (r, "#1");
-			Assert.IsTrue (result, "#2");
-			Assert.IsTrue (finished, "#3");
+
+			mre.Set ();
+
+			Assert.IsTrue (cont.Wait (1000), "#1");
+			Assert.IsTrue (ran, "#2");
+		}
+
+		[Test]
+		public void ContinueWhenAny_Simple ()
+		{
+			var t1 = new ManualResetEvent (false);
+			var t2 = new ManualResetEvent (false);
+
+			var tasks = new Task[2] {
+				Task.Factory.StartNew (() => { t1.WaitOne (3000); }),
+				Task.Factory.StartNew (() => { t2.WaitOne (3000); })
+			};
+
+			bool ran = false;
+			var ct = new CancellationToken ();
+			Task cont = factory.ContinueWhenAny (tasks, t => {
+				Assert.AreEqual (tasks[0], t, "#1");
+				ran = true;
+			}, ct);
+
+			Assert.AreEqual (TaskStatus.WaitingForActivation, cont.Status, "#2");
+
+			t1.Set ();
+
+			Assert.IsTrue (cont.Wait (2000), "#10");
+			Assert.IsTrue (ran, "#11");
+
+			t2.Set ();
+		}
+
+		[Test]
+		public void ContinueWhenAny_InvalidArguments ()
+		{
+			try {
+				factory.ContinueWhenAny (null, delegate { });
+				Assert.Fail ("#1");
+			} catch (ArgumentNullException) {
+			}
+
+			try {
+				factory.ContinueWhenAny (new Task[0], delegate { });
+				Assert.Fail ("#2");
+			} catch (ArgumentException) {
+			}
+
+			try {
+				factory.ContinueWhenAny (new Task[] { null }, delegate { });
+				Assert.Fail ("#3");
+			} catch (ArgumentException) {
+			}
+
+			var tasks = new Task [] {
+				factory.StartNew (delegate {})
+			};
+
+			try {
+				factory.ContinueWhenAny (tasks, null);
+				Assert.Fail ("#4");
+			} catch (ArgumentException) {
+			}
+
+			try {
+				factory.ContinueWhenAny (tasks, delegate { }, CancellationToken.None, TaskContinuationOptions.None, null);
+				Assert.Fail ("#5");
+			} catch (ArgumentException) {
+			}
 		}
 
 		[Test]
-		public void FromAsyncWithBeginTest ()
+		public void FromAsyncBeginInvoke_WithResult ()
 		{
 			bool result = false;
-			bool continuationTest = false;
 
-			Func<int, int> func = (i) => { result = true; return i + 3; };
-			Task<int> task = factory.FromAsync<int, int> (func.BeginInvoke, func.EndInvoke, 1, null);
-			var cont = task.ContinueWith (_ => continuationTest = true, TaskContinuationOptions.ExecuteSynchronously);
-			task.Wait ();
-			cont.Wait ();
+			Func<int, int> func = (i) => {
+				Assert.IsTrue (Thread.CurrentThread.IsThreadPoolThread);
+				result = true; return i + 3;
+			};
 
-			Assert.IsTrue (result);
-			Assert.IsTrue (continuationTest);
-			Assert.AreEqual (4, task.Result);
+			var task = factory.FromAsync<int, int> (func.BeginInvoke, func.EndInvoke, 1, "state", TaskCreationOptions.AttachedToParent);
+			Assert.IsTrue (task.Wait (5000), "#1");
+			Assert.IsTrue (result, "#2");
+			Assert.AreEqual (4, task.Result, "#3");
+			Assert.AreEqual ("state", (string) task.AsyncState, "#4");
+			Assert.AreEqual (TaskCreationOptions.AttachedToParent, task.CreationOptions, "#5");
 		}
 
 		[Test]
-		public void FromAsyncWithDirectAsyncResultTest ()
+		public void FromAsyncBeginMethod_DirectResult ()
 		{
 			bool result = false;
 			bool continuationTest = false;
 
 			Func<int, int> func = (i) => { result = true; return i + 3; };
-			Task<int> task = factory.FromAsync<int> (func.BeginInvoke (1, delegate {}, null), func.EndInvoke);
+			Task<int> task = factory.FromAsync<int> (func.BeginInvoke (1, delegate { }, null), func.EndInvoke);
 			var cont = task.ContinueWith (_ => continuationTest = true, TaskContinuationOptions.ExecuteSynchronously);
 			task.Wait ();
 			cont.Wait ();
@@ -132,7 +275,7 @@ namespace MonoTests.System.Threading.Tasks
 		}
 
 		[Test]
-		public void FromAsyncWithBeginAndExceptionTest ()
+		public void FromAsyncBeginMethod_Exception ()
 		{
 			bool result = false;
 			bool continuationTest = false;
@@ -142,7 +285,7 @@ namespace MonoTests.System.Threading.Tasks
 			var cont = task.ContinueWith (_ => continuationTest = true, TaskContinuationOptions.ExecuteSynchronously);
 			try {
 				task.Wait ();
-			} catch {}
+			} catch { }
 			cont.Wait ();
 
 			Assert.IsTrue (result);
@@ -151,6 +294,230 @@ namespace MonoTests.System.Threading.Tasks
 			var agg = task.Exception;
 			Assert.AreEqual (1, agg.InnerExceptions.Count);
 			Assert.IsInstanceOfType (typeof (ApplicationException), agg.InnerExceptions[0]);
+			Assert.AreEqual (TaskStatus.Faulted, task.Status);
+
+			try {
+				var a = task.Result;
+				Assert.Fail ();
+			} catch (AggregateException) {
+			}
+		}
+
+		[Test]
+		public void FromAsync_ArgumentsCheck ()
+		{
+			var result = new CompletedAsyncResult ();
+			try {
+				factory.FromAsync (null, l => { });
+				Assert.Fail ("#1");
+			} catch (ArgumentNullException) {
+			}
+
+			try {
+				factory.FromAsync (result, null);
+				Assert.Fail ("#2");
+			} catch (ArgumentNullException) {
+			}
+
+			try {
+				factory.FromAsync (result, l => { }, TaskCreationOptions.LongRunning);
+				Assert.Fail ("#3");
+			} catch (ArgumentOutOfRangeException) {
+			}
+
+			try {
+				factory.FromAsync (result, l => { }, TaskCreationOptions.PreferFairness);
+				Assert.Fail ("#4");
+			} catch (ArgumentOutOfRangeException) {
+			}
+
+			try {
+				factory.FromAsync (result, l => { }, TaskCreationOptions.None, null);
+				Assert.Fail ("#5");
+			} catch (ArgumentNullException) {
+			}
+
+			try {
+				factory.FromAsync (null, l => { }, null, TaskCreationOptions.None);
+				Assert.Fail ("#6");
+			} catch (ArgumentNullException) {
+			}
+
+			try {
+				factory.FromAsync ((a, b) => null, l => { }, null, TaskCreationOptions.LongRunning);
+				Assert.Fail ("#7");
+			} catch (ArgumentOutOfRangeException) {
+			}
+		}
+
+		[Test]
+		public void FromAsync_Completed ()
+		{
+			var completed = new CompletedAsyncResult ();
+			bool? valid = null;
+
+			Action<IAsyncResult> end = l => {
+				Assert.IsFalse (Thread.CurrentThread.IsThreadPoolThread, "#2");
+				valid = l == completed;
+			};
+			Task task = factory.FromAsync (completed, end);
+			Assert.IsTrue (valid == true, "#1");
+		}
+
+		[Test]
+		public void FromAsync_CompletedWithException ()
+		{
+			var completed = new CompletedAsyncResult ();
+
+			Action<IAsyncResult> end = l => {
+				throw new ApplicationException ();
+			};
+			Task task = factory.FromAsync (completed, end);
+			Assert.AreEqual (TaskStatus.Faulted, task.Status, "#1");
+		}
+
+		[Test]
+		public void FromAsync_CompletedCanceled ()
+		{
+			var completed = new CompletedAsyncResult ();
+
+			Action<IAsyncResult> end = l => {
+				throw new OperationCanceledException ();
+			};
+			Task task = factory.FromAsync (completed, end);
+			Assert.AreEqual (TaskStatus.Canceled, task.Status, "#1");
+			Assert.IsNull (task.Exception, "#2");
+		}
+
+		[Test]
+		public void FromAsync_SimpleAsyncResult ()
+		{
+			var result = new TestAsyncResult ();
+			bool called = false;
+
+			var task = factory.FromAsync (result, l => {
+				called = true;
+			});
+
+			Assert.IsTrue (task.Wait (1000), "#1");
+			Assert.IsTrue (called, "#2");
+		}
+
+		[Test]
+		public void FromAsync_ResultException ()
+		{
+			var result = new TestAsyncResult ();
+
+			var task = factory.FromAsync (result, l => {
+				throw new ApplicationException ();
+			});
+
+			try {
+				Assert.IsFalse (task.Wait (1000), "#1");
+			} catch (AggregateException) {
+			}
+
+			Assert.AreEqual (TaskStatus.Faulted, task.Status, "#2");
+		}
+
+		[Test]
+		public void FromAsync_ReturnInt ()
+		{
+			var result = new TestAsyncResult ();
+			bool called = false;
+
+			var task = factory.FromAsync<int> (result, l => {
+				called = true;
+				return 4;
+			});
+
+			Assert.IsTrue (task.Wait (1000), "#1");
+			Assert.IsTrue (called, "#2");
+			Assert.AreEqual (4, task.Result, "#3");
+		}
+
+		[Test]
+		public void FromAsync_Scheduler_Explicit ()
+		{
+			var result = new TestAsyncResult ();
+			bool called = false;
+			var scheduler = new TestScheduler ();
+
+			var task = factory.FromAsync (result, l => {
+				called = true;
+			}, TaskCreationOptions.None, scheduler);
+
+			Assert.IsTrue (task.Wait (5000), "#1");
+			Assert.IsTrue (called, "#2");
+			Assert.IsTrue (scheduler.ExecutedInline, "#3");
+		}
+
+		[Test]
+		public void FromAsync_Scheduler_Implicit ()
+		{
+			var result = new TestAsyncResult ();
+			bool called = false;
+			var scheduler = new TestScheduler ();
+
+			factory = new TaskFactory (scheduler);
+
+			Task task = factory.FromAsync (result, l => {
+				Assert.IsTrue (Thread.CurrentThread.IsThreadPoolThread, "#6");
+				called = true;
+			}, TaskCreationOptions.AttachedToParent);
+
+			Assert.AreEqual (TaskCreationOptions.AttachedToParent, task.CreationOptions, "#1");
+			Assert.IsNull (task.AsyncState, "#2");
+			Assert.IsTrue (task.Wait (5000), "#3");
+			Assert.IsTrue (called, "#4");
+			Assert.IsTrue (scheduler.ExecutedInline, "#5");
+		}
+
+		[Test]
+		public void FromAsync_BeginCallback ()
+		{
+			bool called = false;
+			bool called2 = false;
+
+			var task = factory.FromAsync (
+				(a, b, c) => {
+					if (a != "h")
+						Assert.Fail ("#10");
+
+					if ((TaskCreationOptions) c != TaskCreationOptions.AttachedToParent)
+						Assert.Fail ("#11");
+
+					Assert.IsFalse (Thread.CurrentThread.IsThreadPoolThread, "#12");
+
+					called2 = true;
+					b.Invoke (null);
+					return null;
+				},
+				l => {
+					called = true;
+				},
+				"h", TaskCreationOptions.AttachedToParent);
+
+			Assert.AreEqual (TaskCreationOptions.None, task.CreationOptions, "#1");
+			Assert.AreEqual (TaskCreationOptions.AttachedToParent, (TaskCreationOptions) task.AsyncState, "#2");
+			Assert.IsTrue (task.Wait (5000), "#3");
+			Assert.IsTrue (called, "#4");
+			Assert.IsTrue (called2, "#5");
+		}
+
+		[Test]
+		public void StartNewCancelled ()
+		{
+			var cts = new CancellationTokenSource ();
+			cts.Cancel ();
+
+			var task = factory.StartNew (() => Assert.Fail ("Should never be called"), cts.Token);
+			try {
+				task.Start ();
+			} catch (InvalidOperationException) {
+			}
+
+			Assert.IsTrue (task.IsCanceled, "#2");
 		}
 	}
 }
diff --git a/mcs/class/corlib/Test/System.Threading.Tasks/TaskFactoryTest_T.cs b/mcs/class/corlib/Test/System.Threading.Tasks/TaskFactoryTest_T.cs
new file mode 100644
index 0000000..b8c3776
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Threading.Tasks/TaskFactoryTest_T.cs
@@ -0,0 +1,184 @@
+//
+// TaskFactory_T_Test.cs
+//
+// Author:
+//       Marek Safar <marek.safargmail.com>
+//
+// Copyright 2011 Xamarin, Inc (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+//
+
+#if NET_4_0 || MOBILE
+
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.Threading.Tasks
+{
+	[TestFixture]
+	public class TaskFactory_T_Tests
+	{
+		class CompletedAsyncResult : IAsyncResult
+		{
+			public object AsyncState
+			{
+				get { throw new NotImplementedException (); }
+			}
+
+			public WaitHandle AsyncWaitHandle
+			{
+				get { throw new NotImplementedException (); }
+			}
+
+			public bool CompletedSynchronously
+			{
+				get { throw new NotImplementedException (); }
+			}
+
+			public bool IsCompleted
+			{
+				get { return true; }
+			}
+		}
+
+		class TestAsyncResult : IAsyncResult
+		{
+			WaitHandle wh = new ManualResetEvent (true);
+
+			public object AsyncState
+			{
+				get { throw new NotImplementedException (); }
+			}
+
+			public WaitHandle AsyncWaitHandle
+			{
+				get
+				{
+					return wh;
+				}
+			}
+
+			public bool CompletedSynchronously
+			{
+				get { throw new NotImplementedException (); }
+			}
+
+			public bool IsCompleted
+			{
+				get { return false; }
+			}
+		}
+
+		[SetUp]
+		public void Setup ()
+		{
+		}
+		
+		[Test]
+		public void ConstructorTest ()
+		{
+			try {
+				new TaskFactory<int> (TaskCreationOptions.None, TaskContinuationOptions.ExecuteSynchronously | TaskContinuationOptions.LongRunning);
+				Assert.Fail ("#1");
+			} catch (ArgumentOutOfRangeException) {
+			}
+
+			try {
+				new TaskFactory<int> (TaskCreationOptions.None, TaskContinuationOptions.OnlyOnRanToCompletion);
+				Assert.Fail ("#2");
+			} catch (ArgumentOutOfRangeException) {
+			}
+
+			try {
+				new TaskFactory<int> (TaskCreationOptions.None, TaskContinuationOptions.NotOnRanToCompletion);
+				Assert.Fail ("#3");
+			} catch (ArgumentOutOfRangeException) {
+			}
+		}
+
+		[Test]
+		public void NoDefaultScheduler ()
+		{
+			var tf = new TaskFactory<object> ();
+			Assert.IsNull (tf.Scheduler, "#1");
+		}
+
+		[Test]
+		public void FromAsync_ArgumentsCheck ()
+		{
+			var factory = new TaskFactory<object> ();
+
+			var result = new CompletedAsyncResult ();
+			try {
+				factory.FromAsync (null, l => 1);
+				Assert.Fail ("#1");
+			} catch (ArgumentNullException) {
+			}
+
+			try {
+				factory.FromAsync (result, null);
+				Assert.Fail ("#2");
+			} catch (ArgumentNullException) {
+			}
+
+			try {
+				factory.FromAsync (result, l => 1, TaskCreationOptions.LongRunning);
+				Assert.Fail ("#3");
+			} catch (ArgumentOutOfRangeException) {
+			}
+
+			try {
+				factory.FromAsync (result, l => 1, TaskCreationOptions.PreferFairness);
+				Assert.Fail ("#4");
+			} catch (ArgumentOutOfRangeException) {
+			}
+
+			try {
+				factory.FromAsync (result, l => 1, TaskCreationOptions.None, null);
+				Assert.Fail ("#5");
+			} catch (ArgumentNullException) {
+			}
+
+			try {
+				factory.FromAsync (null, l => 1, null, TaskCreationOptions.None);
+				Assert.Fail ("#6");
+			} catch (ArgumentNullException) {
+			}
+		}
+
+		[Test]
+		public void FromAsync_SimpleAsyncResult ()
+		{
+			var result = new TestAsyncResult ();
+
+			var factory = new TaskFactory<int> ();
+			var task = factory.FromAsync (result, l => 5);
+
+			Assert.IsTrue (task.Wait (1000), "#1");
+			Assert.AreEqual (5, task.Result, "#2");
+		}
+	}
+}
+
+#endif
\ No newline at end of file
diff --git a/mcs/class/corlib/Test/System.Threading.Tasks/TaskSchedulerTest.cs b/mcs/class/corlib/Test/System.Threading.Tasks/TaskSchedulerTest.cs
new file mode 100644
index 0000000..079b38a
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Threading.Tasks/TaskSchedulerTest.cs
@@ -0,0 +1,187 @@
+// TaskSchedulerTest.cs
+//
+// Copyright (c) 2008 Jérémie "Garuma" Laval
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+//
+
+#if NET_4_0
+
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+using System.Collections.Generic;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.Threading.Tasks
+{
+	[TestFixture]
+	public class TaskSchedulerTests
+	{
+		[Test]
+		public void BasicRunSynchronouslyTest ()
+		{
+			bool ran = false;
+			var t = new Task (() => ran = true);
+
+			t.RunSynchronously ();
+			Assert.IsTrue (t.IsCompleted);
+			Assert.IsFalse (t.IsFaulted);
+			Assert.IsFalse (t.IsCanceled);
+			Assert.IsTrue (ran);
+		}
+
+		class LazyCatScheduler : TaskScheduler
+		{
+			public TaskStatus ExecuteInlineStatus {
+				get;
+				set;
+			}
+
+			protected override void QueueTask (Task task)
+			{
+				throw new NotImplementedException ();
+			}
+
+			protected override bool TryDequeue (Task task)
+			{
+				throw new NotImplementedException ();
+			}
+
+			protected override bool TryExecuteTaskInline (Task task, bool taskWasPreviouslyQueued)
+			{
+				ExecuteInlineStatus = task.Status;
+				return true;
+			}
+
+			protected override IEnumerable<Task> GetScheduledTasks ()
+			{
+				throw new NotImplementedException ();
+			}
+		}
+
+		[Test]
+		public void RunSynchronouslyButNoExecutionTest ()
+		{
+			TaskSchedulerException ex = null;
+
+			var ts = new LazyCatScheduler ();
+			Task t = new Task (() => {});
+
+			try {
+				t.RunSynchronously (ts);
+			} catch (TaskSchedulerException e) {
+				ex = e;
+			}
+
+			Assert.IsNotNull (ex);
+			Assert.IsNotNull (ex.InnerException);
+			Assert.IsInstanceOfType (typeof (InvalidOperationException), ex.InnerException);
+		}
+
+		[Test]
+		public void RunSynchronouslyTaskStatusTest ()
+		{
+			var ts = new LazyCatScheduler ();
+			var t = new Task (() => { });
+
+			try {
+				t.RunSynchronously (ts);
+			} catch {}
+			Assert.AreEqual (TaskStatus.WaitingToRun, ts.ExecuteInlineStatus);
+		}
+
+		static int finalizerThreadId = -1;
+	
+		class FinalizerCatcher
+		{
+			~FinalizerCatcher ()
+			{
+				finalizerThreadId = Thread.CurrentThread.ManagedThreadId;
+			}
+		}
+
+		// This test doesn't work if the GC uses multiple finalizer thread.
+		// For now it's fine since only one thread is used
+		[Test]
+		public void UnobservedTaskExceptionOnFinalizerThreadTest ()
+		{
+			var foo = new FinalizerCatcher ();
+			foo = null;
+			GC.Collect ();
+			GC.WaitForPendingFinalizers ();
+			// Same than following test, if GC didn't run don't execute the rest of this test
+			if (finalizerThreadId == -1)
+				return;
+
+			int evtThreadId = -2;
+			TaskScheduler.UnobservedTaskException += delegate {
+				evtThreadId = Thread.CurrentThread.ManagedThreadId;
+			};
+			var evt = new ManualResetEventSlim ();
+			CreateAndForgetFaultedTask (evt);
+ 			evt.Wait (500);
+			Thread.Sleep (100);
+			GC.Collect ();
+			GC.WaitForPendingFinalizers ();
+			Assert.AreEqual (finalizerThreadId, evtThreadId, "Should be ran on finalizer thread");
+		}
+
+		[Test]
+		public void UnobservedTaskExceptionArgumentTest ()
+		{
+			bool ran = false;
+			bool senderIsRight = false;
+			UnobservedTaskExceptionEventArgs args = null;
+
+			TaskScheduler.UnobservedTaskException += (o, a) => {
+				senderIsRight = o.GetType ().ToString () == "System.Threading.Tasks.Task";
+				args = a;
+				ran = true;
+			};
+
+			var evt = new ManualResetEventSlim ();
+			CreateAndForgetFaultedTask (evt);
+			evt.Wait (500);
+			Thread.Sleep (100);
+			GC.Collect ();
+			GC.WaitForPendingFinalizers ();
+
+			// GC is too unreliable for some reason in that test, so backoff if finalizer wasn't ran
+			// it needs to be run for the above test to work though (♥)
+			if (!ran)
+				return;
+
+			Assert.IsNotNull (args.Exception);
+			Assert.IsNotNull (args.Exception.InnerException);
+			Assert.AreEqual ("foo", args.Exception.InnerException.Message);
+			Assert.IsFalse (args.Observed);
+			Assert.IsTrue (senderIsRight, "Sender is a task");
+		}
+
+		// We use this intermediary method to improve chances of GC kicking
+		static void CreateAndForgetFaultedTask (ManualResetEventSlim evt)
+		{
+			Task.Factory.StartNew (() => { evt.Set (); throw new Exception ("foo"); });
+		}
+	}
+}
+#endif
diff --git a/mcs/class/corlib/Test/System.Threading.Tasks/TaskTest.cs b/mcs/class/corlib/Test/System.Threading.Tasks/TaskTest.cs
index 38e144c..913c979 100644
--- a/mcs/class/corlib/Test/System.Threading.Tasks/TaskTest.cs
+++ b/mcs/class/corlib/Test/System.Threading.Tasks/TaskTest.cs
@@ -1,4 +1,4 @@
-#if NET_4_0
+//
 // TaskTest.cs
 //
 // Copyright (c) 2008 Jérémie "Garuma" Laval
@@ -23,6 +23,8 @@
 //
 //
 
+#if NET_4_0
+
 using System;
 using System.Threading;
 using System.Threading.Tasks;
@@ -34,8 +36,8 @@ namespace MonoTests.System.Threading.Tasks
 	[TestFixture]
 	public class TaskTests
 	{
-		Task[]      tasks;
-		static readonly int max = 3 * Environment.ProcessorCount;
+		Task[] tasks;
+		const int max = 6;
 		
 		[SetUp]
 		public void Setup()
@@ -50,7 +52,7 @@ namespace MonoTests.System.Threading.Tasks
 			}
 		}
 		
-		[TestAttribute]
+		[Test]
 		public void WaitAnyTest()
 		{
 			ParallelTestHelper.Repeat (delegate {
@@ -67,17 +69,124 @@ namespace MonoTests.System.Threading.Tasks
 					}
 				});
 				
-				int index = Task.WaitAny(tasks);
+				int index = Task.WaitAny(tasks, 1000);
 				
 				Assert.AreNotEqual (-1, index, "#3");
 				Assert.AreEqual (1, flag, "#1");
 				Assert.AreEqual (1, finished, "#2");
-				
-				Task.WaitAll (tasks);
 			});
 		}
+
+		[Test]
+		public void WaitAny_Empty ()
+		{
+			Assert.AreEqual (-1, Task.WaitAny (new Task[0]));
+		}
+
+		[Test]
+		public void WaitAny_Zero ()
+		{
+			Assert.AreEqual (-1, Task.WaitAny (new[] { new Task (delegate { })}, 0), "#1");
+			Assert.AreEqual (-1, Task.WaitAny (new[] { new Task (delegate { }) }, 20), "#1");
+		}
+
+		[Test]
+		public void WaitAny_Cancelled ()
+		{
+			var cancelation = new CancellationTokenSource ();
+			var tasks = new Task[] {
+				new Task (delegate { }),
+				new Task (delegate { }, cancelation.Token)
+			};
+
+			cancelation.Cancel ();
+
+			Assert.AreEqual (1, Task.WaitAny (tasks, 1000), "#1");
+			Assert.IsTrue (tasks[1].IsCompleted, "#2");
+			Assert.IsTrue (tasks[1].IsCanceled, "#3");
+		}
+
+		[Test]
+		public void WaitAny_CancelledWithoutExecution ()
+		{
+			var cancelation = new CancellationTokenSource ();
+			var tasks = new Task[] {
+				new Task (delegate { }),
+				new Task (delegate { })
+			};
+
+			int res = 0;
+			var mre = new ManualResetEventSlim (false);
+			ThreadPool.QueueUserWorkItem (delegate {
+				res = Task.WaitAny (tasks, 20);
+				mre.Set ();
+			});
+
+			cancelation.Cancel ();
+			Assert.IsTrue (mre.Wait (1000), "#1");
+			Assert.AreEqual (-1, res);
+		}
+
+		[Test]
+		public void WaitAny_OneException ()
+		{
+			var mre = new ManualResetEventSlim (false);
+			var tasks = new Task[] {
+				Task.Factory.StartNew (delegate { mre.Wait (1000); }),
+				Task.Factory.StartNew (delegate { throw new ApplicationException (); })
+			};
+
+			Assert.AreEqual (1, Task.WaitAny (tasks, 1000), "#1");
+			Assert.IsFalse (tasks[0].IsCompleted, "#2");
+			Assert.IsTrue (tasks[1].IsFaulted, "#3");
+
+			mre.Set ();
+		}
+
+		[Test]
+		public void WaitAny_SingleCanceled ()
+		{
+			var src = new CancellationTokenSource ();
+			var t = Task.Factory.StartNew (() => { Thread.Sleep (200); src.Cancel (); src.Token.ThrowIfCancellationRequested (); }, src.Token);
+			Assert.AreEqual (0, Task.WaitAny (new [] { t }));
+		}
+
+		public void WaitAny_ManyExceptions ()
+		{
+			CountdownEvent cde = new CountdownEvent (3);
+			var tasks = new [] {
+				Task.Factory.StartNew (delegate { try { throw new ApplicationException (); } finally { cde.Signal (); } }),
+				Task.Factory.StartNew (delegate { try { throw new ApplicationException (); } finally { cde.Signal (); } }),
+				Task.Factory.StartNew (delegate { try { throw new ApplicationException (); } finally { cde.Signal (); } })
+			};
+
+			Assert.IsTrue (cde.Wait (1000), "#1");
+
+			try {
+				Assert.IsTrue (Task.WaitAll (tasks, 1000), "#2");
+			} catch (AggregateException e) {
+				Assert.AreEqual (3, e.InnerExceptions.Count, "#3");
+			}
+		}
+
+		[Test]
+		public void WaitAny_ManyCanceled ()
+		{
+			var cancellation = new CancellationToken (true);
+			var tasks = new[] {
+				Task.Factory.StartNew (delegate { }, cancellation),
+				Task.Factory.StartNew (delegate { }, cancellation),
+				Task.Factory.StartNew (delegate { }, cancellation)
+			};
+
+			try {
+				Assert.IsTrue (Task.WaitAll (tasks, 1000), "#1");
+			} catch (AggregateException e) {
+				Assert.AreEqual (3, e.InnerExceptions.Count, "#2");
+			}
+		}
 		
-		[TestAttribute]
+		[Test]
 		public void WaitAllTest()
 		{
 			ParallelTestHelper.Repeat (delegate {
@@ -87,35 +196,192 @@ namespace MonoTests.System.Threading.Tasks
 				Assert.AreEqual(max, achieved, "#1");
 			});
 		}
-		
+
 		[Test]
-		public void CancelTestCase()
+		public void WaitAll_ManyTasks ()
 		{
-			bool result = false;
-			
-			CancellationTokenSource src = new CancellationTokenSource ();
-			
-			Task t = new Task (delegate {
-				result = true;
-			}, src.Token);
+			for (int r = 0; r < 2000; ++r) {
+				var tasks = new Task[60];
+
+				for (int i = 0; i < tasks.Length; i++) {
+					tasks[i] = Task.Factory.StartNew (delegate { Thread.Sleep (0); });
+				}
+
+				Assert.IsTrue (Task.WaitAll (tasks, 2000));
+			}
+		}
+
+		[Test]
+		public void WaitAll_Zero ()
+		{
+			Assert.IsFalse (Task.WaitAll (new Task[1] { new Task (delegate { }) }, 0), "#0");
+			Assert.IsFalse (Task.WaitAll (new Task[1] { new Task (delegate { }) }, 10), "#1");
+		}
+
+		[Test]
+		public void WaitAll_WithExceptions ()
+		{
+			InitWithDelegate (delegate { throw new ApplicationException (); });
+
+			try {
+				Task.WaitAll (tasks);
+				Assert.Fail ("#1");
+			} catch (AggregateException e) {
+				Assert.AreEqual (6, e.InnerExceptions.Count, "#2");
+			}
+
+			Assert.IsNotNull (tasks[0].Exception, "#3");
+		}
+
+		[Test]
+		public void WaitAll_TimeoutWithExceptionsAfter ()
+		{
+			CountdownEvent cde = new CountdownEvent (2);
+			var mre = new ManualResetEvent (false);
+			var tasks = new[] {
+				Task.Factory.StartNew (delegate { mre.WaitOne (); }),
+				Task.Factory.StartNew (delegate { try { throw new ApplicationException (); } finally { cde.Signal (); } }),
+				Task.Factory.StartNew (delegate { try { throw new ApplicationException (); } finally { cde.Signal (); } })
+			};
+
+			Assert.IsTrue (cde.Wait (100), "#1");
+			Assert.IsFalse (Task.WaitAll (tasks, 100), "#2");
+
+			mre.Set ();
+
+			try {
+				Assert.IsTrue (Task.WaitAll (tasks, 1000), "#3");
+				Assert.Fail ("#4");
+			} catch (AggregateException e) {
+				Assert.AreEqual (2, e.InnerExceptions.Count, "#5");
+			}
+		}
+
+		[Test]
+		public void WaitAll_TimeoutWithExceptionsBefore ()
+		{
+			CountdownEvent cde = new CountdownEvent (2);
+			var mre = new ManualResetEvent (false);
+			var tasks = new[] {
+				Task.Factory.StartNew (delegate { try { throw new ApplicationException (); } finally { cde.Signal (); } }),
+				Task.Factory.StartNew (delegate { try { throw new ApplicationException (); } finally { cde.Signal (); } }),
+				Task.Factory.StartNew (delegate { mre.WaitOne (); })
+			};
+
+			Assert.IsTrue (cde.Wait (100), "#1");
+			Assert.IsFalse (Task.WaitAll (tasks, 100), "#2");
+
+			mre.Set ();
+
+			try {
+				Assert.IsTrue (Task.WaitAll (tasks, 1000), "#3");
+				Assert.Fail ("#4");
+			} catch (AggregateException e) {
+				Assert.AreEqual (2, e.InnerExceptions.Count, "#5");
+			}
+		}
+
+		[Test]
+		public void WaitAll_Cancelled ()
+		{
+			var cancelation = new CancellationTokenSource ();
+			var tasks = new Task[] {
+				new Task (delegate { cancelation.Cancel (); }),
+				new Task (delegate { }, cancelation.Token)
+			};
+
+			tasks[0].Start ();
+
+			try {
+				Task.WaitAll (tasks);
+				Assert.Fail ("#1");
+			} catch (AggregateException e) {
+				var inner = (TaskCanceledException) e.InnerException;
+				Assert.AreEqual (tasks[1], inner.Task, "#2");
+			}
+
+			Assert.IsTrue (tasks[0].IsCompleted, "#3");
+			Assert.IsTrue (tasks[1].IsCanceled, "#4");
+		}
+
+		[Test]
+		public void WaitAllExceptionThenCancelled ()
+		{
+			var cancelation = new CancellationTokenSource ();
+			var tasks = new Task[] {
+				new Task (delegate { cancelation.Cancel (); throw new ApplicationException (); }),
+				new Task (delegate { }, cancelation.Token)
+			};
+
+			tasks[0].Start ();
+
+			try {
+				Task.WaitAll (tasks);
+				Assert.Fail ("#1");
+			} catch (AggregateException e) {
+				Assert.IsInstanceOfType (typeof (ApplicationException), e.InnerException, "#2");
+				var inner = (TaskCanceledException) e.InnerExceptions[1];
+				Assert.AreEqual (tasks[1], inner.Task, "#3");
+			}
+
+			Assert.IsTrue (tasks[0].IsCompleted, "#4");
+			Assert.IsTrue (tasks[1].IsCanceled, "#5");
+		}
+
+		[Test]
+		public void WaitAll_StartedUnderWait ()
+		{
+			var task1 = new Task (delegate { });
+
+			ThreadPool.QueueUserWorkItem (delegate {
+				// Sleep little to let task to start and hit internal wait
+				Thread.Sleep (20);
+				task1.Start ();
+			});
+
+			Assert.IsTrue (Task.WaitAll (new [] { task1 }, 1000), "#1");
+		}
+
+		[Test]
+		public void CancelBeforeStart ()
+		{
+			var src = new CancellationTokenSource ();
+
+			Task t = new Task (delegate { }, src.Token);
 			src.Cancel ();
-			
-			t.Start ();
-			Exception ex = null;
-			
+			Assert.AreEqual (TaskStatus.Canceled, t.Status, "#1");
+
+			try {
+				t.Start ();
+				Assert.Fail ("#2");
+			} catch (InvalidOperationException) {
+			}
+		}
+
+		[Test]
+		public void Wait_CancelledTask ()
+		{
+			var src = new CancellationTokenSource ();
+
+			Task t = new Task (delegate { }, src.Token);
+			src.Cancel ();
+
+			try {
+				t.Wait (1000);
+				Assert.Fail ("#1");
+			} catch (AggregateException e) {
+				var details = (TaskCanceledException) e.InnerException;
+				Assert.AreEqual (t, details.Task, "#1e");
+			}
+
 			try {
 				t.Wait ();
-			} catch (Exception e) {
-				ex = e;
+				Assert.Fail ("#2");
+			} catch (AggregateException e) {
+				var details = (TaskCanceledException) e.InnerException;
+				Assert.AreEqual (t, details.Task, "#2e");
+				Assert.IsNull (details.Task.Exception, "#2e2");
 			}
-			
-			Assert.IsNotNull (ex, "#1");
-			Assert.IsInstanceOfType (typeof(AggregateException), ex, "#2");
-			Assert.IsNull (t.Exception, "#3");
-			
-			AggregateException aggr = (AggregateException)ex;
-			Assert.AreEqual (1, aggr.InnerExceptions.Count, "#4");
-			Assert.IsInstanceOfType (typeof (OperationCanceledException), aggr.InnerExceptions[0], "#5");
 		}
 
 		[Test, ExpectedException (typeof (InvalidOperationException))]
@@ -126,7 +392,36 @@ namespace MonoTests.System.Threading.Tasks
 			Assert.AreEqual (TaskStatus.Canceled, task.Status);
 			task.Start ();
 		}
-		
+
+		[Test]
+		public void ContinueWithInvalidArguments ()
+		{
+			var task = new Task (() => { });
+			try {
+				task.ContinueWith (null);
+				Assert.Fail ("#1");
+			} catch (ArgumentException) {
+			}
+
+			try {
+				task.ContinueWith (delegate { }, null);
+				Assert.Fail ("#2");
+			} catch (ArgumentException) {
+			}
+
+			try {
+				task.ContinueWith (delegate { }, TaskContinuationOptions.OnlyOnCanceled | TaskContinuationOptions.NotOnCanceled);
+				Assert.Fail ("#3");
+			} catch (ArgumentException) {
+			}
+
+			try {
+				task.ContinueWith (delegate { }, TaskContinuationOptions.OnlyOnRanToCompletion | TaskContinuationOptions.NotOnRanToCompletion);
+				Assert.Fail ("#4");
+			} catch (ArgumentException) {
+			}
+		}
+
 		[Test]
 		public void ContinueWithOnAnyTestCase()
 		{
@@ -151,8 +446,8 @@ namespace MonoTests.System.Threading.Tasks
 				
 				Task t = Task.Factory.StartNew(delegate { });
 				Task cont = t.ContinueWith(delegate { result = true; }, TaskContinuationOptions.OnlyOnRanToCompletion);
-				t.Wait();
-				cont.Wait();
+				Assert.IsTrue (t.Wait(1000), "#4");
+				Assert.IsTrue (cont.Wait(1000), "#5");
 				
 				Assert.IsNull(cont.Exception, "#1");
 				Assert.IsNotNull(cont, "#2");
@@ -163,28 +458,33 @@ namespace MonoTests.System.Threading.Tasks
 		[Test]
 		public void ContinueWithOnAbortedTestCase()
 		{
-			ParallelTestHelper.Repeat (delegate {
-				bool result = false;
-				bool taskResult = false;
-				
-				CancellationTokenSource src = new CancellationTokenSource ();
-				Task t = new Task(delegate { taskResult = true; }, src.Token);
-				src.Cancel ();
-				
-				Task cont = t.ContinueWith (delegate { result = true; },
-				                            TaskContinuationOptions.OnlyOnCanceled | TaskContinuationOptions.ExecuteSynchronously);
+			bool result = false;
+			bool taskResult = false;
 
-				t.Start();
-				cont.Wait();
-				
-				Assert.IsFalse (taskResult, "#-1");
-				Assert.AreEqual (TaskStatus.Canceled, t.Status, "#0");
-				Assert.IsTrue (t.IsCanceled, "#0bis");
-				
-				Assert.IsNull(cont.Exception, "#1");
-				Assert.IsNotNull(cont, "#2");
-				Assert.IsTrue(result, "#3");
-			});
+			CancellationTokenSource src = new CancellationTokenSource ();
+			Task t = new Task (delegate { taskResult = true; }, src.Token);
+
+			Task cont = t.ContinueWith (delegate { result = true; },
+				TaskContinuationOptions.OnlyOnCanceled | TaskContinuationOptions.ExecuteSynchronously);
+
+			src.Cancel ();
+
+			Assert.AreEqual (TaskStatus.Canceled, t.Status, "#1a");
+			Assert.IsTrue (cont.IsCompleted, "#1b");
+			Assert.IsTrue (result, "#1c");
+
+			try {
+				t.Start ();
+				Assert.Fail ("#2");
+			} catch (InvalidOperationException) {
+			}
+
+			Assert.IsTrue (cont.Wait (1000), "#3");
+
+			Assert.IsFalse (taskResult, "#4");
+
+			Assert.IsNull (cont.Exception, "#5");
+			Assert.AreEqual (TaskStatus.RanToCompletion, cont.Status, "#6");
 		}
 		
 		[Test]
@@ -196,8 +496,7 @@ namespace MonoTests.System.Threading.Tasks
 				Task t = Task.Factory.StartNew(delegate { throw new Exception("foo"); });	
 				Task cont = t.ContinueWith(delegate { result = true; }, TaskContinuationOptions.OnlyOnFaulted);
 			
-				cont.Wait();
-				
+				Assert.IsTrue (cont.Wait(1000), "#0");
 				Assert.IsNotNull (t.Exception, "#1");
 				Assert.IsNotNull (cont, "#2");
 				Assert.IsTrue (result, "#3");
@@ -205,22 +504,38 @@ namespace MonoTests.System.Threading.Tasks
 		}
 
 		[Test]
+		public void ContinueWithWithStart ()
+		{
+			Task t = new Task<int> (() => 1);
+			t = t.ContinueWith (l => { });
+			try {
+				t.Start ();
+				Assert.Fail ();
+			} catch (InvalidOperationException) {
+			}
+		}
+
+		[Test]
 		public void ContinueWithChildren ()
 		{
 			ParallelTestHelper.Repeat (delegate {
 			    bool result = false;
 
-			    var t = Task.Factory.StartNew (() => Task.Factory.StartNew (() => Thread.Sleep (100), TaskCreationOptions.AttachedToParent));
-			    t.ContinueWith (_ => result = true);
-			    while (!t.IsCompleted)
-				    Thread.Sleep (200);
+			    var t = Task.Factory.StartNew (() => Task.Factory.StartNew (() => {}, TaskCreationOptions.AttachedToParent));
+
+				var mre = new ManualResetEvent (false);
+			    t.ContinueWith (l => {
+					result = true;
+					mre.Set ();
+				});
 
-			    Assert.IsTrue (result);
+				Assert.IsTrue (mre.WaitOne (1000), "#1");
+			    Assert.IsTrue (result, "#2");
 			}, 2);
 		}
 
-		[TestAttribute]
-		public void MultipleTaskTestCase()
+		[Test]
+		public void MultipleTasks()
 		{
 			ParallelTestHelper.Repeat (delegate {
 				bool r1 = false, r2 = false, r3 = false;
@@ -235,14 +550,14 @@ namespace MonoTests.System.Threading.Tasks
 					r3 = true;
 				});
 				
-				t1.Wait();
-				t2.Wait();
-				t3.Wait();
+				t1.Wait(2000);
+				t2.Wait(2000);
+				t3.Wait(2000);
 				
 				Assert.IsTrue(r1, "#1");
 				Assert.IsTrue(r2, "#2");
 				Assert.IsTrue(r3, "#3");
-			});
+			}, 100);
 		}
 		
 		[Test]
@@ -250,25 +565,26 @@ namespace MonoTests.System.Threading.Tasks
 		{
 			ParallelTestHelper.Repeat (delegate {
 				bool r1 = false, r2 = false, r3 = false;
+				var mre = new ManualResetEvent (false);
 				
 				Task t = Task.Factory.StartNew(delegate {
 					Task.Factory.StartNew(delegate {
-						Thread.Sleep(50);
 						r1 = true;
+						mre.Set ();
 					}, TaskCreationOptions.AttachedToParent);
 					Task.Factory.StartNew(delegate {
-						Thread.Sleep(300);
+						Assert.IsTrue (mre.WaitOne (1000), "#0");
 						
 						r2 = true;
 					}, TaskCreationOptions.AttachedToParent);
 					Task.Factory.StartNew(delegate {
-						Thread.Sleep(150);
+						Assert.IsTrue (mre.WaitOne (1000), "#0");
 						
 						r3 = true;
 					}, TaskCreationOptions.AttachedToParent);
 				});
 				
-				t.Wait();
+				Assert.IsTrue (t.Wait(2000), "#0");
 				Assert.IsTrue(r2, "#1");
 				Assert.IsTrue(r3, "#2");
 				Assert.IsTrue(r1, "#3");
@@ -277,6 +593,44 @@ namespace MonoTests.System.Threading.Tasks
 		}
 
 		[Test]
+		public void DoubleWaitTest ()
+		{
+			ParallelTestHelper.Repeat (delegate {
+				Console.WriteLine ("run");
+				var evt = new ManualResetEventSlim ();
+				var t = Task.Factory.StartNew (() => evt.Wait (2000));
+				var cntd = new CountdownEvent (2);
+
+				bool r1 = false, r2 = false;
+				ThreadPool.QueueUserWorkItem (delegate { cntd.Signal (); r1 = t.Wait (1000); Console.WriteLine ("out 1 {0}", r1); cntd.Signal (); });
+				ThreadPool.QueueUserWorkItem (delegate { cntd.Signal (); r2 = t.Wait (1000); Console.WriteLine ("out 2 {0}", r2); cntd.Signal (); });
+
+				cntd.Wait (2000);
+				cntd.Reset ();
+				evt.Set ();
+				cntd.Wait (2000);
+				Assert.IsTrue (r1);
+				Assert.IsTrue (r2);
+			}, 5);
+		}
+
+		[Test]
+		public void DoubleTimeoutedWaitTest ()
+		{
+			var evt = new ManualResetEventSlim ();
+			var t = new Task (delegate { });
+			var cntd = new CountdownEvent (2);
+
+			bool r1 = false, r2 = false;
+			ThreadPool.QueueUserWorkItem (delegate { r1 = !t.Wait (100); cntd.Signal (); });
+			ThreadPool.QueueUserWorkItem (delegate { r2 = !t.Wait (100); cntd.Signal (); });
+
+			cntd.Wait (2000);
+			Assert.IsTrue (r1);
+			Assert.IsTrue (r2);
+		}
+
+		[Test]
 		public void ExecuteSynchronouslyTest ()
 		{
 			var val = 0;
@@ -287,6 +641,17 @@ namespace MonoTests.System.Threading.Tasks
 		}
 
 		[Test]
+		public void RunSynchronouslyArgumentChecks ()
+		{
+			Task t = new Task (() => { });
+			try {
+				t.RunSynchronously (null);
+				Assert.Fail ("#1");
+			} catch (ArgumentNullException) {
+			}
+		}
+
+		[Test]
 		public void UnobservedExceptionOnFinalizerThreadTest ()
 		{
 			bool wasCalled = false;
@@ -313,12 +678,158 @@ namespace MonoTests.System.Threading.Tasks
 			t.Start ();
 		}
 
+		[Test]
+		public void Start_NullArgument ()
+		{
+			var t = Task.Factory.StartNew (delegate () { });
+			try {
+				t.Start (null);
+				Assert.Fail ();
+			} catch (ArgumentNullException) {
+			}
+		}
+
 		[Test, ExpectedException (typeof (InvalidOperationException))]
 		public void DisposeUnstartedTest ()
 		{
 			var t = new Task (() => { });
 			t.Dispose ();
 		}
+
+		[Test]
+		public void ThrowingUnrelatedCanceledExceptionTest ()
+		{
+			Task t = new Task (() => {
+				throw new TaskCanceledException ();
+			});
+
+			t.RunSynchronously ();
+			Assert.IsTrue (t.IsFaulted);
+			Assert.IsFalse (t.IsCanceled);
+		}
+
+#if NET_4_5
+		[Test]
+		public void WaitAny_WithNull ()
+		{
+			var tasks = new [] {
+				Task.FromResult (2),
+				null
+			};
+
+			try {
+				Task.WaitAny (tasks);
+				Assert.Fail ();
+			} catch (ArgumentException) {
+			}
+		}
+
+		[Test]
+		public void ContinueWith_StateValue ()
+		{
+			var t = Task.Factory.StartNew (l => {
+				Assert.AreEqual (1, l, "a-1");
+			}, 1);
+
+			var c = t.ContinueWith ((a, b) => {
+				Assert.AreEqual (t, a, "c-1");
+				Assert.AreEqual (2, b, "c-2");
+			}, 2);
+
+			var d = t.ContinueWith ((a, b) => {
+				Assert.AreEqual (t, a, "d-1");
+				Assert.AreEqual (3, b, "d-2");
+				return 77;
+			}, 3);
+
+			Assert.IsTrue (d.Wait (1000), "#1");
+
+			Assert.AreEqual (1, t.AsyncState, "#2");
+			Assert.AreEqual (2, c.AsyncState, "#3");
+			Assert.AreEqual (3, d.AsyncState, "#4");
+		}
+
+		[Test]
+		public void ContinueWith_StateValueGeneric ()
+		{
+			var t = Task<int>.Factory.StartNew (l => {
+				Assert.AreEqual (1, l, "a-1");
+				return 80;
+			}, 1);
+
+			var c = t.ContinueWith ((a, b) => {
+				Assert.AreEqual (t, a, "c-1");
+				Assert.AreEqual (2, b, "c-2");
+				return "c";
+			}, 2);
+
+			var d = t.ContinueWith ((a, b) => {
+				Assert.AreEqual (t, a, "d-1");
+				Assert.AreEqual (3, b, "d-2");
+				return 'd';
+			}, 3);
+
+			Assert.IsTrue (d.Wait (1000), "#1");
+
+			Assert.AreEqual (1, t.AsyncState, "#2");
+			Assert.AreEqual (80, t.Result, "#2r");
+			Assert.AreEqual (2, c.AsyncState, "#3");
+			Assert.AreEqual ("c", c.Result, "#3r");
+			Assert.AreEqual (3, d.AsyncState, "#4");
+			Assert.AreEqual ('d', d.Result, "#3r");
+		}
+
+		[Test]
+		public void FromResult ()
+		{
+			var t = Task.FromResult<object> (null);
+			Assert.IsTrue (t.IsCompleted, "#1");
+			Assert.AreEqual (null, t.Result, "#2");
+			t.Dispose ();
+			t.Dispose ();
+		}
+
+		[Test]
+		public void Run_ArgumentCheck ()
+		{
+			try {
+				Task.Run (null as Action);
+				Assert.Fail ("#1");
+			} catch (ArgumentNullException) {
+			}
+		}
+
+		[Test]
+		public void Run ()
+		{
+			var t = Task.Run (delegate { });
+			Assert.AreEqual (TaskCreationOptions.DenyChildAttach, t.CreationOptions, "#1");
+			t.Wait ();
+		}
+
+		[Test]
+		public void Run_Cancel ()
+		{
+			var t = Task.Run (() => 1, new CancellationToken (true));
+			try {
+				var r = t.Result;
+				Assert.Fail ("#1");
+			} catch (AggregateException) {
+			}
+
+			Assert.IsTrue (t.IsCanceled, "#2");
+		}
+
+		[Test]
+		public void Run_ExistingTask ()
+		{
+			var t = new Task<int> (() => 5);
+			var t2 = Task.Run (() => { t.Start (); return t; });
+
+			Assert.IsTrue (t2.Wait (1000), "#1");
+			Assert.AreEqual (5, t2.Result, "#2");
+		}
+#endif
 	}
 }
 #endif
diff --git a/mcs/class/corlib/Test/System.Threading.Tasks/Task_T_Test.cs b/mcs/class/corlib/Test/System.Threading.Tasks/Task_T_Test.cs
new file mode 100644
index 0000000..48543fb
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Threading.Tasks/Task_T_Test.cs
@@ -0,0 +1,121 @@
+// Task_T_Tests.cs
+//
+// Copyright (c) 2008 Jérémie "Garuma" Laval
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+//
+
+#if NET_4_0
+
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.Threading.Tasks
+{
+	[TestFixture]
+	public class Task_T_Tests
+	{
+		Task<int> InitTestTask()
+		{
+			return Task.Factory.StartNew<int> (() => 5);
+		}
+		
+		[Test]
+		public void SimpleTaskTestCase ()
+		{
+			Task<int> f = InitTestTask ();
+			
+			Assert.IsNotNull(f, "#1");
+			Assert.AreEqual(5, f.Result, "#2");
+		}
+		
+		[Test]
+		public void TaskContinueWithTestCase ()
+		{
+			bool result = false;
+			
+			Task<int> f = InitTestTask ();
+			Task<int> cont = f.ContinueWith ((future) => { result = true; return future.Result * 2; });
+			f.Wait ();
+			cont.Wait ();
+			
+			Assert.IsNotNull (cont, "#1");
+			Assert.IsTrue (result, "#2");
+			Assert.AreEqual (10, cont.Result);
+		}
+
+		static Task<int> CreateNestedFuture(int level)
+		{
+			if (level == 0)
+				return Task.Factory.StartNew(() => { Thread.Sleep (1); return 1; });
+
+			var t = CreateNestedFuture(level - 1);
+			return Task.Factory.StartNew(() => t.Result + 1);
+		}
+
+		[Test]
+		public void NestedFutureTest ()
+		{
+			ParallelTestHelper.Repeat (delegate {
+				var t = CreateNestedFuture(10);
+				var t2 = CreateNestedFuture(100);
+				var t3 = CreateNestedFuture(100);
+
+				Assert.AreEqual (11, t.Result);
+				Assert.AreEqual (101, t2.Result);
+				Assert.AreEqual (101, t3.Result);
+		   }, 50);
+		}
+
+		[Test]
+		public void FaultedFutureTest ()
+		{
+			var thrown = new ApplicationException ();
+			var f = Task<int>.Factory.StartNew (() => { throw thrown; return 42; });
+			AggregateException ex = null;
+			try {
+				f.Wait ();
+			} catch (AggregateException e) {
+				ex = e;
+			}
+
+			Assert.IsNotNull (ex);
+			Assert.AreEqual (thrown, ex.InnerException);
+			Assert.AreEqual (thrown, f.Exception.InnerException);
+			Assert.AreEqual (TaskStatus.Faulted, f.Status);
+
+			ex = null;
+			try {
+				var result = f.Result;
+			} catch (AggregateException e) {
+				ex = e;
+			}
+
+			Assert.IsNotNull (ex);
+			Assert.AreEqual (TaskStatus.Faulted, f.Status);
+			Assert.AreEqual (thrown, f.Exception.InnerException);
+			Assert.AreEqual (thrown, ex.InnerException);
+		}
+	}
+}
+#endif
diff --git a/mcs/class/corlib/Test/System/AppDomainTest.cs b/mcs/class/corlib/Test/System/AppDomainTest.cs
index 8d55735..687e091 100644
--- a/mcs/class/corlib/Test/System/AppDomainTest.cs
+++ b/mcs/class/corlib/Test/System/AppDomainTest.cs
@@ -3237,6 +3237,21 @@ namespace MonoTests.System
 			asm.GetTypes();
 		}
 
+        [Test]
+		public void ResourceResolve ()
+		{
+			bool called = false;
+
+			ResolveEventHandler del = delegate (object sender, ResolveEventArgs args) { 
+					called = true; 
+					return null;
+			};
+			AppDomain.CurrentDomain.ResourceResolve += del;
+			Stream st = Assembly.GetExecutingAssembly ().GetManifestResourceStream ("NOT_EXISTING");
+			Assert.IsTrue (called);
+			AppDomain.CurrentDomain.ResourceResolve -= del;
+		}			
+
 		private static Assembly CurrentDomain_ReflectionOnlyAssemblyResolve(object sender, ResolveEventArgs args)
 		{
 			return Assembly.ReflectionOnlyLoad(args.Name);
diff --git a/mcs/class/corlib/Test/System/ArrayTest.cs b/mcs/class/corlib/Test/System/ArrayTest.cs
index bc98d58..59db518 100644
--- a/mcs/class/corlib/Test/System/ArrayTest.cs
+++ b/mcs/class/corlib/Test/System/ArrayTest.cs
@@ -2994,6 +2994,9 @@ public class ArrayTest
 		test = new object[] {null};
 		Assert.AreEqual (test.Contains (null), true, "array with null");
 
+		test = new object[] { 1, null};
+		Assert.IsTrue (test.Contains (null), "array with last null");
+		
 		test = new List<object>(test);
 		Assert.AreEqual (test.Contains (null), true, "List<object> with test");
 		
diff --git a/mcs/class/corlib/Test/System/ChangeLog b/mcs/class/corlib/Test/System/ChangeLog
index 7996d89..f164587 100644
--- a/mcs/class/corlib/Test/System/ChangeLog
+++ b/mcs/class/corlib/Test/System/ChangeLog
@@ -1,3 +1,24 @@
+2011-11-30  Marek Safar  <marek.safar at gmail.com>
+
+	Fix Array::Contains for null items via ICollection<T>. Fixes #2260
+
+	Conflicts:
+
+	mcs/class/corlib/System/Array.cs
+
+2011-09-12  Sebastien Pouliot  <sebastien at xamarin.com>
+
+	More fixes for running unit tests under NET_2_1 profile
+
+2011-09-09  Sebastien Pouliot  <sebastien at xamarin.com>
+
+	Adjust corlib unit tests to reduce failures when executed on the
+	NET_2_1 profile
+
+2011-09-04  Zoltan Varga  <vargaz at gmail.com>
+
+	Implement AppDomain.ResourceResolve. Fixes #579.
+
 2011-08-19  Rodrigo Kumpera  <kumpera at gmail.com>
 
 	Fix variance test involving nullable types.
diff --git a/mcs/class/corlib/Test/System/EnvironmentTest.cs b/mcs/class/corlib/Test/System/EnvironmentTest.cs
index be780fd..794e587 100644
--- a/mcs/class/corlib/Test/System/EnvironmentTest.cs
+++ b/mcs/class/corlib/Test/System/EnvironmentTest.cs
@@ -128,7 +128,7 @@ namespace MonoTests.System
 			Assert.IsFalse (d.IsSynchronized, "IsSynchronized");
 		}
 
-#if NET_2_0 && !TARGET_JVM
+#if NET_2_0 && !TARGET_JVM && !NET_2_1
 		[Test] // bug #333740
 		public void GetEnvironmentVariables_NewlySet ()
 		{
@@ -151,7 +151,7 @@ namespace MonoTests.System
 			Assert.IsNotNull (args [0], "application");
 		}
 
-#if NET_2_0
+#if NET_2_0 && !NET_2_1
 		[Test]
 		[ExpectedException (typeof (ArgumentException))]
 		public void GetEnvironmentVariable_Target_Invalid ()
diff --git a/mcs/class/corlib/Test/System/TimeSpanTest.cs b/mcs/class/corlib/Test/System/TimeSpanTest.cs
index 41aa3de..f649230 100644
--- a/mcs/class/corlib/Test/System/TimeSpanTest.cs
+++ b/mcs/class/corlib/Test/System/TimeSpanTest.cs
@@ -794,7 +794,7 @@ public class TimeSpanTest {
 		ParseHelper (" 13:45:15 ",false, false, "13:45:15");
 		ParseHelper (" -1:2:3 ", false, false, "-01:02:03");
 
-#if NET_4_0
+#if NET_4_0 || NET_2_1
 		// In 4.0 when the first part is out of range, it parses it as day.
 		ParseHelper (" 25:11:12 ", false, false, "25.11:12:00");
 		ParseHelper (" 24:11:12 ", false, false, "24.11:12:00");
@@ -811,14 +811,14 @@ public class TimeSpanTest {
 		ParseHelper ("24:60:60", false, true, "dontcare");
 		ParseHelper ("0001:0002:0003.12     ", false, false, "01:02:03.1200000");
 
-#if NET_4_0
+#if NET_4_0 || NET_2_1
 		// In 4.0 when a section has more than 7 digits an OverflowException is thrown.
 		ParseHelper (" 1:2:3:12345678 ", false, true, "dontcare");
 #else
 		ParseHelper (" 1:2:3:12345678 ", true, false, "dontcare"); 
 #endif
 
-#if NET_4_0		
+#if NET_4_0	|| NET_2_1
 		ParseHelper ("10:11:12:13", false, false, "10.11:12:13"); // Days using : instead of . as separator
 		ParseHelper ("10.11", true, false, "dontcare"); // days+hours is invalid
 
@@ -894,7 +894,7 @@ public class TimeSpanTest {
 	{
 		// hours should be between 0 and 23 but format is also invalid (too many dots)
 		// In 2.0 overflow as precedence over format, but not in 4.0
-#if NET_4_0
+#if NET_4_0 || NET_2_1
 		try {
 			TimeSpan.Parse ("0.99.99.0");
 			Assert.Fail ("#A1");
diff --git a/mcs/class/corlib/corlib.dll.sources b/mcs/class/corlib/corlib.dll.sources
index af58af8..ec86a37 100644
--- a/mcs/class/corlib/corlib.dll.sources
+++ b/mcs/class/corlib/corlib.dll.sources
@@ -253,6 +253,7 @@ System/TimeZone.cs
 ../System.Core/System/TimeZoneInfo.cs
 ../System.Core/System/TimeZoneInfo.AdjustmentRule.cs
 ../System.Core/System/TimeZoneInfo.Android.cs
+../System.Core/System/TimeZoneInfo.MonoTouch.cs
 ../System.Core/System/TimeZoneInfo.TransitionTime.cs
 System/TimeZoneNotFoundException.cs
 System/TimeoutException.cs
@@ -422,6 +423,7 @@ System.IO/FileStream.cs
 System.IO/FileStreamAsyncResult.cs
 System.IO/FileSystemInfo.cs
 System.IO/IOException.cs
+System.IO/LogcatTextWriter.cs
 System.IO/MemoryStream.cs
 System.IO/MonoIO.cs
 System.IO/MonoIOError.cs
@@ -1531,19 +1533,25 @@ System/Predicate.cs
 System.Collections.Generic/Comparer.cs
 
 System.Threading.Tasks/TaskFactory.cs
+System.Threading.Tasks/TaskFactory_T.cs
 System.Threading.Tasks/TaskStatus.cs
 System.Threading.Tasks/TaskCreationOptions.cs
-System.Threading.Tasks/ThreadWorker.cs
-System.Threading.Tasks/SchedulerProxy.cs
-System.Threading.Tasks/Scheduler.cs
 System.Threading.Tasks/CyclicDeque.cs
 System.Threading.Tasks/TaskScheduler.cs
 System.Threading.Tasks/TaskContinuationOptions.cs
 System.Threading.Tasks/TaskCanceledException.cs
-System.Threading.Tasks/Future.cs
+System.Threading.Tasks/Task_T.cs
 System.Threading.Tasks/Task.cs
+System.Threading.Tasks/TaskCompletionQueue.cs
+System.Threading.Tasks/EventSlots.cs
+System.Threading.Tasks/TaskExceptionSlot.cs
+System.Threading.Tasks/TaskActionInvoker.cs
+System.Threading.Tasks/TaskDebuggerView.cs
 System.Threading.Tasks/TaskCompletionSource.cs
+System.Threading.Tasks/TaskContinuation.cs
 System.Threading.Tasks/TaskSchedulerException.cs
+System.Threading.Tasks/TaskConstants.cs
+System.Threading.Tasks/TaskConstants_T.cs
 System.Collections.Concurrent/OrderablePartitioner.cs
 System.Collections.Concurrent/ConcurrentDictionary.cs
 System.Collections.Concurrent/Partitioner.cs
diff --git a/mcs/class/corlib/corlib_test.dll.sources b/mcs/class/corlib/corlib_test.dll.sources
index e59eebd..4b9eda8 100644
--- a/mcs/class/corlib/corlib_test.dll.sources
+++ b/mcs/class/corlib/corlib_test.dll.sources
@@ -437,7 +437,10 @@ System.Threading/MutexCas.cs
 System.Threading/ThreadCas.cs
 System.Threading/WaitHandleCas.cs
 System.Threading.Tasks/TaskTest.cs
+System.Threading.Tasks/Task_T_Test.cs
 System.Threading.Tasks/TaskFactoryTest.cs
+System.Threading.Tasks/TaskFactoryTest_T.cs
+System.Threading.Tasks/TaskSchedulerTest.cs
 System.Threading.Tasks/FutureTests.cs
 System.Threading.Tasks/TaskCompletionSourceTests.cs
 System.Threading.Tasks/ParallelTestHelper.cs
diff --git a/mcs/class/lib/monolite/Mono.Security.dll b/mcs/class/lib/monolite/Mono.Security.dll
index 5c159dd..41a94df 100755
Binary files a/mcs/class/lib/monolite/Mono.Security.dll and b/mcs/class/lib/monolite/Mono.Security.dll differ
diff --git a/mcs/class/lib/monolite/System.Core.dll b/mcs/class/lib/monolite/System.Core.dll
index bee9428..6968550 100755
Binary files a/mcs/class/lib/monolite/System.Core.dll and b/mcs/class/lib/monolite/System.Core.dll differ
diff --git a/mcs/class/lib/monolite/System.Xml.dll b/mcs/class/lib/monolite/System.Xml.dll
index 50304a4..29ed006 100755
Binary files a/mcs/class/lib/monolite/System.Xml.dll and b/mcs/class/lib/monolite/System.Xml.dll differ
diff --git a/mcs/class/lib/monolite/System.dll b/mcs/class/lib/monolite/System.dll
index 5f971ae..9ce6d18 100755
Binary files a/mcs/class/lib/monolite/System.dll and b/mcs/class/lib/monolite/System.dll differ
diff --git a/mcs/class/lib/monolite/mcs.exe b/mcs/class/lib/monolite/mcs.exe
index f111bf8..f248f05 100755
Binary files a/mcs/class/lib/monolite/mcs.exe and b/mcs/class/lib/monolite/mcs.exe differ
diff --git a/mcs/class/lib/monolite/mscorlib.dll b/mcs/class/lib/monolite/mscorlib.dll
index 4530c1e..f91e0fc 100755
Binary files a/mcs/class/lib/monolite/mscorlib.dll and b/mcs/class/lib/monolite/mscorlib.dll differ
diff --git a/mcs/errors/ChangeLog b/mcs/errors/ChangeLog
index 692d4c8..c572364 100644
--- a/mcs/errors/ChangeLog
+++ b/mcs/errors/ChangeLog
@@ -1,3 +1,8 @@
+2011-12-13  Marek Safar  <marek.safar at gmail.com>
+
+	Fixes NRE when checking most specific type of default parameters.
+	Fixes #2465
+
 2011-01-24  Marek Safar  <marek.safar at gmail.com>
 
 	[666476] Use correct parameter count when checking ambiguous
diff --git a/mcs/errors/cs0121-21.cs b/mcs/errors/cs0121-21.cs
new file mode 100644
index 0000000..04a8992
--- /dev/null
+++ b/mcs/errors/cs0121-21.cs
@@ -0,0 +1,18 @@
+// CS0121: The call is ambiguous between the following methods or properties: `C.C(double[], int, object)' and `C.C(double[], int, string[])'
+// Line: 16
+
+class C
+{
+	C (double[] o, int i = -1, object ii = null)
+	{
+	}
+	
+	C (double[] o, int i = -1, string[] s = null)
+	{
+	}
+	
+	public static void Main ()
+	{
+		new C (null, 1);
+	}
+}
diff --git a/mcs/ilasm/ChangeLog b/mcs/ilasm/ChangeLog
index cb49f97..667b165 100644
--- a/mcs/ilasm/ChangeLog
+++ b/mcs/ilasm/ChangeLog
@@ -1,3 +1,8 @@
+2011-08-30  Chris Toshok  <toshok at gmail.com>
+
+	prepend $(CURDIR) to jay input files so that the debugging info
+	references the right .jay
+
 2009-01-09  Miguel de Icaza  <miguel at novell.com>
 
 	* Add support for `strict' in .method declaration
diff --git a/mcs/ilasm/ChangeLog b/mcs/ilasm/ChangeLog.old
similarity index 100%
copy from mcs/ilasm/ChangeLog
copy to mcs/ilasm/ChangeLog.old
diff --git a/mcs/ilasm/Makefile b/mcs/ilasm/Makefile
index 97cf9de..7c6cef4 100644
--- a/mcs/ilasm/Makefile
+++ b/mcs/ilasm/Makefile
@@ -16,7 +16,7 @@ EXTRA_DISTFILES = \
 	$(wildcard tests/*.il)
 
 ILParser.cs: parser/ILParser.jay $(topdir)/jay/skeleton.cs
-	$(topdir)/jay/jay -ct < $(topdir)/jay/skeleton.cs $< >$@
+	$(topdir)/jay/jay -ct < $(topdir)/jay/skeleton.cs $(CURDIR)/$< >$@
 
 include ../build/executable.make
 
diff --git a/mcs/mcs/ChangeLog b/mcs/mcs/ChangeLog
index 3f0ac6d..c8b9050 100644
--- a/mcs/mcs/ChangeLog
+++ b/mcs/mcs/ChangeLog
@@ -1,3 +1,12 @@
+2011-12-13  Marek Safar  <marek.safar at gmail.com>
+
+	Fixes NRE when checking most specific type of default parameters.
+	Fixes #2465
+
+2011-05-17  Marek Habersack  <grendel at twistedcode.net>
+
+	Support colors on 256-color terminals
+
 2011-08-17  Miguel de Icaza  <miguel at gnome.org>
 
 	updated copyrights
diff --git a/mcs/mcs/ecore.cs b/mcs/mcs/ecore.cs
index 3a55a77..15003c1 100644
--- a/mcs/mcs/ecore.cs
+++ b/mcs/mcs/ecore.cs
@@ -4100,7 +4100,10 @@ namespace Mono.CSharp {
 
 			var ac_p = p as ArrayContainer;
 			if (ac_p != null) {
-				var ac_q = ((ArrayContainer) q);
+				var ac_q = q as ArrayContainer;
+				if (ac_q == null)
+					return null;
+
 				TypeSpec specific = MoreSpecific (ac_p.Element, ac_q.Element);
 				if (specific == ac_p.Element)
 					return p;
diff --git a/mcs/mcs/report.cs b/mcs/mcs/report.cs
index 98ae95c..b472852 100644
--- a/mcs/mcs/report.cs
+++ b/mcs/mcs/report.cs
@@ -815,6 +815,7 @@ namespace Mono.CSharp {
 				break;
 
 			case "xterm-color":
+			case "xterm-256color":
 				xterm_colors = true;
 				break;
 			}
diff --git a/mcs/tools/mono-service/ChangeLog b/mcs/tools/mono-service/ChangeLog
index 1ddc884..adcdc5e 100644
--- a/mcs/tools/mono-service/ChangeLog
+++ b/mcs/tools/mono-service/ChangeLog
@@ -1,3 +1,8 @@
+2011-10-22  Miguel de Icaza  <miguel at gnome.org>
+
+	Fix from github.com/sehe for passing the command line arguments to
+	the OnStart method
+
 2011-01-31  Bit Diff  <lists at bitdiff.com>
 
 	Fixes #527447 whereby it was not possible to pass additional
diff --git a/mcs/tools/mono-service/mono-service.cs b/mcs/tools/mono-service/mono-service.cs
index 35c9da0..3da6f71 100644
--- a/mcs/tools/mono-service/mono-service.cs
+++ b/mcs/tools/mono-service/mono-service.cs
@@ -240,7 +240,7 @@ class MonoServiceRunner : MarshalByRefObject
 				service = services [0];
 			}
 	
-			call (service, "OnStart", new string [0]);
+			call (service, "OnStart", args);
 			info (logname, "Service {0} started", service.ServiceName);
 	
 			UnixSignal intr = new UnixSignal (Signum.SIGINT);
diff --git a/mcs/tools/monodoc/ChangeLog b/mcs/tools/monodoc/ChangeLog
index bc32d80..735b8e9 100644
--- a/mcs/tools/monodoc/ChangeLog
+++ b/mcs/tools/monodoc/ChangeLog
@@ -1,3 +1,15 @@
+2011-11-29  Jeffrey Stedfast  <jeff at xamarin.com>
+
+	[monodoc] Removed debug spew
+
+2011-10-07  Miguel de Icaza  <miguel at gnome.org>
+
+	Add the fallback to MonoDoc
+
+2011-10-07  Miguel de Icaza  <miguel at gnome.org>
+
+	Avoid loading the same documentation file twice
+
 2011-01-10  Jonathan Pryor  <jonpryor at vt.edu>
 
 	[monodoc/osx] Look for docs in additional directories.
diff --git a/mcs/tools/monodoc/Monodoc/provider.cs b/mcs/tools/monodoc/Monodoc/provider.cs
index c2cee55..22b32f0 100644
--- a/mcs/tools/monodoc/Monodoc/provider.cs
+++ b/mcs/tools/monodoc/Monodoc/provider.cs
@@ -854,6 +854,8 @@ public class RootTree : Tree {
 	{
 		return LoadTree (null);
 	}
+
+	const string MacMonoDocDir = "/Library/Frameworks/Mono.framework/Versions/Current/lib/monodoc";
 	
 	//
 	// Loads the tree layout
@@ -871,8 +873,15 @@ public class RootTree : Tree {
 				d.Load (cfgFile);
 				basedir = d.SelectSingleNode ("config/path").Attributes ["docsPath"].Value;
 			}
-			//basedir = "/Library/Frameworks/Mono.framework/Versions/Current/lib/monodoc/";
+			// Temporary workaround for developers distributing a monodoc.dll themselves on Mac
+			if (Directory.Exists (MacMonoDocDir)){
+				Console.WriteLine ("MacDir exists");
+				if (!File.Exists (Path.Combine (basedir, "monodoc.xml"))){
+					basedir = MacMonoDocDir;
+				}
+			}
 		}
+		Console.WriteLine ("Basedir={0}", basedir);
 
 		//
 		// Load the layout
@@ -906,6 +915,7 @@ public class RootTree : Tree {
 				docTree.Load (defTree);
 		}
 
+
 		sourceFiles = sourceFiles ?? new string [0];
 
 		//
@@ -930,8 +940,9 @@ public class RootTree : Tree {
 		//
 		// Load the sources
 		//
-		foreach (var sourceFile in sourceFiles)
+		foreach (var sourceFile in sourceFiles){
 			root.AddSourceFile (sourceFile);
+		}
 		
 		foreach (string path in UncompiledHelpSources) {
 			EcmaUncompiledHelpSource hs = new EcmaUncompiledHelpSource(path);
@@ -965,8 +976,13 @@ public class RootTree : Tree {
 		}
 	}
 
+	Dictionary<string,string> loadedSourceFiles = new Dictionary<string,string> ();
+	
 	public void AddSourceFile (string sourceFile)
 	{
+		if (loadedSourceFiles.ContainsKey (sourceFile))
+			return;
+		
 		Node third_party = LookupEntryPoint ("various") ?? this;
 
 		XmlDocument doc = new XmlDocument ();
@@ -987,6 +1003,7 @@ public class RootTree : Tree {
 			Console.Error.WriteLine ("Error: No <source> section found in the {0} file", sourceFile);
 			return;
 		}
+		loadedSourceFiles [sourceFile] = sourceFile;
 		foreach (XmlNode source in sources){
 			XmlAttribute a = source.Attributes ["provider"];
 			if (a == null){
@@ -1216,7 +1233,6 @@ public class RootTree : Tree {
 		}
 
 		if (nsidx == -1) {
-			Console.Error.WriteLine ("Did not find dot in: " + url);
 			ns = null;
 			type = null;
 			return false;
diff --git a/mcs/tools/xbuild/ChangeLog b/mcs/tools/xbuild/ChangeLog
index bc74af2..0334f60 100644
--- a/mcs/tools/xbuild/ChangeLog
+++ b/mcs/tools/xbuild/ChangeLog
@@ -1,3 +1,7 @@
+2011-05-17  Marek Habersack  <grendel at twistedcode.net>
+
+	Support colors on 256-color terminals
+
 2011-03-21  Ankit Jain  <radical at corewars.org>
 
 	* tools/xbuild/xbuild/4.0/Microsoft.Common.targets
diff --git a/mcs/tools/xbuild/Main.cs b/mcs/tools/xbuild/Main.cs
index d86c03d..fef416f 100644
--- a/mcs/tools/xbuild/Main.cs
+++ b/mcs/tools/xbuild/Main.cs
@@ -195,6 +195,7 @@ namespace Mono.XBuild.CommandLine {
 				break;
 
 			case "xterm-color":
+			case "xterm-256color":
 				xterm_colors = true;
 				break;
 			}
diff --git a/missing b/missing
index 1c8ff70..28055d2 100755
--- a/missing
+++ b/missing
@@ -1,10 +1,10 @@
 #! /bin/sh
 # Common stub for a few missing GNU programs while installing.
 
-scriptversion=2006-05-10.23
+scriptversion=2009-04-28.21; # UTC
 
-# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006
-#   Free Software Foundation, Inc.
+# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006,
+# 2008, 2009 Free Software Foundation, Inc.
 # Originally by Fran,cois Pinard <pinard at iro.umontreal.ca>, 1996.
 
 # This program is free software; you can redistribute it and/or modify
@@ -18,9 +18,7 @@ scriptversion=2006-05-10.23
 # GNU General Public License for more details.
 
 # You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # As a special exception to the GNU General Public License, if you
 # distribute this file as part of a program that contains a
@@ -89,6 +87,9 @@ Supported PROGRAM values:
   tar          try tar, gnutar, gtar, then tar without non-portable flags
   yacc         create \`y.tab.[ch]', if possible, from existing .[ch]
 
+Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and
+\`g' are ignored when checking the name.
+
 Send bug reports to <bug-automake at gnu.org>."
     exit $?
     ;;
@@ -106,15 +107,22 @@ Send bug reports to <bug-automake at gnu.org>."
 
 esac
 
+# normalize program name to check for.
+program=`echo "$1" | sed '
+  s/^gnu-//; t
+  s/^gnu//; t
+  s/^g//; t'`
+
 # Now exit if we have it, but it failed.  Also exit now if we
 # don't have it and --version was passed (most likely to detect
-# the program).
+# the program).  This is about non-GNU programs, so use $1 not
+# $program.
 case $1 in
-  lex|yacc)
+  lex*|yacc*)
     # Not GNU programs, they don't have --version.
     ;;
 
-  tar)
+  tar*)
     if test -n "$run"; then
        echo 1>&2 "ERROR: \`tar' requires --run"
        exit 1
@@ -138,7 +146,7 @@ esac
 
 # If it does not exist, or fails to run (possibly an outdated version),
 # try to emulate it.
-case $1 in
+case $program in
   aclocal*)
     echo 1>&2 "\
 WARNING: \`$1' is $msg.  You should only need it if
@@ -148,7 +156,7 @@ WARNING: \`$1' is $msg.  You should only need it if
     touch aclocal.m4
     ;;
 
-  autoconf)
+  autoconf*)
     echo 1>&2 "\
 WARNING: \`$1' is $msg.  You should only need it if
          you modified \`${configure_ac}'.  You might want to install the
@@ -157,7 +165,7 @@ WARNING: \`$1' is $msg.  You should only need it if
     touch configure
     ;;
 
-  autoheader)
+  autoheader*)
     echo 1>&2 "\
 WARNING: \`$1' is $msg.  You should only need it if
          you modified \`acconfig.h' or \`${configure_ac}'.  You might want
@@ -187,7 +195,7 @@ WARNING: \`$1' is $msg.  You should only need it if
 	   while read f; do touch "$f"; done
     ;;
 
-  autom4te)
+  autom4te*)
     echo 1>&2 "\
 WARNING: \`$1' is needed, but is $msg.
          You might have modified some files without having the
@@ -210,7 +218,7 @@ WARNING: \`$1' is needed, but is $msg.
     fi
     ;;
 
-  bison|yacc)
+  bison*|yacc*)
     echo 1>&2 "\
 WARNING: \`$1' $msg.  You should only need it if
          you modified a \`.y' file.  You may need the \`Bison' package
@@ -240,7 +248,7 @@ WARNING: \`$1' $msg.  You should only need it if
     fi
     ;;
 
-  lex|flex)
+  lex*|flex*)
     echo 1>&2 "\
 WARNING: \`$1' is $msg.  You should only need it if
          you modified a \`.l' file.  You may need the \`Flex' package
@@ -263,7 +271,7 @@ WARNING: \`$1' is $msg.  You should only need it if
     fi
     ;;
 
-  help2man)
+  help2man*)
     echo 1>&2 "\
 WARNING: \`$1' is $msg.  You should only need it if
 	 you modified a dependency of a manual page.  You may need the
@@ -277,11 +285,11 @@ WARNING: \`$1' is $msg.  You should only need it if
     else
 	test -z "$file" || exec >$file
 	echo ".ab help2man is required to generate this page"
-	exit 1
+	exit $?
     fi
     ;;
 
-  makeinfo)
+  makeinfo*)
     echo 1>&2 "\
 WARNING: \`$1' is $msg.  You should only need it if
          you modified a \`.texi' or \`.texinfo' file, or any other file
@@ -310,7 +318,7 @@ WARNING: \`$1' is $msg.  You should only need it if
     touch $file
     ;;
 
-  tar)
+  tar*)
     shift
 
     # We have already tried tar in the generic part.
@@ -363,5 +371,6 @@ exit 0
 # eval: (add-hook 'write-file-hooks 'time-stamp)
 # time-stamp-start: "scriptversion="
 # time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-end: "$"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
 # End:
diff --git a/mono/Makefile.in b/mono/Makefile.in
index 0b000b5..17dc617 100644
--- a/mono/Makefile.in
+++ b/mono/Makefile.in
@@ -301,9 +301,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign mono/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu mono/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign mono/Makefile
+	  $(AUTOMAKE) --gnu mono/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
diff --git a/mono/arch/Makefile.in b/mono/arch/Makefile.in
index c8a682e..5ae660f 100644
--- a/mono/arch/Makefile.in
+++ b/mono/arch/Makefile.in
@@ -324,9 +324,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign mono/arch/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu mono/arch/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign mono/arch/Makefile
+	  $(AUTOMAKE) --gnu mono/arch/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
diff --git a/mono/arch/alpha/Makefile.in b/mono/arch/alpha/Makefile.in
index 3e79914..812e6d2 100644
--- a/mono/arch/alpha/Makefile.in
+++ b/mono/arch/alpha/Makefile.in
@@ -285,9 +285,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign mono/arch/alpha/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu mono/arch/alpha/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign mono/arch/alpha/Makefile
+	  $(AUTOMAKE) --gnu mono/arch/alpha/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
diff --git a/mono/arch/amd64/Makefile.in b/mono/arch/amd64/Makefile.in
index 0a4cc74..9f079d1 100644
--- a/mono/arch/amd64/Makefile.in
+++ b/mono/arch/amd64/Makefile.in
@@ -279,9 +279,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign mono/arch/amd64/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu mono/arch/amd64/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign mono/arch/amd64/Makefile
+	  $(AUTOMAKE) --gnu mono/arch/amd64/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
diff --git a/mono/arch/arm/Makefile.in b/mono/arch/arm/Makefile.in
index bb69dd2..39ee75d 100644
--- a/mono/arch/arm/Makefile.in
+++ b/mono/arch/arm/Makefile.in
@@ -293,9 +293,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign mono/arch/arm/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu mono/arch/arm/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign mono/arch/arm/Makefile
+	  $(AUTOMAKE) --gnu mono/arch/arm/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
diff --git a/mono/arch/hppa/Makefile.in b/mono/arch/hppa/Makefile.in
index aa0d94e..545eb2f 100644
--- a/mono/arch/hppa/Makefile.in
+++ b/mono/arch/hppa/Makefile.in
@@ -279,9 +279,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign mono/arch/hppa/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu mono/arch/hppa/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign mono/arch/hppa/Makefile
+	  $(AUTOMAKE) --gnu mono/arch/hppa/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
diff --git a/mono/arch/ia64/Makefile.in b/mono/arch/ia64/Makefile.in
index b000ef8..50d251e 100644
--- a/mono/arch/ia64/Makefile.in
+++ b/mono/arch/ia64/Makefile.in
@@ -259,9 +259,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign mono/arch/ia64/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu mono/arch/ia64/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign mono/arch/ia64/Makefile
+	  $(AUTOMAKE) --gnu mono/arch/ia64/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
diff --git a/mono/arch/mips/Makefile.in b/mono/arch/mips/Makefile.in
index 3ee92e7..0cf4ac3 100644
--- a/mono/arch/mips/Makefile.in
+++ b/mono/arch/mips/Makefile.in
@@ -285,9 +285,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign mono/arch/mips/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu mono/arch/mips/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign mono/arch/mips/Makefile
+	  $(AUTOMAKE) --gnu mono/arch/mips/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
diff --git a/mono/arch/ppc/Makefile.in b/mono/arch/ppc/Makefile.in
index 041a977..0b01d3f 100644
--- a/mono/arch/ppc/Makefile.in
+++ b/mono/arch/ppc/Makefile.in
@@ -287,9 +287,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign mono/arch/ppc/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu mono/arch/ppc/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign mono/arch/ppc/Makefile
+	  $(AUTOMAKE) --gnu mono/arch/ppc/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
diff --git a/mono/arch/s390/Makefile.in b/mono/arch/s390/Makefile.in
index 4eda7ef..dbe5a7b 100644
--- a/mono/arch/s390/Makefile.in
+++ b/mono/arch/s390/Makefile.in
@@ -279,9 +279,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign mono/arch/s390/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu mono/arch/s390/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign mono/arch/s390/Makefile
+	  $(AUTOMAKE) --gnu mono/arch/s390/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
diff --git a/mono/arch/s390x/Makefile.in b/mono/arch/s390x/Makefile.in
index dc9dc60..fb41b40 100644
--- a/mono/arch/s390x/Makefile.in
+++ b/mono/arch/s390x/Makefile.in
@@ -279,9 +279,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign mono/arch/s390x/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu mono/arch/s390x/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign mono/arch/s390x/Makefile
+	  $(AUTOMAKE) --gnu mono/arch/s390x/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
diff --git a/mono/arch/sparc/Makefile.in b/mono/arch/sparc/Makefile.in
index 4368435..28cd29b 100644
--- a/mono/arch/sparc/Makefile.in
+++ b/mono/arch/sparc/Makefile.in
@@ -279,9 +279,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign mono/arch/sparc/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu mono/arch/sparc/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign mono/arch/sparc/Makefile
+	  $(AUTOMAKE) --gnu mono/arch/sparc/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
diff --git a/mono/arch/x86/Makefile.in b/mono/arch/x86/Makefile.in
index 1325289..eb55cac 100644
--- a/mono/arch/x86/Makefile.in
+++ b/mono/arch/x86/Makefile.in
@@ -281,9 +281,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign mono/arch/x86/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu mono/arch/x86/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign mono/arch/x86/Makefile
+	  $(AUTOMAKE) --gnu mono/arch/x86/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
diff --git a/mono/benchmark/Makefile.in b/mono/benchmark/Makefile.in
index bf5fca7..5e659af 100644
--- a/mono/benchmark/Makefile.in
+++ b/mono/benchmark/Makefile.in
@@ -304,9 +304,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign mono/benchmark/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu mono/benchmark/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign mono/benchmark/Makefile
+	  $(AUTOMAKE) --gnu mono/benchmark/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
diff --git a/mono/cil/Makefile.in b/mono/cil/Makefile.in
index b2ebc1a..862be8d 100644
--- a/mono/cil/Makefile.in
+++ b/mono/cil/Makefile.in
@@ -288,9 +288,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign mono/cil/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu mono/cil/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign mono/cil/Makefile
+	  $(AUTOMAKE) --gnu mono/cil/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
diff --git a/mono/dis/Makefile.in b/mono/dis/Makefile.in
index a56246a..27bbd4b 100644
--- a/mono/dis/Makefile.in
+++ b/mono/dis/Makefile.in
@@ -345,9 +345,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign mono/dis/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu mono/dis/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign mono/dis/Makefile
+	  $(AUTOMAKE) --gnu mono/dis/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
diff --git a/mono/interpreter/Makefile.in b/mono/interpreter/Makefile.in
index e8731cd..eeee74a 100644
--- a/mono/interpreter/Makefile.in
+++ b/mono/interpreter/Makefile.in
@@ -362,9 +362,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign mono/interpreter/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu mono/interpreter/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign mono/interpreter/Makefile
+	  $(AUTOMAKE) --gnu mono/interpreter/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
diff --git a/mono/io-layer/ChangeLog b/mono/io-layer/ChangeLog
index c5fe937..ae15cfa 100644
--- a/mono/io-layer/ChangeLog
+++ b/mono/io-layer/ChangeLog
@@ -1,3 +1,37 @@
+2011-11-24  Zoltan Varga  <vargaz at gmail.com>
+
+	Always free _WapiFileShare entries using _wapi_free_share_info (),
+	otherwise zeroed out entries remain in the hash table when shared
+	handles are disabled. Fixes #2170.
+
+2011-11-11  Alan McGovern  <alan.mcgovern at gmail.com>
+
+	[io-layer] Use lstat as a fallback for stat in SetFileAttributes
+
+	Make SetFileAttributes consistent with GetFileAttributes - if stat
+	fails and ENOENT try to use lstat in case it's a dangling symlink.
+
+2011-11-04  Zoltan Varga  <vargaz at gmail.com>
+
+	Avoid adding a ref in OpenProcess (), it is already added in
+	_wapi_search_handle (). Fixes #1682.
+
+2011-09-06  Rodrigo Kumpera  <kumpera at gmail.com>
+
+	Let the system figure our permissions instead of doing a poor job
+	at it.
+
+	io.c (DeleteFile): We can't forbit a file to be deleted just
+	before it's mask is not u+w. We should just call unlink and let
+	the kernel figure out permissions.
+
+	We are not SAMBA.
+
+	We're not in the job of trying to mingle windows and unix
+	permissions models so we just let the kernel figure it out and
+	translate the appropriate errno value to
+	UnauthorizedAccessException.
+
 2011-08-17  Miguel de Icaza  <miguel at gnome.org>
 
 	updated copyrights
diff --git a/mono/io-layer/Makefile.in b/mono/io-layer/Makefile.in
index 6cc8c34..7889e16 100644
--- a/mono/io-layer/Makefile.in
+++ b/mono/io-layer/Makefile.in
@@ -442,9 +442,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign mono/io-layer/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu mono/io-layer/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign mono/io-layer/Makefile
+	  $(AUTOMAKE) --gnu mono/io-layer/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
diff --git a/mono/io-layer/handles.c b/mono/io-layer/handles.c
index 591691e..faf92ee 100644
--- a/mono/io-layer/handles.c
+++ b/mono/io-layer/handles.c
@@ -819,6 +819,7 @@ _wapi_handle_foreach (WapiHandleType type,
  * unreffed if the check function returns FALSE, so callers must not
  * rely on the handle persisting (unless the check function returns
  * TRUE)
+ * The caller owns the returned handle.
  */
 gpointer _wapi_search_handle (WapiHandleType type,
 			      gboolean (*check)(gpointer test, gpointer user),
@@ -1668,6 +1669,7 @@ _wapi_free_share_info (_WapiFileShare *share_info)
 		file_share_hash_lock ();
 		g_hash_table_remove (file_share_hash, share_info);
 		file_share_hash_unlock ();
+		/* The hashtable dtor frees share_info */
 	} else {
 		memset (share_info, '\0', sizeof(struct _WapiFileShare));
 	}
@@ -1840,7 +1842,7 @@ static void _wapi_handle_check_share_by_pid (struct _WapiFileShare *share_info)
 		g_message ("%s: Didn't find it, destroying entry", __func__);
 #endif
 
-		memset (share_info, '\0', sizeof(struct _WapiFileShare));
+		_wapi_free_share_info (share_info);
 	}
 }
 
@@ -1970,7 +1972,7 @@ void _wapi_handle_check_share (struct _WapiFileShare *share_info, int fd)
 		g_message ("%s: Didn't find it, destroying entry", __func__);
 #endif
 
-		memset (share_info, '\0', sizeof(struct _WapiFileShare));
+		_wapi_free_share_info (share_info);
 	}
 
 done:
diff --git a/mono/io-layer/io.c b/mono/io-layer/io.c
index 9e6befa..6cf99ab 100644
--- a/mono/io-layer/io.c
+++ b/mono/io-layer/io.c
@@ -1738,15 +1738,6 @@ gboolean DeleteFile(const gunichar2 *name)
 		return(FALSE);
 	}
 
-	if (attrs & FILE_ATTRIBUTE_READONLY) {
-#ifdef DEBUG
-		g_message ("%s: file %s is readonly", __func__, filename);
-#endif
-		SetLastError (ERROR_ACCESS_DENIED);
-		g_free (filename);
-		return(FALSE);
-	}
-
 #if 0
 	/* Check to make sure sharing allows us to open the file for
 	 * writing.  See bug 323389.
@@ -3352,6 +3343,11 @@ extern gboolean SetFileAttributes (const gunichar2 *name, guint32 attrs)
 	}
 
 	result = _wapi_stat (utf8_name, &buf);
+	if (result == -1 && errno == ENOENT) {
+		/* Might be a dangling symlink... */
+		result = _wapi_lstat (utf8_name, &buf);
+	}
+
 	if (result != 0) {
 		_wapi_set_last_path_error_from_errno (NULL, utf8_name);
 		g_free (utf8_name);
diff --git a/mono/io-layer/processes.c b/mono/io-layer/processes.c
index 33037f1..456cbec 100644
--- a/mono/io-layer/processes.c
+++ b/mono/io-layer/processes.c
@@ -1692,6 +1692,9 @@ gboolean CloseProcess(gpointer handle)
 	return CloseHandle (handle);
 }
 
+/*
+ * The caller owns the returned handle and must call CloseProcess () on it to clean it up.
+ */
 gpointer OpenProcess (guint32 req_access G_GNUC_UNUSED, gboolean inherit G_GNUC_UNUSED, guint32 pid)
 {
 	/* Find the process handle that corresponds to pid */
@@ -1731,8 +1734,7 @@ gpointer OpenProcess (guint32 req_access G_GNUC_UNUSED, gboolean inherit G_GNUC_
 		}
 	}
 
-	_wapi_handle_ref (handle);
-	
+	/* _wapi_search_handle () already added a ref */
 	return(handle);
 }
 
diff --git a/mono/metadata/ChangeLog b/mono/metadata/ChangeLog
index 82af2ee..5a24950 100644
--- a/mono/metadata/ChangeLog
+++ b/mono/metadata/ChangeLog
@@ -1,3 +1,251 @@
+2011-12-16  Rodrigo Kumpera  <kumpera at gmail.com>
+
+	Fix sgen
+
+2011-12-09  Jeffrey Stedfast  <jeff at xamarin.com>
+
+	[GetTimeZoneData icall] Fixed logic for zones where there is only
+	a start date
+
+	Thanks to Kirill for this patch.
+
+	Bug #2223.
+
+2011-12-08  Rodrigo Kumpera  <kumpera at gmail.com>
+
+	Fix another case where bridge would not be triggered.
+
+2011-12-07  Rodrigo Kumpera  <kumpera at gmail.com>
+
+	Fix severe breakage of sgen bridge code. 2nd and 3rd step where
+	not been called anymore.
+
+2011-12-07  Rodrigo Kumpera  <kumpera at gmail.com>
+
+	* sgen-bridge.c: * sgen-gc.c: After we split bridge processing in
+	two, one step with world stopped and another with world running,
+	we introduced the following regression:
+
+	A minor collection starts and find an young bridge object ready to
+	be processed. Major heap overflows and a major GC is triggered.
+	The object mentioned above will remain collectible and will be
+	queued for processing again. Since we do the first step in
+	finish_gray_stack, it will be done twice in the above scenario.
+	This will cause an assertion due to duplicate entries in the
+	hashtable.
+
+	The solution is to split the step that is performed with world
+	stopped into another two. One that happens during collections,
+	that can be done multiple times per duty cycle and another one
+	that is done only once before we restart the world.
+
+	This split has the minor advantage of reducing duplicated work for
+	the dfs1 step. Nothing big as this is one of the fastest steps.
+
+2011-12-07  Rodrigo Kumpera  <kumpera at gmail.com>
+
+	Remove some dead code
+
+2011-12-06  Rodrigo Kumpera  <kumpera at gmail.com>
+
+	* domain.c: Use mono-tls for the current domain variable. Sgen
+	depends on this so it has to be lock free and the io-layer version
+	is not.
+
+	Fixes bxc #2326
+
+2011-12-06  Rodrigo Kumpera  <kumpera at gmail.com>
+
+	Move current thread to use mono-tls.
+
+2011-12-01  Paolo Molaro  <lupus at oddwiz.org>
+
+	Fixed complex value type scan (xmarin bug#228).
+
+2011-11-24  Zoltan Varga  <vargaz at gmail.com>
+
+	Save the stack space used by arguments into MonoJitInfo to avoid
+	calling mono_arch_get_arg_info () during stack walking, since it
+	is not signal safe. Fixes #2190.
+
+2011-11-23  Rodrigo Kumpera  <kumpera at gmail.com>
+
+	* sgen-cardtable.c (sgen_card_table_mark_range): The number of
+	pages to be marked must be correctly calculated to avoid the case
+	when the in-card offset of the start address is bigger than of the
+	end address and cause the last card to be skipped.
+
+	Fixes #1917
+
+2011-11-22  Zoltan Varga  <vargaz at gmail.com>
+
+	Fix a crash introduced by
+	64d35e3940f7b0e1839c1906855c29862e6ab8c1. Fixes #2150.
+
+2011-11-22  Rodrigo Kumpera  <kumpera at gmail.com>
+
+	* sgen-gc.c (mark_ephemerons_in_range): All ephemeron arrays must
+	be scanned during a nursery collection since we ignore them during
+	remset processing for a good reason.
+
+	In the future we should use cardtable information to avoid
+	scanning the whole thing.
+
+	Fixes bxc #1175.
+
+2011-11-20  Zoltan Varga  <vargaz at gmail.com>
+
+	Free debug info for dynamic methods by storing it in malloc-ed
+	memory instead of the normal debugger tables. Fixes #731579.
+
+2011-11-15  Rodrigo Kumpera  <kumpera at gmail.com>
+
+	Add JIT counters to the local set of counters we support.
+
+2011-11-04  Zoltan Varga  <vargaz at gmail.com>
+
+	Fix a crash if a profiler is not found. Fixes #1855.
+
+2011-11-03  Rodrigo Kumpera  <kumpera at gmail.com>
+
+	Implement the icalls needed by the new mobile mmap code.
+
+2011-11-02  alexrp  <xtzgzorex at gmail.com>
+
+	Fix call to mono_sgen_gc_unlock () in mono_gc_toggleref_add ().
+
+2011-10-26  Rodrigo Kumpera  <kumpera at gmail.com>
+
+	* sgen-toggleref.c: GC backed toggleref machinery. This enables
+	embedders to support toggleref style of external memory management
+	without hooking up to the host retain/release machinery.
+
+	The API export two entry points. The first let the caller register
+	a callback with sgen that decides the state of a given object, by
+	probably inspecting its native state. The second allows
+	registration of objects with the toggleref machinery.
+
+	The idea of toggleref is that we keep an external reference to an
+	object and it can be either a strong or weak reference. We use a
+	weak reference when the external peer has no interest into the
+	object and a strong otherwise.
+
+2011-10-26  Rodrigo Kumpera  <kumpera at gmail.com>
+
+	Export a bunch of sgen functions for internal usage.
+
+2011-10-13  Rolf Bjarne Kvinge  <rolf at xamarin.com>
+
+	Profiler: add support embedded profilers whose entry point ends
+	with _<profiler name>.
+
+2011-10-22  Miguel de Icaza  <miguel at gnome.org>
+
+	Patch from Mario Kosmiskas for Bug 1460: add support for
+	Path.GetFileName to work with MONO_IOMAP
+
+2011-10-19  Marek Safar  <marek.safar at gmail.com>
+
+	Fix VolatileRead(uint&), VolatileWrite(uint&,uint) to use correct
+	word size
+
+2011-09-29  Zoltan Varga  <vargaz at gmail.com>
+
+	Avoid a crash if mono_debug_open_image_from_memory is called
+	without --debug. Fixes #1093.
+
+2011-09-26  Rodrigo Kumpera  <kumpera at gmail.com>
+
+	* sgen-bridge.c: Bridge processing must be split in two steps
+	because the object scanning step must be done with world stop and
+	before we copy the finalizable objects and the ones pointed by
+	them.
+
+2011-09-26  Rodrigo Kumpera  <kumpera at gmail.com>
+
+	* sgen-gc.c (finish_gray_stack): We must process ephemerons before
+	we check for non track weak refs to make sure we mark those values
+	whose only root are their keys.
+
+2011-06-23  Mark Probst  <mark.probst at gmail.com>
+
+	[sgen] Do the bridge callback after the world has been restarted.
+
+	Conflicts:
+
+	mono/metadata/sgen-gc.c
+
+2011-09-25  Gonzalo Paniagua Javier  <gonzalo.mono at gmail.com>
+
+	Create the first tp thread right away.
+
+	Avoid 500ms delay. Fixes Xamarin bug #1036.
+
+2011-09-19  Miguel de Icaza  <miguel at gnome.org>
+
+	Fix my profiler loader.
+
+	This is what happens when you test on a pre-configured environment
+	that already worked fine. This depended on a function that was
+	never called so we ended up probing for paths on NULL (repeating
+	the same process twice) instead of loading the profiler from the
+	installation directory.
+
+2011-09-13  Rodrigo Kumpera  <kumpera at gmail.com>
+
+	Avoid duplicates in the SSC xrefs.
+
+2011-09-13  Rodrigo Kumpera  <kumpera at gmail.com>
+
+	Add logging to sgen-bridge. Log times and sizes.
+
+2011-09-07  Miguel de Icaza  <miguel at gnome.org>
+
+	Fallback: load profiler from the Mono default path. This in
+	particular allows users to run mono --profiler=log foo.exe without
+	having to set anuy environment variables
+
+2011-09-06  Rodrigo Kumpera  <kumpera at gmail.com>
+
+	Improve exception message.
+
+2011-09-06  Rodrigo Kumpera  <kumpera at gmail.com>
+
+	Add collection logging to sgen.
+
+2011-09-05  Gonzalo Paniagua Javier  <gonzalo.mono at gmail.com>
+
+	Display more debugging info when epoll fails
+
+2011-09-05  Gonzalo Paniagua Javier  <gonzalo.mono at gmail.com>
+
+	Fallback to poll() if epoll_create() fails
+
+	From a patch by Zoltan in bug #705190.
+
+2011-02-22  Mark Probst  <mark.probst at gmail.com>
+
+	[sgen] Break tracking weak references as early as possible.
+
+	Our tracking references code aimed to transform tracking
+	references into normal weak references the first time their
+	targets became unreachable. It was implemented incorrectly though,
+	and is not the right thing to do in the first place anyway,
+	because tracking references have to keep tracking if the target is
+	re-registered for finalization. The incorrect implementation
+	inadvertently handled re-registration correctly, but it kept the
+	reference intact for one garbage collection cycle too many.
+
+2011-09-01  Rodrigo Kumpera  <kumpera at gmail.com>
+
+	Handle finalizable objects pointed by bridge objects. (cont...)
+
+2011-08-28  Zoltan Varga  <vargaz at gmail.com>
+
+	Allow pointers to structures to be passed in pinvoke, MS seems to
+	allow this at least in some cases. Fixes bxc #158. This partially
+	reverts c4d9097c5719bc9455593a47d8d7d2585f1219ec.
+
 2011-08-19  Rodrigo Kumpera  <kumpera at gmail.com>
 
 	Fix sgen-arm-mach. It requires some #define juggling. .
diff --git a/mono/metadata/Makefile.am b/mono/metadata/Makefile.am
index a4ab008..385237b 100644
--- a/mono/metadata/Makefile.am
+++ b/mono/metadata/Makefile.am
@@ -199,6 +199,8 @@ libmonoruntime_la_SOURCES = \
 	sgen-protocol.c \
 	sgen-bridge.c		\
 	sgen-bridge.h		\
+	sgen-toggleref.c		\
+	sgen-toggleref.h		\
 	sgen-gc.h		\
 	sgen-archdep.h		\
 	sgen-cardtable.h	\
diff --git a/mono/metadata/Makefile.in b/mono/metadata/Makefile.in
index 47891ff..a51a1b6 100644
--- a/mono/metadata/Makefile.in
+++ b/mono/metadata/Makefile.in
@@ -84,13 +84,13 @@ am__libmonoruntime_static_la_SOURCES_DIST = console-unix.c \
 	sgen-internal.c sgen-marksweep.c sgen-marksweep-fixed.c \
 	sgen-marksweep-par.c sgen-marksweep-fixed-par.c \
 	sgen-major-copying.c sgen-los.c sgen-protocol.c sgen-bridge.c \
-	sgen-bridge.h sgen-gc.h sgen-archdep.h sgen-cardtable.h \
-	sgen-major-copy-object.h sgen-major-scan-object.h \
-	sgen-protocol.h sgen-scan-object.h string-icalls.c \
-	string-icalls.h sysmath.h sysmath.c tabledefs.h threads.c \
-	threads-types.h threadpool.c threadpool.h \
-	threadpool-internals.h verify.c verify-internals.h \
-	wrapper-types.h
+	sgen-bridge.h sgen-toggleref.c sgen-toggleref.h sgen-gc.h \
+	sgen-archdep.h sgen-cardtable.h sgen-major-copy-object.h \
+	sgen-major-scan-object.h sgen-protocol.h sgen-scan-object.h \
+	string-icalls.c string-icalls.h sysmath.h sysmath.c \
+	tabledefs.h threads.c threads-types.h threadpool.c \
+	threadpool.h threadpool-internals.h verify.c \
+	verify-internals.h wrapper-types.h
 @HOST_WIN32_FALSE at am__objects_1 =  \
 @HOST_WIN32_FALSE@	libmonoruntime_static_la-console-unix.lo
 @HOST_WIN32_TRUE at am__objects_2 =  \
@@ -159,6 +159,7 @@ am__objects_4 = $(am__objects_3) libmonoruntime_static_la-appdomain.lo \
 	libmonoruntime_static_la-sgen-los.lo \
 	libmonoruntime_static_la-sgen-protocol.lo \
 	libmonoruntime_static_la-sgen-bridge.lo \
+	libmonoruntime_static_la-sgen-toggleref.lo \
 	libmonoruntime_static_la-string-icalls.lo \
 	libmonoruntime_static_la-sysmath.lo \
 	libmonoruntime_static_la-threads.lo \
@@ -200,13 +201,13 @@ am__libmonoruntime_la_SOURCES_DIST = console-unix.c console-win32.c \
 	sgen-internal.c sgen-marksweep.c sgen-marksweep-fixed.c \
 	sgen-marksweep-par.c sgen-marksweep-fixed-par.c \
 	sgen-major-copying.c sgen-los.c sgen-protocol.c sgen-bridge.c \
-	sgen-bridge.h sgen-gc.h sgen-archdep.h sgen-cardtable.h \
-	sgen-major-copy-object.h sgen-major-scan-object.h \
-	sgen-protocol.h sgen-scan-object.h string-icalls.c \
-	string-icalls.h sysmath.h sysmath.c tabledefs.h threads.c \
-	threads-types.h threadpool.c threadpool.h \
-	threadpool-internals.h verify.c verify-internals.h \
-	wrapper-types.h
+	sgen-bridge.h sgen-toggleref.c sgen-toggleref.h sgen-gc.h \
+	sgen-archdep.h sgen-cardtable.h sgen-major-copy-object.h \
+	sgen-major-scan-object.h sgen-protocol.h sgen-scan-object.h \
+	string-icalls.c string-icalls.h sysmath.h sysmath.c \
+	tabledefs.h threads.c threads-types.h threadpool.c \
+	threadpool.h threadpool-internals.h verify.c \
+	verify-internals.h wrapper-types.h
 @HOST_WIN32_FALSE at am__objects_5 = libmonoruntime_la-console-unix.lo
 @HOST_WIN32_TRUE at am__objects_6 = libmonoruntime_la-console-win32.lo
 @HOST_WIN32_FALSE at am__objects_7 = $(am__objects_5)
@@ -254,6 +255,7 @@ am_libmonoruntime_la_OBJECTS = $(am__objects_7) \
 	libmonoruntime_la-sgen-los.lo \
 	libmonoruntime_la-sgen-protocol.lo \
 	libmonoruntime_la-sgen-bridge.lo \
+	libmonoruntime_la-sgen-toggleref.lo \
 	libmonoruntime_la-string-icalls.lo \
 	libmonoruntime_la-sysmath.lo libmonoruntime_la-threads.lo \
 	libmonoruntime_la-threadpool.lo libmonoruntime_la-verify.lo
@@ -292,13 +294,13 @@ am__libmonoruntimemoon_la_SOURCES_DIST = console-unix.c \
 	sgen-internal.c sgen-marksweep.c sgen-marksweep-fixed.c \
 	sgen-marksweep-par.c sgen-marksweep-fixed-par.c \
 	sgen-major-copying.c sgen-los.c sgen-protocol.c sgen-bridge.c \
-	sgen-bridge.h sgen-gc.h sgen-archdep.h sgen-cardtable.h \
-	sgen-major-copy-object.h sgen-major-scan-object.h \
-	sgen-protocol.h sgen-scan-object.h string-icalls.c \
-	string-icalls.h sysmath.h sysmath.c tabledefs.h threads.c \
-	threads-types.h threadpool.c threadpool.h \
-	threadpool-internals.h verify.c verify-internals.h \
-	wrapper-types.h
+	sgen-bridge.h sgen-toggleref.c sgen-toggleref.h sgen-gc.h \
+	sgen-archdep.h sgen-cardtable.h sgen-major-copy-object.h \
+	sgen-major-scan-object.h sgen-protocol.h sgen-scan-object.h \
+	string-icalls.c string-icalls.h sysmath.h sysmath.c \
+	tabledefs.h threads.c threads-types.h threadpool.c \
+	threadpool.h threadpool-internals.h verify.c \
+	verify-internals.h wrapper-types.h
 @HOST_WIN32_FALSE at am__objects_8 =  \
 @HOST_WIN32_FALSE@	libmonoruntimemoon_la-console-unix.lo
 @HOST_WIN32_TRUE at am__objects_9 =  \
@@ -364,6 +366,7 @@ am__objects_11 = $(am__objects_10) libmonoruntimemoon_la-appdomain.lo \
 	libmonoruntimemoon_la-sgen-los.lo \
 	libmonoruntimemoon_la-sgen-protocol.lo \
 	libmonoruntimemoon_la-sgen-bridge.lo \
+	libmonoruntimemoon_la-sgen-toggleref.lo \
 	libmonoruntimemoon_la-string-icalls.lo \
 	libmonoruntimemoon_la-sysmath.lo \
 	libmonoruntimemoon_la-threads.lo \
@@ -405,13 +408,13 @@ am__libmonoruntimesgen_static_la_SOURCES_DIST = console-unix.c \
 	sgen-internal.c sgen-marksweep.c sgen-marksweep-fixed.c \
 	sgen-marksweep-par.c sgen-marksweep-fixed-par.c \
 	sgen-major-copying.c sgen-los.c sgen-protocol.c sgen-bridge.c \
-	sgen-bridge.h sgen-gc.h sgen-archdep.h sgen-cardtable.h \
-	sgen-major-copy-object.h sgen-major-scan-object.h \
-	sgen-protocol.h sgen-scan-object.h string-icalls.c \
-	string-icalls.h sysmath.h sysmath.c tabledefs.h threads.c \
-	threads-types.h threadpool.c threadpool.h \
-	threadpool-internals.h verify.c verify-internals.h \
-	wrapper-types.h
+	sgen-bridge.h sgen-toggleref.c sgen-toggleref.h sgen-gc.h \
+	sgen-archdep.h sgen-cardtable.h sgen-major-copy-object.h \
+	sgen-major-scan-object.h sgen-protocol.h sgen-scan-object.h \
+	string-icalls.c string-icalls.h sysmath.h sysmath.c \
+	tabledefs.h threads.c threads-types.h threadpool.c \
+	threadpool.h threadpool-internals.h verify.c \
+	verify-internals.h wrapper-types.h
 @HOST_WIN32_FALSE at am__objects_12 = libmonoruntimesgen_static_la-console-unix.lo
 @HOST_WIN32_TRUE at am__objects_13 = libmonoruntimesgen_static_la-console-win32.lo
 @HOST_WIN32_FALSE at am__objects_14 = $(am__objects_12)
@@ -479,6 +482,7 @@ am__objects_15 = $(am__objects_14) \
 	libmonoruntimesgen_static_la-sgen-los.lo \
 	libmonoruntimesgen_static_la-sgen-protocol.lo \
 	libmonoruntimesgen_static_la-sgen-bridge.lo \
+	libmonoruntimesgen_static_la-sgen-toggleref.lo \
 	libmonoruntimesgen_static_la-string-icalls.lo \
 	libmonoruntimesgen_static_la-sysmath.lo \
 	libmonoruntimesgen_static_la-threads.lo \
@@ -521,13 +525,13 @@ am__libmonoruntimesgen_la_SOURCES_DIST = console-unix.c \
 	sgen-internal.c sgen-marksweep.c sgen-marksweep-fixed.c \
 	sgen-marksweep-par.c sgen-marksweep-fixed-par.c \
 	sgen-major-copying.c sgen-los.c sgen-protocol.c sgen-bridge.c \
-	sgen-bridge.h sgen-gc.h sgen-archdep.h sgen-cardtable.h \
-	sgen-major-copy-object.h sgen-major-scan-object.h \
-	sgen-protocol.h sgen-scan-object.h string-icalls.c \
-	string-icalls.h sysmath.h sysmath.c tabledefs.h threads.c \
-	threads-types.h threadpool.c threadpool.h \
-	threadpool-internals.h verify.c verify-internals.h \
-	wrapper-types.h
+	sgen-bridge.h sgen-toggleref.c sgen-toggleref.h sgen-gc.h \
+	sgen-archdep.h sgen-cardtable.h sgen-major-copy-object.h \
+	sgen-major-scan-object.h sgen-protocol.h sgen-scan-object.h \
+	string-icalls.c string-icalls.h sysmath.h sysmath.c \
+	tabledefs.h threads.c threads-types.h threadpool.c \
+	threadpool.h threadpool-internals.h verify.c \
+	verify-internals.h wrapper-types.h
 @HOST_WIN32_FALSE at am__objects_16 =  \
 @HOST_WIN32_FALSE@	libmonoruntimesgen_la-console-unix.lo
 @HOST_WIN32_TRUE at am__objects_17 =  \
@@ -593,6 +597,7 @@ am__objects_19 = $(am__objects_18) libmonoruntimesgen_la-appdomain.lo \
 	libmonoruntimesgen_la-sgen-los.lo \
 	libmonoruntimesgen_la-sgen-protocol.lo \
 	libmonoruntimesgen_la-sgen-bridge.lo \
+	libmonoruntimesgen_la-sgen-toggleref.lo \
 	libmonoruntimesgen_la-string-icalls.lo \
 	libmonoruntimesgen_la-sysmath.lo \
 	libmonoruntimesgen_la-threads.lo \
@@ -1019,6 +1024,8 @@ libmonoruntime_la_SOURCES = \
 	sgen-protocol.c \
 	sgen-bridge.c		\
 	sgen-bridge.h		\
+	sgen-toggleref.c		\
+	sgen-toggleref.h		\
 	sgen-gc.h		\
 	sgen-archdep.h		\
 	sgen-cardtable.h	\
@@ -1104,9 +1111,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign mono/metadata/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu mono/metadata/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign mono/metadata/Makefile
+	  $(AUTOMAKE) --gnu mono/metadata/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -1260,6 +1267,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libmonoruntime_la-sgen-os-mach.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libmonoruntime_la-sgen-os-posix.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libmonoruntime_la-sgen-protocol.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libmonoruntime_la-sgen-toggleref.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libmonoruntime_la-socket-io.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libmonoruntime_la-string-icalls.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libmonoruntime_la-sysmath.Plo at am__quote@
@@ -1329,6 +1337,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libmonoruntime_static_la-sgen-os-mach.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libmonoruntime_static_la-sgen-os-posix.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libmonoruntime_static_la-sgen-protocol.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libmonoruntime_static_la-sgen-toggleref.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libmonoruntime_static_la-socket-io.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libmonoruntime_static_la-string-icalls.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libmonoruntime_static_la-sysmath.Plo at am__quote@
@@ -1398,6 +1407,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libmonoruntimemoon_la-sgen-os-mach.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libmonoruntimemoon_la-sgen-os-posix.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libmonoruntimemoon_la-sgen-protocol.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libmonoruntimemoon_la-sgen-toggleref.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libmonoruntimemoon_la-socket-io.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libmonoruntimemoon_la-string-icalls.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libmonoruntimemoon_la-sysmath.Plo at am__quote@
@@ -1467,6 +1477,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libmonoruntimesgen_la-sgen-os-mach.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libmonoruntimesgen_la-sgen-os-posix.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libmonoruntimesgen_la-sgen-protocol.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libmonoruntimesgen_la-sgen-toggleref.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libmonoruntimesgen_la-socket-io.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libmonoruntimesgen_la-string-icalls.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libmonoruntimesgen_la-sysmath.Plo at am__quote@
@@ -1536,6 +1547,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libmonoruntimesgen_static_la-sgen-os-mach.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libmonoruntimesgen_static_la-sgen-os-posix.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libmonoruntimesgen_static_la-sgen-protocol.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libmonoruntimesgen_static_la-sgen-toggleref.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libmonoruntimesgen_static_la-socket-io.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libmonoruntimesgen_static_la-string-icalls.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libmonoruntimesgen_static_la-sysmath.Plo at am__quote@
@@ -2013,6 +2025,13 @@ libmonoruntime_static_la-sgen-bridge.lo: sgen-bridge.c
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonoruntime_static_la_CFLAGS) $(CFLAGS) -c -o libmonoruntime_static_la-sgen-bridge.lo `test -f 'sgen-bridge.c' || echo '$(srcdir)/'`sgen-bridge.c
 
+libmonoruntime_static_la-sgen-toggleref.lo: sgen-toggleref.c
+ at am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonoruntime_static_la_CFLAGS) $(CFLAGS) -MT libmonoruntime_static_la-sgen-toggleref.lo -MD -MP -MF $(DEPDIR)/libmonoruntime_static_la-sgen-toggleref.Tpo -c -o libmonoruntime_static_la-sgen-toggleref.lo `test -f 'sgen-toggleref.c' || echo '$(srcdir)/'`sgen-toggleref.c
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libmonoruntime_static_la-sgen-toggleref.Tpo $(DEPDIR)/libmonoruntime_static_la-sgen-toggleref.Plo
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='sgen-toggleref.c' object='libmonoruntime_static_la-sgen-toggleref.lo' libtool=yes @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonoruntime_static_la_CFLAGS) $(CFLAGS) -c -o libmonoruntime_static_la-sgen-toggleref.lo `test -f 'sgen-toggleref.c' || echo '$(srcdir)/'`sgen-toggleref.c
+
 libmonoruntime_static_la-string-icalls.lo: string-icalls.c
 @am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonoruntime_static_la_CFLAGS) $(CFLAGS) -MT libmonoruntime_static_la-string-icalls.lo -MD -MP -MF $(DEPDIR)/libmonoruntime_static_la-string-icalls.Tpo -c -o libmonoruntime_static_la-string-icalls.lo `test -f 'string-icalls.c' || echo '$(srcdir)/'`string-icalls.c
 @am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libmonoruntime_static_la-string-icalls.Tpo $(DEPDIR)/libmonoruntime_static_la-string-icalls.Plo
@@ -2496,6 +2515,13 @@ libmonoruntime_la-sgen-bridge.lo: sgen-bridge.c
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonoruntime_la_CFLAGS) $(CFLAGS) -c -o libmonoruntime_la-sgen-bridge.lo `test -f 'sgen-bridge.c' || echo '$(srcdir)/'`sgen-bridge.c
 
+libmonoruntime_la-sgen-toggleref.lo: sgen-toggleref.c
+ at am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonoruntime_la_CFLAGS) $(CFLAGS) -MT libmonoruntime_la-sgen-toggleref.lo -MD -MP -MF $(DEPDIR)/libmonoruntime_la-sgen-toggleref.Tpo -c -o libmonoruntime_la-sgen-toggleref.lo `test -f 'sgen-toggleref.c' || echo '$(srcdir)/'`sgen-toggleref.c
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libmonoruntime_la-sgen-toggleref.Tpo $(DEPDIR)/libmonoruntime_la-sgen-toggleref.Plo
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='sgen-toggleref.c' object='libmonoruntime_la-sgen-toggleref.lo' libtool=yes @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonoruntime_la_CFLAGS) $(CFLAGS) -c -o libmonoruntime_la-sgen-toggleref.lo `test -f 'sgen-toggleref.c' || echo '$(srcdir)/'`sgen-toggleref.c
+
 libmonoruntime_la-string-icalls.lo: string-icalls.c
 @am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonoruntime_la_CFLAGS) $(CFLAGS) -MT libmonoruntime_la-string-icalls.lo -MD -MP -MF $(DEPDIR)/libmonoruntime_la-string-icalls.Tpo -c -o libmonoruntime_la-string-icalls.lo `test -f 'string-icalls.c' || echo '$(srcdir)/'`string-icalls.c
 @am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libmonoruntime_la-string-icalls.Tpo $(DEPDIR)/libmonoruntime_la-string-icalls.Plo
@@ -2979,6 +3005,13 @@ libmonoruntimemoon_la-sgen-bridge.lo: sgen-bridge.c
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonoruntimemoon_la_CFLAGS) $(CFLAGS) -c -o libmonoruntimemoon_la-sgen-bridge.lo `test -f 'sgen-bridge.c' || echo '$(srcdir)/'`sgen-bridge.c
 
+libmonoruntimemoon_la-sgen-toggleref.lo: sgen-toggleref.c
+ at am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonoruntimemoon_la_CFLAGS) $(CFLAGS) -MT libmonoruntimemoon_la-sgen-toggleref.lo -MD -MP -MF $(DEPDIR)/libmonoruntimemoon_la-sgen-toggleref.Tpo -c -o libmonoruntimemoon_la-sgen-toggleref.lo `test -f 'sgen-toggleref.c' || echo '$(srcdir)/'`sgen-toggleref.c
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libmonoruntimemoon_la-sgen-toggleref.Tpo $(DEPDIR)/libmonoruntimemoon_la-sgen-toggleref.Plo
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='sgen-toggleref.c' object='libmonoruntimemoon_la-sgen-toggleref.lo' libtool=yes @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonoruntimemoon_la_CFLAGS) $(CFLAGS) -c -o libmonoruntimemoon_la-sgen-toggleref.lo `test -f 'sgen-toggleref.c' || echo '$(srcdir)/'`sgen-toggleref.c
+
 libmonoruntimemoon_la-string-icalls.lo: string-icalls.c
 @am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonoruntimemoon_la_CFLAGS) $(CFLAGS) -MT libmonoruntimemoon_la-string-icalls.lo -MD -MP -MF $(DEPDIR)/libmonoruntimemoon_la-string-icalls.Tpo -c -o libmonoruntimemoon_la-string-icalls.lo `test -f 'string-icalls.c' || echo '$(srcdir)/'`string-icalls.c
 @am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libmonoruntimemoon_la-string-icalls.Tpo $(DEPDIR)/libmonoruntimemoon_la-string-icalls.Plo
@@ -3462,6 +3495,13 @@ libmonoruntimesgen_static_la-sgen-bridge.lo: sgen-bridge.c
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonoruntimesgen_static_la_CFLAGS) $(CFLAGS) -c -o libmonoruntimesgen_static_la-sgen-bridge.lo `test -f 'sgen-bridge.c' || echo '$(srcdir)/'`sgen-bridge.c
 
+libmonoruntimesgen_static_la-sgen-toggleref.lo: sgen-toggleref.c
+ at am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonoruntimesgen_static_la_CFLAGS) $(CFLAGS) -MT libmonoruntimesgen_static_la-sgen-toggleref.lo -MD -MP -MF $(DEPDIR)/libmonoruntimesgen_static_la-sgen-toggleref.Tpo -c -o libmonoruntimesgen_static_la-sgen-toggleref.lo `test -f 'sgen-toggleref.c' || echo '$(srcdir)/'`sgen-toggleref.c
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libmonoruntimesgen_static_la-sgen-toggleref.Tpo $(DEPDIR)/libmonoruntimesgen_static_la-sgen-toggleref.Plo
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='sgen-toggleref.c' object='libmonoruntimesgen_static_la-sgen-toggleref.lo' libtool=yes @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonoruntimesgen_static_la_CFLAGS) $(CFLAGS) -c -o libmonoruntimesgen_static_la-sgen-toggleref.lo `test -f 'sgen-toggleref.c' || echo '$(srcdir)/'`sgen-toggleref.c
+
 libmonoruntimesgen_static_la-string-icalls.lo: string-icalls.c
 @am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonoruntimesgen_static_la_CFLAGS) $(CFLAGS) -MT libmonoruntimesgen_static_la-string-icalls.lo -MD -MP -MF $(DEPDIR)/libmonoruntimesgen_static_la-string-icalls.Tpo -c -o libmonoruntimesgen_static_la-string-icalls.lo `test -f 'string-icalls.c' || echo '$(srcdir)/'`string-icalls.c
 @am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libmonoruntimesgen_static_la-string-icalls.Tpo $(DEPDIR)/libmonoruntimesgen_static_la-string-icalls.Plo
@@ -3945,6 +3985,13 @@ libmonoruntimesgen_la-sgen-bridge.lo: sgen-bridge.c
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonoruntimesgen_la_CFLAGS) $(CFLAGS) -c -o libmonoruntimesgen_la-sgen-bridge.lo `test -f 'sgen-bridge.c' || echo '$(srcdir)/'`sgen-bridge.c
 
+libmonoruntimesgen_la-sgen-toggleref.lo: sgen-toggleref.c
+ at am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonoruntimesgen_la_CFLAGS) $(CFLAGS) -MT libmonoruntimesgen_la-sgen-toggleref.lo -MD -MP -MF $(DEPDIR)/libmonoruntimesgen_la-sgen-toggleref.Tpo -c -o libmonoruntimesgen_la-sgen-toggleref.lo `test -f 'sgen-toggleref.c' || echo '$(srcdir)/'`sgen-toggleref.c
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libmonoruntimesgen_la-sgen-toggleref.Tpo $(DEPDIR)/libmonoruntimesgen_la-sgen-toggleref.Plo
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='sgen-toggleref.c' object='libmonoruntimesgen_la-sgen-toggleref.lo' libtool=yes @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonoruntimesgen_la_CFLAGS) $(CFLAGS) -c -o libmonoruntimesgen_la-sgen-toggleref.lo `test -f 'sgen-toggleref.c' || echo '$(srcdir)/'`sgen-toggleref.c
+
 libmonoruntimesgen_la-string-icalls.lo: string-icalls.c
 @am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonoruntimesgen_la_CFLAGS) $(CFLAGS) -MT libmonoruntimesgen_la-string-icalls.lo -MD -MP -MF $(DEPDIR)/libmonoruntimesgen_la-string-icalls.Tpo -c -o libmonoruntimesgen_la-string-icalls.lo `test -f 'string-icalls.c' || echo '$(srcdir)/'`string-icalls.c
 @am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libmonoruntimesgen_la-string-icalls.Tpo $(DEPDIR)/libmonoruntimesgen_la-string-icalls.Plo
diff --git a/mono/metadata/domain-internals.h b/mono/metadata/domain-internals.h
index e10d70c..701a5ee 100644
--- a/mono/metadata/domain-internals.h
+++ b/mono/metadata/domain-internals.h
@@ -142,6 +142,11 @@ typedef struct
 	MonoTryBlockHoleJitInfo holes [MONO_ZERO_LEN_ARRAY];
 } MonoTryBlockHoleTableJitInfo;
 
+typedef struct
+{
+	guint32 stack_size;
+} MonoArchEHJitInfo;
+
 struct _MonoJitInfo {
 	/* NOTE: These first two elements (method and
 	   next_jit_code_hash) must be in the same order and at the
@@ -165,6 +170,7 @@ struct _MonoJitInfo {
 	gboolean    cas_method_permitonly:1;
 	gboolean    has_generic_jit_info:1;
 	gboolean    has_try_block_holes:1;
+	gboolean    has_arch_eh_info:1;
 	gboolean    from_aot:1;
 	gboolean    from_llvm:1;
 
@@ -174,6 +180,7 @@ struct _MonoJitInfo {
 	MonoJitExceptionInfo clauses [MONO_ZERO_LEN_ARRAY];
 	/* There is an optional MonoGenericJitInfo after the clauses */
 	/* There is an optional MonoTryBlockHoleTableJitInfo after MonoGenericJitInfo clauses*/
+	/* There is an optional MonoArchEHJitInfo after MonoTryBlockHoleTableJitInfo */
 };
 
 #define MONO_SIZEOF_JIT_INFO (offsetof (struct _MonoJitInfo, clauses))
@@ -441,6 +448,9 @@ mono_domain_set_internal_with_options (MonoDomain *domain, gboolean migrate_exce
 MonoTryBlockHoleTableJitInfo*
 mono_jit_info_get_try_block_hole_table_info (MonoJitInfo *ji) MONO_INTERNAL;
 
+MonoArchEHJitInfo*
+mono_jit_info_get_arch_eh_info (MonoJitInfo *ji) MONO_INTERNAL;
+
 /* 
  * Installs a new function which is used to return a MonoJitInfo for a method inside
  * an AOT module.
diff --git a/mono/metadata/domain.c b/mono/metadata/domain.c
index e1fb718..d425c59 100644
--- a/mono/metadata/domain.c
+++ b/mono/metadata/domain.c
@@ -21,6 +21,7 @@
 #include <mono/utils/mono-logger-internal.h>
 #include <mono/utils/mono-membar.h>
 #include <mono/utils/mono-counters.h>
+#include <mono/utils/mono-tls.h>
 #include <mono/metadata/object.h>
 #include <mono/metadata/object-internals.h>
 #include <mono/metadata/domain-internals.h>
@@ -44,7 +45,7 @@
  * or the other (we used to do it because tls slots were GC-tracked,
  * but we can't depend on this).
  */
-static guint32 appdomain_thread_id = -1;
+static MonoNativeTlsKey appdomain_thread_id;
 
 /* 
  * Avoid calling TlsSetValue () if possible, since in the io-layer, it acquires
@@ -67,14 +68,14 @@ static __thread MonoDomain * tls_appdomain MONO_TLS_FAST;
 #else
 #define SET_APPDOMAIN(x) do { \
 	tls_appdomain = x; \
-	TlsSetValue (appdomain_thread_id, x); \
+	mono_native_tls_set_value (appdomain_thread_id, x); \
 } while (FALSE)
 #endif
 
 #else /* !HAVE_KW_THREAD */
 
-#define GET_APPDOMAIN() ((MonoDomain *)TlsGetValue (appdomain_thread_id))
-#define SET_APPDOMAIN(x) TlsSetValue (appdomain_thread_id, x);
+#define GET_APPDOMAIN() ((MonoDomain *)mono_native_tls_get_value (appdomain_thread_id))
+#define SET_APPDOMAIN(x) mono_native_tls_set_value (appdomain_thread_id, x);
 
 #endif
 
@@ -157,8 +158,8 @@ get_runtime_by_version (const char *version);
 static MonoImage*
 mono_jit_info_find_aot_module (guint8* addr);
 
-guint32
-mono_domain_get_tls_key (void)
+MonoNativeTlsKey
+mono_domain_get_native_tls_key (void)
 {
 	return appdomain_thread_id;
 }
@@ -1033,6 +1034,22 @@ mono_jit_info_get_try_block_hole_table_info (MonoJitInfo *ji)
 		return NULL;
 	}
 }
+
+MonoArchEHJitInfo*
+mono_jit_info_get_arch_eh_info (MonoJitInfo *ji)
+{
+	if (ji->has_arch_eh_info) {
+		char *ptr = (char*)&ji->clauses [ji->num_clauses];
+		if (ji->has_generic_jit_info)
+			ptr += sizeof (MonoGenericJitInfo);
+		if (ji->has_try_block_holes)
+			ptr += sizeof (MonoTryBlockHoleTableJitInfo);
+		return (MonoArchEHJitInfo*)ptr;
+	} else {
+		return NULL;
+	}
+}
+
 void
 mono_install_create_domain_hook (MonoCreateDomainFunc func)
 {
@@ -1285,7 +1302,7 @@ mono_init_internal (const char *filename, const char *exe_filename, const char *
 
 	mono_gc_base_init ();
 
-	appdomain_thread_id = TlsAlloc ();
+	mono_native_tls_alloc (&appdomain_thread_id, NULL);
 
 	InitializeCriticalSection (&appdomains_mutex);
 
@@ -1750,7 +1767,7 @@ mono_cleanup (void)
 	mono_debug_cleanup ();
 	mono_metadata_cleanup ();
 
-	TlsFree (appdomain_thread_id);
+	mono_native_tls_free (appdomain_thread_id);
 	DeleteCriticalSection (&appdomains_mutex);
 
 	/*
diff --git a/mono/metadata/file-io.c b/mono/metadata/file-io.c
index e35680b..6f1f3c3 100644
--- a/mono/metadata/file-io.c
+++ b/mono/metadata/file-io.c
@@ -31,6 +31,7 @@
 #include <mono/metadata/appdomain.h>
 #include <mono/metadata/marshal.h>
 #include <mono/utils/strenc.h>
+#include <utils/mono-io-portability.h>
 
 #undef DEBUG
 
@@ -1107,7 +1108,10 @@ ves_icall_System_IO_MonoIO_get_AltDirectorySeparatorChar ()
 #if defined (TARGET_WIN32)
 	return (gunichar2) '/';	/* forward slash */
 #else
-	return (gunichar2) '/';	/* slash, same as DirectorySeparatorChar */
+	if (IS_PORTABILITY_SET)
+		return (gunichar2) '\\';	/* backslash */
+	else
+		return (gunichar2) '/';	/* forward slash */
 #endif
 }
 
@@ -1219,3 +1223,35 @@ void ves_icall_System_IO_MonoIO_Unlock (HANDLE handle, gint64 position,
 	}
 }
 
+//Support for io-layer free mmap'd files.
+
+#if (defined (__MACH__) && defined (TARGET_ARM)) || defined (TARGET_ANDROID)
+
+gint64
+mono_filesize_from_path (MonoString *string)
+{
+	struct stat buf;
+	gint64 res;
+	char *path = mono_string_to_utf8 (string);
+	
+	if (stat (path, &buf) == -1)
+		res = -1;
+	else
+		res = (gint64)buf.st_size;
+
+	g_free (path);
+	return res;
+}
+
+gint64
+mono_filesize_from_fd (int fd)
+{
+	struct stat buf;
+
+	if (fstat (fd, &buf) == -1)
+		return (gint64)-1;
+
+	return (gint64)buf.st_size;
+}
+
+#endif
diff --git a/mono/metadata/file-io.h b/mono/metadata/file-io.h
index 1ad78f6..f1951da 100644
--- a/mono/metadata/file-io.h
+++ b/mono/metadata/file-io.h
@@ -251,6 +251,12 @@ ves_icall_System_IO_MonoIO_ReplaceFile (MonoString *sourceFileName, MonoString *
 					MonoString *destinationBackupFileName, MonoBoolean ignoreMetadataErrors,
 					gint32 *error) MONO_INTERNAL;
 
+extern gint64
+mono_filesize_from_path (MonoString *path);
+
+extern gint64
+mono_filesize_from_fd (int fd);
+
 G_END_DECLS
 
 #endif /* _MONO_METADATA_FILEIO_H_ */
diff --git a/mono/metadata/icall-def.h b/mono/metadata/icall-def.h
index 5af43ff..5f2ade7 100644
--- a/mono/metadata/icall-def.h
+++ b/mono/metadata/icall-def.h
@@ -312,6 +312,13 @@ ICALL(INOW_1, "AddWatch", ves_icall_System_IO_InotifyWatcher_AddWatch)
 ICALL(INOW_2, "GetInotifyInstance", ves_icall_System_IO_InotifyWatcher_GetInotifyInstance)
 ICALL(INOW_3, "RemoveWatch", ves_icall_System_IO_InotifyWatcher_RemoveWatch)
 
+#if (defined (__MACH__) && defined (TARGET_ARM)) || defined (TARGET_ANDROID)
+ICALL_TYPE(MMAPIMPL, "System.IO.MemoryMappedFiles.MemoryMapImpl", MMAPIMPL_1)
+ICALL(MMAPIMPL_1, "mono_filesize_from_fd", mono_filesize_from_fd)
+ICALL(MMAPIMPL_2, "mono_filesize_from_path", mono_filesize_from_path)
+#endif
+
+
 ICALL_TYPE(MONOIO, "System.IO.MonoIO", MONOIO_1)
 ICALL(MONOIO_1, "Close(intptr,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_Close)
 #ifndef PLATFORM_RO_FS
@@ -887,7 +894,7 @@ ICALL(THREAD_31, "VolatileRead(long&)", ves_icall_System_Threading_Thread_Volati
 ICALL(THREAD_32, "VolatileRead(object&)", ves_icall_System_Threading_Thread_VolatileReadIntPtr)
 ICALL(THREAD_33, "VolatileRead(sbyte&)", ves_icall_System_Threading_Thread_VolatileRead1)
 ICALL(THREAD_34, "VolatileRead(single&)", ves_icall_System_Threading_Thread_VolatileRead4)
-ICALL(THREAD_35, "VolatileRead(uint&)", ves_icall_System_Threading_Thread_VolatileRead2)
+ICALL(THREAD_35, "VolatileRead(uint&)", ves_icall_System_Threading_Thread_VolatileRead4)
 ICALL(THREAD_36, "VolatileRead(uint16&)", ves_icall_System_Threading_Thread_VolatileRead2)
 ICALL(THREAD_37, "VolatileRead(uintptr&)", ves_icall_System_Threading_Thread_VolatileReadIntPtr)
 ICALL(THREAD_38, "VolatileRead(ulong&)", ves_icall_System_Threading_Thread_VolatileRead8)
@@ -900,7 +907,7 @@ ICALL(THREAD_44, "VolatileWrite(long&,long)", ves_icall_System_Threading_Thread_
 ICALL(THREAD_45, "VolatileWrite(object&,object)", ves_icall_System_Threading_Thread_VolatileWriteObject)
 ICALL(THREAD_46, "VolatileWrite(sbyte&,sbyte)", ves_icall_System_Threading_Thread_VolatileWrite1)
 ICALL(THREAD_47, "VolatileWrite(single&,single)", ves_icall_System_Threading_Thread_VolatileWrite4)
-ICALL(THREAD_48, "VolatileWrite(uint&,uint)", ves_icall_System_Threading_Thread_VolatileWrite2)
+ICALL(THREAD_48, "VolatileWrite(uint&,uint)", ves_icall_System_Threading_Thread_VolatileWrite4)
 ICALL(THREAD_49, "VolatileWrite(uint16&,uint16)", ves_icall_System_Threading_Thread_VolatileWrite2)
 ICALL(THREAD_50, "VolatileWrite(uintptr&,uintptr)", ves_icall_System_Threading_Thread_VolatileWriteIntPtr)
 ICALL(THREAD_51, "VolatileWrite(ulong&,ulong)", ves_icall_System_Threading_Thread_VolatileWrite8)
diff --git a/mono/metadata/icall.c b/mono/metadata/icall.c
index 7c0830f..18d49ab 100644
--- a/mono/metadata/icall.c
+++ b/mono/metadata/icall.c
@@ -2806,7 +2806,13 @@ ves_icall_InternalInvoke (MonoReflectionMethod *method, MonoObject *this, MonoAr
 
 		if (this) {
 			if (!mono_object_isinst (this, m->klass)) {
-				mono_gc_wbarrier_generic_store (exc, (MonoObject*) mono_exception_from_name_msg (mono_defaults.corlib, "System.Reflection", "TargetException", "Object does not match target type."));
+				char *this_name = mono_type_get_full_name (mono_object_get_class (this));
+				char *target_name = mono_type_get_full_name (m->klass);
+				char *msg = g_strdup_printf ("Object of type '%s' doesn't match target type '%s'", this_name, target_name);
+				mono_gc_wbarrier_generic_store (exc, (MonoObject*) mono_exception_from_name_msg (mono_defaults.corlib, "System.Reflection", "TargetException", msg));
+				g_free (msg);
+				g_free (target_name);
+				g_free (this_name);
 				return NULL;
 			}
 			m = mono_object_get_virtual_method (this, m);
@@ -6051,8 +6057,19 @@ ves_icall_System_CurrentSystemTimeZone_GetTimeZoneData (guint32 year, MonoArray
 				mono_array_set ((*data), gint64, 1, ((gint64)t1 + EPOCH_ADJUST) * 10000000L);
 				return 1;
 			} else {
+				struct tm end;
+				time_t te;
+				
+				memset (&end, 0, sizeof (end));
+				end.tm_year = year-1900 + 1;
+				end.tm_mday = 1;
+				
+				te = mktime (&end);
+				
 				mono_array_setref ((*names), 1, mono_string_new (domain, tzone));
 				mono_array_set ((*data), gint64, 0, ((gint64)t1 + EPOCH_ADJUST) * 10000000L);
+				mono_array_setref ((*names), 0, mono_string_new (domain, tzone));
+				mono_array_set ((*data), gint64, 1, ((gint64)te + EPOCH_ADJUST) * 10000000L);
 				is_daylight = 1;
 			}
 
diff --git a/mono/metadata/marshal.c b/mono/metadata/marshal.c
index 7ca7754..a07c02f 100644
--- a/mono/metadata/marshal.c
+++ b/mono/metadata/marshal.c
@@ -7878,10 +7878,13 @@ emit_marshal_ptr (EmitMarshalContext *m, int argnum, MonoType *t,
 
 	switch (action) {
 	case MARSHAL_ACTION_CONV_IN:
+		/* MS seems to allow this in some cases, ie. bxc #158 */
+		/*
 		if (MONO_TYPE_ISSTRUCT (t->data.type) && !mono_class_from_mono_type (t->data.type)->blittable) {
 			char *msg = g_strdup_printf ("Can not marshal 'parameter #%d': Pointers can not reference marshaled structures. Use byref instead.", argnum + 1);
 			mono_mb_emit_exception_marshal_directive (m->mb, msg);
 		}
+		*/
 		break;
 
 	case MARSHAL_ACTION_PUSH:
diff --git a/mono/metadata/mono-debug.c b/mono/metadata/mono-debug.c
index ee94911..ca34631 100644
--- a/mono/metadata/mono-debug.c
+++ b/mono/metadata/mono-debug.c
@@ -279,6 +279,9 @@ _mono_debug_init_corlib (MonoDomain *domain)
 void
 mono_debug_open_image_from_memory (MonoImage *image, const guint8 *raw_contents, int size)
 {
+	if (!mono_debug_initialized)
+		return;
+
 	mono_debug_open_image (image, raw_contents, size);
 }
 
@@ -650,8 +653,12 @@ mono_debug_add_method (MonoMethod *method, MonoDebugMethodJitInfo *jit, MonoDoma
 	g_assert (size < max_size);
 	total_size = size + sizeof (MonoDebugMethodAddress);
 
-	address = (MonoDebugMethodAddress *) allocate_data_item (
-		table, MONO_DEBUG_DATA_ITEM_METHOD, total_size);
+	if (method->dynamic) {
+		address = g_malloc0 (total_size);
+	} else {
+		address = (MonoDebugMethodAddress *) allocate_data_item (
+				  table, MONO_DEBUG_DATA_ITEM_METHOD, total_size);
+	}
 
 	address->header.size = total_size;
 	address->header.symfile_id = handle ? handle->index : 0;
@@ -689,13 +696,50 @@ mono_debug_add_method (MonoMethod *method, MonoDebugMethodJitInfo *jit, MonoDoma
 
 	g_hash_table_insert (table->method_address_hash, method, address);
 
-	write_data_item (table, (guint8 *) address);
+	if (!method->dynamic)
+		write_data_item (table, (guint8 *) address);
 
 	mono_debugger_unlock ();
 	return address;
 }
 
 void
+mono_debug_remove_method (MonoMethod *method, MonoDomain *domain)
+{
+	MonoMethod *declaring;
+	MonoDebugDataTable *table;
+	MonoDebugMethodHeader *header;
+	MonoDebugMethodAddress *address;
+
+	if (!mono_debug_initialized)
+		return;
+
+	g_assert (method->dynamic);
+
+	mono_debugger_lock ();
+
+	table = lookup_data_table (domain);
+
+	declaring = method->is_inflated ? ((MonoMethodInflated *) method)->declaring : method;
+	g_hash_table_remove (table->method_hash, declaring);
+
+	address = g_hash_table_lookup (table->method_address_hash, method);
+	if (address) {
+		header = &address->header;
+
+		if (header->wrapper_data) {
+			g_free ((char*)header->wrapper_data->method_name);
+			g_free (header->wrapper_data);
+		}
+		g_free (address);
+	}
+
+	g_hash_table_remove (table->method_address_hash, method);
+
+	mono_debugger_unlock ();
+}
+
+void
 mono_debug_add_delegate_trampoline (gpointer code, int size)
 {
 	MonoDebugDelegateTrampolineEntry *entry;
diff --git a/mono/metadata/mono-debug.h b/mono/metadata/mono-debug.h
index d4ff5b9..9494a79 100644
--- a/mono/metadata/mono-debug.h
+++ b/mono/metadata/mono-debug.h
@@ -157,6 +157,9 @@ mono_bool mono_debug_using_mono_debugger (void);
 MonoDebugMethodAddress *
 mono_debug_add_method (MonoMethod *method, MonoDebugMethodJitInfo *jit, MonoDomain *domain);
 
+void
+mono_debug_remove_method (MonoMethod *method, MonoDomain *domain);
+
 MonoDebugMethodInfo *
 mono_debug_lookup_method (MonoMethod *method);
 
diff --git a/mono/metadata/mono-perfcounters.c b/mono/metadata/mono-perfcounters.c
index 35e271b..e30c204 100644
--- a/mono/metadata/mono-perfcounters.c
+++ b/mono/metadata/mono-perfcounters.c
@@ -1006,6 +1006,25 @@ predef_writable_counter (ImplVtable *vtable, MonoBoolean only_value, MonoCounter
 			return TRUE;
 		}
 		break;
+	case CATEGORY_JIT:
+		switch (id) {
+		case COUNTER_JIT_BYTES:
+			sample->rawValue = mono_perfcounters->jit_bytes;
+			return TRUE;
+		case COUNTER_JIT_METHODS:
+			sample->rawValue = mono_perfcounters->jit_methods;
+			return TRUE;
+		case COUNTER_JIT_TIME:
+			sample->rawValue = mono_perfcounters->jit_time;
+			return TRUE;
+		case COUNTER_JIT_BYTES_PSEC:
+			sample->rawValue = mono_perfcounters->jit_bytes;
+			return TRUE;
+		case COUNTER_JIT_FAILURES:
+			sample->rawValue = mono_perfcounters->jit_failures;
+			return TRUE;
+		}
+		break;
 	}
 	return FALSE;
 }
diff --git a/mono/metadata/object-internals.h b/mono/metadata/object-internals.h
index c359ef9..27349a1 100644
--- a/mono/metadata/object-internals.h
+++ b/mono/metadata/object-internals.h
@@ -10,6 +10,7 @@
 #include <mono/io-layer/io-layer.h>
 #include "mono/utils/mono-compiler.h"
 #include "mono/utils/mono-error.h"
+#include "mono/utils/mono-tls.h"
 
 /* 
  * We should find a better place for this stuff. We can't put it in mono-compiler.h,
@@ -652,14 +653,14 @@ mono_type_initialization_cleanup (void) MONO_INTERNAL;
 int
 mono_thread_kill           (MonoInternalThread *thread, int signal) MONO_INTERNAL;
 
-guint32
-mono_thread_get_tls_key    (void) MONO_INTERNAL;
+MonoNativeTlsKey
+mono_thread_get_native_tls_key (void) MONO_INTERNAL;
 
 gint32
 mono_thread_get_tls_offset (void) MONO_INTERNAL;
 
-guint32
-mono_domain_get_tls_key    (void) MONO_INTERNAL;
+MonoNativeTlsKey
+mono_domain_get_native_tls_key    (void) MONO_INTERNAL;
 
 gint32
 mono_domain_get_tls_offset (void) MONO_INTERNAL;
diff --git a/mono/metadata/profiler.c b/mono/metadata/profiler.c
index 1cd73ee..ce6a95b 100644
--- a/mono/metadata/profiler.c
+++ b/mono/metadata/profiler.c
@@ -10,6 +10,7 @@
 
 #include "config.h"
 #include "mono/metadata/profiler-private.h"
+#include "mono/metadata/assembly.h"
 #include "mono/metadata/debug-helpers.h"
 #include "mono/metadata/mono-debug.h"
 #include "mono/metadata/debug-mono-symfile.h"
@@ -1029,6 +1030,68 @@ mono_profiler_coverage_get (MonoProfiler *prof, MonoMethod *method, MonoProfileC
 typedef void (*ProfilerInitializer) (const char*);
 #define INITIALIZER_NAME "mono_profiler_startup"
 
+
+static gboolean
+load_profiler (MonoDl *pmodule, const char *desc, const char *symbol)
+{
+	char *err;
+	ProfilerInitializer func;
+
+	if (!pmodule)
+		return FALSE;
+
+	if ((err = mono_dl_symbol (pmodule, symbol, (gpointer *) &func))) {
+		g_free (err);
+		return FALSE;
+	} else {
+		func (desc);
+	}
+	return TRUE;
+}
+
+static gboolean
+load_embedded_profiler (const char *desc, const char *name)
+{
+	char *err = NULL;
+	char *symbol;
+	MonoDl *pmodule = NULL;
+	gboolean result;
+
+	pmodule = mono_dl_open (NULL, MONO_DL_LAZY, &err);
+	if (!pmodule) {
+		g_warning ("Could not open main executable (%s)", err);
+		g_free (err);
+		return FALSE;
+	}
+
+	symbol = g_strdup_printf (INITIALIZER_NAME "_%s", name);
+	result = load_profiler (pmodule, desc, symbol);
+	g_free (symbol);
+
+	return result;
+}
+
+static gboolean
+load_profiler_from_directory (const char *directory, const char *libname, const char *desc)
+{
+	MonoDl *pmodule = NULL;
+	char* path;
+	char *err;
+	void *iter;
+
+	iter = NULL;
+	err = NULL;
+	while ((path = mono_dl_build_path (directory, libname, &iter))) {
+		pmodule = mono_dl_open (path, MONO_DL_LAZY, &err);
+		g_free (path);
+		g_free (err);
+		if (pmodule)
+			return load_profiler (pmodule, desc, INITIALIZER_NAME);
+	}
+		
+	return FALSE;
+}
+
 /**
  * mono_profiler_load:
  * @desc: arguments to configure the profiler
@@ -1074,45 +1137,23 @@ mono_profiler_load (const char *desc)
 		desc = cdesc = g_string_free (str, FALSE);
 	}
 	{
-		MonoDl *pmodule = NULL;
 		const char* col = strchr (desc, ':');
 		char* libname;
-		char* path;
 		char *mname;
-		char *err;
-		void *iter;
 		if (col != NULL) {
 			mname = g_memdup (desc, col - desc + 1);
 			mname [col - desc] = 0;
 		} else {
 			mname = g_strdup (desc);
 		}
-		libname = g_strdup_printf ("mono-profiler-%s", mname);
-		iter = NULL;
-		err = NULL;
-		while ((path = mono_dl_build_path (NULL, libname, &iter))) {
-			g_free (err);
-			pmodule = mono_dl_open (path, MONO_DL_LAZY, &err);
-			if (pmodule) {
-				ProfilerInitializer func;
-				if ((err = mono_dl_symbol (pmodule, INITIALIZER_NAME, (gpointer *)&func))) {
-					g_warning ("Cannot find initializer function %s in profiler module: %s (%s)", INITIALIZER_NAME, libname, err);
-					g_free (err);
-					err = NULL;
-				} else {
-					func (desc);
-				}
-				break;
-			}
-			g_free (path);
+		if (!load_embedded_profiler (desc, mname)) {
+			libname = g_strdup_printf ("mono-profiler-%s", mname);
+			if (!load_profiler_from_directory (NULL, libname, desc))
+				if (!load_profiler_from_directory (MONO_ASSEMBLIES, libname, desc))
+					g_warning ("The '%s' profiler wasn't found in the main executable nor could it be loaded from '%s'.", mname, libname);
+			g_free (libname);
 		}
-		if (!pmodule) {
-			g_warning ("Error loading profiler module '%s': %s", libname, err);
-			g_free (err);
-		}
-		g_free (libname);
 		g_free (mname);
-		g_free (path);
 	}
 	g_free (cdesc);
 }
diff --git a/mono/metadata/sgen-bridge.c b/mono/metadata/sgen-bridge.c
index 113c48d..c36605f 100644
--- a/mono/metadata/sgen-bridge.c
+++ b/mono/metadata/sgen-bridge.c
@@ -42,6 +42,9 @@
 
 #include "sgen-gc.h"
 #include "sgen-bridge.h"
+#include "utils/mono-logger-internal.h"
+#include "utils/mono-time.h"
+
 
 typedef struct {
 	int size;
@@ -53,6 +56,8 @@ typedef struct {
 #define DYN_ARRAY_REF(da,i)	((void*)((da)->data + (i) * (da)->elem_size))
 #define DYN_ARRAY_PTR_REF(da,i)	(((void**)(da)->data) [(i)])
 #define DYN_ARRAY_INT_REF(da,i)	(((int*)(da)->data) [(i)])
+#define DYN_ARRAY_PTR_STATIC_INITIALIZER { 0, sizeof (void*), 0, NULL }
+#define DYN_ARRAY_INT_STATIC_INITIALIZER { 0, sizeof (int), 0, NULL }
 
 static void
 dyn_array_init (DynArray *da, int elem_size)
@@ -165,14 +170,75 @@ dyn_array_int_contains (DynArray *da, int x)
 	return FALSE;
 }
 
+static DynArray merge_array;
+
 static void
-dyn_array_append (DynArray *dst, DynArray *src)
+dyn_array_int_merge (DynArray *dst, DynArray *src)
+{
+	int i, j;
+
+	dyn_array_ensure_capacity (&merge_array, dst->size + src->size);
+	merge_array.size = 0;
+
+	for (i = j = 0; i < dst->size || j < src->size; ) {
+		if (i < dst->size && j < src->size) {
+			int a = DYN_ARRAY_INT_REF (dst, i); 
+			int b = DYN_ARRAY_INT_REF (src, j); 
+			if (a < b) {
+				dyn_array_int_add (&merge_array, a);
+				++i;
+			} else if (a == b) {
+				dyn_array_int_add (&merge_array, a);
+				++i;
+				++j;	
+			} else {
+				dyn_array_int_add (&merge_array, b);
+				++j;
+			}
+		} else if (i < dst->size) {
+			dyn_array_int_add (&merge_array, DYN_ARRAY_INT_REF (dst, i));
+			++i;
+		} else {
+			dyn_array_int_add (&merge_array, DYN_ARRAY_INT_REF (src, j));
+			++j;
+		}
+	}
+
+	if (merge_array.size > dst->size) {
+		dyn_array_ensure_capacity (dst, merge_array.size);
+		memcpy (DYN_ARRAY_REF (dst, 0), DYN_ARRAY_REF (&merge_array, 0), merge_array.size * merge_array.elem_size);
+		dst->size = merge_array.size;
+	}
+}
+
+static void
+dyn_array_int_merge_one (DynArray *array, int value)
 {
-	g_assert (dst->elem_size == src->elem_size);
+	int i;
+	int tmp;
+	int end = array->size;
+
+	for (i = 0; i < end; ++i) {
+		if (DYN_ARRAY_INT_REF (array, i) == value)
+			return;
+		else if (DYN_ARRAY_INT_REF (array, i) > value)
+			break;
+	}
 
-	dyn_array_ensure_capacity (dst, dst->size + src->size);
-	memcpy (DYN_ARRAY_REF (dst, dst->size), DYN_ARRAY_REF (src, 0), src->size * src->elem_size);
-	dst->size += src->size;
+	dyn_array_ensure_capacity (array, array->size + 1);
+
+	if (i < end) {
+		tmp = DYN_ARRAY_INT_REF (array, i);
+		for (; i <= end; ++i) {
+			DYN_ARRAY_INT_REF (array, i) = value;
+			value = tmp;
+			tmp = DYN_ARRAY_INT_REF (array, i + 1);
+		}
+		DYN_ARRAY_INT_REF (array, end + 1) = tmp;
+	} else {
+		DYN_ARRAY_INT_REF (array, end) = value;
+	}
+	++array->size;
 }
 
 /*
@@ -278,13 +344,18 @@ lookup_hash_entry (MonoObject *obj)
 }
 
 static HashEntry*
-get_hash_entry (MonoObject *obj)
+get_hash_entry (MonoObject *obj, gboolean *existing)
 {
 	HashEntry *entry = lookup_hash_entry (obj);
 	int hash;
 
-	if (entry)
+	if (entry) {
+		if (existing)
+			*existing = TRUE;
 		return entry;
+	}
+	if (existing)
+		*existing = FALSE;
 
 	entry = mono_sgen_alloc_internal_dynamic (sizeof (HashEntry), INTERNAL_MEM_BRIDGE_DATA);
 	memset (entry, 0, sizeof (HashEntry));
@@ -341,15 +412,17 @@ free_data (void)
 	num_hash_entries = 0;
 	hash_table = NULL;
 
+	dyn_array_uninit (&merge_array);
 	//g_print ("total srcs %d - max %d\n", total_srcs, max_srcs);
 }
 
-static void
+static gboolean
 register_bridge_object (MonoObject *obj)
 {
-	HashEntry *entry = get_hash_entry (obj);
-	g_assert (!entry->is_bridge);
+	gboolean existing;
+	HashEntry *entry = get_hash_entry (obj, &existing);
 	entry->is_bridge = TRUE;
+	return !existing;
 }
 
 static void
@@ -373,14 +446,18 @@ object_is_live (MonoObject **objp)
 	return lookup_hash_entry (obj) == NULL;
 }
 
+static DynArray registered_bridges = DYN_ARRAY_PTR_STATIC_INITIALIZER;
 static DynArray dfs_stack;
 
+static int dsf1_passes, dsf2_passes;
+
+
 #undef HANDLE_PTR
 #define HANDLE_PTR(ptr,obj)	do {					\
 		MonoObject *dst = (MonoObject*)*(ptr);			\
 		if (dst && !object_is_live (&dst)) {			\
 			dyn_array_ptr_push (&dfs_stack, obj_entry);	\
-			dyn_array_ptr_push (&dfs_stack, get_hash_entry (dst)); \
+			dyn_array_ptr_push (&dfs_stack, get_hash_entry (dst, NULL)); \
 		}							\
 	} while (0)
 
@@ -395,6 +472,7 @@ dfs1 (HashEntry *obj_entry, HashEntry *src)
 	do {
 		MonoObject *obj;
 		char *start;
+		++dsf1_passes;
 
 		obj_entry = dyn_array_ptr_pop (&dfs_stack);
 		if (obj_entry) {
@@ -438,11 +516,10 @@ scc_add_xref (SCC *src, SCC *dst)
 	if (dyn_array_int_contains (&dst->xrefs, src->index))
 		return;
 	if (src->num_bridge_entries) {
-		dyn_array_int_add (&dst->xrefs, src->index);
+		dyn_array_int_merge_one (&dst->xrefs, src->index);
 	} else {
 		int i;
-		// FIXME: uniq here
-		dyn_array_append (&dst->xrefs, &src->xrefs);
+		dyn_array_int_merge (&dst->xrefs, &src->xrefs);
 		for (i = 0; i < dst->xrefs.size; ++i)
 			g_assert (DYN_ARRAY_INT_REF (&dst->xrefs, i) != dst->index);
 	}
@@ -471,6 +548,7 @@ dfs2 (HashEntry *entry)
 
 	do {
 		entry = dyn_array_ptr_pop (&dfs_stack);
+		++dsf2_passes;
 
 		if (entry->scc_index >= 0) {
 			if (entry->scc_index != current_scc->index)
@@ -493,44 +571,88 @@ compare_hash_entries (const void *ep1, const void *ep2)
 	return e2->finishing_time - e1->finishing_time;
 }
 
+gboolean
+mono_sgen_is_bridge_object (MonoObject *obj)
+{
+	return bridge_callbacks.is_bridge_object (obj);
+}
+
+static unsigned long step_1, step_2, step_3, step_4, step_5, step_6, step_7, step_8;
+static int fist_pass_links, second_pass_links, sccs_links;
+static int max_sccs_links = 0;
+
 void
-mono_sgen_bridge_processing (int num_objs, MonoObject **objs)
+mono_sgen_bridge_processing_register_objects (int num_objs, MonoObject **objs)
 {
-	HashEntry **all_entries;
 	int j = 0;
-	int num_sccs, num_xrefs;
-	int max_entries, max_xrefs;
 	int i;
-	MonoGCBridgeSCC **api_sccs;
-	MonoGCBridgeXRef *api_xrefs;
+	SGEN_TV_DECLARE (atv);
+	SGEN_TV_DECLARE (btv);
+
+	fist_pass_links = second_pass_links = sccs_links = 0;
+	dsf1_passes = dsf2_passes = 0;
+	SGEN_TV_GETTIME (atv);
 
 	g_assert (mono_sgen_need_bridge_processing ());
 
 	//g_print ("%d finalized objects\n", num_objs);
 
-	/* remove objects that are not bridge objects */
-
+	/* The collector step checks for bridge objects already, so we don't need to do it again. */
 	for (i = 0; i < num_objs; ++i) {
 		MonoObject *obj = objs [i];
-		//g_assert (!mono_sgen_object_is_live (obj));
-		if (bridge_callbacks.is_bridge_object (obj)) {
-			register_bridge_object (obj);
-			objs [j++] = obj;
-		}
+		if (register_bridge_object (obj))
+			dyn_array_ptr_push (&registered_bridges, obj);
 	}
-	num_objs = j;
 
-	//g_print ("%d bridge objects\n", num_objs);
+	SGEN_TV_GETTIME (btv);
+	step_1 += SGEN_TV_ELAPSED (atv, btv);
+}
+
+void
+mono_sgen_bridge_processing_stw_step (void)
+{
+	int i;
+	SGEN_TV_DECLARE (atv);
+	SGEN_TV_DECLARE (btv);
+
+	if (!registered_bridges.size)
+		return;
+
+	SGEN_TV_GETTIME (btv);
 
 	/* first DFS pass */
 
 	dyn_array_ptr_init (&dfs_stack);
+	dyn_array_int_init (&merge_array);
 
 	current_time = 0;
-	for (i = 0; i < num_objs; ++i)
-		dfs1 (get_hash_entry (objs [i]), NULL);
+	for (i = 0; i < registered_bridges.size; ++i)
+		dfs1 (get_hash_entry (DYN_ARRAY_PTR_REF (&registered_bridges, i), NULL), NULL);
+
+	SGEN_TV_GETTIME (atv);
+	step_2 = SGEN_TV_ELAPSED (btv, atv);
+}
 
-	//g_print ("%d entries - hash size %d\n", num_hash_entries, hash_size);
+void
+mono_sgen_bridge_processing_finish (void)
+{
+	int i, j;
+	int num_sccs, num_xrefs;
+	int max_entries, max_xrefs;
+	int hash_table_size, sccs_size;
+	MonoObject *obj;
+	HashEntry *entry;
+	int num_registered_bridges;
+	HashEntry **all_entries;
+	MonoGCBridgeSCC **api_sccs;
+	MonoGCBridgeXRef *api_xrefs;
+	SGEN_TV_DECLARE (atv);
+	SGEN_TV_DECLARE (btv);
+
+	if (!registered_bridges.size)
+		return;
+
+	SGEN_TV_GETTIME (atv);
 
 	/* alloc and fill array of all entries */
 
@@ -545,11 +667,13 @@ mono_sgen_bridge_processing (int num_objs, MonoObject **objs)
 			g_assert (entry->finishing_time >= 0);
 			all_entries [j++] = entry;
 			++length;
+			fist_pass_links += entry->srcs.size;
 		}
 		if (length > max_entries)
 			max_entries = length;
 	}
 	g_assert (j == num_hash_entries);
+	hash_table_size = num_hash_entries;
 
 	//g_print ("max hash bucket length %d\n", max_entries);
 
@@ -557,6 +681,9 @@ mono_sgen_bridge_processing (int num_objs, MonoObject **objs)
 
 	qsort (all_entries, num_hash_entries, sizeof (HashEntry*), compare_hash_entries);
 
+	SGEN_TV_GETTIME (btv);
+	step_3 = SGEN_TV_ELAPSED (atv, btv);
+
 	/* second DFS pass */
 
 	dyn_array_init (&sccs, sizeof (SCC));
@@ -574,6 +701,16 @@ mono_sgen_bridge_processing (int num_objs, MonoObject **objs)
 		}
 	}
 
+	sccs_size = sccs.size;
+
+	for (i = 0; i < num_hash_entries; ++i) {
+		HashEntry *entry = all_entries [i];
+		second_pass_links += entry->srcs.size;
+	}
+
+	SGEN_TV_GETTIME (atv);
+	step_4 = SGEN_TV_ELAPSED (btv, atv);
+
 	//g_print ("%d sccs\n", sccs.size);
 
 	dyn_array_uninit (&dfs_stack);
@@ -586,6 +723,8 @@ mono_sgen_bridge_processing (int num_objs, MonoObject **objs)
 		g_assert (scc->index == i);
 		if (scc->num_bridge_entries)
 			++num_sccs;
+		sccs_links += scc->xrefs.size;
+		max_sccs_links = MAX (max_sccs_links, scc->xrefs.size);
 	}
 
 	api_sccs = mono_sgen_alloc_internal_dynamic (sizeof (MonoGCBridgeSCC*) * num_sccs, INTERNAL_MEM_BRIDGE_DATA);
@@ -632,6 +771,9 @@ mono_sgen_bridge_processing (int num_objs, MonoObject **objs)
 		}
 	}
 
+	SGEN_TV_GETTIME (btv);
+	step_5 = SGEN_TV_ELAPSED (atv, btv);
+
 	/* free data */
 
 	j = 0;
@@ -652,6 +794,12 @@ mono_sgen_bridge_processing (int num_objs, MonoObject **objs)
 	mono_sgen_free_internal_dynamic (all_entries, sizeof (HashEntry*) * num_hash_entries, INTERNAL_MEM_BRIDGE_DATA);
 
 	free_data ();
+	/* Empty the registered bridges array */
+	num_registered_bridges = registered_bridges.size;
+	registered_bridges.size = 0;
+
+	SGEN_TV_GETTIME (atv);
+	step_6 = SGEN_TV_ELAPSED (btv, atv);
 
 	//g_print ("%d sccs containing bridges - %d max bridge objects - %d max xrefs\n", j, max_entries, max_xrefs);
 
@@ -659,6 +807,17 @@ mono_sgen_bridge_processing (int num_objs, MonoObject **objs)
 
 	bridge_callbacks.cross_references (num_sccs, api_sccs, num_xrefs, api_xrefs);
 
+	SGEN_TV_GETTIME (btv);
+	step_7 = SGEN_TV_ELAPSED (atv, btv);
+
+	/*Release for finalization those objects we no longer care. */
+	for (i = 0; i < num_sccs; ++i) {
+		if (!api_sccs [i]->objs [0])
+			continue;
+		for (j = 0; j < api_sccs [i]->num_objs; ++j)
+			mono_sgen_mark_bridge_object (api_sccs [i]->objs [j]);
+	}
+
 	/* free callback data */
 
 	for (i = 0; i < num_sccs; ++i) {
@@ -669,6 +828,24 @@ mono_sgen_bridge_processing (int num_objs, MonoObject **objs)
 	mono_sgen_free_internal_dynamic (api_sccs, sizeof (MonoGCBridgeSCC*) * num_sccs, INTERNAL_MEM_BRIDGE_DATA);
 
 	mono_sgen_free_internal_dynamic (api_xrefs, sizeof (MonoGCBridgeXRef) * num_xrefs, INTERNAL_MEM_BRIDGE_DATA);
+
+	SGEN_TV_GETTIME (atv);
+	step_8 = SGEN_TV_ELAPSED (btv, atv);
+
+	mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_GC, "GC_BRIDGE num-objects %d num_hash_entries %d sccs size %d init %.2fms df1 %.2fms sort %.2fms dfs2 %.2fms setup-cb %.2fms free-data %.2fms user-cb %.2fms clenanup %.2fms links %d/%d/%d/%d dfs passes %d/%d",
+		num_registered_bridges, hash_table_size, sccs.size,
+		step_1 / 1000.0f,
+		step_2 / 1000.0f,
+		step_3 / 1000.0f,
+		step_4 / 1000.0f,
+		step_5 / 1000.0f,
+		step_6 / 1000.0f,
+		step_7 / 1000.0f,
+		step_8 / 1000.f,
+		fist_pass_links, second_pass_links, sccs_links, max_sccs_links,
+		dsf1_passes, dsf2_passes);
+
+	step_1 = 0; /* We must cleanup since this value is used as an accumulator. */
 }
 
 static gboolean
diff --git a/mono/metadata/sgen-cardtable.c b/mono/metadata/sgen-cardtable.c
index 65e5a95..c4fe252 100644
--- a/mono/metadata/sgen-cardtable.c
+++ b/mono/metadata/sgen-cardtable.c
@@ -8,6 +8,7 @@
  *
  * Copyright 2001-2003 Ximian, Inc
  * Copyright 2003-2010 Novell, Inc.
+ * Copyright 2011 Xamarin Inc (http://www.xamarin.com)
  * 
  * Permission is hereby granted, free of charge, to any person obtaining
  * a copy of this software and associated documentation files (the
@@ -133,11 +134,7 @@ sgen_card_table_align_pointer (void *ptr)
 void
 sgen_card_table_mark_range (mword address, mword size)
 {
-	mword end = address + size;
-	do {
-		sgen_card_table_mark_address (address);
-		address += CARD_SIZE_IN_BYTES;
-	} while (address < end);
+	memset (sgen_card_table_get_card_address (address), 1, cards_in_range (address, size));
 }
 
 static gboolean
@@ -272,6 +269,24 @@ collect_faulted_cards (void)
 
 	printf ("TOTAL card pages %d faulted %d\n", CARD_PAGES, count);
 }
+
+void
+sgen_card_table_dump_obj_card (char *object, size_t size, void *dummy)
+{
+	guint8 *start = sgen_card_table_get_card_scan_address (object);
+	guint8 *end = start + cards_in_range (object, size);
+	int cnt = 0;
+	printf ("--obj %p %d cards [%p %p]--", object, size, start, end);
+	for (; start < end; ++start) {
+		if (cnt == 0)
+			printf ("\n\t[%p] ", start);
+		printf ("%x ", *start);
+		++cnt;
+		if (cnt == 8)
+			cnt = 0;
+	}
+	printf ("\n");
+}
 #endif
 
 void
@@ -343,7 +358,7 @@ LOOP_HEAD:
 			elem = (char*)mono_array_addr_with_size ((MonoArray*)obj, elem_size, index);
 			if (klass->element_class->valuetype) {
 				for (; elem < card_end; elem += elem_size)
-					major_collector.minor_scan_vtype (elem, desc, nursery_start, nursery_next, queue);
+					major_collector.minor_scan_vtype (elem, klass->element_class, nursery_start, nursery_next, queue);
 			} else {
 				for (; elem < card_end; elem += SIZEOF_VOID_P) {
 					gpointer new, old = *(gpointer*)elem;
diff --git a/mono/metadata/sgen-gc.c b/mono/metadata/sgen-gc.c
index f8d5cc3..5983d63 100644
--- a/mono/metadata/sgen-gc.c
+++ b/mono/metadata/sgen-gc.c
@@ -216,6 +216,7 @@
 #include "utils/mono-semaphore.h"
 #include "utils/mono-counters.h"
 #include "utils/mono-proclib.h"
+#include "utils/mono-logger-internal.h"
 
 #include <mono/utils/memcheck.h>
 
@@ -423,7 +424,7 @@ enum {
 	REMSET_LOCATION, /* just a pointer to the exact location */
 	REMSET_RANGE,    /* range of pointer fields */
 	REMSET_OBJECT,   /* mark all the object for scanning */
-	REMSET_VTYPE,    /* a valuetype array described by a gc descriptor and a count */
+	REMSET_VTYPE,    /* a valuetype array described by a MonoClass pointer and a count */
 	REMSET_TYPE_MASK = 0x3
 };
 
@@ -521,6 +522,12 @@ static mword memory_pressure = 0;
 static mword minor_collection_allowance;
 static int minor_collection_sections_alloced = 0;
 
+
+/* GC Logging stats */
+static int last_major_num_sections = 0;
+static int last_los_memory_usage = 0;
+static gboolean major_collection_hapenned = FALSE;
+
 static GCMemSection *nursery_section = NULL;
 static mword lowest_heap_address = ~(mword)0;
 static mword highest_heap_address = 0;
@@ -813,9 +820,27 @@ align_pointer (void *ptr)
 
 typedef SgenGrayQueue GrayQueue;
 
-typedef void (*CopyOrMarkObjectFunc) (void**, GrayQueue*);
 typedef char* (*ScanObjectFunc) (char*, GrayQueue*);
 
+
+static inline MonoObject*
+finalize_entry_get_object (FinalizeEntry *entry)
+{
+	return (MonoObject*)(((mword)entry->object) & ~(mword)0x1);
+}
+
+static inline gboolean
+finalize_entry_get_bridge_bit (FinalizeEntry *entry)
+{
+	return (((mword)entry->object) & 0x1);
+}
+
+static inline void
+finalize_entry_set_object (FinalizeEntry *entry, MonoObject *object, gboolean bridge_bit)
+{
+	entry->object = (MonoObject*)((mword)object | (mword)bridge_bit);
+}
+
 /* forward declarations */
 static int stop_world (int generation);
 static int restart_world (int generation);
@@ -827,6 +852,7 @@ static void report_finalizer_roots (void);
 static void report_registered_roots (void);
 static void find_pinning_ref_from_thread (char *obj, size_t size);
 static void update_current_thread_stack (void *start);
+static void collect_bridge_objects (CopyOrMarkObjectFunc copy_func, char *start, char *end, int generation, GrayQueue *queue);
 static void finalize_in_range (CopyOrMarkObjectFunc copy_func, char *start, char *end, int generation, GrayQueue *queue);
 static void add_or_remove_disappearing_link (MonoObject *obj, void **link, gboolean track, int generation);
 static void null_link_in_range (CopyOrMarkObjectFunc copy_func, char *start, char *end, int generation, gboolean before_finalization, GrayQueue *queue);
@@ -943,9 +969,9 @@ alloc_complex_descriptor (gsize *bitmap, int numbits)
 }
 
 gsize*
-mono_sgen_get_complex_descriptor (GCVTable *vt)
+mono_sgen_get_complex_descriptor (mword desc)
 {
-	return complex_descriptors + (vt->desc >> LOW_TYPE_BITS);
+	return complex_descriptors + (desc >> LOW_TYPE_BITS);
 }
 
 /*
@@ -2280,9 +2306,10 @@ report_finalizer_roots_list (FinalizeEntry *list)
 
 	report.count = 0;
 	for (fin = list; fin; fin = fin->next) {
-		if (!fin->object)
+		MonoObject *object = finalize_entry_get_object (fin);
+		if (!object)
 			continue;
-		add_profile_gc_root (&report, fin->object, MONO_PROFILE_GC_ROOT_FINALIZER, 0);
+		add_profile_gc_root (&report, object, MONO_PROFILE_GC_ROOT_FINALIZER, 0);
 	}
 	notify_gc_roots (&report);
 }
@@ -2378,10 +2405,14 @@ scan_finalizer_entries (CopyOrMarkObjectFunc copy_func, FinalizeEntry *list, Gra
 	FinalizeEntry *fin;
 
 	for (fin = list; fin; fin = fin->next) {
-		if (!fin->object)
+		void *object = finalize_entry_get_object (fin);
+		gboolean bridge_bit = finalize_entry_get_bridge_bit (fin);
+		if (!object)
 			continue;
-		DEBUG (5, fprintf (gc_debug_file, "Scan of fin ready object: %p (%s)\n", fin->object, safe_name (fin->object)));
-		copy_func (&fin->object, queue);
+		DEBUG (5, fprintf (gc_debug_file, "Scan of fin ready object: %p (%s)\n", object, safe_name (object)));
+		copy_func (&object, queue);
+
+		finalize_entry_set_object (fin, object, bridge_bit);
 	}
 }
 
@@ -2470,12 +2501,24 @@ bridge_register_finalized_object (MonoObject *object)
 }
 
 static void
+stw_bridge_process (void)
+{
+	mono_sgen_bridge_processing_stw_step ();
+}
+
+static void
+bridge_process (void)
+{
+	mono_sgen_bridge_processing_finish ();
+}
+
+static void
 finish_gray_stack (char *start_addr, char *end_addr, int generation, GrayQueue *queue)
 {
 	TV_DECLARE (atv);
 	TV_DECLARE (btv);
 	int fin_ready;
-	int ephemeron_rounds = 0;
+	int done_with_ephemerons, ephemeron_rounds = 0;
 	int num_loops;
 	CopyOrMarkObjectFunc copy_func = current_collection_generation == GENERATION_NURSERY ? major_collector.copy_object : major_collector.copy_or_mark_object;
 
@@ -2497,6 +2540,40 @@ finish_gray_stack (char *start_addr, char *end_addr, int generation, GrayQueue *
 	DEBUG (2, fprintf (gc_debug_file, "%s generation done\n", generation_name (generation)));
 
 	/*
+	 * Walk the ephemeron tables marking all values with reachable keys. This must be completely done
+	 * before processing finalizable objects or non-tracking weak hamdle to avoid finalizing/clearing
+	 * objects that are in fact reachable.
+	 */
+	done_with_ephemerons = 0;
+	do {
+		done_with_ephemerons = mark_ephemerons_in_range (copy_func, start_addr, end_addr, queue);
+		drain_gray_stack (queue);
+		++ephemeron_rounds;
+	} while (!done_with_ephemerons);
+
+	mono_sgen_scan_togglerefs (copy_func, start_addr, end_addr, queue);
+	if (generation == GENERATION_OLD)
+		mono_sgen_scan_togglerefs (copy_func, nursery_start, nursery_real_end, queue);
+
+	if (mono_sgen_need_bridge_processing ()) {
+		if (finalized_array == NULL) {
+			finalized_array_capacity = 32;
+			finalized_array = mono_sgen_alloc_internal_dynamic (sizeof (MonoObject*) * finalized_array_capacity, INTERNAL_MEM_BRIDGE_DATA);
+		}
+		finalized_array_entries = 0;		
+
+		collect_bridge_objects (copy_func, start_addr, end_addr, generation, queue);
+		if (generation == GENERATION_OLD)
+			collect_bridge_objects (copy_func, nursery_start, nursery_real_end, GENERATION_NURSERY, queue);
+
+		if (finalized_array_entries > 0) {
+			mono_sgen_bridge_processing_register_objects (finalized_array_entries, finalized_array);
+			finalized_array_entries = 0;
+		}
+		drain_gray_stack (queue);
+	}
+
+	/*
 	We must clear weak links that don't track resurrection before processing object ready for
 	finalization so they can be cleared before that.
 	*/
@@ -2504,11 +2581,6 @@ finish_gray_stack (char *start_addr, char *end_addr, int generation, GrayQueue *
 	if (generation == GENERATION_OLD)
 		null_link_in_range (copy_func, start_addr, end_addr, GENERATION_NURSERY, TRUE, queue);
 
-	if (finalized_array == NULL && mono_sgen_need_bridge_processing ()) {
-		finalized_array_capacity = 32;
-		finalized_array = mono_sgen_alloc_internal_dynamic (sizeof (MonoObject*) * finalized_array_capacity, INTERNAL_MEM_BRIDGE_DATA);
-	}
-	finalized_array_entries = 0;
 
 	/* walk the finalization queue and move also the objects that need to be
 	 * finalized: use the finalized objects as new roots so the objects they depend
@@ -2519,30 +2591,13 @@ finish_gray_stack (char *start_addr, char *end_addr, int generation, GrayQueue *
 	 */
 	num_loops = 0;
 	do {
-		/*
-		 * Walk the ephemeron tables marking all values with reachable keys. This must be completely done
-		 * before processing finalizable objects to avoid finalizing reachable values.
-		 *
-		 * It must be done inside the finalizaters loop since objects must not be removed from CWT tables
-		 * while they are been finalized.
-		 */
-		int done_with_ephemerons = 0;
-		do {
-			done_with_ephemerons = mark_ephemerons_in_range (copy_func, start_addr, end_addr, queue);
-			drain_gray_stack (queue);
-			++ephemeron_rounds;
-		} while (!done_with_ephemerons);
-
 		fin_ready = num_ready_finalizers;
 		finalize_in_range (copy_func, start_addr, end_addr, generation, queue);
 		if (generation == GENERATION_OLD)
 			finalize_in_range (copy_func, nursery_start, nursery_real_end, GENERATION_NURSERY, queue);
 
-		if (fin_ready != num_ready_finalizers) {
+		if (fin_ready != num_ready_finalizers)
 			++num_loops;
-			if (finalized_array != NULL)
-				mono_sgen_bridge_processing (finalized_array_entries, finalized_array);
-		}
 
 		/* drain the new stack that might have been created */
 		DEBUG (6, fprintf (gc_debug_file, "Precise scan of gray area post fin\n"));
@@ -2553,6 +2608,16 @@ finish_gray_stack (char *start_addr, char *end_addr, int generation, GrayQueue *
 		g_assert (num_loops <= 1);
 
 	/*
+	 * This must be done again after processing finalizable objects since CWL slots are cleared only after the key is finalized.
+	 */
+	done_with_ephemerons = 0;
+	do {
+		done_with_ephemerons = mark_ephemerons_in_range (copy_func, start_addr, end_addr, queue);
+		drain_gray_stack (queue);
+		++ephemeron_rounds;
+	} while (!done_with_ephemerons);
+
+	/*
 	 * Clear ephemeron pairs with unreachable keys.
 	 * We pass the copy func so we can figure out if an array was promoted or not.
 	 */
@@ -3403,6 +3468,7 @@ major_collection (const char *reason)
 		return;
 	}
 
+	major_collection_hapenned = TRUE;
 	current_collection_generation = GENERATION_OLD;
 	major_do_collection (reason);
 	current_collection_generation = -1;
@@ -4028,6 +4094,13 @@ mono_gc_alloc_mature (MonoVTable *vtable)
  */
 #define object_is_fin_ready(obj) (!object_is_pinned (obj) && !object_is_forwarded (obj))
 
+
+gboolean
+mono_sgen_gc_is_object_ready_for_finalization (void *object)
+{
+	return !major_collector.is_object_live (object) && object_is_fin_ready (object);
+}
+
 static gboolean
 is_critical_finalizer (FinalizeEntry *entry)
 {
@@ -4037,7 +4110,7 @@ is_critical_finalizer (FinalizeEntry *entry)
 	if (!mono_defaults.critical_finalizer_object)
 		return FALSE;
 
-	obj = entry->object;
+	obj = finalize_entry_get_object (entry);
 	class = ((MonoVTable*)LOAD_VTABLE (obj))->klass;
 
 	return mono_class_has_parent (class, mono_defaults.critical_finalizer_object);
@@ -4069,7 +4142,7 @@ rehash_fin_table (FinalizeEntryHashTable *hash_table)
 	new_hash = mono_sgen_alloc_internal_dynamic (new_size * sizeof (FinalizeEntry*), INTERNAL_MEM_FIN_TABLE);
 	for (i = 0; i < finalizable_hash_size; ++i) {
 		for (entry = finalizable_hash [i]; entry; entry = next) {
-			hash = mono_object_hash (entry->object) % new_size;
+			hash = mono_object_hash (finalize_entry_get_object (entry)) % new_size;
 			next = entry->next;
 			entry->next = new_hash [hash];
 			new_hash [hash] = entry;
@@ -4088,6 +4161,99 @@ rehash_fin_table_if_necessary (FinalizeEntryHashTable *hash_table)
 		rehash_fin_table (hash_table);
 }
 
+
+
+/* LOCKING: requires that the GC lock is held */
+void
+mono_sgen_mark_bridge_object (MonoObject *obj)
+{
+	FinalizeEntryHashTable *hash_table = get_finalize_entry_hash_table (ptr_in_nursery (obj) ? GENERATION_NURSERY : GENERATION_OLD);
+	FinalizeEntry **finalizable_hash = hash_table->table;
+	FinalizeEntry *entry;
+	unsigned int hash;
+
+	hash = mono_object_hash (obj);
+	hash %= hash_table->size;
+
+	for (entry = finalizable_hash [hash]; entry; entry = entry->next) {
+		if (finalize_entry_get_object (entry) == obj)
+			finalize_entry_set_object (entry, obj, TRUE);
+	}
+}
+
+/* LOCKING: requires that the GC lock is held */
+static void
+collect_bridge_objects (CopyOrMarkObjectFunc copy_func, char *start, char *end, int generation, GrayQueue *queue)
+{
+	FinalizeEntryHashTable *hash_table = get_finalize_entry_hash_table (generation);
+	FinalizeEntry *entry, *prev;
+	int i;
+	FinalizeEntry **finalizable_hash = hash_table->table;
+	mword finalizable_hash_size = hash_table->size;
+
+	if (no_finalize)
+		return;
+
+	for (i = 0; i < finalizable_hash_size; ++i) {
+		prev = NULL;
+		for (entry = finalizable_hash [i]; entry;) {
+			MonoObject *object = finalize_entry_get_object (entry);
+			gboolean ignore_obj = finalize_entry_get_bridge_bit (entry);
+			char *copy;
+
+			/* Bridge code told us to ignore this one */
+			if (ignore_obj)
+				goto next_step;
+
+			/* Object is a bridge object and major heap says it's dead  */
+			if (!((char*)object >= start && (char*)object < end && !major_collector.is_object_live ((char*)object)))
+				goto next_step;
+
+			/* Nursery says the object is dead. */
+			if (!object_is_fin_ready (object))
+				goto next_step;
+
+			if (!mono_sgen_is_bridge_object (object))
+				goto next_step;
+
+			copy = (char*)object;
+			copy_func ((void**)&copy, queue);
+
+			bridge_register_finalized_object ((MonoObject*)copy);
+
+			if (hash_table == &minor_finalizable_hash && !ptr_in_nursery (copy)) {
+				FinalizeEntry *next = entry->next;
+				unsigned int major_hash;
+				/* remove from the list */
+				if (prev)
+					prev->next = entry->next;
+				else
+					finalizable_hash [i] = entry->next;
+				hash_table->num_registered--;
+
+				finalize_entry_set_object (entry, (MonoObject*)copy, ignore_obj);
+
+				/* insert it into the major hash */
+				rehash_fin_table_if_necessary (&major_finalizable_hash);
+				major_hash = mono_object_hash ((MonoObject*) copy) %
+					major_finalizable_hash.size;
+				entry->next = major_finalizable_hash.table [major_hash];
+				major_finalizable_hash.table [major_hash] = entry;
+				major_finalizable_hash.num_registered++;
+
+				entry = next;
+				continue;
+			} else {
+				/* update pointer */
+				finalize_entry_set_object (entry, (MonoObject*)copy, ignore_obj);
+			}
+next_step:
+			prev = entry;
+			entry = entry->next;
+		}
+	}
+}
+
 /* LOCKING: requires that the GC lock is held */
 static void
 finalize_in_range (CopyOrMarkObjectFunc copy_func, char *start, char *end, int generation, GrayQueue *queue)
@@ -4103,16 +4269,19 @@ finalize_in_range (CopyOrMarkObjectFunc copy_func, char *start, char *end, int g
 	for (i = 0; i < finalizable_hash_size; ++i) {
 		prev = NULL;
 		for (entry = finalizable_hash [i]; entry;) {
-			if ((char*)entry->object >= start && (char*)entry->object < end && !major_collector.is_object_live (entry->object)) {
-				gboolean is_fin_ready = object_is_fin_ready (entry->object);
-				char *copy = entry->object;
+			MonoObject *object = finalize_entry_get_object (entry);
+			gboolean bridge_bit = finalize_entry_get_bridge_bit (entry);
+
+			if ((char*)object >= start && (char*)object < end && !major_collector.is_object_live ((char*)object)) {
+				gboolean is_fin_ready = object_is_fin_ready (object);
+				char *copy = (char*)object;
 				copy_func ((void**)&copy, queue);
 				if (is_fin_ready) {
 					char *from;
 					FinalizeEntry *next;
 					/* Make it survive */
-					from = entry->object;
-					entry->object = copy;
+					from = (char*)object;
+					finalize_entry_set_object (entry, (MonoObject*)copy, bridge_bit);
 					/* remove and put in fin_ready_list */
 					if (prev)
 						prev->next = entry->next;
@@ -4122,12 +4291,11 @@ finalize_in_range (CopyOrMarkObjectFunc copy_func, char *start, char *end, int g
 					num_ready_finalizers++;
 					hash_table->num_registered--;
 					queue_finalization_entry (entry);
-					bridge_register_finalized_object ((MonoObject*)copy);
-					DEBUG (5, fprintf (gc_debug_file, "Queueing object for finalization: %p (%s) (was at %p) (%d/%d)\n", entry->object, safe_name (entry->object), from, num_ready_finalizers, hash_table->num_registered));
+					DEBUG (5, fprintf (gc_debug_file, "Queueing object for finalization: %p (%s) (was at %p) (%d/%d)\n", object, safe_name (object), from, num_ready_finalizers, hash_table->num_registered));
 					entry = next;
 					continue;
 				} else {
-					char *from = entry->object;
+					char *from = (char*)object;
 					if (hash_table == &minor_finalizable_hash && !ptr_in_nursery (copy)) {
 						FinalizeEntry *next = entry->next;
 						unsigned int major_hash;
@@ -4138,7 +4306,7 @@ finalize_in_range (CopyOrMarkObjectFunc copy_func, char *start, char *end, int g
 							finalizable_hash [i] = entry->next;
 						hash_table->num_registered--;
 
-						entry->object = copy;
+						finalize_entry_set_object (entry, (MonoObject*)copy, bridge_bit);
 
 						/* insert it into the major hash */
 						rehash_fin_table_if_necessary (&major_finalizable_hash);
@@ -4154,8 +4322,8 @@ finalize_in_range (CopyOrMarkObjectFunc copy_func, char *start, char *end, int g
 						continue;
 					} else {
 						/* update pointer */
-						DEBUG (5, fprintf (gc_debug_file, "Updating object for finalization: %p (%s) (was at %p)\n", entry->object, safe_name (entry->object), from));
-						entry->object = copy;
+						DEBUG (5, fprintf (gc_debug_file, "Updating object for finalization: %p (%s) (was at %p)\n", object, safe_name (object), from));
+						finalize_entry_set_object (entry, (MonoObject*)copy, bridge_bit);
 					}
 				}
 			}
@@ -4299,9 +4467,15 @@ mark_ephemerons_in_range (CopyOrMarkObjectFunc copy_func, char *start, char *end
 		char *object = current->array;
 		DEBUG (5, fprintf (gc_debug_file, "Ephemeron array at %p\n", object));
 
-		/*We ignore arrays in old gen during minor collections since all objects are promoted by the remset machinery.*/
-		if (object < start || object >= end)
-			continue;
+		/*
+		For now we process all ephemerons during all collections.
+		Ideally we should use remset information to partially scan those
+		arrays.
+		We already emit write barriers for Ephemeron fields, it's
+		just that we don't process them.
+		*/
+		/*if (object < start || object >= end)
+			continue;*/
 
 		/*It has to be alive*/
 		if (!object_is_reachable (object, start, end)) {
@@ -4359,6 +4533,16 @@ null_link_in_range (CopyOrMarkObjectFunc copy_func, char *start, char *end, int
 		for (entry = disappearing_link_hash [i]; entry;) {
 			char *object;
 			gboolean track = DISLINK_TRACK (entry);
+
+			/*
+			 * Tracked references are processed after
+			 * finalization handling whereas standard weak
+			 * references are processed before.  If an
+			 * object is still not marked after finalization
+			 * handling it means that it either doesn't have
+			 * a finalizer or the finalizer has already run,
+			 * so we must null a tracking reference.
+			 */
 			if (track == before_finalization) {
 				prev = entry;
 				entry = entry->next;
@@ -4368,7 +4552,7 @@ null_link_in_range (CopyOrMarkObjectFunc copy_func, char *start, char *end, int
 			object = DISLINK_OBJECT (entry);
 
 			if (object >= start && object < end && !major_collector.is_object_live (object)) {
-				if (!track && object_is_fin_ready (object)) {
+				if (object_is_fin_ready (object)) {
 					void **p = entry->link;
 					DisappearingLink *old;
 					*p = NULL;
@@ -4415,14 +4599,7 @@ null_link_in_range (CopyOrMarkObjectFunc copy_func, char *start, char *end, int
 
 						continue;
 					} else {
-						/* We set the track resurrection bit to
-						 * FALSE if the object is to be finalized
-						 * so that the object can be collected in
-						 * the next cycle (i.e. after it was
-						 * finalized).
-						 */
-						*entry->link = HIDE_POINTER (copy,
-							object_is_fin_ready (object) ? FALSE : track);
+						*entry->link = HIDE_POINTER (copy, track);
 						DEBUG (5, fprintf (gc_debug_file, "Updated dislink at %p to %p\n", entry->link, DISLINK_OBJECT (entry)));
 					}
 				}
@@ -4486,7 +4663,8 @@ finalizers_for_domain (MonoDomain *domain, MonoObject **out_array, int out_size,
 	for (i = 0; i < finalizable_hash_size; ++i) {
 		prev = NULL;
 		for (entry = finalizable_hash [i]; entry;) {
-			if (mono_object_domain (entry->object) == domain) {
+			MonoObject *object = finalize_entry_get_object (entry);
+			if (mono_object_domain (object) == domain) {
 				FinalizeEntry *next;
 				/* remove and put in out_array */
 				if (prev)
@@ -4495,8 +4673,8 @@ finalizers_for_domain (MonoDomain *domain, MonoObject **out_array, int out_size,
 					finalizable_hash [i] = entry->next;
 				next = entry->next;
 				hash_table->num_registered--;
-				out_array [count ++] = entry->object;
-				DEBUG (5, fprintf (gc_debug_file, "Collecting object for finalization: %p (%s) (%d/%d)\n", entry->object, safe_name (entry->object), num_ready_finalizers, hash_table->num_registered));
+				out_array [count ++] = object;
+				DEBUG (5, fprintf (gc_debug_file, "Collecting object for finalization: %p (%s) (%d/%d)\n", object, safe_name (object), num_ready_finalizers, hash_table->num_registered));
 				entry = next;
 				if (count == out_size)
 					return count;
@@ -4557,7 +4735,7 @@ register_for_finalization (MonoObject *obj, void *user_data, int generation)
 	hash %= finalizable_hash_size;
 	prev = NULL;
 	for (entry = finalizable_hash [hash]; entry; entry = entry->next) {
-		if (entry->object == obj) {
+		if (finalize_entry_get_object (entry) == obj) {
 			if (!user_data) {
 				/* remove from the list */
 				if (prev)
@@ -4579,7 +4757,7 @@ register_for_finalization (MonoObject *obj, void *user_data, int generation)
 		return;
 	}
 	entry = mono_sgen_alloc_internal (INTERNAL_MEM_FINALIZE_ENTRY);
-	entry->object = obj;
+	finalize_entry_set_object (entry, obj, FALSE);
 	entry->next = finalizable_hash [hash];
 	finalizable_hash [hash] = entry;
 	hash_table->num_registered++;
@@ -4716,21 +4894,21 @@ mono_gc_invoke_finalizers (void)
 		}
 
 		/* Now look for the first non-null entry. */
-		for (entry = fin_ready_list; entry && !entry->object; entry = entry->next)
+		for (entry = fin_ready_list; entry && !finalize_entry_get_object (entry); entry = entry->next)
 			;
 		if (entry) {
 			entry_is_critical = FALSE;
 		} else {
 			entry_is_critical = TRUE;
-			for (entry = critical_fin_list; entry && !entry->object; entry = entry->next)
+			for (entry = critical_fin_list; entry && !finalize_entry_get_object (entry); entry = entry->next)
 				;
 		}
 
 		if (entry) {
-			g_assert (entry->object);
+			obj = finalize_entry_get_object (entry);
+			g_assert (obj);
 			num_ready_finalizers--;
-			obj = entry->object;
-			entry->object = NULL;
+			finalize_entry_set_object (entry, NULL, FALSE);
 			DEBUG (7, fprintf (gc_debug_file, "Finalizing object %p (%s)\n", obj, safe_name (obj)));
 		}
 
@@ -4739,7 +4917,7 @@ mono_gc_invoke_finalizers (void)
 		if (!entry)
 			break;
 
-		g_assert (entry->object == NULL);
+		g_assert (finalize_entry_get_object (entry) == NULL);
 		count++;
 		/* the object is on the stack so it is pinned */
 		/*g_print ("Calling finalizer for object: %p (%s)\n", entry->object, safe_name (entry->object));*/
@@ -5185,6 +5363,9 @@ stop_world (int generation)
 {
 	int count;
 
+	/*XXX this is the right stop, thought might not be the nicest place to put it*/
+	mono_sgen_process_togglerefs ();
+
 	mono_profiler_gc_event (MONO_GC_EVENT_PRE_STOP_WORLD, generation);
 	acquire_gc_locks ();
 
@@ -5198,6 +5379,10 @@ stop_world (int generation)
 	g_assert (count >= 0);
 	DEBUG (3, fprintf (gc_debug_file, "world stopped %d thread(s)\n", count));
 	mono_profiler_gc_event (MONO_GC_EVENT_POST_STOP_WORLD, generation);
+
+	last_major_num_sections = major_collector.get_num_major_sections ();
+	last_los_memory_usage = los_memory_usage;
+	major_collection_hapenned = FALSE;
 	return count;
 }
 
@@ -5205,10 +5390,11 @@ stop_world (int generation)
 static int
 restart_world (int generation)
 {
-	int count, i;
+	int count, i, num_major_sections;
 	SgenThreadInfo *info;
 	TV_DECLARE (end_sw);
-	unsigned long usec;
+	TV_DECLARE (end_bridge);
+	unsigned long usec, bridge_usec;
 
 	/* notify the profiler of the leftovers */
 	if (G_UNLIKELY (mono_profiler_events & MONO_PROFILE_GC_MOVES)) {
@@ -5225,6 +5411,7 @@ restart_world (int generation)
 		}
 	}
 
+	stw_bridge_process ();
 	release_gc_locks ();
 
 	count = mono_sgen_thread_handshake (restart_signal_num);
@@ -5233,6 +5420,28 @@ restart_world (int generation)
 	max_pause_usec = MAX (usec, max_pause_usec);
 	DEBUG (2, fprintf (gc_debug_file, "restarted %d thread(s) (pause time: %d usec, max: %d)\n", count, (int)usec, (int)max_pause_usec));
 	mono_profiler_gc_event (MONO_GC_EVENT_POST_START_WORLD, generation);
+
+	bridge_process ();
+
+	TV_GETTIME (end_bridge);
+	bridge_usec = TV_ELAPSED (end_sw, end_bridge);
+
+	num_major_sections = major_collector.get_num_major_sections ();
+	if (major_collection_hapenned)
+		mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_GC, "GC_MAJOR: %s pause %.2fms, bridge %.2fms major %dK/%dK los %dK/%dK",
+			generation ? "" : "(minor overflow)",
+			(int)usec / 1000.0f, (int)bridge_usec / 1000.0f,
+			major_collector.section_size * num_major_sections / 1024,
+			major_collector.section_size * last_major_num_sections / 1024,
+			los_memory_usage / 1024,
+			last_los_memory_usage / 1024);
+	else
+		mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_GC, "GC_MINOR: pause %.2fms, bridge %.2fms promoted %dK major %dK los %dK",
+			(int)usec / 1000.0f, (int)bridge_usec / 1000.0f,
+			(num_major_sections - last_major_num_sections) * major_collector.section_size / 1024,
+			major_collector.section_size * num_major_sections / 1024,
+			los_memory_usage / 1024);
+
 	return count;
 }
 
@@ -5404,10 +5613,9 @@ handle_remset (mword *p, void *start_nursery, void *end_nursery, gboolean global
 		ptr = (void**)(*p & ~REMSET_TYPE_MASK);
 		if (((void*)ptr >= start_nursery && (void*)ptr < end_nursery))
 			return p + 3;
-		desc = p [1];
 		count = p [2];
 		while (count-- > 0)
-			ptr = (void**) major_collector.minor_scan_vtype ((char*)ptr, desc, start_nursery, end_nursery, queue);
+			ptr = (void**) major_collector.minor_scan_vtype ((char*)ptr, (MonoClass*)p [1], start_nursery, end_nursery, queue);
 		return p + 3;
 	}
 	default:
@@ -6336,7 +6544,7 @@ mono_gc_wbarrier_value_copy (gpointer dest, gpointer src, int count, MonoClass *
 
 		if (rs->store_next + 3 < rs->end_set) {
 			*(rs->store_next++) = (mword)dest | REMSET_VTYPE;
-			*(rs->store_next++) = (mword)klass->gc_descr;
+			*(rs->store_next++) = (mword)klass;
 			*(rs->store_next++) = (mword)count;
 			UNLOCK_GC;
 			return;
@@ -6348,7 +6556,7 @@ mono_gc_wbarrier_value_copy (gpointer dest, gpointer src, int count, MonoClass *
 		mono_sgen_thread_info_lookup (ARCH_GET_THREAD ())->remset = rs;
 #endif
 		*(rs->store_next++) = (mword)dest | REMSET_VTYPE;
-		*(rs->store_next++) = (mword)klass->gc_descr;
+		*(rs->store_next++) = (mword)klass;
 		*(rs->store_next++) = (mword)count;
 	}
 	UNLOCK_GC;
@@ -6492,7 +6700,7 @@ find_in_remset_loc (mword *p, char *addr, gboolean *found)
 		return p + 1;
 	case REMSET_VTYPE:
 		ptr = (void**)(*p & ~REMSET_TYPE_MASK);
-		desc = p [1];
+		desc = ((MonoClass*)p [1])->gc_descr;
 		count = p [2];
 
 		switch (desc & 0x7) {
@@ -7911,4 +8119,16 @@ mono_sgen_get_logfile (void)
 	return gc_debug_file;
 }
 
+void
+mono_sgen_gc_lock (void)
+{
+	LOCK_GC;
+}
+
+void
+mono_sgen_gc_unlock (void)
+{
+	UNLOCK_GC;
+}
+
 #endif /* HAVE_SGEN_GC */
diff --git a/mono/metadata/sgen-gc.h b/mono/metadata/sgen-gc.h
index 88ab4ba..c8fd747 100644
--- a/mono/metadata/sgen-gc.h
+++ b/mono/metadata/sgen-gc.h
@@ -415,10 +415,10 @@ enum {
 		}	\
 	} while (0)
 
-#define OBJ_LARGE_BITMAP_FOREACH_PTR(vt,obj)	do {	\
+#define OBJ_LARGE_BITMAP_FOREACH_PTR(desc,obj)	do {	\
 		/* there are pointers */	\
 		void **_objptr = (void**)(obj);	\
-		gsize _bmap = (vt)->desc >> LOW_TYPE_BITS;	\
+		gsize _bmap = (desc) >> LOW_TYPE_BITS;	\
 		_objptr += OBJECT_HEADER_WORDS;	\
 		while (_bmap) {	\
 			if ((_bmap & 1)) {	\
@@ -429,18 +429,18 @@ enum {
 		}	\
 	} while (0)
 
-gsize* mono_sgen_get_complex_descriptor (GCVTable *vt) MONO_INTERNAL;
+gsize* mono_sgen_get_complex_descriptor (mword desc) MONO_INTERNAL;
 
-#define OBJ_COMPLEX_FOREACH_PTR(vt,obj)	do {	\
+#define OBJ_COMPLEX_FOREACH_PTR(desc,obj)	do {	\
 		/* there are pointers */	\
 		void **_objptr = (void**)(obj);	\
-		gsize *bitmap_data = mono_sgen_get_complex_descriptor ((vt)); \
+		gsize *bitmap_data = mono_sgen_get_complex_descriptor (desc); \
 		int bwords = (*bitmap_data) - 1;	\
 		void **start_run = _objptr;	\
 		bitmap_data++;	\
 		if (0) {	\
 			MonoObject *myobj = (MonoObject*)obj;	\
-			g_print ("found %d at %p (0x%zx): %s.%s\n", bwords, (obj), (vt)->desc, myobj->vtable->klass->name_space, myobj->vtable->klass->name);	\
+			g_print ("found %d at %p (0x%zx): %s.%s\n", bwords, (obj), desc, myobj->vtable->klass->name_space, myobj->vtable->klass->name);	\
 		}	\
 		while (bwords-- > 0) {	\
 			gsize _bmap = *bitmap_data++;	\
@@ -460,7 +460,7 @@ gsize* mono_sgen_get_complex_descriptor (GCVTable *vt) MONO_INTERNAL;
 /* this one is untested */
 #define OBJ_COMPLEX_ARR_FOREACH_PTR(vt,obj)	do {	\
 		/* there are pointers */	\
-		gsize *mbitmap_data = mono_sgen_get_complex_descriptor ((vt)); \
+		gsize *mbitmap_data = mono_sgen_get_complex_descriptor ((vt)->desc); \
 		int mbwords = (*mbitmap_data++) - 1;	\
 		int el_size = mono_array_element_size (vt->klass);	\
 		char *e_start = (char*)(obj) +  G_STRUCT_OFFSET (MonoArray, vector);	\
@@ -634,6 +634,7 @@ enum {
 	INTERNAL_MEM_EPHEMERON_LINK,
 	INTERNAL_MEM_WORKER_DATA,
 	INTERNAL_MEM_BRIDGE_DATA,
+	INTERNAL_MEM_TOGGLEREF_DATA,
 	INTERNAL_MEM_MAX
 };
 
@@ -720,7 +721,7 @@ struct _SgenMajorCollector {
 	void* (*alloc_degraded) (MonoVTable *vtable, size_t size);
 	void (*copy_or_mark_object) (void **obj_slot, SgenGrayQueue *queue);
 	void (*minor_scan_object) (char *start, SgenGrayQueue *queue);
-	char* (*minor_scan_vtype) (char *start, mword desc, char* from_start, char* from_end, SgenGrayQueue *queue);
+	char* (*minor_scan_vtype) (char *start, MonoClass *klass, char* from_start, char* from_end, SgenGrayQueue *queue);
 	void (*major_scan_object) (char *start, SgenGrayQueue *queue);
 	void (*copy_object) (void **obj_slot, SgenGrayQueue *queue);
 	void* (*alloc_object) (int size, gboolean has_references);
@@ -802,7 +803,21 @@ const char* mono_sgen_safe_name (void* obj) MONO_INTERNAL;
 gboolean mono_sgen_object_is_live (void *obj) MONO_INTERNAL;
 
 gboolean mono_sgen_need_bridge_processing (void) MONO_INTERNAL;
-void mono_sgen_bridge_processing (int num_objs, MonoObject **objs) MONO_INTERNAL;
+void mono_sgen_bridge_processing_register_objects (int num_objs, MonoObject **objs) MONO_INTERNAL;
+void mono_sgen_bridge_processing_stw_step (void) MONO_INTERNAL;
+void mono_sgen_bridge_processing_finish (void) MONO_INTERNAL;
+void mono_sgen_register_test_bridge_callbacks (void) MONO_INTERNAL;
+gboolean mono_sgen_is_bridge_object (MonoObject *obj) MONO_INTERNAL;
+void mono_sgen_mark_bridge_object (MonoObject *obj) MONO_INTERNAL;
+
+typedef void (*CopyOrMarkObjectFunc) (void**, SgenGrayQueue*);
+void mono_sgen_scan_togglerefs (CopyOrMarkObjectFunc copy_func, char *start, char *end, SgenGrayQueue *queue) MONO_INTERNAL;
+void mono_sgen_process_togglerefs (void) MONO_INTERNAL;
+
+
+gboolean mono_sgen_gc_is_object_ready_for_finalization (void *object) MONO_INTERNAL;
+void mono_sgen_gc_lock (void) MONO_INTERNAL;
+void mono_sgen_gc_unlock (void) MONO_INTERNAL;
 
 enum {
 	SPACE_MAJOR,
@@ -830,7 +845,6 @@ struct _LOSObject {
 
 extern LOSObject *los_object_list;
 extern mword los_memory_usage;
-extern mword last_los_memory_usage;
 
 void mono_sgen_los_free_object (LOSObject *obj) MONO_INTERNAL;
 void* mono_sgen_los_alloc_large_inner (MonoVTable *vtable, size_t size) MONO_INTERNAL;
diff --git a/mono/metadata/sgen-internal.c b/mono/metadata/sgen-internal.c
index 2f7b7ce..d4cd98f 100644
--- a/mono/metadata/sgen-internal.c
+++ b/mono/metadata/sgen-internal.c
@@ -495,7 +495,7 @@ mono_sgen_dump_internal_mem_usage (FILE *heap_dump_file)
 						     "dislink", "roots-table", "root-record", "statistics",
 						     "remset", "gray-queue", "store-remset", "marksweep-tables",
 						     "marksweep-block-info", "ephemeron-link", "worker-data",
-						     "bridge-data" };
+						     "bridge-data", "toggleref-data" };
 
 	int i;
 
diff --git a/mono/metadata/sgen-major-scan-object.h b/mono/metadata/sgen-major-scan-object.h
index ec79a1c..9aa215e 100644
--- a/mono/metadata/sgen-major-scan-object.h
+++ b/mono/metadata/sgen-major-scan-object.h
@@ -58,9 +58,10 @@ minor_scan_object (char *start, SgenGrayQueue *queue)
  * Returns a pointer to the end of the object.
  */
 static char*
-minor_scan_vtype (char *start, mword desc, char* from_start, char* from_end, SgenGrayQueue *queue)
+minor_scan_vtype (char *start, MonoClass* klass, char* from_start, char* from_end, SgenGrayQueue *queue)
 {
 	size_t skip_size;
+	mword desc = (mword)klass->gc_descr;
 
 	/* The descriptors include info about the MonoObject header as well */
 	start -= sizeof (MonoObject);
@@ -76,9 +77,14 @@ minor_scan_vtype (char *start, mword desc, char* from_start, char* from_end, Sge
 		OBJ_BITMAP_SIZE (skip_size, desc, start);
 		return start + skip_size;
 	case DESC_TYPE_LARGE_BITMAP:
+		OBJ_LARGE_BITMAP_FOREACH_PTR (desc,start);
+		skip_size = klass->instance_size;
+		return start + skip_size;
+		break;
 	case DESC_TYPE_COMPLEX:
-		// FIXME:
-		g_assert_not_reached ();
+		OBJ_COMPLEX_FOREACH_PTR (desc,start);
+		skip_size = klass->instance_size;
+		return start + skip_size;
 		break;
 	default:
 		// The other descriptors can't happen with vtypes
diff --git a/mono/metadata/sgen-os-mach.c b/mono/metadata/sgen-os-mach.c
index dc3d58c..876810c 100644
--- a/mono/metadata/sgen-os-mach.c
+++ b/mono/metadata/sgen-os-mach.c
@@ -66,7 +66,7 @@ mono_sgen_suspend_thread (SgenThreadInfo *info)
 	mono_mach_arch_thread_state_to_mcontext (state, mctx);
 	ctx.uc_mcontext = mctx;
 
-	info->stopped_domain = mono_mach_arch_get_tls_value_from_thread ((pthread_t)info->id, mono_pthread_key_for_tls (mono_domain_get_tls_key ()));
+	info->stopped_domain = mono_mach_arch_get_tls_value_from_thread ((pthread_t)info->id, mono_domain_get_native_tls_key ());
 	info->stopped_ip = (gpointer) mono_mach_arch_get_ip (state);
 	stack_start = (char*) mono_mach_arch_get_sp (state) - REDZONE_SIZE;
 	/* If stack_start is not within the limits, then don't set it in info and we will be restarted. */
diff --git a/mono/metadata/sgen-scan-object.h b/mono/metadata/sgen-scan-object.h
index d5a637e..92720e8 100644
--- a/mono/metadata/sgen-scan-object.h
+++ b/mono/metadata/sgen-scan-object.h
@@ -80,7 +80,7 @@
 #undef SCAN
 		break;
 	case DESC_TYPE_LARGE_BITMAP:
-#define SCAN OBJ_LARGE_BITMAP_FOREACH_PTR (vt,start)
+#define SCAN OBJ_LARGE_BITMAP_FOREACH_PTR (desc,start)
 #ifndef SCAN_OBJECT_NOSCAN
 		SCAN;
 #endif
@@ -89,7 +89,7 @@
 		break;
 	case DESC_TYPE_COMPLEX:
 		/* this is a complex object */
-#define SCAN OBJ_COMPLEX_FOREACH_PTR (vt, start)
+#define SCAN OBJ_COMPLEX_FOREACH_PTR (desc, start)
 #ifndef SCAN_OBJECT_NOSCAN
 		SCAN;
 #endif
diff --git a/mono/metadata/sgen-toggleref.c b/mono/metadata/sgen-toggleref.c
new file mode 100644
index 0000000..0665da7
--- /dev/null
+++ b/mono/metadata/sgen-toggleref.c
@@ -0,0 +1,198 @@
+/*
+ *
+ * sgen-toggleref.c: toggleref support for sgen
+ *
+ * Copyright 2011 Xamarin, Inc.
+ *
+ * Author:
+ *  Rodrigo Kumpera (kumpera at gmail.com)
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ * 
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#include "config.h"
+
+#ifdef HAVE_SGEN_GC
+
+#include "sgen-gc.h"
+#include "sgen-toggleref.h"
+
+
+/*only one of the two can be non null at a given time*/
+typedef struct {
+	void *strong_ref;
+	void *weak_ref;
+} MonoGCToggleRef;
+
+static MonoToggleRefStatus (*toggleref_callback) (MonoObject *obj);
+static MonoGCToggleRef *toggleref_array;
+static int toogleref_array_size;
+static int toogleref_array_capacity;
+
+void
+mono_sgen_process_togglerefs (void)
+{
+	int i, w;
+	int toggle_ref_counts [3] = { 0 };
+
+	DEBUG (4, fprintf (gc_debug_file, "Proccessing ToggleRefs %d\n", toogleref_array_size));
+
+	for (i = w = 0; i < toogleref_array_size; ++i) {
+		int res;
+		MonoGCToggleRef r = toggleref_array [i];
+
+		MonoObject *obj;
+
+		if (r.strong_ref)
+			obj = r.strong_ref;
+		else if (r.weak_ref)
+			obj = r.weak_ref;
+		else
+			continue;
+
+		res = toggleref_callback (obj);
+		++toggle_ref_counts [res];
+		switch (res) {
+		case MONO_TOGGLE_REF_DROP:
+			break;
+		case MONO_TOGGLE_REF_STRONG:
+			toggleref_array [w].strong_ref = obj;
+			toggleref_array [w].weak_ref = NULL;
+			++w;
+			break;
+		case MONO_TOGGLE_REF_WEAK:
+			toggleref_array [w].strong_ref = NULL;
+			toggleref_array [w].weak_ref = obj;
+			++w;
+			break;
+		default:
+			g_assert_not_reached ();
+		}
+	}
+
+	toogleref_array_size = w;
+
+	DEBUG (4, fprintf (gc_debug_file, "Done Proccessing ToggleRefs dropped %d strong %d weak %d final size %d\n",
+		toggle_ref_counts [MONO_TOGGLE_REF_DROP],
+		toggle_ref_counts [MONO_TOGGLE_REF_STRONG],
+		toggle_ref_counts [MONO_TOGGLE_REF_WEAK],
+		w));
+}
+
+void
+mono_sgen_scan_togglerefs (CopyOrMarkObjectFunc copy_func, char *start, char *end, SgenGrayQueue *queue)
+{
+	int i;
+
+	DEBUG (4, fprintf (gc_debug_file, "Scanning ToggleRefs %d\n", toogleref_array_size));
+
+	for (i = 0; i < toogleref_array_size; ++i) {
+		if (toggleref_array [i].strong_ref) {
+			char *object = toggleref_array [i].strong_ref;
+			if (object >= start && object < end) {
+				DEBUG (6, fprintf (gc_debug_file, "\tcopying strong slot %d\n", i));
+				copy_func (&toggleref_array [i].strong_ref, queue);
+			}
+		} else if (toggleref_array [i].weak_ref) {
+			char *object = toggleref_array [i].weak_ref;
+
+			if (object >= start && object < end) {
+				if (mono_sgen_gc_is_object_ready_for_finalization (object)) {
+					DEBUG (6, fprintf (gc_debug_file, "\tcleaning weak slot %d\n", i));
+					toggleref_array [i].weak_ref = NULL; /* We defer compaction to only happen on the callback step. */
+				} else {
+					DEBUG (6, fprintf (gc_debug_file, "\tkeeping weak slot %d\n", i));
+					copy_func (&toggleref_array [i].weak_ref, queue);
+				}
+			}
+		}
+	}
+}
+
+static void
+ensure_toggleref_capacity (int capacity)
+{
+	if (!toggleref_array) {
+		toogleref_array_capacity = 32;
+		toggleref_array = mono_sgen_alloc_internal_dynamic (
+			toogleref_array_capacity * sizeof (MonoGCToggleRef),
+			INTERNAL_MEM_TOGGLEREF_DATA);	
+	}
+	if (toogleref_array_size + capacity >= toogleref_array_capacity) {
+		MonoGCToggleRef *tmp;
+		int old_capacity = toogleref_array_capacity;
+		while (toogleref_array_capacity < toogleref_array_size + capacity)
+			toogleref_array_size *= 2;
+		
+		tmp = mono_sgen_alloc_internal_dynamic (
+			toogleref_array_capacity * sizeof (MonoGCToggleRef),
+			INTERNAL_MEM_TOGGLEREF_DATA);
+
+		memcpy (tmp, toggleref_array, toogleref_array_size * sizeof (MonoGCToggleRef));
+
+		mono_sgen_free_internal_dynamic (toggleref_array, old_capacity * sizeof (MonoGCToggleRef), INTERNAL_MEM_TOGGLEREF_DATA);
+		toggleref_array = tmp;
+	}
+}
+
+/**
+ * mono_gc_toggleref_add:
+ * @object object to register for toggleref processing
+ * @strong_ref if true the object is registered with a strong ref, a weak one otherwise
+ *
+ * Register a given object for toggleref processing. It will be stored internally and the toggleref callback will be called
+ * on it until it returns MONO_TOGGLE_REF_DROP or is collected.
+*/
+void
+mono_gc_toggleref_add (MonoObject *object, mono_bool strong_ref)
+{
+	if (!toggleref_callback)
+		return;
+
+	DEBUG (4, fprintf (gc_debug_file, "Adding toggleref %p %d\n", object, strong_ref));
+
+	mono_sgen_gc_lock ();
+
+	ensure_toggleref_capacity (1);
+	if (strong_ref)
+		toggleref_array [toogleref_array_size++].strong_ref = object;
+	else
+		toggleref_array [toogleref_array_size++].weak_ref = object;
+
+	mono_sgen_gc_unlock ();
+}
+
+/**
+ * mono_gc_toggleref_register_callback:
+ * @callback callback used to determine the new state of the given object.
+ *
+ * The callback must decide the status of a given object. It must return one of the values in the MONO_TOGGLE_REF_ enum.
+ * This function is called with the world running but with the GC locked. This means that you can do everything that doesn't
+ * require GC interaction. This includes, but not limited to, allocating objects, (de)registering for finalization, manipulating
+ *gchandles, storing to reference fields or interacting with other threads that might perform such operations.
+ */
+void
+mono_gc_toggleref_register_callback (MonoToggleRefStatus (*proccess_toggleref) (MonoObject *obj))
+{
+	toggleref_callback = proccess_toggleref;
+}
+
+#endif
diff --git a/mono/metadata/sgen-toggleref.h b/mono/metadata/sgen-toggleref.h
new file mode 100644
index 0000000..b7cce12
--- /dev/null
+++ b/mono/metadata/sgen-toggleref.h
@@ -0,0 +1,51 @@
+/*
+ *
+ * sgen-toggleref.h: toggleref support for sgen
+ *
+ * Copyright 2011 Xamarin, Inc.
+ *
+ * Author:
+ *  Rodrigo Kumpera (kumpera at gmail.com)
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ * 
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef _MONO_SGEN_TOGGLEREF_H_
+#define _MONO_SGEN_TOGGLEREF_H_
+
+#include <mono/utils/mono-publib.h>
+
+MONO_BEGIN_DECLS
+
+/* GC toggle ref support */
+
+typedef enum {
+	MONO_TOGGLE_REF_DROP,
+	MONO_TOGGLE_REF_STRONG,
+	MONO_TOGGLE_REF_WEAK
+} MonoToggleRefStatus;
+
+void mono_gc_toggleref_register_callback (MonoToggleRefStatus (*proccess_toggleref) (MonoObject *obj));
+void mono_gc_toggleref_add (MonoObject *object, mono_bool strong_ref);
+
+
+MONO_END_DECLS
+
+#endif
diff --git a/mono/metadata/threadpool.c b/mono/metadata/threadpool.c
index 81a73e1..864c8e0 100644
--- a/mono/metadata/threadpool.c
+++ b/mono/metadata/threadpool.c
@@ -481,8 +481,14 @@ static void
 init_event_system (SocketIOData *data)
 {
 #ifdef HAVE_EPOLL
-	if (data->event_system == EPOLL_BACKEND)
+	if (data->event_system == EPOLL_BACKEND) {
 		data->event_data = tp_epoll_init (data);
+		if (data->event_data == NULL) {
+			if (g_getenv ("MONO_DEBUG"))
+				g_message ("Falling back to poll()");
+			data->event_system = POLL_BACKEND;
+		}
+	}
 #elif defined(HAVE_KQUEUE)
 	if (data->event_system == KQUEUE_BACKEND)
 		data->event_data = tp_kqueue_init (data);
@@ -1046,8 +1052,10 @@ threadpool_append_jobs (ThreadPool *tp, MonoObject **jobs, gint njobs)
 		return;
 
 	if (tp->pool_status == 0 && InterlockedCompareExchange (&tp->pool_status, 1, 0) == 0) {
-		if (!tp->is_io)
+		if (!tp->is_io) {
 			mono_thread_create_internal (mono_get_root_domain (), monitor_thread, NULL, TRUE, SMALL_STACK);
+			threadpool_start_thread (tp);
+		}
 		/* Create on demand up to min_threads to avoid startup penalty for apps that don't use
 		 * the threadpool that much
 		* mono_thread_create_internal (mono_get_root_domain (), threadpool_start_idle_threads, tp, TRUE, SMALL_STACK);
diff --git a/mono/metadata/threads.c b/mono/metadata/threads.c
index 117433c..1da8466 100644
--- a/mono/metadata/threads.c
+++ b/mono/metadata/threads.c
@@ -43,6 +43,7 @@
 #include <mono/utils/mono-mmap.h>
 #include <mono/utils/mono-membar.h>
 #include <mono/utils/mono-time.h>
+#include <mono/utils/mono-tls.h>
 
 #include <mono/metadata/gc-internal.h>
 
@@ -151,7 +152,7 @@ static MonoGHashTable *threads_starting_up = NULL;
 static MonoGHashTable *thread_start_args = NULL;
 
 /* The TLS key that holds the MonoObject assigned to each thread */
-static guint32 current_object_key = -1;
+static MonoNativeTlsKey current_object_key;
 
 #ifdef HAVE_KW_THREAD
 /* we need to use both the Tls* functions and __thread because
@@ -160,12 +161,12 @@ static guint32 current_object_key = -1;
 static __thread MonoInternalThread * tls_current_object MONO_TLS_FAST;
 #define SET_CURRENT_OBJECT(x) do { \
 	tls_current_object = x; \
-	TlsSetValue (current_object_key, x); \
+	mono_native_tls_set_value (current_object_key, x); \
 } while (FALSE)
 #define GET_CURRENT_OBJECT() tls_current_object
 #else
-#define SET_CURRENT_OBJECT(x) TlsSetValue (current_object_key, x)
-#define GET_CURRENT_OBJECT() (MonoThread*) TlsGetValue (current_object_key)
+#define SET_CURRENT_OBJECT(x) mono_native_tls_set_value (current_object_key, x)
+#define GET_CURRENT_OBJECT() (MonoThread*) mono_native_tls_get_value (current_object_key)
 #endif
 
 /* function called at thread start */
@@ -237,8 +238,8 @@ get_next_managed_thread_id (void)
 	return InterlockedIncrement (&managed_thread_id_counter);
 }
 
-guint32
-mono_thread_get_tls_key (void)
+MonoNativeTlsKey
+mono_thread_get_native_tls_key (void)
 {
 	return current_object_key;
 }
@@ -2649,7 +2650,7 @@ void mono_thread_init (MonoThreadStartCB start_cb,
 	mono_init_static_data_info (&thread_static_info);
 	mono_init_static_data_info (&context_static_info);
 
-	current_object_key=TlsAlloc();
+	mono_native_tls_alloc (&current_object_key, NULL);
 	THREAD_DEBUG (g_message ("%s: Allocated current_object_key %d", __func__, current_object_key));
 
 	mono_thread_start_cb = start_cb;
@@ -2699,7 +2700,7 @@ void mono_thread_cleanup (void)
 	g_array_free (delayed_free_table, TRUE);
 	delayed_free_table = NULL;
 
-	TlsFree (current_object_key);
+	mono_native_tls_free (current_object_key);
 }
 
 void
diff --git a/mono/metadata/tpool-epoll.c b/mono/metadata/tpool-epoll.c
index dd8f20f..6017dd2 100644
--- a/mono/metadata/tpool-epoll.c
+++ b/mono/metadata/tpool-epoll.c
@@ -19,8 +19,18 @@ tp_epoll_init (SocketIOData *data)
 	result->epollfd = epoll_create (256); /* The number does not really matter */
 	fcntl (result->epollfd, F_SETFD, FD_CLOEXEC);
 #endif
-	if (result->epollfd == -1)
+	if (result->epollfd == -1) {
+		int err = errno;
+		if (g_getenv ("MONO_DEBUG")) {
+#ifdef EPOLL_CLOEXEC
+			g_message ("epoll_create1(EPOLL_CLOEXEC) failed: %d %s", err, g_strerror (err));
+#else
+			g_message ("epoll_create(256) failed: %d %s", err, g_strerror (err));
+#endif
+		}
+
 		return NULL;
+	}
 
 	data->shutdown = tp_epoll_shutdown;
 	data->modify = tp_epoll_modify;
diff --git a/mono/mini/ChangeLog b/mono/mini/ChangeLog
index cd6765f..d17cf32 100644
--- a/mono/mini/ChangeLog
+++ b/mono/mini/ChangeLog
@@ -1,3 +1,78 @@
+2011-12-19  Rolf Bjarne Kvinge  <rolf at xamarin.com>
+
+	Disable gdb backtracing until #2548 has been fixed.
+
+2011-12-06  Rodrigo Kumpera  <kumpera at gmail.com>
+
+	Use mono-tls for the current domain.
+
+2011-12-06  Rodrigo Kumpera  <kumpera at gmail.com>
+
+	Move current thread to use mono-tls.
+
+2011-12-05  Zoltan Varga  <vargaz at gmail.com>
+
+	Fix infinite recursion introduced by the previous patch.
+
+2011-12-05  Zoltan Varga  <vargaz at gmail.com>
+
+	AOT the cctor of generic classes which are referenced by SFLDA
+	patches and superclasses of generic instances. Fixes #2155
+
+2011-11-28  Miguel de Icaza  <miguel at gnome.org>
+
+	Fix the build, add declaration for SeqPoint
+
+2011-11-26  Zoltan Varga  <vargaz at gmail.com>
+
+	Add a heuristic to insert_breakpoint () to avoid 'Unable to insert
+	breakpoint' errors in some cases, since the set of IL offsets in
+	the debug info doesn't completely match what the JIT generates.
+	Fixes #407.
+
+2011-11-24  Zoltan Varga  <vargaz at gmail.com>
+
+	Save the stack space used by arguments into MonoJitInfo to avoid
+	calling mono_arch_get_arg_info () during stack walking, since it
+	is not signal safe. Fixes #2190.
+
+2011-11-20  Zoltan Varga  <vargaz at gmail.com>
+
+	Free debug info for dynamic methods by storing it in malloc-ed
+	memory instead of the normal debugger tables. Fixes #731579.
+
+2011-11-02  Zoltan Varga  <vargaz at gmail.com>
+
+	Fix a crash which happens when an inlined method ends with a throw
+	inside a branch, i.e. the return value is not on one branch, and
+	not on the other. Fixes #1835.
+
+2011-11-01  Zoltan Varga  <vargaz at gmail.com>
+
+	Delete unused link.h include
+
+2011-10-18  Rolf Bjarne Kvinge  <rolf at xamarin.com>
+
+	When providing stack trace for a crash make sure we attach to the
+	crashed process, not the forked process that will become gdb.
+
+2011-09-29  Rodrigo Kumpera  <kumpera at gmail.com>
+
+	Request ObjectMirror type and domain in a single request.
+
+2011-09-27  Zoltan Varga  <vargaz at gmail.com>
+
+	Save/restore argument registers when instrumenting tail calls.
+	Fixes #971
+
+2011-09-16  Gonzalo Paniagua Javier  <gonzalo.mono at gmail.com>
+
+	Avoid warning
+
+2011-09-06  Zoltan Varga  <vargaz at gmail.com>
+
+	Handle threads which die without detaching.
+
 2011-08-18  Zoltan Varga  <vargaz at gmail.com>
 
 	Disable some failing LLVM passes. Should fix bxc #280.
diff --git a/mono/mini/Makefile.in b/mono/mini/Makefile.in
index 8936fe1..e2625dd 100644
--- a/mono/mini/Makefile.in
+++ b/mono/mini/Makefile.in
@@ -1438,9 +1438,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign mono/mini/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu mono/mini/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign mono/mini/Makefile
+	  $(AUTOMAKE) --gnu mono/mini/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
diff --git a/mono/mini/aot-compiler.c b/mono/mini/aot-compiler.c
index f28599a..87d4d51 100644
--- a/mono/mini/aot-compiler.c
+++ b/mono/mini/aot-compiler.c
@@ -189,6 +189,7 @@ typedef struct MonoAotCompile {
 	GString *as_args;
 	char *assembly_name_sym;
 	gboolean thumb_mixed, need_no_dead_strip, need_pt_gnu_stack;
+	GHashTable *ginst_hash;
 } MonoAotCompile;
 
 typedef struct {
@@ -2892,9 +2893,17 @@ add_generic_class_with_depth (MonoAotCompile *acfg, MonoClass *klass, int depth)
 	if (!klass->generic_class && !klass->rank)
 		return;
 
+	if (!acfg->ginst_hash)
+		acfg->ginst_hash = g_hash_table_new (NULL, NULL);
+
+	if (g_hash_table_lookup (acfg->ginst_hash, klass))
+		return;
+
 	if (check_type_depth (&klass->byval_arg, 0))
 		return;
 
+	g_hash_table_insert (acfg->ginst_hash, klass, klass);
+
 	iter = NULL;
 	while ((method = mono_class_get_methods (klass, &iter))) {
 		if (mono_method_is_generic_sharable_impl_full (method, FALSE, FALSE))
@@ -2920,6 +2929,10 @@ add_generic_class_with_depth (MonoAotCompile *acfg, MonoClass *klass, int depth)
 		add_method (acfg, method);
 	}
 
+	/* Add superclasses */
+	if (klass->parent)
+		add_generic_class_with_depth (acfg, klass->parent, depth);
+
 	/* 
 	 * For ICollection<T>, add instances of the helper methods
 	 * in Array, since a T[] could be cast to ICollection<T>.
@@ -3843,7 +3856,7 @@ emit_exception_debug_info (MonoAotCompile *acfg, MonoCompile *cfg)
 	use_unwind_ops = cfg->unwind_ops != NULL;
 #endif
 
-	flags = (jinfo->has_generic_jit_info ? 1 : 0) | (use_unwind_ops ? 2 : 0) | (header->num_clauses ? 4 : 0) | (seq_points ? 8 : 0) | (cfg->compile_llvm ? 16 : 0) | (jinfo->has_try_block_holes ? 32 : 0) | (cfg->gc_map ? 64 : 0);
+	flags = (jinfo->has_generic_jit_info ? 1 : 0) | (use_unwind_ops ? 2 : 0) | (header->num_clauses ? 4 : 0) | (seq_points ? 8 : 0) | (cfg->compile_llvm ? 16 : 0) | (jinfo->has_try_block_holes ? 32 : 0) | (cfg->gc_map ? 64 : 0) | (jinfo->has_arch_eh_info ? 128 : 0);
 
 	encode_value (flags, p, &p);
 
@@ -3957,6 +3970,13 @@ emit_exception_debug_info (MonoAotCompile *acfg, MonoCompile *cfg)
 		}
 	}
 
+	if (jinfo->has_arch_eh_info) {
+		MonoArchEHJitInfo *eh_info;
+
+		eh_info = mono_jit_info_get_arch_eh_info (jinfo);
+		encode_value (eh_info->stack_size, p, &p);
+	}
+
 	if (seq_points) {
 		int il_offset, native_offset, last_il_offset, last_native_offset, j;
 
@@ -4900,6 +4920,14 @@ compile_method (MonoAotCompile *acfg, MonoMethod *method)
 					add_generic_class_with_depth (acfg, klass, depth + 5);
 				break;
 			}
+			case MONO_PATCH_INFO_SFLDA: {
+				MonoClass *klass = patch_info->data.field->parent;
+
+				/* The .cctor needs to run at runtime. */
+				if (klass->generic_class && !mono_generic_context_is_sharable (&klass->generic_class->context, FALSE) && mono_class_get_cctor (klass))
+					add_extra_method_with_depth (acfg, mono_class_get_cctor (klass), depth + 1);
+				break;
+			}
 			default:
 				break;
 			}
diff --git a/mono/mini/aot-runtime.c b/mono/mini/aot-runtime.c
index a3c5746..cf3114a 100644
--- a/mono/mini/aot-runtime.c
+++ b/mono/mini/aot-runtime.c
@@ -37,10 +37,6 @@
 #include <sys/wait.h>  /* for WIFEXITED, WEXITSTATUS */
 #endif
 
-#ifdef HAVE_DL_ITERATE_PHDR
-#include <link.h>
-#endif
-
 #include <mono/metadata/tabledefs.h>
 #include <mono/metadata/class.h>
 #include <mono/metadata/object.h>
@@ -1777,10 +1773,11 @@ decode_exception_debug_info (MonoAotModule *amodule, MonoDomain *domain,
 	int i, buf_len, num_clauses;
 	MonoJitInfo *jinfo;
 	guint used_int_regs, flags;
-	gboolean has_generic_jit_info, has_dwarf_unwind_info, has_clauses, has_seq_points, has_try_block_holes;
+	gboolean has_generic_jit_info, has_dwarf_unwind_info, has_clauses, has_seq_points, has_try_block_holes, has_arch_eh_jit_info;
 	gboolean from_llvm, has_gc_map;
 	guint8 *p;
-	int generic_info_size, try_holes_info_size, num_holes, this_reg = 0, this_offset = 0;
+	int generic_info_size, try_holes_info_size, num_holes, arch_eh_jit_info_size;
+	int this_reg = 0, this_offset = 0;
 
 	/* Load the method info from the AOT file */
 
@@ -1793,6 +1790,7 @@ decode_exception_debug_info (MonoAotModule *amodule, MonoDomain *domain,
 	from_llvm = (flags & 16) != 0;
 	has_try_block_holes = (flags & 32) != 0;
 	has_gc_map = (flags & 64) != 0;
+	has_arch_eh_jit_info = (flags & 128) != 0;
 
 	if (has_dwarf_unwind_info) {
 		guint32 offset;
@@ -1819,6 +1817,10 @@ decode_exception_debug_info (MonoAotModule *amodule, MonoDomain *domain,
 		num_clauses = decode_value (p, &p);
 	else
 		num_clauses = 0;
+	if (has_arch_eh_jit_info)
+		arch_eh_jit_info_size = sizeof (MonoArchEHJitInfo);
+	else
+		arch_eh_jit_info_size = 0;
 
 	if (from_llvm) {
 		MonoJitExceptionInfo *clauses;
@@ -1848,7 +1850,7 @@ decode_exception_debug_info (MonoAotModule *amodule, MonoDomain *domain,
 			}
 		}
 
- 		jinfo = decode_llvm_mono_eh_frame (amodule, domain, method, code, clauses, num_clauses, generic_info_size + try_holes_info_size, nesting, &this_reg, &this_offset);
+		jinfo = decode_llvm_mono_eh_frame (amodule, domain, method, code, clauses, num_clauses, generic_info_size + try_holes_info_size + arch_eh_jit_info_size, nesting, &this_reg, &this_offset);
 		jinfo->from_llvm = 1;
 
 		g_free (clauses);
@@ -1857,7 +1859,7 @@ decode_exception_debug_info (MonoAotModule *amodule, MonoDomain *domain,
 		g_free (nesting);
 	} else {
 		jinfo = 
-			mono_domain_alloc0 (domain, MONO_SIZEOF_JIT_INFO + (sizeof (MonoJitExceptionInfo) * num_clauses) + generic_info_size + try_holes_info_size);
+			mono_domain_alloc0 (domain, MONO_SIZEOF_JIT_INFO + (sizeof (MonoJitExceptionInfo) * num_clauses) + generic_info_size + try_holes_info_size + arch_eh_jit_info_size);
 		jinfo->num_clauses = num_clauses;
 
 		for (i = 0; i < jinfo->num_clauses; ++i) {
@@ -1928,6 +1930,15 @@ decode_exception_debug_info (MonoAotModule *amodule, MonoDomain *domain,
 		}
 	}
 
+	if (has_arch_eh_jit_info) {
+		MonoArchEHJitInfo *eh_info;
+
+		jinfo->has_arch_eh_info = 1;
+
+		eh_info = mono_jit_info_get_arch_eh_info (jinfo);
+		eh_info->stack_size = decode_value (p, &p);
+	}
+
 	if (has_seq_points) {
 		MonoSeqPointInfo *seq_points;
 		int il_offset, native_offset, last_il_offset, last_native_offset, j;
diff --git a/mono/mini/debugger-agent.c b/mono/mini/debugger-agent.c
index 197e0ae..11bddeb 100644
--- a/mono/mini/debugger-agent.c
+++ b/mono/mini/debugger-agent.c
@@ -254,7 +254,7 @@ typedef struct {
 #define HEADER_LENGTH 11
 
 #define MAJOR_VERSION 2
-#define MINOR_VERSION 4
+#define MINOR_VERSION 5
 
 typedef enum {
 	CMD_SET_VM = 1,
@@ -457,7 +457,8 @@ typedef enum {
 	CMD_OBJECT_REF_IS_COLLECTED = 3,
 	CMD_OBJECT_REF_GET_ADDRESS = 4,
 	CMD_OBJECT_REF_GET_DOMAIN = 5,
-	CMD_OBJECT_REF_SET_VALUES = 6
+	CMD_OBJECT_REF_SET_VALUES = 6,
+	CMD_OBJECT_REF_GET_INFO = 7,
 } CmdObject;
 
 typedef struct {
@@ -2125,6 +2126,7 @@ notify_thread (gpointer key, gpointer value, gpointer user_data)
 	MonoInternalThread *thread = key;
 	DebuggerTlsData *tls = value;
 	gsize tid = thread->tid;
+	int res;
 
 	if (GetCurrentThreadId () == tid || tls->terminated)
 		return;
@@ -2153,7 +2155,12 @@ notify_thread (gpointer key, gpointer value, gpointer user_data)
 #ifdef HOST_WIN32
 	QueueUserAPC (notify_thread_apc, thread->handle, NULL);
 #else
-	mono_thread_kill (thread, mono_thread_get_abort_signal ());
+	res = mono_thread_kill (thread, mono_thread_get_abort_signal ());
+	if (res)
+		/* 
+		 * Attached thread which died without detaching.
+		 */
+		tls->terminated = TRUE;
 #endif
 }
 
@@ -3379,7 +3386,24 @@ insert_breakpoint (MonoSeqPointInfo *seq_points, MonoDomain *domain, MonoJitInfo
 	}
 
 	if (i == seq_points->len) {
+		/*
+		 * The set of IL offsets with seq points doesn't completely match the
+		 * info returned by CMD_METHOD_GET_DEBUG_INFO (#407).
+		 */
+		for (i = 0; i < seq_points->len; ++i) {
+			SeqPoint *sp = &seq_points->seq_points [i];
+
+			if (sp->il_offset != METHOD_ENTRY_IL_OFFSET && sp->il_offset != METHOD_EXIT_IL_OFFSET && sp->il_offset + 1 == bp->il_offset)
+				break;
+		}
+	}
+
+	if (i == seq_points->len) {
 		char *s = g_strdup_printf ("Unable to insert breakpoint at %s:%d, seq_points=%d\n", mono_method_full_name (ji->method, TRUE), bp->il_offset, seq_points->len);
+
+		for (i = 0; i < seq_points->len; ++i)
+			printf ("%d\n", seq_points->seq_points [i].il_offset);
+
 		if (error) {
 			mono_error_set_error (error, MONO_ERROR_GENERIC, "%s", s);
 			g_free (s);
@@ -5349,7 +5373,7 @@ vm_commands (int command, int id, guint8 *p, guint8 *end, Buffer *buf)
 		MonoInternalThread *thread;
 		DebuggerTlsData *tls;
 		MonoClass *env_class;
-		MonoMethod *exit_method;
+		MonoMethod *exit_method = NULL;
 		gpointer *args;
 		int exit_code;
 
@@ -7021,6 +7045,10 @@ object_commands (int command, guint8 *p, guint8 *end, Buffer *buf)
 	case CMD_OBJECT_REF_GET_DOMAIN:
 		buffer_add_domainid (buf, obj->vtable->domain);
 		break;
+	case CMD_OBJECT_REF_GET_INFO:
+		buffer_add_typeid (buf, obj->vtable->domain, obj->vtable->klass);
+		buffer_add_domainid (buf, obj->vtable->domain);
+		break;
 	default:
 		return ERR_NOT_IMPLEMENTED;
 	}
diff --git a/mono/mini/exceptions-amd64.c b/mono/mini/exceptions-amd64.c
index 3d6af85..f9eba39 100644
--- a/mono/mini/exceptions-amd64.c
+++ b/mono/mini/exceptions-amd64.c
@@ -638,12 +638,8 @@ mono_arch_find_jit_info (MonoDomain *domain, MonoJitTlsData *jit_tls,
 
 #ifndef MONO_AMD64_NO_PUSHES
 		/* Pop arguments off the stack */
-		{
-			MonoJitArgumentInfo *arg_info = g_newa (MonoJitArgumentInfo, mono_method_signature (ji->method)->param_count + 1);
-
-			guint32 stack_to_pop = mono_arch_get_argument_info (mono_method_signature (ji->method), mono_method_signature (ji->method)->param_count, arg_info);
-			new_ctx->rsp += stack_to_pop;
-		}
+		if (ji->has_arch_eh_info)
+			new_ctx->rsp += mono_jit_info_get_arch_eh_info (ji)->stack_size;
 #endif
 
 		return TRUE;
diff --git a/mono/mini/exceptions-x86.c b/mono/mini/exceptions-x86.c
index 3a7314c..7fc9949 100644
--- a/mono/mini/exceptions-x86.c
+++ b/mono/mini/exceptions-x86.c
@@ -817,12 +817,8 @@ mono_arch_find_jit_info (MonoDomain *domain, MonoJitTlsData *jit_tls,
 		 * the caller.
 		 */
 #ifndef ENABLE_LLVM
-		{
-			MonoJitArgumentInfo *arg_info = g_newa (MonoJitArgumentInfo, mono_method_signature (ji->method)->param_count + 1);
-
-			guint32 stack_to_pop = mono_arch_get_argument_info (mono_method_signature (ji->method), mono_method_signature (ji->method)->param_count, arg_info);
-			new_ctx->esp += stack_to_pop;
-		}
+		if (ji->has_arch_eh_info)
+			new_ctx->esp += mono_jit_info_get_arch_eh_info (ji)->stack_size;
 #endif
 
 		return TRUE;
diff --git a/mono/mini/exceptions.cs b/mono/mini/exceptions.cs
index 2736ddc..1ab3930 100644
--- a/mono/mini/exceptions.cs
+++ b/mono/mini/exceptions.cs
@@ -2704,5 +2704,26 @@ class Tests {
 			}
 		}
 	}
+
+    public static bool t_1835_inner () {
+        bool a = true;
+        if (a) throw new Exception();
+        return true;
+    }
+
+	[MethodImpl(MethodImplOptions.NoInlining)] 
+    public static bool t_1835_inner_2 () {
+		bool b = t_1835_inner ();
+		return b;
+	}
+
+	public static int test_0_inline_retval_throw_in_branch_1835 () {
+		try {
+			t_1835_inner_2 ();
+		} catch {
+			return 0;
+		}
+		return 1;
+	}
 }
 
diff --git a/mono/mini/generics.cs b/mono/mini/generics.cs
index 25fd698..842ddf6 100644
--- a/mono/mini/generics.cs
+++ b/mono/mini/generics.cs
@@ -885,4 +885,40 @@ class Tests {
 		else
 			return 0;
 	}
+
+	enum DocType {
+		One,
+		Two,
+		Three
+	}
+
+	class Doc {
+		public string Name {
+			get; set;
+		}
+
+		public DocType Type {
+			get; set;
+		}
+	}
+
+	// #2155
+	public static int test_0_fullaot_sflda_cctor () {
+		List<Doc> documents = new List<Doc>();
+		documents.Add(new Doc { Name = "Doc1", Type = DocType.One } );
+		documents.Add(new Doc { Name = "Doc2", Type = DocType.Two } );
+		documents.Add(new Doc { Name = "Doc3", Type = DocType.Three } );
+		documents.Add(new Doc { Name = "Doc4", Type = DocType.One } );
+		documents.Add(new Doc { Name = "Doc5", Type = DocType.Two } );
+		documents.Add(new Doc { Name = "Doc6", Type = DocType.Three } );
+		documents.Add(new Doc { Name = "Doc7", Type = DocType.One } );
+		documents.Add(new Doc { Name = "Doc8", Type = DocType.Two } );
+		documents.Add(new Doc { Name = "Doc9", Type = DocType.Three } );
+
+		List<DocType> categories = documents.Select(d=>d.Type).Distinct().ToList<DocType>().OrderBy(d => d).ToList();
+		foreach(DocType cat in categories) {
+			List<Doc> catDocs = documents.Where(d => d.Type == cat).OrderBy(d => d.Name).ToList<Doc>();
+		}
+		return 0;
+	}
 }
diff --git a/mono/mini/method-to-ir.c b/mono/mini/method-to-ir.c
index 5a6c5f5..f1accf0 100644
--- a/mono/mini/method-to-ir.c
+++ b/mono/mini/method-to-ir.c
@@ -4826,6 +4826,39 @@ check_inline_caller_method_name_limit (MonoMethod *caller_method)
 }
 #endif
 
+static void
+emit_init_rvar (MonoCompile *cfg, MonoInst *rvar, MonoType *rtype)
+{
+	static double r8_0 = 0.0;
+	MonoInst *ins;
+
+	switch (rvar->type) {
+	case STACK_I4:
+		MONO_EMIT_NEW_ICONST (cfg, rvar->dreg, 0);
+		break;
+	case STACK_I8:
+		MONO_EMIT_NEW_I8CONST (cfg, rvar->dreg, 0);
+		break;
+	case STACK_PTR:
+	case STACK_MP:
+	case STACK_OBJ:
+		MONO_EMIT_NEW_PCONST (cfg, rvar->dreg, 0);
+		break;
+	case STACK_R8:
+		MONO_INST_NEW (cfg, ins, OP_R8CONST);
+		ins->type = STACK_R8;
+		ins->inst_p0 = (void*)&r8_0;
+		ins->dreg = rvar->dreg;
+		MONO_ADD_INS (cfg->cbb, ins);
+		break;
+	case STACK_VTYPE:
+		MONO_EMIT_NEW_VZERO (cfg, rvar->dreg, mono_class_from_mono_type (rtype));
+		break;
+	default:
+		g_assert_not_reached ();
+	}
+}
+
 static int
 inline_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig, MonoInst **sp,
 		guchar *ip, guint real_offset, GList *dont_inline, gboolean inline_always)
@@ -4974,6 +5007,24 @@ inline_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig,
 				cfg->cbb = prev_cbb;
 			}
 		} else {
+			/* 
+			 * Its possible that the rvar is set in some prev bblock, but not in others.
+			 * (#1835).
+			 */
+			if (rvar) {
+				MonoBasicBlock *bb;
+
+				for (i = 0; i < ebblock->in_count; ++i) {
+					bb = ebblock->in_bb [i];
+
+					if (bb->last_ins && bb->last_ins->opcode == OP_NOT_REACHED) {
+						cfg->cbb = bb;
+
+						emit_init_rvar (cfg, rvar, fsig->ret);
+					}
+				}
+			}
+
 			cfg->cbb = ebblock;
 		}
 
@@ -4982,35 +5033,8 @@ inline_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig,
 			 * If the inlined method contains only a throw, then the ret var is not 
 			 * set, so set it to a dummy value.
 			 */
-			if (!ret_var_set) {
-				static double r8_0 = 0.0;
-
-				switch (rvar->type) {
-				case STACK_I4:
-					MONO_EMIT_NEW_ICONST (cfg, rvar->dreg, 0);
-					break;
-				case STACK_I8:
-					MONO_EMIT_NEW_I8CONST (cfg, rvar->dreg, 0);
-					break;
-				case STACK_PTR:
-				case STACK_MP:
-				case STACK_OBJ:
-					MONO_EMIT_NEW_PCONST (cfg, rvar->dreg, 0);
-					break;
-				case STACK_R8:
-					MONO_INST_NEW (cfg, ins, OP_R8CONST);
-					ins->type = STACK_R8;
-					ins->inst_p0 = (void*)&r8_0;
-					ins->dreg = rvar->dreg;
-					MONO_ADD_INS (cfg->cbb, ins);
-					break;
-				case STACK_VTYPE:
-					MONO_EMIT_NEW_VZERO (cfg, rvar->dreg, mono_class_from_mono_type (fsig->ret));
-					break;
-				default:
-					g_assert_not_reached ();
-				}
-			}
+			if (!ret_var_set)
+				emit_init_rvar (cfg, rvar, fsig->ret);
 
 			EMIT_NEW_TEMPLOAD (cfg, ins, rvar->inst_c0);
 			*sp++ = ins;
diff --git a/mono/mini/mini-amd64.c b/mono/mini/mini-amd64.c
index c7abb28..40f0fe9 100644
--- a/mono/mini/mini-amd64.c
+++ b/mono/mini/mini-amd64.c
@@ -2053,6 +2053,10 @@ mono_arch_create_vars (MonoCompile *cfg)
 	 */
 	cfg->arch.no_pushes = TRUE;
 #endif
+
+#ifndef MONO_AMD64_NO_PUSHES
+	cfg->arch_eh_jit_info = 1;
+#endif
 }
 
 static void
@@ -4548,7 +4552,7 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
 
 			/* FIXME: no tracing support... */
 			if (cfg->prof_options & MONO_PROFILE_ENTER_LEAVE)
-				code = mono_arch_instrument_epilog_full (cfg, mono_profiler_method_leave, code, FALSE, FALSE);
+				code = mono_arch_instrument_epilog_full (cfg, mono_profiler_method_leave, code, FALSE, TRUE);
 
 			g_assert (!cfg->method->save_lmf);
 
@@ -7459,6 +7463,7 @@ mono_arch_instrument_epilog_full (MonoCompile *cfg, void *func, void *p, gboolea
 	int save_mode = SAVE_NONE;
 	MonoMethod *method = cfg->method;
 	MonoType *ret_type = mini_type_get_underlying_type (NULL, mono_method_signature (method)->ret);
+	int i;
 	
 	switch (ret_type->type) {
 	case MONO_TYPE_VOID:
@@ -7527,8 +7532,8 @@ mono_arch_instrument_epilog_full (MonoCompile *cfg, void *func, void *p, gboolea
 		amd64_mov_reg_imm (code, AMD64_RAX, 0);
 
 	if (preserve_argument_registers) {
-		amd64_push_reg (code, MONO_AMD64_ARG_REG1);
-		amd64_push_reg (code, MONO_AMD64_ARG_REG2);
+		for (i = 0; i < PARAM_REGS; ++i)
+			amd64_push_reg (code, param_regs [i]);
 	}
 
 	mono_add_patch_info (cfg, code-cfg->native_code, MONO_PATCH_INFO_METHODCONST, method);
@@ -7536,8 +7541,8 @@ mono_arch_instrument_epilog_full (MonoCompile *cfg, void *func, void *p, gboolea
 	code = emit_call (cfg, code, MONO_PATCH_INFO_ABS, (gpointer)func, TRUE);
 
 	if (preserve_argument_registers) {
-		amd64_pop_reg (code, MONO_AMD64_ARG_REG2);
-		amd64_pop_reg (code, MONO_AMD64_ARG_REG1);
+		for (i = PARAM_REGS - 1; i >= 0; --i)
+			amd64_pop_reg (code, param_regs [i]);
 	}
 
 	/* Restore result */
@@ -7916,7 +7921,7 @@ mono_arch_setup_jit_tls_data (MonoJitTlsData *tls)
 		 * We need to init this multiple times, since when we are first called, the key might not
 		 * be initialized yet.
 		 */
-		appdomain_tls_offset = mono_domain_get_tls_key ();
+		appdomain_tls_offset = mono_domain_get_native_tls_key ();
 		lmf_tls_offset = mono_get_jit_tls_key ();
 		lmf_addr_tls_offset = mono_get_jit_tls_key ();
 
diff --git a/mono/mini/mini-darwin.c b/mono/mini/mini-darwin.c
index a13cad3..bfd9f28 100644
--- a/mono/mini/mini-darwin.c
+++ b/mono/mini/mini-darwin.c
@@ -227,8 +227,9 @@ mono_runtime_syscall_fork ()
 }
 
 gboolean
-mono_gdb_render_native_backtraces ()
+mono_gdb_render_native_backtraces (pid_t crashed_pid)
 {
+	return FALSE; // disable for now due to #2548.
 	const char *argv [5];
 	char gdb_template [] = "/tmp/mono-gdb-commands.XXXXXX";
 
@@ -240,7 +241,7 @@ mono_gdb_render_native_backtraces ()
 	if (mkstemp (gdb_template) != -1) {
 		FILE *gdb_commands = fopen (gdb_template, "w");
 
-		fprintf (gdb_commands, "attach %ld\n", (long) getpid ());
+		fprintf (gdb_commands, "attach %ld\n", (long) crashed_pid);
 		fprintf (gdb_commands, "info threads\n");
 		fprintf (gdb_commands, "thread apply all bt\n");
 
diff --git a/mono/mini/mini-exceptions.c b/mono/mini/mini-exceptions.c
index 9b5210a..fc74b08 100644
--- a/mono/mini/mini-exceptions.c
+++ b/mono/mini/mini-exceptions.c
@@ -2175,6 +2175,7 @@ mono_handle_native_sigsegv (int signal, void *ctx)
 		pid_t pid;
 		int status;
 		char buffer [1024];
+		pid_t crashed_pid = getpid ();
 
 		res = pipe (stdout_pipe);
 		g_assert (res != -1);
@@ -2193,7 +2194,7 @@ mono_handle_native_sigsegv (int signal, void *ctx)
 			for (i = getdtablesize () - 1; i >= 3; i--)
 				close (i);
 
-			if (!mono_gdb_render_native_backtraces ())
+			if (!mono_gdb_render_native_backtraces (crashed_pid))
 				close (STDOUT_FILENO);
 
 			exit (1);
diff --git a/mono/mini/mini-mips.c b/mono/mini/mini-mips.c
index 932f2ec..4955916 100644
--- a/mono/mini/mini-mips.c
+++ b/mono/mini/mini-mips.c
@@ -5448,12 +5448,9 @@ setup_tls_access (void)
 #endif
 	}
 	if (monodomain_key == -1) {
-		ptk = mono_domain_get_tls_key ();
+		ptk = mono_domain_get_native_tls_key ();
 		if (ptk < 1024) {
-			ptk = mono_pthread_key_for_tls (ptk);
-			if (ptk < 1024) {
-				monodomain_key = ptk;
-			}
+			monodomain_key = ptk;
 		}
 	}
 	if (lmf_pthread_key == -1) {
@@ -5468,15 +5465,10 @@ setup_tls_access (void)
 		}
 	}
 	if (monothread_key == -1) {
-		ptk = mono_thread_get_tls_key ();
+		ptk = mono_thread_get_native_tls_key ();
 		if (ptk < 1024) {
-			ptk = mono_pthread_key_for_tls (ptk);
-			if (ptk < 1024) {
-				monothread_key = ptk;
-				/*g_print ("thread inited: %d\n", ptk);*/
-			}
-		} else {
-			/*g_print ("thread not inited yet %d\n", ptk);*/
+			monothread_key = ptk;
+			/*g_print ("thread inited: %d\n", ptk);*/
 		}
 	}
 }
diff --git a/mono/mini/mini-posix.c b/mono/mini/mini-posix.c
index c15b098..d336e35 100644
--- a/mono/mini/mini-posix.c
+++ b/mono/mini/mini-posix.c
@@ -636,7 +636,7 @@ mono_runtime_syscall_fork ()
 }
 
 gboolean
-mono_gdb_render_native_backtraces ()
+mono_gdb_render_native_backtraces (pid_t crashed_pid)
 {
 	const char *argv [9];
 	char buf1 [128];
@@ -647,7 +647,7 @@ mono_gdb_render_native_backtraces ()
 	}
 
 	argv [1] = "-ex";
-	sprintf (buf1, "attach %ld", (long)getpid ());
+	sprintf (buf1, "attach %ld", (long) crashed_pid);
 	argv [2] = buf1;
 	argv [3] = "--ex";
 	argv [4] = "info threads";
diff --git a/mono/mini/mini-ppc.c b/mono/mini/mini-ppc.c
index 90240f6..64d0426 100644
--- a/mono/mini/mini-ppc.c
+++ b/mono/mini/mini-ppc.c
@@ -5717,12 +5717,9 @@ setup_tls_access (void)
 	/* if not TLS_MODE_NPTL or local dynamic (as indicated by
 	   mono_domain_get_tls_offset returning -1) then use keyed access. */
 	if (monodomain_key == -1) {
-		ptk = mono_domain_get_tls_key ();
+		ptk = mono_domain_get_native_tls_key ();
 		if (ptk < 1024) {
-			ptk = mono_pthread_key_for_tls (ptk);
-			if (ptk < 1024) {
-				monodomain_key = ptk;
-			}
+			monodomain_key = ptk;
 		}
 	}
 
diff --git a/mono/mini/mini-x86.c b/mono/mini/mini-x86.c
index 02d859e..5621b7d 100644
--- a/mono/mini/mini-x86.c
+++ b/mono/mini/mini-x86.c
@@ -1236,6 +1236,8 @@ mono_arch_create_vars (MonoCompile *cfg)
 	if ((cinfo->ret.storage != ArgValuetypeInReg) && MONO_TYPE_ISSTRUCT (sig->ret)) {
 		cfg->vret_addr = mono_compile_create_var (cfg, &mono_defaults.int_class->byval_arg, OP_ARG);
 	}
+
+	cfg->arch_eh_jit_info = 1;
 }
 
 /*
@@ -5510,7 +5512,7 @@ mono_arch_setup_jit_tls_data (MonoJitTlsData *tls)
 			 * We need to init this multiple times, since when we are first called, the key might not
 			 * be initialized yet.
 			 */
-			appdomain_tls_offset = mono_domain_get_tls_key ();
+			appdomain_tls_offset = mono_domain_get_native_tls_key ();
 			lmf_tls_offset = mono_get_jit_tls_key ();
 
 			/* Only 64 tls entries can be accessed using inline code */
diff --git a/mono/mini/mini.c b/mono/mini/mini.c
index 13290bf..f614bd5 100644
--- a/mono/mini/mini.c
+++ b/mono/mini/mini.c
@@ -3807,8 +3807,9 @@ create_jit_info (MonoCompile *cfg, MonoMethod *method_to_compile)
 	MonoMethodHeader *header;
 	MonoJitInfo *jinfo;
 	int num_clauses;
-	int generic_info_size;
+	int generic_info_size, arch_eh_info_size = 0;
 	int holes_size = 0, num_holes = 0;
+	guint32 stack_size = 0;
 
 	g_assert (method_to_compile == cfg->method);
 	header = cfg->header;
@@ -3818,6 +3819,21 @@ create_jit_info (MonoCompile *cfg, MonoMethod *method_to_compile)
 	else
 		generic_info_size = 0;
 
+	if (cfg->arch_eh_jit_info) {
+		MonoJitArgumentInfo *arg_info;
+		MonoMethodSignature *sig = mono_method_signature (cfg->method_to_register);
+
+		/*
+		 * This cannot be computed during stack walking, as
+		 * mono_arch_get_argument_info () is not signal safe.
+		 */
+		arg_info = g_newa (MonoJitArgumentInfo, sig->param_count + 1);
+		stack_size = mono_arch_get_argument_info (sig, sig->param_count, arg_info);
+
+		if (stack_size)
+			arch_eh_info_size = sizeof (MonoArchEHJitInfo);
+	}
+		
 	if (cfg->try_block_holes) {
 		for (tmp = cfg->try_block_holes; tmp; tmp = tmp->next) {
 			TryBlockHole *hole = tmp->data;
@@ -3843,11 +3859,11 @@ create_jit_info (MonoCompile *cfg, MonoMethod *method_to_compile)
 
 	if (cfg->method->dynamic) {
 		jinfo = g_malloc0 (MONO_SIZEOF_JIT_INFO + (num_clauses * sizeof (MonoJitExceptionInfo)) +
-				generic_info_size + holes_size);
+				generic_info_size + holes_size + arch_eh_info_size);
 	} else {
 		jinfo = mono_domain_alloc0 (cfg->domain, MONO_SIZEOF_JIT_INFO +
 				(num_clauses * sizeof (MonoJitExceptionInfo)) +
-				generic_info_size + holes_size);
+				generic_info_size + holes_size + arch_eh_info_size);
 	}
 
 	jinfo->method = cfg->method_to_register;
@@ -3945,6 +3961,15 @@ create_jit_info (MonoCompile *cfg, MonoMethod *method_to_compile)
 		g_assert (i == num_holes);
 	}
 
+	if (arch_eh_info_size) {
+		MonoArchEHJitInfo *info;
+
+		jinfo->has_arch_eh_info = 1;
+		info = mono_jit_info_get_arch_eh_info (jinfo);
+
+		info->stack_size = stack_size;
+	}
+
 	if (COMPILE_LLVM (cfg)) {
 		if (num_clauses)
 			memcpy (&jinfo->clauses [0], &cfg->llvm_ex_info [0], num_clauses * sizeof (MonoJitExceptionInfo));
@@ -5442,6 +5467,8 @@ mono_jit_free_method (MonoDomain *domain, MonoMethod *method)
 	if (!ji)
 		return;
 
+	mono_debug_remove_method (method, domain);
+
 	mono_domain_lock (domain);
 	g_hash_table_remove (domain_jit_info (domain)->dynamic_code_hash, method);
 	mono_internal_hash_table_remove (&domain->jit_code_hash, method);
diff --git a/mono/mini/mini.h b/mono/mini/mini.h
index 5c0f10f..38a9e46 100644
--- a/mono/mini/mini.h
+++ b/mono/mini/mini.h
@@ -119,7 +119,7 @@ typedef gint64 mgreg_t;
 #endif
 
 /* Version number of the AOT file format */
-#define MONO_AOT_FILE_VERSION 75
+#define MONO_AOT_FILE_VERSION ((2 << 16) | (10 << 8) | 75)
 
 //TODO: This is x86/amd64 specific.
 #define mono_simd_shuffle_mask(a,b,c,d) ((a) | ((b) << 2) | ((c) << 4) | ((d) << 6))
@@ -1285,6 +1285,7 @@ typedef struct {
 	guint            explicit_null_checks : 1;
 	guint            compute_gc_maps : 1;
 	guint            soft_breakpoints : 1;
+	guint            arch_eh_jit_info : 1;
 	gpointer         debug_info;
 	guint32          lmf_offset;
     guint16          *intvars;
@@ -2399,7 +2400,7 @@ void mono_runtime_setup_stat_profiler (void) MONO_INTERNAL;
 void mono_runtime_shutdown_stat_profiler (void) MONO_INTERNAL;
 void mono_runtime_posix_install_handlers (void) MONO_INTERNAL;
 pid_t mono_runtime_syscall_fork (void) MONO_INTERNAL;
-gboolean mono_gdb_render_native_backtraces (void) MONO_INTERNAL;
+gboolean mono_gdb_render_native_backtraces (pid_t crashed_pid) MONO_INTERNAL;
 
 /*
  * Signal handling
diff --git a/mono/mini/version.h b/mono/mini/version.h
index 5e38fb4..8bc194c 100644
--- a/mono/mini/version.h
+++ b/mono/mini/version.h
@@ -1 +1 @@
-#define FULL_VERSION "mono-2-10/350fcbd"
+#define FULL_VERSION "mono-2-10/6922ed8"
diff --git a/mono/monograph/Makefile.in b/mono/monograph/Makefile.in
index 71c5700..adeedd6 100644
--- a/mono/monograph/Makefile.in
+++ b/mono/monograph/Makefile.in
@@ -295,9 +295,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign mono/monograph/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu mono/monograph/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign mono/monograph/Makefile
+	  $(AUTOMAKE) --gnu mono/monograph/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
diff --git a/mono/profiler/ChangeLog b/mono/profiler/ChangeLog
index 7adee61..fa145f9 100644
--- a/mono/profiler/ChangeLog
+++ b/mono/profiler/ChangeLog
@@ -1,3 +1,34 @@
+2011-11-09  Rolf Bjarne Kvinge  <rolf at xamarin.com>
+
+	Log profiler: fix comment typo
+
+2011-11-08  Zoltan Varga  <vargaz at gmail.com>
+
+	Fix profiler build if boehm is disabled.
+
+2011-10-26  Rolf Bjarne Kvinge  <rolf at xamarin.com>
+
+	Log profiler: ensure the size we pass to getsockname is initalized
+	correctly.
+
+2011-10-20  Rolf Bjarne Kvinge  <rolf at xamarin.com>
+
+	Log profiler: flush file after writing to it.
+
+2011-10-14  Rolf Bjarne Kvinge  <rolf at xamarin.com>
+
+	Log profiler: add support for writing to an existing file
+	descriptor.
+
+2011-10-13  Rolf Bjarne Kvinge  <rolf at xamarin.com>
+
+	Profiler: add support embedded profilers whose entry point ends
+	with _<profiler name>.
+
+2011-10-12  Rolf Bjarne Kvinge  <rolf at xamarin.com>
+
+	Log profiler: Don't include major collections in ondemand mode.
+
 2011-03-31  Alan McGovern  <alan.mcgovern at gmail.com>
 
 	[log profiler] Keep correct stats about gchandles
diff --git a/mono/profiler/Makefile.am b/mono/profiler/Makefile.am
index 0eaecca..ac7b9a8 100644
--- a/mono/profiler/Makefile.am
+++ b/mono/profiler/Makefile.am
@@ -23,16 +23,22 @@ if HAVE_OPROFILE
 # Do something that uses OPROFILE_CFLAGS and OPROFILE_LIBS
 endif
 
+if SUPPORT_BOEHM
+LIBMONO=$(top_builddir)/mono/mini/libmono-$(API_VER).la
+else
+LIBMONO=$(top_builddir)/mono/mini/libmonosgen-$(API_VER).la
+endif
+
 libmono_profiler_cov_la_SOURCES = mono-cov.c
-libmono_profiler_cov_la_LIBADD = $(top_builddir)/mono/mini/libmono-$(API_VER).la
+libmono_profiler_cov_la_LIBADD = $(LIBMONO)
 libmono_profiler_aot_la_SOURCES = mono-profiler-aot.c
-libmono_profiler_aot_la_LIBADD = $(top_builddir)/mono/mini/libmono-$(API_VER).la
+libmono_profiler_aot_la_LIBADD = $(LIBMONO)
 #libmono_profiler_logging_la_SOURCES = mono-profiler-logging.c
-#libmono_profiler_logging_la_LIBADD = $(top_builddir)/mono/mini/libmono-$(API_VER).la $(GLIB_LIBS)
+#libmono_profiler_logging_la_LIBADD = $(LIBMONO) $(GLIB_LIBS)
 libmono_profiler_iomap_la_SOURCES = mono-profiler-iomap.c
-libmono_profiler_iomap_la_LIBADD = $(top_builddir)/mono/mini/libmono-$(API_VER).la $(GLIB_LIBS)
+libmono_profiler_iomap_la_LIBADD = $(LIBMONO) $(GLIB_LIBS)
 libmono_profiler_log_la_SOURCES = proflog.c
-libmono_profiler_log_la_LIBADD = $(top_builddir)/mono/mini/libmono-$(API_VER).la $(Z_LIBS)
+libmono_profiler_log_la_LIBADD = $(LIBMONO) $(Z_LIBS)
 
 mprof_report_SOURCES = decode.c
 mprof_report_LDADD = $(Z_LIBS)
diff --git a/mono/profiler/Makefile.in b/mono/profiler/Makefile.in
index 1917aa5..5447a60 100644
--- a/mono/profiler/Makefile.in
+++ b/mono/profiler/Makefile.in
@@ -75,31 +75,27 @@ am__base_list = \
   sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
 am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)"
 LTLIBRARIES = $(lib_LTLIBRARIES)
-libmono_profiler_aot_la_DEPENDENCIES =  \
-	$(top_builddir)/mono/mini/libmono-$(API_VER).la
+libmono_profiler_aot_la_DEPENDENCIES = $(LIBMONO)
 am_libmono_profiler_aot_la_OBJECTS = mono-profiler-aot.lo
 libmono_profiler_aot_la_OBJECTS =  \
 	$(am_libmono_profiler_aot_la_OBJECTS)
 @DISABLE_PROFILER_FALSE@@JIT_SUPPORTED_TRUE at am_libmono_profiler_aot_la_rpath =  \
 @DISABLE_PROFILER_FALSE@@JIT_SUPPORTED_TRUE@	-rpath $(libdir)
-libmono_profiler_cov_la_DEPENDENCIES =  \
-	$(top_builddir)/mono/mini/libmono-$(API_VER).la
+libmono_profiler_cov_la_DEPENDENCIES = $(LIBMONO)
 am_libmono_profiler_cov_la_OBJECTS = mono-cov.lo
 libmono_profiler_cov_la_OBJECTS =  \
 	$(am_libmono_profiler_cov_la_OBJECTS)
 @DISABLE_PROFILER_FALSE@@JIT_SUPPORTED_TRUE at am_libmono_profiler_cov_la_rpath =  \
 @DISABLE_PROFILER_FALSE@@JIT_SUPPORTED_TRUE@	-rpath $(libdir)
 am__DEPENDENCIES_1 =
-libmono_profiler_iomap_la_DEPENDENCIES =  \
-	$(top_builddir)/mono/mini/libmono-$(API_VER).la \
+libmono_profiler_iomap_la_DEPENDENCIES = $(LIBMONO) \
 	$(am__DEPENDENCIES_1)
 am_libmono_profiler_iomap_la_OBJECTS = mono-profiler-iomap.lo
 libmono_profiler_iomap_la_OBJECTS =  \
 	$(am_libmono_profiler_iomap_la_OBJECTS)
 @DISABLE_PROFILER_FALSE@@JIT_SUPPORTED_TRUE at am_libmono_profiler_iomap_la_rpath =  \
 @DISABLE_PROFILER_FALSE@@JIT_SUPPORTED_TRUE@	-rpath $(libdir)
-libmono_profiler_log_la_DEPENDENCIES =  \
-	$(top_builddir)/mono/mini/libmono-$(API_VER).la \
+libmono_profiler_log_la_DEPENDENCIES = $(LIBMONO) \
 	$(am__DEPENDENCIES_1)
 am_libmono_profiler_log_la_OBJECTS = proflog.lo
 libmono_profiler_log_la_OBJECTS =  \
@@ -337,18 +333,20 @@ INCLUDES = \
 
 @DISABLE_PROFILER_FALSE@@JIT_SUPPORTED_TRUE at lib_LTLIBRARIES = libmono-profiler-cov.la libmono-profiler-aot.la libmono-profiler-iomap.la libmono-profiler-log.la
 @DISABLE_PROFILER_FALSE@@JIT_SUPPORTED_TRUE@@PLATFORM_DARWIN_TRUE at libmono_profiler_log_la_LDFLAGS = -Wl,-undefined -Wl,suppress -Wl,-flat_namespace
+ at SUPPORT_BOEHM_FALSE@LIBMONO = $(top_builddir)/mono/mini/libmonosgen-$(API_VER).la
 
 # Do something that uses OPROFILE_CFLAGS and OPROFILE_LIBS
+ at SUPPORT_BOEHM_TRUE@LIBMONO = $(top_builddir)/mono/mini/libmono-$(API_VER).la
 libmono_profiler_cov_la_SOURCES = mono-cov.c
-libmono_profiler_cov_la_LIBADD = $(top_builddir)/mono/mini/libmono-$(API_VER).la
+libmono_profiler_cov_la_LIBADD = $(LIBMONO)
 libmono_profiler_aot_la_SOURCES = mono-profiler-aot.c
-libmono_profiler_aot_la_LIBADD = $(top_builddir)/mono/mini/libmono-$(API_VER).la
+libmono_profiler_aot_la_LIBADD = $(LIBMONO)
 #libmono_profiler_logging_la_SOURCES = mono-profiler-logging.c
-#libmono_profiler_logging_la_LIBADD = $(top_builddir)/mono/mini/libmono-$(API_VER).la $(GLIB_LIBS)
+#libmono_profiler_logging_la_LIBADD = $(LIBMONO) $(GLIB_LIBS)
 libmono_profiler_iomap_la_SOURCES = mono-profiler-iomap.c
-libmono_profiler_iomap_la_LIBADD = $(top_builddir)/mono/mini/libmono-$(API_VER).la $(GLIB_LIBS)
+libmono_profiler_iomap_la_LIBADD = $(LIBMONO) $(GLIB_LIBS)
 libmono_profiler_log_la_SOURCES = proflog.c
-libmono_profiler_log_la_LIBADD = $(top_builddir)/mono/mini/libmono-$(API_VER).la $(Z_LIBS)
+libmono_profiler_log_la_LIBADD = $(LIBMONO) $(Z_LIBS)
 mprof_report_SOURCES = decode.c
 mprof_report_LDADD = $(Z_LIBS)
 PLOG_TESTS_SRC = test-alloc.cs test-busy.cs test-monitor.cs test-excleave.cs \
@@ -374,9 +372,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign mono/profiler/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu mono/profiler/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign mono/profiler/Makefile
+	  $(AUTOMAKE) --gnu mono/profiler/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
diff --git a/mono/profiler/log-profiler.txt b/mono/profiler/log-profiler.txt
index 3ef5dcb..10140c6 100644
--- a/mono/profiler/log-profiler.txt
+++ b/mono/profiler/log-profiler.txt
@@ -133,6 +133,8 @@ date and time, then do according to *OUTSPEC*:
 	and feed the data to its standard input
 	* if *OUTSPEC* begins with a *-* character, use the rest of OUTSPEC as
 	the filename, but force overwrite any existing file by that name
+	* if *OUTSPEC* begins with a *#* character, use the rest of OUTSPEC as a
+	file descriptor and feed the data to it.
 	* otherwise write the data the the named file: note that is a file by that
 	name already exists, a warning is issued and profiling is disabled.
 
diff --git a/mono/profiler/proflog.c b/mono/profiler/proflog.c
index cb8d916..d025519 100644
--- a/mono/profiler/proflog.c
+++ b/mono/profiler/proflog.c
@@ -277,7 +277,7 @@ typedef struct _LogBuffer LogBuffer;
  * 	[object: sleb128] the object as a difference from obj_base
  * 	[root_type: uleb128] the root_type: MonoProfileGCRootType (profiler.h)
  * 	[extra_info: uleb128] the extra_info value
- * 	object, root_type_extra_info are repeated num_roots times
+ * 	object, root_type and extra_info are repeated num_roots times
  *
  * type sample format
  * type: TYPE_SAMPLE
@@ -563,6 +563,7 @@ dump_header (MonoProfiler *profiler)
 	}
 #else
 	fwrite (hbuf, p - hbuf, 1, profiler->file);
+	fflush (profiler->file);
 #endif
 }
 
@@ -588,6 +589,7 @@ dump_buffer (MonoProfiler *profiler, LogBuffer *buf)
 #endif
 		fwrite (hbuf, p - hbuf, 1, profiler->file);
 		fwrite (buf->buf, buf->data - buf->buf, 1, profiler->file);
+		fflush (profiler->file);
 #if defined (HAVE_SYS_ZLIB)
 	}
 #endif
@@ -667,8 +669,8 @@ heap_walk (MonoProfiler *profiler)
 		do_walk = 1;
 	else if (hs_mode_gc && (gc_count % hs_mode_gc) == 0)
 		do_walk = 1;
-	else if (hs_mode_ondemand && heapshot_requested)
-		do_walk = 1;
+	else if (hs_mode_ondemand)
+		do_walk = heapshot_requested;
 	else if (!hs_mode_ms && !hs_mode_gc && profiler->last_gc_gen_started == mono_gc_max_generation ())
 		do_walk = 1;
 
@@ -1950,6 +1952,7 @@ start_helper_thread (MonoProfiler* prof)
 		close (prof->server_socket);
 		return 0;
 	}
+	slen = sizeof (server_address);
 	if (getsockname (prof->server_socket, (struct sockaddr *)&server_address, &slen) == 0) {
 		prof->command_port = ntohs (server_address.sin_port);
 		/*fprintf (stderr, "Assigned server port: %d\n", prof->command_port);*/
@@ -1997,6 +2000,9 @@ create_profiler (const char *filename)
 	if (*nf == '|') {
 		prof->file = popen (nf + 1, "w");
 		prof->pipe_output = 1;
+	} else if (*nf == '#') {
+		int fd = strtol (nf + 1, NULL, 10);
+		prof->file = fdopen (fd, "a");
 	} else {
 		FILE *f;
 		if (force_delete)
@@ -2198,6 +2204,19 @@ set_hsmode (char* val, int allow_empty)
 extern void
 mono_profiler_startup (const char *desc);
 
+extern void
+mono_profiler_startup_log (const char *desc);
+
+/*
+ * this is the entry point that will be used when the profiler
+ * is embedded inside the main executable.
+ */
+void
+mono_profiler_startup_log (const char *desc)
+{
+	mono_profiler_startup (desc);
+}
+
 void
 mono_profiler_startup (const char *desc)
 {
diff --git a/mono/tests/ChangeLog b/mono/tests/ChangeLog
index f77d690..d16a694 100644
--- a/mono/tests/ChangeLog
+++ b/mono/tests/ChangeLog
@@ -1,3 +1,9 @@
+2011-08-28  Zoltan Varga  <vargaz at gmail.com>
+
+	Allow pointers to structures to be passed in pinvoke, MS seems to
+	allow this at least in some cases. Fixes bxc #158. This partially
+	reverts c4d9097c5719bc9455593a47d8d7d2585f1219ec.
+
 2011-08-08  Harry Wilkinson  <hwilkinson at mdsol.com>
 
 	Include mono/tests/delegate2.exe.config to the source tarball so
diff --git a/mono/tests/Makefile.in b/mono/tests/Makefile.in
index 459f570..529767a 100644
--- a/mono/tests/Makefile.in
+++ b/mono/tests/Makefile.in
@@ -877,9 +877,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign mono/tests/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu mono/tests/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign mono/tests/Makefile
+	  $(AUTOMAKE) --gnu mono/tests/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
diff --git a/mono/tests/assemblyresolve/Makefile.in b/mono/tests/assemblyresolve/Makefile.in
index e0e6e85..f332da7 100644
--- a/mono/tests/assemblyresolve/Makefile.in
+++ b/mono/tests/assemblyresolve/Makefile.in
@@ -262,9 +262,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign mono/tests/assemblyresolve/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu mono/tests/assemblyresolve/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign mono/tests/assemblyresolve/Makefile
+	  $(AUTOMAKE) --gnu mono/tests/assemblyresolve/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
diff --git a/mono/tests/cas/Makefile.in b/mono/tests/cas/Makefile.in
index beb0553..5ecbfda 100644
--- a/mono/tests/cas/Makefile.in
+++ b/mono/tests/cas/Makefile.in
@@ -303,9 +303,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign mono/tests/cas/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu mono/tests/cas/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign mono/tests/cas/Makefile
+	  $(AUTOMAKE) --gnu mono/tests/cas/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
diff --git a/mono/tests/cas/assembly/Makefile.in b/mono/tests/cas/assembly/Makefile.in
index 16d005a..58fc493 100644
--- a/mono/tests/cas/assembly/Makefile.in
+++ b/mono/tests/cas/assembly/Makefile.in
@@ -269,9 +269,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign mono/tests/cas/assembly/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu mono/tests/cas/assembly/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign mono/tests/cas/assembly/Makefile
+	  $(AUTOMAKE) --gnu mono/tests/cas/assembly/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
diff --git a/mono/tests/cas/demand/Makefile.in b/mono/tests/cas/demand/Makefile.in
index 2e2f5dd..dc5d747 100644
--- a/mono/tests/cas/demand/Makefile.in
+++ b/mono/tests/cas/demand/Makefile.in
@@ -273,9 +273,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign mono/tests/cas/demand/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu mono/tests/cas/demand/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign mono/tests/cas/demand/Makefile
+	  $(AUTOMAKE) --gnu mono/tests/cas/demand/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
diff --git a/mono/tests/cas/inheritance/Makefile.in b/mono/tests/cas/inheritance/Makefile.in
index 6249b23..a84e809 100644
--- a/mono/tests/cas/inheritance/Makefile.in
+++ b/mono/tests/cas/inheritance/Makefile.in
@@ -276,9 +276,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign mono/tests/cas/inheritance/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu mono/tests/cas/inheritance/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign mono/tests/cas/inheritance/Makefile
+	  $(AUTOMAKE) --gnu mono/tests/cas/inheritance/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
diff --git a/mono/tests/cas/linkdemand/Makefile.in b/mono/tests/cas/linkdemand/Makefile.in
index 1f35af6..3fb9829 100644
--- a/mono/tests/cas/linkdemand/Makefile.in
+++ b/mono/tests/cas/linkdemand/Makefile.in
@@ -281,9 +281,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign mono/tests/cas/linkdemand/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu mono/tests/cas/linkdemand/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign mono/tests/cas/linkdemand/Makefile
+	  $(AUTOMAKE) --gnu mono/tests/cas/linkdemand/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
diff --git a/mono/tests/cas/threads/Makefile.in b/mono/tests/cas/threads/Makefile.in
index 74854ce..93fcfb8 100644
--- a/mono/tests/cas/threads/Makefile.in
+++ b/mono/tests/cas/threads/Makefile.in
@@ -276,9 +276,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign mono/tests/cas/threads/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu mono/tests/cas/threads/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign mono/tests/cas/threads/Makefile
+	  $(AUTOMAKE) --gnu mono/tests/cas/threads/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
diff --git a/mono/tests/pinvoke2.cs b/mono/tests/pinvoke2.cs
index 4c19f35..41d9fe7 100644
--- a/mono/tests/pinvoke2.cs
+++ b/mono/tests/pinvoke2.cs
@@ -1300,6 +1300,8 @@ public class Tests {
 	 * Pointers to structures can not be passed
 	 */
 
+	/* This seems to be allowed by MS in some cases */
+	/*
 	public struct CharInfo {
 		public char Character;
 		public short Attributes;
@@ -1321,6 +1323,7 @@ public class Tests {
 		}
 		return 1;
 	}
+	*/
 
 	/*
 	 * LPWStr marshalling
diff --git a/mono/utils/ChangeLog b/mono/utils/ChangeLog
index 88e5254..2cc55b1 100644
--- a/mono/utils/ChangeLog
+++ b/mono/utils/ChangeLog
@@ -1,3 +1,50 @@
+2011-12-14  Duncan Mak  <duncan.mak at xamarin.com>
+
+	Fix typo from commit b4c110c.
+
+2011-12-08  Paolo Molaro  <lupus at oddwiz.org>
+
+	Do the multiplication/division with floating point numbers in time
+	calculations on win32.
+
+2011-12-07  Paolo Molaro  <lupus at oddwiz.org>
+
+	Fix overflow in the win32 monotonic time (xambug #183).
+
+2011-12-05  Rodrigo Kumpera  <kumpera at gmail.com>
+
+	Backport utils/mono-tls.h.
+
+2011-11-21  Jonathan Pryor  <jonp at xamarin.com>
+
+	[MonoDroid] Fix the libmono build.
+
+	7e49d08a nee 2763aae9c doesn't build because <fcntl.h> is missing:
+
+	mono/utils/mono-proclib.c:517: error: 'O_RDONLY' undeclared (first
+	use in this function
+
+	Fix the build.
+
+2011-11-16  Jérémie Laval  <jeremie.laval at gmail.com>
+
+	Fix previous commit
+
+2011-11-16  Jérémie Laval  <jeremie.laval at gmail.com>
+
+	[MonoDroid] Query hardware CPU count for
+	Environment.ProcessorCount
+
+2011-11-04  Sebastien Pouliot  <sebastien at xamarin.com>
+
+	OSX and iOS does not support CLOCK_MONOTONIC so we use
+	mach_timebase_info instead. Fix bug #1366
+
+2011-10-13  David Evans  <devans at mac.com>
+
+	Fix regression to System.Diagnostics.Process.PrivateMemorySize64
+	(). Fixes #1459
+
 2011-08-17  Miguel de Icaza  <miguel at gnome.org>
 
 	updated copyrights
diff --git a/mono/utils/Makefile.am b/mono/utils/Makefile.am
index d9209c4..4a86a07 100644
--- a/mono/utils/Makefile.am
+++ b/mono/utils/Makefile.am
@@ -72,6 +72,7 @@ monoutils_sources = \
 	mono-membar.h	\
 	mono-path.h	\
 	mono-poll.h	\
+	mono-tls.h  	\
 	mono-uri.h	\
 	mono-stdlib.h	\
 	valgrind.h	\
diff --git a/mono/utils/Makefile.in b/mono/utils/Makefile.in
index 93a627d..d8a43dd 100644
--- a/mono/utils/Makefile.in
+++ b/mono/utils/Makefile.in
@@ -73,10 +73,10 @@ am__libmonoutils_la_SOURCES_DIST = mono-md5.c mono-sha1.c \
 	freebsd-elf64.h freebsd-dwarf.h dtrace.h gc_wrapper.h \
 	mono-error.c mono-error-internals.h monobitset.h \
 	mono-codeman.h mono-counters.h mono-digest.h mono-error.h \
-	mono-math.h mono-membar.h mono-path.h mono-poll.h mono-uri.h \
-	mono-stdlib.h valgrind.h mach-support.c mach-support.h \
-	memcheck.h mach-support-x86.c mach-support-amd64.c \
-	mach-support-arm.c
+	mono-math.h mono-membar.h mono-path.h mono-poll.h mono-tls.h \
+	mono-uri.h mono-stdlib.h valgrind.h mach-support.c \
+	mach-support.h memcheck.h mach-support-x86.c \
+	mach-support-amd64.c mach-support-arm.c
 am__objects_1 = mono-md5.lo mono-sha1.lo mono-logger.lo \
 	mono-codeman.lo dlmalloc.lo mono-counters.lo mono-dl.lo \
 	mono-internal-hash.lo mono-io-portability.lo monobitset.lo \
@@ -388,6 +388,7 @@ monoutils_sources = \
 	mono-membar.h	\
 	mono-path.h	\
 	mono-poll.h	\
+	mono-tls.h  	\
 	mono-uri.h	\
 	mono-stdlib.h	\
 	valgrind.h	\
@@ -419,9 +420,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign mono/utils/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu mono/utils/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign mono/utils/Makefile
+	  $(AUTOMAKE) --gnu mono/utils/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
diff --git a/mono/utils/mono-proclib.c b/mono/utils/mono-proclib.c
index 0b1d0c6..48a99a7 100644
--- a/mono/utils/mono-proclib.c
+++ b/mono/utils/mono-proclib.c
@@ -4,6 +4,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
+#include <fcntl.h>
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
@@ -431,7 +432,7 @@ get_pid_status_item (int pid, const char *item, MonoProcessError *error, int mul
 
 	s = get_pid_status_item_buf (pid, item, buf, sizeof (buf), error);
 	if (s)
-		return atoi (s) * multiplier;
+		return ((gint64) atol (s)) * multiplier;
 	return 0;
 #endif
 }
@@ -507,7 +508,26 @@ mono_process_get_data (gpointer pid, MonoProcessData data)
 int
 mono_cpu_count (void)
 {
-	int count;
+	int count = 0;
+#ifdef PLATFORM_ANDROID
+	/* Android tries really hard to save power by powering off CPUs on SMP phones which
+	 * means the normal way to query cpu count returns a wrong value with userspace API.
+	 * Instead we use /sys entries to query the actual hardware CPU count.
+	 */
+	char buffer[8] = {'\0'};
+	int present = open ("/sys/devices/system/cpu/present", O_RDONLY);
+	/* Format of the /sys entry is a cpulist of indexes which in the case
+	 * of present is always of the form "0-(n-1)" when there is more than
+	 * 1 core, n being the number of CPU cores in the system. Otherwise
+	 * the value is simply 0
+	 */
+	if (present != -1 && read (present, (char*)buffer, sizeof (buffer)) > 3)
+		count = strtol (((char*)buffer) + 2, NULL, 10);
+	if (present != -1)
+		close (present);
+	if (count > 0)
+		return count + 1;
+#endif
 #ifdef _SC_NPROCESSORS_ONLN
 	count = sysconf (_SC_NPROCESSORS_ONLN);
 	if (count > 0)
diff --git a/mono/utils/mono-time.c b/mono/utils/mono-time.c
index 4e923e6..2bf306e 100644
--- a/mono/utils/mono-time.c
+++ b/mono/utils/mono-time.c
@@ -25,12 +25,20 @@ gint64
 mono_100ns_ticks (void)
 {
 	static LARGE_INTEGER freq;
+	static UINT64 start_time;
+	UINT64 cur_time;
 	LARGE_INTEGER value;
 
-	if (!freq.QuadPart && !QueryPerformanceFrequency (&freq))
-		return mono_100ns_datetime ();
+	if (!freq.QuadPart) {
+		if (!QueryPerformanceFrequency (&freq))
+			return mono_100ns_datetime ();
+		QueryPerformanceCounter (&value);
+		start_time = value.QuadPart;
+	}
 	QueryPerformanceCounter (&value);
-	return value.QuadPart * MTICKS_PER_SEC / freq.QuadPart;
+	cur_time = value.QuadPart;
+	/* we use unsigned numbers and return the difference to avoid overflows */
+	return (cur_time - start_time) * (double)MTICKS_PER_SEC / freq.QuadPart;
 }
 
 /*
@@ -62,6 +70,11 @@ mono_100ns_datetime (void)
 #include <sys/sysctl.h>
 #endif
 
+#if defined(PLATFORM_MACOSX)
+#include <mach/mach.h>
+#include <mach/mach_time.h>
+#endif
+
 #include <time.h>
 
 static gint64
@@ -131,6 +144,15 @@ mono_100ns_ticks (void)
 		}
 	}
 	
+#elif defined(PLATFORM_MACOSX)
+	/* http://developer.apple.com/library/mac/#qa/qa1398/_index.html */
+	static mach_timebase_info_data_t timebase;
+	guint64 now = mach_absolute_time ();
+	if (timebase.denom == 0) {
+		mach_timebase_info (&timebase);
+		timebase.denom *= 100; /* we return 100ns ticks */
+	}
+	return now * timebase.numer / timebase.denom;
 #endif
 	if (gettimeofday (&tv, NULL) == 0)
 		return ((gint64)tv.tv_sec * 1000000 + tv.tv_usec) * 10;
diff --git a/mono/utils/mono-tls.h b/mono/utils/mono-tls.h
new file mode 100644
index 0000000..c387084
--- /dev/null
+++ b/mono/utils/mono-tls.h
@@ -0,0 +1,53 @@
+/*
+ * mono-tls.h: Low-level TLS support
+ *
+ * Author:
+ *	Rodrigo Kumpera (kumpera at gmail.com)
+ *
+ * Copyright 2011 Novell, Inc (http://www.novell.com)
+ * Copyright 2011 Xamarin, Inc (http://www.xamarin.com)
+ */
+
+#ifndef __MONO_TLS_H__
+#define __MONO_TLS_H__
+
+
+#ifdef HOST_WIN32
+
+#include <windows.h>
+
+#define MonoNativeTlsKey DWORD
+#define mono_native_tls_alloc(key,destructor) ((*(key) = TlsAlloc ()) != TLS_OUT_OF_INDEXES && destructor == NULL)
+#define mono_native_tls_free TlsFree
+#define mono_native_tls_set_value TlsSetValue
+#define mono_native_tls_get_value TlsGetValue
+
+#else
+
+#include <pthread.h>
+
+#define MonoNativeTlsKey pthread_key_t
+#define mono_native_tls_get_value pthread_getspecific
+
+static inline int
+mono_native_tls_alloc (MonoNativeTlsKey *key, void *destructor)
+{
+	return pthread_key_create (key, destructor) == 0;
+}
+
+static inline void
+mono_native_tls_free (MonoNativeTlsKey key)
+{
+	pthread_key_delete (key);
+}
+
+static inline int
+mono_native_tls_set_value (MonoNativeTlsKey key, gpointer value)
+{
+	return !pthread_setspecific (key, value);
+}
+
+#endif /* HOST_WIN32 */
+
+
+#endif /* __MONO_TLS_H__ */
diff --git a/msvc/Makefile.in b/msvc/Makefile.in
index 4517f40..5048d8a 100644
--- a/msvc/Makefile.in
+++ b/msvc/Makefile.in
@@ -287,9 +287,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign msvc/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu msvc/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign msvc/Makefile
+	  $(AUTOMAKE) --gnu msvc/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
diff --git a/po/Makefile.in b/po/Makefile.in
index e0e5683..0f0fde6 100644
--- a/po/Makefile.in
+++ b/po/Makefile.in
@@ -299,9 +299,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign po/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu po/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign po/Makefile
+	  $(AUTOMAKE) --gnu po/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
diff --git a/samples/Makefile.in b/samples/Makefile.in
index 656d9f5..6c58151 100644
--- a/samples/Makefile.in
+++ b/samples/Makefile.in
@@ -258,9 +258,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign samples/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu samples/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign samples/Makefile
+	  $(AUTOMAKE) --gnu samples/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
diff --git a/scripts/Makefile.in b/scripts/Makefile.in
index 7383c92..e3b57e2 100644
--- a/scripts/Makefile.in
+++ b/scripts/Makefile.in
@@ -444,9 +444,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign scripts/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu scripts/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign scripts/Makefile
+	  $(AUTOMAKE) --gnu scripts/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
diff --git a/scripts/mono-test-install b/scripts/mono-test-install
index 362eed4..af0727f 100755
--- a/scripts/mono-test-install
+++ b/scripts/mono-test-install
@@ -41,7 +41,6 @@ if pkg-config --modversion mono >& /dev/null; then
 	    echo "       than the Mono found:"
 	    echo "       Mono on PATH: $monocmd"
 	    echo "       Mono from pkg-config: $pkg_config_mono"
-	    exit 1
 	fi
 else 
         echo "Warning: pkg-config could not find mono installed on this system"
diff --git a/support/Makefile.in b/support/Makefile.in
index 2f6966e..efdc008 100644
--- a/support/Makefile.in
+++ b/support/Makefile.in
@@ -452,9 +452,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign support/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu support/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign support/Makefile
+	  $(AUTOMAKE) --gnu support/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
diff --git a/tools/Makefile.in b/tools/Makefile.in
index 278ee51..708cd84 100644
--- a/tools/Makefile.in
+++ b/tools/Makefile.in
@@ -299,9 +299,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign tools/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu tools/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign tools/Makefile
+	  $(AUTOMAKE) --gnu tools/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
diff --git a/tools/locale-builder/Makefile.in b/tools/locale-builder/Makefile.in
index bf10b00..dcc18e3 100644
--- a/tools/locale-builder/Makefile.in
+++ b/tools/locale-builder/Makefile.in
@@ -397,9 +397,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign tools/locale-builder/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu tools/locale-builder/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign tools/locale-builder/Makefile
+	  $(AUTOMAKE) --gnu tools/locale-builder/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
diff --git a/tools/sgen/Makefile.in b/tools/sgen/Makefile.in
index 6b7686e..ab69a61 100644
--- a/tools/sgen/Makefile.in
+++ b/tools/sgen/Makefile.in
@@ -286,9 +286,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign tools/sgen/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu tools/sgen/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign tools/sgen/Makefile
+	  $(AUTOMAKE) --gnu tools/sgen/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \

-- 
mono



More information about the Pkg-mono-svn-commits mailing list