]> git.street.me.uk Git - andy/viking.git/blobdiff - configure.ac
Make the find best zoom level function reusable.
[andy/viking.git] / configure.ac
index 309e5192a139f5a74535710b11e6f45b15d2d68c..87c2dbb4a418a77c862050c8d4533ece328d6c23 100644 (file)
@@ -1,15 +1,22 @@
 #                                               -*- Autoconf -*-
 # Process this file with autoconf to produce a configure script.
 
-AC_PREREQ(2.59)
-AC_INIT(viking, 1.4.1)
-AM_INIT_AUTOMAKE([dist-bzip2 dist-zip])
+AC_PREREQ(2.64)
+AC_INIT(viking, 1.6.1, , viking, http://viking.sf.net/)
+AM_INIT_AUTOMAKE([dist-bzip2 dist-zip subdir-objects])
 dnl AC_CONFIG_SRCDIR([src/main.c])
 AC_CONFIG_HEADERS([src/config.h])
-GTK_DOC_CHECK(1.0)
 
-# Checks for programs.
+# check for gtk-doc
+m4_ifdef([GTK_DOC_CHECK], [
+GTK_DOC_CHECK([1.0],[--flavour no-tmpl])
+],[
+AM_CONDITIONAL([ENABLE_GTK_DOC], false)
+])
+
 AC_PROG_CC
+AC_PROG_CC_STDC
+# Checks for programs.
 AC_PROG_MAKE_SET
 AC_PROG_RANLIB
 AC_PATH_PROG(GLIB_MKENUMS, glib-mkenums)
@@ -21,7 +28,9 @@ AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE",[Gettext package name])
 
 AM_GLIB_DEFINE_LOCALEDIR(LOCALEDIR)
 
-AM_GLIB_GNU_GETTEXT
+AM_GNU_GETTEXT_VERSION([0.17])
+AM_GNU_GETTEXT([external])
+
 IT_PROG_INTLTOOL([0.35.0])
 
 AC_SUBST([CONFIG_STATUS_DEPENDENCIES],['$(top_srcdir)/po/LINGUAS'])
@@ -42,11 +51,25 @@ AC_TYPE_MODE_T
 # Checks for library functions or symbols
 AC_FUNC_STAT
 AC_FUNC_STRTOD
-AC_CHECK_FUNCS([floor memset mkdtemp pow realpath sqrt strcasecmp strchr strdup strncasecmp strtol strtoul])
+AC_CHECK_FUNCS([floor memset mkdtemp pow realpath sqrt strcasecmp strchr strncasecmp strtol strtoul])
 AC_CHECK_LIB(m, tan)
 AC_CHECK_LIB(z, inflate)
 AC_CHECK_LIB(X11, XSetErrorHandler)
 
+# ATM not running automake under Windows
+#AC_CHECK_PROG(USE_WINDOWS, cmd.exe, yes, no)
+#AM_CONDITIONAL([WINDOWS], [test x$USE_WINDOWS = xyes])
+# So pass in as an option instead
+# This is only to perform slightly different build steps
+#  (the code uses standard WINDOWS defines for any specific different behaviour)
+AC_ARG_ENABLE(windows, AC_HELP_STRING([--enable-windows],
+              [Perform specific Windows build steps (default is no)]),
+              [ac_cv_enable_windows=$enableval],
+              [ac_cv_enable_windows=no])
+AC_CACHE_CHECK([whether to enable Windows build steps],
+               [ac_cv_enable_windows], [ac_cv_enable_windows=no])
+AM_CONDITIONAL([WINDOWS], [test x$ac_cv_enable_windows = xyes])
+
 # Expat
 AM_WITH_EXPAT
 
@@ -65,9 +88,9 @@ dnl | Pkgconfig checks |---------------------------------------
 dnl  ------------------
 
 PKG_CHECK_MODULES(PACKAGE, [
-        glib-2.0          >= 2.16
+        glib-2.0          >= 2.26
         gthread-2.0       >= 2.2
-        gtk+-2.0          >= 2.12
+        gtk+-2.0          >= 2.16
         gio-2.0           >= 2.12
 ])
 
@@ -104,18 +127,6 @@ if test "x$ac_cv_enable_deprecations" = "xyes"; then
 fi
 
 # Options
-AC_ARG_ENABLE(alphabetized-trw, AC_HELP_STRING([--enable-alphabetized-trw],
-              [enable alphabetized track & waypoints (default is enable)]),
-              [ac_cv_enable_alpha_trw=$enableval],
-              [ac_cv_enable_alpha_trw=yes])
-AC_CACHE_CHECK([whether to enable alphabetized track & waypoint],
-               [ac_cv_enable_alpha_trw], [ac_cv_enable_alpha_trw=yes])
-case $ac_cv_enable_alpha_trw in
-  yes)
-    AC_DEFINE(VIK_CONFIG_ALPHABETIZED_TRW, [], [NO ALPHABETIZED TRW])
-    ;;
-esac
-
 AC_ARG_ENABLE(bing, AC_HELP_STRING([--enable-bing],
               [enable Bing stuff (default is enable)]),
               [ac_cv_enable_bing=$enableval],
@@ -143,9 +154,9 @@ esac
 AM_CONDITIONAL([GOOGLE], [test x$ac_cv_enable_google = xyes])
 
 AC_ARG_ENABLE(terraserver, AC_HELP_STRING([--enable-terraserver],
-              [enable Terraserver stuff (default is enable)]),
+              [enable Terraserver stuff (default is disabled as the tileserver is no longer available)]),
               [ac_cv_enable_terraserver=$enableval],
-              [ac_cv_enable_terraserver=yes])
+              [ac_cv_enable_terraserver=no])
 AC_CACHE_CHECK([whether to enable Terraserver stuff],
                [ac_cv_enable_terraserver], [ac_cv_enable_terraserver=yes])
 case $ac_cv_enable_terraserver in
