2007-06-17 Johannes Schmid <johannes.schmid@openismus.com>
[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 # Check for gettext support
36 GETTEXT_PACKAGE=modest
37 AC_SUBST(GETTEXT_PACKAGE)
38 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", ["Description"])
39
40 ALL_LINGUAS="en_GB"
41
42 MODEST_LOCALE_DIR='$prefix/${DATADIRNAME}/locale'
43 AM_GLIB_DEFINE_LOCALEDIR([MODEST_LOCALE_DIR])
44 AM_GLIB_GNU_GETTEXT
45
46
47
48 if test x$prefix = xNONE; then
49    prefix=/usr/local
50 fi
51 AC_SUBST(prefix)
52
53 AC_PROG_CC
54 AM_PROG_CC_STDC
55 AC_HEADER_STDC
56 AC_PROG_LIBTOOL
57
58
59 # Option to enable debugging
60 AC_ARG_ENABLE(debug,
61               [AC_HELP_STRING([  --enable-debug],[Debugging (default=no)])],
62               [with_debug=yes], [with_debug=no])
63
64 if test "x$with_debug" == "xyes" ; then
65         CFLAGS="$CFLAGS -ggdb -O0 -DDEBUG -Wall"
66 else
67         CFLAGS="$CFLAGS -O2 -Wall"
68 fi
69
70
71 dnl # GLib/Gobject/Gtk/Gconf => mandatory
72 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) 
73 AC_SUBST(MODEST_GSTUFF_CFLAGS)
74 AC_SUBST(MODEST_GSTUFF_LIBS)
75
76 dnl dnl now, determine what to build
77 AC_MSG_NOTICE([Determining what platform to build])
78 PKG_CHECK_MODULES(LIBOSSO,libosso,[with_platform=maemo],true)
79
80 AC_ARG_WITH(platform,
81 [--with-platform=gnome          platform to build for [gnome]],
82 [case "${with_platform}" in
83        gnome)    MODEST_PLATFORM=gnome;;
84        maemo) MODEST_PLATFORM=maemo;;
85        *)      MODEST_PLATFORM=${with_platform}
86 esac], [MODEST_PLATFORM=gnome
87                with_platform=gnome])
88 AC_SUBST(MODEST_PLATFORM)
89
90
91 if test "x$with_platform" = "xmaemo"; then
92    
93    PKG_CHECK_MODULES(HILDON, hildon-1 >= 0.9.9, hildon1=yes, hildon1=no)        
94    if test "$hildon1" == "yes"; then   # the 'new' hildon                       
95       PKG_CHECK_MODULES(MODEST_LIBTINYMAIL_MAEMO, conic libtinymail-maemo-1.0 hildon-1 libosso libhildonmime osso-addressbook-1.0 wpeditor hildon-help libebook-1.2 libalarm hildon-notify libnotify)           
96    
97     else     # the old hildon
98      PKG_CHECK_MODULES(MODEST_LIBTINYMAIL_MAEMO, conic libtinymail-maemo-1.0 hildon-libs >= 0.12.0 libosso libossomime libossohelp osso-addressbook-1.0 libwpeditor-plus libebook-1.2 libalarm gnome-vfs-module-2.0 hildon-notify libnotify)             AC_DEFINE_UNQUOTED(MODEST_HILDON_VERSION_0, 1, ["The Hildon version we support."])   
99     fi  
100    
101    AC_SUBST(MODEST_LIBTINYMAIL_MAEMO_CFLAGS)
102    AC_SUBST(MODEST_LIBTINYMAIL_MAEMO_LIBS) 
103    
104    AC_DEFINE_UNQUOTED(MODEST_PLATFORM_MAEMO, 1, ["Whether modest is being built for the Maemo platform."])
105  
106   desktopentrydir=`$PKG_CONFIG osso-af-settings --variable=desktopentrydir`
107   serviceentrydir=`$PKG_CONFIG dbus-glib-1 --variable=prefix`/share/dbus-1/services
108   localedir=`$PKG_CONFIG osso-af-settings --variable=localedir`
109   backupsettingsdir=/etc/osso-backup/applications
110   pixmapdir=`$PKG_CONFIG osso-af-settings --variable=hildonpixmapdir`
111   icon_26x26dir=$datadir/icons/hicolor/26x26/hildon
112   icon_34x34dir=$datadir/icons/hicolor/34x34/hildon
113   icon_40x40dir=$datadir/icons/hicolor/40x40/hildon
114   icon_50x50dir=$datadir/icons/hicolor/50x50/hildon
115   icon_scalabledir=$datadir/icons/hicolor/scalable/hildon
116   pluginlibdir=`$PKG_CONFIG hildon-control-panel --variable=plugindir`
117   plugindesktopentrydir=`$PKG_CONFIG hildon-control-panel --variable=plugindesktopentrydir`
118
119   dbus_api="dbus_api"
120   AC_SUBST(dbus_api)
121
122   # Define as variables in Makefiles
123   AC_SUBST(desktopentrydir)
124   AC_SUBST(serviceentrydir)
125   AC_SUBST(backupsettingsdir)
126   AC_SUBST(localedir)
127   AC_SUBST(pixmapdir)
128   AC_SUBST(icon_26x26dir)
129   AC_SUBST(icon_34x34dir)
130   AC_SUBST(icon_40x40dir)
131   AC_SUBST(icon_50x50dir)
132   AC_SUBST(icon_scalabledir)
133   AC_SUBST(pluginlibdir)
134   AC_SUBST(plugindesktopentrydir)
135
136   # warnings are errors, but don't check format errors, because
137   # it breaks with logical ids
138   CFLAGS="$CFLAGS -Wno-format-extra-args -Werror"
139 else
140    # gnome frontend 
141    #AC_MSG_ERROR([Sorry, the GNOME Frontend is currently not working])
142
143    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)
144    AC_SUBST(MODEST_LIBTINYMAIL_GNOME_DESKTOP_CFLAGS)
145    AC_SUBST(MODEST_LIBTINYMAIL_GNOME_DESKTOP_LIBS)  
146    AC_DEFINE_UNQUOTED(MODEST_PLATFORM_GNOME, 1, ["Whether modest is being built for the GNOME platform."])
147
148   # no dbus api for gnome
149   dbus_api=""
150   AC_SUBST(dbus_api)
151
152 fi
153
154 dnl do we have the easy setup stuff?
155 have_easysetup=false
156 if test -d src/${with_platform}/easysetup; then 
157         have_easysetup=true
158         AC_DEFINE_UNQUOTED(MODEST_HAVE_EASYSETUP, 1, ["Whether the easysetup feature is available."])
159
160    if test "$hildon1" == "yes"; then   # the 'new' hildon                       
161         # Just check that the dependency exists:
162         PKG_CHECK_MODULES(MODEST_PROVIDERS_DATA, modest-providers-data)
163         AC_DEFINE_UNQUOTED([MODEST_PROVIDERS_DATA_PATH],["`$PKG_CONFIG --variable=path modest-providers-data`"],[modest-providers-data file path])
164    else
165         PKG_CHECK_MODULES(MODEST_PROVIDERS_DATA, maemo-providers-data)
166         AC_DEFINE_UNQUOTED([MODEST_PROVIDERS_DATA_PATH],["`$PKG_CONFIG --variable=path maemo-providers-data`"],[maemo-providers-data file path])
167    fi
168 fi
169 AM_CONDITIONAL(MODEST_HAVE_EASYSETUP,test x$have_easysetup = xtrue) 
170
171
172 dnl ## setup the testing framework (ie., make check)
173 build_tests=false
174 AC_ARG_ENABLE(tests,
175 AC_HELP_STRING([--enable-tests],
176         [Build tests (no, yes)]),
177 [case "${enableval}" in
178       yes)
179         build_tests=true ;;
180       *) build_tests=false ;;
181 esac],[build_tests=false])
182 AM_CONDITIONAL(BUILD_TESTS, test x$build_tests = xtrue)
183
184
185
186 dnl ## is the check package installed?
187 if test x$build_tests = xtrue; then
188    PKG_CHECK_MODULES(CHECK, check >= 0.9.4 glib-2.0)
189 fi
190
191
192
193 dnl ## do we want documentation (gtk-doc)
194 build_docs=false
195 AC_ARG_ENABLE(docs,
196 AC_HELP_STRING([--enable-docs],
197         [Build documentation (yes, no)]),
198 [case "${enableval}" in
199       yes)
200         build_docs=true ;;
201       *) build_docs=false ;;
202 esac],[build_docs=false])
203 AM_CONDITIONAL(BUILD_DOCS, test x$build_docs = xtrue)
204
205 dnl ## gtk-doc
206 GTK_DOC_CHECK([1.0])
207
208 dnl Intltool utility programs
209 #AC_PROG_INTLTOOL([0.33.0],[no-xml])
210
211 #dnl wether we can and should build the 
212 #dnl search plugin
213 PKG_CHECK_MODULES(OGS, libosso >= 0.8.5 libogs-1.2, have_ogs=true, have_ogs=false)
214
215 have_ogs_support=false
216 AC_ARG_ENABLE(ogs_support,
217 AC_HELP_STRING([--enable-ogs-support],
218         [Build with osso global search support (yes, no)]),
219 [case "${enableval}" in
220       yes)
221         if test x$have_ogs = xfalse; then
222                 AC_MSG_ERROR([building of ogs support requested and libogs-1.2 not found])
223         fi
224         ;;
225       *) 
226         have_ogs_support=false
227         ;;
228 esac],[have_ogs_support=$have_ogs])
229
230 if test x$have_ogs_support = xtrue; then
231         AC_DEFINE_UNQUOTED(MODEST_HAVE_OGS, 1, ["Whether ogs is available."])
232 fi
233
234 AC_OUTPUT([
235 po/Makefile.in
236 Makefile
237 man/Makefile
238 src/Makefile
239 src/dbus_api/Makefile
240 src/gnome/Makefile
241 src/maemo/Makefile
242 src/maemo/easysetup/Makefile
243 src/widgets/Makefile
244 docs/Makefile
245 docs/reference/Makefile
246 tests/Makefile
247 tests/dbus_api/Makefile
248 src/maemo/modest.desktop
249 src/maemo/com.nokia.modest.service
250 libmodest-dbus-client/Makefile
251 libmodest-dbus-client/libmodest-dbus-client-1.0.pc
252 ])
253
254
255 echo
256 echo "modest configure results"
257 echo "-----------------------------------"
258 echo "Platform         : $with_platform"
259 echo "Build easy setup : $have_easysetup"
260 echo "Build tests      : $build_tests"
261 echo "Build docs       : $build_docs"
262 echo "libogs support   : $have_ogs_support"
263 echo "Debug version    : $with_debug"
264 echo ""
265 echo "NOTE: you should do a 'make clean' after changing architecture or platform (--with-platform=)"
266 echo ""