Skip to content

Commit 32d0bdb

Browse files
committed
Un-break AIX build, take 2.
I incorrectly diagnosed the reason why hoverfly is unhappy. Looking closer, it appears that it fails to link libldap unless libssl is also present; so the problem was my idea of clearing LIBS before making the check. Revert to essentially the original coding, except that instead of failing when libldap_r isn't there, use libldap. Per buildfarm member hoverfly. Discussion: https://postgr.es/m/17083-a19190d9591946a7@postgresql.org
1 parent cbcf5ff commit 32d0bdb

File tree

2 files changed

+51
-72
lines changed

2 files changed

+51
-72
lines changed

configure

Lines changed: 39 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -12491,22 +12491,18 @@ fi
1249112491

1249212492
fi
1249312493

12494-
# Note: We can test for libldap_r only after we know PTHREAD_LIBS
12494+
# Note: We can test for libldap_r only after we know PTHREAD_LIBS;
12495+
# also, on AIX, we may need to have openssl in LIBS for this step.
1249512496
if test "$with_ldap" = yes ; then
1249612497
_LIBS="$LIBS"
1249712498
if test "$PORTNAME" != "win32"; 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-
# also, on AIX we must probe ldap_simple_bind not ldap_bind.
12503-
LIBS=""
12504-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing ldap_simple_bind" >&5
12505-
$as_echo_n "checking for library containing ldap_simple_bind... " >&6; }
12506-
if ${ac_cv_search_ldap_simple_bind+:} false; then :
12499+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ldap_bind in -lldap" >&5
12500+
$as_echo_n "checking for ldap_bind in -lldap... " >&6; }
12501+
if ${ac_cv_lib_ldap_ldap_bind+:} false; then :
1250712502
$as_echo_n "(cached) " >&6
1250812503
else
12509-
ac_func_search_save_LIBS=$LIBS
12504+
ac_check_lib_save_LIBS=$LIBS
12505+
LIBS="-lldap $EXTRA_LDAP_LIBS $LIBS"
1251012506
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1251112507
/* end confdefs.h. */
1251212508

@@ -12516,59 +12512,49 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1251612512
#ifdef __cplusplus
1251712513
extern "C"
1251812514
#endif
12519-
char ldap_simple_bind ();
12515+
char ldap_bind ();
1252012516
int
1252112517
main ()
1252212518
{
12523-
return ldap_simple_bind ();
12519+
return ldap_bind ();
1252412520
;
1252512521
return 0;
1252612522
}
1252712523
_ACEOF
12528-
for ac_lib in '' ldap_r ldap; do
12529-
if test -z "$ac_lib"; then
12530-
ac_res="none required"
12531-
else
12532-
ac_res=-l$ac_lib
12533-
LIBS="-l$ac_lib $PTHREAD_CFLAGS $PTHREAD_LIBS $EXTRA_LDAP_LIBS $ac_func_search_save_LIBS"
12534-
fi
12535-
if ac_fn_c_try_link "$LINENO"; then :
12536-
ac_cv_search_ldap_simple_bind=$ac_res
12524+
if ac_fn_c_try_link "$LINENO"; then :
12525+
ac_cv_lib_ldap_ldap_bind=yes
12526+
else
12527+
ac_cv_lib_ldap_ldap_bind=no
1253712528
fi
1253812529
rm -f core conftest.err conftest.$ac_objext \
12539-
conftest$ac_exeext
12540-
if ${ac_cv_search_ldap_simple_bind+:} false; then :
12541-
break
12530+
conftest$ac_exeext conftest.$ac_ext
12531+
LIBS=$ac_check_lib_save_LIBS
1254212532
fi
12543-
done
12544-
if ${ac_cv_search_ldap_simple_bind+:} false; then :
12533+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ldap_ldap_bind" >&5
12534+
$as_echo "$ac_cv_lib_ldap_ldap_bind" >&6; }
12535+
if test "x$ac_cv_lib_ldap_ldap_bind" = xyes; then :
12536+
cat >>confdefs.h <<_ACEOF
12537+
#define HAVE_LIBLDAP 1
12538+
_ACEOF
1254512539

12546-
else
12547-
ac_cv_search_ldap_simple_bind=no
12548-
fi
12549-
rm conftest.$ac_ext
12550-
LIBS=$ac_func_search_save_LIBS
12551-
fi
12552-
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_ldap_simple_bind" >&5
12553-
$as_echo "$ac_cv_search_ldap_simple_bind" >&6; }
12554-
ac_res=$ac_cv_search_ldap_simple_bind
12555-
if test "$ac_res" != no; then :
12556-
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
12540+
LIBS="-lldap $LIBS"
1255712541

1255812542
else
1255912543
as_fn_error $? "library 'ldap' is required for LDAP" "$LINENO" 5
1256012544
fi
1256112545

12562-
LDAP_LIBS_FE="$LIBS $EXTRA_LDAP_LIBS"
12563-
LDAP_LIBS_BE="-lldap $EXTRA_LDAP_LIBS"
12564-
else
12565-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ldap_bind in -lldap" >&5
12566-
$as_echo_n "checking for ldap_bind in -lldap... " >&6; }
12567-
if ${ac_cv_lib_ldap_ldap_bind+:} false; then :
12546+
LDAP_LIBS_BE="-lldap $EXTRA_LDAP_LIBS"
12547+
if test "$enable_thread_safety" = yes; then
12548+
# Use ldap_r for FE if available, else assume ldap is thread-safe.
12549+
# On some platforms ldap_r fails to link without PTHREAD_LIBS.
12550+
LIBS="$_LIBS"
12551+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ldap_bind in -lldap_r" >&5
12552+
$as_echo_n "checking for ldap_bind in -lldap_r... " >&6; }
12553+
if ${ac_cv_lib_ldap_r_ldap_bind+:} false; then :
1256812554
$as_echo_n "(cached) " >&6
1256912555
else
1257012556
ac_check_lib_save_LIBS=$LIBS
12571-
LIBS="-lldap $EXTRA_LDAP_LIBS $LIBS"
12557+
LIBS="-lldap_r $PTHREAD_CFLAGS $PTHREAD_LIBS $EXTRA_LDAP_LIBS $LIBS"
1257212558
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1257312559
/* end confdefs.h. */
1257412560

