Probe $PROVE not $PERL while checking for modules needed by TAP tests.

Normally "prove" and "perl" come from the same Perl installation,
but we support the case where they don't (mainly because the MSys
buildfarm animals need this).  In that case, AX_PROG_PERL_MODULES
is completely the wrong thing to use, because it's checking what
"perl" has.  Instead, make a little TAP test script including the
required modules, and run that under "prove".

We don't need ax_prog_perl_modules.m4 at all after this change,
so remove it.

Back-patch to all supported branches, for the buildfarm's benefit.
(In v10, this also back-patches the effects of commit 264eb03aa.)

Andrew Dunstan and Tom Lane, per an observation by Noah Misch

Discussion: https://postgr.es/m/E1moZHS-0002Cu-Ei@gemulon.postgresql.org
This commit is contained in:
Tom Lane 2021-11-22 12:54:52 -05:00
parent 3ce5d0884c
commit c23796b1a6
5 changed files with 53 additions and 171 deletions

1
aclocal.m4 vendored
View File

@ -1,6 +1,5 @@
dnl aclocal.m4 dnl aclocal.m4
m4_include([config/ac_func_accept_argtypes.m4]) m4_include([config/ac_func_accept_argtypes.m4])
m4_include([config/ax_prog_perl_modules.m4])
m4_include([config/ax_pthread.m4]) m4_include([config/ax_pthread.m4])
m4_include([config/c-compiler.m4]) m4_include([config/c-compiler.m4])
m4_include([config/c-library.m4]) m4_include([config/c-library.m4])

View File

@ -1,77 +0,0 @@
# ===========================================================================
# https://www.gnu.org/software/autoconf-archive/ax_prog_perl_modules.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_PROG_PERL_MODULES([MODULES], [ACTION-IF-TRUE], [ACTION-IF-FALSE])
#
# DESCRIPTION
#
# Checks to see if the given perl modules are available. If true the shell
# commands in ACTION-IF-TRUE are executed. If not the shell commands in
# ACTION-IF-FALSE are run. Note if $PERL is not set (for example by
# calling AC_CHECK_PROG, or AC_PATH_PROG), AC_CHECK_PROG(PERL, perl, perl)
# will be run.
#
# MODULES is a space separated list of module names. To check for a
# minimum version of a module, append the version number to the module
# name, separated by an equals sign.
#
# Example:
#
# AX_PROG_PERL_MODULES( Text::Wrap Net::LDAP=1.0.3, ,
# AC_MSG_WARN(Need some Perl modules)
#
# LICENSE
#
# Copyright (c) 2009 Dean Povey <povey@wedgetail.com>
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved. This file is offered as-is, without any
# warranty.
#serial 8
AU_ALIAS([AC_PROG_PERL_MODULES], [AX_PROG_PERL_MODULES])
AC_DEFUN([AX_PROG_PERL_MODULES],[dnl
m4_define([ax_perl_modules])
m4_foreach([ax_perl_module], m4_split(m4_normalize([$1])),
[
m4_append([ax_perl_modules],
[']m4_bpatsubst(ax_perl_module,=,[ ])[' ])
])
# Make sure we have perl
if test -z "$PERL"; then
AC_CHECK_PROG(PERL,perl,perl)
fi
if test "x$PERL" != x; then
ax_perl_modules_failed=0
for ax_perl_module in ax_perl_modules; do
AC_MSG_CHECKING(for perl module $ax_perl_module)
# Would be nice to log result here, but can't rely on autoconf internals
$PERL -e "use $ax_perl_module; exit" > /dev/null 2>&1
if test $? -ne 0; then
AC_MSG_RESULT(no);
ax_perl_modules_failed=1
else
AC_MSG_RESULT(ok);
fi
done
# Run optional shell commands
if test "$ax_perl_modules_failed" = 0; then
:
$2
else
:
$3
fi
else
AC_MSG_WARN(could not find perl)
fi])dnl

20
config/check_modules.pl Normal file
View File

@ -0,0 +1,20 @@
#
# Verify that required Perl modules are available,
# in at least the required minimum versions.
# (The required minimum versions are all quite ancient now,
# but specify them anyway for documentation's sake.)
#
use IPC::Run 0.79;
# Test::More and Time::HiRes are supposed to be part of core Perl,
# but some distros omit them in a minimal installation.
use Test::More 0.87;
use Time::HiRes 1.52;
# While here, we might as well report exactly what versions we found.
diag("IPC::Run::VERSION: $IPC::Run::VERSION");
diag("Test::More::VERSION: $Test::More::VERSION");
diag("Time::HiRes::VERSION: $Time::HiRes::VERSION");
ok(1);
done_testing();

102
configure vendored
View File

