From: Alan T. DeKok Date: Tue, 23 Apr 2019 13:24:50 +0000 (-0400) Subject: add pandoc / asciidoc to configure checks. Fixes #2622 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3149f875fcd87a71aaa956c50ab4fe7bac4cc3d3;p=thirdparty%2Ffreeradius-server.git add pandoc / asciidoc to configure checks. Fixes #2622 --- diff --git a/Make.inc.in b/Make.inc.in index bb03b1e27af..406569f8324 100644 --- a/Make.inc.in +++ b/Make.inc.in @@ -173,3 +173,10 @@ ANALYZE.c := @clang_path@ # TESTBINDIR = ./$(BUILD_DIR)/bin/local TESTBIN = $(JLIBTOOL) --quiet --mode=execute $(TESTBINDIR) + +# +# For creating documentation via doc/all.mk +# +ASCIIDOCTOR := @ASCIIDOCTOR@ +PANDOC := @PANDOC@ +PANDOC_ENGINE := @PANDOC_ENGINE@ diff --git a/configure b/configure index 3a47af78cdd..26066eb46f4 100755 --- a/configure +++ b/configure @@ -693,6 +693,9 @@ build_os build_vendor build_cpu build +PANDOC_ENGINE +PANDOC +ASCIIDOCTOR GIT RADIUSD_VERSION_STRING target_alias @@ -2578,6 +2581,106 @@ fi +# Extract the first word of "asciidoctor", so it can be a program name with args. +set dummy asciidoctor; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_ASCIIDOCTOR+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $ASCIIDOCTOR in + [\\/]* | ?:[\\/]*) + ac_cv_path_ASCIIDOCTOR="$ASCIIDOCTOR" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_ASCIIDOCTOR="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +ASCIIDOCTOR=$ac_cv_path_ASCIIDOCTOR +if test -n "$ASCIIDOCTOR"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ASCIIDOCTOR" >&5 +$as_echo "$ASCIIDOCTOR" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +if test "x$ac_cv_path_ASCIIDOCTOR" = "x"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: asciidoctor not found - Please install if you want build the docs" >&5 +$as_echo "$as_me: WARNING: asciidoctor not found - Please install if you want build the docs" >&2;} +fi + + # Extract the first word of "pandoc", so it can be a program name with args. +set dummy pandoc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_PANDOC+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $PANDOC in + [\\/]* | ?:[\\/]*) + ac_cv_path_PANDOC="$PANDOC" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_PANDOC="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +PANDOC=$ac_cv_path_PANDOC +if test -n "$PANDOC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PANDOC" >&5 +$as_echo "$PANDOC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +if test "x$ac_cv_path_PANDOC" = "x"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: pandoc not found - Please install if you want build the docs" >&5 +$as_echo "$as_me: WARNING: pandoc not found - Please install if you want build the docs" >&2;} +else + # + # Pandoc v2 onwards renamed --latex-engine to --pdf-engine + # + if pandoc --help 2>&1 | grep -q "latex-engine"; then + PANDOC_ENGINE=latex + else + PANDOC_ENGINE=pdf + fi + +fi + # Check whether --enable-developer was given. if test "${enable_developer+set}" = set; then : enableval=$enable_developer; case "$enableval" in diff --git a/configure.ac b/configure.ac index d88395d89ca..46de819429b 100644 --- a/configure.ac +++ b/configure.ac @@ -82,6 +82,29 @@ dnl # See if we have Git. dnl # AC_CHECK_PROG(GIT, git, yes, no) +dnl # +dnl # check for ASCIIDOCTOR and pandoc +dnl # +AC_PATH_PROG(ASCIIDOCTOR, asciidoctor) +if test "x$ac_cv_path_ASCIIDOCTOR" = "x"; then + AC_MSG_WARN([asciidoctor not found - Please install if you want build the docs]) +fi + + AC_PATH_PROG(PANDOC, pandoc) +if test "x$ac_cv_path_PANDOC" = "x"; then + AC_MSG_WARN([pandoc not found - Please install if you want build the docs]) +else + # + # Pandoc v2 onwards renamed --latex-engine to --pdf-engine + # + if pandoc --help 2>&1 | grep -q "latex-engine"; then + PANDOC_ENGINE=latex + else + PANDOC_ENGINE=pdf + fi + AC_SUBST(PANDOC_ENGINE) +fi + dnl # dnl # Enable developer features like debugging symbols. dnl # These checks must be done before expanding the AC_PROG_CC diff --git a/doc/all.mk b/doc/all.mk index e2c86cb78f3..b6218231fdc 100644 --- a/doc/all.mk +++ b/doc/all.mk @@ -1,4 +1,24 @@ -ifneq "$(docdir)" "no" +# +# Check if we can build the documentation. +# +# We try to build it, but turn off the build unless +# all of the prerequisites have been found. +# +WITH_DOCS=yes + +ifeq "$(ASCIIDOCTOR)" "" +WITH_DOCS=no +endif + +ifeq "$(PANDOC)" "" +WITH_DOCS=no +endif + +ifeq "$(docdir)" "no" +WITH_DOCS=no +endif + +ifeq "$(WITH_DOCS)" "yes" # # Running "shell" is expensive on OSX. Building the documentation @@ -49,29 +69,6 @@ install.doc: $(DOCINSTALL) clean.doc: ${Q}rm -f *~ rfc/*~ examples/*~ $(ADOC_FILES) $(HTML_FILES) $(PDF_FILES) -# -# Checking some dependencies -# -ifneq "$(strip $(foreach x,html pdf adoc asciidoc,$(findstring $(x),$(MAKECMDGOALS))))" "" -ifeq ($(shell which pandoc 2>/dev/null),) -$(error You need to install pandoc) -endif -endif - -ifneq "$(strip $(foreach x,adoc asciidoc,$(findstring $(x),$(MAKECMDGOALS))))" "" -ifeq ($(shell which asciidoctor 2>/dev/null),) -$(error You need to install asciidoctor) -endif -endif - -# -# Pandoc v2 onwards renamed --latex-engine to --pdf-engine -# -PANDOC_ENGINE=pdf -ifneq ($(shell pandoc --help | grep latex-engine),) -PANDOC_ENGINE=latex -endif - # # Markdown files get converted to asciidoc via pandoc. # @@ -82,7 +79,7 @@ endif doc/raddb/%.adoc: raddb/%.md @echo PANDOC $^ @mkdir -p $(dir $@) - @pandoc --filter=scripts/asciidoc/pandoc-filter -w asciidoc -o $@ $^ + @$(PANDOC) --filter=scripts/asciidoc/pandoc-filter -w asciidoc -o $@ $^ # # Conf files get converted to Asciidoc via our own magic script. @@ -95,19 +92,19 @@ doc/raddb/%.adoc: raddb/% doc/%.html: doc/%.adoc @echo HTML $^ - @asciidoctor $< -b html5 -o $@ $< + @$(ASCIIDOCTOR) $< -b html5 -o $@ $< doc/%.pdf: doc/%.adoc @echo PDF $^ - @asciidoctor $< -b docbook5 -o - | \ - pandoc -f docbook -t latex --${PANDOC_ENGINE}-engine=xelatex \ + @$(ASCIIDOCTOR) $< -b docbook5 -o - | \ + $(PANDOC) -f docbook -t latex --${PANDOC_ENGINE}-engine=xelatex \ -V papersize=letter \ -V images=yes \ --template=./scripts/asciidoc/freeradius.template -o $@ doc/%.pdf: doc/%.md @echo PDF $^ - pandoc -f markdown -t latex --${PANDOC_ENGINE}-engine=xelatex \ + @$(PANDOC) -f markdown -t latex --${PANDOC_ENGINE}-engine=xelatex \ -V papersize=letter \ --template=./scripts/asciidoc/freeradius.template -o $@ $<