@@ -12588,29 +12574,24 @@ return ldap_bind ();
1258812574
}
1258912575
_ACEOF
1259012576
if ac_fn_c_try_link "$LINENO"; then :
12591-
ac_cv_lib_ldap_ldap_bind=yes
12577+
ac_cv_lib_ldap_r_ldap_bind=yes
1259212578
else
12593-
ac_cv_lib_ldap_ldap_bind=no
12579+
ac_cv_lib_ldap_r_ldap_bind=no
1259412580
fi
1259512581
rm -f core conftest.err conftest.$ac_objext \
1259612582
conftest$ac_exeext conftest.$ac_ext
1259712583
LIBS=$ac_check_lib_save_LIBS
1259812584
fi
12599-
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ldap_ldap_bind" >&5
12600-
$as_echo "$ac_cv_lib_ldap_ldap_bind" >&6; }
12601-
if test "x$ac_cv_lib_ldap_ldap_bind" = xyes; then :
12602-
cat >>confdefs.h <<_ACEOF
12603-
#define HAVE_LIBLDAP 1
12604-
_ACEOF
12605-
12606-
LIBS="-lldap $LIBS"
12607-
12585+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ldap_r_ldap_bind" >&5
12586+
$as_echo "$ac_cv_lib_ldap_r_ldap_bind" >&6; }
12587+
if test "x$ac_cv_lib_ldap_r_ldap_bind" = xyes; then :
12588+
LDAP_LIBS_FE="-lldap_r $EXTRA_LDAP_LIBS"
1260812589
else
12609-
as_fn_error $? "library 'ldap' is required for LDAP" "$LINENO" 5
12590+
LDAP_LIBS_FE="-lldap $EXTRA_LDAP_LIBS"
1261012591
fi
1261112592

12593+
else
1261212594
LDAP_LIBS_FE="-lldap $EXTRA_LDAP_LIBS"
12613-
LDAP_LIBS_BE="-lldap $EXTRA_LDAP_LIBS"
1261412595
fi
1261512596
for ac_func in ldap_initialize
1261612597
do :

configure.in

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1237,27 +1237,25 @@ if test "$with_libxslt" = yes ; then
12371237
AC_CHECK_LIB(xslt, xsltCleanupGlobals, [], [AC_MSG_ERROR([library 'xslt' is required for XSLT support])])
12381238
fi
12391239

1240-
# Note: We can test for libldap_r only after we know PTHREAD_LIBS
1240+
# Note: We can test for libldap_r only after we know PTHREAD_LIBS;
1241+
# also, on AIX, we may need to have openssl in LIBS for this step.
12411242
if test "$with_ldap" = yes ; then
12421243
_LIBS="$LIBS"
12431244
if test "$PORTNAME" != "win32"; then
1245+
AC_CHECK_LIB(ldap, ldap_bind, [],
1246+
[AC_MSG_ERROR([library 'ldap' is required for LDAP])],
1247+
[$EXTRA_LDAP_LIBS])
1248+
LDAP_LIBS_BE="-lldap $EXTRA_LDAP_LIBS"
12441249
if test "$enable_thread_safety" = yes; then
12451250
# Use ldap_r for FE if available, else assume ldap is thread-safe.
1246-
# If ldap_r does exist, assume without checking that ldap does too.
1247-
# On some platforms ldap_r fails to link without PTHREAD_LIBS;
1248-
# also, on AIX we must probe ldap_simple_bind not ldap_bind.
1249-
LIBS=""
1250-
AC_SEARCH_LIBS(ldap_simple_bind, [ldap_r ldap], [],
1251-
[AC_MSG_ERROR([library 'ldap' is required for LDAP])],
1252-
[$PTHREAD_CFLAGS $PTHREAD_LIBS $EXTRA_LDAP_LIBS])
1253-
LDAP_LIBS_FE="$LIBS $EXTRA_LDAP_LIBS"
1254-
LDAP_LIBS_BE="-lldap $EXTRA_LDAP_LIBS"
1251+
# On some platforms ldap_r fails to link without PTHREAD_LIBS.
1252+
LIBS="$_LIBS"
1253+
AC_CHECK_LIB(ldap_r, ldap_bind,
1254+
[LDAP_LIBS_FE="-lldap_r $EXTRA_LDAP_LIBS"],
1255+
[LDAP_LIBS_FE="-lldap $EXTRA_LDAP_LIBS"],
1256+
[$PTHREAD_CFLAGS $PTHREAD_LIBS $EXTRA_LDAP_LIBS])
12551257
else
1256-
AC_CHECK_LIB(ldap, ldap_bind, [],
1257-
[AC_MSG_ERROR([library 'ldap' is required for LDAP])],
1258-
[$EXTRA_LDAP_LIBS])
12591258
LDAP_LIBS_FE="-lldap $EXTRA_LDAP_LIBS"
1260-
LDAP_LIBS_BE="-lldap $EXTRA_LDAP_LIBS"
12611259
fi
12621260
AC_CHECK_FUNCS([ldap_initialize])
12631261
else

0 commit comments

Comments
 (0)