### Building the manpage
man_MANS = jq.1
+.PHONY: real_docs
+if ENABLE_DOCS
jq.1: $(srcdir)/docs/content/3.manual/manual.yml
( cd ${abs_srcdir}/docs; rake manpage ) > $@ || { rm -f $@; false; }
+real_docs:
+ true
+else
+jq.1: jq.1.default
+ cp $^ $@
+real_docs:
+ @echo "Cannot build full manpage" > /dev/stderr
+ false
+endif
install-binaries: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) install-exec
+# Ensure "make dist" fails when we can't build the real manpage
+dist-hook: real_docs
# setup is only used by distribution developers, not package developers.
# Still, as a matter of allowing patching, its not a bad idea to distribute
fi
-dnl Check for flex
-AC_CHECK_PROGS(flex_cmd, flex)
-if test x$flex_cmd = "x" ; then
- AC_MSG_NOTICE([flex is required to patch jq.])
-fi
-
dnl Check for valgrind
AC_CHECK_PROGS(valgrind_cmd, valgrind)
-if test x$valgrind_cmd = "x" ; then
- AC_MSG_NOTICE([valgrind is required to test jq.])
+if test "x$valgrind_cmd" = "x" ; then
+ AC_MSG_WARN([valgrind is required to test jq.])
fi
+
+dnl Don't attempt to build docs if there's no Ruby lying around
+AC_ARG_ENABLE([docs],
+ AC_HELP_STRING([--disable-docs], [don't build docs]))
+
+AS_IF([test "x$enable_docs" != "xno"],[
+ AC_CHECK_PROG(bundle_cmd, bundle)
+ AS_IF([test "x$bundle_cmd" = "x" || \
+ ! ( cd ${srcdir}/docs; bundle check 2>/dev/null )],[
+ AC_MSG_WARN([no bundler])
+ enable_docs=no
+ ])
+])
+
+AM_CONDITIONAL([ENABLE_DOCS], [test "x$enable_docs" != xno])
+
dnl AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_HEADERS(config.h)
AM_INIT_AUTOMAKE([-Wall])