Skip to content

Commit 2c28c68

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 29a4fbd commit 2c28c68

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
@@ -12114,22 +12114,18 @@ fi
1211412114

1211512115
fi
1211612116

12117-
# Note: We can test for libldap_r only after we know PTHREAD_LIBS
12117+
# Note: We can test for libldap_r only after we know PTHREAD_LIBS;
12118+
# also, on AIX, we may need to have openssl in LIBS for this step.
1211812119
if test "$with_ldap" = yes ; then
1211912120
_LIBS="$LIBS"
1212012121
if test "$PORTNAME" != "win32"; 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-
# also, on AIX we must probe ldap_simple_bind not ldap_bind.
12126-
LIBS=""
12127-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing ldap_simple_bind" >&5
12128-
$as_echo_n "checking for library containing ldap_simple_bind... " >&6; }
12129-
if ${ac_cv_search_ldap_simple_bind+:} false; then :
12122+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ldap_bind in -lldap" >&5
12123+
$as_echo_n "checking for ldap_bind in -lldap... " >&6; }
12124+
if ${ac_cv_lib_ldap_ldap_bind+:} false; then :
1213012125
$as_echo_n "(cached) " >&6
1213112126
else
12132-
ac_func_search_save_LIBS=$LIBS
12127+
ac_check_lib_save_LIBS=$LIBS
12128+
LIBS="-lldap $EXTRA_LDAP_LIBS $LIBS"
1213312129
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1213412130
/* end confdefs.h. */
1213512131

@@ -12139,59 +12135,49 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1213912135
#ifdef __cplusplus
1214012136
extern "C"
1214112137
#endif
12142-
char ldap_simple_bind ();
12138+
char ldap_bind ();
1214312139
int
1214412140
main ()
1214512141
{
12146-
return ldap_simple_bind ();
12142+
return ldap_bind ();
1214712143
;
1214812144
return 0;
1214912145
}
1215012146
_ACEOF
12151-
for ac_lib in '' ldap_r ldap; do
12152-
if test -z "$ac_lib"; then
12153-
ac_res="none required"
12154-
else
12155-
ac_res=-l$ac_lib
12156-
LIBS="-l$ac_lib $PTHREAD_CFLAGS $PTHREAD_LIBS $EXTRA_LDAP_LIBS $ac_func_search_save_LIBS"
12157-
fi
12158-
if ac_fn_c_try_link "$LINENO"; then :
12159-
ac_cv_search_ldap_simple_bind=$ac_res
12147+
if ac_fn_c_try_link "$LINENO"; then :
12148+
ac_cv_lib_ldap_ldap_bind=yes
12149+
else
12150+
ac_cv_lib_ldap_ldap_bind=no
1216012151
fi
1216112152
rm -f core conftest.err conftest.$ac_objext \
12162-
conftest$ac_exeext
12163-
if ${ac_cv_search_ldap_simple_bind+:} false; then :
12164-
break
12153+
conftest$ac_exeext conftest.$ac_ext
12154+
LIBS=$ac_check_lib_save_LIBS
1216512155
fi
12166-
done
12167-
if ${ac_cv_search_ldap_simple_bind+:} false; then :
12156+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ldap_ldap_bind" >&5
12157+
$as_echo "$ac_cv_lib_ldap_ldap_bind" >&6; }
12158+
if test "x$ac_cv_lib_ldap_ldap_bind" = xyes; then :
12159+
cat >>confdefs.h <<_ACEOF
12160+
#define HAVE_LIBLDAP 1
12161+
_ACEOF
1216812162

12169-
else
12170-
ac_cv_search_ldap_simple_bind=no
12171-
fi
12172-
rm conftest.$ac_ext
12173-
LIBS=$ac_func_search_save_LIBS
12174-
fi
12175-
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_ldap_simple_bind" >&5
12176-
$as_echo "$ac_cv_search_ldap_simple_bind" >&6; }
12177-
ac_res=$ac_cv_search_ldap_simple_bind
12178-
if test "$ac_res" != no; then :
12179-
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
12163+
LIBS="-lldap $LIBS"
1218012164

1218112165
else
1218212166
as_fn_error $? "library 'ldap' is required for LDAP" "$LINENO" 5
1218312167
fi
1218412168

12185-
LDAP_LIBS_FE="$LIBS $EXTRA_LDAP_LIBS"
12186-
LDAP_LIBS_BE="-lldap $EXTRA_LDAP_LIBS"
12187-
else
12188-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ldap_bind in -lldap" >&5
12189-
$as_echo_n "checking for ldap_bind in -lldap... " >&6; }
12190-
if ${ac_cv_lib_ldap_ldap_bind+:} false; then :
12169+
LDAP_LIBS_BE="-lldap $EXTRA_LDAP_LIBS"
12170+
if test "$enable_thread_safety" = yes; then
12171+
# Use ldap_r for FE if available, else assume ldap is thread-safe.
12172+
# On some platforms ldap_r fails to link without PTHREAD_LIBS.
12173+
LIBS="$_LIBS"
12174+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ldap_bind in -lldap_r" >&5
12175+
$as_echo_n "checking for ldap_bind in -lldap_r... " >&6; }
12176+
if ${ac_cv_lib_ldap_r_ldap_bind+:} false; then :
1219112177
$as_echo_n "(cached) " >&6
1219212178
else
1219312179
ac_check_lib_save_LIBS=$LIBS
12194-
LIBS="-lldap $EXTRA_LDAP_LIBS $LIBS"
12180+
LIBS="-lldap_r $PTHREAD_CFLAGS $PTHREAD_LIBS $EXTRA_LDAP_LIBS $LIBS"
1219512181
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1219612182
/* end confdefs.h. */
1219712183

