1From 7fe1b8a53cc8c865c2a10dcd8f6cb4e51ccc6300 Mon Sep 17 00:00:00 2001
2From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
3Date: Mon, 29 Jul 2019 12:19:10 +0200
4Subject: [PATCH] configure.ac: add an option to disable tests
5
6Add an option to allow the user to disable tests, this can be useful for
7example when the toolchain does not provide thread. Indeed, in this
8case, libgcrypt fails to build t-lock:
9
10t-lock.c: In function 'run_test':
11t-lock.c:359:3: error: unknown type name 'pthread_t'
12   pthread_t rthread;
13
14Fixes:
15 - http://autobuild.buildroot.org/results/50a8ba572e3fafd3c6a39bd54bcfcaf78b5ad325
16
17Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
18---
19 Makefile.am  |  7 ++++++-
20 configure.ac | 10 ++++++++++
21 2 files changed, 16 insertions(+), 1 deletion(-)
22
23diff --git a/Makefile.am b/Makefile.am
24index 7fa4fa4d..f0bd90e4 100644
25--- a/Makefile.am
26+++ b/Makefile.am
27@@ -40,9 +40,14 @@ else
28 doc =
29 endif
30
31+if BUILD_TESTS
32+tests = tests
33+else
34+tests =
35+endif
36
37 DIST_SUBDIRS = m4 compat mpi cipher random src doc tests
38-SUBDIRS =         compat mpi cipher random src $(doc) tests
39+SUBDIRS =         compat mpi cipher random src $(doc) $(tests)
40
41 EXTRA_DIST = autogen.sh autogen.rc README.GIT LICENSES      	           \
42              ChangeLog-2011 build-aux/ChangeLog-2011 doc/ChangeLog-2011    \
43diff --git a/configure.ac b/configure.ac
44index e8c8cd39..1a6b61e5 100644
45--- a/configure.ac
46+++ b/configure.ac
47@@ -3198,6 +3198,16 @@ AC_ARG_ENABLE([doc], AC_HELP_STRING([--disable-doc],
48 AM_CONDITIONAL([BUILD_DOC], [test "x$build_doc" != xno])
49
50
51+#
52+# Option to disable building of tests
53+#
54+build_tests=yes
55+AC_ARG_ENABLE([tests], AC_HELP_STRING([--disable-tests],
56+                                      [do not build tests]),
57+                       build_tests=$enableval, build_tests=yes)
58+AM_CONDITIONAL([BUILD_TESTS], [test "x$build_tests" != xno])
59+
60+
61 #
62 # Provide information about the build.
63 #
64--
652.20.1
66
67