[systemd-devel] [PATCH] Allow tests to be disabled.

Thierry Reding thierry.reding at avionic-design.de
Wed Nov 24 06:40:10 PST 2010


This patch adds a --disable-tests option to the configure script in
order to remove the build-dependency on gtk+-3.0.
---
 Makefile.am  |    6 +++++-
 configure.ac |   14 ++++++++++----
 2 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 41ff37c..e13787a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,6 +1,10 @@
 ACLOCAL_AMFLAGS = -I m4
 
-SUBDIRS = libnotify docs tools tests
+SUBDIRS = libnotify docs tools
+
+if ENABLE_TESTS
+SUBDIRS += tests
+endif
 
 pcdata_DATA = libnotify.pc
 pcdatadir = $(libdir)/pkgconfig
diff --git a/configure.ac b/configure.ac
index 71609ed..4cf5515 100644
--- a/configure.ac
+++ b/configure.ac
@@ -97,10 +97,16 @@ AC_SUBST(PACKAGE_LIBS)
 AC_SUBST(PACKAGE_CFLAGS)
 AC_SUBST(pkg_modules)
 
-tests_modules="gtk+-3.0 >= $REQ_GTK_VERSION"
-PKG_CHECK_MODULES(TESTS, [$tests_modules])
-AC_SUBST(TESTS_LIBS)
-AC_SUBST(TESTS_CFLAGS)
+AC_ARG_ENABLE(tests,
+	[AC_HELP_STRING([--disable-tests], [build tests (requires gtk+-3.0)])],
+	enable_tests=$enableval, enable_tests=yes)
+if test x$enable_tests = xyes; then
+	tests_modules="gtk+-3.0 >= $REQ_GTK_VERSION"
+	PKG_CHECK_MODULES(TESTS, [$tests_modules])
+	AC_SUBST(TESTS_LIBS)
+	AC_SUBST(TESTS_CFLAGS)
+fi
+AM_CONDITIONAL(ENABLE_TESTS, [test x$enable_tests = xyes])
 
 GLIB_GENMARSHAL=`pkg-config --variable=glib_genmarshal glib-2.0`
 AC_SUBST(GLIB_GENMARSHAL)



More information about the systemd-devel mailing list