tests: never source test-defs.sh directly, source test-lib.sh instead
[automake.git] / t / vala.sh
blob9e48549f899f53ebc2dffea483bd246351eedbcc
1 #! /bin/sh
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)
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 # Basic "grepping" test on vala support.
19 . ./defs || exit 1
21 # So that we won't require libtool macros.
22 cat > acinclude.m4 <<'END'
23 AC_DEFUN([AC_PROG_LIBTOOL],
24 [AC_SUBST([LIBTOOL], [:])])
25 END
27 cat >> 'configure.ac' << 'END'
28 AC_PROG_CC
29 AC_PROG_CXX
30 AM_PROG_AR
31 AC_PROG_LIBTOOL
32 AM_PROG_VALAC
33 AC_CONFIG_FILES([sub/Makefile])
34 AC_OUTPUT
35 END
37 cat > Makefile.am <<'END'
38 SUBDIRS = sub
40 bin_PROGRAMS = zardoz
41 zardoz_SOURCES = zardoz.vala
42 zardoz_VALAFLAGS = --debug
44 lib_LTLIBRARIES = libzardoz.la
45 libzardoz_la_SOURCES = zardoz-foo.vala zardoz-bar.vala
46 END
48 mkdir sub
50 cat > sub/Makefile.am <<'END'
51 bin_PROGRAMS = foo
52 foo_SOURCES = bar.vala baz.vala mu.c zap.cxx
53 END
55 : > ltmain.sh
56 : > config.sub
57 : > config.guess
59 $ACLOCAL
60 $AUTOMAKE -a
62 grep '\$(VALAC).* \$(AM_VALAFLAGS) \$(VALAFLAGS) ' Makefile.in
63 grep '\$(VALAC).* \$(zardoz_VALAFLAGS) \$(VALAFLAGS) ' Makefile.in
64 $FGREP 'am_zardoz_OBJECTS' Makefile.in
65 $FGREP 'am_libzardoz_la_OBJECTS' Makefile.in
66 $FGREP 'zardoz_vala.stamp:' Makefile.in
67 $FGREP 'libzardoz_la_vala.stamp:' Makefile.in
68 test $($FGREP -c '.stamp:' Makefile.in) -eq 2
69 $FGREP 'zardoz.c' Makefile.in
70 $FGREP 'zardoz-foo.c' Makefile.in
71 $FGREP 'zardoz-bar.c' Makefile.in
73 grep '\$(VALAC).* \$(AM_VALAFLAGS) \$(VALAFLAGS) ' sub/Makefile.in
74 $FGREP 'foo_VALAFLAGS' sub/Makefile.in && exit 1
75 $FGREP 'am_foo_OBJECTS' sub/Makefile.in
76 $FGREP 'bar.c' sub/Makefile.in
77 $FGREP 'baz.c' sub/Makefile.in
78 $FGREP 'foo_vala.stamp:' sub/Makefile.in
79 test $($FGREP -c '.stamp:' sub/Makefile.in) -eq 1
81 # Check against regression for weird bug due to unescaped '@'
82 # characters used in a "..." perl string when writing the vala
83 # rules from automake.in.
84 grep '\$[0-9][0-9]*t' Makefile.in sub/Makefile.in && exit 1