如何使用 autoconf 获取 "build" 和 "target" C 编译器

How to get "build" and "target" C compiler with autoconf

在交叉环境中,AC_PROG_CC查找目标C编译器的名称。在我的设置中,我需要构建一些 运行 在构建机器上而不是在目标上的工具,因此我还需要一个构建系统 C 编译器。我想知道是否有类似 AC_PROG_CC 的东西可以找到构建 C 编译器的名称以及设置正确的 CFLAGS 和链接器标志。

或者我应该为主机上 运行 的工具创建一个单独的配置文件并递归调用 autoconf 吗?

非常感谢您分享您对此的见解!

In my setup I need to build some tools which run on the build machine, not on the target, so I also need a build system C compiler. I wonder if there is something like AC_PROG_CC to find the name of the build C compiler and also to set proper CFLAGS and linker flags.

AX_PROG_CC_FOR_BUILD 可能是您需要的,因为您要设置 CFLAGS.

Or should I have a separate configure file for the tools which run on the host and call autoconf recursively?

这就是 AX_PROC_CC_FOR_BUILD 所做的。