Autotools:Autoscan 忘记了一些检查

Autotools: Autoscan forgets some checks

我正在迁移一个项目以使用 autotools 构建它,我使用 autoscan 获取 configure.ac 文件的模板。

我想检查生成的configure脚本是否在测试一些库headers,所以我卸载了我在项目中使用的库来测试。肯定编译失败是因为缺少 headers 但配置脚本之前没有检查这些 headers 的存在。

我检查了 autoscan 的输出文件,自动扫描似乎忘记了一些 headers:

来自configure.scan

AC_CHECK_HEADERS([fcntl.h limits.h stddef.h stdlib.h string.h unistd.h])

项目中包含的所有 headers (cat src/*.[c,h] | grep 'include <' | sort | uniq):

#include <errno.h>
#include <fcntl.h>
#include <getopt.h>
#include <limits.h>
#include <mosquitto.h> (library)
#include <owcapi.h> (library)
#include <pthread.h>
#include <signal.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
#include <wait.h>

为什么在自动扫描后缺少库 headers 和其他 libc headers?

编辑:函数调用也是如此。

我很确定自动扫描只包括对那些已知缺失或在某些(通常是模糊的)编译器或平台上工作不同的 C-language headers 的检查。

Headers 始终可以假定存在,它不会检查。

它也不会检查外部库 headers。您应该为这些支票提供自己的支票,通常带有 pkg-config.