@ -16908,90 +16908,7 @@ fi
# Check for test tools # Check for test tools
# #
if test "$enable_tap_tests" = yes; then if test "$enable_tap_tests" = yes; then
# Check for necessary modules, unless user has specified the "prove" to use; # Make sure we know where prove is.
# in that case it's her responsibility to have a working configuration.
# (prove might be part of a different Perl installation than perl, eg on
# MSys, so the result of AX_PROG_PERL_MODULES could be irrelevant anyway.)
if test -z "$PROVE"; then
# Make sure we have perl
if test -z "$PERL"; then
# Extract the first word of "perl", so it can be a program name with args.
set dummy perl; 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_prog_PERL+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$PERL"; then
ac_cv_prog_PERL="$PERL" # Let the user override the test.
else
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_prog_PERL="perl"
$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
fi
fi
PERL=$ac_cv_prog_PERL
if test -n "$PERL"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $PERL" >&5
$as_echo "$PERL" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
fi
if test "x$PERL" != x; then
ax_perl_modules_failed=0
for ax_perl_module in 'IPC::Run' ; do
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for perl module $ax_perl_module" >&5
$as_echo_n "checking for perl module $ax_perl_module... " >&6; }
# Would be nice to log result here, but can't rely on autoconf internals
$PERL -e "use $ax_perl_module; exit" > /dev/null 2>&1
if test $? -ne 0; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; };
ax_perl_modules_failed=1
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
$as_echo "ok" >&6; };
fi
done
# Run optional shell commands
if test "$ax_perl_modules_failed" = 0; then
:
else
:
as_fn_error $? "Perl module IPC::Run is required to run TAP tests" "$LINENO" 5
fi
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: could not find perl" >&5
$as_echo "$as_me: WARNING: could not find perl" >&2;}
fi
fi
# Now make sure we know where prove is
if test -z "$PROVE"; then if test -z "$PROVE"; then
for ac_prog in prove for ac_prog in prove
do do
@ -17049,6 +16966,23 @@ fi
if test -z "$PROVE"; then if test -z "$PROVE"; then
as_fn_error $? "prove not found" "$LINENO" 5 as_fn_error $? "prove not found" "$LINENO" 5
fi fi
# Check for necessary Perl modules. You might think we should use
# AX_PROG_PERL_MODULES here, but prove might be part of a different Perl
# installation than perl, eg on MSys, so we have to check using prove.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Perl modules required for TAP tests" >&5
$as_echo_n "checking for Perl modules required for TAP tests... " >&6; }
modulestderr=`"$PROVE" "$srcdir/config/check_modules.pl" 2>&1 >/dev/null`
if test $? -eq 0; then
# log the module version details, but don't show them interactively
echo "$modulestderr" >&5
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
# on failure, though, show the results to the user
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $modulestderr" >&5
$as_echo "$modulestderr" >&6; }
as_fn_error $? "Additional Perl modules are required to run TAP tests" "$LINENO" 5
fi
fi fi
# Thread testing # Thread testing

View File

@ -2216,19 +2216,25 @@ PGAC_PATH_PROGS(FOP, fop)
# Check for test tools # Check for test tools
# #
if test "$enable_tap_tests" = yes; then if test "$enable_tap_tests" = yes; then
# Check for necessary modules, unless user has specified the "prove" to use; # Make sure we know where prove is.
# in that case it's her responsibility to have a working configuration.
# (prove might be part of a different Perl installation than perl, eg on
# MSys, so the result of AX_PROG_PERL_MODULES could be irrelevant anyway.)
if test -z "$PROVE"; then
AX_PROG_PERL_MODULES(IPC::Run, ,
AC_MSG_ERROR([Perl module IPC::Run is required to run TAP tests]))
fi
# Now make sure we know where prove is
PGAC_PATH_PROGS(PROVE, prove) PGAC_PATH_PROGS(PROVE, prove)
if test -z "$PROVE"; then if test -z "$PROVE"; then
AC_MSG_ERROR([prove not found]) AC_MSG_ERROR([prove not found])
fi fi
# Check for necessary Perl modules. You might think we should use
# AX_PROG_PERL_MODULES here, but prove might be part of a different Perl
# installation than perl, eg on MSys, so we have to check using prove.
AC_MSG_CHECKING(for Perl modules required for TAP tests)
[modulestderr=`"$PROVE" "$srcdir/config/check_modules.pl" 2>&1 >/dev/null`]
if test $? -eq 0; then
# log the module version details, but don't show them interactively
echo "$modulestderr" >&AS_MESSAGE_LOG_FD
AC_MSG_RESULT(yes)
else
# on failure, though, show the results to the user
AC_MSG_RESULT([$modulestderr])
AC_MSG_ERROR([Additional Perl modules are required to run TAP tests])
fi
fi fi
# Thread testing # Thread testing