remove duplicated
[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],[0.0.1],[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 QGETTEXT_PACKAGE=modest
37 AC_SUBST(GETTEXT_PACKAGE)
38 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", ["Description"])
39
40 ALL_LINGUAS="en_GB gl nl"
41 #AM_GLIB_DEFINE_LOCALEDIR([MODEST_LOCALE_DIR])
42 AM_GLIB_GNU_GETTEXT
43
44 modestlocaledir='$prefix/${DATADIRNAME}/locale'
45 AC_SUBST(modestlocaledir)
46
47 if test x$prefix = xNONE; then
48    prefix=/usr/local
49 fi
50 AC_SUBST(prefix)
51
52 AC_PROG_CC
53 AM_PROG_CC_STDC
54 AC_HEADER_STDC
55 AC_PROG_LIBTOOL
56
57
58 # Option to enable debugging
59 AC_ARG_ENABLE(debug,
60               [AC_HELP_STRING([  --enable-debug],[Debugging (default=no)])],
61               [with_debug=yes], [with_debug=no])
62
63 if test "x$with_debug" == "xyes" ; then
64         CFLAGS="$CFLAGS -ggdb -O0 -DDEBUG -Wall"
65 else
66         CFLAGS="$CFLAGS -O2 -Wall"
67 fi
68
69
70 dnl # GLib/Gobject/Gtk/Gconf => mandatory
71 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 libtinymailui-1.0 libtinymailui-gtk-1.0) 
72 AC_SUBST(MODEST_GSTUFF_CFLAGS)
73 AC_SUBST(MODEST_GSTUFF_LIBS)
74
75 dnl dnl now, determine what to build
76 AC_MSG_NOTICE([Determining what platform to build])
77 PKG_CHECK_MODULES(LIBOSSO,libosso,[with_platform=maemo],true)
78
79 AC_ARG_WITH(platform,
80 [--with-platform=gnome          platform to build for [gnome]],
81 [case "${with_platform}" in
82        gnome)    MODEST_PLATFORM=gnome;;
83        maemo) MODEST_PLATFORM=maemo;;
84        *)      MODEST_PLATFORM=${with_platform}
85 esac], [MODEST_PLATFORM=gnome
86                with_platform=gnome])
87 AC_SUBST(MODEST_PLATFORM)
88
89 if test "x$with_platform" = "xmaemo"; then
90    PKG_CHECK_MODULES(MODEST_LIBTINYMAIL_MAEMO,libtinymail-maemo-1.0 hildon-libs libosso libossomime osso-addressbook-1.0 wpeditor)
91    AC_SUBST(MODEST_LIBTINYMAIL_MAEMO_CFLAGS)
92    AC_SUBST(MODEST_LIBTINYMAIL_MAEMO_LIBS) 
93  
94   desktopentrydir=`$PKG_CONFIG osso-af-settings --variable=desktopentrydir`
95   serviceentrydir=`$PKG_CONFIG dbus-glib-1 --variable=prefix`/share/dbus-1/services
96   localedir=`$PKG_CONFIG osso-af-settings --variable=localedir`
97   pixmapdir=`$PKG_CONFIG osso-af-settings --variable=hildonpixmapdir`
98   icon_26x26dir=$datadir/icons/hicolor/26x26/hildon
99   icon_34x34dir=$datadir/icons/hicolor/34x34/hildon
100   icon_40x40dir=$datadir/icons/hicolor/40x40/hildon
101   icon_50x50dir=$datadir/icons/hicolor/50x50/hildon
102   icon_scalabledir=$datadir/icons/hicolor/scalable/hildon
103   pluginlibdir=`$PKG_CONFIG hildon-control-panel --variable=plugindir`
104   plugindesktopentrydir=`$PKG_CONFIG hildon-control-panel --variable=plugindesktopentrydir`
105
106   # Define as variables in Makefiles
107   AC_SUBST(desktopentrydir)
108   AC_SUBST(serviceentrydir)
109   AC_SUBST(localedir)
110   AC_SUBST(pixmapdir)
111   AC_SUBST(icon_26x26dir)
112   AC_SUBST(icon_34x34dir)
113   AC_SUBST(icon_40x40dir)
114   AC_SUBST(icon_50x50dir)
115   AC_SUBST(icon_scalabledir)
116   AC_SUBST(pluginlibdir)
117   AC_SUBST(plugindesktopentrydir)
118
119   MODEST_PLATFORM_ID=2
120
121 else
122    # gnome frontend 
123    PKG_CHECK_MODULES(MODEST_LIBTINYMAIL_GNOME_DESKTOP,libtinymail-gnome-desktop-1.0 libnm_glib glib-2.0 >= 2.8 gtk+-2.0 >= 2.10)
124    AC_SUBST(MODEST_LIBTINYMAIL_GNOME_DESKTOP_CFLAGS)
125    AC_SUBST(MODEST_LIBTINYMAIL_GNOME_DESKTOP_LIBS)
126    MODEST_PLATFORM_ID=1
127 fi
128
129 dnl 1==>gnome, 2==>maemo
130 AC_SUBST(MODEST_PLATFORM_ID)
131
132
133
134
135
136 dnl ## setup the testing framework (ie., make check)
137 build_tests=false
138 AC_ARG_ENABLE(tests,
139 AC_HELP_STRING([--enable-tests],
140         [Build tests (no, yes)]),
141 [case "${enableval}" in
142       yes)
143         build_tests=true ;;
144       *) build_tests=false ;;
145 esac],[build_tests=false])
146 AM_CONDITIONAL(BUILD_TESTS, test x$build_tests = xtrue)
147
148 dnl ## is the check package installed?
149 if test x$build_tests = xtrue; then
150    PKG_CHECK_MODULES(CHECK, check >= 0.9.4 glib-2.0)
151 fi
152
153
154
155 dnl ## do we want documentation (gtk-doc)
156 build_docs=false
157 AC_ARG_ENABLE(docs,
158 AC_HELP_STRING([--enable-docs],
159         [Build documentation (yes, no)]),
160 [case "${enableval}" in
161       yes)
162         build_docs=true ;;
163       *) build_docs=false ;;
164 esac],[build_docs=false])
165 AM_CONDITIONAL(BUILD_DOCS, test x$build_docs = xtrue)
166
167 dnl ## gtk-doc
168 GTK_DOC_CHECK([1.0])
169
170 dnl Intltool utility programs
171 #AC_PROG_INTLTOOL([0.33.0],[no-xml])
172
173
174 AC_OUTPUT([
175 po/Makefile.in
176 Makefile
177 man/Makefile
178 src/Makefile
179 src/gnome/Makefile
180 src/maemo/Makefile
181 src/maemo/easysetup/Makefile
182 src/widgets/Makefile
183 docs/Makefile
184 docs/reference/Makefile
185 tests/Makefile
186 src/maemo/modest.desktop
187 src/maemo/modest.service
188 ])
189
190
191
192 echo
193 echo "modest configure results"
194 echo "-----------------------------------"
195 echo "Platform       : $with_platform"
196 echo "Build tests    : $build_tests"
197 echo "Build docs     : $build_docs"
198 echo "Debug version  : $with_debug"
199 echo ""
200 echo "NOTE: you should do a 'make clean' after changing architecture or platform (--with-platform=)"
201 echo ""