2005-04-19 Gabor Kelemen <kelemeng@gnome.hu>
[beagle.git] / configure.in
blob49367b3d5060a10c4e9017d4150cc3ed8262faaa
1 AC_INIT(beagled/BeagleDaemon.cs)
2 AC_CANONICAL_SYSTEM
3 AM_INIT_AUTOMAKE(beagle, 0.0.10)
4 AM_MAINTAINER_MODE
5 AM_CONFIG_HEADER(config.h)
7 AC_PROG_INSTALL
8 AM_PROG_LIBTOOL
9 AC_PROG_CXX
11 VERSION=${VERSION}
12 AC_SUBST(VERSION)
14 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
15 if test "x$PKG_CONFIG" = "xno"; then
16         AC_MSG_ERROR([You need to install pkg-config])
19 AC_PATH_PROG(MONO, mono)
20 AC_PATH_PROG(MCS, mcs)
22 AC_MSG_CHECKING([for mono.pc])
23 if test -z `$PKG_CONFIG --variable=prefix mono`; then
24   AC_MSG_ERROR([missing the mono.pc file, usually found in the mono-devel package])
25 else
26   AC_MSG_RESULT([found])
29 # require mono 1.0.6 or newer
30 PKG_CHECK_MODULES(MONO, mono >= 1.0.6) 
32 # check for various mono DLLs that we need.
33 needed_dlls="Mono.Data.SqliteClient Mono.Posix System.Runtime.Remoting System.Web System.Web.Services"
34 for i in $needed_dlls; do
35   AC_MSG_CHECKING([for $i.dll])
36   if test ! -e `$PKG_CONFIG --variable=prefix mono`/lib/mono/1.0/$i.dll; then
37     AC_MSG_ERROR([missing required mono DLL: $i.dll])
38   else
39     AC_MSG_RESULT([found])
40   fi
41 done
44 # I18N
47 AC_PROG_INTLTOOL([0.23])
48 GETTEXT_PACKAGE=beagle
49 AC_SUBST(GETTEXT_PACKAGE)
50 ALL_LINGUAS="de en_CA en_GB es hu ja nb nl no pt_BR sv zh_CN"
51 AM_GLIB_GNU_GETTEXT
53 # Many distros don't have a dependency on sqlite for their
54 # mono-data-sqlite packages, and the mono build process itself
55 # doesn't require it.  But we do, so check for it here.
56 PKG_CHECK_MODULES(SQLITE, sqlite)
58 AC_CHECK_HEADERS(X11/extensions/scrnsaver.h,, [AC_MSG_ERROR([Unable to find scrnsaver.h.  You probably need to install XFree86 development packages])])
60 dnl ******************
61 dnl Mozilla name check
62 dnl ******************
64 AC_MSG_CHECKING([which mozilla to use])
66 MOZILLA=
67 AC_ARG_WITH([mozilla],
68         AC_HELP_STRING([--with-mozilla@<:@=mozilla|firefox|thunderbird@:>@],
69                        [Whether to use mozilla, firefox or thunderbird gtkmozembed (default: mozilla)]),
70         [MOZILLA="$withval"])
72 dnl try to autodetect: if mozilla exists, use it, else try firefox, then thunderbird
73 if test "x$MOZILLA" = "x"; then
74   if pkg-config --exists mozilla-gtkmozembed; then
75     MOZILLA=mozilla
76   elif pkg-config --exists firefox-gtkmozembed; then
77     MOZILLA=firefox
78   elif pkg-config --exists thunderbird-gtkmozembed; then
79     MOZILLA=thunderbird
80   else
81     AC_MSG_ERROR([unable to find gtkmozembed; this can be found in mozilla/firefox/thunderbird development packages])
82   fi
83 elif test "x$with_mozilla" != "xmozilla" -a "x$with_mozilla" != "xfirefox" -a "x$with_mozilla" != "xthunderbird"; then
84   AC_MSG_ERROR([unknown mozilla name ($MOZILLA)])
86                                                                                 
87 AC_SUBST(MOZILLA)
88                                                                                 
89 AC_MSG_RESULT([$MOZILLA])
91 case "$MOZILLA" in
92 mozilla) min_version=1.6 flavour=mozilla ;;
93 firefox) min_version=0.10 flavour=toolkit ;;
94 thunderbird) min_version=0.8 flavour=toolkit ;;
95 esac
97 MOZILLA_FLAVOUR=$flavour
98 AC_SUBST(MOZILLA_FLAVOUR)
99 PKG_CHECK_MODULES(MOZILLA_COMPONENT, $MOZILLA-gtkmozembed >= $min_version $MOZILLA-xpcom >= $min_version)
100 AC_SUBST(MOZILLA_COMPONENT_CFLAGS)
101 AC_SUBST(MOZILLA_COMPONENT_LIBS)
102                                                                                 
103 MOZILLA_INCLUDE_ROOT="`$PKG_CONFIG --variable=includedir $MOZILLA-gtkmozembed`"
104 AC_SUBST(MOZILLA_INCLUDE_ROOT)
106 MOZILLA_HOME="`$PKG_CONFIG --variable=libdir $MOZILLA-gtkmozembed`"
107 AC_SUBST(MOZILLA_HOME)
108                                                                                 
109 MOZILLA_PREFIX="`$PKG_CONFIG --variable=prefix $MOZILLA-gtkmozembed`"
110 AC_SUBST(MOZILLA_PREFIX)
114 dnl *************************************************************************
115 dnl This is from Mozilla's configure.in. They set almost all the config stuff
116 dnl they need in mozilla-config.h Except for this compiler flag, which can't
117 dnl go in mozilla-config.h So we check the flag too and now we can include
118 dnl mozilla-config.h without breaking epiphany.
119 dnl This is really gcc-only
120 dnl Do this test using CXX only since some versions of gcc
121 dnl 2.95-2.97 have a signed wchar_t in c++ only and some versions
122 dnl only have short-wchar support for c++.
123 AC_LANG_PUSH(C++)
124 _SAVE_CXXFLAGS=$CXXFLAGS
125 _SAVE_AM_CXXFLAGS=$AM_CXXFLAGS
126 AM_CXXFLAGS="$AM_CXXFLAGS -fshort-wchar"
127 CXXFLAGS="$CXXFLAGS $AM_CXXFLAGS"
130 AC_CACHE_CHECK(for compiler -fshort-wchar option,
131     ac_cv_have_usable_wchar_option,
132     [AC_TRY_RUN([#include <stddef.h>
133                  int main () {
134                    return (sizeof(wchar_t) != 2) ||
135                           (wchar_t)-1 < (wchar_t) 0 ; } ],
136                 ac_cv_have_usable_wchar_option="yes",
137                 ac_cv_have_usable_wchar_option="no",
138                 ac_cv_have_usable_wchar_option="maybe")])
139                                                                                 
140 if test "$ac_cv_have_usable_wchar_option" != "yes"; then
141     AM_CXXFLAGS=$_SAVE_AM_CXXFLAGS
144 dnl **********************************
145 dnl now tests for mozilla API variance
146 dnl **********************************
147                                                                                 
148 dnl FIXME find a m4/autoconf guru who can distill this into a nice macro
149                                                                                 
150 CXXFLAGS="$_SAVE_CXXFLAGS $AM_CXXFLAGS -I$MOZILLA_INCLUDE_ROOT -I$MOZILLA_INCLUDE_ROOT/embedstring -I$MOZILLA_INCLUDE_ROOT/content -I$MOZILLA_INCLUDE_ROOT/necko `pkg-config --cflags $MOZILLA-xpcom`"
151                                                                                 
152 dnl Changed from PRUnichar* to nsAString& in 1.8a1 and on aviary branch
153                                                                                 
154 AC_MSG_CHECKING([whether nsIFilePicker methods expect nsAString&])
155                                                                                 AC_COMPILE_IFELSE(
156         [AC_LANG_PROGRAM(
157                 [[#include <nsEmbedString.h>
158                   #include <widget/nsIFilePicker.h>]],
159                 [[nsIFilePicker *p;
160                   p->SetDefaultString (nsEmbedString());]]
161         )],
162         [AC_DEFINE([MOZ_NSIFILEPICKER_NSASTRING_],[1],[Define if nsIFilePicker uses nsAString&]) result=yes],
163         [result=no])
164                                                                                 
165 AC_MSG_RESULT([$result])
166                                                                                 
167 dnl Changed from char* to nsAString& in 1.8a1
168                                                                                 
169 AC_MSG_CHECKING([whether nsIMIMEInfo methods expect nsAString&])
170                                                                                 
171 AC_COMPILE_IFELSE(
172         [AC_LANG_PROGRAM(
173                 [[#include <nsEmbedString.h>
174                   #include <mimetype/nsIMIMEInfo.h>]],
175                 [[nsIMIMEInfo *p;
176                   p->SetDescription (nsEmbedString());]]
177         )],
178         [AC_DEFINE([MOZ_NSIMIMEINFO_NSACSTRING_],[1],[Define if nsIMIMEInfo uses nsAString&]) result=yes],
179         [result=no])
180                                                                                 
181 AC_MSG_RESULT([$result])
182                                                                                 
183 dnl Firefox doesn't have this API (?)
184                                                                                 
185 AC_MSG_CHECKING([for nsIXULChromeRegistry API])
187 AC_COMPILE_IFELSE(
188         [AC_LANG_PROGRAM(
189                 [[#include <nsEmbedString.h>
190                   #include <nsIChromeRegistry.h>]],
191                 [[nsIXULChromeRegistry *p;
192                   p->SelectSkin (nsEmbedCString(), PR_FALSE);]]
193         )],
194         [AC_DEFINE([MOZ_NSIXULCHROMEREGISTRY_SELECTSKIN],[1],[dummy]) result=yes],
195         [result=no])
196 AC_MSG_RESULT([$result])
198 dnl changed from nsIXULChromeRegistry in 1.8a4
199                                                                                 
200 AC_CHECK_FILE([$MOZILLA_INCLUDE_ROOT/chrome/nsIChromeRegistrySea.h],
201         [AC_DEFINE([HAVE_CHROME_NSICHROMEREGISTRYSEA_H], [1], [Define if nsIChromeRegistrySea.h exists])])
202                                                                                 
203 MOZILLA_WARN_CXXFLAGS="-Wall -Wconversion -Wpointer-arith -Wcast-align -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor"
204 AC_SUBST(MOZILLA_WARN_CXXFLAGS)
206 dnl -------------------------------------------------------
208 PKG_CHECK_MODULES(LIBGECKOGLUE, gtk+-2.0 >= 2.2 $MOZILLA-gtkmozembed)
209 AC_SUBST(LIBGECKOGLUE_CFLAGS)
210 AC_SUBST(LIBGECKOGLUE_LIBS)
212 dnl -------------------------------------------------------
214 PKG_CHECK_MODULES(BEAGLE_UI, gtk-sharp glade-sharp gecko-sharp = 0.6 gnome-sharp dbus-sharp >= 0.23.4 gconf-sharp gmime-sharp >= 2.1.13)
215 AC_SUBST(BEAGLE_UI_LIBS)
217 dnl ----------------------------------------------
219 # Gdk and Atk are needed for libtrayiconglue
220 GDK20_MINIMUM_VERSION=2.2.3
221 ATK_MINIMUM_VERSION=1.2.4
223 PKG_CHECK_MODULES(LIBTRAYICON,
224                   gdk-2.0 >= $GDK20_MINIMUM_VERSION
225                   atk >= $ATK_MINIMUM_VERSION)
226 AC_SUBST(LIBTRAYICON_CFLAGS)
227 AC_SUBST(LIBTRAYICON_LIBS)
229 dnl ----------------------------------------------
231 AC_ARG_ENABLE([evolution-sharp],
232          AC_HELP_STRING([--disable-evolution-sharp], [Disable evolution-sharp support (default auto)]),
233          enable_evo_sharp=$enableval,
234          enable_evo_sharp=auto)
236 EVOLUTION_SHARP_REQUIRED=0.6
237 AC_SUBST(EVO_SHARP_LIBS)
238 EVO_SHARP_PREFIX=`$PKG_CONFIG --variable=prefix evolution-sharp`
240 PKG_CHECK_MODULES(EVO_SHARP,
241          evolution-sharp >= $EVOLUTION_SHARP_REQUIRED, \
242          have_evo_sharp_dependencies=yes,
243          have_evo_sharp_dependencies=no)
245 if test "x$have_evo_sharp_dependencies" = "xno"; then
247         dnl error out if user has explicitly requested evo-sharp
248         if test "x$enable_evo_sharp" = "xyes"; then
249                 AC_MSG_ERROR([Could not find evolution-sharp])
250         fi
252         enable_evo_sharp="no (missing dependencies)"
254 else
256         if test "x$enable_evo_sharp" != "xno"; then
257                 enable_evo_sharp="yes"
258         else
259                 enable_evo_sharp="no (disabled)"
260         fi
264 AM_CONDITIONAL(ENABLE_EVO_SHARP, test "x$enable_evo_sharp" == "xyes")
266 dnl ----------------------------------------------
268 AC_ARG_ENABLE([dbus-workarounds],
269          AC_HELP_STRING ([--disable-dbus-workarounds], [Disable D-BUS Workarounds (default enabled)]),
270          use_dbus_workarounds=$enableval,
271          use_dbus_workarounds=yes)
273 dnl ----------------------------------------------
275 AC_ARG_ENABLE([network],
276         AC_HELP_STRING ([--enable-network], [Enable Network Service (default disabled)]),
277         enable_network=$enableval,
278         enable_network=no)
280 AM_CONDITIONAL(ENABLE_NETWORK, test "x$enable_network" = "xyes")
282 if test "x$enable_network" = "xyes"; then
283         PKG_CHECK_MODULES(RENDEZVOUS,                                   \
284                           mdnsresponder,                                \
285                           enable_rendezvous=yes,                        \
286                           enable_rendezvous=no)
287         AC_SUBST(RENDEZVOUS_LIBS)
289         AM_CONDITIONAL(ENABLE_RENDEZVOUS, test "x$enable_rendezvous" = "xyes")
291         RENDEZVOUS_PREFIX=`$PKG_CONFIG --variable=prefix mdnsresponder`
292 else
293         AM_CONDITIONAL(ENABLE_RENDEZVOUS, false)
297 dnl ----------------------------------------------
299 dnl beagled
301 PKG_CHECK_MODULES(GSF_SHARP, gsf-sharp >= 0.2, enable_gsf_sharp=yes, enable_gsf_sharp=no)
302 AM_CONDITIONAL(ENABLE_GSF_SHARP, test "x$enable_gsf_sharp" = "xyes")
304 dnl ----------------------------------------------
305 dnl GST# is not in a usable stage as of 9.3 release, disabling it.
307 PKG_CHECK_MODULES(GST_SHARP, gst-sharp >= __DISABLE_FOR_NOW__, enable_gst_sharp=yes, enable_gst_sharp=no)
308 AM_CONDITIONAL(ENABLE_GST_SHARP, test "x$enable_gst_sharp" = "xyes")
310 dnl ----------------------------------------------
312 dnl Needed to index jpeg metadata
313 PKG_CHECK_MODULES(LIBEXIF, libexif >= 0.5)
315 PKG_CHECK_MODULES(BEAGLED, gmime-sharp >= 2.1.13 gtk-sharp dbus-sharp >= 0.23.4 gconf-sharp)
316 BEAGLED_LIBS="$BEAGLED_LIBS $EVO_SHARP_LIBS $GSF_SHARP_LIBS"
317 AC_SUBST(BEAGLED_LIBS)
319 PKG_CHECK_MODULES(DBUS_BROKEN, dbus-sharp >= 0.23.2 dbus-sharp < 0.30, dbus_broken=no, dbus_broken=yes)
321 DBUS_PREFIX=`$PKG_CONFIG --variable=prefix dbus-sharp`
322 GSF_SHARP_PREFIX=`$PKG_CONFIG --variable=prefix gsf-sharp`
323 GMIME_SHARP_PREFIX=`$PKG_CONFIG --variable=prefix gmime-sharp`
325 # Can't use AC_CHECK_HEADERS() because dbus insists on #defining
326 # DBUS_API_SUBJECT_TO_CHANGE, and that breaks the check.
327 if test ! -e "$DBUS_PREFIX/include/dbus-1.0/dbus/dbus.h"; then
328   AC_MSG_ERROR([Unable to find dbus headers.  You'll need to install the dbus devel package])
331 AC_MSG_CHECKING(for older dbus API)
332 LDFLAGS_save="$LDFLAGS"
333 LDFLAGS="$LDFLAGS `pkg-config --libs dbus-1`"
334 AC_TRY_LINK_FUNC(dbus_message_iter_get_boolean,[
335         AC_MSG_RESULT(yes)
336         have_old_dbus=yes
338         AC_MSG_RESULT(no)
339         have_old_dbus=no
341 LDFLAGS="$LDFLAGS_save"
343 if test "$have_old_dbus" = "yes"; then
344         BEAGLE_DEFINES="-define:HAVE_OLD_DBUS"
345 else
346         BEAGLE_DEFINES=""
349 if test "$dbus_broken" = "yes" -o "$use_dbus_workarounds" = "yes" ; then
350         BEAGLE_DEFINES="$BEAGLE_DEFINES -define:DBUS_IS_BROKEN_BROKEN_BROKEN"
353 AC_SUBST(BEAGLE_DEFINES)
355 dnl ----------------------------------------------
357 dnl Epiphany Extension
358 dnl Much of this is cut&pasted from epiphany-extensions/configure.ac
360 AC_ARG_ENABLE([epiphany-extension],
361         AC_HELP_STRING([--enable-epiphany-extension], [Enable Epiphany Extension (default auto)]),
362         enable_epiphany_extension=$enableval,
363         enable_epiphany_extension=auto)
365 EPIPHANY_REQUIRED=1.2.1
366 LIBXML_REQUIRED=2.6.0
367 LIBGLIB_REQUIRED=2.4.0
368 LIBGTK_REQUIRED=2.4.0
370 AC_SUBST(EPIPHANY_REQUIRED)
371 AC_SUBST(LIBXML_REQUIRED)
372 AC_SUBST(LIBGLIB_REQUIRED)
373 AC_SUBST(LIBGTK_REQUIRED)
375 GTK_BINARY_VERSION=`$PKG_CONFIG --variable=gtk_binary_version gtk+-2.0`
376 AC_SUBST(GTK_BINARY_VERSION)
378 dnl fixme -- combine the dependencies of only the enabled plugins
379 PKG_CHECK_MODULES(EPIPHANY_DEPENDENCY, \
380                   libxml-2.0 >= $LIBXML_REQUIRED \
381                   libglade-2.0 \
382                   glib-2.0 >= $LIBGLIB_REQUIRED \
383                   gmodule-2.0 \
384                   gtk+-2.0 >= $LIBGTK_REQUIRED \
385                   epiphany-1.2 >= $EPIPHANY_REQUIRED,
386                   have_epiphany_dependencies=yes,
387                   have_epiphany_dependencies=no)
388 AC_SUBST(EPIPHANY_DEPENDENCY_CFLAGS)
389 AC_SUBST(EPIPHANY_DEPENDENCY_LIBS)
391 EPIPHANY_PREFIX="`$PKG_CONFIG --variable=prefix epiphany-1.2`"
392 AC_SUBST(EPIPHANY_PREFIX)
394 if test "x$have_epiphany_dependencies" = "xno"; then
396         dnl error out if user has explicitly requested epiphany extension
397         if test "x$enable_epiphany_extension" = "xyes"; then
398                 AC_MSG_ERROR([Could not find epiphany and/or its dependencies])
399         fi
400         
401         enable_epiphany_extension="no (missing dependencies)"
402         
403 else
405         if test "x$enable_epiphany_extension" != "xno"; then
406                 enable_epiphany_extension="yes"
407         else
408                 enable_epiphany_extension="no (disabled)"
409         fi
413 AM_CONDITIONAL(ENABLE_EPIPHANY_EXTENSION, test "x$enable_epiphany_extension" = "xyes")
415 dnl ----------------------------------------------
417 dnl For the systeminfo glue
419 PKG_CHECK_MODULES(SYSTEMINFO_GLUE, gdk-2.0)
420 AC_PATH_XTRA
421 SYSTEMINFO_GLUE_X_LIBS="$X_PRE_LIBS $X_LIBS -lX11 -lXss $X_EXTRA_LIBS"
422 AC_SUBST(SYSTEMINFO_GLUE_X_LIBS)
424 dnl ----------------------------------------------
426 dnl For the wv1 glue
428 PKG_CHECK_MODULES(WV1, wv-1.0, enable_wv1=yes, enable_wv1=no)
429 AM_CONDITIONAL(ENABLE_WV1, test "x$enable_wv1" = "xyes")
430 AC_SUBST(WV1_LIBS)
432 dnl ----------------------------------------------
434 dnl Searchomatic
436 PKG_CHECK_MODULES(SEARCHOMATIC, gtk+-2.0)
437 AC_SUBST(SEARCHOMATIC_CFLAGS)
438 AC_SUBST(SEARCHOMATIC_LIBS)
440 dnl ----------------------------------------------
442 dnl Chooser-fu
444 PKG_CHECK_MODULES(CHOOSER_FU, gtk+-2.0)
445 AC_SUBST(CHOOSER_FU_CFLAGS)
446 AC_SUBST(CHOOSER_FU_LIBS)
448 dnl ----------------------------------------------
450 AC_ARG_ENABLE([webservices],
451         AC_HELP_STRING([--enable-webservices], [Enable WebServices (default disabled)]),
452         enable_webservices=$enableval,
453         enable_webservices=no)
455 AM_CONDITIONAL(ENABLE_WEBSERVICES, test "x$enable_webservices" = "xyes")
457 dnl ----------------------------------------------
458 dnl Prefixes for helper scripts
459 GAC_PREFIX="$DBUS_PREFIX:$EVO_SHARP_PREFIX:$GSF_SHARP_PREFIX:$GMIME_SHARP_PREFIX:$RENDEZVOUS_PREFIX"
460 dnl Remove duplicate prefixes
461 GAC_PREFIX="`echo $GAC_PREFIX | sed -e 's|:|\n|g' | sort | uniq | tr '\n' ':'`"
462 dnl Remove stray :s
463 GAC_PREFIX="`echo $GAC_PREFIX | sed -e 's|::\+|:|g' -e 's|^:\+||' -e 's|:\+$||'`"
464 AC_SUBST(GAC_PREFIX)
466 GNOME_PREFIX="`$PKG_CONFIG --variable=prefix libgnome-2.0`"
467 AC_SUBST(GNOME_PREFIX)
469 AC_OUTPUT([
470 Makefile
471 Util/Makefile
472 images/Makefile
473 templates/Makefile
474 glue/Makefile
475 BeagleClient/Makefile
476 beagled/Makefile
477 Filters/Makefile
478 Tiles/Makefile
479 tools/Makefile
480 Best/Makefile
481 ImLogViewer/Makefile
482 epiphany-extension/Makefile
483 mozilla-extension/Makefile
484 searchomatic/Makefile
485 chooser-fu/Makefile
486 beagle-0.0.pc
487 beagle.spec
488 po/Makefile.in
491 echo "
492         Prefix:                 ${prefix}
493         D-BUS Workarounds?      ${use_dbus_workarounds}
494         Evolution-Sharp?        ${enable_evo_sharp}
495         gsf-sharp?              ${enable_gsf_sharp}
496         gst-sharp?              ${enable_gst_sharp}
497         Epiphany Extension?     ${enable_epiphany_extension}
498         Mozilla Extension?      yes
499         wv1?                    ${enable_wv1}
501         Enable Network          ${enable_network}
502         Enable WebServices      ${enable_webservices}"
504 if test "x$enable_network" = "xyes"; then
505    echo "       Enable Rendezvous       ${enable_rendezvous}"
508 echo
510 if test "x$enable_epiphany_extension" = "xyes"; then
511    echo "NOTE: The Beagle Epiphany Extension Is Totally Insecure!"
512    echo "      Use it at your own risk!"
513    echo
515    if test "x${prefix}" != "x$EPIPHANY_PREFIX"; then
516       echo "NOTE: Epiphany seems to be installed in $EPIPHANY_PREFIX, not ${prefix}."
517       echo "      Epiphany will not be able to find Beagle's Epiphany Extension"
518       echo "      unless you do something like:"
519       echo "      # ln -s ${prefix}/lib/epiphany/extensions/libbeagleextension.so \\"
520       echo "        $EPIPHANY_PREFIX/lib/epiphany/extensions"
521    fi