(This is in response to an earlier "howto" from Dave Morford.)

a. comment out the #ifdef __APPLE__ at the top of the file mono/io-layer/sockets.h. This is not needed on 10.3, only 10.2.
b. in mono/mini, run: grep -n "version-script" Makefile. This should return, at least on the 0.30 Previews, the following: 157:#monoldflags = -Wl,-version-script=$(srcdir)/ldscript. If this line is not commented out and/or has a ./ldscript instead of $(srcdir)/ldscript, you can comment it out or remove the "-Wl,". I commented it out to no problems as well as removed the "-Wl,", which fails when linking.

Attached is a patch that fixes these issues properly, within autoconf and automake. You still need to do glibtoolize and friends (autogen.sh stuff) until a new release is made, though.


It removes the hardcoded apple "socklen_t" thing, and instead does a check for socklen_t in autoconf (taken, somewhat, from KDE's checks). (Then it patches anything that includes mono/io-layer/sockets.h, directly or indirectly, to include config.h to get the socklen_t define, since I didn't want to touch headers.) I ended up having to patch a decent number of c files to make them find config.h; I don't know if external projects link against the mono headers a lot, but if they do maybe there needs to be a way to encode the socklen_t bits into the headers so other projects don't need these same defines.

It also defines an automake conditional on GNU ld for the -version-script thing, since, as far as I'm aware, that's a gnuism.

These changes let it work on panther or jaguar... Possibly earlier, I don't have a 10.1 or earlier system to test with.

1. Some of the assumptions in the configure scripts, in particular threading, need to be examined. gcc does not need the -pthread flags to be specified according to Apple's documentation for the 10.3 Developer tool chain. Most of the standard library modules live in libSystem.dylib, which is always linked in.

Yeah, it's no big deal, though. Apple's gcc just ignores -pthread. The pthread stuff is in libSystem, so nothing's lost. Just get an annoying message to the screen while compiling. ;)


2. The ICU check looks for icu-config and fails but ICU *is* present on OS X Panther in /usr/lib/libicucore.dylib but the icu-config tool is not present. Perhaps a better check for this is possible? Does it need to be linked in or is icu-config called or used anywhere?

The only thing that's there is the library, no headers or configuration. Apple does that when they've included a library, but they're not willing to officially support the library (in a binary-compatible way). You'll need to build your own, or download apple's project from www.opensource.apple.com and try building everything yourself but only install headers and config bits.



diff -uNr mono-0.30/configure.in mono-0.30-patched/configure.in
--- mono-0.30/configure.in      Sat Jan 17 13:55:29 2004
+++ mono-0.30-patched/configure.in      Mon Jan 26 10:56:35 2004
@@ -141,6 +141,11 @@
 AC_SUBST(HOST_CC)
 AC_SUBST(BUILD_EXEEXT)
 
+# check for GNU LD, this comes from libtool.m4
+AC_PROG_LD
+AC_PROG_LD_GNU
+AM_CONDITIONAL(LD_GNU, test x$lt_cv_prog_gnu_ld = xyes)
+
 # Set STDC_HEADERS
 AC_HEADER_STDC
 AC_LIBTOOL_WIN32_DLL
@@ -351,6 +356,38 @@
        dnl *** Checks for libsocket  ***
        dnl *****************************
        AC_CHECK_LIB(socket, socket, LIBS="$LIBS -lsocket")
+
+       dnl ****************************
+       dnl *** Checks for socklen_t ***
+       dnl ****************************
+
+       AC_MSG_CHECKING([for socklen_t])
+       ac_cv_socklen_t=""
+       AC_TRY_COMPILE([
+#include <sys/types.h>
+#include <sys/socket.h>
+       ],[
+socklen_t a=0;
+getsockname(0,(struct sockaddr*)0, &a);
+       ],
+               ac_cv_socklen_t="socklen_t",
+               AC_TRY_COMPILE([
+#include <sys/types.h>
+#include <sys/socket.h>
+               ],[
+int a=0;
+getsockname(0,(struct sockaddr*)0, &a);
+               ],
+                       ac_cv_socklen_t="int",
+                       ac_cv_socklen_t="size_t"
+               )
+       )
+
+       AC_MSG_RESULT($ac_cv_socklen_t)
+       if test "$ac_cv_socklen_t" != "socklen_t"; then
+               AC_DEFINE_UNQUOTED(socklen_t, $ac_cv_socklen_t,
+                       [Define the real type of socklen_t])
+       fi
 
        dnl *******************************
        dnl *** Checks for MSG_NOSIGNAL ***
