Add missing trailing dot in sentences
[viking/guyou.git] / configure.ac
blob370ba78eab7b5188d436d7989cba54eb7eeed931
1 #                                               -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
4 AC_PREREQ(2.64)
5 AC_INIT(viking, 1.6.1, , viking, http://viking.sf.net/)
7 AC_CANONICAL_HOST
8 AC_CANONICAL_TARGET
10 AM_INIT_AUTOMAKE([dist-bzip2 dist-zip subdir-objects])
11 dnl AC_CONFIG_SRCDIR([src/main.c])
12 AC_CONFIG_HEADERS([src/config.h])
14 # check for gtk-doc
15 m4_ifdef([GTK_DOC_CHECK], [
16 GTK_DOC_CHECK([1.0],[--flavour no-tmpl])
17 ],[
18 AM_CONDITIONAL([ENABLE_GTK_DOC], false)
21 AC_PROG_CC
22 AC_PROG_CC_STDC
23 # Checks for programs.
24 AC_PROG_MAKE_SET
25 AC_PROG_RANLIB
26 AC_PATH_PROG(GLIB_MKENUMS, glib-mkenums)
28 ac_mingw32=no
29 case $target_os in
30   *mingw32*)
31     ac_mingw32=yes
32   ;;
33   *)
34   ;;
35 esac
37 # I18N
38 GETTEXT_PACKAGE=viking
39 AC_SUBST(GETTEXT_PACKAGE)
40 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE",[Gettext package name])
42 AM_GLIB_DEFINE_LOCALEDIR(LOCALEDIR)
44 AM_GNU_GETTEXT_VERSION([0.17])
45 AM_GNU_GETTEXT([external])
47 IT_PROG_INTLTOOL([0.35.0])
49 AC_SUBST([CONFIG_STATUS_DEPENDENCIES],['$(top_srcdir)/po/LINGUAS'])
51 dnl This will cause the automake generated makefiles to pass the
52 dnl correct flags to aclocal.
53 ACLOCAL_AMFLAGS="\${ACLOCAL_FLAGS}"
54 AC_SUBST(ACLOCAL_AMFLAGS)
56 # Checks for header files.
57 AC_HEADER_STDC
58 AC_CHECK_HEADERS([malloc.h stdlib.h string.h sys/param.h sys/types.h unistd.h math.h utime.h X11/Xlib.h])
60 # Checks for typedefs, structures, and compiler characteristics.
61 AC_C_CONST
62 AC_TYPE_MODE_T
64 # Checks for library functions or symbols
65 AC_CHECK_FUNCS([floor memset mkdtemp pow realpath sqrt strcasecmp strchr strncasecmp strtol strtoul])
66 AC_CHECK_LIB(m, tan)
67 AC_CHECK_LIB(z, inflate)
68 AC_CHECK_LIB(X11, XSetErrorHandler)
70 # ATM not running automake under Windows
71 #AC_CHECK_PROG(USE_WINDOWS, cmd.exe, yes, no)
72 #AM_CONDITIONAL([WINDOWS], [test x$USE_WINDOWS = xyes])
73 # So pass in as an option instead
74 # This is only to perform slightly different build steps
75 #  (the code uses standard WINDOWS defines for any specific different behaviour)
76 AC_ARG_ENABLE(windows, AC_HELP_STRING([--enable-windows],
77               [Perform specific Windows build steps (default is no)]),
78               [ac_cv_enable_windows=$enableval],
79               [ac_cv_enable_windows=no])
80 AC_CACHE_CHECK([whether to enable Windows build steps],
81                [ac_cv_enable_windows], [ac_cv_enable_windows=no])
82 AM_CONDITIONAL([WINDOWS], [test x$ac_cv_enable_windows = xyes])
84 # Expat
85 AM_WITH_EXPAT
87 # Curl
88 LIBCURL_CHECK_CONFIG([yes],[],[],[AC_MSG_ERROR([libcurl is needed but not found])])
90 # gdk-pixbuf-csource
91 AC_CHECK_PROG([GDK_PIXBUF_CSOURCE],gdk-pixbuf-csource,[yes])
92 if test "x$GDK_PIXBUF_CSOURCE" != "xyes"
93 then
94   AC_MSG_ERROR([gdk-pixbuf-csource is needed but not found])
97 dnl  ------------------
98 dnl | Pkgconfig checks |---------------------------------------
99 dnl  ------------------
101 PKG_CHECK_MODULES(PACKAGE, [
102         glib-2.0          >= 2.26
103         gthread-2.0       >= 2.2
104         gtk+-2.0          >= 2.16
105         gio-2.0           >= 2.12
108 AC_SUBST(PACKAGE_CFLAGS)
109 AC_SUBST(PACKAGE_LIBS)
111 dnl  -------------
112 dnl | User Manual |---------------------------------------
113 dnl  -------------
114 GNOME_DOC_INIT
116 dnl ---------------------------------------------------------------------------
117 dnl - Use deprecated options (default enabled for devs, disabled in releases) 
118 dnl ---------------------------------------------------------------------------
120 AC_ARG_ENABLE(deprecations,
121               [AC_HELP_STRING([--enable-deprecations],
122                               [warn about deprecated usages [default=no]])],
123                               [ac_cv_enable_deprecations=$enableval],
124                               [ac_cv_enable_deprecations=no])
125 AC_CACHE_CHECK([whether to enable deprecated features],
126                [ac_cv_enable_deprecations], [ac_cv_enable_deprecations=no])
128 if test "x$ac_cv_enable_deprecations" = "xyes"; then
129    DISABLE_DEPRECATED_CFLAGS="\
130 -DG_DISABLE_SINGLE_INCLUDES \
131 -DGSEAL_ENABLE \
132 -DG_DISABLE_DEPRECATED \
133 -DGDK_DISABLE_DEPRECATED \
134 -DGDK_PIXBUF_DISABLE_DEPRECATED \
135 -DGTK_DISABLE_SINGLE_INCLUDES \
136 -DGTK_DISABLE_DEPRECATED"
137    CPPFLAGS="$CPPFLAGS $DISABLE_DEPRECATED_CFLAGS"
140 # Options
141 AC_ARG_ENABLE(bing, AC_HELP_STRING([--enable-bing],
142               [enable Bing stuff (default is enable)]),
143               [ac_cv_enable_bing=$enableval],
144               [ac_cv_enable_bing=yes])
145 AC_CACHE_CHECK([whether to enable Bing stuff],
146                [ac_cv_enable_bing], [ac_cv_enable_bing=yes])
147 case $ac_cv_enable_bing in
148   yes)
149     AC_DEFINE(VIK_CONFIG_BING, [], [BING STUFF])
150     ;;
151 esac
152 AM_CONDITIONAL([BING], [test x$ac_cv_enable_bing = xyes])
154 AC_ARG_ENABLE(google, AC_HELP_STRING([--enable-google],
155               [enable Google stuff (default is enable)]),
156               [ac_cv_enable_google=$enableval],
157               [ac_cv_enable_google=yes])
158 AC_CACHE_CHECK([whether to enable Google stuff],
159                [ac_cv_enable_google], [ac_cv_enable_google=yes])
160 case $ac_cv_enable_google in
161   yes)
162     AC_DEFINE(VIK_CONFIG_GOOGLE, [], [GOOGLE STUFF])
163     ;;
164 esac
165 AM_CONDITIONAL([GOOGLE], [test x$ac_cv_enable_google = xyes])
167 AC_ARG_ENABLE(terraserver, AC_HELP_STRING([--enable-terraserver],
168               [enable Terraserver stuff (default is disabled as the tileserver is no longer available)]),
169               [ac_cv_enable_terraserver=$enableval],
170               [ac_cv_enable_terraserver=no])
171 AC_CACHE_CHECK([whether to enable Terraserver stuff],
172                [ac_cv_enable_terraserver], [ac_cv_enable_terraserver=yes])
173 case $ac_cv_enable_terraserver in
174   yes)
175     AC_DEFINE(VIK_CONFIG_TERRASERVER, [], [TERRASERVER STUFF])
176     ;;
177 esac
178 AM_CONDITIONAL([TERRASERVER], [test x$ac_cv_enable_terraserver = xyes])
180 AC_ARG_ENABLE(expedia, AC_HELP_STRING([--enable-expedia],
181               [enable Expedia stuff (default is disable)]),
182               [ac_cv_enable_expedia=$enableval],
183               [ac_cv_enable_expedia=no])
184 AC_CACHE_CHECK([whether to enable Expedia stuff],
185                [ac_cv_enable_expedia], [ac_cv_enable_expedia=yes])
186 case $ac_cv_enable_expedia in
187   yes)
188     AC_DEFINE(VIK_CONFIG_EXPEDIA, [], [EXPEDIA STUFF])
189     ;;
190 esac
191 AM_CONDITIONAL([EXPEDIA], [test x$ac_cv_enable_expedia = xyes])
193 # OpenStreetMap http://www.openstreetmap.org/
194 AC_ARG_ENABLE(openstreetmap, AC_HELP_STRING([--enable-openstreetmap],
195               [enable OpenStreetMap stuff (default is enable)]),
196               [ac_cv_enable_openstreetmap=$enableval],
197               [ac_cv_enable_openstreetmap=yes])
198 AC_CACHE_CHECK([whether to enable OpenStreetMap stuff],
199                [ac_cv_enable_openstreetmap], [ac_cv_enable_openstreetmap=yes])
200 case $ac_cv_enable_openstreetmap in
201   yes)
202     AC_DEFINE(VIK_CONFIG_OPENSTREETMAP, [], [OPENSTREETMAP STUFF])
203     ;;
204 esac
205 AM_CONDITIONAL([OPENSTREETMAP], [test x$ac_cv_enable_openstreetmap = xyes])
207 # BlueMarble
208 AC_ARG_ENABLE(bluemarble, AC_HELP_STRING([--enable-bluemarble],
209               [enable BlueMarble stuff (default is enable)]),
210               [ac_cv_enable_bluemarble=$enableval],
211               [ac_cv_enable_bluemarble=yes])
212 AC_CACHE_CHECK([whether to enable BlueMarble stuff],
213                [ac_cv_enable_bluemarble], [ac_cv_enable_bluemarble=yes])
214 case $ac_cv_enable_bluemarble in
215   yes)
216     AC_DEFINE(VIK_CONFIG_BLUEMARBLE, [], [BLUEMARBLE STUFF])
217     ;;
218 esac
219 AM_CONDITIONAL([BLUEMARBLE], [test x$ac_cv_enable_bluemarble = xyes])
221 # GeoNames http://www.geonames.org/
222 AC_ARG_ENABLE(geonames, AC_HELP_STRING([--enable-geonames],
223               [enable Geonames stuff (default is enable)]),
224               [ac_cv_enable_geonames=$enableval],
225               [ac_cv_enable_geonames=yes])
226 AC_CACHE_CHECK([whether to enable Geonames stuff],
227                [ac_cv_enable_geonames], [ac_cv_enable_geonames=yes])
228 case $ac_cv_enable_geonames in
229   yes)
230     AC_DEFINE(VIK_CONFIG_GEONAMES, [], [GEONAMES STUFF])
231     ;;
232 esac
233 AM_CONDITIONAL([GEONAMES], [test x$ac_cv_enable_geonames = xyes])
235 AC_ARG_ENABLE(geocaches, AC_HELP_STRING([--enable-geocaches],
236               [enable Geocaches Acquire (default is disable).]),
237               [ac_cv_enable_geocaches=$enableval],
238               [ac_cv_enable_geocaches=no])
239 AC_CACHE_CHECK([whether to enable Geocaches Acquire],
240                [ac_cv_enable_geocaches], [ac_cv_enable_geocaches=yes])
241 case $ac_cv_enable_geocaches in
242   yes)
243     AC_DEFINE(VIK_CONFIG_GEOCACHES, [], [GEOCACHES STUFF])
244     ;;
245 esac
246 AM_CONDITIONAL([GEOCACHES], [test x$ac_cv_enable_geocaches = xyes])
248 # GeoClue
249 AC_ARG_ENABLE(geoclue, AC_HELP_STRING([--enable-geoclue],
250               [enable GeoClue support (default is enable).]),
251               [ac_cv_enable_geoclue=$enableval],
252               [ac_cv_enable_geoclue=yes])
253 AC_CACHE_CHECK([whether to enable GeoClue Support],
254                [ac_cv_enable_geoclue], [ac_cv_enable_geoclue=yes])
255 case $ac_cv_enable_geoclue in
256   yes)
257     PKG_CHECK_MODULES( [LIBGEOCLUE], [libgeoclue-2.0 >= 2],
258                        AC_CHECK_LIB(geoclue-2, main,, AC_MSG_ERROR([libgeoclue is needed but not found - you will need to install package 'libgeoclue-2-dev' or similar ])) )
259     ;;
260 esac
261 AM_CONDITIONAL([GEOCLUE], [test x$ac_cv_enable_geoclue = xyes])
263 # Geotagging
264 AC_ARG_WITH(libexif, AC_HELP_STRING([--with-libexif], [Force usage of libexif instead of libgexiv2]))
265 AC_ARG_ENABLE(geotag, AC_HELP_STRING([--enable-geotag],
266               [enable Geotag Support (default is enable).]),
267               [ac_cv_enable_geotag=$enableval],
268               [ac_cv_enable_geotag=yes])
269 AC_CACHE_CHECK([whether to enable Geotag Support],
270                [ac_cv_enable_geotag], [ac_cv_enable_geotag=yes])
271 case $ac_cv_enable_geotag in
272   yes)
273     AS_IF([test x$with_libexif = xyes],
274       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]))
275       AC_CHECK_LIB(exif,exif_loader_new,, AC_MSG_ERROR([libexif is not found but it has been forcibly required])),
276       # gexiv2.h relies on glib so a simple compile check fails.
277       #AC_CHECK_HEADER([gexiv2/gexiv2.h],,AC_MSG_ERROR([Error msg...]))
278       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]))
279       )
280     AC_DEFINE(VIK_CONFIG_GEOTAG, [], [GEOTAG STUFF])
281     ;;
282 esac
283 AM_CONDITIONAL([GEOTAG], [test x$ac_cv_enable_geotag = xyes])
284 AM_CONDITIONAL([GEXIV2], [test x$ac_cv_lib_gexiv2_gexiv2_metadata_new = xyes] )
285 # Tested with gexiv2 0.10.2, but probably would work with older versions; may be all of them...
286 #AM_COND_IF([GEXIV2], [PKG_CHECK_MODULES([GEXIV2], [gexiv2 >= 0.6.1])])
287 AM_CONDITIONAL([LIBEXIF], [test x$ac_cv_lib_exif_exif_loader_new = xyes] )
289 AC_ARG_ENABLE(dem24k, AC_HELP_STRING([--enable-dem24k],
290               [enable USGS 24k DEM (default is disable) download source. Requires dem24k.pl script in path.]),
291               [ac_cv_enable_dem24k=$enableval],
292               [ac_cv_enable_dem24k=no])
293 AC_CACHE_CHECK([whether to enable USGS DEM 24k download source],
294                [ac_cv_enable_dem24k], [ac_cv_enable_dem24k=yes])
295 case $ac_cv_enable_dem24k in
296   yes)
297     AC_DEFINE(VIK_CONFIG_DEM24K, [], [DEM24K STUFF])
298     ;;
299 esac
300 AM_CONDITIONAL([DEM24K], [test x$ac_cv_enable_dem24k = xyes])
302 # OAuth
303 AC_ARG_ENABLE(oauth, AC_HELP_STRING([--enable-oauth],
304               [enable OAuth Support (default is enable).]),
305               [ac_cv_enable_oauth=$enableval],
306               [ac_cv_enable_oauth=yes])
307 AC_CACHE_CHECK([whether to enable OAuth Support],
308                [ac_cv_enable_oauth], [ac_cv_enable_oauth=yes])
309 case $ac_cv_enable_oauth in
310   yes)
311     AC_CHECK_HEADERS([oauth.h],[],[AC_MSG_ERROR([oauth.h is needed but not found - you will need to install package 'liboauth-dev' or similar. The feature can be disabled with --disable-oauth])])
312     AC_CHECK_LIB(oauth, oauth_sign_url2, [], [AC_MSG_ERROR([liboauth is needed but not found.])])
313     ;;
314 esac
315 AM_CONDITIONAL([OAUTH], [test x$ac_cv_enable_oauth = xyes])
317 # Realtime GPS tracking
318 AC_ARG_ENABLE(realtime-gps-tracking, AC_HELP_STRING([--enable-realtime-gps-tracking],
319               [enable realtime GPS tracking (default is enable)]),
320               [ac_cv_enable_realtimegpstracking=$enableval],
321               [ac_cv_enable_realtimegpstracking=yes])
322 AC_CACHE_CHECK([whether to enable Realtime GPS Tracking stuff],
323                [ac_cv_enable_realtimegpstracking], [ac_cv_enable_realtimegpstracking=yes])
324 case $ac_cv_enable_realtimegpstracking in
325   yes)
326     AC_CHECK_HEADERS([gps.h],[],[AC_MSG_ERROR([gps.h is needed but not found - you will need to install package 'libgps-dev' or similar. The feature can be disabled with --disable-realtime-gps-tracking])])
327     AC_CHECK_LIB(gps, gps_close, [],
328       if test "$ac_mingw32" = "yes"; then
329        [LIBS="-lgps $LIBS"
330         AC_MSG_WARN([libgps not found! Forcing it anyway!])]
331       else
332         AC_MSG_ERROR([libgps is needed but not found.])
333       fi)
334     AC_DEFINE(VIK_CONFIG_REALTIME_GPS_TRACKING, [], [REALTIME GPS TRACKING STUFF])
335     ;;
336 esac
337 AM_CONDITIONAL([REALTIME_GPS_TRACKING], [test x$ac_cv_enable_realtimegpstracking = xyes])
339 # BZIP2
340 AC_ARG_ENABLE(bzip2, AC_HELP_STRING([--enable-bzip2],
341               [enable bzip2 Support (default is enable).]),
342               [ac_cv_enable_bzip2=$enableval],
343               [ac_cv_enable_bzip2=yes])
344 AC_CACHE_CHECK([whether to enable bzip2 Support],
345                [ac_cv_enable_bzip2], [ac_cv_enable_bzip2=yes])
346 case $ac_cv_enable_bzip2 in
347   yes)
348     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])])
349     if test "$ac_mingw32" = "yes"; then
350       # Using the cross compiler it bizarrely fails to detect BZ2_bzRead during the configure stage
351       # I SWEAR THIS WORKED AT SOME POINT - BUT ON A DIFFERENT DAY IT DOESN'T = MORE SWEARING
352       BZ2FUNC=main
353       AC_CHECK_LIB(bz2, [$BZ2FUNC], [], [LIBS="-lbz2 $LIBS"
354                                          AC_MSG_WARN([libbz2 not found! Forcing it anyway!])])
355     else
356       BZ2FUNC=BZ2_bzRead
357       AC_CHECK_LIB(bz2, [$BZ2FUNC], [], [AC_MSG_ERROR([libbz2 is needed but not found.])])
358     fi
359     ;;
360 esac
361 AM_CONDITIONAL([BZIP2], [test x$ac_cv_enable_bzip2 = xyes])
363 # FILE MAGIC
364 AC_ARG_ENABLE(magic, AC_HELP_STRING([--enable-magic],
365               [enable File Magic support via libmagic (default is enable).]),
366               [ac_cv_enable_magic=$enableval],
367               [ac_cv_enable_magic=yes])
368 AC_CACHE_CHECK([whether to enable Magic Support],
369                [ac_cv_enable_magic], [ac_cv_enable_magic=yes])
370 case $ac_cv_enable_magic in
371   yes)
372     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])])
373     # Using the cross compiler it fails to find libmagic.dll during the configure stage
374     AC_CHECK_LIB(magic, magic_open, [],
375       if test "$ac_mingw32" = "yes"; then
376         [LIBS="-lmagic $LIBS"
377          AC_MSG_WARN([libmagic not found! Forcing it anyway!])]
378       else
379          AC_MSG_ERROR([libmagic is needed but not found.])
380       fi)
381     ;;
382 esac
383 AM_CONDITIONAL([MAGIC], [test x$ac_cv_enable_magic = xyes])
385 # SQL for MBTiles
386 AC_ARG_ENABLE(mbtiles, AC_HELP_STRING([--enable-mbtiles],
387               [enable MBTiles support via libsqlite3 (default is enable).]),
388               [ac_cv_enable_mbtiles=$enableval],
389               [ac_cv_enable_mbtiles=yes])
390 AC_CACHE_CHECK([whether to enable MBTiles Support],
391                [ac_cv_enable_mbtiles], [ac_cv_enable_mbtiles=yes])
392 case $ac_cv_enable_mbtiles in
393   yes)
394     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])])
395     AC_CHECK_LIB(sqlite3, sqlite3_open, [],
396       if test "$ac_mingw32" = "yes"; then
397         [LIBS="-lsqlite3 $LIBS"
398          AC_MSG_WARN([libsqlite3 not found! Forcing it anyway!])]
399       else
400          AC_MSG_ERROR([libsqlite3 is needed but not found.])
401       fi)
402     ;;
403 esac
404 AM_CONDITIONAL([SQLITE], [test x$ac_cv_enable_mbtiles = xyes])
406 # Standard compression is handled by libz
407 # libzip enables a friendlier file based interface
408 # libzip itself depends on libz (which is required in the Viking build ATM)
409 # ZIP
410 AC_ARG_ENABLE(zip, AC_HELP_STRING([--enable-zip],
411               [enable zip support (default is enable).]),
412               [ac_cv_enable_zip=$enableval],
413               [ac_cv_enable_zip=yes])
414 AC_CACHE_CHECK([whether to enable zip Support],
415                [ac_cv_enable_zip], [ac_cv_enable_zip=yes])
416 case $ac_cv_enable_zip in
417   yes)
418     # NB As far as I can tell libzip doesn't provide any versioning info within the header code itself
419     # Thus supporting old versions via simple #if #else #endif directives is seemingly not possible
420     # Resort to checking versioning only via pkgconfig
421     PKG_CHECK_MODULES([LIBZIP], [libzip >= 0.11],
422       [ AC_CHECK_HEADERS([zip.h],[],[AC_MSG_ERROR([zip.h is needed but not found - you will need to install package 'libzip-dev' or similar. The feature can be disabled with --disable-zip])])
423         AC_CHECK_LIB(zip, [main], [],
424           if test "$ac_mingw32" = "yes"; then
425             [LIBS="-lzip $LIBS"
426              AC_MSG_WARN([libzip not found! Forcing it anyway!])]
427           else
428              AC_MSG_ERROR([libzip is needed but not found.])
429           fi)],
430       [ AC_MSG_WARN([libzip version needs to be at least 0.11, use of libzip is disabled])
431         ac_cv_enable_zip=no ]
432   )
433     ;;
434 esac
435 AM_CONDITIONAL([ZIP], [test x$ac_cv_enable_zip = xyes])
437 # ATM only for MD5 Hashing which is currently only used for filename of image thumbnails
438 AC_ARG_ENABLE(nettle, AC_HELP_STRING([--enable-nettle],
439               [enable MD5 Hash support (default is enable)]),
440               [ac_cv_enable_nettle=$enableval],
441               [ac_cv_enable_nettle=yes])
442 AC_CACHE_CHECK([whether to enable MD5 Hash support],
443                [ac_cv_enable_nettle], [ac_cv_enable_nettle=yes])
444 case $ac_cv_enable_nettle in
445   yes)
446     AC_CHECK_HEADER([nettle/md5-compat.h],[],[AC_MSG_ERROR([nettle/md5-compat.h is needed but not found - you will need to install package 'nettle-dev' or similar. The feature can be disabled with --disable-nettle])])
447     AC_CHECK_LIB([nettle], [main], [],
448       if test "$ac_mingw32" = "yes"; then
449         [LIBS="-lnettle $LIBS"
450          AC_MSG_WARN([libnettle not found! Forcing it anyway!])]
451       else
452          AC_MSG_ERROR([libnettle is needed but not found.])
453       fi)
454     ;;
455 esac
456 AM_CONDITIONAL([MD5_HASH], [test x$ac_cv_enable_nettle = xyes])
458 # Mapnik rendering layer
459 AC_ARG_ENABLE(mapnik, AC_HELP_STRING([--enable-mapnik],
460               [enable Mapnik (default is enable)]),
461               [ac_cv_enable_mapnik=$enableval],
462               [ac_cv_enable_mapnik=yes])
463 AC_CACHE_CHECK([whether to enable Mapnik],
464                [ac_cv_enable_mapnik], [ac_cv_enable_mapnik=yes])
465 case $ac_cv_enable_mapnik in
466   yes)
467     # C++
468     AC_LANG_CPLUSPLUS
469     AC_LANG_SAVE
470     AC_PROG_CXX
471     # Mapnik3 requires C++11. Viking will use C++11 as well.
472     CXXFLAGS="$CXXFLAGS -std=c++11"
473     # Too difficult to get check working under Windows (extra dependencies needed probably Boost)- so just skip it
474     if test "x$ac_cv_enable_windows" = "xno"; then
475       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])])
476     fi
477     AC_CHECK_LIB([mapnik], [main], [], [AC_MSG_ERROR([libmapnik is needed but not found.])])
478     AC_CHECK_LIB([stdc++], [main], [], [AC_MSG_ERROR([libstdc++ is needed but not found.])])
479     # Required for Mapnik3 build (it's also in Mapnik2 but does not need to be specified for some reason)
480     #  it's part of libmapnik install dependencies
481     AC_CHECK_LIB([icuuc], [main], [], [AC_MSG_ERROR([libicuuc is needed but not found.])])
482     AC_LANG_RESTORE
483     ;;
484 esac
485 AM_CONDITIONAL([MAPNIK], [test x$ac_cv_enable_mapnik = xyes])
488 ## WORK AROUND BROKEN autoconf - see http://lists.gnu.org/archive/html/bug-automake/2002-11/msg00020.html
489 m4_pushdef([AC_MSG_ERROR])
490 AC_PROG_CXX
491 m4_popdef([AC_MSG_ERROR])
494 dnl Compile time defined access token
495 AC_ARG_WITH(mapbox_access_token,
496             [AC_HELP_STRING([--with-mapbox_access_token],
497              [Access token for MapBox tiles.
498               Please register your own if you're going to distribute the
499               package, as requests are limited per token.])],
500             [VIK_CONFIG_MAPBOX_TOKEN="\"${withval}\""],
501             [VIK_CONFIG_MAPBOX_TOKEN="\"pk.eyJ1Ijoicndub3JyaXMiLCJhIjoiY2lxc294anN2MDA5bWhzbWFseWsxMW1ydiJ9.HcybKtZsiG6RVuOHg481Kg\""])
502 AC_DEFINE_UNQUOTED(VIK_CONFIG_MAPBOX_TOKEN, ${VIK_CONFIG_MAPBOX_TOKEN}, [Mapbox Token])
505 dnl Compile time defined key
506 AC_ARG_WITH(thunderforest_apikey,
507             [AC_HELP_STRING([--with-thunderforest_apikey],
508              [API Key for Thunderforest (OSM Cyclemap) tiles.
509               Please register your own if you're going to distribute the
510               package, as requests are limited per key.])],
511             [VIK_CONFIG_THUNDERFOREST_KEY="\"${withval}\""],
512             [VIK_CONFIG_THUNDERFOREST_KEY="\"7387c111d85642b18f63608bd4cb8b4f\""])
513 AC_DEFINE_UNQUOTED(VIK_CONFIG_THUNDERFOREST_KEY, ${VIK_CONFIG_THUNDERFOREST_KEY}, [Thunderforest key])
515 AC_ARG_WITH(geonames_username,
516             [AC_HELP_STRING([--with-geonames_username],
517              [Username for the GeoNames webservice.
518               Please register your own if you're going to distribute the
519               package, as requests are limited per username.])],
520             [VIK_CONFIG_GEONAMES_USERNAME="\"${withval}\""],
521             [VIK_CONFIG_GEONAMES_USERNAME="\"$PACKAGE\""])
522 AC_DEFINE_UNQUOTED(VIK_CONFIG_GEONAMES_USERNAME, ${VIK_CONFIG_GEONAMES_USERNAME}, [geonames username])
525 AC_ARG_WITH(mapcache,
526             [AC_HELP_STRING([--with-mapcache],
527                             [specify the size of the map cache in MB (default is 128)])],
528             [if test "x$withval" = "xno"; then
529                 VIK_CONFIG_MAPCACHE_SIZE=0;
530              elif test "x$withval" = "xyes"; then
531                 AC_MSG_ERROR([Please, set a value for size of the map cache in MB])
532              else
533                 VIK_CONFIG_MAPCACHE_SIZE=${withval}
534              fi],
535              [VIK_CONFIG_MAPCACHE_SIZE=128])
536 AC_DEFINE_UNQUOTED(VIK_CONFIG_MAPCACHE_SIZE, ${VIK_CONFIG_MAPCACHE_SIZE},
537                    [Size of the map cache])
540 AC_ARG_WITH(tileage,
541             [AC_HELP_STRING([--with-tileage],
542                             [specify the age of a tile before checking it (default is 7 days)])],
543             [if test "x$withval" = "xno"; then
544                 VIK_CONFIG_DEFAULT_TILE_AGE=0;
545              elif test "x$withval" = "xyes"; then
546                 AC_MSG_ERROR([Please, set a value for age of tiles])
547              else
548                 VIK_CONFIG_DEFAULT_TILE_AGE=${withval}
549              fi],
550              [VIK_CONFIG_DEFAULT_TILE_AGE=604800])
551 AC_DEFINE_UNQUOTED(VIK_CONFIG_DEFAULT_TILE_AGE, ${VIK_CONFIG_DEFAULT_TILE_AGE},
552                    [Age of tiles before checking it (in seconds)])
553 AC_DEFINE(HAVE_VIKING, 1, [Enable Viking specifics in otherwise reusable code])
555 dnl man pages processing
556 DB2MAN_XSL=/usr/share/sgml/docbook/stylesheet/xsl/nwalsh/manpages/docbook.xsl
557 AC_SUBST(DB2MAN_XSL)
558 AC_PATH_PROG(XP,xsltproc)
559 AM_CONDITIONAL([HAVE_XSLTPROC],[test "x$XP" != "x"])
560 AC_CHECK_PROG([HAVE_SCROLLKEEPER],scrollkeeper-config,"yes")
561 AM_CONDITIONAL([GEN_MANPAGES],[test "x$XP" != "x" && test -r "$DB2MAN_XSL"] && test "${HAVE_SCROLLKEEPER}" = "yes" )
562 AM_COND_IF([GEN_MANPAGES], [ac_cv_enable_man=yes], [ac_cv_enable_man=no])
564 ISODATE="$(date --utc --date="@${SOURCE_DATE_EPOCH:-$(date +%s)}" +%Y-%m-%d)"
565 AC_SUBST(ISODATE)
567 AC_DEFINE_UNQUOTED(THEYEAR, "$(date --utc --date="@${SOURCE_DATE_EPOCH:-$(date +%s)}" +%Y)", [The Year])
569 # Configuration
570 AC_CONFIG_FILES([
571                 viking.spec
572                 mingw-viking.spec
573                 mingw64-viking.spec
574                 Makefile
575                 src/Makefile
576                 src/icons/Makefile
577                 po/Makefile.in
578                 data/Makefile
579                 tools/Makefile
580                 test/Makefile
581                 help/Makefile
582                 help/viking.xml
583                 windows/Makefile
584                 windows/installer/Makefile
585                 windows/installer/pixmaps/Makefile
586                 windows/installer/translations/Makefile
587                 doc/Makefile
588                 doc/reference/Makefile
589                 doc/examples/Makefile])
591 AC_OUTPUT
593 dnl Output the configuration summary
594 AC_MSG_NOTICE(["
595 ===========================================
596 $PACKAGE $PACKAGE_URL $VERSION
597 -------------------------------------------
598 Bing Maps                        : $ac_cv_enable_bing
599 Google                           : $ac_cv_enable_google
600 Terraserver Maps                 : $ac_cv_enable_terraserver
601 Expedia Maps                     : $ac_cv_enable_expedia
602 Open Street Map                  : $ac_cv_enable_openstreetmap
603 BlueMarble                       : $ac_cv_enable_bluemarble
604 GeoClue Support                  : $ac_cv_enable_geoclue
605 Geonames                         : $ac_cv_enable_geonames
606 Geocaches Acquire                : $ac_cv_enable_geocaches
607 Geotag Support                   : $ac_cv_enable_geotag (libgexiv2=$ac_cv_lib_gexiv2_gexiv2_metadata_new libexif=$ac_cv_lib_exif_exif_loader_new)
608 USGS 24k DEM                     : $ac_cv_enable_dem24k
609 Realtime GPS Tracking            : $ac_cv_enable_realtimegpstracking
610 bzip2 Support                    : $ac_cv_enable_bzip2
611 File Magic Support               : $ac_cv_enable_magic
612 MBTiles Support (SQLite3)        : $ac_cv_enable_mbtiles
613 Zip File Support (with libzip)   : $ac_cv_enable_zip
614 MD5 Hash Support (with libnettle): $ac_cv_enable_nettle
615 Mapnik Rendering Support (C++)   : $ac_cv_enable_mapnik
616 OAuth                            : $ac_cv_enable_oauth
617 Size of map cache (in memory)    : ${VIK_CONFIG_MAPCACHE_SIZE}
618 Age of tiles (in seconds)        : ${VIK_CONFIG_DEFAULT_TILE_AGE}
619 GeoNames user                    : ${VIK_CONFIG_GEONAMES_USERNAME}
620 Man page generation              : $ac_cv_enable_man
621 Documentation (+HTML)            : ${enable_gtk_doc} (HTML: ${enable_gtk_doc_html})
622 -------------------------------------------
624 Configure finished, type 'make' to build.