]> err.no Git - mapper/blob - configure.ac
Some fixes
[mapper] / configure.ac
1 #
2 # This file is part of maemo-mapper
3 #
4 # Copyright (C) 2006 John Costigan.
5 #
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
10 #
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 # GNU General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License along
17 # with this program; if not, write to the Free Software Foundation, Inc.,
18 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 #
20
21 AC_INIT(Makefile.am)
22 AM_INIT_AUTOMAKE(mapper, 1.0.3.95)
23 AM_MAINTAINER_MODE
24
25 AC_PROG_CPP
26 AC_CONFIG_HEADERS(src/config.h)
27 AC_PROG_INSTALL
28 AC_PROG_LIBTOOL
29 # AC_SYS_LARGEFILE
30 # ^That should do it but for some reason it won't so hack it:
31 # CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES"
32
33 AC_DEFINE(_FILE_OFFSET_BITS, 64, [Enable LFS])
34 AC_DEFINE(_GNU_SOURCE, 1, [Enable GNU Extensions])
35
36 dnl PKG_PROG_PKG_CONFIG
37
38 dnl Debugging options to enable debug macros
39 DEBUG_FLAGS=
40 AC_ARG_ENABLE(debug,     [  --enable-debug                compile with DEBUG],,enable_debug=no)
41
42 if test "x$enable_debug" = "xyes"; then
43     DEBUG_FLAGS="$DEBUG_FLAGS -DDEBUG -g -fno-omit-frame-pointer"
44 else
45     DEBUG_FLAGS="$DEBUG_FLAGS -DG_DISABLE_CHECKS -DG_DISABLE_CAST_CHECKS -DG_DISABLE_ASSERT"
46 fi
47
48 CFLAGS="$CFLAGS $DEBUG_FLAGS -Wall -Wmissing-prototypes -Wmissing-declarations"
49
50 PKG_CHECK_MODULES(GLIBGTK, glib-2.0 gconf-2.0 dbus-glib-1 gtk+-2.0)
51 AC_SUBST(GLIBGTK_LIBS)
52 AC_SUBST(GLIBGTK_CFLAGS)
53
54 AC_PATH_PROG(GCONFTOOL, gconftool-2)
55 AM_GCONF_SOURCE_2
56
57 dnl Maemo has 3.8, but prefer new version in case it's available
58 PKG_CHECK_MODULES(GTKHTML, libgtkhtml-3.14, HAVE_GTKHTML=yes, HAVE_GTKHTML=no)
59 if test "x$HAVE_GTKHTML" = "xno"; then
60         PKG_CHECK_MODULES(GTKHTML, libgtkhtml-3.8)
61 fi
62 AC_SUBST(GTKHTML_LIBS)
63 AC_SUBST(GTKHTML_CFLAGS)
64
65 PKG_CHECK_MODULES(GNOME_VFS, gnome-vfs-2.0 >= 2.8.4.11 gnome-vfs-module-2.0 >= 2.8.4.11)
66 AC_SUBST(GNOME_VFS_LIBS)
67 AC_SUBST(GNOME_VFS_CFLAGS)
68
69 PKG_CHECK_MODULES(LIBXML2, libxml-2.0 >= 2.6.16)
70 AC_SUBST(LIBXML2_LIBS)
71 AC_SUBST(LIBXML2_CFLAGS)
72
73 PKG_CHECK_MODULES(LIBCURL, libcurl)
74 AC_SUBST(LIBCURL_LIBS)
75 AC_SUBST(LIBCURL_CFLAGS)
76
77 PKG_CHECK_MODULES(SQLITE, sqlite3)
78 AC_SUBST(SQLITE_LIBS)
79 AC_SUBST(SQLITE_CFLAGS)
80
81 AC_ARG_ENABLE([770],AS_HELP_STRING([--enable-770],[Build for Nokia 770/N800]),
82               [enable_770=$enableval], [enable_770=no])
83
84 AC_ARG_ENABLE([hildon],AS_HELP_STRING([--enable-hildon],[Build for Hildon]),
85               [enable_hildon=$enableval], [enable_hildon=no])
86
87 AC_ARG_ENABLE([itbtdbus],AS_HELP_STRING([--enable-itbtdbus],[Use IT D-Bus Bluetooth interface]),
88               [enable_itbtdbus=$enableval], [enable_itbtdbus=no])
89
90 AC_ARG_ENABLE([btdbus],AS_HELP_STRING([--enable-btdbus],[Use D-Bus bluez interface]),
91               [enable_btdbus=$enableval], [enable_btdbus=no])
92
93 AC_ARG_ENABLE([gpsd],AS_HELP_STRING([--enable-gpsd],[Use gpsd]),
94               [enable_gpsd=$enableval], [enable_gpsd=no])
95
96 AC_ARG_ENABLE([gypsy],AS_HELP_STRING([--enable-gypsy],[Use gypsy]),
97               [enable_gypsy=$enableval], [enable_gypsy=no])
98
99 AC_ARG_ENABLE([geoclue],AS_HELP_STRING([--enable-geoclue],[Use geoclue]),
100               [enable_geoclue=$enableval], [enable_geoclue=no])
101
102 if test "x$enable_770" = "xno" ; then
103   WITH_DEVICE_770=no
104 else
105   WITH_DEVICE_770=yes
106   enable_hildon=yes
107   AC_DEFINE([WITH_DEVICE_770], 1, [With 770/N800 specific code])
108 fi
109
110 AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal)
111
112 if test "x$enable_itbtdbus" = "xno" ; then
113   WITH_HILDON_DBUS_BT=no
114   enable_btdbus=yes
115 else
116   WITH_HILDON_DBUS_BT=yes
117   AC_CHECK_HEADERS([bt-dbus.h], [ac_cv_btdbus_h=yes])
118   AC_DEFINE([WITH_HILDON_DBUS_BT], 1, [IT D-Bus bluetooth])
119 fi
120
121 PKG_CHECK_MODULES(BLUEZ, bluez, HAVE_BLUEZ=yes, HAVE_BLUEZ=no)
122 if test "x$HAVE_BLUEZ" = "xyes"; then
123  AC_SUBST(BLUEZ_LIBS)
124  AC_SUBST(BLUEZ_CFLAGS)
125  WITH_BLUEZ=yes
126  AC_DEFINE([WITH_BLUEZ], 1, [Bluez RFCOMM])
127 fi
128
129 if test "x$enable_btdbus" = "xno" ; then
130   WITH_BLUEZ_DBUS_BT=no
131 else
132   WITH_BLUEZ_DBUS_BT=yes
133   AC_DEFINE([WITH_BLUEZ_DBUS_BT], 1, [bluez D-Bus bluetooth])
134 fi
135
136 AM_CONDITIONAL(HAVE_HILDON_DBUS_BT, [test "$enable_itbtdbus" = "yes"])
137 AM_CONDITIONAL(HAVE_BLUEZ_DBUS_BT, [test "$enable_btdbus" = "yes"])
138
139 if test "x$enable_hildon" = "xyes" ; then
140  dnl Ckeck for hildon-libs
141  PKG_CHECK_MODULES(HILDON, hildon-libs, HAVE_HILDON=yes, HAVE_HILDON=no)
142
143  if test "x$HAVE_HILDON" = "xno"; then
144   PKG_CHECK_MODULES(HILDON, hildon-1, HAVE_HILDON1=yes, HAVE_HILDON1=no)
145  fi
146
147  if test "x$HAVE_HILDON" = "xyes"; then
148   AC_DEFINE(WITH_HILDON, 1, [build with Maemo/Hildon user interface])
149  else
150   AC_MSG_RESULT(no)
151  fi
152 else
153  HAVE_HILDON=no
154  HAVE_HILDON1=no
155 fi
156
157 if test "x$HAVE_HILDON1" = "xyes"; then
158   AC_DEFINE(WITH_HILDON, 1, [build with Maemo/Hildon user interface])
159   AC_DEFINE(WITH_HILDON_NEW, 1, [build with new Hildon libs])
160   HAVE_HILDON=yes
161 else
162   AC_MSG_RESULT(no)
163 fi
164
165 dnl make HILDON_CFLAGS and HILDON_LIBS available
166 if test "x$HAVE_HILDON" = "xyes"; then
167  AC_SUBST(HILDON_CFLAGS)
168  AC_SUBST(HILDON_LIBS)
169
170  PKG_CHECK_MODULES(OSSO, libosso >= 1, HAVE_OSSO=yes, HAVE_OSSO=no)
171  if test "x$HAVE_OSSO" = "xyes"; then
172   AC_DEFINE(WITH_OSSO, 1, [build with Nokia osso])
173   AC_SUBST(OSSO_LIBS)
174   AC_SUBST(OSSO_CFLAGS)
175  else
176   AC_MSG_RESULT(no)
177  fi
178
179  if test "x$HAVE_OSSO" = "xyes"; then
180
181  PKG_CHECK_MODULES(CONIC, conic, CONIC=yes, CONIC=no)
182  if test "x$CONIC" = "xyes"; then
183   AC_DEFINE(WITH_CONIC, 1, [build with Nokia Internet Connectivity library])
184   AC_SUBST(CONIC_LIBS)
185   AC_SUBST(CONIC_CFLAGS)
186  else
187   AC_MSG_RESULT(no)
188   PKG_CHECK_MODULES(OSSO_IC, osso-ic, HAVE_OSSO_IC=yes, HAVE_OSSO_IC=no)
189   if test "x$HAVE_OSSO_IC" = "xyes"; then
190    AC_DEFINE(WITH_OSSO_IC, 1, [build with Nokia osso ic])
191    AC_SUBST(OSSO_IC_LIBS)
192    AC_SUBST(OSSO_IC_CFLAGS)
193   else
194    AC_MSG_RESULT(no)
195   fi
196  fi
197
198  PKG_CHECK_MODULES(HILDON_HELP, hildon-help, HAVE_HILDON_HELP=yes, HAVE_HILDON_HELP=no)
199  if test "x$HAVE_HILDON_HELP" = "xyes"; then
200   AC_DEFINE(WITH_HILDON_HELP, 1, [build with Nokia hildon help (new)])
201   AC_SUBST(HILDON_HELP_LIBS)
202   AC_SUBST(HILDON_HELP_CFLAGS)
203  else
204   AC_MSG_RESULT(no)
205   PKG_CHECK_MODULES(OSSO_HELP, libossohelp, HAVE_OSSO_HELP=yes, HAVE_OSSO_HELP=no)
206   if test "x$HAVE_OSSO_HELP" = "xyes"; then
207    AC_DEFINE(WITH_OSSO_HELP, 1, [build with Nokia osso help (old)])
208    AC_SUBST(OSSO_HELP_LIBS)
209    AC_SUBST(OSSO_HELP_CFLAGS)
210   else
211    AC_MSG_RESULT(no)
212   fi
213  fi
214
215  # libosso
216  fi
217
218  PKG_CHECK_MODULES(HILDONFM, hildon-fm, HAVE_HILDONFM=yes, HAVE_HILDONFM=no)
219  if test "x$HAVE_HILDONFM" = "xyes"; then
220   AC_DEFINE(WITH_HILDONFM, 1, [build with Hildon Filemanager 1])
221   AC_SUBST(HILDONFM_LIBS)
222   AC_SUBST(HILDONFM_CFLAGS)
223  else
224   AC_MSG_RESULT(no)
225   PKG_CHECK_MODULES(HILDONFM, hildon-fm-2, HAVE_HILDONFM=yes, HAVE_HILDONFM=no)
226   if test "x$HAVE_HILDONFM" = "xyes"; then
227    AC_DEFINE(WITH_HILDONFM, 1, [build with Hildon Filemanager 2])
228    AC_SUBST(HILDONFM_LIBS)
229    AC_SUBST(HILDONFM_CFLAGS)
230   else
231    AC_MSG_RESULT(no)
232   fi
233  fi
234
235 fi
236
237 AM_CONDITIONAL(WITH_HILDON, test "x$HAVE_HILDON" = "xyes")
238 AM_CONDITIONAL(WITH_OSSO, test "x$HAVE_OSSO" = "xyes")
239
240 if test "x$enable_gpsd" = "xyes" ; then
241 AC_CHECK_HEADERS([gps.h], [ac_cv_gps_h=yes])
242 AC_CHECK_LIB(gps, gps_open,[ac_cv_libgps=yes] )
243 if test "x$ac_cv_libgps" = xyes; then
244         AC_DEFINE(WITH_LIBGPS, 1, [build with gpsd])
245 fi
246 fi
247 AM_CONDITIONAL(HAVE_GPSD, [test "$enable_gpsd" = "yes"])
248
249 if test "x$enable_gypsy" = "xyes" ; then
250  PKG_CHECK_MODULES(GYPSY, gypsy, HAVE_GYPSY=yes, HAVE_GYPSY=no)
251  if test "x$HAVE_GEOCLUE" = "xyes"; then
252   AC_DEFINE(WITH_GYPSY, 1, [build with gypsy])
253   AC_SUBST(GYPSY_CFLAGS)
254   AC_SUBST(GYPSY_LIBS)
255  fi
256 fi
257 AM_CONDITIONAL(HAVE_GYPSY, [test "$enable_gypsy" = "yes"])
258
259
260 if test "x$enable_geoclue" = "xyes" ; then
261  PKG_CHECK_MODULES(GEOCLUE, geoclue, HAVE_GEOCLUE=yes, HAVE_GEOCLUE=no)
262  if test "x$HAVE_GEOCLUE" = "xyes"; then
263   AC_DEFINE(WITH_GEOCLUE, 1, [build with Geoclue])
264   AC_SUBST(GEOCLUE_CFLAGS)
265   AC_SUBST(GEOCLUE_LIBS)
266  fi
267 fi
268 AM_CONDITIONAL(HAVE_GEOCLUE, [test "$enable_geoclue" = "yes"])
269
270
271 PKG_CHECK_MODULES(GSTREAMER, gstreamer-0.10, HAVE_GST=yes, HAVE_GST=no)
272 if test "x$HAVE_GST" = "xyes"; then
273  AC_DEFINE(WITH_GST, 1, [build with Gstreamer])
274  GSTREAMER_LIBS="$GSTREAMER_LIBS -lgstapp-0.10"
275  AC_SUBST(GSTREAMER_LIBS)
276  AC_SUBST(GSTREAMER_CFLAGS)
277 else
278  AC_MSG_ERROR([Mapper requires gstreamer.])
279 fi
280
281 AC_CHECK_HEADERS(bzlib.h,
282     BZ2_LIBS="$BZ2_LIBS -lbz2",
283     AC_MSG_ERROR([Mapper requires libbz2.])
284     )
285 AC_SUBST(BZ2_LIBS)
286
287 AC_CHECK_LIB([expat], [XML_ParserCreate],
288   AC_DEFINE(HAVE_LIBEXPAT, 1, [Defined if you have libexpat])
289   AC_SUBST(EXPAT_LIBS)
290 )
291
292 AC_CHECK_HEADERS(expat.h,
293         EXPAT_LIBS="-lexpat",
294         AC_MSG_ERROR([Mapper requires libexpat.])
295         )
296 AC_SUBST(EXPAT_LIBS)
297
298 AC_CHECK_HEADER(espeak/speak_lib.h, HAVE_ESPEAK=yes, HAVE_ESPEAK=no)
299 if test "x$HAVE_GST" = "xyes"; then
300 ESPEAK_LIBS="-lespeak"
301 ESPEAK_CFLAGS="-I/usr/include/espeak"
302 AC_CHECK_LIB([espeak], [espeak_Initialize],
303   AC_DEFINE(WITH_ESPEAK, 1, [Defined if you have espeak])
304   AC_SUBST(ESPEAK_CFLAGS)
305   AC_SUBST(ESPEAK_LIBS)
306 )
307 fi
308
309 # Localisation
310 if test "x$HAVE_HILDON" = "xyes"; then
311  localedir=`$PKG_CONFIG osso-af-settings --variable=localedir`
312 else
313  localedir=
314 fi
315 AC_PROG_INTLTOOL([0.23])
316 GETTEXT_PACKAGE=$PACKAGE
317 AC_SUBST(GETTEXT_PACKAGE)
318 AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE], "${GETTEXT_PACKAGE}", [Name of gettext package])
319 ALL_LINGUAS="en_US en_GB nl_NL it_IT bg_BG fi_FI"
320 AM_GLIB_GNU_GETTEXT
321
322 if test "x$HAVE_HILDON" = "xyes"; then
323 # To make application visible in maemo Task Navigator it needs a Desktop
324 # file for the application.
325 # D-BUS service file is needed to be able to launch the maemo application
326 # and connect it to D-BUS services.
327 # The following line defines install directories for these files.
328  desktopentrydir=`$PKG_CONFIG osso-af-settings --variable=desktopentrydir`
329  serviceentrydir=`$PKG_CONFIG osso-af-settings --variable=dbusservicedir`
330
331 # Application pixmaps install directory
332  pixmapdir=`$PKG_CONFIG osso-af-settings --variable=hildonpixmapdir`
333
334 # Help file install directory
335  helpfile_engbdir=$datadir/osso-help/en_US
336
337 # Hildon control panel plugin install directories
338  pluginlibdir=`$PKG_CONFIG hildon-control-panel --variable=plugindir`
339  plugindesktopentrydir=`$PKG_CONFIG hildon-control-panel --variable=plugindesktopentrydir`
340
341  # Application icon install directories
342  icon_26x26dir=$datadir/icons/hicolor/26x26/hildon
343  icon_34x34dir=$datadir/icons/hicolor/34x34/hildon
344  icon_40x40dir=$datadir/icons/hicolor/40x40/hildon
345  icon_50x50dir=$datadir/icons/hicolor/50x50/hildon
346  icon_scalabledir=$datadir/icons/hicolor/scalable/hildon
347
348  # Help file install directory
349  helpfile_enusdir=$datadir/osso-help/en_US
350  helpfile_engbdir=$datadir/osso-help/en_GB
351
352  AC_SUBST(helpfile_enusdir)
353  AC_SUBST(helpfile_engbdir)
354
355 else
356  desktopentrydir=$datadir/applications
357  serviceentrydir=
358  pixmapdir=$datadir/pixmaps
359  pluginlibdir=
360  plugindesktopentrydir=
361
362  # Application icon install directories
363  icon_26x26dir=$datadir/icons/hicolor/26x26
364  icon_34x34dir=$datadir/icons/hicolor/34x34
365  icon_40x40dir=$datadir/icons/hicolor/40x40
366  icon_50x50dir=$datadir/icons/hicolor/50x50
367  icon_scalabledir=$datadir/icons/hicolor/scalable
368
369 fi
370
371 # Define as variables in Makefiles
372 AC_SUBST(desktopentrydir)
373 AC_SUBST(serviceentrydir)
374 AC_SUBST(localedir)
375 AC_SUBST(pixmapdir)
376 AC_SUBST(icon_26x26dir)
377 AC_SUBST(icon_34x34dir)
378 AC_SUBST(icon_40x40dir)
379 AC_SUBST(icon_50x50dir)
380 AC_SUBST(icon_scalabledir)
381 AC_SUBST(pluginlibdir)
382 AC_SUBST(plugindesktopentrydir)
383
384 AC_DEFINE_UNQUOTED([LOCALEDIR], "${localedir}", [Runtime locale catalog files path])
385 AC_DEFINE_UNQUOTED([PIXMAPDIR], "${pixmapdir}", [Runtime pixmap files path])
386
387 # Produce output files
388 AC_OUTPUT(
389           Makefile \
390           src/Makefile \
391           data/Makefile \
392           data/help/Makefile \
393           po/Makefile.in \
394           po/Makefile
395 )
396
397 if test x$enable_hildon = xyes; then
398 AC_MSG_NOTICE([** Hildon support enabled])
399 fi
400
401 if test x$enable_770 = xyes; then
402 AC_MSG_NOTICE([** Tablet support enabled])
403 fi
404
405 if test x$enable_itbtdbus = xyes; then
406 AC_MSG_NOTICE([** Tablet bluetooth D-Bus support enabled])
407 fi
408
409 if test x$HAVE_BLUEZ = xyes; then
410 AC_MSG_NOTICE([** Bluez support enabled])
411 fi
412
413 if test x$enable_btdbus = xyes; then
414 AC_MSG_NOTICE([** Bluez D-Bus support enabled])
415 fi
416
417 if test x$enable_gpsd = xyes; then
418 AC_MSG_NOTICE([** GPSD support enabled])
419 fi
420
421 if test x$enable_gypsy = xyes; then
422 AC_MSG_NOTICE([** Gypsy D-Bus GPS support enabled])
423 fi