diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2021-07-09 12:38:55 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2021-07-09 12:38:55 -0400 |
commit | 5620ec83362d08b9f86c90c97c0a70031c4d0b2c (patch) | |
tree | 1398cc8f69aac8b1653a94688a4969b7a6fbe44e /configure.ac | |
parent | 39b6e85f135f7a1dcf43c0551d7d10e8c57b7fce (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.ac | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/configure.ac b/configure.ac index 3eb35583c1b..1cf41a69625 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 |