2 # Process this file with autoconf to produce a configure script.
5 AC_INIT(viking, 1.6, , 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])
13 # Checks for programs.
16 AC_PATH_PROG(GLIB_MKENUMS, glib-mkenums)
19 GETTEXT_PACKAGE=viking
20 AC_SUBST(GETTEXT_PACKAGE)
21 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE",[Gettext package name])
23 AM_GLIB_DEFINE_LOCALEDIR(LOCALEDIR)
25 AM_GNU_GETTEXT_VERSION([0.17])
26 AM_GNU_GETTEXT([external])
28 IT_PROG_INTLTOOL([0.35.0])
30 AC_SUBST([CONFIG_STATUS_DEPENDENCIES],['$(top_srcdir)/po/LINGUAS'])
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)
37 # Checks for header files.
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])
41 # Checks for typedefs, structures, and compiler characteristics.
45 # Checks for library functions or symbols
48 AC_CHECK_FUNCS([floor memset mkdtemp pow realpath sqrt strcasecmp strchr strncasecmp strtol strtoul])
50 AC_CHECK_LIB(z, inflate)
51 AC_CHECK_LIB(X11, XSetErrorHandler)
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])
71 LIBCURL_CHECK_CONFIG([yes],[],[],[AC_MSG_ERROR([libcurl is needed but not found])])
74 AC_CHECK_PROG([GDK_PIXBUF_CSOURCE],gdk-pixbuf-csource,[yes])
75 if test "x$GDK_PIXBUF_CSOURCE" != "xyes"
77 AC_MSG_ERROR([gdk-pixbuf-csource is needed but not found])
80 dnl ------------------
81 dnl | Pkgconfig checks |---------------------------------------
82 dnl ------------------
84 PKG_CHECK_MODULES(PACKAGE, [
91 AC_SUBST(PACKAGE_CFLAGS)
92 AC_SUBST(PACKAGE_LIBS)
95 dnl | User Manual |---------------------------------------
99 dnl ---------------------------------------------------------------------------
100 dnl - Use deprecated options (default enabled for devs, disabled in releases)
101 dnl ---------------------------------------------------------------------------
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])
111 if test "x$ac_cv_enable_deprecations" = "xyes"; then
112 DISABLE_DEPRECATED_CFLAGS="\
113 -DG_DISABLE_SINGLE_INCLUDES \
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"
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
132 AC_DEFINE(VIK_CONFIG_BING, [], [BING STUFF])
135 AM_CONDITIONAL([BING], [test x$ac_cv_enable_bing = xyes])
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
145 AC_DEFINE(VIK_CONFIG_GOOGLE, [], [GOOGLE STUFF])
148 AM_CONDITIONAL([GOOGLE], [test x$ac_cv_enable_google = xyes])
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
158 AC_DEFINE(VIK_CONFIG_TERRASERVER, [], [TERRASERVER STUFF])
161 AM_CONDITIONAL([TERRASERVER], [test x$ac_cv_enable_terraserver = xyes])
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
171 AC_DEFINE(VIK_CONFIG_EXPEDIA, [], [EXPEDIA STUFF])
174 AM_CONDITIONAL([EXPEDIA], [test x$ac_cv_enable_expedia = xyes])
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
185 AC_DEFINE(VIK_CONFIG_OPENSTREETMAP, [], [OPENSTREETMAP STUFF])
188 AM_CONDITIONAL([OPENSTREETMAP], [test x$ac_cv_enable_openstreetmap = xyes])
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
199 AC_DEFINE(VIK_CONFIG_BLUEMARBLE, [], [BLUEMARBLE STUFF])
202 AM_CONDITIONAL([BLUEMARBLE], [test x$ac_cv_enable_bluemarble = xyes])
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
213 AC_DEFINE(VIK_CONFIG_GEONAMES, [], [GEONAMES STUFF])
216 AM_CONDITIONAL([GEONAMES], [test x$ac_cv_enable_geonames = xyes])
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
226 AC_DEFINE(VIK_CONFIG_GEOCACHES, [], [GEOCACHES STUFF])
229 AM_CONDITIONAL([GEOCACHES], [test x$ac_cv_enable_geocaches = xyes])
232 AC_ARG_WITH(libexif, AC_HELP_STRING([--with-libexif], [Force usage of libexif instead of libgexiv2]))
233 AC_ARG_ENABLE(geotag, AC_HELP_STRING([--enable-geotag],
234 [enable Geotag Support (default is enable).]),
235 [ac_cv_enable_geotag=$enableval],
236 [ac_cv_enable_geotag=yes])
237 AC_CACHE_CHECK([whether to enable Geotag Support],
238 [ac_cv_enable_geotag], [ac_cv_enable_geotag=yes])
239 case $ac_cv_enable_geotag in
241 AS_IF([test x$with_libexif = xyes],
242 AC_CHECK_HEADER([libexif/exif-data.h],[],AC_MSG_ERROR([exif-data.h is needed but not found - you will need to install package 'libexif-dev' or similar]))
243 AC_CHECK_LIB(exif,exif_loader_new,, AC_MSG_ERROR([libexif is not found but it has been forcibly required])),
244 # gexiv2.h relies on glib so a simple compile check fails.
245 #AC_CHECK_HEADER([gexiv2/gexiv2.h],,AC_MSG_ERROR([Error msg...]))
246 AC_CHECK_LIB(gexiv2,gexiv2_metadata_new,, AC_MSG_ERROR([libgexiv2 is needed but not found - you will need to install package 'libgexiv2-dev' or similar. The feature can be disabled with --disable-geotag]))
248 AC_DEFINE(VIK_CONFIG_GEOTAG, [], [GEOTAG STUFF])
251 AM_CONDITIONAL([GEOTAG], [test x$ac_cv_enable_geotag = xyes])
252 AM_CONDITIONAL([GEXIV2], [test x$ac_cv_lib_gexiv2_gexiv2_metadata_new = xyes] )
253 # Tested with gexiv2 0.10.2, but probably would work with older versions; may be all of them...
254 #AM_COND_IF([GEXIV2], [PKG_CHECK_MODULES([GEXIV2], [gexiv2 >= 0.6.1])])
255 AM_CONDITIONAL([LIBEXIF], [test x$ac_cv_lib_exif_exif_loader_new = xyes] )
257 AC_ARG_ENABLE(dem24k, AC_HELP_STRING([--enable-dem24k],
258 [enable USGS 24k DEM (default is disable) download source. Requires dem24k.pl script in path.]),
259 [ac_cv_enable_dem24k=$enableval],
260 [ac_cv_enable_dem24k=no])
261 AC_CACHE_CHECK([whether to enable USGS DEM 24k download source],
262 [ac_cv_enable_dem24k], [ac_cv_enable_dem24k=yes])
263 case $ac_cv_enable_dem24k in
265 AC_DEFINE(VIK_CONFIG_DEM24K, [], [DEM24K STUFF])
268 AM_CONDITIONAL([DEM24K], [test x$ac_cv_enable_dem24k = xyes])
270 # Realtime GPS tracking
271 AC_ARG_ENABLE(realtime-gps-tracking, AC_HELP_STRING([--enable-realtime-gps-tracking],
272 [enable realtime GPS tracking (default is enable)]),
273 [ac_cv_enable_realtimegpstracking=$enableval],
274 [ac_cv_enable_realtimegpstracking=yes])
275 AC_CACHE_CHECK([whether to enable Realtime GPS Tracking stuff],
276 [ac_cv_enable_realtimegpstracking], [ac_cv_enable_realtimegpstracking=yes])
277 case $ac_cv_enable_realtimegpstracking in
279 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]))
280 AC_DEFINE(VIK_CONFIG_REALTIME_GPS_TRACKING, [], [REALTIME GPS TRACKING STUFF])
283 AM_CONDITIONAL([REALTIME_GPS_TRACKING], [test x$ac_cv_enable_realtimegpstracking = xyes])
286 AC_ARG_ENABLE(bz2, AC_HELP_STRING([--enable-bzip2],
287 [enable bzip2 Support (default is enable).]),
288 [ac_cv_enable_bzip2=$enableval],
289 [ac_cv_enable_bzip2=yes])
290 AC_CACHE_CHECK([whether to enable bzip2 Support],
291 [ac_cv_enable_bzip2], [ac_cv_enable_bzip2=yes])
292 case $ac_cv_enable_bzip2 in
294 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])])
295 AC_CHECK_LIB(bz2, BZ2_bzBuffToBuffDecompress, [], [AC_MSG_ERROR([libbz2 is needed but not found.])])
298 AM_CONDITIONAL([BZIP2], [test x$ac_cv_enable_bzip2 = xyes])
301 AC_ARG_ENABLE(magic, AC_HELP_STRING([--enable-magic],
302 [enable File Magic support via libmagic (default is enable).]),
303 [ac_cv_enable_magic=$enableval],
304 [ac_cv_enable_magic=yes])
305 AC_CACHE_CHECK([whether to enable Magic Support],
306 [ac_cv_enable_magic], [ac_cv_enable_magic=yes])
307 case $ac_cv_enable_magic in
309 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])])
310 AC_CHECK_LIB(magic, magic_open, [], [AC_MSG_ERROR([libmagic is needed but not found.])])
313 AM_CONDITIONAL([MAGIC], [test x$ac_cv_enable_magic = xyes])
316 AC_ARG_ENABLE(mbtiles, AC_HELP_STRING([--enable-mbtiles],
317 [enable MBTiles support via libsqlite3 (default is enable).]),
318 [ac_cv_enable_mbtiles=$enableval],
319 [ac_cv_enable_mbtiles=yes])
320 AC_CACHE_CHECK([whether to enable MBTiles Support],
321 [ac_cv_enable_mbtiles], [ac_cv_enable_mbtiles=yes])
322 case $ac_cv_enable_mbtiles in
324 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])])
325 AC_CHECK_LIB(sqlite3, sqlite3_open, [], [AC_MSG_ERROR([libsqlite3 is needed but not found.])])
328 AM_CONDITIONAL([SQLITE], [test x$ac_cv_enable_mbtiles = xyes])
330 # Mapnik rendering layer
331 AC_ARG_ENABLE(mapnik, AC_HELP_STRING([--enable-mapnik],
332 [enable Mapnik (default is enable)]),
333 [ac_cv_enable_mapnik=$enableval],
334 [ac_cv_enable_mapnik=yes])
335 AC_CACHE_CHECK([whether to enable Mapnik],
336 [ac_cv_enable_mapnik], [ac_cv_enable_mapnik=yes])
337 case $ac_cv_enable_mapnik in
343 # Mapnik3 requires C++11. Viking will use C++11 as well.
344 CXXFLAGS="$CXXFLAGS -std=c++11"
345 # Too difficult to get check working under Windows (extra dependencies needed probably Boost)- so just skip it
346 if test "x$ac_cv_enable_windows" = "xno"; then
347 AC_CHECK_HEADER([mapnik/map.hpp],[],[AC_MSG_ERROR([mapnik/map.hpp is needed but not found - you will need to install package 'libmapnik-dev' or similar. The feature can be disabled with --disable-mapnik])])
349 AC_CHECK_LIB([mapnik], [main], [], [AC_MSG_ERROR([libmapnik is needed but not found.])])
350 AC_CHECK_LIB([stdc++], [main], [], [AC_MSG_ERROR([libstdc++ is needed but not found.])])
351 # Required for Mapnik3 build (it's also in Mapnik2 but does not need to be specified for some reason)
352 # it's part of libmapnik install dependencies
353 AC_CHECK_LIB([icuuc], [main], [], [AC_MSG_ERROR([libicuuc is needed but not found.])])
357 AM_CONDITIONAL([MAPNIK], [test x$ac_cv_enable_mapnik = xyes])
360 ## WORK AROUND BROKEN autoconf - see http://lists.gnu.org/archive/html/bug-automake/2002-11/msg00020.html
361 m4_pushdef([AC_MSG_ERROR])
363 m4_popdef([AC_MSG_ERROR])
367 [AC_HELP_STRING([--with-search],
368 [specify google or geonames for searching (default is google)])],
371 VIK_CONFIG_SEARCH=VIK_CONFIG_SEARCH_GOOGLE
374 VIK_CONFIG_SEARCH=VIK_CONFIG_SEARCH_GEONAMES
377 AC_MSG_ERROR([Please, set a value for search method])
379 [VIK_CONFIG_SEARCH=VIK_CONFIG_SEARCH_GOOGLE])
380 AC_DEFINE_UNQUOTED(VIK_CONFIG_SEARCH_GOOGLE, 1,
381 [Id. for searching via GOOGLE])
382 AC_DEFINE_UNQUOTED(VIK_CONFIG_SEARCH_GEONAMES, 2,
383 [Id. for searching via GEONAMES])
384 AC_DEFINE_UNQUOTED(VIK_CONFIG_SEARCH, ${VIK_CONFIG_SEARCH},
385 [Method for the search])
388 AC_ARG_WITH(mapcache,
389 [AC_HELP_STRING([--with-mapcache],
390 [specify the size of the map cache in MB (default is 128)])],
391 [if test "x$withval" = "xno"; then
392 VIK_CONFIG_MAPCACHE_SIZE=0;
393 elif test "x$withval" = "xyes"; then
394 AC_MSG_ERROR([Please, set a value for size of the map cache in MB])
396 VIK_CONFIG_MAPCACHE_SIZE=${withval}
398 [VIK_CONFIG_MAPCACHE_SIZE=128])
399 AC_DEFINE_UNQUOTED(VIK_CONFIG_MAPCACHE_SIZE, ${VIK_CONFIG_MAPCACHE_SIZE},
400 [Size of the map cache])
404 [AC_HELP_STRING([--with-tileage],
405 [specify the age of a tile before checking it (default is 7 days)])],
406 [if test "x$withval" = "xno"; then
407 VIK_CONFIG_DEFAULT_TILE_AGE=0;
408 elif test "x$withval" = "xyes"; then
409 AC_MSG_ERROR([Please, set a value for age of tiles])
411 VIK_CONFIG_DEFAULT_TILE_AGE=${withval}
413 [VIK_CONFIG_DEFAULT_TILE_AGE=604800])
414 AC_DEFINE_UNQUOTED(VIK_CONFIG_DEFAULT_TILE_AGE, ${VIK_CONFIG_DEFAULT_TILE_AGE},
415 [Age of tiles before checking it (in seconds)])
416 AC_DEFINE(HAVE_VIKING, 1, [Enable Viking specifics in otherwise reusable code])
418 dnl man pages processing
419 DB2MAN_XSL=/usr/share/sgml/docbook/stylesheet/xsl/nwalsh/manpages/docbook.xsl
421 AC_PATH_PROG(XP,xsltproc)
422 AM_CONDITIONAL([HAVE_XSLTPROC],[test "x$XP" != "x"])
423 AM_CONDITIONAL([GEN_MANPAGES],[test "x$XP" != "x" && test -r "$DB2MAN_XSL"])
425 dnl This will cause the automake generated makefiles to pass the
426 dnl correct flags to aclocal.
427 ACLOCAL_AMFLAGS="\${ACLOCAL_FLAGS}"
428 AC_SUBST(ACLOCAL_AMFLAGS)
430 AM_CONDITIONAL([VIKING_DOC], test x${enable_gtk_doc} = xyes)
443 win32/installer/Makefile
444 win32/installer/pixmaps/Makefile
445 win32/installer/translations/Makefile])
446 AM_COND_IF([VIKING_DOC],
449 doc/reference/Makefile
450 doc/examples/Makefile])])
456 dnl Output the configuration summary
458 echo "==========================================="
459 echo "$PACKAGE $PACKAGE_URL $VERSION"
460 echo "-------------------------------------------"
461 echo "Bing Maps : $ac_cv_enable_bing"
462 echo "Google : $ac_cv_enable_google"
463 echo "Terraserver Maps : $ac_cv_enable_terraserver"
464 echo "Expedia Maps : $ac_cv_enable_expedia"
465 echo "Open Street Map : $ac_cv_enable_openstreetmap"
466 echo "BlueMarble : $ac_cv_enable_bluemarble"
467 echo "Geonames : $ac_cv_enable_geonames"
468 echo "Geocaches Acquire : $ac_cv_enable_geocaches"
469 echo "Geotag Support : $ac_cv_enable_geotag (libgexiv2=$ac_cv_lib_gexiv2_gexiv2_metadata_new libexif=$ac_cv_lib_exif_exif_loader_new)"
470 echo "USGS 24k DEM : $ac_cv_enable_dem24k"
471 echo "Realtime GPS Tracking : $ac_cv_enable_realtimegpstracking"
472 echo "bzip2 Support : $ac_cv_enable_bzip2"
473 echo "File Magic Support : $ac_cv_enable_magic"
474 echo "MBTiles Support (SQLite3) : $ac_cv_enable_mbtiles"
475 echo "Mapnik Rendering Support (C++) : $ac_cv_enable_mapnik"
476 echo "Size of map cache (in memory) : ${VIK_CONFIG_MAPCACHE_SIZE}"
477 echo "Age of tiles (in seconds) : ${VIK_CONFIG_DEFAULT_TILE_AGE}"
478 echo "Documentation (+HTML) : ${enable_gtk_doc} (HTML: ${enable_gtk_doc_html})"
479 echo "-------------------------------------------"
481 echo "Configure finished, type 'make' to build."