Skip to content

Commit 53c38a0

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 ab09679 commit 53c38a0

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
@@ -12876,22 +12876,18 @@ fi
1287612876

1287712877
fi
1287812878

12879-
# Note: We can test for libldap_r only after we know PTHREAD_LIBS
12879+
# Note: We can test for libldap_r only after we know PTHREAD_LIBS;
12880+
# also, on AIX, we may need to have openssl in LIBS for this step.
1288012881
if test "$with_ldap" = yes ; then
1288112882
_LIBS="$LIBS"
1288212883
if test "$PORTNAME" != "win32"; then
12883-
if test "$enable_thread_safety" = yes; then
12884-
# Use ldap_r for FE if available, else assume ldap is thread-safe.
12885-
# If ldap_r does exist, assume without checking that ldap does too.
12886-
# On some platforms ldap_r fails to link without PTHREAD_LIBS;
12887-
# also, on AIX we must probe ldap_simple_bind not ldap_bind.
12888-
LIBS=""
12889-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing ldap_simple_bind" >&5
12890-
$as_echo_n "checking for library containing ldap_simple_bind... " >&6; }
12891-
if ${ac_cv_search_ldap_simple_bind+:} false; then :
12884+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ldap_bind in -lldap" >&5
12885+
$as_echo_n "checking for ldap_bind in -lldap... " >&6; }
12886+
if ${ac_cv_lib_ldap_ldap_bind+:} false; then :
1289212887
$as_echo_n "(cached) " >&6
1289312888
else
12894-
ac_func_search_save_LIBS=$LIBS
12889+
ac_check_lib_save_LIBS=$LIBS
12890+
LIBS="-lldap $EXTRA_LDAP_LIBS $LIBS"
1289512891
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1289612892
/* end confdefs.h. */
1289712893

@@ -12901,59 +12897,49 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1290112897
#ifdef __cplusplus
1290212898
extern "C"
1290312899
#endif
12904-
char ldap_simple_bind ();
12900+
char ldap_bind ();
1290512901
int
1290612902
main ()
1290712903
{
12908-
return ldap_simple_bind ();
12904+
return ldap_bind ();
1290912905
;
1291012906
return 0;
1291112907
}
1291212908
_ACEOF
12913-
for ac_lib in '' ldap_r ldap; do
12914-
if test -z "$ac_lib"; then
12915-
ac_res="none required"
12916-
else
12917-
ac_res=-l$ac_lib
12918-
LIBS="-l$ac_lib $PTHREAD_CFLAGS $PTHREAD_LIBS $EXTRA_LDAP_LIBS $ac_func_search_save_LIBS"
12919-
fi
12920-
if ac_fn_c_try_link "$LINENO"; then :
12921-
ac_cv_search_ldap_simple_bind=$ac_res
12909+
if ac_fn_c_try_link "$LINENO"; then :
12910+
ac_cv_lib_ldap_ldap_bind=yes
12911+
else
12912+
ac_cv_lib_ldap_ldap_bind=no
1292212913
fi
1292312914
rm -f core conftest.err conftest.$ac_objext \
12924-
conftest$ac_exeext
12925-
if ${ac_cv_search_ldap_simple_bind+:} false; then :
12926-
break
12915+
conftest$ac_exeext conftest.$ac_ext
12916+
LIBS=$ac_check_lib_save_LIBS
1292712917
fi
12928-
done
12929-
if ${ac_cv_search_ldap_simple_bind+:} false; then :
12918+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ldap_ldap_bind" >&5
12919+
$as_echo "$ac_cv_lib_ldap_ldap_bind" >&6; }
12920+
if test "x$ac_cv_lib_ldap_ldap_bind" = xyes; then :
12921+
cat >>confdefs.h <<_ACEOF
12922+
#define HAVE_LIBLDAP 1
12923+
_ACEOF
1293012924

12931-
else
12932-
ac_cv_search_ldap_simple_bind=no
12933-
fi
12934-
rm conftest.$ac_ext
12935-
LIBS=$ac_func_search_save_LIBS
12936-
fi
12937-
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_ldap_simple_bind" >&5
12938-
$as_echo "$ac_cv_search_ldap_simple_bind" >&6; }
12939-
ac_res=$ac_cv_search_ldap_simple_bind
12940-
if test "$ac_res" != no; then :
12941-
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
12925+
LIBS="-lldap $LIBS"
1294212926

1294312927
else
1294412928
as_fn_error $? "library 'ldap' is required for LDAP" "$LINENO" 5
1294512929
fi
1294612930

12947-
LDAP_LIBS_FE="$LIBS $EXTRA_LDAP_LIBS"
12948-
LDAP_LIBS_BE="-lldap $EXTRA_LDAP_LIBS"
12949-
else
12950-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ldap_bind in -lldap" >&5
12951-
$as_echo_n "checking for ldap_bind in -lldap... " >&6; }
12952-
if ${ac_cv_lib_ldap_ldap_bind+:} false; then :
12931+
LDAP_LIBS_BE="-lldap $EXTRA_LDAP_LIBS"
12932+
if test "$enable_thread_safety" = yes; then
12933+
# Use ldap_r for FE if available, else assume ldap is thread-safe.
12934+
# On some platforms ldap_r fails to link without PTHREAD_LIBS.
12935+
LIBS="$_LIBS"
12936+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ldap_bind in -lldap_r" >&5
12937+
$as_echo_n "checking for ldap_bind in -lldap_r... " >&6; }
12938+
if ${ac_cv_lib_ldap_r_ldap_bind+:} false; then :
1295312939
$as_echo_n "(cached) " >&6
1295412940
else
1295512941
ac_check_lib_save_LIBS=$LIBS
12956-
LIBS="-lldap $EXTRA_LDAP_LIBS $LIBS"
12942+
LIBS="-lldap_r $PTHREAD_CFLAGS $PTHREAD_LIBS $EXTRA_LDAP_LIBS $LIBS"
1295712943
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1295812944
/* end confdefs.h. */
1295912945

