+# set $IN_GIT_REPO if we're in the Git repository; the `bootstrap` file
+# is not distributed in tarballs
+AS_IF([test -f "$srcdir/bootstrap"], [in_git_repo=yes], [in_git_repo=no])
+AM_CONDITIONAL([IN_GIT_REPO], [test "x$in_git_repo" = "xyes"])
+
+# enable building man pages
+AC_ARG_ENABLE(
+ build-man-pages,
+ AS_HELP_STRING(
+ [--disable-build-man-pages],
+ [Build man pages (already built in a distributed tarball)]
+ ),
+ [build_man_pages=$enableval],
+ [build_man_pages=yes]
+)
+
+# export man page build condition
+AM_CONDITIONAL([BUILD_MAN_PAGES], [test "x$build_man_pages" != "xno"])
+
+# check for asciidoc and xmlto if we enabled building the man pages
+AS_IF([test "x$build_man_pages" = "xyes"], [
+ AC_PATH_PROG([ASCIIDOC], [asciidoc], [no])
+ AC_PATH_PROG([XMLTO], [xmlto], [no])
+
+ AS_IF([test "x$ASCIIDOC" = "xno" || test "x$XMLTO" = "xno"], [
+ AC_MSG_ERROR([Both asciidoc and xmlto are needed to build the LTTng man pages.])
+ ])
+])
+