在配置脚本中硬编码的automake版本(am__api_version)

fen*_*ker 6 linux automake makefile autotools

我目前正在使用autotools开发Linux项目.代码在SCM(Perforce)中提交,我们有配置脚本Makefile.am,Makefile.in - 通常的autotools样板.最近,有人改变了Makefile.am,但忘了重新生成Makefile.in; 当我尝试构建时,我收到此错误:

WARNING: `automake-1.11' is missing on your system.  You should only need it if
         you modified `Makefile.am', `acinclude.m4' or `configure.ac'.
         You might want to install the `Automake' and `Perl' packages.
         Grab them from any GNU archive site.
 cd . && /bin/bash ./config.status Makefile depfiles
Run Code Online (Sandbox Code Playgroud)

我看到automake版本在configure脚本中是硬编码的(似乎来自aclocal.m4):

am__api_version='1.11'
Run Code Online (Sandbox Code Playgroud)

所以我想我需要使用automake-1.11(不是1.10,而不是更新的)来重新生成Makefile.in文件.

这是为什么?我们为什么要绑定特定的automake版本?我们主要在Ubuntu 14.04上构建,其中1.14是安装的默认版本.有没有办法告诉构建系统简单地使用任何版本的automake?或者从aclocal.m4中删除am__api_version定义是否安全?

zti*_*tik 1

重要的问题是为什么有人要修复am__api_versions。最可能的答案是:因为automake往往会改变宏的参数,甚至完全删除以前版本的宏。在每个发布公告中automake都有一个名为

警告:未来的向后不兼容性!

另一个叫

已删除过时的功能

您可以参考版本1.12 , 1.13 , 1.14

因此configure.acorMakefile.am可能包含一些在以后的版本中已过时的宏。当遇到这个问题时,你有两种可能性。要么找出哪个功能取代了过时的功能,要么坚持使用automake. 大多数开发人员并不认为autotools文件是项目源代码的一部分。他们只是希望保持工作版本运行并坚持使用当前am版本。

请注意,所有发行版都支持旧版本的automake. 在ubuntu中你可以找到:

$ apt-cache search automake | grep automake
automake - Tool for generating GNU Standards-compliant Makefiles
automake1.4 - A tool for generating GNU Standards-compliant Makefiles
automake1.9 - A tool for generating GNU Standards-compliant Makefiles
automake1.10 - Tool for generating GNU Standards-compliant Makefiles
automake1.11 - Tool for generating GNU Standards-compliant Makefiles
Run Code Online (Sandbox Code Playgroud)

这意味着您可以安装请求的版本automake

因此,您可以删除该行am__api_version='1.11'并找出哪个宏已过时。然后您必须决定采用上述两种解决方案中的哪一种。