This patch adds --disable-tests to configure.  It is based on a patch
posted by Thierry Reding in 2010.  The motivation for adding it is that
some tests fail link-time when cross-compiling.
---
 Makefile.am  |   21 +++++++++++----------
 configure.ac |    5 +++++
 2 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 7b4b2d8..82bd4f6 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -125,8 +125,13 @@ dist_dbussystemservice_DATA =
 check_PROGRAMS =
 check_DATA =
 noinst_tests=
+if ENABLE_TESTS
 noinst_PROGRAMS = $(noinst_tests)
 TESTS = $(noinst_tests)
+else
+noinst_PROGRAMS =
+TESTS =
+endif
 udevlibexec_PROGRAMS =
 
 AM_CPPFLAGS = \
@@ -1063,7 +1068,7 @@ CLEANFILES += \
        src/core/org.freedesktop.systemd1.policy.in
 
 # 
------------------------------------------------------------------------------
-noinst_PROGRAMS += \
+noinst_tests += \
        test-engine \
        test-ns \
        test-loopback \
@@ -1072,9 +1077,7 @@ noinst_PROGRAMS += \
        test-cgroup \
        test-install \
        test-watchdog \
-       test-log
-
-noinst_tests += \
+       test-log \
        test-job-type \
        test-env-replace \
        test-strbuf \
@@ -1145,7 +1148,7 @@ test_hostname_LDADD = \
        libsystemd-core.la
 
 if ENABLE_EFI
-noinst_PROGRAMS += \
+noinst_tests += \
        test-efivars
 
 test_efivars_SOURCES = \
@@ -2074,7 +2077,7 @@ TESTS += \
        test/udev-test.pl \
        test/rules-test.sh
 
-noinst_PROGRAMS += \
+noinst_tests += \
        test-libudev \
        test-udev
 
@@ -2835,10 +2838,8 @@ catalog-remove-hook:
 UNINSTALL_DATA_HOOKS += \
        catalog-remove-hook
 
-noinst_PROGRAMS += \
-       test-journal-enum
-
 noinst_tests += \
+       test-journal-enum
        test-journal \
        test-journal-send \
        test-journal-syslog \
@@ -3536,7 +3537,7 @@ test_inhibit_CFLAGS = \
        $(AM_CFLAGS) \
        $(DBUS_CFLAGS)
 
-noinst_PROGRAMS += \
+noinst_tests += \
        test-login \
        test-inhibit
 
diff --git a/configure.ac b/configure.ac
index 519f1a9..fbc07c2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -880,6 +880,11 @@ AS_IF([test "x$0" != "x./configure"], [
         AC_SUBST([INTLTOOL_UPDATE], [/bin/true])
 ])
 
+AC_ARG_ENABLE(tests,
+       [AC_HELP_STRING([--disable-tests], [build tests])],
+       enable_tests=$enableval, enable_tests=yes)
+AM_CONDITIONAL(ENABLE_TESTS, [test x$enable_tests = xyes])
+
 AC_SUBST([dbuspolicydir], [$with_dbuspolicydir])
 AC_SUBST([dbussessionservicedir], [$with_dbussessionservicedir])
 AC_SUBST([dbussystemservicedir], [$with_dbussystemservicedir])
-- 
1.7.10.1

_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to