Skip to content

Commit e9af18c

Browse files
committed
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 264eb03.) Andrew Dunstan and Tom Lane, per an observation by Noah Misch Discussion: https://postgr.es/m/[email protected]
1 parent c985a43 commit e9af18c

File tree

5 files changed

+53
-179
lines changed

5 files changed

+53
-179
lines changed

aclocal.m4

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
dnl aclocal.m4
22
m4_include([config/ac_func_accept_argtypes.m4])
3-
m4_include([config/ax_prog_perl_modules.m4])
43
m4_include([config/ax_pthread.m4])
54
m4_include([config/c-compiler.m4])
65
m4_include([config/c-library.m4])

config/ax_prog_perl_modules.m4

-77
This file was deleted.

config/check_modules.pl

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#
2+
# Verify that required Perl modules are available,
3+
# in at least the required minimum versions.
4+
# (The required minimum versions are all quite ancient now,
5+
# but specify them anyway for documentation's sake.)
6+
#
7+
use IPC::Run 0.79;
8+
9+
# Test::More and Time::HiRes are supposed to be part of core Perl,
10+
# but some distros omit them in a minimal installation.
11+
use Test::More 0.87;
12+
use Time::HiRes 1.52;
13+
14+
# While here, we might as well report exactly what versions we found.
15+
diag("IPC::Run::VERSION: $IPC::Run::VERSION");
16+
diag("Test::More::VERSION: $Test::More::VERSION");
17+
diag("Time::HiRes::VERSION: $Time::HiRes::VERSION");
18+
19+
ok(1);
20+
done_testing();

configure

+18-90
Original file line numberDiff line numberDiff line change
@@ -19407,96 +19407,7 @@ fi
1940719407
# Check for test tools
1940819408
#
1940919409
if test "$enable_tap_tests" = yes; then
19410-
# Check for necessary modules, unless user has specified the "prove" to use;
19411-
# in that case it's her responsibility to have a working configuration.
19412-
# (prove might be part of a different Perl installation than perl, eg on
19413-
# MSys, so the result of AX_PROG_PERL_MODULES could be irrelevant anyway.)
19414-
if test -z "$PROVE"; then
19415-
# Test::More and Time::HiRes are supposed to be part of core Perl,
19416-
# but some distros omit them in a minimal installation.
19417-
19418-
19419-
19420-
19421-
19422-
19423-
19424-
19425-
19426-
19427-
# Make sure we have perl
19428-
if test -z "$PERL"; then
19429-
# Extract the first word of "perl", so it can be a program name with args.
19430-
set dummy perl; ac_word=$2
19431-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
19432-
$as_echo_n "checking for $ac_word... " >&6; }
19433-
if ${ac_cv_prog_PERL+:} false; then :
19434-
$as_echo_n "(cached) " >&6
19435-
else
19436-
if test -n "$PERL"; then
19437-
ac_cv_prog_PERL="$PERL" # Let the user override the test.
19438-
else
19439-
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
19440-
for as_dir in $PATH
19441-
do
19442-
IFS=$as_save_IFS
19443-
test -z "$as_dir" && as_dir=.
19444-
for ac_exec_ext in '' $ac_executable_extensions; do
19445-
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
19446-
ac_cv_prog_PERL="perl"
19447-
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
19448-
break 2
19449-
fi
19450-
done
19451-
done
19452-
IFS=$as_save_IFS
19453-
19454-
fi
19455-
fi
19456-
PERL=$ac_cv_prog_PERL
19457-
if test -n "$PERL"; then
19458-
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $PERL" >&5
19459-
$as_echo "$PERL" >&6; }
19460-
else
19461-
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
19462-
$as_echo "no" >&6; }
19463-
fi
19464-
19465-
19466-
fi
19467-
19468-
if test "x$PERL" != x; then
19469-
ax_perl_modules_failed=0
19470-
for ax_perl_module in 'IPC::Run' 'Test::More 0.87' 'Time::HiRes' ; do
19471-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for perl module $ax_perl_module" >&5
19472-
$as_echo_n "checking for perl module $ax_perl_module... " >&6; }
19473-
19474-
# Would be nice to log result here, but can't rely on autoconf internals
19475-
$PERL -e "use $ax_perl_module; exit" > /dev/null 2>&1
19476-
if test $? -ne 0; then
19477-
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
19478-
$as_echo "no" >&6; };
19479-
ax_perl_modules_failed=1
19480-
else
19481-
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
19482-
$as_echo "ok" >&6; };
19483-
fi
19484-
done
19485-
19486-
# Run optional shell commands
19487-
if test "$ax_perl_modules_failed" = 0; then
19488-
:
19489-
19490-
else
19491-
:
19492-
as_fn_error $? "Additional Perl modules are required to run TAP tests" "$LINENO" 5
19493-
fi
19494-
else
19495-
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: could not find perl" >&5
19496-
$as_echo "$as_me: WARNING: could not find perl" >&2;}
19497-
fi
19498-
fi
19499-
# Now make sure we know where prove is
19410+
# Make sure we know where prove is.
1950019411
if test -z "$PROVE"; then
1950119412
for ac_prog in prove
1950219413
do
@@ -19554,6 +19465,23 @@ fi
1955419465
if test -z "$PROVE"; then
1955519466
as_fn_error $? "prove not found" "$LINENO" 5
1955619467
fi
19468+
# Check for necessary Perl modules. You might think we should use
19469+
# AX_PROG_PERL_MODULES here, but prove might be part of a different Perl
19470+
# installation than perl, eg on MSys, so we have to check using prove.
19471+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Perl modules required for TAP tests" >&5
19472+
$as_echo_n "checking for Perl modules required for TAP tests... " >&6; }
19473+
modulestderr=`"$PROVE" "$srcdir/config/check_modules.pl" 2>&1 >/dev/null`
19474+
if test $? -eq 0; then
19475+
# log the module version details, but don't show them interactively
19476+
echo "$modulestderr" >&5
19477+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
19478+
$as_echo "yes" >&6; }
19479+
else
19480+
# on failure, though, show the results to the user
19481+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $modulestderr" >&5
19482+
$as_echo "$modulestderr" >&6; }
19483+
as_fn_error $? "Additional Perl modules are required to run TAP tests" "$LINENO" 5
19484+
fi
1955719485
fi
1955819486

