]> 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)
committerKarel Zak <kzak@redhat.com>
Fri, 22 Mar 2024 10:30:16 +0000 (11:30 +0100)
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>
(cherry picked from commit 1a374511693e4b2e8e53966615ce9112553d3b08)

meson.build

index b6efc42202c04bf8a5ea2f45835eae233d0323f4..a7b8e1d25034f16c82dbe5d2222cff66167fcb01 100644 (file)
@@ -1556,26 +1556,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',