Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit b21c569

Browse files
committed
Further improve consistency of configure's program searching.
Peter Eisentraut noted that commit 40b9f19 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
1 parent 4de6216 commit b21c569

File tree

7 files changed

+267
-52
lines changed

7 files changed

+267
-52
lines changed

config/docbook.m4

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# PGAC_PROG_NSGMLS
44
# ----------------
55
AC_DEFUN([PGAC_PROG_NSGMLS],
6-
[AC_PATH_PROGS([NSGMLS], [onsgmls nsgmls])])
6+
[PGAC_PATH_PROGS(NSGMLS, [onsgmls nsgmls])])
77

88

99
# PGAC_CHECK_DOCBOOK(VERSION)

config/perl.m4

+1-4
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@
44
# PGAC_PATH_PERL
55
# --------------
66
AC_DEFUN([PGAC_PATH_PERL],
7-
[# Let the user override the search
8-
if test -z "$PERL"; then
9-
AC_PATH_PROG(PERL, perl)
10-
fi
7+
[PGAC_PATH_PROGS(PERL, perl)
118
129
if test "$PERL"; then
1310
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

+23-8
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,32 @@
11
# config/programs.m4
22

33

4+
# PGAC_PATH_PROGS
5+
# ---------------
6+
# This wrapper for AC_PATH_PROGS behaves like that macro except when
7+
# VARIABLE is already set; in that case we just accept the value verbatim.
8+
# (AC_PATH_PROGS would accept it only if it looks like an absolute path.)
9+
# A desirable future improvement would be to convert a non-absolute-path
10+
# input into absolute form.
11+
AC_DEFUN([PGAC_PATH_PROGS],
12+
[if test -z "$$1"; then
13+
AC_PATH_PROGS($@)
14+
else
15+
# Report the value of $1 in configure's output in all cases.
16+
AC_MSG_CHECKING([for $1])
17+
AC_MSG_RESULT([$$1])
18+
fi
19+
])
20+
21+
422
# PGAC_PATH_BISON
523
# ---------------
624
# Look for Bison, set the output variable BISON to its path if found.
725
# Reject versions before 1.875 (they have bugs or capacity limits).
826
# Note we do not accept other implementations of yacc.
927

1028
AC_DEFUN([PGAC_PATH_BISON],
11-
[# Let the user override the search
12-
if test -z "$BISON"; then
13-
AC_PATH_PROGS(BISON, bison)
14-
fi
29+
[PGAC_PATH_PROGS(BISON, bison)
1530
1631
if test "$BISON"; then
1732
pgac_bison_version=`$BISON --version 2>/dev/null | sed q`
@@ -41,7 +56,7 @@ if test -z "$BISON"; then
4156
*** PostgreSQL then you do not need to worry about this, because the Bison
4257
*** output is pre-generated.)])
4358
fi
44-
# We don't need AC_SUBST(BISON) because AC_PATH_PROG did it
59+
# We don't need AC_SUBST(BISON) because PGAC_PATH_PROGS did it
4560
AC_SUBST(BISONFLAGS)
4661
])# PGAC_PATH_BISON
4762

@@ -229,7 +244,7 @@ AC_DEFUN([PGAC_CHECK_GETTEXT],
229244
[AC_MSG_ERROR([a gettext implementation is required for NLS])])
230245
AC_CHECK_HEADER([libintl.h], [],
231246
[AC_MSG_ERROR([header file <libintl.h> is required for NLS])])
232-
AC_PATH_PROGS(MSGFMT, msgfmt)
247+
PGAC_PATH_PROGS(MSGFMT, msgfmt)
233248
if test -z "$MSGFMT"; then
234249
AC_MSG_ERROR([msgfmt is required for NLS])
235250
fi
@@ -238,8 +253,8 @@ AC_DEFUN([PGAC_CHECK_GETTEXT],
238253
pgac_cv_msgfmt_flags=-c
239254
fi])
240255
AC_SUBST(MSGFMT_FLAGS, $pgac_cv_msgfmt_flags)
241-
AC_PATH_PROGS(MSGMERGE, msgmerge)
242-
AC_PATH_PROGS(XGETTEXT, xgettext)
256+
PGAC_PATH_PROGS(MSGMERGE, msgmerge)
257+
PGAC_PATH_PROGS(XGETTEXT, xgettext)
243258
])# PGAC_CHECK_GETTEXT
244259

245260

config/python.m4

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66

77
# PGAC_PATH_PYTHON
88
# ----------------
9-
# Look for Python and set the output variable 'PYTHON'
10-
# to 'python' if found, empty otherwise.
9+
# Look for Python and set the output variable 'PYTHON' if found,
10+
# fail otherwise.
1111
AC_DEFUN([PGAC_PATH_PYTHON],
12-
[AC_PATH_PROG(PYTHON, python)
12+
[PGAC_PATH_PROGS(PYTHON, python)
1313
if test x"$PYTHON" = x""; then
1414
AC_MSG_ERROR([Python not found])
1515
fi

config/tcl.m4

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55

66
AC_DEFUN([PGAC_PATH_TCLSH],
7-
[AC_PATH_PROGS(TCLSH, [tclsh tcl tclsh8.6 tclsh86 tclsh8.5 tclsh85 tclsh8.4 tclsh84])
7+
[PGAC_PATH_PROGS(TCLSH, [tclsh tcl tclsh8.6 tclsh86 tclsh8.5 tclsh85 tclsh8.4 tclsh84])
88
if test x"$TCLSH" = x""; then
99
AC_MSG_ERROR([Tcl shell not found])
1010
fi

0 commit comments

Comments
 (0)