From f0191040616e6fe58fef5b20b7d9c284de913be7 Mon Sep 17 00:00:00 2001 From: Alexander Bokovoy Date: Tue, 11 Jan 2022 16:10:24 +0200 Subject: [PATCH] Support building against OpenLDAP 2.6+ OpenLDAP 2.6 deprecated separate libldap/libldap_r, there is only one (reentrant) variant for the library. Attempt to use _r variant by default. In case it is missing, assume we are using OpenLDAP 2.6 which has libraries without _r suffix. The functions are still reentrant so there is not functional difference. Fixes: https://pagure.io/freeipa/issue/9080 Signed-off-by: Alexander Bokovoy Reviewed-By: Rob Crittenden --- configure.ac | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 1ae4dc8dd..a64b434fe 100644 --- a/configure.ac +++ b/configure.ac @@ -101,9 +101,13 @@ dnl --------------------------------------------------------------------------- SAVE_CPPFLAGS=$CPPFLAGS CPPFLAGS="$NSPR_CFLAGS $NSS_CFLAGS" -AC_CHECK_LIB([ldap_r], [ldap_search], [ ], AC_MSG_ERROR([libldap_r not found])) -AC_CHECK_LIB([lber], [ber_peek_tag], [ ], AC_MSG_ERROR([liblber not found])) -LDAP_LIBS="-lldap_r -llber" +SAVE_LIBS="$LIBS" +LIBS= +AC_SEARCH_LIBS([ldap_search], [ldap_r ldap], [], [AC_MSG_ERROR([libldap or libldap_r not found])]) +AC_SEARCH_LIBS([ber_peek_tag], [lber], [], [AC_MSG_ERROR([liblber not found])]) +LDAP_LIBS="$LIBS" +LDAP_CFLAGS="" +LIBS="$SAVE_LIBS" LDAP_CFLAGS="" AC_SUBST(LDAP_LIBS) AC_SUBST(LDAP_CFLAGS)