如何更改默认的 autoconf configure --help 输出

How to change the default autoconf configure --help output

我想更改 autoconf 默认 configure --help 输出的内容,特别是 _AC_INIT_HELP 放置在 HELP_BEGIN 转移中的文本。

我意识到这将是一个不完全 "kosher" 根据 autoconf 原则的 hack,但我愿意忍受在可移植性等方面的任何后果。但是我不想直接编辑autoconf 实现,或者需要对生成的配置脚本执行 post 处理步骤。

似乎 m4 的强大功能应该让我做到这一点,但我尝试了很多不同的方法,none 其中的一些有效。其中大部分导致m4崩溃,例如:

$ cat configure.ac 
AC_PREREQ(2.69)
m4_define([_AC_INIT_HELP],patsubst(m4_defn([_AC_INIT_HELP]),[Fine],[Foo]))
AC_INIT(foo,1.0)
AC_OUTPUT()
$ autoreconf
/usr/local/pkg/autotools-201608/bin/m4: memory exhausted
autom4te: /usr/local/pkg/autotools-201608/bin/m4 failed with exit status: 1
aclocal: error: echo failed with exit status: 1
autoreconf: aclocal failed with exit status: 1

我怎样才能完成这项工作?

终于自己找到了答案。

关键是利用m4_copy:

AC_PREREQ(2.69)
m4_copy([_AC_INIT_HELP],[_MY_INIT_HELP])
m4_define([_AC_INIT_HELP],[patsubst(m4_defn([_MY_INIT_HELP]),[Fine],[Foo])])
AC_INIT(foo,1.0)
AC_OUTPUT()