Merge branch 'python-fix-pr10227' into maint
[automake.git] / t / vala-mix2.sh
blob9b2402dec4fc3e8fc577db3926a1490ad8525dfc
1 #! /bin/sh
2 # Copyright (C) 2012 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 <http://www.gnu.org/licenses/>.
17 # Vala sources, C and C++ sources and C and C++ headers in the same
18 # program. Functional test. See automake bug#10894.
20 required='valac cc c++ GNUmake'
21 . test-init.sh
23 cat >> configure.ac <<'END'
24 AC_PROG_CC
25 AC_PROG_CXX
26 AM_PROG_VALAC([0.7.3])
27 AC_OUTPUT
28 END
30 cat > Makefile.am <<'END'
31 bin_PROGRAMS = zardoz
32 AM_VALAFLAGS = --profile=posix
33 zardoz_SOURCES = zardoz.vala foo.h bar.c baz.c zen.hh master.cxx
34 END
36 cat > zardoz.vala <<'END'
37 int main ()
39 stdout.printf ("foo is alive\n");
40 return 0;
42 END
44 cat > foo.h <<'END'
45 int foo;
46 int bar (void);
47 int baz (void);
48 END
50 cat > bar.c <<'END'
51 #include "foo.h"
52 int bar (void) { return foo + baz (); }
53 END
55 cat > baz.c <<'END'
56 #include "foo.h"
57 extern int foo = 0;
58 int baz (void) { return 0; }
59 END
61 cat > zen.hh <<'END'
62 #include <iostream>
63 END
65 cat > master.cxx <<'END'
66 #include "zen.hh"
67 void chatty (void) { std::cout << "Hello, stranger!\n"; }
68 END
70 $ACLOCAL
71 $AUTOMAKE -a
72 $AUTOCONF
74 # Do not reject slower dependency extractors.
75 ./configure --enable-dependency-tracking
77 $MAKE all
78 ls -l # For debugging.
80 have_generated_files ()
82 test -f zardoz_vala.stamp
83 test -f zardoz.c
86 # Our vala-related rules must create stamp files and intermediate
87 # C files.
88 have_generated_files
90 # Remake rules are not uselessly triggered.
91 $MAKE -q
92 $MAKE -n | $FGREP vala.stamp && exit 1
94 # But are triggered when they should.
95 for file in zardoz.vala foo.h bar.c baz.c zen.hh master.cxx; do
96 $sleep
97 echo '& choke me !' >> $file
98 $MAKE && exit 1
99 $sleep
100 sed '$d' $file > t
101 mv -f t $file
102 $MAKE
103 done
105 # Check the distribution.
106 $MAKE distcheck
108 # Stamp files and intermediate C files should *not* be removed
109 # by "make clean".
110 $MAKE clean
111 ls -l # For debugging.
112 have_generated_files
114 # But stamp files should be removed by "maintainer-clean" (the
115 # behaviour w.r.t. intermediate C files is still unclear, and
116 # better left undefined for the moment).
117 $MAKE maintainer-clean
118 ls *vala*.stamp | grep . && exit 1