build/HACKING: add check for pandoc and update make rule for HACKING.pdf
diff --git a/Makefile.am b/Makefile.am
index b485bc8..3c3b65e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -13,10 +13,10 @@
 	vtysh/Makefile.in vtysh/Makefile.am \
 	tools/zebra.el tools/multiple-bgpd.sh
 
-if HAVE_LATEX
+if HAVE_PANDOC
 
-HACKING.pdf: HACKING.tex
-	$(LATEXMK) -pdf $<
+HACKING.pdf: HACKING.md
+	pandoc -o $@ $<
 
 clean-local:
 	-$(LATEXMK) -C HACKING.tex
diff --git a/configure.ac b/configure.ac
index 1331dee..fe409b4 100755
--- a/configure.ac
+++ b/configure.ac
@@ -83,7 +83,8 @@
 dnl AC_PROG_SED
 AC_CHECK_PROG([SED],[sed],[sed],[/bin/false])
 
-dnl pdflatex and latexmk are needed to build HACKING.pdf
+dnl Check for pdflatex and latexmk, in case someone wants to build
+dnl PDFs from TeX (as used to be case for HACKING)
 AC_CHECK_PROG([PDFLATEX],[pdflatex],[pdflatex],[/bin/false])
 AC_CHECK_PROG([LATEXMK],[latexmk],[latexmk],[/bin/false])
 if test "x$PDFLATEX" = "x/bin/false" -o "x$LATEXMK" = "x/bin/false"; then
@@ -92,6 +93,14 @@
 	HAVE_LATEX=true
 fi
 AM_CONDITIONAL([HAVE_LATEX], [test "x$HAVE_LATEX" = "xtrue"])
+dnl for making HACKING.pdf from HACKING.md using pandoc
+AC_CHECK_PROG([PANDOC],[pandoc],[pandoc],[/bin/false])
+if test "x$PDFLATEX" = "x/bin/false" -o "x$PANDOC" = "x/bin/false"; then
+	AC_MSG_WARN([Will not be able to make PDF versions of MD documents])
+else
+	HAVE_PANDOC=true
+fi
+AM_CONDITIONAL([HAVE_PANDOC], [test "x$HAVE_PANDOC" = "xtrue"])
 
 if test "x${GCC}" != "xyes" ; then
   AC_MSG_CHECKING([whether we are using SunPro compiler])