autoconf: Allow disabling build of test suite
diff --git a/Makefile.am b/Makefile.am
index 84b196d..7da967d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,11 +1,15 @@
 AUTOMAKE_OPTIONS = foreign
 ACLOCAL_AMFLAGS = -I m4
-SUBDIRS = libcnary src include tools test docs
+SUBDIRS = libcnary src include tools docs
 
 if HAVE_CYTHON
 SUBDIRS += cython
 endif
 
+if BUILD_TESTS
+SUBDIRS += test
+endif
+
 if BUILD_FUZZERS
 SUBDIRS += fuzz
 endif
diff --git a/configure.ac b/configure.ac
index a9de503..cb230fa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -202,6 +202,12 @@
             [build_fuzzers=${withval}],
             [build_fuzzers=no])
 
+AC_ARG_WITH([tests],
+            [AS_HELP_STRING([--without-tests],
+            [Do not build libplist test suite (default is yes)])],
+            [build_tests=${withval}],
+            [build_tests=yes])
+
 if test "x$build_fuzzers" = "xyes"; then
     if test "x$build_sanitizers" = "xno"; then
         AC_MSG_ERROR([--with-fuzzers implies --with-sanitizers, but --without-sanitizers was given. This does not work.])
@@ -288,6 +294,7 @@
 fi
 
 AM_CONDITIONAL([BUILD_FUZZERS],[test "x$build_fuzzers" = "xyes"])
+AM_CONDITIONAL([BUILD_TESTS],[test "x$build_tests" != "xno"])
 
 if test "x$build_fuzzers" = "xyes" || test "x$build_sanitizers" = "xyes"; then
     AS_COMPILER_FLAGS(TEST_CFLAGS, [$CFLAGS])