21.5 had the same combination of lossages, both in upstream and in my
branch, so the patch for it should also be interesting to users.
Posting it. Posting the patch to 21.4 in another message.
./
2005-12-17 Ilya N. Golubev <gin(a)mo.msk.ru>
* configure.ac: Avoid inadvertent use of cached test results the
same way as did in `configure.in' for autoconf 2.13. As an
additional defense, use `$as_unset' from 2.59.
2005-12-16 Ilya N. Golubev <gin(a)mo.msk.ru>
* configure.ac: Fixed `LDAP_OPT_ON' libraries configuration
introduced in local 2004-12-20 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 source did not state precisely
under which circumstances checking for it was useful, which sort
of user code tried to link the symbol. So on 2004-12-20 dismissed
both the code and the comment without writing a cleaner
equivalent.
2004-12-20 Ilya N. Golubev <gin(a)mo.msk.ru>
* configure.in: Fix ldap libraries configuration lossage when
`-lldap -llber' links and but `-lldap' does not; the lossage was
introduced in revision 1.232. Also allow `ldap_libs' to be empty
or overridden by builder.
etc/
2005-12-16 Ilya N. Golubev <gin(a)mo.msk.ru>
* NEWS: Document fix of `LDAP_OPT_ON' libraries configuration.
2005-03-13 Ilya N. Golubev <gin(a)mo.msk.ru>
* NEWS: Document recent `configure' fixes.
--- configure.ac 2005-11-29 22:15:44.000000000 +0300
+++ configure.ac 2005-12-17 23:11:21.610953520 +0300
@@ -103,6 +103,14 @@
dnl PRINT_VAR(var var ...) prints values of shell variables
define([PRINT_VAR],[for var in patsubst([$1],[[
]+],[ ]); do eval "echo \"$var = '\$$var'\""; done])dnl
+dnl Disable cache files:
+dnl This is controversial. So is the idea behind caching test results
+dnl that it is better to be broken than to be slow. With caching as
+dnl it is currently implemented in autoconf there are too many
+dnl surprises.
+define([AC_CACHE_VAL], [
+$2
+])dnl
dnl
dnl XE_ADD_OBJS(foo.o)
define([XE_ADD_OBJS],
@@ -3403,10 +3411,12 @@
do
if test -d $freetype_include_top; then
AC_CHECKING([in ${freetype_include_top}/freetype2])
- dnl disable autoconf's fucking cache; why these fuckheads think it
- dnl is better to be broken than to be slow, I don't know!
- dnl #### there's gotta be a better-looking way to do this!!
- unset "$as_ac_Header"
+dnl Using `$as_unset' from autoconf internals as another defense
+dnl against inadvertent use of cached test results. Do not using full
+dnl `AS_UNSET': the standard autoconf caching checks for variable
+dnl being exactly unset, and setting it to any value is useless;
+dnl exporting cache variables is just never needed.
+ $as_unset "$as_ac_Header"
save_c_switch_site="$c_switch_site"
c_switch_site="$c_switch_site -I${freetype_include_top}"
AC_CHECK_HEADERS([freetype/config/ftheader.h],
@@ -3794,36 +3804,132 @@
dnl Autodetect LDAP
AC_CHECKING([for LDAP])
-ldap_libs=
test -z "$with_ldap" && { AC_CHECK_HEADER(ldap.h, ,with_ldap=no) }
test -z "$with_ldap" && { AC_CHECK_HEADER(lber.h, ,with_ldap=no) }
-if test "$with_ldap" != "no"; then
- AC_CHECK_LIB(ldap, ldap_search, with_ldap=yes)
- dnl Check for other libraries we need to link with to get the main routines.
- test "$with_ldap" != "yes" && { AC_CHECK_LIB(ldap, ldap_open, [with_ldap=yes with_ldap_lber=yes], , -llber) }
- test "$with_ldap" != "yes" && { AC_CHECK_LIB(ldap, ldap_open, [with_ldap=yes with_ldap_lber=yes with_ldap_krb=yes], , -llber -lkrb) }
- test "$with_ldap" != "yes" && { AC_CHECK_LIB(ldap, ldap_open, [with_ldap=yes with_ldap_lber=yes with_ldap_krb=yes with_ldap_des=yes], , -llber -lkrb -ldes) }
- dnl Recently, we need -lber even though the main routines are elsewhere,
- dnl because otherwise be get link errors w.r.t. ber_pvt_opt_on. So just
- dnl check for that (it's a variable not a fun but that doesn't seem to
- dnl matter in these checks) and stick in -lber if so. Can't hurt (even to
- dnl stick it in always shouldn't hurt, I don't think) ... #### Someone who
- dnl #### understands LDAP needs to fix this properly.
- test "$with_ldap_lber" != "yes" && { AC_CHECK_LIB(lber, ber_pvt_opt_on, with_ldap_lber=yes) }
+if test no != "$with_ldap";then
+ if test . != "${ldap_libs+.}";then
+ ldap_libs=
+ AC_CHECK_FUNC(ldap_open,dnl Allow it to be in generic "$LIBS"
+ [with_ldap=yes
+ test yes = "$extra_verbose" &&
+ 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
+dnl done above, because the same variable is used in all
+dnl `AC_CHECK_LIB' expansions in macro invocation below. Worse, if it
+dnl is not done, there is no portable way to compensate for this
+dnl locally since `unset' command is not supported by all shells. The
+dnl other solution would be changing `AC_CHECK_LIB' so that cache
+dnl variable name depends on the macro OTHER-LIBRARIES argument.
+dnl
+dnl See comment on `$as_unset "$as_ac_Header"'.
+ $as_unset ac_cv_lib_ldap_ldap_open
+ AC_CHECK_LIB(ldap, ldap_open,dnl
+ [with_ldap=yes],dnl
+ [ldap_needs_krb=yes ldap_other_libs="$ldap_other_libs -lkrb"
+ $as_unset ac_cv_lib_ldap_ldap_open
+ AC_CHECK_LIB(ldap, ldap_open,dnl
+ [with_ldap=yes],dnl
+ [ldap_needs_des=yes ldap_other_libs="$ldap_other_libs -ldes"
+ $as_unset ac_cv_lib_ldap_ldap_open
+ AC_CHECK_LIB(ldap, ldap_open,dnl
+ [with_ldap=yes],dnl
+ [with_ldap=no],dnl
+ $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_COMPILE_IFELSE(
+ AC_LANG_SOURCE(
+[[#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_LINK_IFELSE(
+AC_LANG_PROGRAM(
+[[#include <lber.h>
+#include <ldap.h>
+const void *const v = LDAP_OPT_ON;]],
+[[int
+main ()
+{
+ return 0;
+}]]),
+ 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_LINK_IFELSE(
+AC_LANG_PROGRAM(
+[[#include <lber.h>
+#include <ldap.h>
+const void *const v = LDAP_OPT_ON;]],
+[[int
+main ()
+{
+ return 0;
+}]]),
+ 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)
+ fi
+ if test yes = "$ldap_needs_krb";then
+ XE_PREPEND(-lkrb, ldap_libs)
+ fi
+ if test yes = "$ldap_needs_lber";then
+ XE_PREPEND(-llber, ldap_libs)
+ fi
+ XE_PREPEND(-lldap, ldap_libs)
+ fi])
+ else
+dnl Allow builder to override "$ldap_libs".
+ save_LIBS="$LIBS" LIBS="$ldap_libs $LIBS"
+ AC_CHECK_FUNC(ldap_open,dnl
+ [with_ldap=yes
+ test yes = "$extra_verbose" &&
+ echo "Setting ldap_libs to $ldap_libs"],dnl
+ [with_ldap=no])
+ LIBS="$save_LIBS"
+ fi
fi
if test "$with_ldap" = "yes"; then
AC_DEFINE(HAVE_LDAP)
- if test "$with_ldap_des" = "yes" ; then
- XE_PREPEND(-ldes, ldap_libs)
- fi
- if test "$with_ldap_krb" = "yes" ; then
- XE_PREPEND(-lkrb, ldap_libs)
- fi
- if test "$with_ldap_lber" = "yes" ; then
- XE_PREPEND(-llber, ldap_libs)
- fi
- XE_PREPEND(-lldap, ldap_libs)
- save_LIBS="$LIBS" LIBS="$LIBS $ldap_libs"
+ save_LIBS="$LIBS" LIBS="$ldap_libs $LIBS"
AC_CHECK_FUNCS(ldap_set_option ldap_get_lderrno ldap_result2error ldap_parse_result)
LIBS="$save_LIBS"
XE_APPEND(modules/ldap, MAKE_SUBDIR)
--- etc/NEWS 2005-07-18 23:35:16.000000000 +0400
+++ etc/NEWS 2005-12-16 04:48:25.265284776 +0300
@@ -36,6 +36,8 @@
-- Windows users have benefit of the full Win32 Unicode API.
-- (in process) Xft provides antialiased fonts on X11.
-- "XEmacs" used as X11 application class
+ -- Fixed ldap libraries configuration.
+ -- Fixed `LDAP_OPT_ON' libraries configuration.
** Bignum implementation.
@@ -56,6 +58,20 @@
course of the next major release, though, so you will have to migrate your
resources at some point.
+** Fixed ldap libraries configuration.
+
+It used to fail when `-lldap' requires `-llber'. Introduced in
+upstream `configure.in' revision 1.232 (2004/11/04 23:05:33 +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.5
==========================================