]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
add pandoc / asciidoc to configure checks. Fixes #2622
authorAlan T. DeKok <aland@freeradius.org>
Tue, 23 Apr 2019 13:24:50 +0000 (09:24 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Tue, 23 Apr 2019 13:25:12 +0000 (09:25 -0400)
Make.inc.in
configure
configure.ac
doc/all.mk

index bb03b1e27af27b9445a7fc5d93300c130396fb15..406569f8324eb93ba678bc442120adfa5fdd4bb3 100644 (file)
@@ -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@
index 3a47af78cdd988ed6594f3160d2af011bc411515..26066eb46f471f684fe7f00baf7952b74a4aeed0 100755 (executable)
--- 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
index d88395d89caf5c69985b90626d6877bd49232d75..46de819429b7c974b60c3677ba1f7f98f2b7861d 100644 (file)
@@ -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
index e2c86cb78f3a81713b7fd1bf9612441d5e4d3674..b6218231fdc5aec7fdce2a65682ff98e2b0896e9 100644 (file)
@@ -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 $@ $<