1955919487
# If compiler will take -Wl,--as-needed (or various platform-specific

configure.ac

+15-11
Original file line numberDiff line numberDiff line change
@@ -2345,21 +2345,25 @@ PGAC_PATH_PROGS(DBTOEPUB, dbtoepub)
23452345
# Check for test tools
23462346
#
23472347
if test "$enable_tap_tests" = yes; then
2348-
# Check for necessary modules, unless user has specified the "prove" to use;
2349-
# in that case it's her responsibility to have a working configuration.
2350-
# (prove might be part of a different Perl installation than perl, eg on
2351-
# MSys, so the result of AX_PROG_PERL_MODULES could be irrelevant anyway.)
2352-
if test -z "$PROVE"; then
2353-
# Test::More and Time::HiRes are supposed to be part of core Perl,
2354-
# but some distros omit them in a minimal installation.
2355-
AX_PROG_PERL_MODULES([IPC::Run Test::More=0.87 Time::HiRes], ,
2356-
[AC_MSG_ERROR([Additional Perl modules are required to run TAP tests])])
2357-
fi
2358-
# Now make sure we know where prove is
2348+
# Make sure we know where prove is.
23592349
PGAC_PATH_PROGS(PROVE, prove)
23602350
if test -z "$PROVE"; then
23612351
AC_MSG_ERROR([prove not found])
23622352
fi
2353+
# Check for necessary Perl modules. You might think we should use
2354+
# AX_PROG_PERL_MODULES here, but prove might be part of a different Perl
2355+
# installation than perl, eg on MSys, so we have to check using prove.
2356+
AC_MSG_CHECKING(for Perl modules required for TAP tests)
2357+
[modulestderr=`"$PROVE" "$srcdir/config/check_modules.pl" 2>&1 >/dev/null`]
2358+
if test $? -eq 0; then
2359+
# log the module version details, but don't show them interactively
2360+
echo "$modulestderr" >&AS_MESSAGE_LOG_FD
2361+
AC_MSG_RESULT(yes)
2362+
else
2363+
# on failure, though, show the results to the user
2364+
AC_MSG_RESULT([$modulestderr])
2365+
AC_MSG_ERROR([Additional Perl modules are required to run TAP tests])
2366+
fi
23632367
fi
23642368

23652369
# If compiler will take -Wl,--as-needed (or various platform-specific

0 commit comments

Comments
 (0)