Skip to content

Commit c4fe319

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 2fed48f commit c4fe319

File tree

5 files changed

+53
-183
lines changed

5 files changed

+53
-183
lines changed

aclocal.m4

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
dnl aclocal.m4
2-
m4_include([config/ax_prog_perl_modules.m4])
32
m4_include([config/ax_pthread.m4])
43
m4_include([config/c-compiler.m4])
54
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.98;
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-92
Original file line numberDiff line numberDiff line change
@@ -19410,98 +19410,7 @@ fi
1941019410
# Check for test tools
1941119411
#
1941219412
if test "$enable_tap_tests" = yes; then
19413-
# Check for necessary modules, unless user has specified the "prove" to use;
19414-
# in that case it's her responsibility to have a working configuration.
19415-
# (prove might be part of a different Perl installation than perl, eg on
19416-
# MSys, so the result of AX_PROG_PERL_MODULES could be irrelevant anyway.)
19417-
if test -z "$PROVE"; then
19418-
# Test::More and Time::HiRes are supposed to be part of core Perl,
19419-
# but some distros omit them in a minimal installation.
19420-
# The required minimum versions are all quite ancient now, but specify
19421-
# them anyway for documentation's sake.
19422-
19423-
19424-
19425-
19426-
19427-
19428-
19429-
19430-
19431-
19432-
# Make sure we have perl
19433-
if test -z "$PERL"; then
19434-
# Extract the first word of "perl", so it can be a program name with args.
19435-
set dummy perl; ac_word=$2
19436-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
19437-
$as_echo_n "checking for $ac_word... " >&6; }
19438-
if ${ac_cv_prog_PERL+:} false; then :
19439-
$as_echo_n "(cached) " >&6
19440-
else
19441-
if test -n "$PERL"; then
19442-
ac_cv_prog_PERL="$PERL" # Let the user override the test.
19443-
else
19444-
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
19445-
for as_dir in $PATH
19446-
do
19447-
IFS=$as_save_IFS
19448-
test -z "$as_dir" && as_dir=.
19449-
for ac_exec_ext in '' $ac_executable_extensions; do
19450-
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
19451-
ac_cv_prog_PERL="perl"
19452-
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
19453-
break 2
19454-
fi
19455-
done
19456-
done
19457-
IFS=$as_save_IFS
19458-
19459-
fi
19460-
fi
19461-
PERL=$ac_cv_prog_PERL
19462-
if test -n "$PERL"; then
19463-
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $PERL" >&5
19464-
$as_echo "$PERL" >&6; }
19465-
else
19466-
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
19467-
$as_echo "no" >&6; }
19468-
fi
19469-
19470-
19471-
fi
19472-
19473-
if test "x$PERL" != x; then
19474-
ax_perl_modules_failed=0
19475-
for ax_perl_module in 'IPC::Run 0.79' 'Test::More 0.98' 'Time::HiRes 1.52' ; do
19476-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for perl module $ax_perl_module" >&5
19477-
$as_echo_n "checking for perl module $ax_perl_module... " >&6; }
19478-
19479-
# Would be nice to log result here, but can't rely on autoconf internals
19480-
modversion=`$PERL -e "use $ax_perl_module; my \\\$x=q($ax_perl_module); \\\$x =~ s/ .*//; \\\$x .= q(::VERSION); eval qq{print \\\\$\\\$x\\n}; exit;" 2>/dev/null`
19481-
if test $? -ne 0; then
19482-
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
19483-
$as_echo "no" >&6; };
19484-
ax_perl_modules_failed=1
19485-
else
19486-
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $modversion" >&5
19487-
$as_echo "$modversion" >&6; };
19488-
fi
19489-
done
19490-
19491-
# Run optional shell commands
19492-
if test "$ax_perl_modules_failed" = 0; then
19493-
:
19494-
19495-
else
19496-
:
19497-
as_fn_error $? "Additional Perl modules are required to run TAP tests" "$LINENO" 5
19498-
fi
19499-
else
19500-
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: could not find perl" >&5
19501-
$as_echo "$as_me: WARNING: could not find perl" >&2;}
19502-
fi
19503-
fi
19504-
# Now make sure we know where prove is
19413+
# Make sure we know where prove is.
1950519414
if test -z "$PROVE"; then
1950619415
for ac_prog in prove
1950719416
do
@@ -19559,6 +19468,23 @@ fi
1955919468
if test -z "$PROVE"; then
1956019469
as_fn_error $? "prove not found" "$LINENO" 5
1956119470
fi
19471+
# Check for necessary Perl modules. You might think we should use
19472+
# AX_PROG_PERL_MODULES here, but prove might be part of a different Perl
19473+
# installation than perl, eg on MSys, so we have to check using prove.
19474+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Perl modules required for TAP tests" >&5
19475+
$as_echo_n "checking for Perl modules required for TAP tests... " >&6; }
19476+
modulestderr=`"$PROVE" "$srcdir/config/check_modules.pl" 2>&1 >/dev/null`
19477+
if test $? -eq 0; then
19478+
# log the module version details, but don't show them interactively
19479+
echo "$modulestderr" >&5
19480+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
19481+
$as_echo "yes" >&6; }
19482+
else
19483+
# on failure, though, show the results to the user
19484+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $modulestderr" >&5
19485+
$as_echo "$modulestderr" >&6; }
19486+
as_fn_error $? "Additional Perl modules are required to run TAP tests" "$LINENO" 5
19487+
fi
1956219488
fi
1956319489

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

