2 # Copyright (C) 1996-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)
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 # Test to make sure compiling Vala code really works with recursive make.
19 required="pkg-config valac gcc GNUmake"
24 cat >> 'configure.ac' << 'END'
27 AM_PROG_VALAC([0.7.0])
28 PKG_CHECK_MODULES([GOBJECT], [gobject-2.0 >= 2.4])
29 AC_CONFIG_FILES([src/Makefile])
33 cat > 'Makefile.am' <<'END'
37 cat > 'src/Makefile.am' <<'END'
39 zardoz_VALAFLAGS = -H zardoz.h
40 zardoz_CFLAGS = $(GOBJECT_CFLAGS)
41 zardoz_LDADD = $(GOBJECT_LIBS)
42 zardoz_SOURCES = zardoz.vala
45 cat > 'src/zardoz.vala' <<'END'
49 public static void main () {
50 stdout.printf ("Zardoz!\n");
59 grep PKG_CHECK_MODULES configure && skip_ "pkg-config m4 macros not found"
73 echo am--error > src/zardoz.h
74 echo am--error > src/zardoz.c
78 grep 'am--error' src/zardoz.[ch] && exit 1
80 # Check the distribution.
93 # Test rebuild rules from builddir.
96 $MAKE -C src ../../src/zardoz.h
97 test -f ../src/zardoz.h
101 grep 'Zardoz!' ../src/zardoz.c
104 sed 's/Zardoz!/FooBar!/' ../src/zardoz.vala > t
105 mv -f t ../src/zardoz.vala
107 grep 'FooBar!' ../src/zardoz.c
108 grep 'Zardoz!' ../src/zardoz.c && exit 1