diff --git a/Makefile.am b/Makefile.am index 158e040..a0a165e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -9,4 +9,8 @@ CLEANFILES += libmodbus.pc dist_doc_DATA = MIGRATION README.md -SUBDIRS = src tests doc +SUBDIRS = src doc + +if BUILD_TESTS +SUBDIRS += tests +endif diff --git a/configure.ac b/configure.ac index 2e14ec9..ddb9532 100644 --- a/configure.ac +++ b/configure.ac @@ -141,6 +141,13 @@ my_CFLAGS="-Wall \ -Wformat-security" AC_SUBST([my_CFLAGS]) +# Build options +AC_ARG_ENABLE(tests, + AS_HELP_STRING([--disable-tests], + [Build tests (default: yes)]),, + [enable_tests=yes]) +AM_CONDITIONAL(BUILD_TESTS, [test $enable_tests != no]) + AC_CONFIG_HEADERS([config.h tests/unit-test.h]) AC_CONFIG_FILES([ Makefile @@ -167,4 +174,5 @@ AC_MSG_RESULT([ ldflags: ${LDFLAGS} documentation: ${ac_libmodbus_build_doc} + tests: ${enable_tests} ])