8217032: Check pandoc capabilities in configure
authorerikj
Tue, 19 Feb 2019 12:44:56 -0800
changeset 53830 e403ff78116c
parent 53829 56dc0b27536c
child 53831 c419f0c1c355
8217032: Check pandoc capabilities in configure Reviewed-by: mikael, ihse
make/autoconf/basics.m4
make/autoconf/spec.gmk.in
make/common/ProcessMarkdown.gmk
--- a/make/autoconf/basics.m4	Tue Feb 19 12:43:10 2019 -0800
+++ b/make/autoconf/basics.m4	Tue Feb 19 12:44:56 2019 -0800
@@ -618,14 +618,6 @@
   BASIC_PATH_PROGS(CPIO, [cpio bsdcpio])
   BASIC_PATH_PROGS(NICE, nice)
 
-  BASIC_PATH_PROGS(PANDOC, pandoc)
-  if test -n "$PANDOC"; then
-    ENABLE_PANDOC="true"
-  else
-    ENABLE_PANDOC="false"
-  fi
-  AC_SUBST(ENABLE_PANDOC)
-
   BASIC_PATH_PROGS(LSB_RELEASE, lsb_release)
   BASIC_PATH_PROGS(CMD, [cmd.exe /mnt/c/Windows/System32/cmd.exe])
 ])
@@ -1193,6 +1185,7 @@
   BASIC_CHECK_FIND_DELETE
   BASIC_CHECK_TAR
   BASIC_CHECK_GREP
+  BASIC_SETUP_PANDOC
 
   # These tools might not be installed by default,
   # need hint on how to install them.
@@ -1379,6 +1372,34 @@
 
 ################################################################################
 #
+# Setup Pandoc
+#
+AC_DEFUN_ONCE([BASIC_SETUP_PANDOC],
+[
+  BASIC_PATH_PROGS(PANDOC, pandoc)
+
+  PANDOC_MARKDOWN_FLAG="markdown"
+  if test -n "$PANDOC"; then
+    AC_MSG_CHECKING(if the pandoc smart extension needs to be disabled for markdown)
+    if $PANDOC --list-extensions | $GREP -q '\+smart'; then
+      AC_MSG_RESULT([yes])
+      PANDOC_MARKDOWN_FLAG="markdown-smart"
+    else
+      AC_MSG_RESULT([no])
+    fi
+  fi
+
+  if test -n "$PANDOC"; then
+    ENABLE_PANDOC="true"
+  else
+    ENABLE_PANDOC="false"
+  fi
+  AC_SUBST(ENABLE_PANDOC)
+  AC_SUBST(PANDOC_MARKDOWN_FLAG)
+])
+
+################################################################################
+#
 # Default make target
 #
 AC_DEFUN_ONCE([BASIC_SETUP_DEFAULT_MAKE_TARGET],
--- a/make/autoconf/spec.gmk.in	Tue Feb 19 12:43:10 2019 -0800
+++ b/make/autoconf/spec.gmk.in	Tue Feb 19 12:44:56 2019 -0800
@@ -774,6 +774,7 @@
 UCRT_DLL_DIR:=@UCRT_DLL_DIR@
 STLPORT_LIB:=@STLPORT_LIB@
 ENABLE_PANDOC:=@ENABLE_PANDOC@
+PANDOC_MARKDOWN_FLAG:=@PANDOC_MARKDOWN_FLAG@
 
 ####################################################
 #
--- a/make/common/ProcessMarkdown.gmk	Tue Feb 19 12:43:10 2019 -0800
+++ b/make/common/ProcessMarkdown.gmk	Tue Feb 19 12:44:56 2019 -0800
@@ -80,7 +80,8 @@
 	$$(call LogInfo, Converting $2 to $$($1_FORMAT))
 	$$(call MakeDir, $$(SUPPORT_OUTPUTDIR)/markdown $$(dir $$($1_$2_PANDOC_OUTPUT)))
 	$$(call ExecuteWithLog, $$(SUPPORT_OUTPUTDIR)/markdown/$$($1_$2_MARKER), \
-	    $$(PANDOC) $$($1_OPTIONS) -f markdown-smart -t $$($1_FORMAT) --standalone \
+	    $$(PANDOC) $$($1_OPTIONS) -f $$(PANDOC_MARKDOWN_FLAG) \
+	    -t $$($1_FORMAT) --standalone \
 	    $$($1_$2_CSS_OPTION) $$($1_$2_OPTIONS) '$$($1_$2_PANDOC_INPUT)' \
 	    -o '$$($1_$2_PANDOC_OUTPUT)')
         ifneq ($$(findstring $$(LOG_LEVEL), debug trace),)