- [ --enable-console_ui=[yes/no] Turn on or off compilation of console interface [default=yes]],
- [case "${enableval}" in
- yes) console_ui=true ;;
- no) console_ui=false ;;
- *) AC_MSG_ERROR(bad value ${enableval} for --enable-console_ui) ;;
- esac],[console_ui=true])
+ [AS_HELP_STRING([--enable-console_ui=[yes/no]], [Turn on or off compilation of console interface (default=yes)])],
+ [case "${enableval}" in
+ yes) console_ui=true ;;
+ no) console_ui=false ;;
+ *) AC_MSG_ERROR(bad value ${enableval} for --enable-console_ui) ;;
+ esac],
+ [console_ui=true]
+)
+
+dnl conditionnal build of tools.
+AC_ARG_ENABLE(tools,
+ [AS_HELP_STRING([--enable-tools=[yes/no]], [Turn on or off compilation of console interface (default=yes)])],
+ [case "${enableval}" in
+ yes) build_tools=true ;;
+ no) build_tools=false ;;
+ *) AC_MSG_ERROR(bad value ${enableval} for --enable-tools) ;;
+ esac],
+ [build_tools=check]
+)
+
+dnl check for installed version of libupnp
+AC_ARG_ENABLE(upnp,
+ [AS_HELP_STRING([--disable-upnp], [Disable uPnP support])],
+ [case "${enableval}" in
+ yes) build_upnp=true ;;
+ no) build_upnp=false ;;
+ *) AC_MSG_ERROR(bad value ${enableval} for --disable-upnp) ;;
+ esac],
+ [build_upnp=auto]
+)
+
+if test "$build_upnp" != "false" ; then
+ PKG_CHECK_MODULES([LIBUPNP], [libupnp],
+ [if pkg-config --atleast-version=1.6 "libupnp < 1.7"; then
+ build_upnp=true
+ else
+ AC_MSG_ERROR([libupnp >= 1.6 < 1.5 required.])
+ fi],
+ [if test "$build_upnp" == "true" ; then
+ AC_MSG_ERROR([libupnp not found.])
+ else
+ build_upnp=false
+ fi]
+ )
+
+fi
+
+AM_CONDITIONAL(BUILD_UPNP, test x$build_upnp != xfalse)
+if test "$build_upnp" != "false" ; then
+ AC_DEFINE(BUILD_UPNP, 1, [Define if upnp enabled])
+fi
+
+dnl check libxml2 (needed for tools)
+if test "$build_tools" != "false" ; then
+ PKG_CHECK_MODULES(LIBXML2, [libxml-2.0],[],
+ [if test "$build_tools" = "true" ; then
+ AC_MSG_ERROR([Could not found libxml2, tools cannot be compiled.])
+ else
+ build_tools=false
+ fi]
+ )
+fi
+
+AM_CONDITIONAL(BUILD_TOOLS, test x$build_tools != xfalse)
+if test "$build_tools" != "false" ; then
+ build_tools=true
+ AC_DEFINE(BUILD_TOOLS, 1, [Define if tools enabled] )
+fi