doc: update Vala documentation
[automake.git] / t / vala-configure.sh
blob61f26a933f659d8b7c98b33354ce75634d4ab6bc
1 #! /bin/sh
2 # Copyright (C) 2008-2024 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 if test "x$1" = x--api-version; then
41 echo "${vala_version-1.2.3}"
43 exit 0
44 END
45 chmod +x bin/valac
47 cat > bin/valac.old << 'END'
48 #! /bin/sh
49 if test "x$1" = x--version; then
50 echo 0.1
52 if test "x$1" = x--api-version; then
53 echo 0.1
55 exit 0
56 END
57 chmod +x bin/valac.old
59 PATH=$(pwd)/bin$PATH_SEPARATOR$PATH; export PATH
61 # Avoid interferences from the environment.
62 unset VALAC vala_version
64 $ACLOCAL
65 $AUTOMAKE -a
66 $AUTOCONF
68 st=0; ./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=99.9 ./configure 2>stderr || st=$?
75 cat stderr >&2
76 grep 'WARNING.*vala' stderr && exit 1
77 test $st -eq 0
78 $MAKE has-valac
80 st=0; vala_version=0.1.2 ./configure 2>stderr || st=$?
81 cat stderr >&2
82 test $st -eq 0
83 grep '^configure: WARNING: Vala compiler not found or too old' stderr
84 $MAKE no-valac
86 st=0; ./configure VALAC="$(pwd)/bin/valac.old" 2>stderr || st=$?
87 cat stderr >&2
88 test $st -eq 0 || exit 1
89 grep '^configure: WARNING: Vala compiler not found or too old' stderr
90 $MAKE no-valac
92 sed 's/^\(AM_PROG_VALAC\).*/\1([1], [: > ok], [: > ko])/' <configure.ac >t
93 mv -f t configure.ac
94 rm -rf autom4te*.cache
95 $ACLOCAL
96 $AUTOCONF
98 st=0; ./configure 2>stderr || st=$?
99 cat stderr >&2
100 grep 'WARNING.*vala' stderr && exit 1
101 test -f ok
102 test ! -e ko
103 $MAKE has-valac
104 rm -f ok ko
106 st=0; vala_version=0.1.2 ./configure 2>stderr || st=$?
107 cat stderr >&2
108 grep 'WARNING.*vala' stderr && exit 1
109 test $st -eq 0
110 test ! -e ok
111 test -f ko
112 $MAKE no-valac
113 rm -f ok ko
115 st=0; ./configure VALAC="$(pwd)/bin/valac.old" 2>stderr || st=$?
116 cat stderr >&2
117 grep 'WARNING.*vala' stderr && exit 1
118 test $st -eq 0
119 test ! -e ok
120 test -f ko
121 $MAKE no-valac
122 rm -f ok ko