]> err.no Git - mapper/blob - configure.ac
Use globaly set _GNU_SOURCE
[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 AC_ARG_ENABLE([770],AS_HELP_STRING([--enable-770],[Build for Nokia 770/N800]),
66               [enable_770=$enableval], [enable_770=no])
67
68 AC_ARG_ENABLE([hildon],AS_HELP_STRING([--enable-hildon],[Build for Hildon]),
69               [enable_hildon=$enableval], [enable_hildon=no])
70
71 AC_ARG_ENABLE([itbtdbus],AS_HELP_STRING([--enable-itbtdbus],[Use IT D-Bus Bluetooth interface]),
72               [enable_itbtdbus=$enableval], [enable_itbtdbus=no])
73
74 AC_ARG_ENABLE([btdbus],AS_HELP_STRING([--enable-btdbus],[Use D-Bus bluez interface]),
75               [enable_btdbus=$enableval], [enable_btdbus=no])
76
77 AC_ARG_ENABLE([gpsd],AS_HELP_STRING([--enable-gpsd],[Use gpsd]),
78               [enable_gpsd=$enableval], [enable_gpsd=no])
79
80 AC_ARG_ENABLE([gypsy],AS_HELP_STRING([--enable-gypsy],[Use gypsy]),
81               [enable_gypsy=$enableval], [enable_gypsy=no])
82
83 AC_ARG_ENABLE([geoclue],AS_HELP_STRING([--enable-geoclue],[Use geoclue]),
84               [enable_geoclue=$enableval], [enable_geoclue=no])
85
86 if test "x$enable_770" = "xno" ; then
87   WITH_DEVICE_770=no
88 else
89   WITH_DEVICE_770=yes
90   enable_hildon=yes
91   AC_DEFINE([WITH_DEVICE_770], 1, [With 770/N800 specific code])
92 fi
93
94 AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal)
95
96 if test "x$enable_itbtdbus" = "xno" ; then
97   WITH_HILDON_DBUS_BT=no
98   enable_btdbus=yes
99 else
100   WITH_HILDON_DBUS_BT=yes
101   AC_CHECK_HEADERS([bt-dbus.h], [ac_cv_btdbus_h=yes])
102   AC_DEFINE([WITH_HILDON_DBUS_BT], 1, [IT D-Bus bluetooth])
103 fi
104
105 if test "x$enable_btdbus" = "xno" ; then
106   WITH_BLUEZ_DBUS_BT=no
107 else
108   WITH_BLUEZ_DBUS_BT=yes
109   PKG_CHECK_MODULES(BLUEZ, bluez)
110   AC_SUBST(BLUEZ_LIBS)
111   AC_SUBST(BLUEZ_CFLAGS)
112   AC_DEFINE([WITH_BLUEZ_DBUS_BT], 1, [bluez D-Bus bluetooth])
113 fi
114
115 if test "x$enable_hildon" = "xyes" ; then
116  dnl Ckeck for hildon-libs
117  PKG_CHECK_MODULES(HILDON, hildon-libs, HAVE_HILDON=yes, HAVE_HILDON=no)
118
119  if test "x$HAVE_HILDON" = "xno"; then
120   PKG_CHECK_MODULES(HILDON, hildon-1, HAVE_HILDON1=yes, HAVE_HILDON1=no)
121  fi
122
123  if test "x$HAVE_HILDON" = "xyes"; then
124   AC_DEFINE(WITH_HILDON, 1, [build with Maemo/Hildon user interface])
125  else
126   AC_MSG_RESULT(no)
127  fi
128 else
129  HAVE_HILDON=no
130  HAVE_HILDON1=no
131 fi
132
133 if test "x$HAVE_HILDON1" = "xyes"; then
134   AC_DEFINE(WITH_HILDON, 1, [build with Maemo/Hildon user interface])
135   AC_DEFINE(WITH_HILDON_NEW, 1, [build with new Hildon libs])
136   HAVE_HILDON=yes
137 else
138   AC_MSG_RESULT(no)
139 fi
140
141 dnl make HILDON_CFLAGS and HILDON_LIBS available
142 if test "x$HAVE_HILDON" = "xyes"; then
143  AC_SUBST(HILDON_CFLAGS)
144  AC_SUBST(HILDON_LIBS)
145
146  PKG_CHECK_MODULES(OSSO, libosso >= 1, HAVE_OSSO=yes, HAVE_OSSO=no)
147  if test "x$HAVE_OSSO" = "xyes"; then
148   AC_DEFINE(WITH_OSSO, 1, [build with Nokia osso])
149   AC_SUBST(OSSO_LIBS)
150   AC_SUBST(OSSO_CFLAGS)
151  else
152   AC_MSG_RESULT(no)
153  fi
154
155  if test "x$HAVE_OSSO" = "xyes"; then
156
157  PKG_CHECK_MODULES(CONIC, conic, CONIC=yes, CONIC=no)
158  if test "x$CONIC" = "xyes"; then
159   AC_DEFINE(WITH_CONIC, 1, [build with Nokia Internet Connectivity library])
160   AC_SUBST(CONIC_LIBS)
161   AC_SUBST(CONIC_CFLAGS)
162  else
163   AC_MSG_RESULT(no)
164   PKG_CHECK_MODULES(OSSO_IC, osso-ic, HAVE_OSSO_IC=yes, HAVE_OSSO_IC=no)
165   if test "x$HAVE_OSSO_IC" = "xyes"; then
166    AC_DEFINE(WITH_OSSO_IC, 1, [build with Nokia osso ic])
167    AC_SUBST(OSSO_IC_LIBS)
168    AC_SUBST(OSSO_IC_CFLAGS)
169   else
170    AC_MSG_RESULT(no)
171   fi
172  fi
173
174  PKG_CHECK_MODULES(HILDON_HELP, hildon-help, HAVE_HILDON_HELP=yes, HAVE_HILDON_HELP=no)
175  if test "x$HAVE_HILDON_HELP" = "xyes"; then
176   AC_DEFINE(WITH_HILDON_HELP, 1, [build with Nokia hildon help (new)])
177   AC_SUBST(HILDON_HELP_LIBS)
178   AC_SUBST(HILDON_HELP_CFLAGS)
179  else
180   AC_MSG_RESULT(no)
181   PKG_CHECK_MODULES(OSSO_HELP, libossohelp, HAVE_OSSO_HELP=yes, HAVE_OSSO_HELP=no)
182   if test "x$HAVE_OSSO_HELP" = "xyes"; then
183    AC_DEFINE(WITH_OSSO_HELP, 1, [build with Nokia osso help (old)])
184    AC_SUBST(OSSO_HELP_LIBS)
185    AC_SUBST(OSSO_HELP_CFLAGS)
186   else
187    AC_MSG_RESULT(no)
188   fi
189  fi
190
191  # libosso
192  fi
193
194  PKG_CHECK_MODULES(HILDONFM, hildon-fm, HAVE_HILDONFM=yes, HAVE_HILDONFM=no)
195  if test "x$HAVE_HILDONFM" = "xyes"; then
196   AC_DEFINE(WITH_HILDONFM, 1, [build with Hildon Filemanager 1])
197   AC_SUBST(HILDONFM_LIBS)
198   AC_SUBST(HILDONFM_CFLAGS)
199  else
200   AC_MSG_RESULT(no)
201   PKG_CHECK_MODULES(HILDONFM, hildon-fm-2, HAVE_HILDONFM=yes, HAVE_HILDONFM=no)
202   if test "x$HAVE_HILDONFM" = "xyes"; then
203    AC_DEFINE(WITH_HILDONFM, 1, [build with Hildon Filemanager 2])
204    AC_SUBST(HILDONFM_LIBS)
205    AC_SUBST(HILDONFM_CFLAGS)
206   else
207    AC_MSG_RESULT(no)
208   fi
209  fi
210
211 fi
212
213 AM_CONDITIONAL(WITH_HILDON, test "x$HAVE_HILDON" = "xyes")
214 AM_CONDITIONAL(WITH_OSSO, test "x$HAVE_OSSO" = "xyes")
215
216 if test "x$enable_gpsd" = "xyes" ; then
217 AC_CHECK_HEADERS([gps.h], [ac_cv_gps_h=yes])
218 AC_CHECK_LIB(gps, gps_open,[ac_cv_libgps=yes] )
219 if test "x$ac_cv_libgps" = xyes; then
220         AC_DEFINE(WITH_LIBGPS, 1, [build with gpsd])
221 fi
222 fi
223
224 if test "x$enable_gypsy" = "xyes" ; then
225 PKG_CHECK_MODULES(GYPSY, [gypsy]) AC_SUBST(GYPSY_CFLAGS) AC_SUBST(GYPSY_LIBS)
226 AC_DEFINE(WITH_GYPSY, 1, [build with gypsy])
227 fi
228
229 if test "x$enable_geoclue" = "xyes" ; then
230 PKG_CHECK_MODULES(GEOCLUE, geoclue, HAVE_GEOCLUE=yes, HAVE_GEOCLUE=no)
231 if test "x$HAVE_GEOCLUE" = "xyes"; then
232  AC_DEFINE(WITH_GEOCLUE, 1, [build with Geoclue])
233  AC_SUBST(GEOCLUE_CFLAGS)
234  AC_SUBST(GEOCLUE_LIBS)
235 fi
236 fi
237
238 PKG_CHECK_MODULES(GNOME_VFS, gnome-vfs-2.0 >= 2.8.4.11 gnome-vfs-module-2.0 >= 2.8.4.11)
239 AC_SUBST(GNOME_VFS_LIBS)
240 AC_SUBST(GNOME_VFS_CFLAGS)
241
242 PKG_CHECK_MODULES(LIBXML2, libxml-2.0 >= 2.6.16)
243 AC_SUBST(LIBXML2_LIBS)
244 AC_SUBST(LIBXML2_CFLAGS)
245
246 PKG_CHECK_MODULES(LIBCURL, libcurl)
247 AC_SUBST(LIBCURL_LIBS)
248 AC_SUBST(LIBCURL_CFLAGS)
249
250 PKG_CHECK_MODULES(SQLITE, sqlite3)
251 AC_SUBST(SQLITE_LIBS)
252 AC_SUBST(SQLITE_CFLAGS)
253
254 PKG_CHECK_MODULES(GSTREAMER, gstreamer-0.10, HAVE_GST=yes, HAVE_GST=no)
255 if test "x$HAVE_GST" = "xyes"; then
256  AC_DEFINE(WITH_GST, 1, [build with Gstreamer])
257  GSTREAMER_LIBS="$GSTREAMER_LIBS -lgstapp-0.10"
258  AC_SUBST(GSTREAMER_LIBS)
259  AC_SUBST(GSTREAMER_CFLAGS)
260 else
261  AC_MSG_ERROR([Mapper requires gstreamer.])
262 fi
263
264 AC_CHECK_HEADERS(bzlib.h,
265     BZ2_LIBS="$BZ2_LIBS -lbz2",
266     AC_MSG_ERROR([Mapper requires libbz2.])
267     )
268 AC_SUBST(BZ2_LIBS)
269
270 AC_CHECK_LIB([expat], [XML_ParserCreate],
271   AC_DEFINE(HAVE_LIBEXPAT, 1, [Defined if you have libexpat])
272   AC_SUBST(EXPAT_LIBS)
273 )
274
275 AC_CHECK_HEADERS(expat.h,
276         EXPAT_LIBS="-lexpat",
277         AC_MSG_ERROR([Mapper requires libexpat.])
278         )
279 AC_SUBST(EXPAT_LIBS)
280
281 AC_CHECK_HEADER(espeak/speak_lib.h, HAVE_ESPEAK=yes, HAVE_ESPEAK=no)
282 if test "x$HAVE_GST" = "xyes"; then
283 ESPEAK_LIBS="-lespeak"
284 ESPEAK_CFLAGS="-I/usr/include/espeak"
285 AC_CHECK_LIB([espeak], [espeak_Initialize],
286   AC_DEFINE(WITH_ESPEAK, 1, [Defined if you have espeak])
287   AC_SUBST(ESPEAK_CFLAGS)
288   AC_SUBST(ESPEAK_LIBS)
289 )
290 fi
291
292 # Localisation
293 if test "x$HAVE_HILDON" = "xyes"; then
294  localedir=`$PKG_CONFIG osso-af-settings --variable=localedir`
295 else
296  localedir=
297 fi
298 AC_PROG_INTLTOOL([0.23])
299 GETTEXT_PACKAGE=$PACKAGE
300 AC_SUBST(GETTEXT_PACKAGE)
301 AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE], "${GETTEXT_PACKAGE}", [Name of gettext package])
302 ALL_LINGUAS="en_US en_GB nl_NL it_IT bg_BG fi_FI"
303 AM_GLIB_GNU_GETTEXT
304
305 if test "x$HAVE_HILDON" = "xyes"; then
306 # To make application visible in maemo Task Navigator it needs a Desktop
307 # file for the application.
308 # D-BUS service file is needed to be able to launch the maemo application
309 # and connect it to D-BUS services.
310 # The following line defines install directories for these files.
311  desktopentrydir=`$PKG_CONFIG osso-af-settings --variable=desktopentrydir`
312  serviceentrydir=`$PKG_CONFIG osso-af-settings --variable=dbusservicedir`
313
314 # Application pixmaps install directory
315  pixmapdir=`$PKG_CONFIG osso-af-settings --variable=hildonpixmapdir`
316
317 # Help file install directory
318  helpfile_engbdir=$datadir/osso-help/en_US
319
320 # Hildon control panel plugin install directories
321  pluginlibdir=`$PKG_CONFIG hildon-control-panel --variable=plugindir`
322  plugindesktopentrydir=`$PKG_CONFIG hildon-control-panel --variable=plugindesktopentrydir`
323
324  # Application icon install directories
325  icon_26x26dir=$datadir/icons/hicolor/26x26/hildon
326  icon_34x34dir=$datadir/icons/hicolor/34x34/hildon
327  icon_40x40dir=$datadir/icons/hicolor/40x40/hildon
328  icon_50x50dir=$datadir/icons/hicolor/50x50/hildon
329  icon_scalabledir=$datadir/icons/hicolor/scalable/hildon
330
331  # Help file install directory
332  helpfile_enusdir=$datadir/osso-help/en_US
333  helpfile_engbdir=$datadir/osso-help/en_GB
334
335  AC_SUBST(helpfile_enusdir)
336  AC_SUBST(helpfile_engbdir)
337
338 else
339  desktopentrydir=$datadir/applications
340  serviceentrydir=
341  pixmapdir=$datadir/pixmaps
342  pluginlibdir=
343  plugindesktopentrydir=
344
345  # Application icon install directories
346  icon_26x26dir=$datadir/icons/hicolor/26x26
347  icon_34x34dir=$datadir/icons/hicolor/34x34
348  icon_40x40dir=$datadir/icons/hicolor/40x40
349  icon_50x50dir=$datadir/icons/hicolor/50x50
350  icon_scalabledir=$datadir/icons/hicolor/scalable
351
352 fi
353
354 # Define as variables in Makefiles
355 AC_SUBST(desktopentrydir)
356 AC_SUBST(serviceentrydir)
357 AC_SUBST(localedir)
358 AC_SUBST(pixmapdir)
359 AC_SUBST(icon_26x26dir)
360 AC_SUBST(icon_34x34dir)
361 AC_SUBST(icon_40x40dir)
362 AC_SUBST(icon_50x50dir)
363 AC_SUBST(icon_scalabledir)
364 AC_SUBST(pluginlibdir)
365 AC_SUBST(plugindesktopentrydir)
366
367 AC_DEFINE_UNQUOTED([LOCALEDIR], "${localedir}", [Runtime locale catalog files path])
368 AC_DEFINE_UNQUOTED([PIXMAPDIR], "${pixmapdir}", [Runtime pixmap files path])
369
370 # Produce output files
371 AC_OUTPUT(
372           Makefile \
373           src/Makefile \
374           data/Makefile \
375           data/help/Makefile \
376           po/Makefile.in \
377           po/Makefile
378 )
379
380 if test x$enable_hildon = xyes; then
381 AC_MSG_NOTICE([** Hildon support enabled])
382 fi
383
384 if test x$enable_770 = xyes; then
385 AC_MSG_NOTICE([** Tablet support enabled])
386 fi
387
388 if test x$enable_itbtdbus = xyes; then
389 AC_MSG_NOTICE([** Tablet bluetooth D-Bus support enabled])
390 fi
391
392 if test x$enable_btdbus = xyes; then
393 AC_MSG_NOTICE([** Bluez D-Bus support enabled])
394 fi
395
396 if test x$enable_gpsd = xyes; then
397 AC_MSG_NOTICE([** GPSD support enabled])
398 fi
399
400 if test x$enable_gypsy = xyes; then
401 AC_MSG_NOTICE([** Gypsy D-Bus GPS support enabled])
402 fi