]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
meson: define _GNU_SOURCE when testing for 'struct statx'
authorThomas Weißschuh <thomas@t-8ch.de>
Thu, 26 Feb 2026 16:52:44 +0000 (17:52 +0100)
committerThomas Weißschuh <thomas@t-8ch.de>
Thu, 26 Feb 2026 16:52:44 +0000 (17:52 +0100)
glibc (at least with 2.43) requires _GNU_SOURCE to be defined to expose
'struct statx' from 'sys/stat.h'.

Define _GNU_SOURCE in the feature test, so 'struct statx' is correctly
detected. The code is being build with _GNU_SOURCE anyways.

With autotools this happens automatically.

Reported-by: Christian Hesse <mail@eworm.de>
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
meson.build

index e9267a35fd515a5519a419f2cdfe0abcdc261c5a..ed6cfdc7f13a30cb0532ed1c26dfad79125f354f 100644 (file)
@@ -107,7 +107,7 @@ have_mountfd_api = cc.has_type('struct mount_attr', prefix : '#include <linux/mo
 conf.set('HAVE_STRUCT_MOUNT_ATTR', have_mountfd_api ? 1 : false)
 conf.set('HAVE_MOUNTFD_API', have_mountfd_api ? 1 : false)
 
-have_struct_statx = cc.has_type('struct statx', prefix : '#include <sys/stat.h>')
+have_struct_statx = cc.has_type('struct statx', args : '-D_GNU_SOURCE', prefix : '#include <sys/stat.h>')
 conf.set('HAVE_STRUCT_STATX', have_struct_statx ? 1 : false)
 have = cc.has_member('struct statx', 'stx_mnt_id',
                      prefix : '#include <linux/stat.h>')