From 6187dfbd140c6f3af8dce96c3cac1e86c6ff0442 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Thu, 26 Apr 2012 15:01:53 -0500 Subject: only require GTest and libdbustest if we're building the unit tests --- Makefile.am | 7 ++++++- configure.ac | 22 ++++++++++++++++++---- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/Makefile.am b/Makefile.am index b76302c..c05a4f0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -2,9 +2,14 @@ SUBDIRS = \ src \ data \ - tests \ po +if BUILD_TESTS +SUBDIRS += tests +# build src first +test: src +endif + EXTRA_DIST = autogen.sh DISTCHECK_CONFIGURE_FLAGS = --enable-localinstall diff --git a/configure.ac b/configure.ac index 4a1317e..476fc2e 100644 --- a/configure.ac +++ b/configure.ac @@ -89,8 +89,6 @@ AS_IF([test "x$with_gtk" = x3], [ AC_DEFINE(HAVE_GTK3, 1, [whether gtk3 is available]) ]) -PKG_CHECK_MODULES(LIBDBUSTEST, dbustest-1 >= DBUSTEST_REQUIRED_VERSION) - ########################### # GTK Logout Helper ########################### @@ -178,8 +176,23 @@ AC_SUBST(DBUSSERVICEDIR) # Google Test framework ########################### -m4_include([m4/gtest.m4]) -CHECK_GTEST +AC_ARG_ENABLE([tests], + [AS_HELP_STRING([--disable-tests], [Disable test scripts and tools (default=auto)])], + [enable_tests=${enableval}], + [enable_tests=auto]) +if test "x$enable_tests" != "xno"; then + m4_include([m4/gtest.m4]) + CHECK_GTEST + if test "x$enable_tests" = "xauto"; then + enable_tests=${have_gtest} + elif test "x$enable_tests" = "xyes" && test "x$have_gtest" != "xyes"; then + AC_MSG_ERROR([tests were requested but gtest is not installed.]) + fi + if test "x$enable_tests" = "xyes"; then + PKG_CHECK_MODULES(LIBDBUSTEST, dbustest-1 >= DBUSTEST_REQUIRED_VERSION) + fi +fi +AM_CONDITIONAL([BUILD_TESTS],[test "x$enable_tests" = "xyes"]) ############################## # Custom Junk @@ -266,5 +279,6 @@ SUS Indicator Configuration: Indicator GTK: $with_gtk Logout Helper: $have_gtklogouthelper APT support: $enable_apt + Enable tests: $enable_tests Coverage reporting: $use_gcov ]) -- cgit v1.2.3