Commit 671086111c2e9edd559a5d3b5319329d7ad55d16

Authored by Yegor Yefremov
Committed by Stéphane Raimbault
1 parent 55d8e2c0

Add an option to disable tests compilation

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
Showing 2 changed files with 13 additions and 1 deletions
Makefile.am
@@ -9,4 +9,8 @@ CLEANFILES += libmodbus.pc @@ -9,4 +9,8 @@ CLEANFILES += libmodbus.pc
9 9
10 dist_doc_DATA = MIGRATION README.md 10 dist_doc_DATA = MIGRATION README.md
11 11
12 -SUBDIRS = src tests doc 12 +SUBDIRS = src doc
  13 +
  14 +if BUILD_TESTS
  15 +SUBDIRS += tests
  16 +endif
configure.ac
@@ -141,6 +141,13 @@ my_CFLAGS=&quot;-Wall \ @@ -141,6 +141,13 @@ my_CFLAGS=&quot;-Wall \
141 -Wformat-security" 141 -Wformat-security"
142 AC_SUBST([my_CFLAGS]) 142 AC_SUBST([my_CFLAGS])
143 143
  144 +# Build options
  145 +AC_ARG_ENABLE(tests,
  146 + AS_HELP_STRING([--disable-tests],
  147 + [Build tests (default: yes)]),,
  148 + [enable_tests=yes])
  149 +AM_CONDITIONAL(BUILD_TESTS, [test $enable_tests != no])
  150 +
144 AC_CONFIG_HEADERS([config.h tests/unit-test.h]) 151 AC_CONFIG_HEADERS([config.h tests/unit-test.h])
145 AC_CONFIG_FILES([ 152 AC_CONFIG_FILES([
146 Makefile 153 Makefile
@@ -167,4 +174,5 @@ AC_MSG_RESULT([ @@ -167,4 +174,5 @@ AC_MSG_RESULT([
167 ldflags: ${LDFLAGS} 174 ldflags: ${LDFLAGS}
168 175
169 documentation: ${ac_libmodbus_build_doc} 176 documentation: ${ac_libmodbus_build_doc}
  177 + tests: ${enable_tests}
170 ]) 178 ])