From 1f498641f28241a016c7fce85fc586162421baee Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Fri, 2 Mar 2018 17:07:10 -0500 Subject: [PATCH] autotools: replace my busted header checks with something that works. My existing AC_CHECK_HEADERS checks were failing silently. Oops. I've now defined my own macro in m4/ac_header_required.m4 that successfully fails when a required header is missing. --- Makefile.am | 1 + configure.ac | 13 ++++++++++--- m4/ac_header_required.m4 | 3 +++ 3 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 m4/ac_header_required.m4 diff --git a/Makefile.am b/Makefile.am index 5ba858c..f8b6405 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,3 +1,4 @@ +ACLOCAL_AMFLAGS = -I m4 SUBDIRS = src EXTRA_DIST = doc run-tests.sh man_MANS = doc/man/apply-default-acl.1 diff --git a/configure.ac b/configure.ac index bd51920..54d03f7 100644 --- a/configure.ac +++ b/configure.ac @@ -1,8 +1,9 @@ AC_PREREQ([2.68]) AC_INIT([apply-default-acl], [0.3.0], [michael@orlitzky.com]) AM_INIT_AUTOMAKE([-Wall foreign no-dist-gzip dist-xz]) -AC_CONFIG_SRCDIR([src/apply-default-acl.c]) AC_CONFIG_FILES([Makefile src/Makefile]) +AC_CONFIG_SRCDIR([src/apply-default-acl.c]) +AC_CONFIG_MACRO_DIRS([m4]) # Checks for programs. AC_PROG_CC @@ -15,8 +16,14 @@ AC_HEADER_STDBOOL # stdbool.h AC_HEADER_STDC # stdlib.h string.h (implied: errno.h limits.h stdio.h) # Check for header files not covered by the predefined macros above. -AC_CHECK_HEADERS([ acl/libacl.h fcntl.h getopt.h libgen.h limits.h ]) -AC_CHECK_HEADERS([ linux/xattr.h sys/acl.h unistd.h ]) +AC_HEADER_REQUIRE(acl/libacl.h) +AC_HEADER_REQUIRE(fcntl.h) +AC_HEADER_REQUIRE(getopt.h) +AC_HEADER_REQUIRE(libgen.h) +AC_HEADER_REQUIRE(limits.h) +AC_HEADER_REQUIRE(linux/xattr.h) +AC_HEADER_REQUIRE(sys/acl.h) +AC_HEADER_REQUIRE(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. diff --git a/m4/ac_header_required.m4 b/m4/ac_header_required.m4 new file mode 100644 index 0000000..2345612 --- /dev/null +++ b/m4/ac_header_required.m4 @@ -0,0 +1,3 @@ +AC_DEFUN([AC_HEADER_REQUIRE],[ + AC_CHECK_HEADER($1, [], AC_MSG_ERROR(missing required header $1)) +]) -- 2.43.2