summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorTom Lane2021-07-09 16:38:55 +0000
committerTom Lane2021-07-09 16:38:55 +0000
commitd0a02bdb8c2576b5aa607f127320e444080bd579 (patch)
tree4c1bb5af5eec16f6bba29ddc48879d02a5bdc353 /configure.ac
parenta9da1934e971b38ab360ce80a352fbfc4d2d986b (diff)
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
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac20
1 files changed, 12 insertions, 8 deletions
diff --git a/configure.ac b/configure.ac
index 39666f97277..9b79274ea7b 100644
--- a/configure.ac
+++ b/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