[31510] in CVS-changelog-for-Kerberos-V5

home help back first fref pref prev next nref lref last post

krb5 commit: Use pkg-config if available to find libldap

daemon@ATHENA.MIT.EDU (ghudson@mit.edu)
Wed Mar 18 01:57:59 2026

From: ghudson@mit.edu
To: cvs-krb5@mit.edu
Message-Id: <20260318055752.C6AA1102C88@krbdev.mit.edu>
Date: Wed, 18 Mar 2026 01:57:52 -0400 (EDT)
MIME-Version: 1.0
Reply-To: krbdev@mit.edu
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: cvs-krb5-bounces@mit.edu

https://github.com/krb5/krb5/commit/d060d76e48e83af58b8aa1d01300267227066e7f
commit d060d76e48e83af58b8aa1d01300267227066e7f
Author: Marcelo Juchem <m@juchem.pro>
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.
    
    [ghudson@mit.edu: 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.])
_______________________________________________
cvs-krb5 mailing list
cvs-krb5@mit.edu
https://mailman.mit.edu/mailman/listinfo/cvs-krb5

home help back first fref pref prev next nref lref last post