Commit b21c569c authored by Tom Lane's avatar Tom Lane

Further improve consistency of configure's program searching.

Peter Eisentraut noted that commit 40b9f192 had broken a configure
behavior that some people might rely on: AC_CHECK_PROGS(FOO,...) will
allow the search to be overridden by specifying a value for FOO on
configure's command line or in its environment, but AC_PATH_PROGS(FOO,...)
accepts such an override only if it's an absolute path.  We had worked
around that behavior for some, but not all, of the pre-existing uses
of AC_PATH_PROGS by just skipping the macro altogether when FOO is
already set.  Let's standardize on that workaround for all uses of
AC_PATH_PROGS, new and pre-existing, by wrapping AC_PATH_PROGS in a
new macro PGAC_PATH_PROGS.  While at it, fix a deficiency of the old
workaround code by making sure we report the setting to configure's log.

Eventually I'd like to improve PGAC_PATH_PROGS so that it converts
non-absolute override inputs to absolute form, eg "PYTHON=python3"
becomes, say, PYTHON = /usr/bin/python3.  But that will take some
nontrivial coding so it doesn't seem like a thing to do in late beta.

Discussion: https://postgr.es/m/90a92a7d-938e-507a-3bd7-ecd2b4004689@2ndquadrant.com
parent 4de62168
......@@ -3,7 +3,7 @@
# PGAC_PROG_NSGMLS
# ----------------
AC_DEFUN([PGAC_PROG_NSGMLS],
[AC_PATH_PROGS([NSGMLS], [onsgmls nsgmls])])
[PGAC_PATH_PROGS(NSGMLS, [onsgmls nsgmls])])
# PGAC_CHECK_DOCBOOK(VERSION)
......
......@@ -4,10 +4,7 @@
# PGAC_PATH_PERL
# --------------
AC_DEFUN([PGAC_PATH_PERL],
[# Let the user override the search
if test -z "$PERL"; then
AC_PATH_PROG(PERL, perl)
fi
[PGAC_PATH_PROGS(PERL, perl)
if test "$PERL"; then
pgac_perl_version=`$PERL -v 2>/dev/null | sed -n ['s/This is perl.*v[a-z ]*\([0-9]\.[0-9][0-9.]*\).*$/\1/p']`
......
# config/programs.m4
# PGAC_PATH_PROGS
# ---------------
# This wrapper for AC_PATH_PROGS behaves like that macro except when
# VARIABLE is already set; in that case we just accept the value verbatim.
# (AC_PATH_PROGS would accept it only if it looks like an absolute path.)
# A desirable future improvement would be to convert a non-absolute-path
# input into absolute form.
AC_DEFUN([PGAC_PATH_PROGS],
[if test -z "$$1"; then
AC_PATH_PROGS($@)
else
# Report the value of $1 in configure's output in all cases.
AC_MSG_CHECKING([for $1])
AC_MSG_RESULT([$$1])
fi
])
# PGAC_PATH_BISON
# ---------------
# Look for Bison, set the output variable BISON to its path if found.
......@@ -8,10 +26,7 @@
# Note we do not accept other implementations of yacc.
AC_DEFUN([PGAC_PATH_BISON],
[# Let the user override the search
if test -z "$BISON"; then
AC_PATH_PROGS(BISON, bison)
fi
[PGAC_PATH_PROGS(BISON, bison)
if test "$BISON"; then
pgac_bison_version=`$BISON --version 2>/dev/null | sed q`
......@@ -41,7 +56,7 @@ if test -z "$BISON"; then
*** PostgreSQL then you do not need to worry about this, because the Bison
*** output is pre-generated.)])
fi
# We don't need AC_SUBST(BISON) because AC_PATH_PROG did it
# We don't need AC_SUBST(BISON) because PGAC_PATH_PROGS did it
AC_SUBST(BISONFLAGS)
])# PGAC_PATH_BISON
......@@ -229,7 +244,7 @@ AC_DEFUN([PGAC_CHECK_GETTEXT],
[AC_MSG_ERROR([a gettext implementation is required for NLS])])
AC_CHECK_HEADER([libintl.h], [],
[AC_MSG_ERROR([header file <libintl.h> is required for NLS])])
AC_PATH_PROGS(MSGFMT, msgfmt)
PGAC_PATH_PROGS(MSGFMT, msgfmt)
if test -z "$MSGFMT"; then
AC_MSG_ERROR([msgfmt is required for NLS])
fi
......@@ -238,8 +253,8 @@ AC_DEFUN([PGAC_CHECK_GETTEXT],
pgac_cv_msgfmt_flags=-c
fi])
AC_SUBST(MSGFMT_FLAGS, $pgac_cv_msgfmt_flags)
AC_PATH_PROGS(MSGMERGE, msgmerge)
AC_PATH_PROGS(XGETTEXT, xgettext)
PGAC_PATH_PROGS(MSGMERGE, msgmerge)
PGAC_PATH_PROGS(XGETTEXT, xgettext)
])# PGAC_CHECK_GETTEXT
......
......@@ -6,10 +6,10 @@
# PGAC_PATH_PYTHON
# ----------------
# Look for Python and set the output variable 'PYTHON'
# to 'python' if found, empty otherwise.
# Look for Python and set the output variable 'PYTHON' if found,
# fail otherwise.
AC_DEFUN([PGAC_PATH_PYTHON],
[AC_PATH_PROG(PYTHON, python)
[PGAC_PATH_PROGS(PYTHON, python)
if test x"$PYTHON" = x""; then
AC_MSG_ERROR([Python not found])
fi
......
......@@ -4,7 +4,7 @@
AC_DEFUN([PGAC_PATH_TCLSH],
[AC_PATH_PROGS(TCLSH, [tclsh tcl tclsh8.6 tclsh86 tclsh8.5 tclsh85 tclsh8.4 tclsh84])
[PGAC_PATH_PROGS(TCLSH, [tclsh tcl tclsh8.6 tclsh86 tclsh8.5 tclsh85 tclsh8.4 tclsh84])
if test x"$TCLSH" = x""; then
AC_MSG_ERROR([Tcl shell not found])
fi
......
This diff is collapsed.
......@@ -218,15 +218,15 @@ PGAC_ARG_BOOL(enable, profiling, no,
#
PGAC_ARG_BOOL(enable, coverage, no,
[build with coverage testing instrumentation],
[AC_PATH_PROGS(GCOV, gcov)
[PGAC_PATH_PROGS(GCOV, gcov)
if test -z "$GCOV"; then
AC_MSG_ERROR([gcov not found])
fi
AC_PATH_PROGS(LCOV, lcov)
PGAC_PATH_PROGS(LCOV, lcov)
if test -z "$LCOV"; then
AC_MSG_ERROR([lcov not found])
fi
AC_PATH_PROGS(GENHTML, genhtml)
PGAC_PATH_PROGS(GENHTML, genhtml)
if test -z "$GENHTML"; then
AC_MSG_ERROR([genhtml not found])
fi])
......@@ -237,7 +237,7 @@ AC_SUBST(enable_coverage)
#
PGAC_ARG_BOOL(enable, dtrace, no,
[build with DTrace support],
[AC_PATH_PROGS(DTRACE, dtrace)
[PGAC_PATH_PROGS(DTRACE, dtrace)
if test -z "$DTRACE"; then
AC_MSG_ERROR([dtrace not found])
fi
......@@ -816,7 +816,7 @@ PGAC_ARG_BOOL(with, libxml, no, [build with XML support],
[AC_DEFINE([USE_LIBXML], 1, [Define to 1 to build with XML support. (--with-libxml)])])
if test "$with_libxml" = yes ; then
AC_PATH_PROGS(XML2_CONFIG, xml2-config)
PGAC_PATH_PROGS(XML2_CONFIG, xml2-config)
if test -n "$XML2_CONFIG"; then
for pgac_option in `$XML2_CONFIG --cflags`; do
case $pgac_option in
......@@ -912,7 +912,7 @@ case $INSTALL in
esac
AC_SUBST(install_bin)
AC_PATH_PROG(TAR, tar)
PGAC_PATH_PROGS(TAR, tar)
AC_PROG_LN_S
AC_PROG_AWK
AC_PROG_MKDIR_P
......@@ -948,7 +948,7 @@ if test "$with_python" = yes; then
fi
if test "$cross_compiling" = yes && test -z "$with_system_tzdata"; then
AC_PATH_PROG(ZIC, zic)
PGAC_PATH_PROGS(ZIC, zic)
if test -z "$ZIC"; then
AC_MSG_ERROR([
When cross-compiling, either use the option --with-system-tzdata to use
......@@ -2119,17 +2119,17 @@ fi
#
PGAC_PROG_NSGMLS
PGAC_CHECK_DOCBOOK(4.2)
AC_PATH_PROGS(DBTOEPUB, dbtoepub)
AC_PATH_PROGS(XMLLINT, xmllint)
AC_PATH_PROGS(XSLTPROC, xsltproc)
AC_PATH_PROGS(OSX, [osx sgml2xml sx])
AC_PATH_PROGS(FOP, fop)
PGAC_PATH_PROGS(DBTOEPUB, dbtoepub)
PGAC_PATH_PROGS(XMLLINT, xmllint)
PGAC_PATH_PROGS(XSLTPROC, xsltproc)
PGAC_PATH_PROGS(OSX, [osx sgml2xml sx])
PGAC_PATH_PROGS(FOP, fop)
#
# Check for test tools
#
if test "$enable_tap_tests" = yes; then
AC_PATH_PROGS(PROVE, prove)
PGAC_PATH_PROGS(PROVE, prove)
if test -z "$PROVE"; then
AC_MSG_ERROR([prove not found])
fi
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment