Skip to content

Commit ec383ca

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 33edf4a commit ec383ca

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
@@ -18924,96 +18924,7 @@ fi
1892418924
# Check for test tools
1892518925
#
1892618926
if test "$enable_tap_tests" = yes; then
18927-
# Check for necessary modules, unless user has specified the "prove" to use;
18928-
# in that case it's her responsibility to have a working configuration.
18929-
# (prove might be part of a different Perl installation than perl, eg on
18930-
# MSys, so the result of AX_PROG_PERL_MODULES could be irrelevant anyway.)
18931-
if test -z "$PROVE"; then
18932-
# Test::More and Time::HiRes are supposed to be part of core Perl,
18933-
# but some distros omit them in a minimal installation.
18934-
18935-
18936-
18937-
18938-
18939-
18940-
18941-
18942-
18943-
18944-
# Make sure we have perl
18945-
if test -z "$PERL"; then
18946-
# Extract the first word of "perl", so it can be a program name with args.
18947-
set dummy perl; ac_word=$2
18948-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
18949-
$as_echo_n "checking for $ac_word... " >&6; }
18950-
if ${ac_cv_prog_PERL+:} false; then :
18951-
$as_echo_n "(cached) " >&6
18952-
else
18953-
if test -n "$PERL"; then
18954-
ac_cv_prog_PERL="$PERL" # Let the user override the test.
18955-
else
18956-
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
18957-
for as_dir in $PATH
18958-
do
18959-
IFS=$as_save_IFS
18960-
test -z "$as_dir" && as_dir=.
18961-
for ac_exec_ext in '' $ac_executable_extensions; do
18962-
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
18963-
ac_cv_prog_PERL="perl"
18964-
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
18965-
break 2
18966-
fi
18967-
done
18968-
done
18969-
IFS=$as_save_IFS
18970-
18971-
fi
18972-
fi
18973-
PERL=$ac_cv_prog_PERL
18974-
if test -n "$PERL"; then
18975-
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $PERL" >&5
18976-
$as_echo "$PERL" >&6; }
18977-
else
18978-
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
18979-
$as_echo "no" >&6; }
18980-
fi
18981-
18982-
18983-
fi
18984-
18985-
if test "x$PERL" != x; then
18986-
ax_perl_modules_failed=0
18987-
for ax_perl_module in 'IPC::Run' 'Test::More 0.87' 'Time::HiRes' ; do
18988-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for perl module $ax_perl_module" >&5
18989-
$as_echo_n "checking for perl module $ax_perl_module... " >&6; }
18990-
18991-
# Would be nice to log result here, but can't rely on autoconf internals
18992-
$PERL -e "use $ax_perl_module; exit" > /dev/null 2>&1
18993-
if test $? -ne 0; then
18994-
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
18995-
$as_echo "no" >&6; };
18996-
ax_perl_modules_failed=1
18997-
else
18998-
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
18999-
$as_echo "ok" >&6; };
19000-
fi
19001-
done
19002-
19003-
# Run optional shell commands
19004-
if test "$ax_perl_modules_failed" = 0; then
19005-
:
19006-
19007-
else
19008-
:
19009-
as_fn_error $? "Additional Perl modules are required to run TAP tests" "$LINENO" 5
19010-
fi
19011-
else
19012-
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: could not find perl" >&5
19013-
$as_echo "$as_me: WARNING: could not find perl" >&2;}
19014-
fi
19015-
fi
19016-
# Now make sure we know where prove is
18927+
# Make sure we know where prove is.
1901718928
if test -z "$PROVE"; then
1901818929
for ac_prog in prove
1901918930
do
@@ -19071,6 +18982,23 @@ fi
1907118982
if test -z "$PROVE"; then
1907218983
as_fn_error $? "prove not found" "$LINENO" 5
1907318984
fi
18985+
# Check for necessary Perl modules. You might think we should use
18986+
# AX_PROG_PERL_MODULES here, but prove might be part of a different Perl
18987+
# installation than perl, eg on MSys, so we have to check using prove.
18988+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Perl modules required for TAP tests" >&5
18989+
$as_echo_n "checking for Perl modules required for TAP tests... " >&6; }
18990+
modulestderr=`"$PROVE" "$srcdir/config/check_modules.pl" 2>&1 >/dev/null`
18991+
if test $? -eq 0; then
18992+
# log the module version details, but don't show them interactively
18993+
echo "$modulestderr" >&5
18994+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
18995+
$as_echo "yes" >&6; }
18996+
else
18997+
# on failure, though, show the results to the user
18998+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $modulestderr" >&5
18999+
$as_echo "$modulestderr" >&6; }
19000+
as_fn_error $? "Additional Perl modules are required to run TAP tests" "$LINENO" 5
19001+
fi
1907419002
fi
1907519003

1907619004
# Thread testing

configure.in

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2296,21 +2296,25 @@ PGAC_PATH_PROGS(DBTOEPUB, dbtoepub)
22962296
# Check for test tools
22972297
#
22982298
if test "$enable_tap_tests" = yes; then
2299-
# Check for necessary modules, unless user has specified the "prove" to use;
2300-
# in that case it's her responsibility to have a working configuration.
2301-
# (prove might be part of a different Perl installation than perl, eg on
2302-
# MSys, so the result of AX_PROG_PERL_MODULES could be irrelevant anyway.)
2303-
if test -z "$PROVE"; then
2304-
# Test::More and Time::HiRes are supposed to be part of core Perl,
2305-
# but some distros omit them in a minimal installation.
2306-
AX_PROG_PERL_MODULES([IPC::Run Test::More=0.87 Time::HiRes], ,
2307-
[AC_MSG_ERROR([Additional Perl modules are required to run TAP tests])])
2308-
fi
2309-
# Now make sure we know where prove is
2299+
# Make sure we know where prove is.
23102300
PGAC_PATH_PROGS(PROVE, prove)
23112301
if test -z "$PROVE"; then
23122302
AC_MSG_ERROR([prove not found])
23132303
fi
2304+
# Check for necessary Perl modules. You might think we should use
2305+
# AX_PROG_PERL_MODULES here, but prove might be part of a different Perl
2306+
# installation than perl, eg on MSys, so we have to check using prove.
2307+
AC_MSG_CHECKING(for Perl modules required for TAP tests)
2308+
[modulestderr=`"$PROVE" "$srcdir/config/check_modules.pl" 2>&1 >/dev/null`]
2309+
if test $? -eq 0; then
2310+
# log the module version details, but don't show them interactively
2311+
echo "$modulestderr" >&AS_MESSAGE_LOG_FD
2312+
AC_MSG_RESULT(yes)
2313+
else
2314+
# on failure, though, show the results to the user
2315+
AC_MSG_RESULT([$modulestderr])
2316+
AC_MSG_ERROR([Additional Perl modules are required to run TAP tests])
2317+
fi
23142318
fi
23152319

23162320
# Thread testing

0 commit comments

Comments
 (0)