aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJordan Williams <jordan@jwillikers.com>2024-04-08 10:12:17 -0500
committerJordan Williams <jordan@jwillikers.com>2024-04-08 10:56:23 -0500
commit9e3c5d1b5351333129a967dbf3b5ac4a78190772 (patch)
tree1b35adbfe7305dc7c9742c09d0739d75758f91d5
parent07aacb371470b5561f13b95e399e5ff77e417b8f (diff)
downloadutil-linux-9e3c5d1b5351333129a967dbf3b5ac4a78190772.tar.gz
meson: Disable targets requiring pam when it is missing
Several executables require the pam library. The current behavior in Meson only requires this library when these executables are explicitly enabled. Unfortunately, by default, Meson will not throw an error when the required pam library is missing while still trying to build these executables. To fix this, make the pam library a disabler which automatically disables these executables if it is not found. Signed-off-by: Jordan Williams <jordan@jwillikers.com>
-rw-r--r--meson.build17
1 files changed, 7 insertions, 10 deletions
diff --git a/meson.build b/meson.build
index e65cd9582f..912427c600 100644
--- a/meson.build
+++ b/meson.build
@@ -356,16 +356,13 @@ if not lib_crypt.found()
lib_crypt = cc.find_library('crypt', required : get_option('build-sulogin'))
endif
-lib_pam = cc.find_library('pam', required : get_option('build-login'))
-if not lib_pam.found()
- lib_pam = cc.find_library('pam', required : get_option('build-chfn-chsh'))
-endif
-if not lib_pam.found()
- lib_pam = cc.find_library('pam', required : get_option('build-su'))
-endif
-if not lib_pam.found()
- lib_pam = cc.find_library('pam', required : get_option('build-runuser'))
-endif
+lib_pam = cc.find_library(
+ 'pam',
+ disabler : true,
+ required : get_option('build-login').enabled() or \
+ get_option('build-chfn-chsh').enabled() or \
+ get_option('build-su').enabled() or \
+ get_option('build-runuser').enabled())
if lib_pam.found()
lib_pam_misc = cc.find_library('pam_misc')
lib_pam = [lib_pam, lib_pam_misc]