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 <abokovoy@redhat.com>
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
This commit is contained in:
Alexander Bokovoy 2022-01-11 16:10:24 +02:00 committed by Rob Crittenden
parent a8b2279e94
commit f019104061

View File

@ -101,9 +101,13 @@ dnl ---------------------------------------------------------------------------
SAVE_CPPFLAGS=$CPPFLAGS SAVE_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$NSPR_CFLAGS $NSS_CFLAGS" CPPFLAGS="$NSPR_CFLAGS $NSS_CFLAGS"
AC_CHECK_LIB([ldap_r], [ldap_search], [ ], AC_MSG_ERROR([libldap_r not found])) SAVE_LIBS="$LIBS"
AC_CHECK_LIB([lber], [ber_peek_tag], [ ], AC_MSG_ERROR([liblber not found])) LIBS=
LDAP_LIBS="-lldap_r -llber" 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="" LDAP_CFLAGS=""
AC_SUBST(LDAP_LIBS) AC_SUBST(LDAP_LIBS)
AC_SUBST(LDAP_CFLAGS) AC_SUBST(LDAP_CFLAGS)