@@ -223,6 +234,8 @@ case $ac_cv_enable_geocaches in
 esac
 AM_CONDITIONAL([GEOCACHES], [test x$ac_cv_enable_geocaches = xyes])
 
+# Geotagging
+AC_ARG_WITH(libexif, AC_HELP_STRING([--with-libexif], [Force usage of libexif instead of libgexiv2]))
 AC_ARG_ENABLE(geotag, AC_HELP_STRING([--enable-geotag],
              [enable Geotag Support (default is enable).]),
               [ac_cv_enable_geotag=$enableval],
@@ -231,25 +244,21 @@ 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]))
+    AS_IF([test x$with_libexif = xyes],
+      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]))
+      AC_CHECK_LIB(exif,exif_loader_new,, AC_MSG_ERROR([libexif is not found but it has been forcibly required])),
+      # gexiv2.h relies on glib so a simple compile check fails.
+      #AC_CHECK_HEADER([gexiv2/gexiv2.h],,AC_MSG_ERROR([Error msg...]))
+      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]))
+      )
     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])
-
+AM_CONDITIONAL([GEXIV2], [test x$ac_cv_lib_gexiv2_gexiv2_metadata_new = xyes] )
+# Tested with gexiv2 0.10.2, but probably would work with older versions; may be all of them...
+#AM_COND_IF([GEXIV2], [PKG_CHECK_MODULES([GEXIV2], [gexiv2 >= 0.6.1])])
+AM_CONDITIONAL([LIBEXIF], [test x$ac_cv_lib_exif_exif_loader_new = 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.]),
@@ -279,26 +288,111 @@ case $ac_cv_enable_realtimegpstracking in
 esac
 AM_CONDITIONAL([REALTIME_GPS_TRACKING], [test x$ac_cv_enable_realtimegpstracking = 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])
