This is a series of patches to add support to Mono for building against
the Android NDK [0].  Android runs the Linux kernel, but moves many
things around compared to a "normal" desktop Linux distro.

These patches are based against the mono-2-6 branch.

This second patch patches libgc so that it will properly build and link
under Android.  In particular, note that Android includes pthread_*()
functions within libc, not libpthread, thus the added configure check.

        * include/private/gcconfig.h: Android platforms are built atop Linux,
          don't use glibc, and uses `environ` instead of `__environ`.
        * configure.in: Use AC_CHECK_LIB() to check for pthread instead of
          just blindly linking to -lpthread, as Android includes pthread
          support within libc and doesn't provide a separate libpthread.


Permission to commit?

- Jon

[0] http://developer.android.com/sdk/ndk/index.html

Index: libgc/include/private/gcconfig.h
===================================================================
--- libgc/include/private/gcconfig.h	(revision 155735)
+++ libgc/include/private/gcconfig.h	(working copy)
@@ -713,6 +713,9 @@
 #	     if defined(__GLIBC__)&& __GLIBC__>=2
 #              define SEARCH_FOR_DATA_START
 #	     else /* !GLIBC2 */
+#              if defined(PLATFORM_ANDROID)
+#                      define __environ environ
+#              endif
                extern char **__environ;
 #              define DATASTART ((ptr_t)(&__environ))
                              /* hideous kludge: __environ is the first */
Index: libgc/configure.in
===================================================================
--- libgc/configure.in	(revision 155735)
+++ libgc/configure.in	(working copy)
@@ -84,7 +84,7 @@
     ;;
  posix | pthreads)
     THREADS=posix
-    THREADDLLIBS=-lpthread
+    AC_CHECK_LIB(pthread, pthread_self, THREADDLLIBS="-lpthread",,)
     case "$host" in
      x86-*-linux* | ia64-*-linux* | i386-*-linux* | i486-*-linux* | i586-*-linux* | i686-*-linux* | x86_64-*-linux* | alpha*-*-linux* | s390*-*-linux* | sparc*-*-linux* | powerpc-*-linux*)
 	AC_DEFINE(GC_LINUX_THREADS)
Index: libgc/ChangeLog
===================================================================
--- libgc/ChangeLog	(revision 155735)
+++ libgc/ChangeLog	(working copy)
@@ -1,3 +1,11 @@
+2010-04-19  Jonathan Pryor  <jpr...@novell.com>
+
+	* include/private/gcconfig.h: Android platforms are built atop Linux,
+	  don't use glibc, and uses `environ` instead of `__environ`.
+	* configure.in: Use AC_CHECK_LIB() to check for pthread instead of
+	  just blindly linking to -lpthread, as Android includes pthread
+	  support within libc and doesn't provide a separate libpthread.
+
 2010-03-09  Zoltan Varga  <var...@gmail.com>
 
 	* include/private/gc_locks.h: Fix amd64 build with newer gcc's.
_______________________________________________
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list

Reply via email to