I am migrating a project to build it with autotools, and I use autoscan
to get a template for configure.ac
file.
I wanted to check if the generated configure
script was testing some libraries headers, so I uninstalled the libraries I used in the project to test. For sure compilation fails because of missing headers but configure script didn't checked the presence of these headers before.
I checked the output file of autoscan
and it seems that autoscan forgets some headers:
From configure.scan
:
AC_CHECK_HEADERS([fcntl.h limits.h stddef.h stdlib.h string.h unistd.h])
All headers included in the project (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>
Why are libraries headers and other libc headers missing after autoscan ?
EDIT: It is the same for functions calls.
I'm pretty sure that autoscan only includes checks for those C-language headers which are known to be missing or work differently on some (often obscure) compilers or platforms.
Headers which can always be assumed to be present, it won't check for.
Neither will it check for external library headers. You are expected to provide your own checks for those, often with pkg-config.