Merge branch 'msvc' into maint
[platform/upstream/automake.git] / tests / vala.test
1 #! /bin/sh
2 # Copyright (C) 1996, 2001, 2002, 2006, 2008, 2009, 2012 Free Software
3 # Foundation, Inc.
4 #
5 # This file is part of GNU Automake.
6 #
7 # GNU Automake is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2, or (at your option)
10 # any later version.
11 #
12 # GNU Automake is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 # GNU General Public License for more details.
16 #
17 # You should have received a copy of the GNU General Public License
18 # along with Automake; see the file COPYING.  If not, write to
19 # the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 # Boston, MA 02110-1301, USA.
21
22 # Basic "grepping" test on vala support.
23
24 . ./defs || Exit 1
25
26 set -e
27
28 # So that we won't require libtool macros.
29 cat > acinclude.m4 <<'END'
30 AC_DEFUN([AC_PROG_LIBTOOL],
31          [AC_SUBST([LIBTOOL], [:])])
32 END
33
34 cat >> configure.in <<'END'
35 AC_PROG_CC
36 AC_PROG_CXX
37 AM_PROG_AR
38 AC_PROG_LIBTOOL
39 AM_PROG_VALAC
40 AC_CONFIG_FILES([sub/Makefile])
41 AC_OUTPUT
42 END
43
44 cat > Makefile.am <<'END'
45 SUBDIRS = sub
46
47 bin_PROGRAMS = zardoz
48 zardoz_SOURCES = zardoz.vala
49 zardoz_VALAFLAGS = --debug
50
51 lib_LTLIBRARIES = libzardoz.la
52 libzardoz_la_SOURCES = zardoz-foo.vala zardoz-bar.vala
53 END
54
55 mkdir sub
56
57 cat > sub/Makefile.am <<'END'
58 bin_PROGRAMS = foo
59 foo_SOURCES = bar.vala baz.vala mu.c zap.cxx
60 END
61
62 : > ltmain.sh
63 : > config.sub
64 : > config.guess
65
66 $ACLOCAL
67 $AUTOMAKE -a
68
69 grep '\$(VALAC).* \$(AM_VALAFLAGS) \$(VALAFLAGS) ' Makefile.in
70 grep '\$(VALAC).* \$(zardoz_VALAFLAGS) \$(VALAFLAGS) ' Makefile.in
71 $FGREP 'am_zardoz_OBJECTS' Makefile.in
72 $FGREP 'am_libzardoz_la_OBJECTS' Makefile.in
73 $FGREP 'zardoz_vala.stamp:' Makefile.in
74 $FGREP 'libzardoz_la_vala.stamp:' Makefile.in
75 test `$FGREP -c '.stamp:' Makefile.in` -eq 2
76 $FGREP 'zardoz.c' Makefile.in
77 $FGREP 'zardoz-foo.c' Makefile.in
78 $FGREP 'zardoz-bar.c' Makefile.in
79
80 grep '\$(VALAC).* \$(AM_VALAFLAGS) \$(VALAFLAGS) ' sub/Makefile.in
81 $FGREP 'foo_VALAFLAGS' sub/Makefile.in && Exit 1
82 $FGREP 'am_foo_OBJECTS' sub/Makefile.in
83 $FGREP 'bar.c' sub/Makefile.in
84 $FGREP 'baz.c' sub/Makefile.in
85 $FGREP 'foo_vala.stamp:' sub/Makefile.in
86 test `$FGREP -c '.stamp:' sub/Makefile.in` -eq 1
87
88 # Check against regression for weird bug due to unescaped '@'
89 # characters used in a "..." perl string when writing the vala
90 # rules from automake.in.
91 grep '\$[0-9][0-9]*t' Makefile.in sub/Makefile.in && Exit 1
92
93 :