From fb2e460df9598a3f478036f1e95c7b39de4c3853 Mon Sep 17 00:00:00 2001 From: "Yann E. MORIN" Date: Tue, 4 Dec 2018 08:30:09 +0100 Subject: [PATCH] buildsys: add option to enable/disable building tests When doing cross-compilation, the tests are meant to be run on the target. However, they are currently not installed, so it does not make sense to build tehm to start with. Additionally, when doing a system for production, those tests are not needed anyway. Add a configure option to disable building the tests altogether. Signed-off-by: "Yann E. MORIN" --- Makefile.am | 5 ++++- configure.ac | 8 ++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 7d8164a..60fe178 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,5 +1,8 @@ # Generic definitions -SUBDIRS = lib doc utils test-tool tests examples +SUBDIRS = lib doc utils test-tool examples +if BUILD_TESTS +SUBDIRS += tests +endif ACLOCAL_AMFLAGS =-I m4 AUTOMAKE_OPTIONS = foreign subdir-objects diff --git a/configure.ac b/configure.ac index 54f9d4f..69cefd5 100644 --- a/configure.ac +++ b/configure.ac @@ -47,6 +47,14 @@ AC_ARG_ENABLE([manpages], AM_CONDITIONAL(BUILD_MANPAGES, [expr "$ENABLE_MANPAGES" : yes > /dev/null 2>&1]) +AC_ARG_ENABLE([tests], + [AC_HELP_STRING([--enable-tests], + [Enable building tests])], + [ENABLE_TESTS=$enableval], + [ENABLE_TESTS=yes]) +AM_CONDITIONAL([BUILD_TESTS], + [expr "$ENABLE_TESTS" : yes > /dev/null 2>&1]) + AC_CONFIG_HEADER(config.h) AC_CHECK_LIB([gcrypt], [gcry_control])