tests: Conditional compilation of tests (including boost-based unit tests)

To compile tests, code needs to be configured with --with-tests option,
otherwise all tests are disabled.

Tests that are based on Boost's unit test framework are enabled only if
the framework is detected during the configure time.

Change-Id: Ia1768e24b088e4f19d2a8799c6d5baeabb2f44c5
diff --git a/configure.ac b/configure.ac
index 5e19152..1bac2be 100644
--- a/configure.ac
+++ b/configure.ac
@@ -74,6 +74,26 @@
   ],
   []
 )
+AX_BOOST_ASIO
+
+AC_ARG_WITH([tests],
+  AS_HELP_STRING(
+      [--with-tests],
+      [Enable compilation of library tests (disabled by default).]
+  ),
+  [
+    want_tests="yes"
+    AM_CONDITIONAL(COMPILE_TESTS, true)
+  ],
+  [
+    want_tests="no"
+    AM_CONDITIONAL(COMPILE_TESTS, false)
+  ]
+)
+
+AX_BOOST_SYSTEM
+AX_BOOST_UNIT_TEST_FRAMEWORK
+AM_CONDITIONAL(HAVE_BOOST_UNIT_TEST_FRAMEWORK, [test "x$ax_cv_boost_unit_test_framework" = "xyes"])
 
 AC_MSG_CHECKING([for gmtime support])
 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
@@ -135,5 +155,6 @@
 
 AC_CONFIG_FILES([Makefile
                  include/Makefile
-                 tests/Makefile])
+                 tests/Makefile
+                 tests_boost/Makefile])
 AC_OUTPUT