2009-06-01 Jeffrey Stedfast <fejj@novell.com>
[moon.git] / m4 / mono.m4
blob50600f890b1fc187c2602b2e84581a2c28dd3a61
1 AC_DEFUN([MOONLIGHT_CHECK_MONO],
3         MONO_REQUIRED_VERSION=2.0
4         MONO_REQUIRED_BROWSER_VERSION=2.5
6         MOON_ARG_ENABLED_BY_DEFAULT([browser-support], [Disable the browser plugin])
7         browser_support=$enableval
8         if test "x$browser_support" = xyes; then
9                 MONO_REQUIRED_VERSION=$MONO_REQUIRED_BROWSER_VERSION
11                 dnl 
12                 dnl path to mcs checkout
13                 dnl 
14                 AC_ARG_WITH(mcspath, AC_HELP_STRING([--with-mcspath=<path>], []),
15                         [], [with_mcspath=$srcdir/../mcs])
17                 if test "x$with_mcspath" = "xno"; then
18                         AC_ERROR(You need to set the path to mcs)
19                 fi
20                         
21                 if test ! -d "$with_mcspath"; then
22                         AC_ERROR(mcs_path doesn't exist)
23                 fi
25                 MCS_PATH=$(cd "$with_mcspath" && pwd)
26                 AC_SUBST(MCS_PATH)
27         
28                 dnl
29                 dnl path to mono-basic checkout
30                 dnl
31                 AC_ARG_WITH(mono_basic_path, AC_HELP_STRING([--with-mono-basic-path=<path>], []),
32                         [], [with_mono_basic_path=$srcdir/../mono-basic])
33                         
34                 if test "x$with_mono_basic_path" = "xno"; then
35                         AC_MSG_WARN([You need to set the path to mono-basic to include Microsoft.VisualBasic.dll in your Moonlight install])
36                         with_mono_basic_path="no"
37                 else
38                         if test ! -d "$with_mono_basic_path"; then
39                                 AC_MSG_WARN([The path to mono-basic does not exist, you need to set it to an existing directory to include Microsoft.VisualBasic.dll in your Moonlight install])
40                                 with_mono_basic_path="no"
41                         fi
42                 fi
44                 if test "x$with_mono_basic_path" = "xno"; then
45                         AM_CONDITIONAL([HAVE_MONO_BASIC], false)
46                 else
47                         MONO_BASIC_PATH=$(cd "$with_mono_basic_path" && pwd)
48                         AC_SUBST(MONO_BASIC_PATH)
49                         AM_CONDITIONAL([HAVE_MONO_BASIC], true)
50                 fi
52                 AC_DEFINE([PLUGIN_SL_2_0], [1], [Enable Silverlight 2.0 support for the plugin])
53         else
54                 AM_CONDITIONAL([HAVE_MONO_BASIC], false)
55         fi
57         MOON_ARG_ENABLED_BY_DEFAULT([desktop-support], [Disable support for Moonlight-based desktop applications])
58         desktop_support=$enableval
59         if test "x$desktop_support" = xyes; then
60                 PKG_CHECK_MODULES(GTKSHARP, gtk-sharp-2.0)
62                 rsvg_sharp_pcs="rsvg-sharp-2.0 rsvg2-sharp-2.0"
63                 for pc in $rsvg_sharp_pcs; do
64                         PKG_CHECK_EXISTS($pc, [rsvg_sharp=$pc])
65                 done
67                 PKG_CHECK_MODULES(RSVGSHARP, $rsvg_sharp, [
68                         RSVG_SHARP=$rsvg_sharp
69                         AC_SUBST(RSVG_SHARP)
70                         AM_CONDITIONAL(HAVE_RSVG_SHARP, true)
71                 ], [
72                         AM_CONDITIONAL(HAVE_RSVG_SHARP, false)
73                 ])
74         else
75                 AM_CONDITIONAL(HAVE_RSVG_SHARP, false)
76         fi
78         if test "x$desktop_support" = xno -a "x$browser_support" = xno; then
79                 AC_ERROR(You cannot disable both Browser and Desktop support)
80         fi
82         PKG_CHECK_MODULES(MONO, mono >= $MONO_REQUIRED_VERSION)
84         PKG_CHECK_MODULES(MONO_EXTENDED, mono >= $MONO_REQUIRED_BROWSER_VERSION, 
85                 mono_extended=yes, mono_extended=no)
86         if test x$mono_extended = xyes; then
87                 dnl the logistics for these defines might change in the future
88                 dnl when 2.5+ becomes readily available and it turns out that 
89                 dnl we should always be disabling these features in the 
90                 dnl desktop-only scenario, but for now the 2.5 check is ok
92                 AC_DEFINE([MONO_ENABLE_APP_DOMAIN_CONTROL], [1], 
93                         [Whether Mono 2.5 is available and Deployment should create/destroy App Domains])
95                 AC_DEFINE([MONO_ENABLE_CORECLR_SECURITY], [1], 
96                         [Whether Mono 2.5 is available and CoreCLR security should be enabled])
97         fi
99         AC_DEFINE([SL_2_0], [1], [Enable Silverlight 2.0 support in the runtime])
101         AM_CONDITIONAL(INCLUDE_MANAGED_CODE, true)
102         AM_CONDITIONAL(INCLUDE_BROWSER_MANAGED_CODE, test x$browser_support = xyes)
103         AM_CONDITIONAL(INCLUDE_DESKTOP_MANAGED_CODE, test x$desktop_support = xyes)
105         SL_PROFILE=2.0
106         AC_SUBST([SL_PROFILE])