diff --git a/common.mak b/common.mak index e6fd2778..8ddb571a 100644 --- a/common.mak +++ b/common.mak @@ -111,6 +111,20 @@ ifeq ("${ASAN}","1") DEFAULT_LDFLAGS += -fsanitize=address endif +# +# Check for header prerequisite +# +# $1: Name of include file to check +# $2: Additional compiler & linker options (optional) +# +# Returns "yes" on success and nothing otherwise +# +define check_header_prereq +$(shell printf "#include <%s>\n int main(void) {return 0;}" $1 | \ + ( $(CC) $(filter-out --coverage, $(ALL_CFLAGS)) $(ALL_CPPFLAGS) \ + $2 -o /dev/null -xc - ) >/dev/null 2>&1 && echo -n yes) +endef + # # Check for build dependency #