@@ -998,7 +998,8 @@ threads = dependency('threads')
998998librt = cc.find_library (' rt' )
999999libm = cc.find_library (' m' )
10001000libdl = cc.find_library (' dl' )
1001- libcrypt = cc.find_library (' crypt' )
1001+ libcrypt = dependency (' libcrypt' )
1002+ libcap = dependency (' libcap' )
10021003
10031004# On some architectures, libatomic is required. But on some installations,
10041005# it is found, but actual linking fails. So let's try to use it opportunistically.
@@ -1022,12 +1023,6 @@ foreach ident : [
10221023 conf.set10(' HAVE_' + ident[0 ].to_upper(), have)
10231024endforeach
10241025
1025- libcap = dependency (' libcap' , required : false )
1026- if not libcap.found()
1027- # Compat with Ubuntu 14.04 which ships libcap w/o .pc file
1028- libcap = cc.find_library (' cap' )
1029- endif
1030-
10311026want_bpf_framework = get_option (' bpf-framework' )
10321027bpf_framework_required = want_bpf_framework == ' true'
10331028
@@ -1178,7 +1173,7 @@ conf.set10('ENABLE_POLKIT', install_polkit)
11781173
11791174want_acl = get_option (' acl' )
11801175if want_acl != ' false' and not skip_deps
1181- libacl = cc. find_library ( ' acl ' , required : want_acl == ' true' )
1176+ libacl = dependency ( ' libacl ' , required : want_acl == ' true' )
11821177 have = libacl.found()
11831178else
11841179 have = false
@@ -1223,8 +1218,15 @@ conf.set10('HAVE_KMOD', have)
12231218
12241219want_pam = get_option (' pam' )
12251220if want_pam != ' false' and not skip_deps
1226- libpam = cc.find_library (' pam' , required : want_pam == ' true' )
1227- libpam_misc = cc.find_library (' pam_misc' , required : want_pam == ' true' )
1221+ libpam = dependency (' pam' , required : false )
1222+ if not libpam.found()
1223+ # Debian older than bookworm and Ubuntu older than 22.10 do not provide the .pc file.
1224+ libpam = cc.find_library (' pam' , required : want_pam == ' true' )
1225+ endif
1226+ libpam_misc = dependency (' pam_misc' , required : false )
1227+ if not libpam_misc.found()
1228+ libpam_misc = cc.find_library (' pam_misc' , required : want_pam == ' true' )
1229+ endif
12281230 have = libpam.found() and libpam_misc.found()
12291231else
12301232 have = false
@@ -1350,8 +1352,12 @@ conf.set10('HAVE_QRENCODE', have)
13501352
13511353want_gcrypt = get_option (' gcrypt' )
13521354if want_gcrypt != ' false' and not skip_deps
1353- libgcrypt = cc.find_library (' gcrypt' , required : want_gcrypt == ' true' )
1354- libgpg_error = cc.find_library (' gpg-error' , required : want_gcrypt == ' true' )
1355+ libgcrypt = dependency (' libgcrypt' , required : want_gcrypt == ' true' )
1356+ libgpg_error = dependency (' gpg-error' , required : false )
1357+ if not libgpg_error.found()
1358+ # CentOS 8 does not provide the .pc file.
1359+ libgpg_error = cc.find_library (' gpg-error' , required : want_gcrypt == ' true' )
1360+ endif
13551361 have = libgcrypt.found() and libgpg_error.found()
13561362else
13571363 have = false
@@ -1449,8 +1455,11 @@ conf.set10('HAVE_ZLIB', have)
14491455
14501456want_bzip2 = get_option (' bzip2' )
14511457if want_bzip2 != ' false' and not skip_deps
1452- libbzip2 = cc.find_library (' bz2' ,
1453- required : want_bzip2 == ' true' )
1458+ libbzip2 = dependency (' bzip2' , required : false )
1459+ if not libbzip2.found()
1460+ # Debian and Ubuntu do not provide the .pc file.
1461+ libbzip2 = cc.find_library (' bz2' , required : want_bzip2 == ' true' )
1462+ endif
14541463 have = libbzip2.found()
14551464else
14561465 have = false
0 commit comments