summaryrefslogtreecommitdiff
blob: 09fe364487bf923265b6f54dee9b5752f0acac3d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
From 85515b2c196f2e361e93c158201f74177dc4ae37 Mon Sep 17 00:00:00 2001
From: Randy Barlow <randy@electronsweatshop.com>
Date: Sat, 18 Sep 2021 21:56:19 -0400
Subject: [PATCH] Provide a configure flag to use the system doctest

This will allow distributions to more easily maintain
incompatibilies between doctest and the rest of their software.

Fixes #912

Signed-off-by: Randy Barlow <randy@electronsweatshop.com>
---
 configure.ac            |   21 +
 src/Makefile.am         |    4 +
 src/doctest.hh          | 5502 +--------------------------------------
 src/doctest_vendored.hh | 5464 ++++++++++++++++++++++++++++++++++++++
 4 files changed, 5527 insertions(+), 5464 deletions(-)
 create mode 100644 src/doctest_vendored.hh

diff --git a/configure.ac b/configure.ac
index f2127def..33746d1e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -153,6 +153,27 @@ AS_IF([test "x$enable_simd" = "xyes"], [
 ])
 
 
+AC_ARG_WITH([system_doctest],
+    AS_HELP_STRING(
+        [--with-system-doctest],
+        [Use the system provided doctest library rather than the bundled one]
+    ),
+    [], []
+)
+
+AS_IF([test "x$with_system_doctest" = "xyes"], [
+    AC_CHECK_HEADERS(doctest/doctest.h)
+    AS_IF([test "x$ac_cv_header_doctest_doctest_h" != "xyes"], [
+        AC_MSG_ERROR([system doctest not found])dnl
+    ])
+    AC_DEFINE([DOCTEST_HEADER], ["doctest/doctest.h"], [doctest include path])
+])
+AS_IF([test "x$with_system_doctest" != "xyes"], [
+    AC_DEFINE([DOCTEST_HEADER], ["doctest_vendored.hh"], [doctest include path])
+    AS_VAR_SET(doctest_vendored_h, "doctest_vendored.hh")
+    AC_SUBST(doctest_vendored_h)
+])
+
 
 LNAV_WITH_JEMALLOC
 
diff --git a/src/Makefile.am b/src/Makefile.am
index 9be9168e..8dc0cd94 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -151,6 +151,9 @@ dist_noinst_DATA = \
 	$(FORMAT_FILES) \
 	xterm-palette.json
 
+EXTRA_HEADERS = \
+	doctest_vendored.hh
+
 noinst_HEADERS = \
 	all_logs_vtab.hh \
 	ansi_scrubber.hh \
@@ -174,6 +177,7 @@ noinst_HEADERS = \
 	db_sub_source.hh \
 	doc_status_source.hh \
 	doctest.hh \
+	$(doctest_vendored_h) \
 	elem_to_json.hh \
 	environ_vtab.hh \
 	field_overlay_source.hh \