Skip to content

Commit c254970

Browse files
committed
Make configure check for IPC::Run when --enable-tap-tests is specified.
The TAP tests mostly don't work without IPC::Run, and the reason for the failure is not immediately obvious from the error messages you get. So teach configure to reject --enable-tap-tests unless IPC::Run exists. Mostly this just involves adding ax_prog_perl_modules.m4 from the GNU autoconf archives. This was discussed last year, but we held off on the theory that we might be switching to CMake soon. That's evidently not happening for v10, so let's absorb this now. Eugene Kazakov and Michael Paquier Discussion: https://postgr.es/m/[email protected] Discussion: https://postgr.es/m/CAB7nPqRVKG_CR4Dy_AMfE6DXcr6F7ygy2goa2atJU4XkerDRUg@mail.gmail.com
1 parent a3bed62 commit c254970

File tree

4 files changed

+159
-0
lines changed

4 files changed

+159
-0
lines changed

aclocal.m4

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

config/ax_prog_perl_modules.m4

+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# ===========================================================================
2+
# https://www.gnu.org/software/autoconf-archive/ax_prog_perl_modules.html
3+
# ===========================================================================
4+
#
5+
# SYNOPSIS
6+
#
7+
# AX_PROG_PERL_MODULES([MODULES], [ACTION-IF-TRUE], [ACTION-IF-FALSE])
8+
#
9+
# DESCRIPTION
10+
#
11+
# Checks to see if the given perl modules are available. If true the shell
12+
# commands in ACTION-IF-TRUE are executed. If not the shell commands in
13+
# ACTION-IF-FALSE are run. Note if $PERL is not set (for example by
14+
# calling AC_CHECK_PROG, or AC_PATH_PROG), AC_CHECK_PROG(PERL, perl, perl)
15+
# will be run.
16+
#
17+
# MODULES is a space separated list of module names. To check for a
18+
# minimum version of a module, append the version number to the module
19+
# name, separated by an equals sign.
20+
#
21+
# Example:
22+
#
23+
# AX_PROG_PERL_MODULES( Text::Wrap Net::LDAP=1.0.3, ,
24+
# AC_MSG_WARN(Need some Perl modules)
25+
#
26+
# LICENSE
27+
#
28+
# Copyright (c) 2009 Dean Povey <[email protected]>
29+
#
30+
# Copying and distribution of this file, with or without modification, are
31+
# permitted in any medium without royalty provided the copyright notice
32+
# and this notice are preserved. This file is offered as-is, without any
33+
# warranty.
34+
35+
#serial 8
36+
37+
AU_ALIAS([AC_PROG_PERL_MODULES], [AX_PROG_PERL_MODULES])
38+
AC_DEFUN([AX_PROG_PERL_MODULES],[dnl
39+
40+
m4_define([ax_perl_modules])
41+
m4_foreach([ax_perl_module], m4_split(m4_normalize([$1])),
42+
[
43+
m4_append([ax_perl_modules],
44+
[']m4_bpatsubst(ax_perl_module,=,[ ])[' ])
45+
])
46+
47+
# Make sure we have perl
48+
if test -z "$PERL"; then
49+
AC_CHECK_PROG(PERL,perl,perl)
50+
fi
51+
52+
if test "x$PERL" != x; then
53+
ax_perl_modules_failed=0
54+
for ax_perl_module in ax_perl_modules; do
55+
AC_MSG_CHECKING(for perl module $ax_perl_module)
56+
57+
# Would be nice to log result here, but can't rely on autoconf internals
58+
$PERL -e "use $ax_perl_module; exit" > /dev/null 2>&1
59+
if test $? -ne 0; then
60+
AC_MSG_RESULT(no);
61+
ax_perl_modules_failed=1
62+
else
63+
AC_MSG_RESULT(ok);
64+
fi
65+
done
66+
67+
# Run optional shell commands
68+
if test "$ax_perl_modules_failed" = 0; then
69+
:
70+
$2
71+
else
72+
:
73+
$3
74+
fi
75+
else
76+
AC_MSG_WARN(could not find perl)
77+
fi])dnl

configure

+78
Original file line numberDiff line numberDiff line change
@@ -16245,6 +16245,84 @@ done
1624516245
if test -z "$PERL"; then
1624616246
as_fn_error $? "Perl not found" "$LINENO" 5
1624716247
fi
16248+
# Check for necessary modules
16249+
16250+
16251+
16252+
16253+
16254+
16255+
# Make sure we have perl
16256+
if test -z "$PERL"; then
16257+
# Extract the first word of "perl", so it can be a program name with args.
16258+
set dummy perl; ac_word=$2
16259+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
16260+
$as_echo_n "checking for $ac_word... " >&6; }
16261+
if ${ac_cv_prog_PERL+:} false; then :
16262+
$as_echo_n "(cached) " >&6
16263+
else
16264+
if test -n "$PERL"; then
16265+
ac_cv_prog_PERL="$PERL" # Let the user override the test.
16266+
else
16267+
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
16268+
for as_dir in $PATH
16269+
do
16270+
IFS=$as_save_IFS
16271+
test -z "$as_dir" && as_dir=.
16272+
for ac_exec_ext in '' $ac_executable_extensions; do
16273+
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
16274+
ac_cv_prog_PERL="perl"
16275+
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
16276+
break 2
16277+
fi
16278+
done
16279+
done
16280+
IFS=$as_save_IFS
16281+
16282+
fi
16283+
fi
16284+
PERL=$ac_cv_prog_PERL
16285+
if test -n "$PERL"; then
16286+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $PERL" >&5
16287+
$as_echo "$PERL" >&6; }
16288+
else
16289+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
16290+
$as_echo "no" >&6; }
16291+
fi
16292+
16293+
16294+
fi
16295+
16296+
if test "x$PERL" != x; then
16297+
ax_perl_modules_failed=0
16298+
for ax_perl_module in 'IPC::Run' ; do
16299+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for perl module $ax_perl_module" >&5
16300+
$as_echo_n "checking for perl module $ax_perl_module... " >&6; }
16301+
16302+
# Would be nice to log result here, but can't rely on autoconf internals
16303+
$PERL -e "use $ax_perl_module; exit" > /dev/null 2>&1
16304+
if test $? -ne 0; then
16305+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
16306+
$as_echo "no" >&6; };
16307+
ax_perl_modules_failed=1
16308+
else
16309+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
16310+
$as_echo "ok" >&6; };
16311+
fi
16312+
done
16313+
16314+
# Run optional shell commands
16315+
if test "$ax_perl_modules_failed" = 0; then
16316+
:
16317+
16318+
else
16319+
:
16320+
as_fn_error $? "Perl module IPC::Run is required to run TAP tests" "$LINENO" 5
16321+
fi
16322+
else
16323+
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: could not find perl" >&5
16324+
$as_echo "$as_me: WARNING: could not find perl" >&2;}
16325+
fi
1624816326
fi
1624916327

1625016328
# Thread testing

configure.in

+3
Original file line numberDiff line numberDiff line change
@@ -2135,6 +2135,9 @@ if test "$enable_tap_tests" = yes; then
21352135
if test -z "$PERL"; then
21362136
AC_MSG_ERROR([Perl not found])
21372137
fi
2138+
# Check for necessary modules
2139+
AX_PROG_PERL_MODULES(IPC::Run, ,
2140+
AC_MSG_ERROR([Perl module IPC::Run is required to run TAP tests]))
21382141
fi
21392142

21402143
# Thread testing

0 commit comments

Comments
 (0)