summaryrefslogtreecommitdiff
path: root/community/libsignon-glib/make-tests-optional.patch
blob: cc1e72848c2c5d6604f8d122bfdcc321d367f58a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
commit 65e1948097695f26aa13f4104336a8a76a678b87
Author: David King <david.king@canonical.com>
Date:   Tue Oct 30 09:24:27 2012 +0000

    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 86b3a55..5740d45 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -2,12 +2,16 @@ ACLOCAL_AMFLAGS = -I m4
 DISTCHECK_CONFIGURE_FLAGS = \
 	--enable-gtk-doc \
 	--enable-introspection=yes
-SUBDIRS = libsignon-glib docs tests
+SUBDIRS = libsignon-glib docs
 
 if ENABLE_PYTHON
 SUBDIRS += pygobject
 endif
 
+if ENABLE_TESTS
+SUBDIRS += tests
+endif
+
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = libsignon-glib.pc
 
diff --git a/configure.ac b/configure.ac
index af5e663..d09661e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -19,7 +19,25 @@ PKG_CHECK_MODULES(
 AC_SUBST(DEPS_CFLAGS)
 AC_SUBST(DEPS_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