Fix configure's search for collateindex.pl.
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 22 Mar 2012 04:46:03 +0000 (00:46 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 22 Mar 2012 04:46:03 +0000 (00:46 -0400)
PGAC_PATH_COLLATEINDEX supposed that it could use AC_PATH_PROGS to search
for collateindex.pl, but that macro will only accept files that are marked
executable, and at least some DocBook installations don't mark the script
executable (a case the docs Makefile was already prepared for).  Accept the
script if it's present and readable in $DOCBOOKSTYLE/bin, and otherwise
search the PATH as before.

Having fixed that up, we don't need the fallback case that was in the docs
Makefile, and instead can throw an understandable error if configure didn't
find the script.  Per recent trouble report from John Lumby.

config/docbook.m4
configure
doc/src/sgml/Makefile

index 636aefed4c1094d42a1d1571fea4e01c2a4f051a..4304fa7ea1374d6def90963d2b72ef8460e79d87 100644 (file)
@@ -89,11 +89,14 @@ fi])# PGAC_PATH_DOCBOOK_STYLESHEETS
 
 # PGAC_PATH_COLLATEINDEX
 # ----------------------
+# Some DocBook installations provide collateindex.pl in $DOCBOOKSTYLE/bin,
+# but it's not necessarily marked executable, so we can't use AC_PATH_PROG
+# to check for it there.  Other installations just put it in the PATH.
 AC_DEFUN([PGAC_PATH_COLLATEINDEX],
 [AC_REQUIRE([PGAC_PATH_DOCBOOK_STYLESHEETS])dnl
-if test -n "$DOCBOOKSTYLE"; then
-  AC_PATH_PROGS(COLLATEINDEX, collateindex.pl, [],
-                [$DOCBOOKSTYLE/bin $PATH])
+if test -n "$DOCBOOKSTYLE" -a -r "$DOCBOOKSTYLE/bin/collateindex.pl"; then
+  COLLATEINDEX="$DOCBOOKSTYLE/bin/collateindex.pl"
+  AC_SUBST([COLLATEINDEX])
 else
-  AC_PATH_PROGS(COLLATEINDEX, collateindex.pl)
+  AC_PATH_PROG(COLLATEINDEX, collateindex.pl)
 fi])# PGAC_PATH_COLLATEINDEX
index 84d18a263d8fa73c65ca429d470fbe0aefde90f9..26e6b631a6486e7e6bbda1134ad0adcae6d6241b 100755 (executable)
--- a/configure
+++ b/configure
@@ -29430,57 +29430,12 @@ else
   { $as_echo "$as_me:$LINENO: result: no" >&5
 $as_echo "no" >&6; }
 fi
-if test -n "$DOCBOOKSTYLE"; then
-  for ac_prog in collateindex.pl
-do
-  # Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_COLLATEINDEX+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  case $COLLATEINDEX in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_COLLATEINDEX="$COLLATEINDEX" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $DOCBOOKSTYLE/bin $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_path_COLLATEINDEX="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
+if test -n "$DOCBOOKSTYLE" -a -r "$DOCBOOKSTYLE/bin/collateindex.pl"; then
+  COLLATEINDEX="$DOCBOOKSTYLE/bin/collateindex.pl"
 
-  ;;
-esac
-fi
-COLLATEINDEX=$ac_cv_path_COLLATEINDEX
-if test -n "$COLLATEINDEX"; then
-  { $as_echo "$as_me:$LINENO: result: $COLLATEINDEX" >&5
-$as_echo "$COLLATEINDEX" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-  test -n "$COLLATEINDEX" && break
-done
-
-else
-  for ac_prog in collateindex.pl
-do
-  # Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
+  # Extract the first word of "collateindex.pl", so it can be a program name with args.
+set dummy collateindex.pl; ac_word=$2
 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_path_COLLATEINDEX+set}" = set; then
@@ -29519,9 +29474,6 @@ $as_echo "no" >&6; }
 fi
 
 
-  test -n "$COLLATEINDEX" && break
-done
-
 fi
 for ac_prog in xsltproc
 do
index 19e640b5d252bcfb962764057aaad71e242947f9..04fba434509dcb0adfa04a77e0ceb416271c0e88 100644 (file)
@@ -27,10 +27,6 @@ all: html man
 distprep: html distprep-man
 
 
-ifndef COLLATEINDEX
-COLLATEINDEX = $(DOCBOOKSTYLE)/bin/collateindex.pl
-endif
-
 ifndef JADE
 JADE = jade
 endif
@@ -120,7 +116,11 @@ HTML.index: postgres.sgml $(ALMOSTALLSGML) stylesheet.dsl
        $(JADE.html.call) -V html-index $<
 
 bookindex.sgml: HTML.index
+ifdef COLLATEINDEX
        LC_ALL=C $(PERL) $(COLLATEINDEX) -f -g -i 'bookindex' -o $@ $<
+else
+       @$(missing) collateindex.pl $< $@
+endif
 
 # Technically, this should depend on Makefile.global, but then
 # version.sgml would need to be rebuilt after every configure run,