commit c34f64423776d214fc5a24b76c7c606119988d7e Author: David King Date: Mon Oct 22 08:12:40 2012 +0100 Make tests optional at configure time http://code.google.com/p/accounts-sso/issues/detail?id=124 diff --git a/Makefile.am b/Makefile.am index 97979a6..358a923 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,7 +1,10 @@ -SUBDIRS = libaccounts-glib docs tests tools +SUBDIRS = libaccounts-glib docs tools if ENABLE_PYTHON SUBDIRS += pygobject endif +if ENABLE_TESTS +SUBDIRS += tests +endif ACLOCAL_AMFLAGS = -I m4 diff --git a/configure.ac b/configure.ac index cbaf8d5..50b95ea 100644 --- a/configure.ac +++ b/configure.ac @@ -22,7 +22,25 @@ PKG_CHECK_MODULES( AC_SUBST(LIBACCOUNTS_CFLAGS) AC_SUBST(LIBACCOUNTS_LIBS) -PKG_CHECK_MODULES([CHECK], [check >= 0.9.4]) +# Build tests. + +CHECK_REQUIRED="check >= 0.9.4" + +AC_ARG_ENABLE([tests], + [AS_HELP_STRING([--disable-tests], [build with testing support disabled])]) + +AS_IF([test "x$enable_tests" != "xno"], + [PKG_CHECK_EXISTS([$CHECK_REQUIRED], [have_check=yes], [have_check=no])], + [have_check=no]) + +AS_IF([test "x$have_check" = "xyes"], + [PKG_CHECK_MODULES([CHECK], [$CHECK_REQUIRED]) + AC_SUBST([CHECK_CFLAGS]) + AC_SUBST([CHECK_LIBS])], + [AS_IF([test "x$enable_tests" = "xyes"], + [AC_MSG_ERROR([tests enabled but required dependencies were not found])])]) + +AM_CONDITIONAL([ENABLE_TESTS], [test "x$have_check" = "xyes"]) AC_ISC_POSIX AC_PROG_CC diff --git a/tests/Makefile.am b/tests/Makefile.am index db5aa3f..f6c8dbf 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -7,7 +7,7 @@ dist_check_SCRIPTS = \ check_SCRIPTS = accounts-glib-test.sh accounts_glib_testsuite_SOURCES = check_ag.c -accounts_glib_testsuite_CFLAGS = $(CHECK_FLAGS) -I$(top_srcdir) +accounts_glib_testsuite_CFLAGS = $(CHECK_CFLAGS) -I$(top_srcdir) accounts_glib_testsuite_LDADD = \ $(CHECK_LIBS) \ $(LIBACCOUNTS_LIBS) \