@@ -12495,13 +12495,17 @@ fi
12495
12495
if test "$with_ldap" = yes ; then
12496
12496
_LIBS="$LIBS"
12497
12497
if test "$PORTNAME" != "win32"; then
12498
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ldap_bind in -lldap" >&5
12499
- $as_echo_n "checking for ldap_bind in -lldap... " >&6; }
12500
- if ${ac_cv_lib_ldap_ldap_bind+:} false; then :
12498
+ if test "$enable_thread_safety" = yes; then
12499
+ # Use ldap_r for FE if available, else assume ldap is thread-safe.
12500
+ # If ldap_r does exist, assume without checking that ldap does too.
12501
+ # on some platforms ldap_r fails to link without PTHREAD_LIBS
12502
+ LIBS=""
12503
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing ldap_bind" >&5
12504
+ $as_echo_n "checking for library containing ldap_bind... " >&6; }
12505
+ if ${ac_cv_search_ldap_bind+:} false; then :
12501
12506
$as_echo_n "(cached) " >&6
12502
12507
else
12503
- ac_check_lib_save_LIBS=$LIBS
12504
- LIBS="-lldap $EXTRA_LDAP_LIBS $LIBS"
12508
+ ac_func_search_save_LIBS=$LIBS
12505
12509
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
12506
12510
/* end confdefs.h. */
12507
12511
@@ -12520,38 +12524,50 @@ return ldap_bind ();
12520
12524
return 0;
12521
12525
}
12522
12526
_ACEOF
12523
- if ac_fn_c_try_link "$LINENO"; then :
12524
- ac_cv_lib_ldap_ldap_bind=yes
12525
- else
12526
- ac_cv_lib_ldap_ldap_bind=no
12527
+ for ac_lib in '' ldap_r ldap; do
12528
+ if test -z "$ac_lib"; then
12529
+ ac_res="none required"
12530
+ else
12531
+ ac_res=-l$ac_lib
12532
+ LIBS="-l$ac_lib $PTHREAD_CFLAGS $PTHREAD_LIBS $EXTRA_LDAP_LIBS $ac_func_search_save_LIBS"
12533
+ fi
12534
+ if ac_fn_c_try_link "$LINENO"; then :
12535
+ ac_cv_search_ldap_bind=$ac_res
12527
12536
fi
12528
12537
rm -f core conftest.err conftest.$ac_objext \
12529
- conftest$ac_exeext conftest.$ac_ext
12530
- LIBS=$ac_check_lib_save_LIBS
12538
+ conftest$ac_exeext
12539
+ if ${ac_cv_search_ldap_bind+:} false; then :
12540
+ break
12531
12541
fi
12532
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ldap_ldap_bind" >&5
12533
- $as_echo "$ac_cv_lib_ldap_ldap_bind" >&6; }
12534
- if test "x$ac_cv_lib_ldap_ldap_bind" = xyes; then :
12535
- cat >>confdefs.h <<_ACEOF
12536
- #define HAVE_LIBLDAP 1
12537
- _ACEOF
12542
+ done
12543
+ if ${ac_cv_search_ldap_bind+:} false; then :
12538
12544
12539
- LIBS="-lldap $LIBS"
12545
+ else
12546
+ ac_cv_search_ldap_bind=no
12547
+ fi
12548
+ rm conftest.$ac_ext
12549
+ LIBS=$ac_func_search_save_LIBS
12550
+ fi
12551
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_ldap_bind" >&5
12552
+ $as_echo "$ac_cv_search_ldap_bind" >&6; }
12553
+ ac_res=$ac_cv_search_ldap_bind
12554
+ if test "$ac_res" != no; then :
12555
+ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
12540
12556
12541
12557
else
12542
12558
as_fn_error $? "library 'ldap' is required for LDAP" "$LINENO" 5
12543
12559
fi
12544
12560
12545
- LDAP_LIBS_BE="-lldap $EXTRA_LDAP_LIBS"
12546
- if test "$enable_thread_safety" = yes; then
12547
- # on some platforms ldap_r fails to link without PTHREAD_LIBS
12548
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ldap_simple_bind in -lldap_r " >&5
12549
- $as_echo_n "checking for ldap_simple_bind in -lldap_r ... " >&6; }
12550
- if ${ac_cv_lib_ldap_r_ldap_simple_bind +:} false; then :
12561
+ LDAP_LIBS_FE="$LIBS $EXTRA_LDAP_LIBS"
12562
+ LDAP_LIBS_BE="-lldap $EXTRA_LDAP_LIBS"
12563
+ else
12564
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ldap_bind in -lldap " >&5
12565
+ $as_echo_n "checking for ldap_bind in -lldap ... " >&6; }
12566
+ if ${ac_cv_lib_ldap_ldap_bind +:} false; then :
12551
12567
$as_echo_n "(cached) " >&6
12552
12568
else
12553
12569
ac_check_lib_save_LIBS=$LIBS
12554
- LIBS="-lldap_r $PTHREAD_CFLAGS $PTHREAD_LIBS $EXTRA_LDAP_LIBS $LIBS"
12570
+ LIBS="-lldap $EXTRA_LDAP_LIBS $LIBS"
12555
12571
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
12556
12572
/* end confdefs.h. */
12557
12573
@@ -12561,40 +12577,39 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
12561
12577
#ifdef __cplusplus
12562
12578
extern "C"
12563
12579
#endif
12564
- char ldap_simple_bind ();
12580
+ char ldap_bind ();
12565
12581
int
12566
12582
main ()
12567
12583
{
12568
- return ldap_simple_bind ();
12584
+ return ldap_bind ();
12569
12585
;
12570
12586
return 0;
12571
12587
}
12572
12588
_ACEOF
12573
12589
if ac_fn_c_try_link "$LINENO"; then :
12574
- ac_cv_lib_ldap_r_ldap_simple_bind =yes
12590
+ ac_cv_lib_ldap_ldap_bind =yes
12575
12591
else
12576
- ac_cv_lib_ldap_r_ldap_simple_bind =no
12592
+ ac_cv_lib_ldap_ldap_bind =no
12577
12593
fi
12578
12594
rm -f core conftest.err conftest.$ac_objext \
12579
12595
conftest$ac_exeext conftest.$ac_ext
12580
12596
LIBS=$ac_check_lib_save_LIBS
12581
12597
fi
12582
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ldap_r_ldap_simple_bind " >&5
12583
- $as_echo "$ac_cv_lib_ldap_r_ldap_simple_bind " >&6; }
12584
- if test "x$ac_cv_lib_ldap_r_ldap_simple_bind " = xyes; then :
12598
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ldap_ldap_bind " >&5
12599
+ $as_echo "$ac_cv_lib_ldap_ldap_bind " >&6; }
12600
+ if test "x$ac_cv_lib_ldap_ldap_bind " = xyes; then :
12585
12601
cat >>confdefs.h <<_ACEOF
12586
- #define HAVE_LIBLDAP_R 1
12602
+ #define HAVE_LIBLDAP 1
12587
12603
_ACEOF
12588
12604
12589
- LIBS="-lldap_r $LIBS"
12605
+ LIBS="-lldap $LIBS"
12590
12606
12591
12607
else
12592
- as_fn_error $? "library 'ldap_r ' is required for LDAP" "$LINENO" 5
12608
+ as_fn_error $? "library 'ldap ' is required for LDAP" "$LINENO" 5
12593
12609
fi
12594
12610
12595
- LDAP_LIBS_FE="-lldap_r $EXTRA_LDAP_LIBS"
12596
- else
12597
12611
LDAP_LIBS_FE="-lldap $EXTRA_LDAP_LIBS"
12612
+ LDAP_LIBS_BE="-lldap $EXTRA_LDAP_LIBS"
12598
12613
fi
12599
12614
for ac_func in ldap_initialize
12600
12615
do :
0 commit comments