Skip to content

Commit e82cde7

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 83a8bf2 commit e82cde7

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
@@ -12456,22 +12456,18 @@ fi
1245612456

1245712457
fi
1245812458

12459-
# Note: We can test for libldap_r only after we know PTHREAD_LIBS
12459+
# Note: We can test for libldap_r only after we know PTHREAD_LIBS;
12460+
# also, on AIX, we may need to have openssl in LIBS for this step.
1246012461
if test "$with_ldap" = yes ; then
1246112462
_LIBS="$LIBS"
1246212463
if test "$PORTNAME" != "win32"; then
12463-
if test "$enable_thread_safety" = yes; then
12464-
# Use ldap_r for FE if available, else assume ldap is thread-safe.
12465-
# If ldap_r does exist, assume without checking that ldap does too.
12466-
# On some platforms ldap_r fails to link without PTHREAD_LIBS;
12467-
# also, on AIX we must probe ldap_simple_bind not ldap_bind.
12468-
LIBS=""
12469-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing ldap_simple_bind" >&5
12470-
$as_echo_n "checking for library containing ldap_simple_bind... " >&6; }
12471-
if ${ac_cv_search_ldap_simple_bind+:} false; then :
12464+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ldap_bind in -lldap" >&5
12465+
$as_echo_n "checking for ldap_bind in -lldap... " >&6; }
12466+
if ${ac_cv_lib_ldap_ldap_bind+:} false; then :
1247212467
$as_echo_n "(cached) " >&6
1247312468
else
12474-
ac_func_search_save_LIBS=$LIBS
12469+
ac_check_lib_save_LIBS=$LIBS
12470+
LIBS="-lldap $EXTRA_LDAP_LIBS $LIBS"
1247512471
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1247612472
/* end confdefs.h. */
1247712473

@@ -12481,59 +12477,49 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1248112477
#ifdef __cplusplus
1248212478
extern "C"
1248312479
#endif
12484-
char ldap_simple_bind ();
12480+
char ldap_bind ();
1248512481
int
1248612482
main ()
1248712483
{
12488-
return ldap_simple_bind ();
12484+
return ldap_bind ();
1248912485
;
1249012486
return 0;
1249112487
}
1249212488
_ACEOF
12493-
for ac_lib in '' ldap_r ldap; do
12494-
if test -z "$ac_lib"; then
12495-
ac_res="none required"
12496-
else
12497-
ac_res=-l$ac_lib
12498-
LIBS="-l$ac_lib $PTHREAD_CFLAGS $PTHREAD_LIBS $EXTRA_LDAP_LIBS $ac_func_search_save_LIBS"
12499-
fi
12500-
if ac_fn_c_try_link "$LINENO"; then :
12501-
ac_cv_search_ldap_simple_bind=$ac_res
12489+
if ac_fn_c_try_link "$LINENO"; then :
12490+
ac_cv_lib_ldap_ldap_bind=yes
12491+
else
12492+
ac_cv_lib_ldap_ldap_bind=no
1250212493
fi
1250312494
rm -f core conftest.err conftest.$ac_objext \
12504-
conftest$ac_exeext
12505-
if ${ac_cv_search_ldap_simple_bind+:} false; then :
12506-
break
12495+
conftest$ac_exeext conftest.$ac_ext
12496+
LIBS=$ac_check_lib_save_LIBS
1250712497
fi
12508-
done
12509-
if ${ac_cv_search_ldap_simple_bind+:} false; then :
12498+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ldap_ldap_bind" >&5
12499+
$as_echo "$ac_cv_lib_ldap_ldap_bind" >&6; }
12500+
if test "x$ac_cv_lib_ldap_ldap_bind" = xyes; then :
12501+
cat >>confdefs.h <<_ACEOF
12502+
#define HAVE_LIBLDAP 1
12503+
_ACEOF
1251012504

12511-
else
12512-
ac_cv_search_ldap_simple_bind=no
12513-
fi
12514-
rm conftest.$ac_ext
12515-
LIBS=$ac_func_search_save_LIBS
12516-
fi
12517-
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_ldap_simple_bind" >&5
12518-
$as_echo "$ac_cv_search_ldap_simple_bind" >&6; }
12519-
ac_res=$ac_cv_search_ldap_simple_bind
12520-
if test "$ac_res" != no; then :
12521-
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
12505+
LIBS="-lldap $LIBS"
1252212506

1252312507
else
1252412508
as_fn_error $? "library 'ldap' is required for LDAP" "$LINENO" 5
1252512509
fi
1252612510

12527-
LDAP_LIBS_FE="$LIBS $EXTRA_LDAP_LIBS"
12528-
LDAP_LIBS_BE="-lldap $EXTRA_LDAP_LIBS"
12529-
else
12530-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ldap_bind in -lldap" >&5
12531-
$as_echo_n "checking for ldap_bind in -lldap... " >&6; }
12532-
if ${ac_cv_lib_ldap_ldap_bind+:} false; then :
12511+
LDAP_LIBS_BE="-lldap $EXTRA_LDAP_LIBS"
12512+
if test "$enable_thread_safety" = yes; then
12513+
# Use ldap_r for FE if available, else assume ldap is thread-safe.
12514+
# On some platforms ldap_r fails to link without PTHREAD_LIBS.
12515+
LIBS="$_LIBS"
12516+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ldap_bind in -lldap_r" >&5
12517+
$as_echo_n "checking for ldap_bind in -lldap_r... " >&6; }
12518+
if ${ac_cv_lib_ldap_r_ldap_bind+:} false; then :
1253312519
$as_echo_n "(cached) " >&6
1253412520
else
1253512521
ac_check_lib_save_LIBS=$LIBS
12536-
LIBS="-lldap $EXTRA_LDAP_LIBS $LIBS"
12522+
LIBS="-lldap_r $PTHREAD_CFLAGS $PTHREAD_LIBS $EXTRA_LDAP_LIBS $LIBS"
1253712523
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1253812524
/* end confdefs.h. */
1253912525

