mirror of
https://github.com/postgres/postgres.git
synced 2025-04-21 12:05:57 +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:
parent
39b6e85f13
commit
5620ec8336
121
configure
vendored
121
configure
vendored
@ -12880,7 +12880,73 @@ fi
|
|||||||
if test "$with_ldap" = yes ; then
|
if test "$with_ldap" = yes ; then
|
||||||
_LIBS="$LIBS"
|
_LIBS="$LIBS"
|
||||||
if test "$PORTNAME" != "win32"; then
|
if test "$PORTNAME" != "win32"; then
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ldap_bind in -lldap" >&5
|
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
|
||||||
|
LIBS=""
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing ldap_bind" >&5
|
||||||
|
$as_echo_n "checking for library containing ldap_bind... " >&6; }
|
||||||
|
if ${ac_cv_search_ldap_bind+:} false; then :
|
||||||
|
$as_echo_n "(cached) " >&6
|
||||||
|
else
|
||||||
|
ac_func_search_save_LIBS=$LIBS
|
||||||
|
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||||
|
/* end confdefs.h. */
|
||||||
|
|
||||||
|
/* Override any GCC internal prototype to avoid an error.
|
||||||
|
Use char because int might match the return type of a GCC
|
||||||
|
builtin and then its argument prototype would still apply. */
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
#endif
|
||||||
|
char ldap_bind ();
|
||||||
|
int
|
||||||
|
main ()
|
||||||
|
{
|
||||||
|
return ldap_bind ();
|
||||||
|
;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
_ACEOF
|
||||||
|
for ac_lib in '' ldap_r ldap; do
|
||||||
|
if test -z "$ac_lib"; then
|
||||||
|
ac_res="none required"
|
||||||
|
else
|
||||||
|
ac_res=-l$ac_lib
|
||||||
|
LIBS="-l$ac_lib $PTHREAD_CFLAGS $PTHREAD_LIBS $EXTRA_LDAP_LIBS $ac_func_search_save_LIBS"
|
||||||
|
fi
|
||||||
|
if ac_fn_c_try_link "$LINENO"; then :
|
||||||
|
ac_cv_search_ldap_bind=$ac_res
|
||||||
|
fi
|
||||||
|
rm -f core conftest.err conftest.$ac_objext \
|
||||||
|
conftest$ac_exeext
|
||||||
|
if ${ac_cv_search_ldap_bind+:} false; then :
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if ${ac_cv_search_ldap_bind+:} false; then :
|
||||||
|
|
||||||
|
else
|
||||||
|
ac_cv_search_ldap_bind=no
|
||||||
|
fi
|
||||||
|
rm conftest.$ac_ext
|
||||||
|
LIBS=$ac_func_search_save_LIBS
|
||||||
|
fi
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_ldap_bind" >&5
|
||||||
|
$as_echo "$ac_cv_search_ldap_bind" >&6; }
|
||||||
|
ac_res=$ac_cv_search_ldap_bind
|
||||||
|
if test "$ac_res" != no; then :
|
||||||
|
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
|
||||||
|
|
||||||
|
else
|
||||||
|
as_fn_error $? "library 'ldap' is required for LDAP" "$LINENO" 5
|
||||||
|
fi
|
||||||
|
|
||||||
|
LDAP_LIBS_FE="$LIBS $EXTRA_LDAP_LIBS"
|
||||||
|
LDAP_LIBS_BE="-lldap $EXTRA_LDAP_LIBS"
|
||||||
|
else
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ldap_bind in -lldap" >&5
|
||||||
$as_echo_n "checking for ldap_bind in -lldap... " >&6; }
|
$as_echo_n "checking for ldap_bind in -lldap... " >&6; }
|
||||||
if ${ac_cv_lib_ldap_ldap_bind+:} false; then :
|
if ${ac_cv_lib_ldap_ldap_bind+:} false; then :
|
||||||
$as_echo_n "(cached) " >&6
|
$as_echo_n "(cached) " >&6
|
||||||
@ -12927,59 +12993,8 @@ else
|
|||||||
as_fn_error $? "library 'ldap' is required for LDAP" "$LINENO" 5
|
as_fn_error $? "library 'ldap' is required for LDAP" "$LINENO" 5
|
||||||
fi
|
fi
|
||||||
|
|
||||||
LDAP_LIBS_BE="-lldap $EXTRA_LDAP_LIBS"
|
|
||||||
if test "$enable_thread_safety" = yes; then
|
|
||||||
# on some platforms ldap_r fails to link without PTHREAD_LIBS
|
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ldap_simple_bind in -lldap_r" >&5
|
|
||||||
$as_echo_n "checking for ldap_simple_bind in -lldap_r... " >&6; }
|
|
||||||
if ${ac_cv_lib_ldap_r_ldap_simple_bind+:} false; then :
|
|
||||||
$as_echo_n "(cached) " >&6
|
|
||||||
else
|
|
||||||
ac_check_lib_save_LIBS=$LIBS
|
|
||||||
LIBS="-lldap_r $PTHREAD_CFLAGS $PTHREAD_LIBS $EXTRA_LDAP_LIBS $LIBS"
|
|
||||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
|
||||||
/* end confdefs.h. */
|
|
||||||
|
|
||||||
/* Override any GCC internal prototype to avoid an error.
|
|
||||||
Use char because int might match the return type of a GCC
|
|
||||||
builtin and then its argument prototype would still apply. */
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C"
|
|
||||||
#endif
|
|
||||||
char ldap_simple_bind ();
|
|
||||||
int
|
|
||||||
main ()
|
|
||||||
{
|
|
||||||
return ldap_simple_bind ();
|
|
||||||
;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
_ACEOF
|
|
||||||
if ac_fn_c_try_link "$LINENO"; then :
|
|
||||||
ac_cv_lib_ldap_r_ldap_simple_bind=yes
|
|
||||||
else
|
|
||||||
ac_cv_lib_ldap_r_ldap_simple_bind=no
|
|
||||||
fi
|
|
||||||
rm -f core conftest.err conftest.$ac_objext \
|
|
||||||
conftest$ac_exeext conftest.$ac_ext
|
|
||||||
LIBS=$ac_check_lib_save_LIBS
|
|
||||||
fi
|
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ldap_r_ldap_simple_bind" >&5
|
|
||||||
$as_echo "$ac_cv_lib_ldap_r_ldap_simple_bind" >&6; }
|
|
||||||
if test "x$ac_cv_lib_ldap_r_ldap_simple_bind" = xyes; then :
|
|
||||||
cat >>confdefs.h <<_ACEOF
|
|
||||||
#define HAVE_LIBLDAP_R 1
|
|
||||||
_ACEOF
|
|
||||||
|
|
||||||
LIBS="-lldap_r $LIBS"
|
|
||||||
|
|
||||||
else
|
|
||||||
as_fn_error $? "library 'ldap_r' is required for LDAP" "$LINENO" 5
|
|
||||||
fi
|
|
||||||
|
|
||||||
LDAP_LIBS_FE="-lldap_r $EXTRA_LDAP_LIBS"
|
|
||||||
else
|
|
||||||
LDAP_LIBS_FE="-lldap $EXTRA_LDAP_LIBS"
|
LDAP_LIBS_FE="-lldap $EXTRA_LDAP_LIBS"
|
||||||
|
LDAP_LIBS_BE="-lldap $EXTRA_LDAP_LIBS"
|
||||||
fi
|
fi
|
||||||
for ac_func in ldap_initialize
|
for ac_func in ldap_initialize
|
||||||
do :
|
do :
|
||||||
|
20
configure.ac
20
configure.ac
@ -1289,18 +1289,22 @@ fi
|
|||||||
if test "$with_ldap" = yes ; then
|
if test "$with_ldap" = yes ; then
|
||||||
_LIBS="$LIBS"
|
_LIBS="$LIBS"
|
||||||
if test "$PORTNAME" != "win32"; then
|
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
|
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
|
# on some platforms ldap_r fails to link without PTHREAD_LIBS
|
||||||
AC_CHECK_LIB(ldap_r, ldap_simple_bind, [],
|
LIBS=""
|
||||||
[AC_MSG_ERROR([library 'ldap_r' is required for LDAP])],
|
AC_SEARCH_LIBS(ldap_bind, [ldap_r ldap], [],
|
||||||
[$PTHREAD_CFLAGS $PTHREAD_LIBS $EXTRA_LDAP_LIBS])
|
[AC_MSG_ERROR([library 'ldap' is required for LDAP])],
|
||||||
LDAP_LIBS_FE="-lldap_r $EXTRA_LDAP_LIBS"
|
[$PTHREAD_CFLAGS $PTHREAD_LIBS $EXTRA_LDAP_LIBS])
|
||||||
|
LDAP_LIBS_FE="$LIBS $EXTRA_LDAP_LIBS"
|
||||||
|
LDAP_LIBS_BE="-lldap $EXTRA_LDAP_LIBS"
|
||||||
else
|
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_FE="-lldap $EXTRA_LDAP_LIBS"
|
||||||
|
LDAP_LIBS_BE="-lldap $EXTRA_LDAP_LIBS"
|
||||||
fi
|
fi
|
||||||
AC_CHECK_FUNCS([ldap_initialize])
|
AC_CHECK_FUNCS([ldap_initialize])
|
||||||
else
|
else
|
||||||
|
@ -322,9 +322,6 @@
|
|||||||
/* Define to 1 if you have the `ldap' library (-lldap). */
|
/* Define to 1 if you have the `ldap' library (-lldap). */
|
||||||
#undef HAVE_LIBLDAP
|
#undef HAVE_LIBLDAP
|
||||||
|
|
||||||
/* Define to 1 if you have the `ldap_r' library (-lldap_r). */
|
|
||||||
#undef HAVE_LIBLDAP_R
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `lz4' library (-llz4). */
|
/* Define to 1 if you have the `lz4' library (-llz4). */
|
||||||
#undef HAVE_LIBLZ4
|
#undef HAVE_LIBLZ4
|
||||||
|
|
||||||
|
@ -302,7 +302,6 @@ sub GenerateFiles
|
|||||||
HAVE_LDAP_INITIALIZE => undef,
|
HAVE_LDAP_INITIALIZE => undef,
|
||||||
HAVE_LIBCRYPTO => undef,
|
HAVE_LIBCRYPTO => undef,
|
||||||
HAVE_LIBLDAP => undef,
|
HAVE_LIBLDAP => undef,
|
||||||
HAVE_LIBLDAP_R => undef,
|
|
||||||
HAVE_LIBLZ4 => undef,
|
HAVE_LIBLZ4 => undef,
|
||||||
HAVE_LIBM => undef,
|
HAVE_LIBM => undef,
|
||||||
HAVE_LIBPAM => undef,
|
HAVE_LIBPAM => undef,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user