本文并非深奥的技术讨论,只是遇到的一些问题,花了很多精力解决,希望分享给大家
Vala是Gnome为了能加快GObject应用开发采用的一种新兴的面向对象语言,他的语法类似于微软的C#。作为一个GNU还好者,本人的很多PC应用程序,都是采用GTK+ 2.0开发的,当然也会实验性的了解Vala。
对于大部分了解GNU的人来说都会了解Makefile,很多人下载源码以后都会用configure编译和安装,而这些源于GNU的Autotools工具。他是一种能够动态的生成Makefile的工具组。VALA源于GNU当然,Autotools也就理所当然的随着版本的升级开始支持Vala了。
参考如下的帖子应该可以基本了解VALA使用Autotool的步骤
https://pomozok.wordpress.com/2011/01/02/vala-autotools-example/
或者你可以直接用GIT工具Clone帖子里提到的工程文件
https://github.com/anatol/vala-sample
但是很遗憾,可能是我的autotool工具集的问题,执行autogen.sh的时候,一直会提示AM_PROG_VALAC没有定义,于是我阅读了aclocal/vala.m4和aclocal-1.11/vala.m4的代码,发现这个版本没有对这个宏的定义,但是却一直需要定义这个宏,可能希望自己定义吧。
在网上找到了vala.m4的新的定义
http://code.openhub.net/file?fid=FuZPiv7RFAH2mi8ZCaNSNbAeL6c&cid=Odd6moAHXVo&s=&fp=299985&mp&projSelected=true#L0
# Autoconf support for the Vala compiler
# Copyright (C) 2008-2014 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.
# Check whether the Vala compiler exists in $PATH. If it is found, the
# variable VALAC is set pointing to its absolute path. Otherwise, it is
# simply set to 'valac'.
# Optionally a minimum release number of the compiler can be requested.
# If the ACTION-IF-FOUND parameter is given, it will be run if a proper
# Vala compiler is found.
# Similarly, if the ACTION-IF-FOUND is given, it will be run if no proper
# Vala compiler is found. It defaults to simply print a warning about the
# situation, but otherwise proceeding with the configuration.
#
# AM_PROG_VALAC([MINIMUM-VERSION], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
# --------------------------------------------------------------------------
AC_DEFUN([AM_PROG_VALAC],
[AC_PATH_PROG([VALAC], [valac], [valac])
AS_IF([test "$VALAC" != valac && test -n "$1"],
[AC_MSG_CHECKING([whether $VALAC is at least version $1])
am__vala_version=`$VALAC --version | sed 's/Vala *//'`
AS_VERSION_COMPARE([$1], ["$am__vala_version"],
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])
VALAC=valac])])
if test "$VALAC" = valac; then
m4_default([$3],
[AC_MSG_WARN([no proper vala compiler found])
AC_MSG_WARN([you will not be able to compile vala source files])])
else
m4_default([$2], [:])
fi])