# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.64)
-AC_INIT(viking, 1.5, , viking, http://viking.sf.net/)
+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)
+
+# 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 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)
AM_CONDITIONAL([REALTIME_GPS_TRACKING], [test x$ac_cv_enable_realtimegpstracking = xyes])
# BZIP2
-AC_ARG_ENABLE(bz2, AC_HELP_STRING([--enable-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])
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])
###
-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])
+## 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,
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"])
-
-dnl This will cause the automake generated makefiles to pass the
-dnl correct flags to aclocal.
-ACLOCAL_AMFLAGS="\${ACLOCAL_FLAGS}"
-AC_SUBST(ACLOCAL_AMFLAGS)
+AC_CHECK_PROG([HAVE_SCROLLKEEPER],scrollkeeper-config,"yes")
+AM_CONDITIONAL([GEN_MANPAGES],[test "x$XP" != "x" && test -r "$DB2MAN_XSL"] && test "${HAVE_SCROLLKEEPER}" == "yes" )
-AM_CONDITIONAL([VIKING_DOC], test x${enable_gtk_doc} = xyes)
+ISODATE=`date +%Y-%m-%d`
+AC_SUBST(ISODATE)
# Configuration
AC_CONFIG_FILES([
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
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 ""