changeset 29684:490e400d4df0

build: Show warning if RapidJSON is not found by configure (bug #60610). * configure.ac: Show warning if RapidJSON is not found by configure.
author Markus Mützel <markus.muetzel@gmx.de>
date Sun, 16 May 2021 11:42:27 +0200
parents 5ffe7159f94b
children 29c93cd14d1e
files configure.ac
diffstat 1 files changed, 14 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/configure.ac	Sun May 16 19:11:15 2021 +0200
+++ b/configure.ac	Sun May 16 11:42:27 2021 +0200
@@ -1374,14 +1374,22 @@
 
 ### Check for RapidJSON header only library.
 
+warn_rapidjson=
 AC_LANG_PUSH(C++)
 AC_CHECK_HEADER([rapidjson/rapidjson.h],
-                [have_rapidjson=yes], [have_rapidjson=no])
+                [have_rapidjson=yes],
+                [have_rapidjson=no
+                 warn_rapidjson="RapidJSON library not found.  Octave will not be able to read or write JSON files."])
 
 if test $have_rapidjson = yes; then
   AC_DEFINE(HAVE_RAPIDJSON, 1, [Define to 1 if RapidJSON is available.])
 
   ## Additional check on RapidJSON library that was found
+  ## Some features of the version of RapidJSON that is packaged in many
+  ## distributions do not build correctly with newer compilers.
+  ## See also:
+  ## https://github.com/Tencent/rapidjson/issues/909
+  ## https://github.com/Tencent/rapidjson/issues/1718
   AC_CACHE_CHECK([for working PrettyWriter in RapidJSON],
     [octave_cv_rapidjson_has_prettywriter],
     [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
@@ -1399,12 +1407,15 @@
     AC_DEFINE(HAVE_RAPIDJSON_PRETTYWRITER, 1,
       [Define to 1 if the RapidJSON PrettyWriter function is available.])
   else
-    rapid_json_warning='Older RapidJSON library found.  The "PrettyWriter" option in jsonencode will be disabled.'
-    OCTAVE_CONFIGURE_WARNING([rapid_json_warning])
+    warn_rapidjson='RapidJSON library found, but does not seem to work properly.  The "PrettyWriter" option in jsonencode will be disabled.'
   fi
 fi
 AC_LANG_POP([C++])
 
+if test -n "$warn_rapidjson"; then
+  OCTAVE_CONFIGURE_WARNING([warn_rapidjson])
+fi
+
 ### Check for readline library.
 
 OCTAVE_ENABLE_READLINE