From 671086111c2e9edd559a5d3b5319329d7ad55d16 Mon Sep 17 00:00:00 2001 From: Yegor Yefremov Date: Mon, 25 Apr 2016 10:06:27 +0200 Subject: [PATCH] Add an option to disable tests compilation --- Makefile.am | 6 +++++- configure.ac | 8 ++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) 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} ]) -- libgit2 0.21.4