Skip to content

Commit ead5c36

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/E1moZHS-0002Cu-Ei@gemulon.postgresql.org
1 parent c2242d3 commit ead5c36

File tree

5 files changed

+53
-179
lines changed

5 files changed

+53
-179
lines changed

aclocal.m4

Lines changed: 0 additions & 1 deletion
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

Lines changed: 0 additions & 77 deletions
This file was deleted.

config/check_modules.pl

Lines changed: 20 additions & 0 deletions
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

Lines changed: 18 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -18849,96 +18849,7 @@ fi
1884918849
# Check for test tools
1885018850
#
1885118851
if test "$enable_tap_tests" = yes; then
18852-
# Check for necessary modules, unless user has specified the "prove" to use;
18853-
# in that case it's her responsibility to have a working configuration.
18854-
# (prove might be part of a different Perl installation than perl, eg on
18855-
# MSys, so the result of AX_PROG_PERL_MODULES could be irrelevant anyway.)
18856-
if test -z "$PROVE"; then
18857-
# Test::More and Time::HiRes are supposed to be part of core Perl,
18858-
# but some distros omit them in a minimal installation.
18859-
18860-
18861-
18862-
18863-
18864-
18865-
18866-
18867-
18868-
18869-
# Make sure we have perl
18870-
if test -z "$PERL"; then
18871-
# Extract the first word of "perl", so it can be a program name with args.
18872-
set dummy perl; ac_word=$2
18873-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
18874-
$as_echo_n "checking for $ac_word... " >&6; }
18875-
if ${ac_cv_prog_PERL+:} false; then :
18876-
$as_echo_n "(cached) " >&6
18877-
else
18878-
if test -n "$PERL"; then
18879-
ac_cv_prog_PERL="$PERL" # Let the user override the test.
18880-
else
18881-
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
18882-
for as_dir in $PATH
18883-
do
18884-
IFS=$as_save_IFS
18885-
test -z "$as_dir" && as_dir=.
18886-
for ac_exec_ext in '' $ac_executable_extensions; do
18887-
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
18888-
ac_cv_prog_PERL="perl"
18889-
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
18890-
break 2
18891-
fi
18892-
done
18893-
done
18894-
IFS=$as_save_IFS
18895-
18896-
fi
18897-
fi
18898-
PERL=$ac_cv_prog_PERL
18899-
if test -n "$PERL"; then
18900-
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $PERL" >&5
18901-
$as_echo "$PERL" >&6; }
18902-
else
18903-
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
18904-
$as_echo "no" >&6; }
18905-
fi
18906-
18907-
18908-
fi
18909-
18910-
if test "x$PERL" != x; then
18911-
ax_perl_modules_failed=0
18912-
for ax_perl_module in 'IPC::Run' 'Test::More 0.87' 'Time::HiRes' ; do
18913-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for perl module $ax_perl_module" >&5
18914-
$as_echo_n "checking for perl module $ax_perl_module... " >&6; }
18915-
18916-
# Would be nice to log result here, but can't rely on autoconf internals
18917-
$PERL -e "use $ax_perl_module; exit" > /dev/null 2>&1
18918-
if test $? -ne 0; then
18919-
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
18920-
$as_echo "no" >&6; };
18921-
ax_perl_modules_failed=1
18922-
else
18923-
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
18924-
$as_echo "ok" >&6; };
18925-
fi
18926-
done
18927-
18928-
# Run optional shell commands
18929-
if test "$ax_perl_modules_failed" = 0; then
18930-
:
18931-
18932-
else
18933-
:
18934-
as_fn_error $? "Additional Perl modules are required to run TAP tests" "$LINENO" 5
18935-
fi
18936-
else
18937-
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: could not find perl" >&5
18938-
$as_echo "$as_me: WARNING: could not find perl" >&2;}
18939-
fi
18940-
fi
18941-
# Now make sure we know where prove is
18852+
# Make sure we know where prove is.
1894218853
if test -z "$PROVE"; then
1894318854
for ac_prog in prove
1894418855
do
@@ -18996,6 +18907,23 @@ fi
1899618907
if test -z "$PROVE"; then
1899718908
as_fn_error $? "prove not found" "$LINENO" 5
1899818909
fi
18910+
# Check for necessary Perl modules. You might think we should use
18911+
# AX_PROG_PERL_MODULES here, but prove might be part of a different Perl
18912+
# installation than perl, eg on MSys, so we have to check using prove.
18913+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Perl modules required for TAP tests" >&5
18914+
$as_echo_n "checking for Perl modules required for TAP tests... " >&6; }
18915+
modulestderr=`"$PROVE" "$srcdir/config/check_modules.pl" 2>&1 >/dev/null`
18916+
if test $? -eq 0; then
18917+
# log the module version details, but don't show them interactively
18918+
echo "$modulestderr" >&5
18919+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
18920+
$as_echo "yes" >&6; }
18921+
else
18922+
# on failure, though, show the results to the user
18923+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $modulestderr" >&5
18924+
$as_echo "$modulestderr" >&6; }
18925+
as_fn_error $? "Additional Perl modules are required to run TAP tests" "$LINENO" 5
18926+
fi
1899918927
fi
1900018928

1900118929
# Thread testing

configure.in

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2369,21 +2369,25 @@ PGAC_PATH_PROGS(DBTOEPUB, dbtoepub)
23692369
# Check for test tools
23702370
#
23712371
if test "$enable_tap_tests" = yes; then
2372-
# Check for necessary modules, unless user has specified the "prove" to use;
2373-
# in that case it's her responsibility to have a working configuration.
2374-
# (prove might be part of a different Perl installation than perl, eg on
2375-
# MSys, so the result of AX_PROG_PERL_MODULES could be irrelevant anyway.)
2376-
if test -z "$PROVE"; then
2377-
# Test::More and Time::HiRes are supposed to be part of core Perl,
2378-
# but some distros omit them in a minimal installation.
2379-
AX_PROG_PERL_MODULES([IPC::Run Test::More=0.87 Time::HiRes], ,
2380-
[AC_MSG_ERROR([Additional Perl modules are required to run TAP tests])])
2381-
fi
2382-
# Now make sure we know where prove is
2372+
# Make sure we know where prove is.
23832373
PGAC_PATH_PROGS(PROVE, prove)
23842374
if test -z "$PROVE"; then
23852375
AC_MSG_ERROR([prove not found])
23862376
fi
2377+
# Check for necessary Perl modules. You might think we should use
2378+
# AX_PROG_PERL_MODULES here, but prove might be part of a different Perl
2379+
# installation than perl, eg on MSys, so we have to check using prove.
2380+
AC_MSG_CHECKING(for Perl modules required for TAP tests)
2381+
[modulestderr=`"$PROVE" "$srcdir/config/check_modules.pl" 2>&1 >/dev/null`]
2382+
if test $? -eq 0; then
2383+
# log the module version details, but don't show them interactively
2384+
echo "$modulestderr" >&AS_MESSAGE_LOG_FD
2385+
AC_MSG_RESULT(yes)
2386+
else
2387+
# on failure, though, show the results to the user
2388+
AC_MSG_RESULT([$modulestderr])
2389+
AC_MSG_ERROR([Additional Perl modules are required to run TAP tests])
2390+
fi
23872391
fi
23882392

23892393
# Thread testing

0 commit comments

Comments
 (0)