@@ -12118,13 +12118,17 @@ fi
12118
12118
if test "$with_ldap" = yes ; then
12119
12119
_LIBS="$LIBS"
12120
12120
if test "$PORTNAME" != "win32"; then
12121
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ldap_bind in -lldap" >&5
12122
- $as_echo_n "checking for ldap_bind in -lldap... " >&6; }
12123
- if ${ac_cv_lib_ldap_ldap_bind+:} false; then :
12121
+ if test "$enable_thread_safety" = yes; then
12122
+ # Use ldap_r for FE if available, else assume ldap is thread-safe.
12123
+ # If ldap_r does exist, assume without checking that ldap does too.
12124
+ # on some platforms ldap_r fails to link without PTHREAD_LIBS
12125
+ LIBS=""
12126
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing ldap_bind" >&5
12127
+ $as_echo_n "checking for library containing ldap_bind... " >&6; }
12128
+ if ${ac_cv_search_ldap_bind+:} false; then :
12124
12129
$as_echo_n "(cached) " >&6
12125
12130
else
12126
- ac_check_lib_save_LIBS=$LIBS
12127
- LIBS="-lldap $EXTRA_LDAP_LIBS $LIBS"
12131
+ ac_func_search_save_LIBS=$LIBS
12128
12132
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
12129
12133
/* end confdefs.h. */
12130
12134
@@ -12143,38 +12147,50 @@ return ldap_bind ();
12143
12147
return 0;
12144
12148
}
12145
12149
_ACEOF
12146
- if ac_fn_c_try_link "$LINENO"; then :
12147
- ac_cv_lib_ldap_ldap_bind=yes
12148
- else
12149
- ac_cv_lib_ldap_ldap_bind=no
12150
+ for ac_lib in '' ldap_r ldap; do
12151
+ if test -z "$ac_lib"; then
12152
+ ac_res="none required"
12153
+ else
12154
+ ac_res=-l$ac_lib
12155
+ LIBS="-l$ac_lib $PTHREAD_CFLAGS $PTHREAD_LIBS $EXTRA_LDAP_LIBS $ac_func_search_save_LIBS"
12156
+ fi
12157
+ if ac_fn_c_try_link "$LINENO"; then :
12158
+ ac_cv_search_ldap_bind=$ac_res
12150
12159
fi
12151
12160
rm -f core conftest.err conftest.$ac_objext \
12152
- conftest$ac_exeext conftest.$ac_ext
12153
- LIBS=$ac_check_lib_save_LIBS
12161
+ conftest$ac_exeext
12162
+ if ${ac_cv_search_ldap_bind+:} false; then :
12163
+ break
12154
12164
fi
12155
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ldap_ldap_bind" >&5
12156
- $as_echo "$ac_cv_lib_ldap_ldap_bind" >&6; }
12157
- if test "x$ac_cv_lib_ldap_ldap_bind" = xyes; then :
12158
- cat >>confdefs.h <<_ACEOF
12159
- #define HAVE_LIBLDAP 1
12160
- _ACEOF
12165
+ done
12166
+ if ${ac_cv_search_ldap_bind+:} false; then :
12161
12167
12162
- LIBS="-lldap $LIBS"
12168
+ else
12169
+ ac_cv_search_ldap_bind=no
12170
+ fi
12171
+ rm conftest.$ac_ext
12172
+ LIBS=$ac_func_search_save_LIBS
12173
+ fi
12174
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_ldap_bind" >&5
12175
+ $as_echo "$ac_cv_search_ldap_bind" >&6; }
12176
+ ac_res=$ac_cv_search_ldap_bind
12177
+ if test "$ac_res" != no; then :
12178
+ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
12163
12179
12164
12180
else
12165
12181
as_fn_error $? "library 'ldap' is required for LDAP" "$LINENO" 5
12166
12182
fi
12167
12183
12168
- LDAP_LIBS_BE="-lldap $EXTRA_LDAP_LIBS"
12169
- if test "$enable_thread_safety" = yes; then
12170
- # on some platforms ldap_r fails to link without PTHREAD_LIBS
12171
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ldap_simple_bind in -lldap_r " >&5
12172
- $as_echo_n "checking for ldap_simple_bind in -lldap_r ... " >&6; }
12173
- if ${ac_cv_lib_ldap_r_ldap_simple_bind +:} false; then :
12184
+ LDAP_LIBS_FE="$LIBS $EXTRA_LDAP_LIBS"
12185
+ LDAP_LIBS_BE="-lldap $EXTRA_LDAP_LIBS"
12186
+ else
12187
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ldap_bind in -lldap " >&5
12188
+ $as_echo_n "checking for ldap_bind in -lldap ... " >&6; }
12189
+ if ${ac_cv_lib_ldap_ldap_bind +:} false; then :
12174
12190
$as_echo_n "(cached) " >&6
12175
12191
else
12176
12192
ac_check_lib_save_LIBS=$LIBS
12177
- LIBS="-lldap_r $PTHREAD_CFLAGS $PTHREAD_LIBS $EXTRA_LDAP_LIBS $LIBS"
12193
+ LIBS="-lldap $EXTRA_LDAP_LIBS $LIBS"
12178
12194
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
12179
12195
/* end confdefs.h. */
12180
12196
@@ -12184,40 +12200,39 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
12184
12200
#ifdef __cplusplus
12185
12201
extern "C"
12186
12202
#endif
12187
- char ldap_simple_bind ();
12203
+ char ldap_bind ();
12188
12204
int
12189
12205
main ()
12190
12206
{
12191
- return ldap_simple_bind ();
12207
+ return ldap_bind ();
12192
12208
;
12193
12209
return 0;
12194
12210
}
12195
12211
_ACEOF
12196
12212
if ac_fn_c_try_link "$LINENO"; then :
12197
- ac_cv_lib_ldap_r_ldap_simple_bind =yes
12213
+ ac_cv_lib_ldap_ldap_bind =yes
12198
12214
else
12199
- ac_cv_lib_ldap_r_ldap_simple_bind =no
12215
+ ac_cv_lib_ldap_ldap_bind =no
12200
12216
fi
12201
12217
rm -f core conftest.err conftest.$ac_objext \
12202
12218
conftest$ac_exeext conftest.$ac_ext
12203
12219
LIBS=$ac_check_lib_save_LIBS
12204
12220
fi
12205
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ldap_r_ldap_simple_bind " >&5
12206
- $as_echo "$ac_cv_lib_ldap_r_ldap_simple_bind " >&6; }
12207
- if test "x$ac_cv_lib_ldap_r_ldap_simple_bind " = xyes; then :
12221
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ldap_ldap_bind " >&5
12222
+ $as_echo "$ac_cv_lib_ldap_ldap_bind " >&6; }
12223
+ if test "x$ac_cv_lib_ldap_ldap_bind " = xyes; then :
12208
12224
cat >>confdefs.h <<_ACEOF
12209
- #define HAVE_LIBLDAP_R 1
12225
+ #define HAVE_LIBLDAP 1
12210
12226
_ACEOF
12211
12227
12212
- LIBS="-lldap_r $LIBS"
12228
+ LIBS="-lldap $LIBS"
12213
12229
12214
12230
else
12215
- as_fn_error $? "library 'ldap_r ' is required for LDAP" "$LINENO" 5
12231
+ as_fn_error $? "library 'ldap ' is required for LDAP" "$LINENO" 5
12216
12232
fi
12217
12233
12218
- LDAP_LIBS_FE="-lldap_r $EXTRA_LDAP_LIBS"
12219
- else
12220
12234
LDAP_LIBS_FE="-lldap $EXTRA_LDAP_LIBS"
12235
+ LDAP_LIBS_BE="-lldap $EXTRA_LDAP_LIBS"
12221
12236
fi
12222
12237
for ac_func in ldap_initialize
12223
12238
do :
0 commit comments