tests: cosmetic changes in t/extra-sources.sh
[platform/upstream/automake.git] / t / vala-configure.sh
1 #! /bin/sh
2 # Copyright (C) 2008-2013 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 AM_PROG_VALAC.
18
19 . test-init.sh
20
21 cat >> configure.ac << 'END'
22 AC_PROG_CC
23 AM_PROG_VALAC([1.2.3])
24 AC_OUTPUT
25 END
26
27 cat > Makefile.am << 'END'
28 has-valac:
29         case '$(VALAC)' in */bin/valac) exit 0;; *) exit 1;; esac
30 no-valac:
31         test x'$(VALAC)' = x'valac'
32 END
33
34 mkdir bin
35 cat > bin/valac << 'END'
36 #! /bin/sh
37 if test "x$1" = x--version; then
38   echo "${vala_version-1.2.3}"
39 fi
40 exit 0
41 END
42 chmod +x bin/valac
43
44 cat > bin/valac.old << 'END'
45 #! /bin/sh
46 if test "x$1" = x--version; then
47   echo 0.1
48 fi
49 exit 0
50 END
51 chmod +x bin/valac.old
52
53 PATH=$(pwd)/bin$PATH_SEPARATOR$PATH; export PATH
54
55 # Avoid interferences from the environment.
56 unset VALAC vala_version
57
58 $ACLOCAL
59 $AUTOMAKE -a
60 $AUTOCONF
61
62 st=0; ./configure 2>stderr || st=$?
63 cat stderr >&2
64 grep 'WARNING.*vala' stderr && exit 1
65 test $st -eq 0
66 $MAKE has-valac
67
68 st=0; vala_version=99.9 ./configure 2>stderr || st=$?
69 cat stderr >&2
70 grep 'WARNING.*vala' stderr && exit 1
71 test $st -eq 0
72 $MAKE has-valac
73
74 st=0; vala_version=0.1.2 ./configure 2>stderr || st=$?
75 cat stderr >&2
76 test $st -eq 0
77 grep '^configure: WARNING: no proper vala compiler found' stderr
78 $MAKE no-valac
79
80 st=0; ./configure VALAC="$(pwd)/bin/valac.old" 2>stderr || st=$?
81 cat stderr >&2
82 test $st -eq 0 || exit 1
83 grep '^configure: WARNING: no proper vala compiler found' stderr
84 $MAKE no-valac
85
86 sed 's/^\(AM_PROG_VALAC\).*/\1([1], [: > ok], [: > ko])/' <configure.ac >t
87 mv -f t configure.ac
88 rm -rf autom4te*.cache
89 $ACLOCAL
90 $AUTOCONF
91
92 st=0; ./configure 2>stderr || st=$?
93 cat stderr >&2
94 grep 'WARNING.*vala' stderr && exit 1
95 test -f ok
96 test ! -e ko
97 $MAKE has-valac
98 rm -f ok ko
99
100 st=0; vala_version=0.1.2 ./configure 2>stderr || st=$?
101 cat stderr >&2
102 grep 'WARNING.*vala' stderr && exit 1
103 test $st -eq 0
104 test ! -e ok
105 test -f ko
106 $MAKE no-valac
107 rm -f ok ko
108
109 st=0; ./configure VALAC="$(pwd)/bin/valac.old" 2>stderr || st=$?
110 cat stderr >&2
111 grep 'WARNING.*vala' stderr && exit 1
112 test $st -eq 0
113 test ! -e ok
114 test -f ko
115 $MAKE no-valac
116 rm -f ok ko
117
118 :