On 07/01/2019 00:16, Tom Lane wrote:
> BTW, this is a pre-existing problem not the fault of this patch,
> but while we're fooling with the behavior of python lookup would
> be a great time to fix it: we should add something like
> 
> AC_ARG_VAR([PYTHON], [path to Python executable])
> 
> Aside from improving the "configure --help" documentation, this
> will prevent insane results from using inapplicable cached
> conclusions about what Python we've got.  Since more and more
> people seem to be using configure cache files, I think we need
> to be more careful about declaring relevant variables.

Patch attached.

I went through the environment variables listed in installation.sgml and
came up with the following that would affect subsequent cacheable tests:

MSGFMT
PERL
PYTHON
TCLSH

The following are listed but don't affect any other tests, so I didn't
include them:

BISON
DTRACE
DTRACEFLAGS
FLEX
XML2_CONFIG

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
From 9ba9c7f7e56714535290776cb622a610bc599d8d Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <pe...@eisentraut.org>
Date: Wed, 16 Jan 2019 10:05:42 +0100
Subject: [PATCH] configure: More use of AC_ARG_VAR

AC_ARG_VAR is necessary if an environment variable influences a
configure result that is then used by other tests that are cached.
With AC_ARG_VAR, a change in the variable is detected on subsequent
configure runs and the user is then advised to remove the cache.

This adds AC_ARG_VAR calls for: MSGFMT, PERL, PYTHON, TCLSH
---
 config/perl.m4     |  1 +
 config/programs.m4 |  1 +
 config/python.m4   |  1 +
 config/tcl.m4      |  1 +
 configure          | 12 ++++++++++--
 5 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/config/perl.m4 b/config/perl.m4
index caefb0705e..059e31c476 100644
--- a/config/perl.m4
+++ b/config/perl.m4
@@ -5,6 +5,7 @@
 # --------------
 AC_DEFUN([PGAC_PATH_PERL],
 [PGAC_PATH_PROGS(PERL, perl)
+AC_ARG_VAR(PERL, [Perl program])dnl
 
 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']`
diff --git a/config/programs.m4 b/config/programs.m4
index aa84bfdb9e..21888cb68f 100644
--- a/config/programs.m4
+++ b/config/programs.m4
@@ -245,6 +245,7 @@ AC_DEFUN([PGAC_CHECK_GETTEXT],
   AC_CHECK_HEADER([libintl.h], [],
                   [AC_MSG_ERROR([header file <libintl.h> is required for 
NLS])])
   PGAC_PATH_PROGS(MSGFMT, msgfmt)
+  AC_ARG_VAR(MSGFMT, [msgfmt program for NLS])dnl
   if test -z "$MSGFMT"; then
     AC_MSG_ERROR([msgfmt is required for NLS])
   fi
diff --git a/config/python.m4 b/config/python.m4
index 9a4d12112e..c51aa4e332 100644
--- a/config/python.m4
+++ b/config/python.m4
@@ -17,6 +17,7 @@
 # newer version.
 AC_DEFUN([PGAC_PATH_PYTHON],
 [PGAC_PATH_PROGS(PYTHON, [python python3 python2])
+AC_ARG_VAR(PYTHON, [Python program])dnl
 if test x"$PYTHON" = x""; then
   AC_MSG_ERROR([Python not found])
 fi
diff --git a/config/tcl.m4 b/config/tcl.m4
index 581471f338..9de31a5715 100644
--- a/config/tcl.m4
+++ b/config/tcl.m4
@@ -5,6 +5,7 @@
 
 AC_DEFUN([PGAC_PATH_TCLSH],
 [PGAC_PATH_PROGS(TCLSH, [tclsh tcl tclsh8.6 tclsh86 tclsh8.5 tclsh85 tclsh8.4 
tclsh84])
+AC_ARG_VAR(TCLSH, [Tcl interpreter program (tclsh)])dnl
 if test x"$TCLSH" = x""; then
   AC_MSG_ERROR([Tcl shell not found])
 fi
diff --git a/configure b/configure
index 06fc3c6835..f3639c1363 100755
--- a/configure
+++ b/configure
@@ -888,7 +888,11 @@ PKG_CONFIG_LIBDIR
 ICU_CFLAGS
 ICU_LIBS
 LDFLAGS_EX
-LDFLAGS_SL'
+LDFLAGS_SL
+PERL
+PYTHON
+MSGFMT
+TCLSH'
 
 
 # Initialize some variables set by options.
@@ -1588,6 +1592,10 @@ Some influential environment variables:
   ICU_LIBS    linker flags for ICU, overriding pkg-config
   LDFLAGS_EX  extra linker flags for linking executables only
   LDFLAGS_SL  extra linker flags for linking shared libraries only
+  PERL        Perl program
+  PYTHON      Python program
+  MSGFMT      msgfmt program for NLS
+  TCLSH       Tcl interpreter program (tclsh)
 
 Use these variables to override the choices made by `configure' or to help
 it to find libraries and programs with nonstandard names/locations.
@@ -18097,7 +18105,7 @@ $as_echo_n "checking for MSGFMT... " >&6; }
 $as_echo "$MSGFMT" >&6; }
 fi
 
-  if test -z "$MSGFMT"; then
+    if test -z "$MSGFMT"; then
     as_fn_error $? "msgfmt is required for NLS" "$LINENO" 5
   fi
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for msgfmt flags" >&5
-- 
2.20.1

Reply via email to