@@ -12553,29 +12539,24 @@ return ldap_bind ();
1255312539
}
1255412540
_ACEOF
1255512541
if ac_fn_c_try_link "$LINENO"; then :
12556-
ac_cv_lib_ldap_ldap_bind=yes
12542+
ac_cv_lib_ldap_r_ldap_bind=yes
1255712543
else
12558-
ac_cv_lib_ldap_ldap_bind=no
12544+
ac_cv_lib_ldap_r_ldap_bind=no
1255912545
fi
1256012546
rm -f core conftest.err conftest.$ac_objext \
1256112547
conftest$ac_exeext conftest.$ac_ext
1256212548
LIBS=$ac_check_lib_save_LIBS
1256312549
fi
12564-
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ldap_ldap_bind" >&5
12565-
$as_echo "$ac_cv_lib_ldap_ldap_bind" >&6; }
12566-
if test "x$ac_cv_lib_ldap_ldap_bind" = xyes; then :
12567-
cat >>confdefs.h <<_ACEOF
12568-
#define HAVE_LIBLDAP 1
12569-
_ACEOF
12570-
12571-
LIBS="-lldap $LIBS"
12572-
12550+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ldap_r_ldap_bind" >&5
12551+
$as_echo "$ac_cv_lib_ldap_r_ldap_bind" >&6; }
12552+
if test "x$ac_cv_lib_ldap_r_ldap_bind" = xyes; then :
12553+
LDAP_LIBS_FE="-lldap_r $EXTRA_LDAP_LIBS"
1257312554
else
12574-
as_fn_error $? "library 'ldap' is required for LDAP" "$LINENO" 5
12555+
LDAP_LIBS_FE="-lldap $EXTRA_LDAP_LIBS"
1257512556
fi
1257612557

12558+
else
1257712559
LDAP_LIBS_FE="-lldap $EXTRA_LDAP_LIBS"
12578-
LDAP_LIBS_BE="-lldap $EXTRA_LDAP_LIBS"
1257912560
fi
1258012561
for ac_func in ldap_initialize
1258112562
do :

configure.in

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

1269-
# Note: We can test for libldap_r only after we know PTHREAD_LIBS
1269+
# Note: We can test for libldap_r only after we know PTHREAD_LIBS;
1270+
# also, on AIX, we may need to have openssl in LIBS for this step.
12701271
if test "$with_ldap" = yes ; then
12711272
_LIBS="$LIBS"
12721273
if test "$PORTNAME" != "win32"; then
1274+
AC_CHECK_LIB(ldap, ldap_bind, [],
1275+
[AC_MSG_ERROR([library 'ldap' is required for LDAP])],
1276+
[$EXTRA_LDAP_LIBS])
1277+
LDAP_LIBS_BE="-lldap $EXTRA_LDAP_LIBS"
12731278
if test "$enable_thread_safety" = yes; then
12741279
# Use ldap_r for FE if available, else assume ldap is thread-safe.
1275-
# If ldap_r does exist, assume without checking that ldap does too.
1276-
# On some platforms ldap_r fails to link without PTHREAD_LIBS;
1277-
# also, on AIX we must probe ldap_simple_bind not ldap_bind.
1278-
LIBS=""
1279-
AC_SEARCH_LIBS(ldap_simple_bind, [ldap_r ldap], [],
1280-
[AC_MSG_ERROR([library 'ldap' is required for LDAP])],
1281-
[$PTHREAD_CFLAGS $PTHREAD_LIBS $EXTRA_LDAP_LIBS])
1282-
LDAP_LIBS_FE="$LIBS $EXTRA_LDAP_LIBS"
1283-
LDAP_LIBS_BE="-lldap $EXTRA_LDAP_LIBS"
1280+
# On some platforms ldap_r fails to link without PTHREAD_LIBS.
1281+
LIBS="$_LIBS"
1282+
AC_CHECK_LIB(ldap_r, ldap_bind,
1283+
[LDAP_LIBS_FE="-lldap_r $EXTRA_LDAP_LIBS"],
1284+
[LDAP_LIBS_FE="-lldap $EXTRA_LDAP_LIBS"],
1285+
[$PTHREAD_CFLAGS $PTHREAD_LIBS $EXTRA_LDAP_LIBS])
12841286
else
1285-
AC_CHECK_LIB(ldap, ldap_bind, [],
1286-
[AC_MSG_ERROR([library 'ldap' is required for LDAP])],
1287-
[$EXTRA_LDAP_LIBS])
12881287
LDAP_LIBS_FE="-lldap $EXTRA_LDAP_LIBS"
1289-
LDAP_LIBS_BE="-lldap $EXTRA_LDAP_LIBS"
12901288
fi
12911289
AC_CHECK_FUNCS([ldap_initialize])
12921290
else

0 commit comments

Comments
 (0)