Merge branch 'minor'
[automake.git] / t / vala-configure.sh
blobb7ba9db1423531824cfba99cec68951abb61734d
1 #! /bin/sh
2 # Copyright (C) 2008-2017 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 <https://www.gnu.org/licenses/>.
17 # Test AM_PROG_VALAC.
19 . test-init.sh
21 cat >> configure.ac << 'END'
22 AC_PROG_CC
23 AM_PROG_VALAC([1.2.3])
24 AC_OUTPUT
25 END
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
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}"
40 exit 0
41 END
42 chmod +x bin/valac
44 cat > bin/valac.old << 'END'
45 #! /bin/sh
46 if test "x$1" = x--version; then
47 echo 0.1
49 exit 0
50 END
51 chmod +x bin/valac.old
53 PATH=$(pwd)/bin$PATH_SEPARATOR$PATH; export PATH
55 # Avoid interferences from the environment.
56 unset VALAC vala_version
58 $ACLOCAL
59 $AUTOMAKE -a
60 $AUTOCONF
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
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
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
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
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
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
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
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