从configure.ac中的文件中读取版本号 [英] Read a version number from a file in configure.ac

查看:117
本文介绍了从configure.ac中的文件中读取版本号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

出于某些原因,我在纯文本文件中而不是configure.ac中定义我的项目版本号.我想创建一条语句,该语句将读取版本号并将其存储在编译期间.

I define my project version number in a plain text file instead of configure.ac for some reasons. I would like to create a statement that would read the version number and store it during compilation time.

现在我的configure.ac看起来像这样:

Right now my configure.ac looks like this:

AC_INIT([my program],[999.9.9])

我想要类似的东西:

AC_INIT([my program],[ $(cat VERSION) ])

这当然行不通.这有什么窍门? (我知道我失去了一些可移植性-目前我不在乎).谢谢!

This wont work of course. What is the trick here? (I know I am loosing some portability - I don't care at the moment). Thanks!

推荐答案

尝试:

AC_INIT([my program], m4_esyscmd([tr -d '\n' < VERSION]))

使用注释中建议的修复程序进行编辑.

Edited with fixes suggested in the comments.

我还能够使用以下方式删除不可移植的tr调用:

I was also able to remove the non-portable tr invocation using:

AC_INIT([my program], [m4_translit(m4_esyscmd([cat VERSION]),m4_newline)])

似乎也一样有效,Enrico在下面的评论中建议的解决方案也是如此:

which seems to work just as well, as does the solution suggested by Enrico in the comments below:

AC_INIT([my program], [m4_esyscmd_s([cat VERSION])])

这篇关于从configure.ac中的文件中读取版本号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