krb5 commit: Use pkg-config if available to find libldap
[email protected] Wed, 18 Mar 2026 01:57:52 -0400 (EDT)
| Newsgroups | gmane.comp.encryption.kerberos.cvs |
|---|---|
| Message-ID | <[email protected]> |
https://github.com/krb5/krb5/commit/d060d76e48e83af58b8aa1d01300267227066e7f commit d060d76e48e83af58b8aa1d01300267227066e7f Author: Marcelo Juchem <[email protected]> Date: Thu Mar 12 10:52:24 2026 -0500 Use pkg-config if available to find libldap Finding libldap manually can fail with static libraries. Use pkg-config instead if we can. [[email protected]: simplified PKG_CHECK_MODULES() invocation; fixed some style issues in the code that is now indented] ticket: 9199 (new) src/configure.ac | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/src/configure.ac b/src/configure.ac index 7313bc552..f42ed1db7 100644 --- a/src/configure.ac +++ b/src/configure.ac @@ -1279,19 +1279,25 @@ fi ldap_plugin_dir="" ldap_lib="" if test -n "$OPENLDAP_PLUGIN"; then - AC_CHECK_HEADERS(ldap.h lber.h, :, [AC_MSG_ERROR($ac_header not found)]) - AC_CHECK_LIB(ldap, ldap_str2dn, :, [AC_MSG_ERROR(libldap not found or missing ldap_str2dn)]) - - BER_OKAY=0 - AC_CHECK_LIB(ldap, ber_init, [BER_OKAY=1]) - if test "$BER_OKAY" = "1"; then - LDAP_LIBS='-lldap' + PKG_PROG_PKG_CONFIG() + if test -n "$PKG_CONFIG"; then + PKG_CHECK_MODULES([LDAP], [ldap]) else - AC_CHECK_LIB(lber, ber_init, [BER_OKAY=1], [AC_MSG_WARN([libber not found])]) + AC_CHECK_HEADERS([ldap.h lber.h], :, [AC_MSG_ERROR($ac_header not found)]) + AC_CHECK_LIB([ldap], [ldap_str2dn], :, [AC_MSG_ERROR(libldap not found)]) + + BER_OKAY=0 + AC_CHECK_LIB([ldap], [ber_init], [BER_OKAY=1]) if test "$BER_OKAY" = "1"; then - LDAP_LIBS='-lldap -llber' + LDAP_LIBS='-lldap' else - AC_MSG_ERROR("BER library missing - cannot build LDAP database module") + AC_CHECK_LIB([lber], [ber_init], [BER_OKAY=1], + [AC_MSG_WARN([libber not found])]) + if test "$BER_OKAY" = "1"; then + LDAP_LIBS='-lldap -llber' + else + AC_MSG_ERROR([BER library missing - cannot build LDAP database module]) + fi fi fi AC_DEFINE([ENABLE_LDAP], 1, [Define if LDAP KDB support within the Kerberos library (mainly ASN.1 code) should be enabled.])