ax_check_compile_flag 的 autotools 语法错误

autotools syntax error with ax_check_compile_flag

我正在使用 autotools 构建我的 C++ 应用程序。在我的 configure.ac 中,我有以下行:

AX_CHECK_COMPILE_FLAG([-Wall], [CPPFLAGS="$CPPFLAGS -Wall"])

在执行./configure时(在运行 autoreconf -i之后会出现如下错误):

./configure: line 3825: syntax error near unexpected token `-Wall,'
./configure: line 3825: `AX_CHECK_COMPILE_FLAG(-Wall, CPPFLAGS="$CPPFLAGS -Wall")'

我的系统:Linux web 3.2.0-4-amd64 #1 SMP Debian 3.2.65-1+deb7u2 x86_64 GNU/Linux

在我的 Ubuntu 机器上运行良好,为什么会出现此错误?

autoreconf 不是魔法(尽管我遇到了显然相信这一点的包维护者)。当您 运行 autoreconf 时,它找不到 AX_CHECK_COMPILE_FLAG 宏,并生成了损坏的 configure 脚本。通常会同时产生一条 error/diagnostic 消息。

'AX_CHECK_COMPILE_FLAG` 来自 autoconf archive project, and Debian has a package which provides this, named autoconf-archive。您可能忘记安装它:

sudo apt-get install autoconf-archive