@@ -1036,7 +1036,8 @@ threads = dependency('threads')
10361036librt = cc.find_library (' rt' )
10371037libm = cc.find_library (' m' )
10381038libdl = cc.find_library (' dl' )
1039- libcrypt = cc.find_library (' crypt' )
1039+ libcrypt = dependency (' libcrypt' )
1040+ libcap = dependency (' libcap' )
10401041
10411042# On some architectures, libatomic is required. But on some installations,
10421043# it is found, but actual linking fails. So let's try to use it opportunistically.
@@ -1060,12 +1061,6 @@ foreach ident : [
10601061 conf.set10(' HAVE_' + ident[0 ].to_upper(), have)
10611062endforeach
10621063
1063- libcap = dependency (' libcap' , required : false )
1064- if not libcap.found()
1065- # Compat with Ubuntu 14.04 which ships libcap w/o .pc file
1066- libcap = cc.find_library (' cap' )
1067- endif
1068-
10691064want_bpf_framework = get_option (' bpf-framework' )
10701065bpf_compiler = get_option (' bpf-compiler' )
10711066bpf_framework_required = want_bpf_framework == ' true'
@@ -1244,7 +1239,7 @@ conf.set10('ENABLE_POLKIT', install_polkit)
12441239
12451240want_acl = get_option (' acl' )
12461241if want_acl != ' false' and not skip_deps
1247- libacl = cc. find_library ( ' acl ' , required : want_acl == ' true' )
1242+ libacl = dependency ( ' libacl ' , required : want_acl == ' true' )
12481243 have = libacl.found()
12491244else
12501245 have = false
@@ -1301,8 +1296,15 @@ conf.set10('HAVE_XENCTRL', have)
13011296
13021297want_pam = get_option (' pam' )
13031298if want_pam != ' false' and not skip_deps
1304- libpam = cc.find_library (' pam' , required : want_pam == ' true' )
1305- libpam_misc = cc.find_library (' pam_misc' , required : want_pam == ' true' )
1299+ libpam = dependency (' pam' , required : false )
1300+ if not libpam.found()
1301+ # Debian older than bookworm and Ubuntu older than 22.10 do not provide the .pc file.
1302+ libpam = cc.find_library (' pam' , required : want_pam == ' true' )
1303+ endif
1304+ libpam_misc = dependency (' pam_misc' , required : false )
1305+ if not libpam_misc.found()
1306+ libpam_misc = cc.find_library (' pam_misc' , required : want_pam == ' true' )
1307+ endif
13061308 have = libpam.found() and libpam_misc.found()
13071309else
13081310 have = false
@@ -1431,8 +1433,12 @@ conf.set10('HAVE_QRENCODE', have)
14311433
14321434want_gcrypt = get_option (' gcrypt' )
14331435if want_gcrypt != ' false' and not skip_deps
1434- libgcrypt = cc.find_library (' gcrypt' , required : want_gcrypt == ' true' )
1435- libgpg_error = cc.find_library (' gpg-error' , required : want_gcrypt == ' true' )
1436+ libgcrypt = dependency (' libgcrypt' , required : want_gcrypt == ' true' )
1437+ libgpg_error = dependency (' gpg-error' , required : false )
1438+ if not libgpg_error.found()
1439+ # CentOS 8 does not provide the .pc file.
1440+ libgpg_error = cc.find_library (' gpg-error' , required : want_gcrypt == ' true' )
1441+ endif
14361442 have = libgcrypt.found() and libgpg_error.found()
14371443else
14381444 have = false
@@ -1542,8 +1548,11 @@ conf.set10('HAVE_ZLIB', have)
15421548
15431549want_bzip2 = get_option (' bzip2' )
15441550if want_bzip2 != ' false' and not skip_deps
1545- libbzip2 = cc.find_library (' bz2' ,
1546- required : want_bzip2 == ' true' )
1551+ libbzip2 = dependency (' bzip2' , required : false )
1552+ if not libbzip2.found()
1553+ # Debian and Ubuntu do not provide the .pc file.
1554+ libbzip2 = cc.find_library (' bz2' , required : want_bzip2 == ' true' )
1555+ endif
15471556 have = libbzip2.found()
15481557else
15491558 have = false
0 commit comments