缺少 autoconf 宏不会引发错误,但是 ./configure 会

Missing autoconf macro doesn't throw an error, but ./configure does

如果 AX_CHECK_COMPILE_FLAG 缺失,我如何使 autogen.sh 出错?

我可以将 .m4 文件 wget 到源代码树中并包含它,这是比给出错误更好的选择吗?

详情如下:

我刚刚将 AX_CHECK_COMPILE_FLAG(...) 添加到我的 configure.ac 和 运行 ./autogen.sh,结果成功了。

因为 autoconf-archive 没有安装,./configure 给出了这个错误:

./configure: 5358: Syntax error: word unexpected (expecting ")")

5358 处的 ./configure 行如下所示,因为宏不存在,所以 bourne shell 死于上述错误。

AX_CHECK_COMPILE_FLAG(-fcx-fortran-rules, CFLAGS="$CFLAGS -fcx-fortran-rules")

通常,当我在 configure.ac 中使用其名称既不以 AC_ 也不以 AM_ 开头的宏时,我确保 autoconf 处理那些出现在生成的 configure 文件错误。

在你的情况下,那就是

m4_pattern_forbid([AX_CHECK_COMPILE_FLAG])dnl
AX_CHECK_COMPILE_FLAG([...what...], [...ever...])
AX_CHECK_COMPILE_FLAG([...and...], [...more...])