+# BlueMarble
+AC_ARG_ENABLE(bluemarble, AC_HELP_STRING([--enable-bluemarble],
+ [enable BlueMarble stuff (default is enable)]),
+ [ac_cv_enable_bluemarble=$enableval],
+ [ac_cv_enable_bluemarble=yes])
+AC_CACHE_CHECK([whether to enable BlueMarble stuff],
+ [ac_cv_enable_bluemarble], [ac_cv_enable_bluemarble=yes])
+case $ac_cv_enable_bluemarble in
+ yes)
+ AC_DEFINE(VIK_CONFIG_BLUEMARBLE, [], [BLUEMARBLE STUFF])
+ ;;
+esac
+AM_CONDITIONAL([BLUEMARBLE], [test x$ac_cv_enable_bluemarble = xyes])
+
+# GeoNames http://www.geonames.org/
+AC_ARG_ENABLE(geonames, AC_HELP_STRING([--enable-geonames],
+ [enable Geonames stuff (default is enable)]),
+ [ac_cv_enable_geonames=$enableval],
+ [ac_cv_enable_geonames=yes])
+AC_CACHE_CHECK([whether to enable Geonames stuff],
+ [ac_cv_enable_geonames], [ac_cv_enable_geonames=yes])
+case $ac_cv_enable_geonames in
+ yes)
+ AC_DEFINE(VIK_CONFIG_GEONAMES, [], [GEONAMES STUFF])
+ ;;
+esac
+AM_CONDITIONAL([GEONAMES], [test x$ac_cv_enable_geonames = xyes])
+
+AC_ARG_ENABLE(geocaches, AC_HELP_STRING([--enable-geocaches],
+ [enable Geocaches Acquire (default is disable).]),
+ [ac_cv_enable_geocaches=$enableval],
+ [ac_cv_enable_geocaches=no])
+AC_CACHE_CHECK([whether to enable Geocaches Acquire],
+ [ac_cv_enable_geocaches], [ac_cv_enable_geocaches=yes])
+case $ac_cv_enable_geocaches in
+ yes)
+ AC_DEFINE(VIK_CONFIG_GEOCACHES, [], [GEOCACHES STUFF])
+ ;;
+esac
+AM_CONDITIONAL([GEOCACHES], [test x$ac_cv_enable_geocaches = xyes])
+
+AC_ARG_ENABLE(geotag, AC_HELP_STRING([--enable-geotag],
+ [enable Geotag Support (default is enable).]),
+ [ac_cv_enable_geotag=$enableval],
+ [ac_cv_enable_geotag=yes])
+AC_CACHE_CHECK([whether to enable Geotag Support],
+ [ac_cv_enable_geotag], [ac_cv_enable_geotag=yes])
+case $ac_cv_enable_geotag in
+ yes)
+ 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]))
+ AC_DEFINE(VIK_CONFIG_GEOTAG, [], [GEOTAG STUFF])
+ ;;
+esac
+AM_CONDITIONAL([GEOTAG], [test x$ac_cv_enable_geotag = xyes])
+
+AC_ARG_ENABLE(spotmaps, AC_HELP_STRING([--enable-spotmaps],
+ [enable SPOTMaps map (default is enable).]),
+ [ac_cv_enable_spotmaps=$enableval],
+ [ac_cv_enable_spotmaps=yes])
+AC_CACHE_CHECK([whether to enable SPOTMaps map],
+ [ac_cv_enable_spotmaps], [ac_cv_enable_spotmaps=yes])
+case $ac_cv_enable_spotmaps in
+ yes)
+ AC_DEFINE(VIK_CONFIG_SPOTMAPS, [], [SPOTMAPS STUFF])
+ ;;
+esac
+AM_CONDITIONAL([SPOTMAPS], [test x$ac_cv_enable_spotmaps = xyes])
+
+
+AC_ARG_ENABLE(dem24k, AC_HELP_STRING([--enable-dem24k],
+ [enable USGS 24k DEM (default is disable) download source. Requires dem24k.pl script in path.]),
+ [ac_cv_enable_dem24k=$enableval],
+ [ac_cv_enable_dem24k=no])
+AC_CACHE_CHECK([whether to enable USGS DEM 24k download source],
+ [ac_cv_enable_dem24k], [ac_cv_enable_dem24k=yes])
+case $ac_cv_enable_dem24k in
+ yes)
+ AC_DEFINE(VIK_CONFIG_DEM24K, [], [DEM24K STUFF])
+ ;;
+esac
+AM_CONDITIONAL([DEM24K], [test x$ac_cv_enable_dem24k = xyes])
+
+# Realtime GPS tracking
+AC_ARG_ENABLE(realtime-gps-tracking, AC_HELP_STRING([--enable-realtime-gps-tracking],
+ [enable realtime GPS tracking (default is enable)]),
+ [ac_cv_enable_realtimegpstracking=$enableval],
+ [ac_cv_enable_realtimegpstracking=yes])
+AC_CACHE_CHECK([whether to enable Realtime GPS Tracking stuff],
+ [ac_cv_enable_realtimegpstracking], [ac_cv_enable_realtimegpstracking=yes])
+case $ac_cv_enable_realtimegpstracking in
+ yes)
+ 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]))
+ AC_DEFINE(VIK_CONFIG_REALTIME_GPS_TRACKING, [], [REALTIME GPS TRACKING STUFF])
+ ;;
+esac
+AM_CONDITIONAL([REALTIME_GPS_TRACKING], [test x$ac_cv_enable_realtimegpstracking = xyes])
+
+# BZIP2
+AC_ARG_ENABLE(bz2, AC_HELP_STRING([--enable-bzip2],
+ [enable bzip2 Support (default is enable).]),
+ [ac_cv_enable_bzip2=$enableval],
+ [ac_cv_enable_bzip2=yes])
+AC_CACHE_CHECK([whether to enable bzip2 Support],
+ [ac_cv_enable_bzip2], [ac_cv_enable_bzip2=yes])
+case $ac_cv_enable_bzip2 in
+ yes)
+ 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])])
+ AC_CHECK_LIB(bz2, BZ2_bzBuffToBuffDecompress, [], [AC_MSG_ERROR([libbz2 is needed but not found.])])
+ ;;
+esac
+AM_CONDITIONAL([BZIP2], [test x$ac_cv_enable_bzip2 = xyes])
+
+# FILE MAGIC
+AC_ARG_ENABLE(magic, AC_HELP_STRING([--enable-magic],
+ [enable File Magic support via libmagic (default is enable).]),
+ [ac_cv_enable_magic=$enableval],
+ [ac_cv_enable_magic=yes])
+AC_CACHE_CHECK([whether to enable Magic Support],
+ [ac_cv_enable_magic], [ac_cv_enable_magic=yes])
+case $ac_cv_enable_magic in
+ yes)
+ 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])])
+ AC_CHECK_LIB(magic, magic_open, [], [AC_MSG_ERROR([libmagic is needed but not found.])])
+ ;;
+esac
+AM_CONDITIONAL([MAGIC], [test x$ac_cv_enable_magic = xyes])
+
+###
+
+AC_ARG_WITH(search,
+ [AC_HELP_STRING([--with-search],
+ [specify google or geonames for searching (default is google)])],
+ [case "x$withval" in
+ "xgoogle")
+ VIK_CONFIG_SEARCH=VIK_CONFIG_SEARCH_GOOGLE
+ ;;
+ "xgeonames")
+ VIK_CONFIG_SEARCH=VIK_CONFIG_SEARCH_GEONAMES
+ ;;
+ *)
+ AC_MSG_ERROR([Please, set a value for search method])
+ esac],
+ [VIK_CONFIG_SEARCH=VIK_CONFIG_SEARCH_GOOGLE])
+AC_DEFINE_UNQUOTED(VIK_CONFIG_SEARCH_GOOGLE, 1,
+ [Id. for searching via GOOGLE])
+AC_DEFINE_UNQUOTED(VIK_CONFIG_SEARCH_GEONAMES, 2,
+ [Id. for searching via GEONAMES])
+AC_DEFINE_UNQUOTED(VIK_CONFIG_SEARCH, ${VIK_CONFIG_SEARCH},
+ [Method for the search])
+
+