@@ -12211,29 +12197,24 @@ return ldap_bind ();
1221112197
}
1221212198
_ACEOF
1221312199
if ac_fn_c_try_link "$LINENO"; then :
12214-
ac_cv_lib_ldap_ldap_bind=yes
12200+
ac_cv_lib_ldap_r_ldap_bind=yes
1221512201
else
12216-
ac_cv_lib_ldap_ldap_bind=no
12202+
ac_cv_lib_ldap_r_ldap_bind=no
1221712203
fi
1221812204
rm -f core conftest.err conftest.$ac_objext \
1221912205
conftest$ac_exeext conftest.$ac_ext
1222012206
LIBS=$ac_check_lib_save_LIBS
1222112207
fi
12222-
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ldap_ldap_bind" >&5
12223-
$as_echo "$ac_cv_lib_ldap_ldap_bind" >&6; }
12224-
if test "x$ac_cv_lib_ldap_ldap_bind" = xyes; then :
12225-
cat >>confdefs.h <<_ACEOF
12226-
#define HAVE_LIBLDAP 1
12227-
_ACEOF
12228-
12229-
LIBS="-lldap $LIBS"
12230-
12208+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ldap_r_ldap_bind" >&5
12209+
$as_echo "$ac_cv_lib_ldap_r_ldap_bind" >&6; }
12210+
if test "x$ac_cv_lib_ldap_r_ldap_bind" = xyes; then :
12211+
LDAP_LIBS_FE="-lldap_r $EXTRA_LDAP_LIBS"
1223112212
else
12232-
as_fn_error $? "library 'ldap' is required for LDAP" "$LINENO" 5
12213+
LDAP_LIBS_FE="-lldap $EXTRA_LDAP_LIBS"
1223312214
fi
1223412215

12216+
else
1223512217
LDAP_LIBS_FE="-lldap $EXTRA_LDAP_LIBS"
12236-
LDAP_LIBS_BE="-lldap $EXTRA_LDAP_LIBS"
1223712218
fi
1223812219
for ac_func in ldap_initialize
1223912220
do :

configure.in

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

1264-
# Note: We can test for libldap_r only after we know PTHREAD_LIBS
1264+
# Note: We can test for libldap_r only after we know PTHREAD_LIBS;
1265+
# also, on AIX, we may need to have openssl in LIBS for this step.
12651266
if test "$with_ldap" = yes ; then
12661267
_LIBS="$LIBS"
12671268
if test "$PORTNAME" != "win32"; then
1269+
AC_CHECK_LIB(ldap, ldap_bind, [],
1270+
[AC_MSG_ERROR([library 'ldap' is required for LDAP])],
1271+
[$EXTRA_LDAP_LIBS])
1272+
LDAP_LIBS_BE="-lldap $EXTRA_LDAP_LIBS"
12681273
if test "$enable_thread_safety" = yes; then
12691274
# Use ldap_r for FE if available, else assume ldap is thread-safe.
1270-
# If ldap_r does exist, assume without checking that ldap does too.
1271-
# On some platforms ldap_r fails to link without PTHREAD_LIBS;
1272-
# also, on AIX we must probe ldap_simple_bind not ldap_bind.
1273-
LIBS=""
1274-
AC_SEARCH_LIBS(ldap_simple_bind, [ldap_r ldap], [],
1275-
[AC_MSG_ERROR([library 'ldap' is required for LDAP])],
1276-
[$PTHREAD_CFLAGS $PTHREAD_LIBS $EXTRA_LDAP_LIBS])
1277-
LDAP_LIBS_FE="$LIBS $EXTRA_LDAP_LIBS"
1278-
LDAP_LIBS_BE="-lldap $EXTRA_LDAP_LIBS"
1275+
# On some platforms ldap_r fails to link without PTHREAD_LIBS.
1276+
LIBS="$_LIBS"
1277+
AC_CHECK_LIB(ldap_r, ldap_bind,
1278+
[LDAP_LIBS_FE="-lldap_r $EXTRA_LDAP_LIBS"],
1279+
[LDAP_LIBS_FE="-lldap $EXTRA_LDAP_LIBS"],
1280+
[$PTHREAD_CFLAGS $PTHREAD_LIBS $EXTRA_LDAP_LIBS])
12791281
else
1280-
AC_CHECK_LIB(ldap, ldap_bind, [],
1281-
[AC_MSG_ERROR([library 'ldap' is required for LDAP])],
1282-
[$EXTRA_LDAP_LIBS])
12831282
LDAP_LIBS_FE="-lldap $EXTRA_LDAP_LIBS"
1284-
LDAP_LIBS_BE="-lldap $EXTRA_LDAP_LIBS"
12851283
fi
12861284
AC_CHECK_FUNCS([ldap_initialize])
12871285
else

0 commit comments

Comments
 (0)