From f85cd0174e629375bb79f13cda713e3ee810b49f Mon Sep 17 00:00:00 2001 From: Ulya Trofimovich Date: Tue, 29 Jul 2014 17:53:49 +0300 Subject: [PATCH] Enable 'make docs' only if configured with '--enable-docs'. ./configure --enable-docs checks for asciidoc and a2x --- re2c/Makefile.am | 22 +++++++++------------- re2c/configure.ac | 15 +++++++++++---- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/re2c/Makefile.am b/re2c/Makefile.am index a7b4ae36..708cc117 100755 --- a/re2c/Makefile.am +++ b/re2c/Makefile.am @@ -21,12 +21,6 @@ RE2C = re2c$(EXEEXT) 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) @@ -101,12 +95,14 @@ vtests: all $(TESTS) 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 diff --git a/re2c/configure.ac b/re2c/configure.ac index 9cac446c..1d226152 100644 --- a/re2c/configure.ac +++ b/re2c/configure.ac @@ -16,10 +16,17 @@ AC_CHECK_PROG(BISON, bison, yes, no) 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]) -- 2.40.0