Make the tests optional to drop unneeded dependencies
authorPeter Hutterer <peter.hutterer@who-t.net>
Mon, 29 Jul 2013 04:27:41 +0000 (14:27 +1000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Mon, 12 Aug 2013 21:11:50 +0000 (07:11 +1000)
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@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
configure.ac
test/Makefile.am

index cfa9746..68df538 100644 (file)
@@ -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"
index e2c1ca1..12f7176 100644 (file)
@@ -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