* automake.in: $(VALAFLAGS) comes after $(AM_VALAFLAGS).
* doc/automake.texi (Vala Support): Add some references,
document AM_VALAFLAGS, streamline a bit.
* lib/am/vala.am: Copyright blurb.
* m4/vala.m4 (AM_PROG_VALAC): Rewrite using AS_VERSION_COMPARE.
* tests/vala.test: Fix minor nits.
* tests/vala1.test: Likewise.
* tests/vala2.test: Likewise.
* tests/vala3.test: Likewise.
* tests/vala4.test: New test, for version argument of
AM_PROG_VALAC.
* tests/Makefile.am: Update.
Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+2008-10-10 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
+ Minor fixups for Vala support.
+ * automake.in: $(VALAFLAGS) comes after $(AM_VALAFLAGS).
+ * doc/automake.texi (Vala Support): Add some references,
+ document AM_VALAFLAGS, streamline a bit.
+ * lib/am/vala.am: Copyright blurb.
+ * m4/vala.m4 (AM_PROG_VALAC): Rewrite using AS_VERSION_COMPARE.
+ * tests/vala.test: Fix minor nits.
+ * tests/vala1.test: Likewise.
+ * tests/vala2.test: Likewise.
+ * tests/vala3.test: Likewise.
+ * tests/vala4.test: New test, for version argument of
+ AM_PROG_VALAC.
+ * tests/Makefile.am: Update.
+
2008-10-09 Mathias Hasselmann <mathias.hasselmann@gmx.de>
* automake.in: Support Vala in non-recursive builds. Make sure
'Name' => 'Vala',
'config_vars' => ['VALAC'],
'flags' => ['VALAFLAGS'],
- 'compile' => '$(VALAC) $(VALAFLAGS) $(AM_VALAFLAGS)',
+ 'compile' => '$(VALAC) $(AM_VALAFLAGS) $(VALAFLAGS)',
'compiler' => 'VALACOMPILE',
'extensions' => ['.vala'],
'output_extensions' => sub { (my $ext1 = $_[0]) =~ s/vala$/c/;
@cindex Vala Support
@cindex Support for Vala
-Automake provides support for Vala compilation.
+Automake provides support for Vala compilation
+(@uref{http://live.gnome.org/@/Vala}).
@example
foo_SOURCES = foo.vala bar.vala zardoc.c
@end example
-Any .vala file listed in a @code{_SOURCE} variable will be compiled
-into C code by the Vala compiler.
+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.
-@defmac AM_PROG_VALAC ([@var{MINIMUM-VERSION}])
-
-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.
+@defmac AM_PROG_VALAC (@ovar{MINIMUM-VERSION})
+Try to find a Vala compiler in @env{PATH}. If it is found, the variable
+@code{VALAC} is set. Optionally a minimum release number of the compiler
+can be requested:
@example
AM_PROG_VALAC([0.1.3])
@end example
-
@end defmac
There are a few variables that are used when compiling Vala sources:
@vtable @code
-
@item VALAC
Path to the the Vala compiler.
@item VALAFLAGS
Additional arguments for the Vala compiler.
+@item AM_VALAFLAGS
+The maintainer's variant of @code{VALAFLAGS}.
+
@item PKGNAME
-The pkg-config and VAPI name to use when building Vala based library.
+The pkg-config
+(@uref{http://www.freedesktop.org/@/software/@/pkgconfig/}) and VAPI
+(Vala API definition file) name to use when building Vala based library.
@example
lib_LTLIBRARIES = libfoo.la
libfoo_la_PKGNAME = foo-2.0
libfoo_la_SOURCES = foo.vala
@end example
-
@end vtable
+## 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 <http://www.gnu.org/licenses/>.
+
+## There is no rule here. :-)
# Autoconf support for the Vala compiler
-# Copyright (C) 2007 Free Software Foundation, Inc.
+# 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 2
+# 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.
-#
-# Author: Mathias Hasselmann <mathias.hasselmann@gmx.de>
+# 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], [])
- AC_SUBST(VALAC)
-
- if test -z "${VALAC}"; then
- AC_MSG_WARN([No Vala compiler found. You will not be able to recompile .vala source files.])
- elif test -n "$1"; then
- AC_REQUIRE([AC_PROG_AWK])
- AC_MSG_CHECKING([valac is at least version $1])
-
- if "${VALAC}" --version | "${AWK}" -v r='$1' 'function vn(s) { if (3 == split(s,v,".")) return (v[1]*1000+v[2])*1000+v[3]; else exit 2; } /^Vala / { exit vn(r) > vn($[2]) }'; then
- AC_MSG_RESULT([yes])
- else
- AC_MSG_RESULT([no])
- AC_MSG_ERROR([Vala $1 not found.])
- fi
- fi
+# --------------------------------
+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.])])])])
])
vala1.test \
vala2.test \
vala3.test \
+vala4.test \
vars.test \
vars3.test \
vartar.test \
vala1.test \
vala2.test \
vala3.test \
+vala4.test \
vars.test \
vars3.test \
vartar.test \
#! /bin/sh
-# Copyright (C) 1996, 2001, 2002, 2006 Free Software Foundation, Inc.
+# Copyright (C) 1996, 2001, 2002, 2006, 2008 Free Software Foundation,
+# Inc.
#
# This file is part of GNU Automake.
#
# Test to make sure intermediate .c files are built from vala source.
required="libtool"
-. ./defs || exit 1
+. ./defs || Exit 1
set -e
$ACLOCAL
$AUTOMAKE -a
-grep -w -- 'VALAC' 'Makefile.in'
-grep -w -- 'am_zardoz_OBJECTS' 'Makefile.in'
-grep -w -- 'am_libzardoz_la_OBJECTS' 'Makefile.in'
-grep -w -- 'zardoz_vala.stamp' 'Makefile.in'
-grep -w -- 'libzardoz_la_vala.stamp' 'Makefile.in'
-grep -w -- '--library=libzardoz' 'Makefile.in'
-grep -w -- 'zardoz\.c' 'Makefile.in'
-grep -w -- 'zardoz\.h' 'Makefile.in'
-grep -w -- 'zardoz-foo\.c' 'Makefile.in'
-grep -w -- 'zardoz-foo\.h' 'Makefile.in'
+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 ' --library=libzardoz' Makefile.in
+grep 'zardoz\.c' Makefile.in
+grep 'zardoz\.h' Makefile.in
+grep 'zardoz-foo\.c' Makefile.in
+grep 'zardoz-foo\.h' Makefile.in
#! /bin/sh
-# Copyright (C) 1996, 2001, 2002, 2006 Free Software Foundation, Inc.
+# Copyright (C) 1996, 2001, 2002, 2006, 2008 Free Software Foundation,
+# Inc.
#
# This file is part of GNU Automake.
#
# in non-recursive automake mode.
required="libtool"
-. ./defs || exit 1
+. ./defs || Exit 1
set -e
$ACLOCAL
$AUTOMAKE -a
-grep -w -- 'VALAC' 'Makefile.in'
-grep -w -- 'src_zardoz_OBJECTS' 'Makefile.in'
-grep -w -- 'src_libzardoz_la_OBJECTS' 'Makefile.in'
-grep -w -- 'src_zardoz_vala.stamp' 'Makefile.in'
-grep -w -- 'src_libzardoz_la_vala.stamp' 'Makefile.in'
-grep -w -- '--library=libzardoz' 'Makefile.in'
-grep -w -- 'zardoz\.c' 'Makefile.in'
-grep -w -- 'zardoz\.h' 'Makefile.in'
-grep -w -- 'src/zardoz-foo\.c' 'Makefile.in'
-grep -w -- 'src/zardoz-foo\.h' 'Makefile.in'
-
+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 ' --library=libzardoz' Makefile.in
+grep 'zardoz\.c' Makefile.in
+grep 'zardoz\.h' Makefile.in
+grep 'src/zardoz-foo\.c' Makefile.in
+grep 'src/zardoz-foo\.h' Makefile.in
#! /bin/sh
-# Copyright (C) 1996, 2001, 2002, 2006 Free Software Foundation, Inc.
+# Copyright (C) 1996, 2001, 2002, 2006, 2008 Free Software Foundation,
+# Inc.
#
# This file is part of GNU Automake.
#
# Test to make foo_PKGNAME variables are considered.
required="libtool"
-. ./defs || exit 1
+. ./defs || Exit 1
set -e
$ACLOCAL
$AUTOMAKE -a
-grep -w -- 'VALAC' 'Makefile.in'
-grep -w -- 'src_libzardoz_la_OBJECTS' 'Makefile.in'
-grep -w -- 'src_libzardoz_la_vala.stamp' 'Makefile.in'
-grep -w -- '--library=zardoz+-3.0' 'Makefile.in'
-grep -w -- 'src/zardoz-foo\.c' 'Makefile.in'
-grep -w -- 'src/zardoz-foo\.h' 'Makefile.in'
-
+grep 'VALAC' Makefile.in
+grep 'src_libzardoz_la_OBJECTS' Makefile.in
+grep 'src_libzardoz_la_vala.stamp' Makefile.in
+grep ' --library=zardoz+-3.0' Makefile.in
+grep 'src/zardoz-foo\.c' Makefile.in
+grep 'src/zardoz-foo\.h' Makefile.in
# Test to make sure compiling Vala code really works.
required="libtool libtoolize pkg-config valac gcc"
-. ./defs || exit 1
+. ./defs || Exit 1
set -e
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
$AUTOMAKE -a
./configure
-make
+$MAKE
--- /dev/null
+#! /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"
+: