d10dc6799faa83496275a8a13531269a12c2387b
[modest] / configure.ac
1 # Copyright (c) 2006,2007 Nokia Corporation
2 # All rights reserved.
3
4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions are
6 # met:
7
8 # * Redistributions of source code must retain the above copyright
9 #   notice, this list of conditions and the following disclaimer.
10 # * Redistributions in binary form must reproduce the above copyright
11 #   notice, this list of conditions and the following disclaimer in the
12 #   documentation and/or other materials provided with the distribution.
13 # * Neither the name of the Nokia Corporation nor the names of its
14 #   contributors may be used to endorse or promote products derived from
15 #   this software without specific prior written permission.
16
17 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
18 # IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
19 # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
20 # PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
21 # OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
22 # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
23 # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
24 # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
25 # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
26 # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27 # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
29 AC_INIT([modest],[1.0],[http://maemo.org])
30 AC_CONFIG_HEADERS([config.h])
31
32 AC_CONFIG_SRCDIR(src/modest-main.c)
33 AM_INIT_AUTOMAKE([dist-bzip2])
34
35 ALL_LINGUAS="en_GB"
36
37 MODEST_LOCALE_DIR='$prefix/${DATADIRNAME}/locale'
38 AM_GLIB_DEFINE_LOCALEDIR([MODEST_LOCALE_DIR])
39 AM_GLIB_GNU_GETTEXT
40
41
42
43 if test x$prefix = xNONE; then
44    prefix=/usr/local
45 fi
46 AC_SUBST(prefix)
47
48 AC_PROG_CC
49 AC_PROG_CXX
50 AM_PROG_CC_STDC
51 AC_HEADER_STDC
52 AC_PROG_LIBTOOL
53
54
55 # Option to enable debugging
56 AC_ARG_ENABLE(debug,
57               [AC_HELP_STRING([  --enable-debug],[Debugging (default=no)])],
58               [with_debug=yes], [with_debug=no])
59
60 if test "x$with_debug" == "xyes" ; then
61         CFLAGS="$CFLAGS -ggdb -O0 -DDEBUG -Wall"
62 else
63         CFLAGS="$CFLAGS -O2 -Wall"
64 fi
65
66
67 dnl # GLib/Gobject/Gtk/Gconf => mandatory
68 PKG_CHECK_MODULES(MODEST_GSTUFF,glib-2.0 >= 2.6 gobject-2.0 gtk+-2.0 >= 2.6 gconf-2.0 gnome-vfs-2.0 libgtkhtml-3.8 libtinymail-1.0 libtinymail-camel-1.0 libtinymail-gnomevfs-1.0 libtinymailui-1.0 libtinymailui-gtk-1.0) 
69 AC_SUBST(MODEST_GSTUFF_CFLAGS)
70 AC_SUBST(MODEST_GSTUFF_LIBS)
71
72 modest_save_cflags="$CFLAGS"
73 modest_save_libs="$LIBS"
74 CFLAGS="$MODEST_GSTUFF_CFLAGS"
75 LIBS="$MODEST_GSTUFF_LIBS"
76 AC_CHECK_DECLS([gtk_widget_tap_and_hold_setup],[],[], [#include <gtk/gtk.h>])
77 CFLAGS="$modest_save_cflags"
78 LIBS="$modest_save_libs"
79
80 __COPY_LIBS="$LIBS"
81 LIBS="$LIBS $MODEST_GSTUFF_LIBS"
82 AC_CHECK_FUNCS(gtk_html_get_selection_area)
83 LIBS="$__COPY_LIBS"
84 AC_SUBST(HAVE_GTK_HTML_GET_SELECTION_AREA)
85
86 dnl dnl now, determine what to build
87 dnl AC_MSG_NOTICE([Determining what platform to build])
88 PKG_CHECK_MODULES(MODEST_MAEMO_LIBS,conic,[detected_platform=maemo],[detected_platform=gnome])
89
90 AC_ARG_WITH(platform, [
91 Target platform:
92   --with-platform=detect  detect target platform (default)
93   --with-platform=gnome   build for Gnome
94   --with-platform=maemo   build for Maemo
95 ],
96 [case "${with_platform}" in
97        gnome|maemo|detect)    MODEST_PLATFORM=${with_platform};;
98        *)        AC_MSG_ERROR([Unknown platform selected]);;
99 esac], [MODEST_PLATFORM=detect])
100
101 if test "$MODEST_PLATFORM" = "detect"; then
102         MODEST_PLATFORM="$detected_platform"
103         with_platform=$detected_platform
104 fi
105
106
107 dnl Whether to use maemo-launcher or not
108 AC_ARG_ENABLE([maemo-launcher],
109               [AS_HELP_STRING([--enable-maemo-launcher],
110                               [build with maemo-launcher support])],
111                               [case "${enableval}" in
112                                yes) maemo_launcher=true ;;
113                                no)  maemo_launcher=false ;;
114                                *) AC_MSG_ERROR([bad value ${enableval} for --enable-maemo-launcher]) ;;
115                                esac], [maemo_launcher=false])
116 if test x$maemo_launcher = xtrue
117 then
118         PKG_CHECK_MODULES(MAEMO_LAUNCHER, [maemo-launcher-app])
119         AC_SUBST(MAEMO_LAUNCHER_CFLAGS)
120         AC_SUBST(MAEMO_LAUNCHER_LIBS)
121 fi
122
123 have_easysetup=false
124 if test "x$with_platform" == "xgnome"; then
125       PKG_CHECK_MODULES(MODEST_PLATFORM,libtinymail-gnome-desktop-1.0 libnm_glib glib-2.0 >= 2.8 gtk+-2.0 >= 2.10 libnotify)
126     AC_DEFINE_UNQUOTED(MODEST_PLATFORM_GNOME, 1, ["Whether modest is being built for the GNOME platform."])
127 dnl     AC_MSG_ERROR([The GNOME Build is currently broken; please try the Maemo build instead])
128 else
129     have_easysetup=true
130     have_dbusapi=true
131     PKG_CHECK_MODULES(MODEST_PLATFORM,libosso dbus-1 libtinymail-maemo-1.0 libebook-1.2 )
132     AC_DEFINE_UNQUOTED(MODEST_PLATFORM_MAEMO, 1, ["Whether modest is being built for the MAEMO platform."])
133     AC_DEFINE_UNQUOTED(MODEST_HAVE_EASYSETUP, 1, ["Whether we have the easysetup feature"])
134 fi                  
135
136 AM_CONDITIONAL(MODEST_HAVE_EASYSETUP,test "x$have_easysetup" == "xtrue")
137 AM_CONDITIONAL(MODEST_HAVE_DBUS_API,test "x$have_dbusapi" == "xtrue")
138 AC_SUBST(MODEST_PLATFORM)
139
140
141 #
142 # check for libcurl
143 #
144 PKG_CHECK_MODULES(MODEST_LIBCURL,libcurl,have_libcurl=true,have_libcurl=false)
145 if test "x$have_libcurl" == "xtrue"; then
146         AC_DEFINE_UNQUOTED(MODEST_HAVE_LIBCURL, 1, ["Whether libcurl is available."])
147 fi
148
149
150 #
151 # check for wpeditor or libwpeditor-plus (on maemo)
152 #
153 if test "x$with_platform" == "xmaemo"; then  
154 PKG_CHECK_MODULES(MODEST_WPEDITOR,wpeditor,have_wpeditor=true,have_wpeditor=false)
155 if test "x$have_wpeditor" == "xfalse"; then
156    PKG_CHECK_MODULES(MODEST_WPEDITOR,libwpeditor-plus,have_libwpeditorplus=true,have_libwpeditorplus=false)     
157    if test "x$have_libwpeditorplus" == "xtrue"; then
158         wpeditor="libwpeditor-plus"
159         AC_DEFINE_UNQUOTED(MODEST_HAVE_LIBWPEDITOR_PLUS, 1, ["Whether libwpeditor-plus is used."])              
160    else
161         AC_MSG_ERROR([you need to have either wpeditor or libwpeditor-plus installed])
162    fi
163 else
164    wpeditor="wpeditor"  
165    AC_DEFINE_UNQUOTED(MODEST_HAVE_WPEDITOR, 1, ["Whether wpeditor is used."])           
166 fi
167 fi
168
169
170 #
171 # check libalarm
172 #
173 if test "x$with_platform" == "xmaemo"; then  
174 PKG_CHECK_MODULES(MODEST_LIBALARM,libalarm,have_libalarm=true,have_libalarm=false)
175 if test "x$have_libalarm" == "xtrue"; then
176    libalarm="libalarm"  
177    AC_DEFINE_UNQUOTED(MODEST_HAVE_LIBALARM, 1, ["Whether libalarm is used."])           
178    AC_SUBST(MODEST_LIBALARM_CFLAGS)
179    AC_SUBST(MODEST_LIBALARM_LIBS)
180 else
181    libalarm=""
182 fi
183 fi
184
185 #
186 # check for MCE
187 #
188 if test "x$with_platform" == "xmaemo"; then  
189 PKG_CHECK_MODULES(MODEST_MCE,mce,have_mce=true,have_mce=false)
190 if test "x$have_mce" == "xtrue"; then
191    mce="mce"    
192    AC_DEFINE_UNQUOTED(MODEST_HAVE_MCE, 1, ["Whether mce is used."])
193    AC_SUBST(MODEST_MCE_CFLAGS)
194    AC_SUBST(MODEST_MCE_LIBS)
195 else
196    mce=""
197 fi
198 fi
199
200 #
201 # check for libconic; this is a trick to check whether we run
202 # on a 'real' maemo platform, or on, say, ubuntu embedded
203 # this determines whether we build with the non-hildon GTK+
204 #
205 if test "x$with_platform" == "xmaemo"; then  
206 PKG_CHECK_MODULES(MODEST_LIBCONIC,conic,have_libconic=true,have_libconic=false)
207 if test "x$have_libconic" == "xtrue"; then
208    AC_DEFINE_UNQUOTED(MODEST_HAVE_HILDON_GTK,1,["Whether modest is being built with Hildon/Gtk"])
209    AC_DEFINE_UNQUOTED(MODEST_HAVE_CONIC,1,["Whether modest has conic available"])
210    AC_SUBST(MODEST_LIBCONIC_CLAGS)
211    AC_SUBST(MODEST_LIBCONIC_LIBS)
212 else
213 # if we define this, tinymail will not try to #include conic headers
214    CFLAGS="$CFLAGS -DLIBTINYMAIL_MAEMO_WITHOUT_CONIC"
215 fi
216 fi
217
218 #
219 # check hildon-help (only for maemo)
220 #
221 if test "x$with_platform" == "xmaemo"; then  
222    PKG_CHECK_MODULES(MODEST_HILDON_HELP,hildon-help,have_hildon_help=true,have_hildon_help=false)
223    if test "x$have_hildon_help" == "xfalse"; then
224       PKG_CHECK_MODULES(MODEST_HILDON_HELP,libossohelp,have_osso_help=true,have_osso_help=false)        
225       if test "x$have_osso_help" == "xtrue"; then
226         helplib="osso-help"
227         AC_DEFINE_UNQUOTED(MODEST_HAVE_OSSO_HELP, 1, ["Whether osso-help is used."])            
228       else
229         AC_MSG_ERROR([you need to have either osso-help or hildon-help installed])
230       fi
231    else
232      helplib="hildon-help"      
233      AC_DEFINE_UNQUOTED(MODEST_HAVE_HILDON_HELP, 1, ["Whether hildon-help is used."])           
234    fi
235 fi
236
237
238
239 #
240 # check for the notification stuff (only maemo)
241 #
242 if test "x$with_platform" == "xmaemo"; then  
243    PKG_CHECK_MODULES(MODEST_HILDON_NOTIFY,hildon-notify libnotify,have_hildon_notify=true,have_hildon_notify=false)
244    if test "x$have_hildon_notify" == "xtrue"; then
245       AC_DEFINE_UNQUOTED(MODEST_HAVE_HILDON_NOTIFY, 1, ["Whether hildon-notify is available"])      
246    fi
247 fi
248
249
250 #
251 # check for the uri/mime stuff
252 #
253 if test "x$with_platform" == "xmaemo"; then  
254    PKG_CHECK_MODULES(MODEST_HILDON_MIME,libhildonmime,have_hildonmime=true,have_hildonmime=false)
255    if test "x$have_hildonmime" == "xfalse"; then
256       PKG_CHECK_MODULES(MODEST_HILDON_MIME,libossomime,have_ossomime=true,have_ossomime=false)  
257       if test "x$have_ossomime" == "xtrue"; then
258         mimelib="osso-mime"
259         AC_DEFINE_UNQUOTED(MODEST_HAVE_OSSO_MIME, 1, ["Whether osso-mime is used."])            
260       else
261         AC_MSG_ERROR([you need to have either osso-mime or hildon-mime installed])
262       fi
263    else
264      mimelib="hildon-mime"      
265      AC_DEFINE_UNQUOTED(MODEST_HAVE_HILDON_MIME, 1, ["Whether hildon-mime is used."])           
266    fi
267 fi
268
269 PKG_CHECK_MODULES(MODEST_MOZEMBED, libtinymailui-mozembed-1.0, have_mozembed=true, have_mozembed=false)
270 AC_ARG_ENABLE(mozembed,
271 AC_HELP_STRING([--enable-mozembed],
272         [Build with GtkMozEmbed (yes, no)]),
273 [case "${enableval}" in
274       yes)
275         if test x$have_mozembed = xfalse; then
276            AC_MSG_ERROR([building of GtkMozEmbed support requested and gtkmozembed not found])
277         fi
278         use_mozembed=true
279         ;;
280       *)
281         use_mozembed=false
282         ;;
283 esac],[use_mozembed=false])
284
285 AM_CONDITIONAL(BUILD_MOZEMBED, test x$use_mozembed = xtrue)
286
287 if test x$use_mozembed = xtrue; then
288         AC_DEFINE_UNQUOTED(MODEST_USE_MOZEMBED, 1, ["Whether we use GtkMozEmbed."])
289 fi
290
291 #dnl wether we can and should build the 
292 #dnl search plugin (on maemo)
293 if test "x$with_platform" == "xmaemo"; then  
294 PKG_CHECK_MODULES(MODEST_OGS, libosso >= 0.8.5 libogs-1.2, have_ogs=true, have_ogs=false)
295 have_ogs_support=false
296 AC_ARG_ENABLE(ogs_support,
297 AC_HELP_STRING([--enable-ogs-support],
298         [Build with osso global search support (yes, no)]),
299 [case "${enableval}" in
300       yes)
301         if test x$have_ogs = xfalse; then
302            AC_MSG_ERROR([building of ogs support requested and libogs-1.2 not found])
303         fi
304         ;;
305       *) 
306         have_ogs_support=false
307         ;;
308 esac],[have_ogs_support=$have_ogs])
309
310 if test x$have_ogs_support = xtrue; then
311         AC_DEFINE_UNQUOTED(MODEST_HAVE_OGS, 1, ["Whether ogs is available."])
312 fi
313 fi
314
315
316
317 #
318 # check the version of the widgets on maemo
319 #
320 if test "x$with_platform" == "xmaemo"; then  
321 PKG_CHECK_MODULES(MODEST_HILDON_WIDGETS, hildon-1 >= 0.9.9 hildon-fm-2, have_hildon1=true,have_hildon1=false)   
322 if test "x$have_hildon1" == "xfalse"; then 
323    PKG_CHECK_MODULES(MODEST_HILDON_WIDGETS, hildon-libs >= 0.12.0 hildon-fm, have_hildon0=true,have_hildon0=false)      
324    if test "x$have_hildon0" == "xtrue"; then
325       AC_DEFINE_UNQUOTED(MODEST_HAVE_HILDON0_WIDGETS, 1, ["Whether hildon0 widgets are used."])               
326    else
327       AC_MSG_ERROR([hildon widgets and/or hildon-fm not found])
328    fi
329 else
330       AC_DEFINE_UNQUOTED(MODEST_HAVE_HILDON1_WIDGETS, 1, ["Whether hildon1 widgets are used."])             
331 fi
332 fi
333
334
335
336 #
337 # check the version of the addressbook on maemo
338 #
339 if test "x$with_platform" == "xmaemo"; then  
340    PKG_CHECK_MODULES(MODEST_ABOOK,osso-addressbook-1.0,have_abook=true,have_abook=false)
341    AC_SUBST(MODEST_ABOOK_CFLAGS)
342    AC_SUBST(MODEST_ABOOK_LIBS)
343
344    if test "x$have_abook" == "xtrue"; then      
345       PKG_CHECK_MODULES(MODEST_ABOOK_OLD, osso-addressbook-1.0 < 2.0, have_old_abook=true,have_old_abook=false) 
346       if test "x$have_old_abook" == "xtrue"; then
347          AC_DEFINE_UNQUOTED(MODEST_HAVE_OLD_ABOOK, 1, ["whether we have an old osso-addressbook"])
348       fi
349       AC_DEFINE_UNQUOTED(MODEST_HAVE_ABOOK,1, ["whether we have osso-addressbook"])
350       addressbook="osso-addressbook"
351    fi
352 fi
353
354
355 #
356 # if we don't have an addressbook, use the dummy one
357 #
358 AM_CONDITIONAL(MODEST_USE_DUMMY_ADDRESS_BOOK,test "x$have_abook" != "xtrue")
359
360
361 # gettext support
362 GETTEXT_PACKAGE=modest  
363 AC_SUBST(GETTEXT_PACKAGE)
364 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", ["gettext package"])
365
366
367 #
368 # settings for maemo platform
369 #
370 if test "x$with_platform" == "xmaemo"; then  
371
372   # warnings are errors, but don't check format errors, because
373   # it breaks with logical ids
374   CFLAGS="$CFLAGS -Wno-format-extra-args -Werror"
375
376    desktopentrydir=`$PKG_CONFIG osso-af-settings --variable=desktopentrydir`
377    serviceentrydir=`$PKG_CONFIG dbus-glib-1 --variable=prefix`/share/dbus-1/services
378    localedir=`$PKG_CONFIG osso-af-settings --variable=localedir`
379    backupsettingsdir=/etc/osso-backup/applications
380    pixmapdir=`$PKG_CONFIG osso-af-settings --variable=hildonpixmapdir`
381    icon_26x26dir=$datadir/icons/hicolor/26x26/hildon
382    icon_34x34dir=$datadir/icons/hicolor/34x34/hildon
383    icon_40x40dir=$datadir/icons/hicolor/40x40/hildon
384    icon_50x50dir=$datadir/icons/hicolor/50x50/hildon
385    icon_scalabledir=$datadir/icons/hicolor/scalable/hildon
386    pluginlibdir=`$PKG_CONFIG hildon-control-panel --variable=plugindir`
387    plugindesktopentrydir=`$PKG_CONFIG hildon-control-panel --variable=plugindesktopentrydir`
388
389    dbus_api="dbus_api"
390    AC_SUBST(dbus_api)
391
392    # Define as variables in Makefiles
393    AC_SUBST(desktopentrydir)
394    AC_SUBST(serviceentrydir)
395    AC_SUBST(backupsettingsdir)
396    AC_SUBST(localedir)
397    AC_SUBST(pixmapdir)
398    AC_SUBST(icon_26x26dir)
399    AC_SUBST(icon_34x34dir)
400    AC_SUBST(icon_40x40dir)
401    AC_SUBST(icon_50x50dir)
402    AC_SUBST(icon_scalabledir)
403    AC_SUBST(pluginlibdir)
404    AC_SUBST(plugindesktopentrydir)
405
406 else
407    # gnome frontend 
408    PKG_CHECK_MODULES(MODEST_LIBTINYMAIL_GNOME_DESKTOP,libtinymail-gnome-desktop-1.0 libnm_glib glib-2.0 >= 2.8 gtk+-2.0 >= 2.10 libnotify)
409    AC_SUBST(MODEST_LIBTINYMAIL_GNOME_DESKTOP_CFLAGS)
410    AC_SUBST(MODEST_LIBTINYMAIL_GNOME_DESKTOP_LIBS)  
411    AC_DEFINE_UNQUOTED(MODEST_PLATFORM_GNOME, 1, ["Whether modest is being built for the GNOME platform."])
412
413   # no dbus api for gnome
414   dbus_api=""
415   AC_SUBST(dbus_api)
416
417 fi
418
419
420 dnl ## setup the testing framework (ie., make check)
421 build_tests=false
422 AC_ARG_ENABLE(tests,
423 AC_HELP_STRING([--enable-tests],
424         [Build tests (no, yes)]),
425 [case "${enableval}" in
426       yes)
427         build_tests=true ;;
428       *) build_tests=false ;;
429 esac],[build_tests=false])
430 AM_CONDITIONAL(BUILD_TESTS, test x$build_tests = xtrue)
431
432
433
434 dnl ## is the check package installed?
435 if test x$build_tests = xtrue; then
436    PKG_CHECK_MODULES(CHECK, check >= 0.9.4 glib-2.0)
437 fi
438
439
440
441 dnl ## do we want documentation (gtk-doc)
442 build_docs=false
443 AC_ARG_ENABLE(docs,
444 AC_HELP_STRING([--enable-docs],
445         [Build documentation (yes, no)]),
446 [case "${enableval}" in
447       yes)
448         build_docs=true ;;
449       *) build_docs=false ;;
450 esac],[build_docs=false])
451 AM_CONDITIONAL(BUILD_DOCS, test x$build_docs = xtrue)
452
453 dnl ## gtk-doc
454 GTK_DOC_CHECK([1.0])
455
456 dnl Intltool utility programs
457 #AC_PROG_INTLTOOL([0.33.0],[no-xml])
458
459 AC_OUTPUT([
460 po/Makefile.in
461 Makefile
462 man/Makefile
463 src/Makefile
464 src/dbus_api/Makefile
465 src/gnome/Makefile
466 src/maemo/Makefile
467 src/maemo/easysetup/Makefile
468 src/widgets/Makefile
469 docs/Makefile
470 docs/reference/Makefile
471 tests/Makefile
472 tests/dbus_api/Makefile
473 src/maemo/modest.desktop
474 src/maemo/com.nokia.modest.service
475 libmodest-dbus-client/Makefile
476 libmodest-dbus-client/libmodest-dbus-client-1.0.pc
477 ])
478
479
480 echo
481 echo "modest configure results"
482 echo "-----------------------------------"
483 echo "Platform         : $with_platform"
484 echo "Prefix           : ${prefix}"
485 echo "Build tests      : $build_tests"
486 echo "Build docs       : $build_docs"
487 echo "Gettext Package  : $GETTEXT_PACKAGE"
488 echo "libcurl          : $have_libcurl"
489
490 if test "x$with_platform" == "xmaemo"; then
491    echo "Maemo Launcher   : $maemo_launcher"
492    echo "Editor lib       : $wpeditor"
493    echo "Addressbook      : $have_abook"
494    echo "Help lib         : $helplib"
495    echo "libconic support : $have_libconic"
496    echo "Alarm            : $have_libalarm"
497    echo "MCE              : $have_mce"
498    echo "Hildon-Notify    : $have_hildon_notify"    
499    echo "LibOGS support   : $have_ogs_support"
500    echo "MozEmbed support : $use_mozembed"
501 fi 
502
503 echo "CFLAGS           : $CFLAGS"
504 echo "Debug version    : $with_debug"
505 echo ""
506 echo "NOTE: you should do a 'make clean' after changing architecture or platform (--with-platform=)"
507 echo ""