configure.ac

+15-13
Original file line numberDiff line numberDiff line change
@@ -2377,23 +2377,25 @@ PGAC_PATH_PROGS(DBTOEPUB, dbtoepub)
23772377
# Check for test tools
23782378
#
23792379
if test "$enable_tap_tests" = yes; then
2380-
# Check for necessary modules, unless user has specified the "prove" to use;
2381-
# in that case it's her responsibility to have a working configuration.
2382-
# (prove might be part of a different Perl installation than perl, eg on
2383-
# MSys, so the result of AX_PROG_PERL_MODULES could be irrelevant anyway.)
2384-
if test -z "$PROVE"; then
2385-
# Test::More and Time::HiRes are supposed to be part of core Perl,
2386-
# but some distros omit them in a minimal installation.
2387-
# The required minimum versions are all quite ancient now, but specify
2388-
# them anyway for documentation's sake.
2389-
AX_PROG_PERL_MODULES([IPC::Run=0.79 Test::More=0.98 Time::HiRes=1.52], ,
2390-
[AC_MSG_ERROR([Additional Perl modules are required to run TAP tests])])
2391-
fi
2392-
# Now make sure we know where prove is
2380+
# Make sure we know where prove is.
23932381
PGAC_PATH_PROGS(PROVE, prove)
23942382
if test -z "$PROVE"; then
23952383
AC_MSG_ERROR([prove not found])
23962384
fi
2385+
# Check for necessary Perl modules. You might think we should use
2386+
# AX_PROG_PERL_MODULES here, but prove might be part of a different Perl
2387+
# installation than perl, eg on MSys, so we have to check using prove.
2388+
AC_MSG_CHECKING(for Perl modules required for TAP tests)
2389+
[modulestderr=`"$PROVE" "$srcdir/config/check_modules.pl" 2>&1 >/dev/null`]
2390+
if test $? -eq 0; then
2391+
# log the module version details, but don't show them interactively
2392+
echo "$modulestderr" >&AS_MESSAGE_LOG_FD
2393+
AC_MSG_RESULT(yes)
2394+
else
2395+
# on failure, though, show the results to the user
2396+
AC_MSG_RESULT([$modulestderr])
2397+
AC_MSG_ERROR([Additional Perl modules are required to run TAP tests])
2398+
fi
23972399
fi
23982400

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

0 commit comments

Comments
 (0)