On Sun, 2008-06-15 at 13:08 +0200, Ruediger Pluem wrote:

> Another issue I have mentioned before:
> 
> APR-UTIL fails to compile on Red Hat AS 3 with ldap turned on as the OpenLDAP
> API seems to have changed between 2.0.x and 2.2.x:
> ldap/apr_ldap_rebind.c: In function `apr_ldap_rebind_set_callback':
> ldap/apr_ldap_rebind.c:289: warning: passing arg 2 of `ldap_set_rebind_proc' 
> from incompatible pointer type
> ldap/apr_ldap_rebind.c:289: too many arguments to function 
> `ldap_set_rebind_proc'
> make[1]: *** [ldap/apr_ldap_rebind.lo] Error 1
> make: *** [all-recursive] Error 1
> 
> IMHO it should be checked during configure time if ldap_set_rebind_proc is 
> usable.

Does this help?

-- 
Bojan
Index: ldap/apr_ldap_rebind.c
===================================================================
--- ldap/apr_ldap_rebind.c	(revision 667454)
+++ ldap/apr_ldap_rebind.c	(working copy)
@@ -286,7 +286,11 @@
 
 static int apr_ldap_rebind_set_callback(LDAP *ld)
 {
+#if defined(LDAP_SET_REBIND_PROC_THREE)
     ldap_set_rebind_proc(ld, LDAP_rebindproc, NULL);
+#else
+    ldap_set_rebind_proc(ld, LDAP_rebindproc);
+#endif
     return APR_SUCCESS;
 }
 
Index: build/apu-conf.m4
===================================================================
--- build/apu-conf.m4	(revision 667454)
+++ build/apu-conf.m4	(working copy)
@@ -356,6 +356,26 @@
     LIBS=$save_libs
   ])
 
+if test "$apu_has_ldap" = "1"; then
+    AC_CACHE_CHECK([style of ldap_set_rebind_proc routine], ac_cv_ldap_set_rebind_proc_style,
+    APR_TRY_COMPILE_NO_WARNING([
+    #ifdef HAVE_LBER_H
+    #include <lber.h>
+    #endif
+    #ifdef HAVE_LDAP_H
+    #include <ldap.h>
+    #endif
+    ], [
+    int tmp = ldap_set_rebind_proc((LDAP *)0, (LDAP_REBIND_PROC *)0, (void *)0);
+    /* use tmp to suppress the warning */
+    tmp=0;
+    ], ac_cv_ldap_set_rebind_proc_style=three, ac_cv_ldap_set_rebind_proc_style=two))
+
+    if test "$ac_cv_ldap_set_rebind_proc_style" = "three"; then
+        AC_DEFINE(LDAP_SET_REBIND_PROC_THREE, 1, [Define if ldap_set_rebind_proc takes three arguments])
+    fi
+fi
+
 AC_SUBST(ldap_h)
 AC_SUBST(lber_h)
 AC_SUBST(ldap_ssl_h)

Reply via email to