]> git.ipfire.org Git - thirdparty/mlmmj.git/commitdiff
Add a configure option to disable tests
authorMichael Jeanson <mjeanson@debian.org>
Mon, 12 Feb 2024 22:53:42 +0000 (17:53 -0500)
committerMichael Jeanson <mjeanson@debian.org>
Wed, 14 Feb 2024 16:53:37 +0000 (11:53 -0500)
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 <mjeanson@debian.org>
Makefile.am
configure.ac

index c4d214b3caa4e7a33b534fbefd64cb42b3689d1f..968a1947de8b1662c44a6a29dc4d65274b0e610e 100644 (file)
@@ -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)
index 16681d9c307aa62a361a9d1a17ad3e7ae268b30e..b95548a90877f6b9b51083eebb1c07ee831e570e 100644 (file)
@@ -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)