2009-06-01 Jeffrey Stedfast <fejj@novell.com>
[moon.git] / m4 / mozilla.m4
blob614d24504508c8a267852a37522d69e03615deff
1 AC_DEFUN([MOONLIGHT_CHECK_MOZILLA],
3         with_mozilla=no
4         with_ff3=$browser_support
5         with_ff2=$browser_support
7         dnl
8         dnl Firefox 3
9         dnl
11         AC_ARG_WITH(ff3, AC_HELP_STRING([--with-ff3=no|yes], 
12                 [If you want to enable the xulrunner 1.9 (Firefox 3) bridge]),
13                 [], [with_ff3=yes])
15         if test x$with_ff3 = xyes -a x$browser_support = xyes; then
16                 FF3_MODULES="libxul-unstable mozilla-plugin mozilla-js"
18                 PKG_CHECK_EXISTS($FF3_MODULES,
19                         [with_ff3=yes],
20                         [with_ff3=no ff3_reason="(reason: missing FF3 development packages)"])
22                 if test x$with_ff3 = xyes; then
23                         AC_DEFINE([HAVE_GECKO_1_9], [1], [Gecko 1.9 support])
24                         PKG_CHECK_MODULES(FF3, [$FF3_MODULES glib-2.0])
25                         dnl Strip out problem libraries (should already be in process space)
26                         FF3_LIBS="$(echo $FF3_LIBS | sed -e 's/-lmozjs\|-lplds4\|-lplc4\|-lnspr4//g')"
27                 fi
28         fi
29         
30         AM_CONDITIONAL(HAVE_GECKO_1_9,test x$with_ff3 = xyes)
32         dnl
33         dnl Firefox 2
34         dnl
36         AC_ARG_WITH(ff2, AC_HELP_STRING([--with-ff2=no|yes],
37                 [If you want to enable the xulrunner 1.8.1 (Firefox 2)]),
38                 [], [with_ff2=yes])
40         if test x$with_ff2 = xyes -a x$browser_support = xyes; then
41                 mozilla_xpcom="libxul-missing"
42                 mozilla_xpcom_pcs="xpcom mozilla-xpcom firefox-xpcom xulrunner-xpcom"
43                 for pc in $mozilla_xpcom_pcs; do
44                         PKG_CHECK_EXISTS($pc, [mozilla_xpcom=$pc])
45                 done
46                 
47                 mozilla_plugin="plugin-missing"
48                 mozilla_plugin_pcs="plugin firefox-plugin xulrunner-plugin"
49                 for pc in $mozilla_plugin_pcs; do
50                         PKG_CHECK_EXISTS($pc, [mozilla_plugin=$pc])
51                 done
52                 
53                 if test $mozilla_xpcom = "libxul-missing" -o $mozilla_plugin = "plugin-missing"; then
54                         with_ff2=no
55                 ff2_reason="(reason: missing FF2 development packages)"
56                 else
57                 PKG_CHECK_MODULES(FF2, [$mozilla_xpcom $mozilla_plugin glib-2.0])
58                         dnl Strip out problem libraries (should already be in process space)
59                         FF2_LIBS="$(echo $FF2_LIBS | sed -e 's/-lmozjs\|-lplds4\|-lplc4\|-lnspr4//g')"
60                 fi
61         fi
62         
63         AM_CONDITIONAL(HAVE_GECKO_1_8,test x$with_ff2 = xyes)
65         dnl
66         dnl Put it all together
67         dnl
69         if test x$with_ff2 = xyes; then
70                 with_mozilla=yes
71                 MIN_FIREFOX_VERSION="1.5"
72                 if test x$with_ff3 = xyes; then
73                         MAX_FIREFOX_VERSION="3.5.*"
74                 else
75                         MAX_FIREFOX_VERSION="2.0.0.*"
76                 fi
77         elif test x$with_ff3 = xyes; then
78                 with_mozilla=yes
79         MIN_FIREFOX_VERSION="2.9.*"
80         MAX_FIREFOX_VERSION="3.5.*"
81         fi
83         AC_SUBST([MIN_FIREFOX_VERSION])
84         AC_SUBST([MAX_FIREFOX_VERSION])
85         AM_CONDITIONAL(HAVE_MOZILLA, test x$with_mozilla = xyes)