1#! /bin/sh 2# Copyright (C) 1996-2021 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 <https://www.gnu.org/licenses/>. 16 17# Test to make sure compiling Vala code really works with recursive make. 18 19required="pkg-config valac gcc GNUmake" 20. test-init.sh 21 22cat >> configure.ac << 'END' 23AC_PROG_CC 24AM_PROG_VALAC([0.7.0]) 25PKG_CHECK_MODULES([GOBJECT], [gobject-2.0 >= 2.4]) 26AC_OUTPUT 27END 28 29cat > Makefile.am << 'END' 30bin_PROGRAMS = zardoz quux 31 32zardoz_SOURCES = zardoz.vala 33quux_SOURCES = quux.vala 34quux.vala: zardoz.vala 35 sed 's/Zardoz/Quux/' <zardoz.vala >quux.vala 36 37quux_VALAFLAGS = \ 38 --header HDR.h \ 39 --vapi hello.vapi 40 41zardoz_VALAFLAGS = \ 42 -H foo.h \ 43 --internal-header foo2.h \ 44 --internal-vapi foo3.vapi 45 46AM_CFLAGS = $(GOBJECT_CFLAGS) 47LDADD = $(GOBJECT_LIBS) 48 49# Tell GNU make not to parallelize, since the tests can result in, for example: 50# mv: cannot stat 'quux_vala.stamp-t': No such file or directory 51# make[1]: *** [Makefile:438: quux_vala.stamp] Error 1 52# No evident way to debug or reliably reproduce. 53.NOTPARALLEL: 54END 55 56headers='HDR.h hello.vapi foo.h foo2.h foo3.vapi' 57 58cat > zardoz.vala << 'END' 59using GLib; 60public class Zardoz { 61 public static void main () { 62 stdout.printf ("Zardoz!\n"); 63 } 64} 65END 66 67$ACLOCAL 68$AUTOCONF 69$AUTOMAKE -a 70 71./configure 72$MAKE 73 74# Test rebuild rules. 75 76for h in $headers; do 77 rm -f $h 78 $MAKE $h 79 test -f $h 80done 81 82rm -f $headers 83$MAKE $headers 84for h in $headers; do test -f $h; done 85 86$MAKE distcheck 87 88$MAKE maintainer-clean 89for h in $headers; do test ! -e $h; done 90 91: 92