At compile time the libc headers are preferred, and linux/stat.h is only included if the libc headers don't provide a definition for statx and its types (tested on STATX_TYPE). The configure test should be based on the same logic. This fixes one cause for failing to compile against musl libc. Signed-off-by: Johannes Nixdorf <johannes@xxxxxxxxxxx> --- m4/package_libcdev.m4 | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/m4/package_libcdev.m4 b/m4/package_libcdev.m4 index b77ac1a7580a8089b8980cae4dcdbe69540c3482..650b8b7be389dd3ead7fe15de69806ddeb294509 100644 --- a/m4/package_libcdev.m4 +++ b/m4/package_libcdev.m4 @@ -129,7 +129,15 @@ AC_DEFUN([AC_NEED_INTERNAL_STATX], AC_CHECK_MEMBER(struct statx.stx_atomic_write_unit_max_opt, , need_internal_statx=yes, - [#include <linux/stat.h>] + [[ +#define _GNU_SOURCE +#include <fcntl.h> +#include <sys/stat.h> + +#ifndef STATX_TYPE +#include <linux/stat.h> +#endif +]] ) ],need_internal_statx=yes, [#include <linux/stat.h>] -- 2.50.1