build: Don't build tests unless asked
Introduce --enable-tests so that packagers don't need gtest installed
to produce a package.
Change-Id: Ic17f46f2535d0426d05f05d4ff32711d0a2847d1
diff --git a/configure.ac b/configure.ac
index 95020a3..34a70e5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -35,10 +35,17 @@
# Checks for library functions.
LT_INIT # Removes 'unrecognized options: --with-libtool-sysroot'
+
+# Make it possible for users to choose if they want test support
+# explicitly or not at all
+AC_ARG_ENABLE([tests], [Whether we should build test cases])
+
# Check/set gtest specific functions.
-PKG_CHECK_MODULES([GMOCK], [gtest_main],,)
-PKG_CHECK_MODULES([GTEST], [gmock],,)
-AX_PTHREAD
+AS_IF([test "x$enable_tests" != "xno"], [
+ PKG_CHECK_MODULES([GMOCK], [gtest_main],,)
+ PKG_CHECK_MODULES([GTEST], [gmock],,)
+ AX_PTHREAD
+])
AC_ARG_ENABLE([oe-sdk],
AS_HELP_STRING([--enable-oe-sdk], [Link testcases absolutely against OE SDK so they can be ran within it.])