RE2CFLAGS = -bi
CLEANFILES = parser.cc y.tab.c y.tab.h scanner.cc .version
-if HAVE_ASCIIDOC
- CLEANFILES += htdocs/manual.html
-endif HAVE_ASCIIDOC
-if HAVE_A2X
- CLEANFILES += re2c.1
-endif HAVE_A2X
DISTCLEANFILES = makerpm re2c.spec README scanner.cc re2c$(EXEEXT)
test -x $(TESTS) || chmod +x $(TESTS)
./$(TESTS) --valgrind
+if REBUILD_DOCS
docs: $(DOCS)
$(DOCS): re2c.ad
- @if test $(A2X) = "yes"; then \
- a2x -f manpage re2c.ad; \
- fi
- @if test $(ASCIIDOC) = "yes"; then \
- mkdir -p htdocs; \
- asciidoc -o htdocs/manual.html re2c.ad; \
- fi
+ a2x -f manpage re2c.ad
+ mkdir -p htdocs
+ asciidoc -o htdocs/manual.html re2c.ad
+else
+docs:
+ @echo "Reconfigure to rebuild docs: ./configure --enable-docs"
+ @exit 1
+endif
AC_PROG_CXX
AC_PROG_CC
AC_PROG_INSTALL
-AC_CHECK_PROG(ASCIIDOC, asciidoc, yes, no)
-AM_CONDITIONAL(HAVE_ASCIIDOC, [test "$ASCIIDOC" = yes])
-AC_CHECK_PROG(A2X, a2x, yes, no)
-AM_CONDITIONAL(HAVE_A2X, [test "$A2X" == yes])
+
+dnl --enable-docs
+AC_ARG_ENABLE([docs], [AS_HELP_STRING([--enable-docs], [regenerate man page and online documentation])])
+AM_CONDITIONAL([REBUILD_DOCS], [test "x$enable_docs" = "xyes"])
+AM_COND_IF([REBUILD_DOCS], [
+ AC_CHECK_PROG(ASCIIDOC, asciidoc, yes, no)
+ AC_CHECK_PROG(A2X, a2x, yes, no)
+ AS_IF([test "x$ASCIIDOC" = "xno" -o "x$A2X" = "xno"], [
+ AC_MSG_ERROR([need asciidoc and a2x for --enable-docs])
+ ])
+])
if test "$GCC" = "yes"; then
AC_MSG_CHECKING([Testing GCC version])