]> git.street.me.uk Git - andy/viking.git/blob - configure.ac
Save and use the position of the horizontal pane when restoring the window layout.
[andy/viking.git] / configure.ac
1 #                                               -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
3
4 AC_PREREQ(2.59)
5 AC_INIT(viking, 1.5, , viking, http://viking.sf.net/)
6 AM_INIT_AUTOMAKE([dist-bzip2 dist-zip subdir-objects])
7 dnl AC_CONFIG_SRCDIR([src/main.c])
8 AC_CONFIG_HEADERS([src/config.h])
9 GTK_DOC_CHECK(1.0)
10
11 AC_PROG_CC
12 AC_PROG_CC_STDC
13 # Checks for programs.
14 AC_PROG_MAKE_SET
15 AC_PROG_RANLIB
16 AC_PATH_PROG(GLIB_MKENUMS, glib-mkenums)
17
18 # I18N
19 GETTEXT_PACKAGE=viking
20 AC_SUBST(GETTEXT_PACKAGE)
21 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE",[Gettext package name])
22
23 AM_GLIB_DEFINE_LOCALEDIR(LOCALEDIR)
24
25 AM_GNU_GETTEXT_VERSION([0.17])
26 AM_GNU_GETTEXT([external])
27
28 IT_PROG_INTLTOOL([0.35.0])
29
30 AC_SUBST([CONFIG_STATUS_DEPENDENCIES],['$(top_srcdir)/po/LINGUAS'])
31
32 dnl This will cause the automake generated makefiles to pass the
33 dnl correct flags to aclocal.
34 ACLOCAL_AMFLAGS="\${ACLOCAL_FLAGS}"
35 AC_SUBST(ACLOCAL_AMFLAGS)
36
37 # Checks for header files.
38 AC_HEADER_STDC
39 AC_CHECK_HEADERS([malloc.h stdlib.h string.h sys/param.h sys/types.h unistd.h math.h utime.h X11/Xlib.h])
40
41 # Checks for typedefs, structures, and compiler characteristics.
42 AC_C_CONST
43 AC_TYPE_MODE_T
44
45 # Checks for library functions or symbols
46 AC_FUNC_STAT
47 AC_FUNC_STRTOD
48 AC_CHECK_FUNCS([floor memset mkdtemp pow realpath sqrt strcasecmp strchr strdup strncasecmp strtol strtoul])
49 AC_CHECK_LIB(m, tan)
50 AC_CHECK_LIB(z, inflate)
51 AC_CHECK_LIB(X11, XSetErrorHandler)
52
53 # ATM not running automake under Windows
54 #AC_CHECK_PROG(USE_WINDOWS, cmd.exe, yes, no)
55 #AM_CONDITIONAL([WINDOWS], [test x$USE_WINDOWS = xyes])
56 # So pass in as an option instead
57 # This is only to perform slightly different build steps
58 #  (the code uses standard WINDOWS defines for any specific different behaviour)
59 AC_ARG_ENABLE(windows, AC_HELP_STRING([--enable-windows],
60               [Perform specific Windows build steps (default is no)]),
61               [ac_cv_enable_windows=$enableval],
62               [ac_cv_enable_windows=no])
63 AC_CACHE_CHECK([whether to enable Windows build steps],
64                [ac_cv_enable_windows], [ac_cv_enable_windows=no])
65 AM_CONDITIONAL([WINDOWS], [test x$ac_cv_enable_windows = xyes])
66
67 # Expat
68 AM_WITH_EXPAT
69
70 # Curl
71 LIBCURL_CHECK_CONFIG([yes],[],[],[AC_MSG_ERROR([libcurl is needed but not found])])
72
73 # gdk-pixbuf-csource
74 AC_CHECK_PROG([GDK_PIXBUF_CSOURCE],gdk-pixbuf-csource,[yes])
75 if test "x$GDK_PIXBUF_CSOURCE" != "xyes"
76 then
77   AC_MSG_ERROR([gdk-pixbuf-csource is needed but not found])
78 fi
79
80 dnl  ------------------
81 dnl | Pkgconfig checks |---------------------------------------
82 dnl  ------------------
83
84 PKG_CHECK_MODULES(PACKAGE, [
85         glib-2.0          >= 2.16
86         gthread-2.0       >= 2.2
87         gtk+-2.0          >= 2.16
88         gio-2.0           >= 2.12
89 ])
90
91 AC_SUBST(PACKAGE_CFLAGS)
92 AC_SUBST(PACKAGE_LIBS)
93
94 dnl  -------------
95 dnl | User Manual |---------------------------------------
96 dnl  -------------
97 GNOME_DOC_INIT
98
99 dnl ---------------------------------------------------------------------------
100 dnl - Use deprecated options (default enabled for devs, disabled in releases) 
101 dnl ---------------------------------------------------------------------------
102
103 AC_ARG_ENABLE(deprecations,
104               [AC_HELP_STRING([--enable-deprecations],
105                               [warn about deprecated usages [default=no]])],
106                               [ac_cv_enable_deprecations=$enableval],
107                               [ac_cv_enable_deprecations=no])
108 AC_CACHE_CHECK([whether to enable deprecated features],
109                [ac_cv_enable_deprecations], [ac_cv_enable_deprecations=no])
110
111 if test "x$ac_cv_enable_deprecations" = "xyes"; then
112    DISABLE_DEPRECATED_CFLAGS="\
113 -DG_DISABLE_SINGLE_INCLUDES \
114 -DGSEAL_ENABLE \
115 -DG_DISABLE_DEPRECATED \
116 -DGDK_DISABLE_DEPRECATED \
117 -DGDK_PIXBUF_DISABLE_DEPRECATED \
118 -DGTK_DISABLE_SINGLE_INCLUDES \
119 -DGTK_DISABLE_DEPRECATED"
120    CPPFLAGS="$CPPFLAGS $DISABLE_DEPRECATED_CFLAGS"
121 fi
122
123 # Options
124 AC_ARG_ENABLE(bing, AC_HELP_STRING([--enable-bing],
125               [enable Bing stuff (default is enable)]),
126               [ac_cv_enable_bing=$enableval],
127               [ac_cv_enable_bing=yes])
128 AC_CACHE_CHECK([whether to enable Bing stuff],
129                [ac_cv_enable_bing], [ac_cv_enable_bing=yes])
130 case $ac_cv_enable_bing in
131   yes)
132     AC_DEFINE(VIK_CONFIG_BING, [], [BING STUFF])
133     ;;
134 esac
135 AM_CONDITIONAL([BING], [test x$ac_cv_enable_bing = xyes])
136
137 AC_ARG_ENABLE(google, AC_HELP_STRING([--enable-google],
138               [enable Google stuff (default is enable)]),
139               [ac_cv_enable_google=$enableval],
140               [ac_cv_enable_google=yes])
141 AC_CACHE_CHECK([whether to enable Google stuff],
142                [ac_cv_enable_google], [ac_cv_enable_google=yes])
143 case $ac_cv_enable_google in
144   yes)
145     AC_DEFINE(VIK_CONFIG_GOOGLE, [], [GOOGLE STUFF])
146     ;;
147 esac
148 AM_CONDITIONAL([GOOGLE], [test x$ac_cv_enable_google = xyes])
149
150 AC_ARG_ENABLE(terraserver, AC_HELP_STRING([--enable-terraserver],
151               [enable Terraserver stuff (default is disabled as the tileserver is no longer available)]),
152               [ac_cv_enable_terraserver=$enableval],
153               [ac_cv_enable_terraserver=no])
154 AC_CACHE_CHECK([whether to enable Terraserver stuff],
155                [ac_cv_enable_terraserver], [ac_cv_enable_terraserver=yes])
156 case $ac_cv_enable_terraserver in
157   yes)
158     AC_DEFINE(VIK_CONFIG_TERRASERVER, [], [TERRASERVER STUFF])
159     ;;
160 esac
161 AM_CONDITIONAL([TERRASERVER], [test x$ac_cv_enable_terraserver = xyes])
162
163 AC_ARG_ENABLE(expedia, AC_HELP_STRING([--enable-expedia],
164               [enable Expedia stuff (default is disable)]),
165               [ac_cv_enable_expedia=$enableval],
166               [ac_cv_enable_expedia=no])
167 AC_CACHE_CHECK([whether to enable Expedia stuff],
168                [ac_cv_enable_expedia], [ac_cv_enable_expedia=yes])
169 case $ac_cv_enable_expedia in
170   yes)
171     AC_DEFINE(VIK_CONFIG_EXPEDIA, [], [EXPEDIA STUFF])
172     ;;
173 esac
174 AM_CONDITIONAL([EXPEDIA], [test x$ac_cv_enable_expedia = xyes])
175
176 # OpenStreetMap http://www.openstreetmap.org/
177 AC_ARG_ENABLE(openstreetmap, AC_HELP_STRING([--enable-openstreetmap],
178               [enable OpenStreetMap stuff (default is enable)]),
179               [ac_cv_enable_openstreetmap=$enableval],
180               [ac_cv_enable_openstreetmap=yes])
181 AC_CACHE_CHECK([whether to enable OpenStreetMap stuff],
182                [ac_cv_enable_openstreetmap], [ac_cv_enable_openstreetmap=yes])
183 case $ac_cv_enable_openstreetmap in
184   yes)
185     AC_DEFINE(VIK_CONFIG_OPENSTREETMAP, [], [OPENSTREETMAP STUFF])
186     ;;
187 esac
188 AM_CONDITIONAL([OPENSTREETMAP], [test x$ac_cv_enable_openstreetmap = xyes])
189
190 # BlueMarble
191 AC_ARG_ENABLE(bluemarble, AC_HELP_STRING([--enable-bluemarble],
192               [enable BlueMarble stuff (default is enable)]),
193               [ac_cv_enable_bluemarble=$enableval],
194               [ac_cv_enable_bluemarble=yes])
195 AC_CACHE_CHECK([whether to enable BlueMarble stuff],
196                [ac_cv_enable_bluemarble], [ac_cv_enable_bluemarble=yes])
197 case $ac_cv_enable_bluemarble in
198   yes)
199     AC_DEFINE(VIK_CONFIG_BLUEMARBLE, [], [BLUEMARBLE STUFF])
200     ;;
201 esac
202 AM_CONDITIONAL([BLUEMARBLE], [test x$ac_cv_enable_bluemarble = xyes])
203
204 # GeoNames http://www.geonames.org/
205 AC_ARG_ENABLE(geonames, AC_HELP_STRING([--enable-geonames],
206               [enable Geonames stuff (default is enable)]),
207               [ac_cv_enable_geonames=$enableval],
208               [ac_cv_enable_geonames=yes])
209 AC_CACHE_CHECK([whether to enable Geonames stuff],
210                [ac_cv_enable_geonames], [ac_cv_enable_geonames=yes])
211 case $ac_cv_enable_geonames in
212   yes)
213     AC_DEFINE(VIK_CONFIG_GEONAMES, [], [GEONAMES STUFF])
214     ;;
215 esac
216 AM_CONDITIONAL([GEONAMES], [test x$ac_cv_enable_geonames = xyes])
217
218 AC_ARG_ENABLE(geocaches, AC_HELP_STRING([--enable-geocaches],
219               [enable Geocaches Acquire (default is disable).]),
220               [ac_cv_enable_geocaches=$enableval],
221               [ac_cv_enable_geocaches=no])
222 AC_CACHE_CHECK([whether to enable Geocaches Acquire],
223                [ac_cv_enable_geocaches], [ac_cv_enable_geocaches=yes])
224 case $ac_cv_enable_geocaches in
225   yes)
226     AC_DEFINE(VIK_CONFIG_GEOCACHES, [], [GEOCACHES STUFF])
227     ;;
228 esac
229 AM_CONDITIONAL([GEOCACHES], [test x$ac_cv_enable_geocaches = xyes])
230
231 AC_ARG_ENABLE(geotag, AC_HELP_STRING([--enable-geotag],
232               [enable Geotag Support (default is enable).]),
233               [ac_cv_enable_geotag=$enableval],
234               [ac_cv_enable_geotag=yes])
235 AC_CACHE_CHECK([whether to enable Geotag Support],
236                [ac_cv_enable_geotag], [ac_cv_enable_geotag=yes])
237 case $ac_cv_enable_geotag in
238   yes)
239     AC_CHECK_LIB(exif,exif_loader_new,,AC_MSG_ERROR([libexif is needed for Geotag features[,] but is not found. The feature can be disabled with --disable-geotag]))
240     AC_DEFINE(VIK_CONFIG_GEOTAG, [], [GEOTAG STUFF])
241     ;;
242 esac
243 AM_CONDITIONAL([GEOTAG], [test x$ac_cv_enable_geotag = xyes])
244
245 AC_ARG_ENABLE(dem24k, AC_HELP_STRING([--enable-dem24k],
246               [enable USGS 24k DEM (default is disable) download source. Requires dem24k.pl script in path.]),
247               [ac_cv_enable_dem24k=$enableval],
248               [ac_cv_enable_dem24k=no])
249 AC_CACHE_CHECK([whether to enable USGS DEM 24k download source],
250                [ac_cv_enable_dem24k], [ac_cv_enable_dem24k=yes])
251 case $ac_cv_enable_dem24k in
252   yes)
253     AC_DEFINE(VIK_CONFIG_DEM24K, [], [DEM24K STUFF])
254     ;;
255 esac
256 AM_CONDITIONAL([DEM24K], [test x$ac_cv_enable_dem24k = xyes])
257
258 # Realtime GPS tracking
259 AC_ARG_ENABLE(realtime-gps-tracking, AC_HELP_STRING([--enable-realtime-gps-tracking],
260               [enable realtime GPS tracking (default is enable)]),
261               [ac_cv_enable_realtimegpstracking=$enableval],
262               [ac_cv_enable_realtimegpstracking=yes])
263 AC_CACHE_CHECK([whether to enable Realtime GPS Tracking stuff],
264                [ac_cv_enable_realtimegpstracking], [ac_cv_enable_realtimegpstracking=yes])
265 case $ac_cv_enable_realtimegpstracking in
266   yes)
267     AC_CHECK_LIB(gps,gps_close,,AC_MSG_ERROR([libgps is needed for Realtime GPS Tracking feature[,] but not found. The feature can be disable with --disable-realtime-gps-tracking]))
268     AC_DEFINE(VIK_CONFIG_REALTIME_GPS_TRACKING, [], [REALTIME GPS TRACKING STUFF])
269     ;;
270 esac
271 AM_CONDITIONAL([REALTIME_GPS_TRACKING], [test x$ac_cv_enable_realtimegpstracking = xyes])
272
273 # BZIP2
274 AC_ARG_ENABLE(bz2, AC_HELP_STRING([--enable-bzip2],
275               [enable bzip2 Support (default is enable).]),
276               [ac_cv_enable_bzip2=$enableval],
277               [ac_cv_enable_bzip2=yes])
278 AC_CACHE_CHECK([whether to enable bzip2 Support],
279                [ac_cv_enable_bzip2], [ac_cv_enable_bzip2=yes])
280 case $ac_cv_enable_bzip2 in
281   yes)
282     AC_CHECK_HEADERS([bzlib.h],[],[AC_MSG_ERROR([bzlib.h is needed but not found - you will need to install package 'libbz2-dev' or similar. The feature can be disabled with --disable-bzip2])])
283     AC_CHECK_LIB(bz2, BZ2_bzBuffToBuffDecompress, [], [AC_MSG_ERROR([libbz2 is needed but not found.])])
284     ;;
285 esac
286 AM_CONDITIONAL([BZIP2], [test x$ac_cv_enable_bzip2 = xyes])
287
288 # FILE MAGIC
289 AC_ARG_ENABLE(magic, AC_HELP_STRING([--enable-magic],
290               [enable File Magic support via libmagic (default is enable).]),
291               [ac_cv_enable_magic=$enableval],
292               [ac_cv_enable_magic=yes])
293 AC_CACHE_CHECK([whether to enable Magic Support],
294                [ac_cv_enable_magic], [ac_cv_enable_magic=yes])
295 case $ac_cv_enable_magic in
296   yes)
297     AC_CHECK_HEADERS([magic.h],[],[AC_MSG_ERROR([magic.h is needed but not found - you will need to install package 'libmagic-dev' or similar. The feature can be disabled with --disable-magic])])
298     AC_CHECK_LIB(magic, magic_open, [], [AC_MSG_ERROR([libmagic is needed but not found.])])
299     ;;
300 esac
301 AM_CONDITIONAL([MAGIC], [test x$ac_cv_enable_magic = xyes])
302
303 # SQL for MBTiles
304 AC_ARG_ENABLE(mbtiles, AC_HELP_STRING([--enable-mbtiles],
305               [enable MBTiles support via libsqlite3 (default is enable).]),
306               [ac_cv_enable_mbtiles=$enableval],
307               [ac_cv_enable_mbtiles=yes])
308 AC_CACHE_CHECK([whether to enable MBTiles Support],
309                [ac_cv_enable_mbtiles], [ac_cv_enable_mbtiles=yes])
310 case $ac_cv_enable_mbtiles in
311   yes)
312     AC_CHECK_HEADERS([sqlite3.h],[],[AC_MSG_ERROR([sqlite3.h is needed but not found - you will need to install package 'libsqlite3-dev' or similar. The feature can be disabled with --disable-mbtiles])])
313     AC_CHECK_LIB(sqlite3, sqlite3_open, [], [AC_MSG_ERROR([libsqlite3 is needed but not found.])])
314     ;;
315 esac
316 AM_CONDITIONAL([SQLITE], [test x$ac_cv_enable_mbtiles = xyes])
317
318 ###
319
320 AC_ARG_WITH(search,
321             [AC_HELP_STRING([--with-search],
322                             [specify google or geonames for searching (default is google)])],
323             [case "x$withval" in
324                "xgoogle")
325                  VIK_CONFIG_SEARCH=VIK_CONFIG_SEARCH_GOOGLE
326                  ;;
327                "xgeonames")
328                  VIK_CONFIG_SEARCH=VIK_CONFIG_SEARCH_GEONAMES
329                  ;;
330                *)
331                 AC_MSG_ERROR([Please, set a value for search method])
332              esac],
333              [VIK_CONFIG_SEARCH=VIK_CONFIG_SEARCH_GOOGLE])
334 AC_DEFINE_UNQUOTED(VIK_CONFIG_SEARCH_GOOGLE, 1,
335                    [Id. for searching via GOOGLE])
336 AC_DEFINE_UNQUOTED(VIK_CONFIG_SEARCH_GEONAMES, 2,
337                    [Id. for searching via GEONAMES])
338 AC_DEFINE_UNQUOTED(VIK_CONFIG_SEARCH, ${VIK_CONFIG_SEARCH},
339                    [Method for the search])
340
341
342 AC_ARG_WITH(mapcache,
343             [AC_HELP_STRING([--with-mapcache],
344                             [specify the size of the map cache in MB (default is 128)])],
345             [if test "x$withval" = "xno"; then
346                 VIK_CONFIG_MAPCACHE_SIZE=0;
347              elif test "x$withval" = "xyes"; then
348                 AC_MSG_ERROR([Please, set a value for size of the map cache in MB])
349              else
350                 VIK_CONFIG_MAPCACHE_SIZE=${withval}
351              fi],
352              [VIK_CONFIG_MAPCACHE_SIZE=128])
353 AC_DEFINE_UNQUOTED(VIK_CONFIG_MAPCACHE_SIZE, ${VIK_CONFIG_MAPCACHE_SIZE},
354                    [Size of the map cache])
355
356
357 AC_ARG_WITH(tileage,
358             [AC_HELP_STRING([--with-tileage],
359                             [specify the age of a tile before checking it (default is 7 days)])],
360             [if test "x$withval" = "xno"; then
361                 VIK_CONFIG_DEFAULT_TILE_AGE=0;
362              elif test "x$withval" = "xyes"; then
363                 AC_MSG_ERROR([Please, set a value for age of tiles])
364              else
365                 VIK_CONFIG_DEFAULT_TILE_AGE=${withval}
366              fi],
367              [VIK_CONFIG_DEFAULT_TILE_AGE=604800])
368 AC_DEFINE_UNQUOTED(VIK_CONFIG_DEFAULT_TILE_AGE, ${VIK_CONFIG_DEFAULT_TILE_AGE},
369                    [Age of tiles before checking it (in seconds)])
370 AC_DEFINE(HAVE_VIKING, 1, [Enable Viking specifics in otherwise reusable code])
371
372 dnl man pages processing
373 DB2MAN_XSL=/usr/share/sgml/docbook/stylesheet/xsl/nwalsh/manpages/docbook.xsl
374 AC_SUBST(DB2MAN_XSL)
375 AC_PATH_PROG(XP,xsltproc)
376 AM_CONDITIONAL([HAVE_XSLTPROC],[test "x$XP" != "x"])
377 AM_CONDITIONAL([GEN_MANPAGES],[test "x$XP" != "x" && test -r "$DB2MAN_XSL"])
378
379 dnl This will cause the automake generated makefiles to pass the
380 dnl correct flags to aclocal.
381 ACLOCAL_AMFLAGS="\${ACLOCAL_FLAGS}"
382 AC_SUBST(ACLOCAL_AMFLAGS)
383
384 AM_CONDITIONAL([VIKING_DOC], test x${enable_gtk_doc} = xyes)
385
386 # Configuration
387 AC_CONFIG_FILES([
388                 Makefile
389                 src/Makefile
390                 src/icons/Makefile
391                 po/Makefile.in
392                 data/Makefile
393                 tools/Makefile
394                 test/Makefile
395                 help/Makefile
396                 win32/Makefile
397                 win32/installer/Makefile
398                 win32/installer/pixmaps/Makefile
399                 win32/installer/translations/Makefile])
400 AM_COND_IF([VIKING_DOC],
401         [AC_CONFIG_FILES([
402                 doc/Makefile
403                 doc/reference/Makefile
404                 doc/examples/Makefile])])
405
406 AC_OUTPUT([
407            viking.spec
408            ])
409
410 dnl Output the configuration summary
411 echo ""
412 echo "==========================================="
413 echo "$PACKAGE $VERSION"
414 echo "-------------------------------------------"
415 echo "Bing Maps                        : $ac_cv_enable_bing"
416 echo "Google                           : $ac_cv_enable_google"
417 echo "Terraserver Maps                 : $ac_cv_enable_terraserver"
418 echo "Expedia Maps                     : $ac_cv_enable_expedia"
419 echo "Open Street Map                  : $ac_cv_enable_openstreetmap"
420 echo "BlueMarble                       : $ac_cv_enable_bluemarble"
421 echo "Geonames                         : $ac_cv_enable_geonames"
422 echo "Geocaches Acquire                : $ac_cv_enable_geocaches"
423 echo "Geotag Support                   : $ac_cv_enable_geotag"
424 echo "USGS 24k DEM                     : $ac_cv_enable_dem24k"
425 echo "Realtime GPS Tracking            : $ac_cv_enable_realtimegpstracking"
426 echo "bzip2 Support                    : $ac_cv_enable_bzip2"
427 echo "File Magic Support               : $ac_cv_enable_magic"
428 echo "MBTiles Support (SQLite3)        : $ac_cv_enable_mbtiles"
429 echo "Size of map cache (in memory)    : ${VIK_CONFIG_MAPCACHE_SIZE}"
430 echo "Age of tiles (in seconds)        : ${VIK_CONFIG_DEFAULT_TILE_AGE}"
431 echo "Documentation (+HTML)            : ${enable_gtk_doc} (HTML: ${enable_gtk_doc_html})"
432 echo "-------------------------------------------"
433 echo ""
434 echo "Configure finished, type 'make' to build."
435