From fabe9c83b50dea61bbd852a482eda6250d712755 Mon Sep 17 00:00:00 2001
From: Virgile Prevosto <virgile.prevosto@m4x.org>
Date: Tue, 22 Oct 2019 14:46:06 +0200
Subject: [PATCH] [configure] do not compile mdr if ppx_deriving is not present

---
 src/plugins/markdown-report/configure.ac | 39 ++++++++++++++++++++++++
 1 file changed, 39 insertions(+)
 create mode 100644 src/plugins/markdown-report/configure.ac

diff --git a/src/plugins/markdown-report/configure.ac b/src/plugins/markdown-report/configure.ac
new file mode 100644
index 00000000000..41588070016
--- /dev/null
+++ b/src/plugins/markdown-report/configure.ac
@@ -0,0 +1,39 @@
+m4_define([plugin_file],Makefile)
+
+m4_define([FRAMAC_SHARE_ENV],
+          [m4_normalize(m4_esyscmd([echo $FRAMAC_SHARE]))])
+
+m4_define([FRAMAC_SHARE],
+	  [m4_ifval(FRAMAC_SHARE_ENV,[FRAMAC_SHARE_ENV],
+                                     [m4_esyscmd(frama-c -print-path)])])
+
+m4_ifndef([FRAMAC_M4_MACROS],
+         [m4_include(FRAMAC_SHARE/configure.ac)]
+        )
+
+check_plugin(mdr,PLUGIN_RELATIVE_PATH(plugin_file),[Mardown/SARIF report plug-in],yes)
+
+AC_MSG_CHECKING(for ppx_deriving)
+if $OCAMLFIND query ppx_deriving -qo -qe; then
+  HAS_PPX_DERIVING=yes;
+  AC_MSG_RESULT(yes)
+  AC_MSG_CHECKING(for ppx_deriving_yojson)
+  if $OCAMLFIND query ppx_deriving_yojson -qo -qe; then
+    HAS_PPX_DERIVING_YOJSON=yes;
+  else
+    HAS_PPX_DERIVING_YOJSON=no;
+  fi
+  AC_MSG_RESULT($HAS_PPX_DERIVING_YOJSON);
+else
+  HAS_PPX_DERIVING=no;
+  HAS_PPX_DERIVING_YOJSON=no;
+  AC_MSG_RESULT(no)
+fi
+
+if test "$HAS_PPX_DERIVING_YOJSON" != "yes"; then
+   plugin_disable(mdr, [ppx_deriving_yojson not available]);
+fi
+
+check_plugin_dependencies
+
+write_plugin_config()
-- 
GitLab