diff -uNr mono-0.30/mono/interpreter/main.c mono-0.30-patched/mono/interpreter/main.c
--- mono-0.30/mono/interpreter/main.c   Fri Dec 19 15:19:37 2003
+++ mono-0.30-patched/mono/interpreter/main.c   Mon Jan 26 11:40:09 2004
@@ -1,3 +1,4 @@
+#include <config.h>
 #include "interp.h"
 #include "embed.h"
 
diff -uNr mono-0.30/mono/io-layer/sockets.h mono-0.30-patched/mono/io-layer/sockets.h
--- mono-0.30/mono/io-layer/sockets.h   Fri Nov 21 11:56:00 2003
+++ mono-0.30-patched/mono/io-layer/sockets.h   Mon Jan 26 10:27:39 2004
@@ -23,10 +23,6 @@
 #define WSADESCRIPTION_LEN 256
 #define WSASYS_STATUS_LEN 128
 
-#ifdef __APPLE__
-typedef unsigned int socklen_t;
-#endif
-
 typedef struct 
 {
        guint16 wVersion;
diff -uNr mono-0.30/mono/metadata/debug-helpers.c 
mono-0.30-patched/mono/metadata/debug-helpers.c
--- mono-0.30/mono/metadata/debug-helpers.c     Mon Nov 24 22:07:26 2003
+++ mono-0.30-patched/mono/metadata/debug-helpers.c     Mon Jan 26 11:39:37 2004
@@ -1,4 +1,4 @@
-
+#include <config.h>
 #include <string.h>
 #include "mono/metadata/tokentype.h"
 #include "mono/metadata/opcodes.h"
diff -uNr mono-0.30/mono/metadata/decimal.c mono-0.30-patched/mono/metadata/decimal.c
--- mono-0.30/mono/metadata/decimal.c   Fri Oct  3 13:02:34 2003
+++ mono-0.30-patched/mono/metadata/decimal.c   Mon Jan 26 11:39:37 2004
@@ -13,6 +13,7 @@
  * CSharp value type System.Decimal
  */
 
+#include <config.h>
 #include <mono/metadata/exception.h>
 #include <stdio.h>
 #include <memory.h>
diff -uNr mono-0.30/mono/metadata/exception.c 
mono-0.30-patched/mono/metadata/exception.c
--- mono-0.30/mono/metadata/exception.c Mon Jan 19 15:02:30 2004
+++ mono-0.30-patched/mono/metadata/exception.c Mon Jan 26 11:39:37 2004
@@ -10,6 +10,7 @@
  * (C) 2001, 2002 Ximian, Inc.
  */
 
+#include <config.h>
 #include <mono/metadata/exception.h>
 #include <mono/metadata/class.h>
 #include <mono/metadata/appdomain.h>
diff -uNr mono-0.30/mono/metadata/monosn.c mono-0.30-patched/mono/metadata/monosn.c
--- mono-0.30/mono/metadata/monosn.c    Thu Sep  4 15:46:43 2003
+++ mono-0.30-patched/mono/metadata/monosn.c    Mon Jan 26 11:39:37 2004
@@ -7,6 +7,7 @@
  * (C) 2002 Ximian, Inc.
  *
  */
+#include <config.h>
 #include <mono/metadata/class.h>
 #include <mono/metadata/debug-helpers.h>
 #include <mono/metadata/tokentype.h>
diff -uNr mono-0.30/mono/metadata/profiler.c mono-0.30-patched/mono/metadata/profiler.c
--- mono-0.30/mono/metadata/profiler.c  Fri Jan  2 09:47:10 2004
+++ mono-0.30-patched/mono/metadata/profiler.c  Mon Jan 26 11:39:37 2004
@@ -1,4 +1,4 @@
-
+#include <config.h>
 #include "mono/metadata/profiler-private.h"
 #include "mono/metadata/debug-helpers.h"
 #include "mono/metadata/mono-debug.h"
diff -uNr mono-0.30/mono/metadata/verify.c mono-0.30-patched/mono/metadata/verify.c
--- mono-0.30/mono/metadata/verify.c    Mon Jan 19 15:02:31 2004
+++ mono-0.30-patched/mono/metadata/verify.c    Mon Jan 26 11:23:44 2004
@@ -1,4 +1,4 @@
-
+#include <config.h>
 #include <mono/metadata/object.h>
 #include <mono/metadata/verify.h>
 #include <mono/metadata/opcodes.h>
diff -uNr mono-0.30/mono/mini/Makefile.am mono-0.30-patched/mono/mini/Makefile.am
--- mono-0.30/mono/mini/Makefile.am     Fri Dec  5 02:21:43 2003
+++ mono-0.30-patched/mono/mini/Makefile.am     Mon Jan 26 10:51:08 2004
@@ -28,7 +28,9 @@
 # hack for automake to have the same source file in a library and a bin
 genmdesc_CFLAGS = $(AM_CFLAGS)
 
+if LD_GNU
 libmono_la_LDFLAGS=-Wl,-version-script=$(srcdir)/ldscript
+endif
 
 if JIT_SUPPORTED
 bin_PROGRAMS = mono
diff -uNr mono-0.30/mono/mini/dominators.c mono-0.30-patched/mono/mini/dominators.c
--- mono-0.30/mono/mini/dominators.c    Sat Apr  5 14:21:32 2003
+++ mono-0.30-patched/mono/mini/dominators.c    Mon Jan 26 11:40:47 2004
@@ -7,6 +7,7 @@
  *
  * (C) 2003 Ximian, Inc.
  */
+#include <config.h>
 #include <string.h>
 #include <mono/metadata/debug-helpers.h>
 
diff -uNr mono-0.30/mono/mini/graph.c mono-0.30-patched/mono/mini/graph.c
--- mono-0.30/mono/mini/graph.c Mon Sep  1 12:09:40 2003
+++ mono-0.30-patched/mono/mini/graph.c Mon Jan 26 11:40:47 2004
@@ -6,6 +6,7 @@
  *
  * (C) 2003 Ximian, Inc.
  */
+#include <config.h>
 #include <string.h>
 #include <mono/metadata/debug-helpers.h>
 
diff -uNr mono-0.30/mono/mini/ssa.c mono-0.30-patched/mono/mini/ssa.c
--- mono-0.30/mono/mini/ssa.c   Sat Jan  3 20:08:38 2004
+++ mono-0.30-patched/mono/mini/ssa.c   Mon Jan 26 11:40:47 2004
@@ -6,6 +6,7 @@
  *
  * (C) 2003 Ximian, Inc.
  */
+#include <config.h>
 #include <string.h>
 #include <mono/metadata/debug-helpers.h>
 
diff -uNr mono-0.30/mono/monograph/monograph.c 
mono-0.30-patched/mono/monograph/monograph.c
--- mono-0.30/mono/monograph/monograph.c        Wed Nov 12 13:49:11 2003
+++ mono-0.30-patched/mono/monograph/monograph.c        Mon Jan 26 11:39:47 2004
@@ -1,3 +1,4 @@
+#include <config.h>
 #include <glib.h>
 #include <string.h>
 #include "mono/metadata/class.h"
diff -uNr mono-0.30/mono/profiler/mono-cov.c mono-0.30-patched/mono/profiler/mono-cov.c
--- mono-0.30/mono/profiler/mono-cov.c  Wed Nov 12 13:49:11 2003
+++ mono-0.30-patched/mono/profiler/mono-cov.c  Mon Jan 26 11:40:59 2004
@@ -1,3 +1,4 @@
+#include <config.h>
 #include <mono/metadata/profiler.h>
 #include <mono/metadata/tokentype.h>
 #include <mono/metadata/tabledefs.h>

Reply via email to