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