From 1f2423a6a4654842ca5178642244fd88d9ea235d Mon Sep 17 00:00:00 2001
From: Virgile Prevosto <virgile.prevosto@m4x.org>
Date: Wed, 30 Oct 2019 11:54:00 +0100
Subject: [PATCH] [configure] use newly available configure_pkg macro in MdR's
 configure.ac

---
 src/plugins/markdown-report/.gitignore        |  1 +
 .../markdown-report/{Makefile => Makefile.in} |  1 +
 src/plugins/markdown-report/configure.ac      | 29 +++++--------------
 3 files changed, 9 insertions(+), 22 deletions(-)
 rename src/plugins/markdown-report/{Makefile => Makefile.in} (97%)

diff --git a/src/plugins/markdown-report/.gitignore b/src/plugins/markdown-report/.gitignore
index fec8b03f6b4..6c2faaa71d3 100644
--- a/src/plugins/markdown-report/.gitignore
+++ b/src/plugins/markdown-report/.gitignore
@@ -7,6 +7,7 @@ top/
 .depend
 .merlin
 *~
+/Makefile
 /Markdown_report.mli
 /tests/ptests_config
 /tests/*/result
diff --git a/src/plugins/markdown-report/Makefile b/src/plugins/markdown-report/Makefile.in
similarity index 97%
rename from src/plugins/markdown-report/Makefile
rename to src/plugins/markdown-report/Makefile.in
index fae71e12424..a12c2471765 100644
--- a/src/plugins/markdown-report/Makefile
+++ b/src/plugins/markdown-report/Makefile.in
@@ -10,6 +10,7 @@ PLUGIN_CMO:=\
 PLUGIN_REQUIRES:=ppx_deriving ppx_deriving_yojson yojson
 PLUGIN_DISTRIB_EXTERNAL:=share/acsl.xml
 PLUGIN_TESTS_DIRS:= eva
+PLUGIN_ENABLE:=@ENABLE_MDR@
 
 include $(FRAMAC_SHARE)/Makefile.dynamic
 
diff --git a/src/plugins/markdown-report/configure.ac b/src/plugins/markdown-report/configure.ac
index 41588070016..e58d4f1b60c 100644
--- a/src/plugins/markdown-report/configure.ac
+++ b/src/plugins/markdown-report/configure.ac
@@ -1,4 +1,4 @@
-m4_define([plugin_file],Makefile)
+m4_define([plugin_file],Makefile.in)
 
 m4_define([FRAMAC_SHARE_ENV],
           [m4_normalize(m4_esyscmd([echo $FRAMAC_SHARE]))])
@@ -13,27 +13,12 @@ m4_ifndef([FRAMAC_M4_MACROS],
 
 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
+plugin_require_pkg(mdr,ppx_deriving)
+plugin_require_pkg(mdr,ppx_deriving_yojson)
+
+configure_pkg(ppx_deriving,[package ppx_deriving not found])
+configure_pkg(ppx_deriving_yojson,[package ppx_deriving_yojson not found])
 
 check_plugin_dependencies
 
-write_plugin_config()
+write_plugin_config(Makefile)
-- 
GitLab