sync: update files from upstream with "make fetch"
[automake.git] / t / python-missing.sh
blobb0912d34b67cb08e4a3b566150d3c070887318e7
1 #! /bin/sh
2 # Copyright (C) 2003-2012 Free Software Foundation, Inc.
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2, or (at your option)
7 # any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
17 # Test detection of missing Python.
18 # See also related test t/python-am-path-missing-2.sh (which requires
19 # an actual python program).
21 am_create_testdir=empty
22 # An actual python is *not* required in this test.
23 . ./defs || exit 1
25 PYTHON=; unset PYTHON
27 cat > configure.ac <<END
28 AC_INIT([$me], [1.0])
29 m4_include([mypy.m4])
30 AC_OUTPUT
31 END
33 echo AM_PATH_PYTHON > mypy.m4
35 $ACLOCAL
36 $AUTOCONF
38 # Simulate no Python.
39 ./configure PYTHON=: 2>stderr && { cat stderr >&2; exit 1; }
40 cat stderr >&2
41 grep 'no suitable Python interpreter found' stderr
43 # Again, but from the environment this time.
44 env PYTHON=: ./configure 2>stderr && { cat stderr >&2; exit 1; }
45 cat stderr >&2
46 grep 'no suitable Python interpreter found' stderr
48 # Now try using a custom ACTION-IF-NOT-FOUND.
50 echo 'AM_PATH_PYTHON(,, [echo "$PYTHON" > py])' > mypy.m4
51 $AUTOCONF --force
52 ./configure PYTHON=:
53 test x"$(cat py)" = x:
55 # Now try requiring a version.
57 rm -rf autom4te*.cache # Will have to re-run aclocal.
59 # Hopefully the Python team will never release such a version :-)
60 echo 'AM_PATH_PYTHON([9999.9], [])' > mypy.m4
61 # The "--force" options (here and below) are truly needed to avoid
62 # potential timestamp races. See automake bug#12210.
63 $ACLOCAL --force
64 $AUTOCONF --force
65 ./configure >stdout 2>stderr && {
66 cat stdout
67 cat stderr >&2
68 exit 1
70 cat stdout
71 cat stderr >&2
72 $EGREP 'checking for a Python interpreter with version >= 9999\.9\.\.\. no(ne)? *$' stdout
73 grep 'no suitable Python interpreter found' stderr
75 # Now try requiring a version and using a custom ACTION-IF-NOT-FOUND.
77 echo 'AM_PATH_PYTHON([9999.9], [], [echo "$PYTHON" > py])' > mypy.m4
78 $AUTOCONF --force
79 ./configure
80 test x"$(cat py)" = x: