Minor fixups for Vala support.
authorRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Fri, 10 Oct 2008 05:44:01 +0000 (07:44 +0200)
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Fri, 10 Oct 2008 05:44:01 +0000 (07:44 +0200)
* 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>
12 files changed:
ChangeLog
automake.in
doc/automake.texi
lib/am/vala.am
m4/vala.m4
tests/Makefile.am
tests/Makefile.in
tests/vala.test
tests/vala1.test
tests/vala2.test
tests/vala3.test
tests/vala4.test [new file with mode: 0755]

index 73bdf3f..161f64f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+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
index 4693704..a014bd0 100755 (executable)
@@ -783,7 +783,7 @@ register_language ('name' => 'vala',
                   '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/;
index a5fdc23..7c5bf82 100644 (file)
@@ -6505,50 +6505,52 @@ the @code{_LDFLAGS} variable for the program.
 @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
 
 
index e69de29..fa2a23c 100644 (file)
@@ -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 <http://www.gnu.org/licenses/>.
+
+## There is no rule here.  :-)
index 57aae60..5606296 100644 (file)
@@ -1,36 +1,29 @@
 # 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.])])])])
 ])
index a0bee69..4e0de85 100644 (file)
@@ -631,6 +631,7 @@ vala.test \
 vala1.test \
 vala2.test \
 vala3.test \
+vala4.test \
 vars.test \
 vars3.test \
 vartar.test \
index c986262..2ae178a 100644 (file)
@@ -783,6 +783,7 @@ vala.test \
 vala1.test \
 vala2.test \
 vala3.test \
+vala4.test \
 vars.test \
 vars3.test \
 vartar.test \
index d709cb2..c9b12af 100755 (executable)
@@ -1,5 +1,6 @@
 #! /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.
 #
@@ -21,7 +22,7 @@
 # Test to make sure intermediate .c files are built from vala source.
 
 required="libtool"
-. ./defs || exit 1
+. ./defs || Exit 1
 
 set -e
 
@@ -48,14 +49,14 @@ END
 $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
 
index 086b312..69edb15 100755 (executable)
@@ -1,5 +1,6 @@
 #! /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.
 #
@@ -22,7 +23,7 @@
 # in non-recursive automake mode.
 
 required="libtool"
-. ./defs || exit 1
+. ./defs || Exit 1
 
 set -e
 
@@ -48,14 +49,13 @@ END
 $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
index 03ce33c..ce568d5 100755 (executable)
@@ -1,5 +1,6 @@
 #! /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.
 #
@@ -21,7 +22,7 @@
 # Test to make foo_PKGNAME variables are considered.
 
 required="libtool"
-. ./defs || exit 1
+. ./defs || Exit 1
 
 set -e
 
@@ -45,10 +46,9 @@ END
 $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
index 70aca27..41b083d 100755 (executable)
@@ -21,7 +21,7 @@
 # Test to make sure compiling Vala code really works.
 
 required="libtool libtoolize pkg-config valac gcc"
-. ./defs || exit 1
+. ./defs || Exit 1
 
 set -e
 
@@ -31,11 +31,8 @@ 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
 
@@ -63,5 +60,5 @@ $AUTOCONF
 $AUTOMAKE -a
 
 ./configure
-make
+$MAKE
 
diff --git a/tests/vala4.test b/tests/vala4.test
new file mode 100755 (executable)
index 0000000..a2e8c96
--- /dev/null
@@ -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"
+: