am-ft: make the environment available earlier
[platform/upstream/automake.git] / t / vala-headers.sh
1 #! /bin/sh
2 # Copyright (C) 1996-2013 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 cat >> configure.ac << 'END'
23 AC_PROG_CC
24 AM_PROG_VALAC([0.7.0])
25 PKG_CHECK_MODULES([GOBJECT], [gobject-2.0 >= 2.4])
26 AC_OUTPUT
27 END
28
29 cat > Makefile.am << 'END'
30 bin_PROGRAMS = zardoz quux
31
32 zardoz_SOURCES = zardoz.vala
33 quux_SOURCES = quux.vala
34 quux.vala: zardoz.vala
35         sed 's/Zardoz/Quux/' <zardoz.vala >quux.vala
36
37 quux_VALAFLAGS = \
38   --header HDR.h \
39   --vapi hello.vapi
40
41 zardoz_VALAFLAGS = \
42   -H foo.h \
43   --internal-header foo2.h \
44   --internal-vapi foo3.vapi
45
46 AM_CFLAGS = $(GOBJECT_CFLAGS)
47 LDADD = $(GOBJECT_LIBS)
48 END
49
50 headers='HDR.h hello.vapi foo.h foo2.h foo3.vapi'
51
52 cat > zardoz.vala << 'END'
53 using GLib;
54 public class Zardoz {
55   public static void main () {
56     stdout.printf ("Zardoz!\n");
57   }
58 }
59 END
60
61 $ACLOCAL
62 $AUTOCONF
63 $AUTOMAKE -a
64
65 ./configure
66 $MAKE
67
68 # Test rebuild rules.
69
70 for h in $headers; do
71   rm -f $h
72   $MAKE $h
73   test -f $h
74 done
75
76 rm -f $headers
77 $MAKE $headers
78 for h in $headers; do test -f $h; done
79
80 $MAKE distcheck
81
82 $MAKE maintainer-clean
83 for h in $headers; do test ! -e $h; done
84
85 :