From 85515b2c196f2e361e93c158201f74177dc4ae37 Mon Sep 17 00:00:00 2001 From: Randy Barlow 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 --- 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 \