]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
meson: Only build blkzone and blkpr if the required linux header exists
authorJordan Williams <jordan@jwillikers.com>
Wed, 20 Mar 2024 16:41:49 +0000 (11:41 -0500)
committerJordan Williams <jordan@jwillikers.com>
Wed, 20 Mar 2024 16:46:18 +0000 (11:46 -0500)
Checks for the required headers for blkzone and blkptr are done for
 Autotools.
This logic wasn't carried over to Meson.
This PR just adds the same checks.

Fixes #2850.

Signed-off-by: Jordan Williams <jordan@jwillikers.com>
meson.build

index f7baab7a22640c4a7cdef694e20e54040e07409f..9600ce49f73d69045a9ddc304bb3570aec72a85e 100644 (file)
@@ -1561,26 +1561,30 @@ exes += exe
 manadocs += ['sys-utils/blkdiscard.8.adoc']
 bashcompletions += ['blkdiscard']
 
-exe = executable(
-  'blkzone',
-  blkzone_sources,
-  include_directories : includes,
-  link_with : [lib_common],
-  install_dir : sbindir,
-  install : true)
-exes += exe
-manadocs += ['sys-utils/blkzone.8.adoc']
-bashcompletions += ['blkzone']
+if cc.has_header('linux/blkzoned.h')
+  exe = executable(
+    'blkzone',
+    blkzone_sources,
+    include_directories : includes,
+    link_with : [lib_common],
+    install_dir : sbindir,
+    install : true)
+  exes += exe
+  manadocs += ['sys-utils/blkzone.8.adoc']
+  bashcompletions += ['blkzone']
+endif
 
-exe = executable(
-  'blkpr',
-  blkpr_sources,
-  include_directories : includes,
-  link_with : [lib_common],
-  install_dir : sbindir,
-  install : true)
-exes += exe
-manadocs += ['sys-utils/blkpr.8.adoc']
+if cc.has_header('linux/pr.h')
+  exe = executable(
+    'blkpr',
+    blkpr_sources,
+    include_directories : includes,
+    link_with : [lib_common],
+    install_dir : sbindir,
+    install : true)
+  exes += exe
+  manadocs += ['sys-utils/blkpr.8.adoc']
+endif
 
 exe = executable(
   'ldattach',