[PATCH libevdev 3/3] Make the tests optional to drop unneeded dependencies

Peter Hutterer peter.hutterer at who-t.net
Thu Aug 8 23:40:55 PDT 2013


libevdev has no external dependencies and both check and libudev are
only required for running the unit-tests. Make them optional.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 configure.ac     | 6 +++++-
 test/Makefile.am | 2 ++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index cfa9746..68df538 100644
--- a/configure.ac
+++ b/configure.ac
@@ -33,7 +33,11 @@ LT_PREREQ([2.2])
 LT_INIT
 
 PKG_PROG_PKG_CONFIG()
-PKG_CHECK_MODULES(CHECK, [check])
+PKG_CHECK_MODULES(CHECK, [check], [HAVE_CHECK="yes"], [HAVE_CHECK="no"])
+if test "x$HAVE_CHECK" != "xyes"; then
+	AC_MSG_WARN([check not found - skipping building unit tests])
+fi
+AM_CONDITIONAL(BUILD_TESTS, [test "x$HAVE_CHECK" = "xyes"])
 
 if test "x$GCC" = "xyes"; then
 	GCC_CFLAGS="-Wall -Wextra -Wno-unused-parameter -g -Wstrict-prototypes -Wmissing-prototypes -fvisibility=hidden"
diff --git a/test/Makefile.am b/test/Makefile.am
index e2c1ca1..12f7176 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -1,3 +1,4 @@
+if BUILD_TESTS
 noinst_PROGRAMS = test-libevdev
 
 TESTS = $(noinst_PROGRAMS)
@@ -71,3 +72,4 @@ endif
 clean-local: gcov-clean
 	rm -f *.gcno *.gcda
 
+endif
-- 
1.8.2.1



More information about the Input-tools mailing list