1From ae92a466e203c8aec43f682a3a7aa617b820c3ba Mon Sep 17 00:00:00 2001
2From: Sergio Prado <sergio.prado@e-labworks.com>
3Date: Sat, 10 Apr 2021 11:03:38 -0300
4Subject: [PATCH] Build unit tests only when --enable-unit-tests is passed
5
6Building unit tests by default requires all dependencies to be
7installed (jpeg, tiff, etc) and users may not want that.
8
9So let's disable the build of unit tests by default and introduce
10--enable-unit-tests configure option to enable it.
11
12Signed-off-by: Sergio Prado <sergio.prado@e-labworks.com>
13Upstream: https://github.com/mono/libgdiplus/pull/701
14---
15 Makefile.am  | 8 ++++++--
16 configure.ac | 4 ++++
17 2 files changed, 10 insertions(+), 2 deletions(-)
18
19diff --git a/Makefile.am b/Makefile.am
20index f40bdee0c2e9..152e0d64fdd9 100644
21--- a/Makefile.am
22+++ b/Makefile.am
23@@ -1,7 +1,11 @@
24 ACLOCAL_AMFLAGS = -I m4
25
26-SUBDIRS = src tests
27-DIST_SUBDIRS = src tests
28+if BUILD_UNIT_TESTS
29+SUBDIRS_TESTS = tests
30+endif
31+
32+SUBDIRS = src $(SUBDIRS_TESTS)
33+DIST_SUBDIRS = src $(SUBDIRS_TESTS)
34
35 pkgconfigdir = $(libdir)/pkgconfig
36
37diff --git a/configure.ac b/configure.ac
38index 098fd0a664bd..c126ff091e58 100644
39--- a/configure.ac
40+++ b/configure.ac
41@@ -39,6 +39,10 @@ if test $warnaserror = "yes"; then
42   GDIPLUS_CFLAGS="$GDIPLUS_CFLAGS -Werror -Wno-unknown-warning-option -Wno-clobbered -Wno-typedef-redefinition"
43 fi
44
45+AC_ARG_ENABLE(unittests, AS_HELP_STRING([--enable-unittests],[Enable building unit tests.]),[unittests=yes],[unittests=no])
46+
47+AM_CONDITIONAL([BUILD_UNIT_TESTS], [test x$unittests = xyes])
48+
49 AC_ARG_ENABLE(asan, AS_HELP_STRING([--enable-asan],[Enable address sanitizer.]),[asan=yes],[asan=no])
50
51 if test $asan = "yes"; then
52--
532.17.1
54
55