@@ -12973,29 +12959,24 @@ return ldap_bind ();
1297312959
}
1297412960
_ACEOF
1297512961
if ac_fn_c_try_link "$LINENO"; then :
12976-
ac_cv_lib_ldap_ldap_bind=yes
12962+
ac_cv_lib_ldap_r_ldap_bind=yes
1297712963
else
12978-
ac_cv_lib_ldap_ldap_bind=no
12964+
ac_cv_lib_ldap_r_ldap_bind=no
1297912965
fi
1298012966
rm -f core conftest.err conftest.$ac_objext \
1298112967
conftest$ac_exeext conftest.$ac_ext
1298212968
LIBS=$ac_check_lib_save_LIBS
1298312969
fi
12984-
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ldap_ldap_bind" >&5
12985-
$as_echo "$ac_cv_lib_ldap_ldap_bind" >&6; }
12986-
if test "x$ac_cv_lib_ldap_ldap_bind" = xyes; then :
12987-
cat >>confdefs.h <<_ACEOF
12988-
#define HAVE_LIBLDAP 1
12989-
_ACEOF
12990-
12991-
LIBS="-lldap $LIBS"
12992-
12970+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ldap_r_ldap_bind" >&5
12971+
$as_echo "$ac_cv_lib_ldap_r_ldap_bind" >&6; }
12972+
if test "x$ac_cv_lib_ldap_r_ldap_bind" = xyes; then :
12973+
LDAP_LIBS_FE="-lldap_r $EXTRA_LDAP_LIBS"
1299312974
else
12994-
as_fn_error $? "library 'ldap' is required for LDAP" "$LINENO" 5
12975+
LDAP_LIBS_FE="-lldap $EXTRA_LDAP_LIBS"
1299512976
fi
1299612977

12978+
else
1299712979
LDAP_LIBS_FE="-lldap $EXTRA_LDAP_LIBS"
12998-
LDAP_LIBS_BE="-lldap $EXTRA_LDAP_LIBS"
1299912980
fi
1300012981
for ac_func in ldap_initialize
1300112982
do :

configure.ac

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1285,27 +1285,25 @@ if test "$with_lz4" = yes ; then
12851285
AC_CHECK_LIB(lz4, LZ4_compress_default, [], [AC_MSG_ERROR([library 'lz4' is required for LZ4 support])])
12861286
fi
12871287

1288-
# Note: We can test for libldap_r only after we know PTHREAD_LIBS
1288+
# Note: We can test for libldap_r only after we know PTHREAD_LIBS;
1289+
# also, on AIX, we may need to have openssl in LIBS for this step.
12891290
if test "$with_ldap" = yes ; then
12901291
_LIBS="$LIBS"
12911292
if test "$PORTNAME" != "win32"; then
1293+
AC_CHECK_LIB(ldap, ldap_bind, [],
1294+
[AC_MSG_ERROR([library 'ldap' is required for LDAP])],
1295+
[$EXTRA_LDAP_LIBS])
1296+
LDAP_LIBS_BE="-lldap $EXTRA_LDAP_LIBS"
12921297
if test "$enable_thread_safety" = yes; then
12931298
# Use ldap_r for FE if available, else assume ldap is thread-safe.
1294-
# If ldap_r does exist, assume without checking that ldap does too.
1295-
# On some platforms ldap_r fails to link without PTHREAD_LIBS;
1296-
# also, on AIX we must probe ldap_simple_bind not ldap_bind.
1297-
LIBS=""
1298-
AC_SEARCH_LIBS(ldap_simple_bind, [ldap_r ldap], [],
1299-
[AC_MSG_ERROR([library 'ldap' is required for LDAP])],
1300-
[$PTHREAD_CFLAGS $PTHREAD_LIBS $EXTRA_LDAP_LIBS])
1301-
LDAP_LIBS_FE="$LIBS $EXTRA_LDAP_LIBS"
1302-
LDAP_LIBS_BE="-lldap $EXTRA_LDAP_LIBS"
1299+
# On some platforms ldap_r fails to link without PTHREAD_LIBS.
1300+
LIBS="$_LIBS"
1301+
AC_CHECK_LIB(ldap_r, ldap_bind,
1302+
[LDAP_LIBS_FE="-lldap_r $EXTRA_LDAP_LIBS"],
1303+
[LDAP_LIBS_FE="-lldap $EXTRA_LDAP_LIBS"],
1304+
[$PTHREAD_CFLAGS $PTHREAD_LIBS $EXTRA_LDAP_LIBS])
13031305
else
1304-
AC_CHECK_LIB(ldap, ldap_bind, [],
1305-
[AC_MSG_ERROR([library 'ldap' is required for LDAP])],
1306-
[$EXTRA_LDAP_LIBS])
13071306
LDAP_LIBS_FE="-lldap $EXTRA_LDAP_LIBS"
1308-
LDAP_LIBS_BE="-lldap $EXTRA_LDAP_LIBS"
13091307
fi
13101308
AC_CHECK_FUNCS([ldap_initialize])
13111309
else

0 commit comments

Comments
 (0)