summaryrefslogtreecommitdiff
path: root/t/python-am-path-iftrue.sh
blob: 809e8450716feafcb5a660db3c90b92cfdbbadfc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#! /bin/sh
# Copyright (C) 2003-2014 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

# Test ACTION-IF-TRUE in AM_PATH_PYTHON.

am_create_testdir=empty
required=python
. test-init.sh

cat > configure.ac <<END
AC_INIT([$me], [1.0])
m4_include([mypy.m4])
AC_OUTPUT
END

# $PYTHON is supposed to be properly set in ACTION-IF-TRUE.
cat > mypy.m4 << 'END'
AM_PATH_PYTHON(, [$PYTHON -V >py-version 2>&1])
END

$ACLOCAL
$AUTOCONF
./configure
grep '^Python [0-9]\.[0-9][0-9]*\.[0-9]' py-version

# The same, but requiring a version.

rm -rf autom4te*.cache

# $PYTHON is supposed to be properly set in ACTION-IF-TRUE.
cat > mypy.m4 << 'END'
AM_PATH_PYTHON([0.0], [$PYTHON -c 'print("%u:%u" % (1-1, 2**0))' > py.out])
END

# The "--force" option here is truly needed to avoid potential timestamp
# races.  See automake bug#12210.
$ACLOCAL --force
$AUTOCONF --force
./configure
test x"$(cat py.out)" = x0:1

: