From 1033909f0e80b7627b5cb0d18d1d9c4e7762ba9e Mon Sep 17 00:00:00 2001 From: William Hubbs Date: Fri, 8 Oct 2021 16:39:21 -0500 Subject: [PATCH] fix bug in pam build tests --- meson.build | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/meson.build b/meson.build index 00c4f2d9..d074946e 100644 --- a/meson.build +++ b/meson.build @@ -42,9 +42,9 @@ else os = option_os endif -pam_dep = dependency('pam', required : get_option('pam')) +pam_dep = dependency('pam', required: false) if not pam_dep.found() - pam_dep = cc.find_library('pam', required : get_option('pam')) + pam_dep = cc.find_library('pam', required: false) endif if pam_dep.found() cc_pam_flags = '-DHAVE_PAM' @@ -52,6 +52,10 @@ else cc_pam_flags = [] endif +if not pam_dep.found() and get_option('pam') + error('Pam was requested but could not be located') + endif + option_pkg_prefix = get_option('pkg_prefix') if option_pkg_prefix == '' if os == 'Dragonfly' or os == 'FreeBSD' @@ -92,10 +96,13 @@ sbindir = rootprefix / get_option('sbindir') selinux_dep = dependency('libselinux', required : get_option('selinux')) if selinux_dep.found() cc_selinux_flags = '-DHAVE_SELINUX' - if pam_dep.found() - pam_misc_dep = dependency('pam_misc', required : get_option('pam')) + if pam_dep.found() and get_option('pam') + pam_misc_dep = dependency('pam_misc', required: false) if not pam_misc_dep.found() - pam_misc_dep = cc.find_library('pam_misc', required : get_option('pam')) + pam_misc_dep = cc.find_library('pam_misc', required: false) + endif + if not pam_misc_dep.found() and get_option('pam') + error('Pam was requested but could not be located') endif endif else