+# BZIP2
+AC_ARG_ENABLE(bzip2, 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])
+
+# SQL for MBTiles
+AC_ARG_ENABLE(mbtiles, AC_HELP_STRING([--enable-mbtiles],
+              [enable MBTiles support via libsqlite3 (default is enable).]),
+              [ac_cv_enable_mbtiles=$enableval],
+              [ac_cv_enable_mbtiles=yes])
+AC_CACHE_CHECK([whether to enable MBTiles Support],
+               [ac_cv_enable_mbtiles], [ac_cv_enable_mbtiles=yes])
+case $ac_cv_enable_mbtiles in
+  yes)
+    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])])
+    AC_CHECK_LIB(sqlite3, sqlite3_open, [], [AC_MSG_ERROR([libsqlite3 is needed but not found.])])
+    ;;
+esac
+AM_CONDITIONAL([SQLITE], [test x$ac_cv_enable_mbtiles = xyes])
+
+# Standard compression is handled by libz
+# libzip enables a friendlier file based interface
+# libzip itself depends on libz (which is required in the Viking build ATM)
+# ZIP
+AC_ARG_ENABLE(zip, AC_HELP_STRING([--enable-zip],
+              [enable zip support (default is enable).]),
+              [ac_cv_enable_zip=$enableval],
+              [ac_cv_enable_zip=yes])
+AC_CACHE_CHECK([whether to enable zip Support],
+               [ac_cv_enable_zip], [ac_cv_enable_zip=yes])
+case $ac_cv_enable_zip in
+  yes)
+    # NB As far as I can tell libzip doesn't provide any versioning info within the header code itself
+    # Thus supporting old versions via simple #if #else #endif directives is seemingly not possible
+    # Resort to checking versioning only via pkgconfig
+    PKG_CHECK_MODULES([LIBZIP], [libzip >= 0.11],
+      [ 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])]) 
+        AC_CHECK_LIB(zip, [main], [], [AC_MSG_ERROR([libzip is needed but not found.])]) ],
+      [ AC_MSG_WARN([libzip version needs to be at least 0.11, use of libzip is disabled])
+        ac_cv_enable_zip=no ]
+  )
+    ;;
+esac
+AM_CONDITIONAL([ZIP], [test x$ac_cv_enable_zip = xyes])
+
+# Mapnik rendering layer
+AC_ARG_ENABLE(mapnik, AC_HELP_STRING([--enable-mapnik],
+              [enable Mapnik (default is enable)]),
+              [ac_cv_enable_mapnik=$enableval],
+              [ac_cv_enable_mapnik=yes])
+AC_CACHE_CHECK([whether to enable Mapnik],
+               [ac_cv_enable_mapnik], [ac_cv_enable_mapnik=yes])
+case $ac_cv_enable_mapnik in
+  yes)
+    # C++
+    AC_LANG_CPLUSPLUS
+    AC_LANG_SAVE
+    AC_PROG_CXX
+    # Mapnik3 requires C++11. Viking will use C++11 as well.
+    CXXFLAGS="$CXXFLAGS -std=c++11"
+    # Too difficult to get check working under Windows (extra dependencies needed probably Boost)- so just skip it
+    if test "x$ac_cv_enable_windows" = "xno"; then
+      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])])
+    fi
+    AC_CHECK_LIB([mapnik], [main], [], [AC_MSG_ERROR([libmapnik is needed but not found.])])
+    AC_CHECK_LIB([stdc++], [main], [], [AC_MSG_ERROR([libstdc++ is needed but not found.])])
+    # Required for Mapnik3 build (it's also in Mapnik2 but does not need to be specified for some reason)
+    #  it's part of libmapnik install dependencies
+    AC_CHECK_LIB([icuuc], [main], [], [AC_MSG_ERROR([libicuuc is needed but not found.])])
+    AC_LANG_RESTORE
+    ;;
+esac
+AM_CONDITIONAL([MAPNIK], [test x$ac_cv_enable_mapnik = xyes])
+###
+
+## WORK AROUND BROKEN autoconf - see http://lists.gnu.org/archive/html/bug-automake/2002-11/msg00020.html
+m4_pushdef([AC_MSG_ERROR])
+AC_PROG_CXX
+m4_popdef([AC_MSG_ERROR])
+##
 
 
 AC_ARG_WITH(mapcache,
@@ -329,20 +423,18 @@ AC_ARG_WITH(tileage,
              [VIK_CONFIG_DEFAULT_TILE_AGE=604800])
 AC_DEFINE_UNQUOTED(VIK_CONFIG_DEFAULT_TILE_AGE, ${VIK_CONFIG_DEFAULT_TILE_AGE},
                    [Age of tiles before checking it (in seconds)])
+AC_DEFINE(HAVE_VIKING, 1, [Enable Viking specifics in otherwise reusable code])
 
 dnl man pages processing
 DB2MAN_XSL=/usr/share/sgml/docbook/stylesheet/xsl/nwalsh/manpages/docbook.xsl
 AC_SUBST(DB2MAN_XSL)
 AC_PATH_PROG(XP,xsltproc)
 AM_CONDITIONAL([HAVE_XSLTPROC],[test "x$XP" != "x"])
-AM_CONDITIONAL([GEN_MANPAGES],[test "x$XP" != "x" && test -r "$DB2MAN_XSL"])
+AC_CHECK_PROG([HAVE_SCROLLKEEPER],scrollkeeper-config,"yes")
+AM_CONDITIONAL([GEN_MANPAGES],[test "x$XP" != "x" && test -r "$DB2MAN_XSL"] && test "${HAVE_SCROLLKEEPER}" == "yes" )
 
-dnl This will cause the automake generated makefiles to pass the
-dnl correct flags to aclocal.
-ACLOCAL_AMFLAGS="\${ACLOCAL_FLAGS}"
-AC_SUBST(ACLOCAL_AMFLAGS)
-
-AM_CONDITIONAL([VIKING_DOC], test x${enable_gtk_doc} = xyes)
+ISODATE=`date +%Y-%m-%d`
+AC_SUBST(ISODATE)
 
 # Configuration
 AC_CONFIG_FILES([
@@ -351,17 +443,17 @@ AC_CONFIG_FILES([
                src/icons/Makefile
                po/Makefile.in
                data/Makefile
+               tools/Makefile
                test/Makefile
                help/Makefile
+               help/viking.xml
                win32/Makefile
                win32/installer/Makefile
                win32/installer/pixmaps/Makefile
-               win32/installer/translations/Makefile])
-AM_COND_IF([VIKING_DOC],
-       [AC_CONFIG_FILES([
+               win32/installer/translations/Makefile
                doc/Makefile
                doc/reference/Makefile
-               doc/examples/Makefile])])
+               doc/examples/Makefile])
 
 AC_OUTPUT([
           viking.spec
@@ -370,25 +462,29 @@ AC_OUTPUT([
 dnl Output the configuration summary
 echo ""
 echo "==========================================="
-echo "$PACKAGE $VERSION"
+echo "$PACKAGE $PACKAGE_URL $VERSION"
 echo "-------------------------------------------"
-echo "Alphabetized track & waypoints   : $ac_cv_enable_alpha_trw"
 echo "Bing Maps                        : $ac_cv_enable_bing"
 echo "Google                           : $ac_cv_enable_google"
 echo "Terraserver Maps                 : $ac_cv_enable_terraserver"
 echo "Expedia Maps                     : $ac_cv_enable_expedia"
 echo "Open Street Map                  : $ac_cv_enable_openstreetmap"
 echo "BlueMarble                       : $ac_cv_enable_bluemarble"
-echo "SPOTMaps                         : $ac_cv_enable_spotmaps"
 echo "Geonames                         : $ac_cv_enable_geonames"
 echo "Geocaches Acquire                : $ac_cv_enable_geocaches"
-echo "Geotag Support                   : $ac_cv_enable_geotag"
+echo "Geotag Support                   : $ac_cv_enable_geotag (libgexiv2=$ac_cv_lib_gexiv2_gexiv2_metadata_new libexif=$ac_cv_lib_exif_exif_loader_new)"
 echo "USGS 24k DEM                     : $ac_cv_enable_dem24k"
 echo "Realtime GPS Tracking            : $ac_cv_enable_realtimegpstracking"
+echo "bzip2 Support                    : $ac_cv_enable_bzip2"
+echo "File Magic Support               : $ac_cv_enable_magic"
+echo "MBTiles Support (SQLite3)        : $ac_cv_enable_mbtiles"
+echo "Zip File Support (with libzip)   : $ac_cv_enable_zip"
+echo "Mapnik Rendering Support (C++)   : $ac_cv_enable_mapnik"
 echo "Size of map cache (in memory)    : ${VIK_CONFIG_MAPCACHE_SIZE}"
 echo "Age of tiles (in seconds)        : ${VIK_CONFIG_DEFAULT_TILE_AGE}"
+echo -n "Man page generation              : "
+AM_COND_IF([GEN_MANPAGES], [echo "yes"], [echo "no"])
 echo "Documentation (+HTML)            : ${enable_gtk_doc} (HTML: ${enable_gtk_doc_html})"
 echo "-------------------------------------------"
 echo ""
 echo "Configure finished, type 'make' to build."
-