]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
configure: Base NEED_INTERNAL_STATX on libc headers first
authorJohannes Nixdorf <johannes@nixdorf.dev>
Sat, 9 Aug 2025 17:13:07 +0000 (19:13 +0200)
committerAndrey Albershteyn <aalbersh@kernel.org>
Mon, 8 Sep 2025 11:34:23 +0000 (13:34 +0200)
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>
m4/package_libcdev.m4

index b77ac1a7580a8089b8980cae4dcdbe69540c3482..650b8b7be389dd3ead7fe15de69806ddeb294509 100644 (file)
@@ -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>]