>From e98d9faf34fbb9ab2e719c22beb968e386d06425 Mon Sep 17 00:00:00 2001
From: =?utf-8?q?J=C3=BCrg=20Billeter?=
Date: Tue, 31 Mar 2009 10:08:24 +0200
Subject: [PATCH] Initial support for the Vala programming language.
* automake.in: Add %known_libraries, lang_vala_rewrite,
lang_vala_finish and lang_vala_target_hook to support the Vala
programming language. Register Vala language hooks.
* doc/automake.texi, NEWS: Document Vala support.
* lib/am/vala.am: Empty rules file to prevent creation of depend2
based rules for Vala code.
* lib/am/Makefile.am (dist_am_DATA): Add vala.am.
* m4/vala.m4: Provide AM_PROG_VALAC for detecting the Vala compiler.
* m4/Makefile.am (dist_m4data_DATA): Add vala.m4.
* tests/vala.test: Test Vala support.
* tests/vala1.test: Test .c file generation.
* tests/vala2.test: Test recursive make.
* tests/vala3.test: Test non-recursive make.
* tests/vala4.test: Test AM_PROG_VALAC.
* tests/Makefile.am: Update.
Based on patch by Mathias Hasselmann.
---
ChangeLog | 20 ++++++++++
NEWS | 2 +
automake.in | 99 +++++++++++++++++++++++++++++++++++++++++++++++++++-
doc/automake.texi | 52 +++++++++++++++++++++++++++
lib/am/Makefile.am | 1 +
lib/am/Makefile.in | 1 +
lib/am/vala.am | 17 +++++++++
m4/Makefile.am | 3 +-
m4/Makefile.in | 3 +-
m4/vala.m4 | 29 +++++++++++++++
tests/Makefile.am | 5 +++
tests/Makefile.in | 5 +++
tests/vala.test | 59 +++++++++++++++++++++++++++++++
tests/vala1.test | 58 ++++++++++++++++++++++++++++++
tests/vala2.test | 70 ++++++++++++++++++++++++++++++++++++
tests/vala3.test | 64 +++++++++++++++++++++++++++++++++
tests/vala4.test | 61 ++++++++++++++++++++++++++++++++
17 files changed, 546 insertions(+), 3 deletions(-)
create mode 100644 lib/am/vala.am
create mode 100644 m4/vala.m4
create mode 100755 tests/vala.test
create mode 100755 tests/vala1.test
create mode 100755 tests/vala2.test
create mode 100755 tests/vala3.test
create mode 100755 tests/vala4.test
diff --git a/ChangeLog b/ChangeLog
index 3e08fe6..cadf637 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,23 @@
+2009-03-31 Jürg Billeter
+
+ Initial support for the Vala programming language.
+ * automake.in: Add %known_libraries, lang_vala_rewrite,
+ lang_vala_finish and lang_vala_target_hook to support the Vala
+ programming language. Register Vala language hooks.
+ * doc/automake.texi, NEWS: Document Vala support.
+ * lib/am/vala.am: Empty rules file to prevent creation of depend2
+ based rules for Vala code.
+ * lib/am/Makefile.am (dist_am_DATA): Add vala.am.
+ * m4/vala.m4: Provide AM_PROG_VALAC for detecting the Vala compiler.
+ * m4/Makefile.am (dist_m4data_DATA): Add vala.m4.
+ * tests/vala.test: Test Vala support.
+ * tests/vala1.test: Test .c file generation.
+ * tests/vala2.test: Test recursive make.
+ * tests/vala3.test: Test non-recursive make.
+ * tests/vala4.test: Test AM_PROG_VALAC.
+ * tests/Makefile.am: Update.
+ Based on patch by Mathias Hasselmann.
+
2009-03-29 Ralf Wildenhues
Rewrite maintainer-check in separate tests, parallelizable.
diff --git a/NEWS b/NEWS
index 6b94a7c..0126a14 100644
--- a/NEWS
+++ b/NEWS
@@ -42,6 +42,8 @@ New in 1.10a:
- The default source file extension (.c) can be overridden with
AM_DEFAULT_SOURCE_EXT now.
+ - Vala source files are recognized now.
+
* Miscellaneous changes:
- Automake development is done in a git repository on Savannah now, see
diff --git a/automake.in b/automake.in
index c1321f0..f5d0dac 100755
--- a/automake.in
+++ b/automake.in
@@ -112,7 +112,7 @@ sub finish ($)
my ($self) = @_;
if (defined $self->_finish)
{
- &{$self->_finish} ();
+ &{$self->_finish} (@_);
}
}
@@ -569,6 +569,7 @@ my @dist_targets;
# Keep track of all programs declared in this Makefile, without
# $(EXEEXT). @substitutions@ are not listed.
my %known_programs;
+my %known_libraries;
# Keys in this hash are the basenames of files which must depend on
# ansi2knr. Values are either the empty string, or the directory in
@@ -699,6 +700,7 @@ sub initialize_per_input ()
@dist_targets = ();
%known_programs = ();
+ %known_libraries= ();
%de_ansi_files = ();
@@ -802,6 +804,21 @@ register_language ('name' => 'header',
# Nothing to do.
'_finish' => sub { });
+# Vala
+register_language ('name' => 'vala',
+ 'Name' => 'Vala',
+ 'config_vars' => ['VALAC'],
+ 'flags' => ['VALAFLAGS'],
+ 'compile' => '$(VALAC) $(AM_VALAFLAGS) $(VALAFLAGS)',
+ 'compiler' => 'VALACOMPILE',
+ 'extensions' => ['.vala'],
+ 'output_extensions' => sub { (my $ext = $_[0]) =~ s/vala$/c/;
+ return ($ext,) },
+ 'rule_file' => 'vala',
+ '_finish' => \&lang_vala_finish,
+ '_target_hook' => \&lang_vala_target_hook,
+ 'nodist_specific' => 1);
+
# Yacc (C & C++).
register_language ('name' => 'yacc',
'Name' => 'Yacc',
@@ -2582,6 +2599,8 @@ sub handle_libraries
. "did you mean `$suggestion'?")
}
+ ($known_libraries{$onelib} = $bn) =~ s/\.a$//;
+
$where->push_context ("while processing library `$onelib'");
$where->set (INTERNAL->get);
@@ -2783,6 +2802,8 @@ sub handle_ltlibraries
. "did you mean `$suggestion'?")
}
+ ($known_libraries{$onelib} = $bn) =~ s/\.la$//;
+
$where->push_context ("while processing Libtool library `$onelib'");
$where->set (INTERNAL->get);
@@ -5488,6 +5509,15 @@ sub lang_header_rewrite
return LANG_IGNORE;
}
+# Rewrite a single Vala source file.
+sub lang_vala_rewrite
+{
+ my ($directory, $base, $ext) = @_;
+
+ (my $newext = $ext) =~ s/vala$/c/;
+ return (LANG_SUBDIR, $newext);
+}
+
# Rewrite a single yacc file.
sub lang_yacc_rewrite
{
@@ -5646,6 +5676,73 @@ sub lang_c_finish
}
}
+sub lang_vala_finish_target ($$)
+{
+ my ($self, $name) = @_;
+
+ my $derived = canonicalize ($name);
+ my $varname = $derived . '_SOURCES';
+ my $var = var ($varname);
+
+ if ($var)
+ {
+ foreach my $file ($var->value_as_list_recursive)
+ {
+ $output_rules .= "$file: ${derived}_vala.stamp ;\n"
+ if ($file =~ s/(.*)\.vala$/$1.c/);
+ }
+ }
+
+ my $compile = $self->compile;
+
+ # Rewrite each occurrence of `AM_$flag' in the compile
+ # rule into `${derived}_$flag' if it exists.
+ for my $flag (@{$self->flags})
+ {
+ my $val = "${derived}_$flag";
+ $compile =~ s/\(AM_$flag\)/\($val\)/
+ if set_seen ($val);
+ }
+
+ my $dirname = dirname ($name);
+
+ $compile .= " -C";
+
+ $output_rules .=
+ "${derived}_vala.stamp: \$(${derived}_SOURCES)\n".
+ "\t${compile} \$^\n\ttouch address@hidden";
+
+ &push_dist_common ("${derived}_vala.stamp");
+
+ $clean_files{"${derived}_vala.stamp"} = MAINTAINER_CLEAN;
+}
+
+# This is a vala helper which is called after all source file
+# processing is done.
+sub lang_vala_finish
+{
+ my ($self) = @_;
+
+ foreach my $prog (keys %known_programs)
+ {
+ lang_vala_finish_target ($self, $prog);
+ }
+
+ while (my ($name) = each %known_libraries)
+ {
+ lang_vala_finish_target ($self, $name);
+ }
+}
+
+# This is a vala helper which is called whenever we have decided to
+# compile a vala file.
+sub lang_vala_target_hook
+{
+ my ($self, $aggregate, $output, $input, %transform) = @_;
+
+ $clean_files{$output} = MAINTAINER_CLEAN;
+}
+
# This is a yacc helper which is called whenever we have decided to
# compile a yacc file.
sub lang_yacc_target_hook
diff --git a/doc/automake.texi b/doc/automake.texi
index e1f0f32..1382d5c 100644
--- a/doc/automake.texi
+++ b/doc/automake.texi
@@ -217,6 +217,7 @@ Building Programs and Libraries
* Fortran 77 Support:: Compiling Fortran 77 sources
* Fortran 9x Support:: Compiling Fortran 9x sources
* Java Support:: Compiling Java sources
+* Vala Support:: Compiling Vala sources
* Support for Other Languages:: Compiling other languages
* ANSI:: Automatic de-ANSI-fication (obsolete)
* Dependencies:: Automatic dependency tracking
@@ -4471,6 +4472,7 @@ to build programs and libraries.
* Fortran 77 Support:: Compiling Fortran 77 sources
* Fortran 9x Support:: Compiling Fortran 9x sources
* Java Support:: Compiling Java sources
+* Vala Support:: Compiling Vala sources
* Support for Other Languages:: Compiling other languages
* ANSI:: Automatic de-ANSI-fication (obsolete)
* Dependencies:: Automatic dependency tracking
@@ -6523,6 +6525,56 @@ using the @option{--main=} option. The easiest way to do this is to use
the @code{_LDFLAGS} variable for the program.
address@hidden Vala Support
address@hidden node-name, next, previous, up
address@hidden Vala Support
+
address@hidden Vala Support
address@hidden Support for Vala
+
+Automake provides support for Vala compilation
+(@uref{http://www.vala-project.org/}).
+
address@hidden
+foo_SOURCES = foo.vala bar.vala zardoc.c
address@hidden example
+
+Any @file{.vala} file listed in a @code{_SOURCE} variable will be
+compiled into C code by the Vala compiler.
+
+Automake ships with an Autoconf macro called @code{AM_PROG_VALAC}
+that will locate the Vala compiler and optionally check its version
+number.
+
address@hidden AM_PROG_VALAC (@ovar{MINIMUM-VERSION})
+Try to find a Vala compiler in @env{PATH}. If it is found, the variable
address@hidden is set. Optionally a minimum release number of the compiler
+can be requested:
+
address@hidden
+AM_PROG_VALAC([0.7.0])
address@hidden example
address@hidden defmac
+
+There are a few variables that are used when compiling Vala sources:
+
address@hidden @code
address@hidden VALAC
+Path to the the Vala compiler.
+
address@hidden VALAFLAGS
+Additional arguments for the Vala compiler.
+
address@hidden AM_VALAFLAGS
+The maintainer's variant of @code{VALAFLAGS}.
+
address@hidden
+lib_LTLIBRARIES = libfoo.la
+libfoo_la_SOURCES = foo.vala
address@hidden example
address@hidden vtable
+
+
@node Support for Other Languages
@comment node-name, next, previous, up
@section Support for Other Languages
diff --git a/lib/am/Makefile.am b/lib/am/Makefile.am
index 9767496..f6fdafa 100644
--- a/lib/am/Makefile.am
+++ b/lib/am/Makefile.am
@@ -59,4 +59,5 @@ tags.am \
texi-vers.am \
texibuild.am \
texinfos.am \
+vala.am \
yacc.am
diff --git a/lib/am/Makefile.in b/lib/am/Makefile.in
index 75e58e1..019709d 100644
--- a/lib/am/Makefile.in
+++ b/lib/am/Makefile.in
@@ -204,6 +204,7 @@ tags.am \
texi-vers.am \
texibuild.am \
texinfos.am \
+vala.am \
yacc.am
all: all-am
diff --git a/lib/am/vala.am b/lib/am/vala.am
new file mode 100644
index 0000000..fa2a23c
--- /dev/null
+++ b/lib/am/vala.am
@@ -0,0 +1,17 @@
+## automake - create Makefile.in from Makefile.am
+## Copyright (C) 2008 Free Software Foundation, Inc.
+
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3, or (at your option)
+## any later version.
+
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+
+## You should have received a copy of the GNU General Public License
+## along with this program. If not, see .
+
+## There is no rule here. :-)
diff --git a/m4/Makefile.am b/m4/Makefile.am
index 9f5e1c2..fd7c71c 100644
--- a/m4/Makefile.am
+++ b/m4/Makefile.am
@@ -55,7 +55,8 @@ sanity.m4 \
strip.m4 \
substnot.m4 \
tar.m4 \
-upc.m4
+upc.m4 \
+vala.m4
EXTRA_DIST = dirlist amversion.in
diff --git a/m4/Makefile.in b/m4/Makefile.in
index 972b980..aada406 100644
--- a/m4/Makefile.in
+++ b/m4/Makefile.in
@@ -200,7 +200,8 @@ sanity.m4 \
strip.m4 \
substnot.m4 \
tar.m4 \
-upc.m4
+upc.m4 \
+vala.m4
EXTRA_DIST = dirlist amversion.in
all: all-am
diff --git a/m4/vala.m4 b/m4/vala.m4
new file mode 100644
index 0000000..5606296
--- /dev/null
+++ b/m4/vala.m4
@@ -0,0 +1,29 @@
+# Autoconf support for the Vala compiler
+
+# Copyright (C) 2008 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 3
+
+# Check whether the Vala compiler exists in `PATH'. If it is found, the
+# variable VALAC is set. Optionally a minimum release number of the
+# compiler can be requested.
+#
+# AM_PROG_VALAC([MINIMUM-VERSION])
+# --------------------------------
+AC_DEFUN([AM_PROG_VALAC],
+[AC_PATH_PROG([VALAC], [valac], [])
+ AS_IF([test -z "$VALAC"],
+ [AC_MSG_WARN([No Vala compiler found. You will not be able to compile .vala source files.])],
+ [AS_IF([test -n "$1"],
+ [AC_MSG_CHECKING([$VALAC is at least version $1])
+ am__vala_version=`$VALAC --version`
+ AS_VERSION_COMPARE([$1], ["$am__vala_version"],
+ [AC_MSG_RESULT([yes])],
+ [AC_MSG_RESULT([yes])],
+ [AC_MSG_RESULT([no])
+ AC_MSG_ERROR([Vala $1 not found.])])])])
+])
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 027e3f5..840ec1b 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -655,6 +655,11 @@ unused.test \
upc.test \
upc2.test \
upc3.test \
+vala.test \
+vala1.test \
+vala2.test \
+vala3.test \
+vala4.test \
vars.test \
vars3.test \
vartar.test \
diff --git a/tests/Makefile.in b/tests/Makefile.in
index 138e043..50ebf52 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -810,6 +810,11 @@ unused.test \
upc.test \
upc2.test \
upc3.test \
+vala.test \
+vala1.test \
+vala2.test \
+vala3.test \
+vala4.test \
vars.test \
vars3.test \
vartar.test \
diff --git a/tests/vala.test b/tests/vala.test
new file mode 100755
index 0000000..ea6fee1
--- /dev/null
+++ b/tests/vala.test
@@ -0,0 +1,59 @@
+#! /bin/sh
+# Copyright (C) 1996, 2001, 2002, 2006, 2008 Free Software Foundation,
+# Inc.
+#
+# This file is part of GNU Automake.
+#
+# GNU Automake is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GNU Automake is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Automake; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301, USA.
+
+# Test to make sure intermediate .c files are built from vala source.
+
+required="libtool"
+. ./defs || Exit 1
+
+set -e
+
+cat >> 'configure.in' << 'END'
+AC_PROG_CC
+AC_PROG_LIBTOOL
+AM_PROG_VALAC
+AC_OUTPUT
+END
+
+cat > 'Makefile.am' <<'END'
+bin_PROGRAMS = zardoz
+zardoz_SOURCES = zardoz.vala
+zardoz_VALAFLAGS = --debug
+
+lib_LTLIBRARIES = libzardoz.la
+libzardoz_la_SOURCES = zardoz-foo.vala zardoz-bar.vala
+END
+
+: > ltmain.sh
+: > config.sub
+: > config.guess
+
+$ACLOCAL
+$AUTOMAKE -a
+
+grep 'VALAC' Makefile.in
+grep 'am_zardoz_OBJECTS' Makefile.in
+grep 'am_libzardoz_la_OBJECTS' Makefile.in
+grep 'zardoz_vala.stamp' Makefile.in
+grep 'libzardoz_la_vala.stamp' Makefile.in
+grep 'zardoz\.c' Makefile.in
+grep 'zardoz-foo\.c' Makefile.in
+
diff --git a/tests/vala1.test b/tests/vala1.test
new file mode 100755
index 0000000..1ee0455
--- /dev/null
+++ b/tests/vala1.test
@@ -0,0 +1,58 @@
+#! /bin/sh
+# Copyright (C) 1996, 2001, 2002, 2006, 2008 Free Software Foundation,
+# Inc.
+#
+# This file is part of GNU Automake.
+#
+# GNU Automake is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GNU Automake is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Automake; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301, USA.
+
+# Test to make sure intermediate .c files are built from vala sources
+# in non-recursive automake mode.
+
+required="libtool"
+. ./defs || Exit 1
+
+set -e
+
+cat >> 'configure.in' << 'END'
+AC_PROG_CC
+AC_PROG_LIBTOOL
+AM_PROG_VALAC
+AC_OUTPUT
+END
+
+cat > 'Makefile.am' <<'END'
+bin_PROGRAMS = src/zardoz
+src_zardoz_SOURCES = src/zardoz.vala
+
+lib_LTLIBRARIES = src/libzardoz.la
+src_libzardoz_la_SOURCES = src/zardoz-foo.vala src/zardoz-bar.vala
+END
+
+: > ltmain.sh
+: > config.sub
+: > config.guess
+
+$ACLOCAL
+$AUTOMAKE -a
+
+grep 'VALAC' Makefile.in
+grep 'src_zardoz_OBJECTS' Makefile.in
+grep 'src_libzardoz_la_OBJECTS' Makefile.in
+grep 'src_zardoz_vala.stamp' Makefile.in
+grep 'src_libzardoz_la_vala.stamp' Makefile.in
+grep 'zardoz\.c' Makefile.in
+grep 'src/zardoz-foo\.c' Makefile.in
diff --git a/tests/vala2.test b/tests/vala2.test
new file mode 100755
index 0000000..0bdd66c
--- /dev/null
+++ b/tests/vala2.test
@@ -0,0 +1,70 @@
+#! /bin/sh
+# Copyright (C) 1996, 2001, 2002, 2006, 2008 Free Software Foundation,
+# Inc.
+#
+# This file is part of GNU Automake.
+#
+# GNU Automake is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GNU Automake is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Automake; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301, USA.
+
+# Test to make sure compiling Vala code really works with recursive make.
+
+required="libtool libtoolize pkg-config valac gcc"
+. ./defs || Exit 1
+
+set -e
+
+mkdir src
+
+cat >> 'configure.in' << 'END'
+AC_PROG_CC
+AM_PROG_CC_C_O
+AC_PROG_LIBTOOL
+AM_PROG_VALAC
+PKG_CHECK_MODULES(GOBJECT,gobject-2.0 >= 2.10)
+AC_CONFIG_FILES([src/Makefile])
+AC_OUTPUT
+END
+
+cat > 'Makefile.am' <<'END'
+SUBDIRS = src
+END
+
+cat > 'src/Makefile.am' <<'END'
+bin_PROGRAMS = zardoz
+zardoz_CFLAGS = $(GOBJECT_CFLAGS)
+zardoz_LDADD = $(GOBJECT_LIBS)
+zardoz_SOURCES = zardoz.vala
+END
+
+cat > 'src/zardoz.vala' <<'END'
+using GLib;
+
+public class Zardoz {
+ public static void main () {
+ stdout.printf ("Zardoz!\n");
+ }
+}
+END
+
+libtoolize
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+./configure
+$MAKE
+
diff --git a/tests/vala3.test b/tests/vala3.test
new file mode 100755
index 0000000..9cca476
--- /dev/null
+++ b/tests/vala3.test
@@ -0,0 +1,64 @@
+#! /bin/sh
+# Copyright (C) 1996, 2001, 2002, 2006 Free Software Foundation, Inc.
+#
+# This file is part of GNU Automake.
+#
+# GNU Automake is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GNU Automake is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Automake; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301, USA.
+
+# Test to make sure compiling Vala code really works with non-recursive make.
+
+required="libtool libtoolize pkg-config valac gcc"
+. ./defs || Exit 1
+
+set -e
+
+mkdir src
+
+cat >> 'configure.in' << 'END'
+AC_PROG_CC
+AM_PROG_CC_C_O
+AC_PROG_LIBTOOL
+AM_PROG_VALAC
+PKG_CHECK_MODULES(GOBJECT,gobject-2.0 >= 2.10)
+AC_OUTPUT
+END
+
+cat > 'Makefile.am' <<'END'
+bin_PROGRAMS = src/zardoz
+src_zardoz_CFLAGS = $(GOBJECT_CFLAGS)
+src_zardoz_LDADD = $(GOBJECT_LIBS)
+src_zardoz_SOURCES = src/zardoz.vala
+END
+
+cat > 'src/zardoz.vala' <<'END'
+using GLib;
+
+public class Zardoz {
+ public static void main () {
+ stdout.printf ("Zardoz!\n");
+ }
+}
+END
+
+libtoolize
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+./configure
+$MAKE
+
diff --git a/tests/vala4.test b/tests/vala4.test
new file mode 100755
index 0000000..a2e8c96
--- /dev/null
+++ b/tests/vala4.test
@@ -0,0 +1,61 @@
+#! /bin/sh
+# Copyright (C) 2008 Free Software Foundation, Inc.
+#
+# This file is part of GNU Automake.
+#
+# GNU Automake is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GNU Automake is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Automake; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301, USA.
+
+# Test AM_PROG_VALAC.
+
+required=libtoolize
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+AC_PROG_LIBTOOL
+AM_PROG_VALAC([0.0.1])
+AC_OUTPUT
+END
+
+: > Makefile.am
+
+cat > valac << 'END'
+#! /bin/sh
+if test "x$1" = x--version; then
+ echo 1.2.3
+fi
+exit 0
+END
+chmod +x valac
+
+libtoolize
+$ACLOCAL
+$AUTOMAKE -a
+$AUTOCONF
+./configure "VALAC=`pwd`/valac"
+
+sed 's/AM_PROG_VALAC.*/AM_PROG_VALAC([9999.9])/' < configure.in >t
+mv -f t configure.in
+$AUTOCONF --force
+./configure "VALAC=`pwd`/valac" && Exit 1
+
+sed 's/AM_PROG_VALAC.*/AM_PROG_VALAC([1.2.3])/' < configure.in >t
+mv -f t configure.in
+$AUTOCONF --force
+./configure "VALAC=`pwd`/valac"
+:
--
1.6.2