@@ -1022,7 +1022,8 @@ threads = dependency('threads')
10221022librt = cc.find_library (' rt' )
10231023libm = cc.find_library (' m' )
10241024libdl = cc.find_library (' dl' )
1025- libcrypt = cc.find_library (' crypt' )
1025+ libcrypt = dependency (' libcrypt' )
1026+ libcap = dependency (' libcap' )
10261027
10271028# On some architectures, libatomic is required. But on some installations,
10281029# it is found, but actual linking fails. So let's try to use it opportunistically.
@@ -1046,12 +1047,6 @@ foreach ident : [
10461047 conf.set10(' HAVE_' + ident[0 ].to_upper(), have)
10471048endforeach
10481049
1049- libcap = dependency (' libcap' , required : false )
1050- if not libcap.found()
1051- # Compat with Ubuntu 14.04 which ships libcap w/o .pc file
1052- libcap = cc.find_library (' cap' )
1053- endif
1054-
10551050want_bpf_framework = get_option (' bpf-framework' )
10561051bpf_compiler = get_option (' bpf-compiler' )
10571052bpf_framework_required = want_bpf_framework == ' true'
@@ -1233,7 +1228,7 @@ conf.set10('ENABLE_POLKIT', install_polkit)
12331228
12341229want_acl = get_option (' acl' )
12351230if want_acl != ' false' and not skip_deps
1236- libacl = cc. find_library ( ' acl ' , required : want_acl == ' true' )
1231+ libacl = dependency ( ' libacl ' , required : want_acl == ' true' )
12371232 have = libacl.found()
12381233else
12391234 have = false
@@ -1278,8 +1273,15 @@ conf.set10('HAVE_KMOD', have)
12781273
12791274want_pam = get_option (' pam' )
12801275if want_pam != ' false' and not skip_deps
1281- libpam = cc.find_library (' pam' , required : want_pam == ' true' )
1282- libpam_misc = cc.find_library (' pam_misc' , required : want_pam == ' true' )
1276+ libpam = dependency (' pam' , required : false )
1277+ if not libpam.found()
1278+ # Debian older than bookworm and Ubuntu older than 22.10 do not provide the .pc file.
1279+ libpam = cc.find_library (' pam' , required : want_pam == ' true' )
1280+ endif
1281+ libpam_misc = dependency (' pam_misc' , required : false )
1282+ if not libpam_misc.found()
1283+ libpam_misc = cc.find_library (' pam_misc' , required : want_pam == ' true' )
1284+ endif
12831285 have = libpam.found() and libpam_misc.found()
12841286else
12851287 have = false
@@ -1405,8 +1407,12 @@ conf.set10('HAVE_QRENCODE', have)
14051407
14061408want_gcrypt = get_option (' gcrypt' )
14071409if want_gcrypt != ' false' and not skip_deps
1408- libgcrypt = cc.find_library (' gcrypt' , required : want_gcrypt == ' true' )
1409- libgpg_error = cc.find_library (' gpg-error' , required : want_gcrypt == ' true' )
1410+ libgcrypt = dependency (' libgcrypt' , required : want_gcrypt == ' true' )
1411+ libgpg_error = dependency (' gpg-error' , required : false )
1412+ if not libgpg_error.found()
1413+ # CentOS 8 does not provide the .pc file.
1414+ libgpg_error = cc.find_library (' gpg-error' , required : want_gcrypt == ' true' )
1415+ endif
14101416 have = libgcrypt.found() and libgpg_error.found()
14111417else
14121418 have = false
@@ -1514,8 +1520,11 @@ conf.set10('HAVE_ZLIB', have)
15141520
15151521want_bzip2 = get_option (' bzip2' )
15161522if want_bzip2 != ' false' and not skip_deps
1517- libbzip2 = cc.find_library (' bz2' ,
1518- required : want_bzip2 == ' true' )
1523+ libbzip2 = dependency (' bzip2' , required : false )
1524+ if not libbzip2.found()
1525+ # Debian and Ubuntu do not provide the .pc file.
1526+ libbzip2 = cc.find_library (' bz2' , required : want_bzip2 == ' true' )
1527+ endif
15191528 have = libbzip2.found()
15201529else
15211530 have = false
0 commit comments