2009-12-02 Jeffrey Stedfast <fejj@novell.com>
[moon.git] / m4 / mono.m4
blob687f3b2f3153c7492e74340945bf31aa594bf630
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                 PKG_CHECK_MODULES(WNCKSHARP, wnck-sharp-1.0)
64                 rsvg_sharp_pcs="rsvg-sharp-2.0 rsvg2-sharp-2.0"
65                 for pc in $rsvg_sharp_pcs; do
66                         PKG_CHECK_EXISTS($pc, [rsvg_sharp=$pc])
67                 done
69                 PKG_CHECK_MODULES(RSVGSHARP, $rsvg_sharp, [
70                         RSVG_SHARP=$rsvg_sharp
71                         AC_SUBST(RSVG_SHARP)
72                         AM_CONDITIONAL(HAVE_RSVG_SHARP, true)
73                 ], [
74                         AM_CONDITIONAL(HAVE_RSVG_SHARP, false)
75                 ])
76         else
77                 AM_CONDITIONAL(HAVE_RSVG_SHARP, false)
78         fi
80         if test "x$desktop_support" = xno -a "x$browser_support" = xno; then
81                 AC_ERROR(You cannot disable both Browser and Desktop support)
82         fi
84         PKG_CHECK_MODULES(MONO, mono >= $MONO_REQUIRED_VERSION)
86         PKG_CHECK_MODULES(MONO_EXTENDED, mono >= $MONO_REQUIRED_BROWSER_VERSION, 
87                 mono_extended=yes, mono_extended=no)
88         if test x$mono_extended = xyes; then
89                 dnl the logistics for these defines might change in the future
90                 dnl when 2.5+ becomes readily available and it turns out that 
91                 dnl we should always be disabling these features in the 
92                 dnl desktop-only scenario, but for now the 2.5 check is ok
94                 AC_DEFINE([MONO_ENABLE_APP_DOMAIN_CONTROL], [1], 
95                         [Whether Mono 2.5 is available and Deployment should create/destroy App Domains])
97                 AC_DEFINE([MONO_ENABLE_CORECLR_SECURITY], [1], 
98                         [Whether Mono 2.5 is available and CoreCLR security should be enabled])
99         fi
101         AC_DEFINE([SL_2_0], [1], [Enable Silverlight 2.0 support in the runtime])
103         AM_CONDITIONAL(INCLUDE_MANAGED_CODE, true)
104         AM_CONDITIONAL(INCLUDE_BROWSER_MANAGED_CODE, test x$browser_support = xyes)
105         AM_CONDITIONAL(INCLUDE_DESKTOP_MANAGED_CODE, test x$desktop_support = xyes)
107         SL_PROFILE=2.0
108         AC_SUBST([SL_PROFILE])