THRIFT-3295 C# library does not build on Mono 4.0.2.5 or later
Client: C#
Patch: Nobuaki Sukegawa <nsukeg@gmail.com>
This closes #586
diff --git a/configure.ac b/configure.ac
index 71d6517..880cc32 100755
--- a/configure.ac
+++ b/configure.ac
@@ -198,6 +198,13 @@
AX_THRIFT_LIB(csharp, [C#], yes)
if test "$with_csharp" = "yes"; then
+ PKG_CHECK_MODULES(MONO, mono >= 2.11.0, mono_2_11=yes, mono_2_11=no)
+ if test "$mono_2_11" == "yes"; then
+ AC_PATH_PROG([MCS], [mcs])
+ if test "x$MCS" != "x"; then
+ mono_mcs="yes"
+ fi
+ fi
PKG_CHECK_MODULES(MONO, mono >= 2.0.0, net_3_5=yes, net_3_5=no)
PKG_CHECK_MODULES(MONO, mono >= 1.2.4, have_mono=yes, have_mono=no)
if test "$have_mono" = "yes" ; then
@@ -206,6 +213,7 @@
fi
AM_CONDITIONAL(WITH_MONO, [test "$have_csharp" = "yes"])
AM_CONDITIONAL(NET_2_0, [test "$net_3_5" = "no"])
+AM_CONDITIONAL(MONO_MCS, [test "$mono_mcs" = "yes"])
AX_THRIFT_LIB(java, [Java], yes)
if test "$with_java" = "yes"; then
diff --git a/lib/csharp/Makefile.am b/lib/csharp/Makefile.am
index 2e2d7fe..611405d 100644
--- a/lib/csharp/Makefile.am
+++ b/lib/csharp/Makefile.am
@@ -69,7 +69,11 @@
src/TException.cs \
src/TApplicationException.cs
+if MONO_MCS
+CSC=mcs
+else
CSC=gmcs
+endif
if NET_2_0
MONO_DEFINES=/d:NET_2_0
diff --git a/lib/csharp/test/ThriftTest/Makefile.am b/lib/csharp/test/ThriftTest/Makefile.am
index fcde6fc..7125c90 100644
--- a/lib/csharp/test/ThriftTest/Makefile.am
+++ b/lib/csharp/test/ThriftTest/Makefile.am
@@ -18,7 +18,11 @@
#
THRIFT = $(top_builddir)/compiler/cpp/thrift
+if MONO_MCS
+CSC=mcs
+else
CSC=gmcs
+endif
stubs: $(top_srcdir)/test/ThriftTest.thrift
$(THRIFT) --gen csharp -o . $(top_srcdir)/test/ThriftTest.thrift