mirror of
https://github.com/postgres/postgres.git
synced 2025-06-25 01:02:05 +03:00
Update configure's probe for libldap to work with OpenLDAP 2.5.
The separate libldap_r is gone and libldap itself is now always thread-safe. Unfortunately there seems no easy way to tell by inspection whether libldap is thread-safe, so we have to take it on faith that libldap is thread-safe if there's no libldap_r. That should be okay, as it appears that libldap_r was a standard part of the installation going back at least 20 years. Report and patch by Adrian Ho. Back-patch to all supported branches, since people might try to build any of them with a newer OpenLDAP. Discussion: https://postgr.es/m/17083-a19190d9591946a7@postgresql.org
This commit is contained in:
20
configure.ac
20
configure.ac
@ -1289,18 +1289,22 @@ fi
|
||||
if test "$with_ldap" = yes ; then
|
||||
_LIBS="$LIBS"
|
||||
if test "$PORTNAME" != "win32"; then
|
||||
AC_CHECK_LIB(ldap, ldap_bind, [],
|
||||
[AC_MSG_ERROR([library 'ldap' is required for LDAP])],
|
||||
[$EXTRA_LDAP_LIBS])
|
||||
LDAP_LIBS_BE="-lldap $EXTRA_LDAP_LIBS"
|
||||
if test "$enable_thread_safety" = yes; then
|
||||
# Use ldap_r for FE if available, else assume ldap is thread-safe.
|
||||
# If ldap_r does exist, assume without checking that ldap does too.
|
||||
# on some platforms ldap_r fails to link without PTHREAD_LIBS
|
||||
AC_CHECK_LIB(ldap_r, ldap_simple_bind, [],
|
||||
[AC_MSG_ERROR([library 'ldap_r' is required for LDAP])],
|
||||
[$PTHREAD_CFLAGS $PTHREAD_LIBS $EXTRA_LDAP_LIBS])
|
||||
LDAP_LIBS_FE="-lldap_r $EXTRA_LDAP_LIBS"
|
||||
LIBS=""
|
||||
AC_SEARCH_LIBS(ldap_bind, [ldap_r ldap], [],
|
||||
[AC_MSG_ERROR([library 'ldap' is required for LDAP])],
|
||||
[$PTHREAD_CFLAGS $PTHREAD_LIBS $EXTRA_LDAP_LIBS])
|
||||
LDAP_LIBS_FE="$LIBS $EXTRA_LDAP_LIBS"
|
||||
LDAP_LIBS_BE="-lldap $EXTRA_LDAP_LIBS"
|
||||
else
|
||||
AC_CHECK_LIB(ldap, ldap_bind, [],
|
||||
[AC_MSG_ERROR([library 'ldap' is required for LDAP])],
|
||||
[$EXTRA_LDAP_LIBS])
|
||||
LDAP_LIBS_FE="-lldap $EXTRA_LDAP_LIBS"
|
||||
LDAP_LIBS_BE="-lldap $EXTRA_LDAP_LIBS"
|
||||
fi
|
||||
AC_CHECK_FUNCS([ldap_initialize])
|
||||
else
|
||||
|
Reference in New Issue
Block a user