tests: remove most uses of the AM_PROG_CC_C_O obsolete macro
[platform/upstream/automake.git] / t / vala-non-recursive-setup.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 non-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_VALAC([0.7.0])
27 PKG_CHECK_MODULES([GOBJECT], [gobject-2.0 >= 2.4])
28 AC_OUTPUT
29 END
30
31 cat > 'src/zardoz.vala' <<'END'
32 using GLib;
33
34 public class Zardoz {
35   public static void main () {
36     stdout.printf ("Zardoz!\n");
37   }
38 }
39 END
40
41 cat > 'Makefile.am' <<'END'
42 bin_PROGRAMS = src/zardoz
43 src_zardoz_CFLAGS = $(GOBJECT_CFLAGS)
44 src_zardoz_LDADD = $(GOBJECT_LIBS)
45 src_zardoz_SOURCES = src/zardoz.vala
46 END
47
48 $ACLOCAL
49 $AUTOCONF
50 $AUTOMAKE -a
51
52 ./configure
53 $MAKE
54 test -f src/zardoz.c
55 test -f src_zardoz_vala.stamp
56 $MAKE distcheck
57 $MAKE maintainer-clean
58 test ! -e src/zardoz.c
59 test ! -e src_zardoz_vala.stamp
60
61 mkdir build
62 cd build
63 ../configure
64 $MAKE
65 $MAKE distcheck
66
67 cd ..
68 rm -rf build
69
70 # Try again with subdir-objects.
71
72 cat > 'Makefile.am' <<'END'
73 AUTOMAKE_OPTIONS = subdir-objects
74
75 bin_PROGRAMS = src/zardoz
76 src_zardoz_CFLAGS = $(GOBJECT_CFLAGS)
77 src_zardoz_LDADD = $(GOBJECT_LIBS)
78 src_zardoz_SOURCES = src/zardoz.vala
79 END
80
81 $ACLOCAL
82 $AUTOCONF
83 $AUTOMAKE -a
84
85 ./configure || skip_ "configure failure"
86 $MAKE
87 $MAKE distcheck
88 $MAKE distclean
89 mkdir build
90 cd build
91 ../configure
92 $MAKE
93 $MAKE distcheck
94
95