From: Michael Jeanson Date: Mon, 12 Feb 2024 22:53:42 +0000 (-0500) Subject: Add a configure option to disable tests X-Git-Tag: RELEASE_1_4_5~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4bb86f7a08a568e9ee25a5a01c7cc771b20edc09;p=thirdparty%2Fmlmmj.git Add a configure option to disable tests With the previous behavior, a missing dependency would silently disable the test suite and could be error prone. Add a configure option to explicitly disable the tests and build without Kyua and libatf. Signed-off-by: Michael Jeanson --- diff --git a/Makefile.am b/Makefile.am index c4d214b3..968a1947 100644 --- a/Makefile.am +++ b/Makefile.am @@ -12,7 +12,7 @@ man1_MANS = man/mlmmj-bounce.1 man/mlmmj-make-ml.1 man/mlmmj-receive.1 \ SUBDIRS = src listtexts contrib -if TESTS +if WANT_TESTS SUBDIRS += tests check: $(check_SCRIPTS) $(check_PROGRAMS) diff --git a/configure.ac b/configure.ac index 16681d9c..b95548a9 100644 --- a/configure.ac +++ b/configure.ac @@ -66,13 +66,22 @@ AC_ARG_ENABLE([receive-strip], [build mlmmj-receive-strip (default is no)])) AM_CONDITIONAL(WANT_RECEIVESTRIP, test x"$enable_receive_strip" = xyes) +AC_ARG_ENABLE([tests], + AS_HELP_STRING([--disable-tests], + [build tests (default is yes)]), + [:], [enable_tests=yes] +) + # Checks for library functions. AC_FUNC_MALLOC AC_CHECK_FUNCS([syslog]) AC_CHECK_FUNCS([arc4random_uniform copy_file_range]) -PKG_CHECK_MODULES([ATF], [atf-c], [HAVE_ATF=1], [NO_ATF=1]) -AC_CHECK_PROG([KYUA], [kyua], [HAVE_KYUA=1]) -AM_CONDITIONAL([TESTS], [test "x$HAVE_ATF" = x1 -a "x$HAVE_KYUA" = x1 ]) + +AS_IF([test x"$enable_tests" = xyes], [ + PKG_CHECK_MODULES([ATF], [atf-c]) + AC_PATH_PROG([KYUA], [kyua]) +]) +AM_CONDITIONAL([WANT_TESTS], [test x"$enable_tests" = xyes]) AM_CPPFLAGS="-I\$(top_srcdir)/include -DDEFAULTTEXTDIR='\"\$(textlibdir)\"'" AC_SUBST(AM_CPPFLAGS)