MingW Autotools 编写Vala程序 之一

本文并非深奥的技术讨论,只是遇到的一些问题,花了很多精力解决,希望分享给大家

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])

需要用这个vala.m4替换aclocal/vala.m4和aclocal-1.11/vala.m4,再执行上面的autogen.sh就可以顺利的产生configure了。


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值