diff --git a/meson.build b/meson.build index 61073d4ead..4315914a2e 100644 --- a/meson.build +++ b/meson.build @@ -511,7 +511,6 @@ decl_headers = ''' #include #include #include -#include ''' foreach decl : ['char16_t', @@ -523,6 +522,17 @@ foreach decl : ['char16_t', # We get -1 if the size cannot be determined have = cc.sizeof(decl, prefix : decl_headers, args : '-D_GNU_SOURCE') > 0 + if decl == 'struct mount_attr' + if have + want_linux_fs_h = false + else + have = cc.sizeof(decl, + prefix : decl_headers + '#include ', + args : '-D_GNU_SOURCE') > 0 + want_linux_fs_h = have + endif + endif + if decl == 'struct statx' if have want_linux_stat_h = false @@ -538,6 +548,7 @@ foreach decl : ['char16_t', endforeach conf.set10('WANT_LINUX_STAT_H', want_linux_stat_h) +conf.set10('WANT_LINUX_FS_H', want_linux_fs_h) foreach ident : ['secure_getenv', '__secure_getenv'] conf.set10('HAVE_' + ident.to_upper(), cc.has_function(ident)) diff --git a/src/basic/fd-util.c b/src/basic/fd-util.c index 6c1de92a26..00591d6c2d 100644 --- a/src/basic/fd-util.c +++ b/src/basic/fd-util.c @@ -3,7 +3,9 @@ #include #include #include +#if WANT_LINUX_FS_H #include +#endif #include #include #include diff --git a/src/core/namespace.c b/src/core/namespace.c index 41457ea816..016afe4d9e 100644 --- a/src/core/namespace.c +++ b/src/core/namespace.c @@ -7,7 +7,9 @@ #include #include #include +#if WANT_LINUX_FS_H #include +#endif #include "alloc-util.h" #include "base-filesystem.h" diff --git a/src/shared/mount-util.c b/src/shared/mount-util.c index 8cf16affcb..a119a7c3c1 100644 --- a/src/shared/mount-util.c +++ b/src/shared/mount-util.c @@ -7,7 +7,9 @@ #include #include #include +#if WANT_LINUX_FS_H #include +#endif #include "alloc-util.h" #include "chase-symlinks.h"