+# Check for header files not covered by the predefined macros above.
+AC_CHECK_HEADERS([ fcntl.h ftw.h getopt.h libgen.h limits.h linux/xattr.h ])
+AC_CHECK_HEADERS([ sys/acl.h sys/libacl.h sys/types.h unistd.h ])
+
+# We need openat() with O_NOFOLLOW from POSIX-2008. Without them, we
+# can't operate securely; I would rather refuse to be built.
+AC_CHECK_FUNC(openat,
+ [],
+ AC_MSG_ERROR(missing required openat function))
+AC_CHECK_DECLS([O_DIRECTORY],
+ [],
+ [AC_MSG_ERROR(missing required O_DIRECTORY flag in fcntl.h)],
+ [[#include <fcntl.h>]])
+AC_CHECK_DECLS([O_NOFOLLOW],
+ [],
+ [AC_MSG_ERROR(missing required O_NOFOLLOW flag in fcntl.h)],
+ [[#include <fcntl.h>]])
+AC_CHECK_DECLS([O_PATH],
+ [],
+ [AC_MSG_ERROR(missing required O_PATH flag in fcntl.h)],
+ [[#define _GNU_SOURCE
+ #include <fcntl.h>]])