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@nixdorf.dev>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Petr Vaněk <arkamar@gentoo.org>
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>]