diff --git a/meson.build b/meson.build index 838bfe3e..ea2b9a5d 100644 --- a/meson.build +++ b/meson.build @@ -42,14 +42,10 @@ else os = option_os endif -pam = get_option('pam') -if pam - libpam = cc.find_library('pam') - libpam_misc = cc.find_library('pam_misc') +pam_dep = dependency('pam', required : get_option('pam')) +if pam_dep.found() cc_pam_flags = '-DHAVE_PAM' else - libpam = [] - libpam_misc = [] cc_pam_flags = [] endif @@ -93,8 +89,12 @@ sbindir = rootprefix / get_option('sbindir') selinux_dep = dependency('libselinux', required : get_option('selinux')) if selinux_dep.found() cc_selinux_flags = '-DHAVE_SELINUX' - else + if pam_dep.found() + pam_misc_dep = dependency('pam_misc', required : get_option('pam')) + endif +else cc_selinux_flags = [] + pam_misc_dep = [] endif termcap = get_option('termcap') diff --git a/src/rc/meson.build b/src/rc/meson.build index 0246eabd..eafba436 100644 --- a/src/rc/meson.build +++ b/src/rc/meson.build @@ -50,7 +50,7 @@ executable('openrc-run', rc_selinux_c, version_h], c_args : [cc_audit_flags, cc_branding_flags, cc_pam_flags, cc_selinux_flags], link_with: [libeinfo, librc], - dependencies: [audit_dep, dl_dep, libpam, libpam_misc, selinux_dep, util_dep], + dependencies: [audit_dep, dl_dep, pam_dep, pam_misc_dep, selinux_dep, util_dep], include_directories: [incdir, einfo_incdir, rc_incdir], install: true, install_dir: sbindir) @@ -85,7 +85,7 @@ executable('runscript', rc_selinux_c, version_h], c_args : [cc_audit_flags, cc_branding_flags, cc_pam_flags, cc_selinux_flags], link_with: [libeinfo, librc], - dependencies: [audit_dep, dl_dep, libpam, util_dep, selinux_dep], + dependencies: [audit_dep, dl_dep, pam_dep, util_dep, selinux_dep], include_directories: [incdir, einfo_incdir, rc_incdir], install: true, install_dir: sbindir) @@ -95,7 +95,7 @@ executable('start-stop-daemon', rc_selinux_c, usage_c, version_h], c_args : [cc_audit_flags, cc_branding_flags, cc_pam_flags, cc_selinux_flags], link_with: [libeinfo, librc], - dependencies: [dl_dep, libpam, util_dep, selinux_dep], + dependencies: [dl_dep, pam_dep, util_dep, selinux_dep], include_directories: [incdir, einfo_incdir, rc_incdir], install: true, install_dir: sbindir) @@ -105,7 +105,7 @@ executable('supervise-daemon', usage_c, version_h], c_args : [cc_branding_flags, cc_pam_flags, cc_selinux_flags], link_with: [libeinfo, librc], - dependencies: [dl_dep, libpam, util_dep, selinux_dep], + dependencies: [dl_dep, pam_dep, util_dep, selinux_dep], include_directories: [incdir, einfo_incdir, rc_incdir], install: true, install_dir: sbindir) @@ -168,7 +168,7 @@ executable('checkpath', c_args : [cc_audit_flags, cc_branding_flags, cc_pam_flags, cc_selinux_flags], include_directories: [incdir, einfo_incdir, rc_incdir], link_with: [libeinfo, librc], - dependencies: [libpam, selinux_dep], + dependencies: [pam_dep, selinux_dep], install: true, install_dir: rc_bindir)