Revert Automake license to GPLv2+.
[platform/upstream/automake.git] / tests / python10.test
1 #! /bin/sh
2 # Copyright (C) 2004, 2007  Free Software Foundation, Inc.
3 #
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.
8 #
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.
13 #
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/>.
16
17 # Test _PYTHON with conditionals.
18
19 required=python
20 . ./defs || Exit 1
21
22 set -e
23
24 cat >>configure.in <<'EOF'
25 AM_PATH_PYTHON
26 AM_CONDITIONAL([ONE], [test "x$one" = x1])
27 AC_OUTPUT
28 EOF
29
30 cat > Makefile.am <<'END'
31 if ONE
32 mydir=$(prefix)/my
33 my_PYTHON = one.py
34 else
35 yourdir=$(prefix)/your
36 your_PYTHON = two.py
37 endif
38
39 one.py:
40         echo 'def one(): return 1' >$@
41 two.py:
42         echo 'def two(): return 1' >$@
43
44 disttest: distdir
45         test -f $(distdir)/one.py
46         test -f $(distdir)/two.py
47 END
48
49 $ACLOCAL
50 $AUTOCONF
51 $AUTOMAKE --add-missing
52
53 mkdir inst
54 inst=`pwd`/inst
55 mkdir build
56 cd build
57 ../configure --prefix="$inst"
58 $MAKE install
59 test -f "$inst/your/two.py"
60 test -f "$inst/your/two.pyc"
61 test -f "$inst/your/two.pyo"
62 test ! -f "$inst/my/one.py"
63 test ! -f "$inst/my/one.pyc"
64 test ! -f "$inst/my/one.pyo"
65 $MAKE uninstall
66 test ! -f "$inst/your/two.py"
67 test ! -f "$inst/your/two.pyc"
68 test ! -f "$inst/your/two.pyo"
69
70 ../configure --prefix="$inst" one=1
71 $MAKE install
72 test ! -f "$inst/your/two.py"
73 test ! -f "$inst/your/two.pyc"
74 test ! -f "$inst/your/two.pyo"
75 test -f "$inst/my/one.py"
76 test -f "$inst/my/one.pyc"
77 test -f "$inst/my/one.pyo"
78 $MAKE uninstall
79 test ! -f "$inst/my/one.py"
80 test ! -f "$inst/my/one.pyc"
81 test ! -f "$inst/my/one.pyo"
82
83 $MAKE disttest