On Tue, 13 Dec 2005 19:20:40 +0300 I wrote:
Gimme time to write the patch.
So this is it.
2005-12-18 Ilya N. Golubev <gin(a)mo.msk.ru>
Merge from 21.5.
* configure.in: Fixed `LDAP_OPT_ON' libraries configuration
introduced in local 2005-03-13 change of `configure.in'. However,
do not check for internal `-lber' `ber_pvt_opt_on' symbol as done
in upstream. This symbol is not part of any published interface,
it may exist or not exist, depending on openldap version. Cryptic
comment before using it in upstream 21.5 source did not state
precisely under which circumstances checking for it was useful,
which sort of user code tried to link the symbol. So in local
21.5 dismissed both the code and the comment without writing a
cleaner equivalent.
* etc/NEWS: Document.
--- configure.in 2005-12-03 01:15:38.000000000 +0300
+++ configure.in 2005-12-18 00:29:31.167032632 +0300
@@ -3215,6 +3215,7 @@
echo "Setting ldap_libs to $ldap_libs"],dnl
[AC_CHECK_LIB(ldap, ldap_open,dnl
[with_ldap=yes],dnl
+dnl If logic of setting these vars change, change it the same way below.
[ldap_needs_lber=yes ldap_other_libs=-llber
dnl This requires `AC_CACHE_VAL' (which is called by `AC_CHECK_LIB')
dnl to be redefined to ignore cached (shell variable) value, as it is
@@ -3236,6 +3237,55 @@
$ldap_other_libs)],dnl
$ldap_other_libs)],dnl
$ldap_other_libs)])
+ if test yes = "$with_ldap" -a yes != "$ldap_needs_lber";then
+dnl Need this check since `LDAP_OPT_ON' is (currently) used only with
+dnl `ldap_set_option', and the latter may not exist at all, for which
+dnl is testing later. So `LDAP_OPT_ON' is not necessarily defined.
+ AC_CACHE_CHECK([for LDAP_OPT_ON definition],xe_cv_have_LDAP_OPT_ON,
+ [AC_TRY_COMPILE(
+[#include <lber.h>
+#include <ldap.h>
+#ifdef LDAP_OPT_ON
+/* Relying on const defined by ac_c_const (upper case). */
+const void *const v = LDAP_OPT_ON;
+#else /* !defined (LDAP_OPT_ON) */
+choke me
+#endif /* !defined (LDAP_OPT_ON) */],[],
+ [xe_cv_have_LDAP_OPT_ON=yes],
+ [xe_cv_have_LDAP_OPT_ON=no])])
+ if test yes = "$xe_cv_have_LDAP_OPT_ON";then
+ AC_CACHE_CHECK([LDAP_OPT_ON linking],
+ xe_cv_LDAP_OPT_ON_links,
+ [xe_save_LIBS="$LIBS"
+ LIBS="-lldap $LIBS"
+AC_TRY_LINK(
+[#include <lber.h>
+#include <ldap.h>
+const void *const v = LDAP_OPT_ON;],[],
+ xe_cv_LDAP_OPT_ON_links=yes,
+ xe_cv_LDAP_OPT_ON_links=no)
+ LIBS="$xe_save_LIBS"])
+dnl In some openldap installations other `ldap_*' functions link with
+dnl `-lldap' alone, but `LDAP_OPT_ON' requires `-llber'.
+ if test yes != "$xe_cv_LDAP_OPT_ON_links";then
+ ldap_needs_lber=yes ldap_other_libs=-llber
+ AC_CACHE_CHECK([LDAP_OPT_ON linking with -llber],
+ xe_cv_LDAP_OPT_ON_links_w_lber,
+ [xe_save_LIBS="$LIBS"
+ LIBS="-lldap $ldap_other_libs $LIBS"
+AC_TRY_LINK(
+[#include <lber.h>
+#include <ldap.h>
+const void *const v = LDAP_OPT_ON;],[],
+ xe_cv_LDAP_OPT_ON_links_w_lber=yes,
+ xe_cv_LDAP_OPT_ON_links_w_lber=no)
+ LIBS="$xe_save_LIBS"])
+ if test yes != "$xe_cv_LDAP_OPT_ON_links_w_lber";then
+ with_ldap=no
+ fi
+ fi
+ fi
+ fi
if test yes = "$with_ldap";then
if test yes = "$ldap_needs_des";then
XE_PREPEND(-ldes, ldap_libs)
--- etc/NEWS 2005-12-07 01:11:17.000000000 +0300
+++ etc/NEWS 2005-12-18 00:33:40.322155296 +0300
@@ -121,6 +121,7 @@
- Python now supported.
- New file extensions recognized: .ss, .pdb, .psw.
-- Fixed ldap libraries configuration.
+ -- Fixed `LDAP_OPT_ON' libraries configuration.
** The delete key now deletes forward by default.
@@ -608,6 +609,15 @@
It used to fail when `-lldap' requires `-llber'. Introduced in
upstream `configure.in' revision 1.151.2.31 (2005/01/31 02:54:47 +0).
+*** Fixed `LDAP_OPT_ON' libraries configuration.
+
+The original fix of local `configure.in' revision 1.19 (2004/12/19
+21:10:02 +0) introduced lossage on another class of systems. In some
+openldap versions `ldap_*' functions may link successfully without
+`-lber', but compiling and linking program with `LDAP_OPT_ON' may
+require `-lber'. When configuring ldap libraries, check for such
+systems, and in a cleaner way than in upstream.
+
* Lisp and internal changes in XEmacs 21.4
==========================================