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