blob: 450286462ef92bc39c02082ef53e91e8ee9e5197 [file] [log] [blame]
From ae92a466e203c8aec43f682a3a7aa617b820c3ba Mon Sep 17 00:00:00 2001
From: Sergio Prado <sergio.prado@e-labworks.com>
Date: Sat, 10 Apr 2021 11:03:38 -0300
Subject: [PATCH] Build unit tests only when --enable-unit-tests is passed
Building unit tests by default requires all dependencies to be
installed (jpeg, tiff, etc) and users may not want that.
So let's disable the build of unit tests by default and introduce
--enable-unit-tests configure option to enable it.
Signed-off-by: Sergio Prado <sergio.prado@e-labworks.com>
---
Makefile.am | 8 ++++++--
configure.ac | 4 ++++
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index f40bdee0c2e9..152e0d64fdd9 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,7 +1,11 @@
ACLOCAL_AMFLAGS = -I m4
-SUBDIRS = src tests
-DIST_SUBDIRS = src tests
+if BUILD_UNIT_TESTS
+SUBDIRS_TESTS = tests
+endif
+
+SUBDIRS = src $(SUBDIRS_TESTS)
+DIST_SUBDIRS = src $(SUBDIRS_TESTS)
pkgconfigdir = $(libdir)/pkgconfig
diff --git a/configure.ac b/configure.ac
index 098fd0a664bd..c126ff091e58 100644
--- a/configure.ac
+++ b/configure.ac
@@ -39,6 +39,10 @@ if test $warnaserror = "yes"; then
GDIPLUS_CFLAGS="$GDIPLUS_CFLAGS -Werror -Wno-unknown-warning-option -Wno-clobbered -Wno-typedef-redefinition"
fi
+AC_ARG_ENABLE(unittests, AS_HELP_STRING([--enable-unittests],[Enable building unit tests.]),[unittests=yes],[unittests=no])
+
+AM_CONDITIONAL([BUILD_UNIT_TESTS], [test x$unittests = xyes])
+
AC_ARG_ENABLE(asan, AS_HELP_STRING([--enable-asan],[Enable address sanitizer.]),[asan=yes],[asan=no])
if test $asan = "yes"; then
--
2.17.1