1#! /bin/sh
2# Copyright (C) 2012-2021 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 <https://www.gnu.org/licenses/>.
16
17# Vala support with parallel make.
18
19required='valac cc pkg-config GNUmake'
20. test-init.sh
21
22cat >> configure.ac <<'END'
23AC_PROG_CC
24AC_PROG_CXX
25PKG_CHECK_MODULES([GOBJECT], [gobject-2.0 >= 2.4])
26AM_PROG_VALAC([0.7.3])
27AC_OUTPUT
28END
29
30cat > Makefile.am <<'END'
31bin_PROGRAMS = zardoz
32AM_CFLAGS = $(GOBJECT_CFLAGS)
33LDADD = $(GOBJECT_LIBS)
34zardoz_SOURCES = main.vala 1.vala 2.vala 3.vala 4.vala 5.vala 6.vala
35END
36
37echo 'int main () {' > main.vala
38for i in 1 2 3 4 5 6; do
39  echo "void foo$i () { stdout.printf (\"ok $i\\n\"); }" > $i.vala
40  echo "foo$i ();" >> main.vala
41done
42echo 'return 0; }' >> main.vala
43
44cat main.vala # For debugging.
45
46$ACLOCAL
47$AUTOMAKE -a
48$AUTOCONF
49
50./configure
51
52$MAKE -j3
53ls -l # For debugging.
54for x in main 1 2 3 4 5 6; do test -f $x.c; done
55test -f  zardoz_vala.stamp
56
57$MAKE maintainer-clean -j4
58ls -l # For debugging.
59for x in main 1 2 3 4 5 6; do test ! -e $x.c; done
60test ! -e zardoz_vala.stamp
61
62mkdir build
63cd build
64../configure
65$MAKE -j6
66ls -l . .. # For debugging.
67for x in main 1 2 3 4 5 6; do test -f $x.c; done
68test -f ./zardoz_vala.stamp
69
70$MAKE distcheck -j4
71
72$MAKE maintainer-clean -j2
73for x in main 1 2 3 4 5 6; do test ! -e ../$x.c; done
74test ! -e ../zardoz_vala.stamp
75
76:
77