vala tests: don't use the 'posix' profile, it's no longer supported
[platform/upstream/automake.git] / t / vala-recursive-setup.sh
1 #! /bin/sh
2 # Copyright (C) 1996-2012 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 to make sure compiling Vala code really works with recursive make.
18
19 required="pkg-config valac gcc GNUmake"
20 . test-init.sh
21
22 mkdir src
23
24 cat >> 'configure.ac' << 'END'
25 AC_PROG_CC
26 AM_PROG_CC_C_O
27 AM_PROG_VALAC([0.7.0])
28 PKG_CHECK_MODULES([GOBJECT], [gobject-2.0 >= 2.4])
29 AC_CONFIG_FILES([src/Makefile])
30 AC_OUTPUT
31 END
32
33 cat > 'Makefile.am' <<'END'
34 SUBDIRS = src
35 END
36
37 cat > 'src/Makefile.am' <<'END'
38 bin_PROGRAMS = zardoz
39 zardoz_VALAFLAGS = -H zardoz.h
40 zardoz_CFLAGS = $(GOBJECT_CFLAGS)
41 zardoz_LDADD = $(GOBJECT_LIBS)
42 zardoz_SOURCES = zardoz.vala
43 END
44
45 cat > 'src/zardoz.vala' <<'END'
46 using GLib;
47
48 public class Zardoz {
49   public static void main () {
50     stdout.printf ("Zardoz!\n");
51   }
52 }
53 END
54
55 $ACLOCAL
56 $AUTOCONF
57 $AUTOMAKE -a
58
59 grep PKG_CHECK_MODULES configure && skip_ "pkg-config m4 macros not found"
60
61 ./configure
62 $MAKE
63
64 # Test rebuild rules.
65
66 rm -f src/zardoz.h
67 $MAKE -C src zardoz.h
68 test -f src/zardoz.h
69 rm -f src/zardoz.c
70 $MAKE -C src
71 test -f src/zardoz.c
72
73 echo am--error > src/zardoz.h
74 echo am--error > src/zardoz.c
75 $sleep
76 touch src/zardoz.vala
77 $MAKE
78 grep 'am--error' src/zardoz.[ch] && exit 1
79
80 # Check the distribution.
81
82 $MAKE distcheck
83 $MAKE distclean
84
85 # Tru a VPATH setup.
86
87 mkdir build
88 cd build
89 ../configure
90 $MAKE
91 $MAKE distcheck
92
93 # Test rebuild rules from builddir.
94
95 rm -f ../src/zardoz.h
96 $MAKE -C src ../../src/zardoz.h
97 test -f ../src/zardoz.h
98
99 rm -f ../src/zardoz.c
100 $MAKE
101 grep 'Zardoz!' ../src/zardoz.c
102
103 $sleep
104 sed 's/Zardoz!/FooBar!/' ../src/zardoz.vala > t
105 mv -f t ../src/zardoz.vala
106 $MAKE
107 grep 'FooBar!' ../src/zardoz.c
108 grep 'Zardoz!' ../src/zardoz.c && exit 1
109
110 :