diff --git a/plugins/autotools-templates/Makefile.am b/plugins/autotools-templates/Makefile.am
index aa06b89..349fd00 100644
--- a/plugins/autotools-templates/Makefile.am
+++ b/plugins/autotools-templates/Makefile.am
@@ -34,6 +34,7 @@ nobase_resource_DATA = \
 	autotools_templates/resources/m4/libtool.m4 \
 	autotools_templates/resources/m4/pkg.m4 \
 	autotools_templates/resources/m4/vala.m4 \
+	autotools_templates/resources/m4/valac.m4 \
 	autotools_templates/resources/m4/vapigen.m4 \
 	autotools_templates/resources/po/LINGUAS \
 	autotools_templates/resources/po/Makevars \
diff --git a/plugins/autotools-templates/autotools_templates/__init__.py b/plugins/autotools-templates/autotools_templates/__init__.py
index ad07985..dbbe8a1 100644
--- a/plugins/autotools-templates/autotools_templates/__init__.py
+++ b/plugins/autotools-templates/autotools_templates/__init__.py
@@ -181,6 +181,7 @@ class AutotoolsTemplate(Ide.TemplateBase, Ide.ProjectTemplate):
             'resources/m4/libtool.m4':                  'm4/libtool.m4',
             'resources/m4/pkg.m4':                      'm4/pkg.m4',
             'resources/m4/vala.m4':                     'm4/vala.m4',
+            'resources/m4/valac.m4':                    'm4/valac.m4',
             'resources/m4/vapigen.m4':                  'm4/vapigen.m4',
 
             'resources/data/Makefile.am':               'data/Makefile.am',
diff --git a/plugins/autotools-templates/autotools_templates/resources/configure.ac b/plugins/autotools-templates/autotools_templates/resources/configure.ac
index 56d18eb..c9a34d2 100644
--- a/plugins/autotools-templates/autotools_templates/resources/configure.ac
+++ b/plugins/autotools-templates/autotools_templates/resources/configure.ac
@@ -84,7 +84,7 @@ GLIB_GSETTINGS
 GOBJECT_INTROSPECTION_CHECK([1.42.0])
 {{end}}
 {{if enable_vala}}
-AM_PROG_VALAC([0.32])
+VALAC_CHECK([0.32])
 {{end}}
 {{if enable_vapi}}
 VAPIGEN_CHECK
diff --git a/plugins/autotools-templates/autotools_templates/resources/m4/vala.m4 b/plugins/autotools-templates/autotools_templates/resources/m4/vala.m4
index 4393866..23dfe45 100644
--- a/plugins/autotools-templates/autotools_templates/resources/m4/vala.m4
+++ b/plugins/autotools-templates/autotools_templates/resources/m4/vala.m4
@@ -31,8 +31,6 @@ _ACEOF
 
   AS_IF([vala_error=`$VALAC $1 -q --cc="${CC} ${CPPFLAGS} ${CFLAGS} ${LDFLAGS}" -o conftest$ac_exeext conftest.vala 2>&1`],
         [$2], [$3])
-])
-
 ])# _VALA_CHECK_COMPILE_WITH_ARGS
 
 # VALA_CHECK_PACKAGES(PKGS, [ACTION-IF-FOUND],
diff --git a/plugins/autotools-templates/autotools_templates/resources/m4/valac.m4 b/plugins/autotools-templates/autotools_templates/resources/m4/valac.m4
new file mode 100644
index 0000000..bde4ba0
--- /dev/null
+++ b/plugins/autotools-templates/autotools_templates/resources/m4/valac.m4
@@ -0,0 +1,78 @@
+dnl vapigen.m4
+dnl
+dnl Copyright 2014 Daniel Espinosa
+dnl
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License, or (at your option) any later version.
+dnl
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+dnl Lesser General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
+
+# serial 8
+
+# VALAC_CHECK([VERSION], [API_VERSION])
+# --------------------------------------
+# Check valac existence and version.
+m4_define([_VALAC_CHECK_INTERNAL],
+[
+  AC_REQUIRE([PKG_PROG_PKG_CONFIG])
+  AS_IF([ test "x$2" = "x" ], [
+    AM_PROG_VALAC($1)
+    AS_IF([ test "x$VALAC" = "xno"], [
+      check_prog=no
+      AC_MSG_ERROR([valac is not installed])
+    ], [
+      check_prog=yes
+      VALAC_VERSION=`$VALAC --api-version`
+      VAPIDIR=$datadir/vala-$VALAC_VERSION/vapi
+      VAPIDIR_UNVERSIONED=$datadir/vala-$VALAC_VERSION/vapi
+    ])
+  ], [
+    AS_IF([ test "x$1" = "x"], [
+        vala_pkg="libvala-$2"
+      ], [
+        vala_pkg="libvala-$2 >= $1"
+      ])
+	  AC_MSG_CHECKING([for $vala_pkg])
+	  PKG_CHECK_EXISTS([ $vala_pkg ], [
+	          vala_pkg_found=yes
+            VAPIGEN=`$PKG_CONFIG --variable=vapigen libvala-$2`
+	          VAPIGEN_MAKEFILE=`$PKG_CONFIG --variable=datadir libvala-$2`/vala/Makefile.vapigen
+	          VAPIDIR=`$PKG_CONFIG --variable=vapidir libvala-$2`
+            GEN_INTROSPECT=`$PKG_CONFIG --variable=gen_introspect libvala-$2`
+            vala_datadir=`$PKG_CONFIG --variable=datadir libvala-$2`
+            VAPIDIR_UNVERSIONED=$vala_datadir/vala/vapi
+            VALA_GEN_INTROSPECT=`$PKG_CONFIG --variable=vala_gen_introspect libvala-$2`
+	    ], [
+	          vala_pkg_found=no
+	          AC_MSG_ERROR([no package libvala-$2 is installed])
+	    ])
+	  AC_MSG_RESULT([$vala_pkg_found])
+  ])
+	AC_SUBST([VAPIGEN])
+	AC_SUBST([VAPIGEN_VAPIDIR])
+	AC_SUBST([VAPIDIR])
+	AC_SUBST([VAPIDIR_UNVERSIONED])
+	AC_SUBST([VAPIGEN_MAKEFILE])
+	AC_SUBST([GEN_INTROSPECT])
+	AC_SUBST([VALA_GEN_INTROSPECT])
+	AC_SUBST([VALAC_VERSION])
+])
+
+dnl Check VAPIGEN
+# VALAC_CHECK([VERSION], [API_VERSION], [DEFAULT])
+# --------------------------------------
+# Check vapigen existence and version.
+AC_DEFUN([VALAC_CHECK],
+[
+  _VALAC_CHECK_INTERNAL($1,$2,$3)
+]
+)
diff --git a/plugins/autotools-templates/autotools_templates/resources/src/package.vala b/plugins/autotools-templates/autotools_templates/resources/src/package.vala
index ee63008..ff2fac3 100644
--- a/plugins/autotools-templates/autotools_templates/resources/src/package.vala
+++ b/plugins/autotools-templates/autotools_templates/resources/src/package.vala
@@ -3,7 +3,7 @@
 using GLib;
 
 namespace {{Prefix}} {
-	public class A {
+	public class A : Object {
 		public bool foo() { return false; }
 	}
 }
