diff options
author | Jordan Williams <jordan@jwillikers.com> | 2024-04-08 11:17:12 -0500 |
---|---|---|
committer | Jordan Williams <jordan@jwillikers.com> | 2024-04-09 16:00:17 -0500 |
commit | b8b63b36ac33f92be17a12370a0640ce5cf06a80 (patch) | |
tree | d6be02d17698d56eac5c198ee509b2654b01dfe4 | |
parent | 5ebf0edb0a0531cba801c7791543c610725bf944 (diff) | |
download | util-linux-b8b63b36ac33f92be17a12370a0640ce5cf06a80.tar.gz |
meson: Require the sys/vfs.h header for libmount and fstrim
libmount and fstrim both include sys/vfs.h unconditionally.
To avoid an error at compile time, require this header for their
respective feature options to be enabled.
This avoids building them on systems without sys/vfs.h, such as macOS.
Fixes #2932.
Signed-off-by: Jordan Williams <jordan@jwillikers.com>
-rw-r--r-- | meson.build | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/meson.build b/meson.build index 21822f0bd4..3c2e860749 100644 --- a/meson.build +++ b/meson.build @@ -102,7 +102,12 @@ conf.set('HAVE_MOUNTFD_API', have_mountfd_api ? 1 : false) have_struct_statx = cc.sizeof('struct statx', prefix : '#include <sys/stat.h>') > 0 conf.set('HAVE_STRUCT_STATX', have_struct_statx ? 1 : false) -build_libmount = get_option('build-libmount').require(get_option('build-libblkid').allowed()).allowed() +have_sys_vfs_header = cc.has_header('sys/vfs.h') + +build_libmount = get_option('build-libmount').require( + get_option('build-libblkid').allowed() \ + and have_sys_vfs_header \ +).allowed() conf.set('HAVE_LIBMOUNT', build_libmount ? 1 : false) conf.set('USE_LIBMOUNT_SUPPORT_NAMESPACES', 1) @@ -1501,7 +1506,7 @@ if opt and not is_disabler(exe) bashcompletions += ['tunelp'] endif -opt = not get_option('build-fstrim').disabled() +opt = get_option('build-fstrim').require(have_sys_vfs_header).allowed() exe = executable( 'fstrim', fstrim_sources, |