21.5 patch posted to <xemacs-patches(a)xemacs.org> on Mon, 19 Dec 2005
12:37:58 +0300 should be updated by adding the following change.
2006-03-30
* configure.ac: Fix `LDAP_OPT_ON' linking checks that could
incorrectly fail with C compilers that do not support nested
functions, like GNU one does. Introduced in 2005-12-17 change.
Patch to current head file is as follows.
--- configure.ac 2006-03-30 00:48:57 +0400
+++ configure.ac 2006-03-30 02:50:17 +0400
@@ -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],
@@ -3443,10 +3451,12 @@
do
if test -d $freetype_include_top; then
AC_MSG_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],
@@ -3839,36 +3849,124 @@
dnl Autodetect LDAP
AC_MSG_CHECKING([for LDAP])
AC_MSG_RESULT()
-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;]],
+[[]]),
+ 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;]],
+[[]]),
+ 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)