From 7892a833014b0304e1ca4dd7c3c442da93b5832f Mon Sep 17 00:00:00 2001 From: Dave Davenport Date: Sun, 30 Apr 2017 18:34:37 +0200 Subject: [PATCH] Allow libcheck to be disabled if not found --- .travis.yml | 2 ++ Makefile.am | 24 +++++++++++++++++------- configure.ac | 3 ++- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index dfc98ba8..caddd262 100644 --- a/.travis.yml +++ b/.travis.yml @@ -39,6 +39,8 @@ addons: - lcov - doxygen - graphviz + - texinfo + - texi2html compiler: - gcc diff --git a/Makefile.am b/Makefile.am index f5af4b3e..3fd8bb98 100644 --- a/Makefile.am +++ b/Makefile.am @@ -225,9 +225,12 @@ check_PROGRAMS=\ helper_config_cmdline_parser\ widget_test\ box_test\ - theme_parser_test\ - scrollbar_test\ - mode_test + scrollbar_test + +if HAVE_CHECK +check_PROGRAMS+=mode_test theme_parser_test +endif + history_test_CFLAGS=\ @@ -363,6 +366,9 @@ textbox_test_SOURCES=\ include/helper-theme.h\ test/textbox-test.c +if HAVE_CHECK +theme_parser_test_CFLAGS=${helper_test_CFLAGS} $(check_CFLAGS) +theme_parser_test_LDADD=${helper_test_LDADD} $(check_LIBS) theme_parser_test_SOURCES=\ config/config.c\ include/rofi.h\ @@ -380,6 +386,7 @@ theme_parser_test_SOURCES=\ lexer/theme-parser.h\ source/theme.c\ test/theme-parser-test.c +endif helper_test_SOURCES=\ config/config.c\ @@ -415,8 +422,6 @@ helper_test_LDADD=\ $(libsn_LIBS)\ $(cairo_LIBS) -theme_parser_test_CFLAGS=${helper_test_CFLAGS} $(check_CFLAGS) -theme_parser_test_LDADD=${helper_test_LDADD} $(check_LIBS) helper_expand_SOURCES=\ config/config.c\ @@ -452,6 +457,7 @@ helper_config_cmdline_parser_SOURCES=\ test/helper-config-cmdline-parser.c +if HAVE_CHECK mode_test_CFLAGS=$(textbox_test_CFLAGS) $(check_CFLAGS) mode_test_LDADD=$(textbox_test_LDADD) $(check_LIBS) mode_test_SOURCES=\ @@ -464,6 +470,7 @@ mode_test_SOURCES=\ source/keyb.c\ include/mode.h\ include/mode-private.h +endif TESTS=\ history_test\ @@ -475,9 +482,12 @@ TESTS=\ textbox_test\ widget_test\ box_test\ - theme_parser_test\ - scrollbar_test\ + scrollbar_test + +if HAVE_CHECK +TESTS+=theme_parser_test\ mode_test +endif .PHONY: test-x test-x: $(bin_PROGRAMS) diff --git a/configure.ac b/configure.ac index 19e7afe3..ca473401 100644 --- a/configure.ac +++ b/configure.ac @@ -119,7 +119,8 @@ GW_CHECK_XCB([xcb-aux xcb-xkb xkbcommon >= 0.5.0 xkbcommon-x11 xcb-ewmh xcb-iccc PKG_CHECK_MODULES([pango], [pango pangocairo]) PKG_CHECK_MODULES([cairo], [cairo cairo-xcb]) PKG_CHECK_MODULES([libsn], [libstartup-notification-1.0 ]) -PKG_CHECK_MODULES([check], [check]) +PKG_CHECK_MODULES([check], [check >= 0.11.0], [HAVE_CHECK=1], [HAVE_CHECK=0]) +AM_CONDITIONAL([HAVE_CHECK], [test "$HAVE_CHECK" -eq 1]) dnl ---------------------------------------------------------------------