With Ubuntu's packaging of OpenLDAP 2.4.9 and whatever OpenLDAP is in Leopard.latest, LDAP_OPT_REFHOPLIMIT is defined in ldap.h but the library returns an error when trying to set it to 5 (httpd LDAP's default value).  This is apparently a wide-spread issue (http://article.gmane.org/gmane.network.openldap.devel/3619).

The intent in apr_ldap_set_option() is apparently to ignore lack of support for LDAP_OPT_REFHOPLIMIT, but that is implemented with this compile-time check:

#if !defined(LDAP_OPT_REFHOPLIMIT) || APR_HAS_NOVELL_LDAPSDK

How to handle...  Ignore failures and return success if LDAP_OPT_REFHOPLIMIT defined but the set fails?

(As an aside, this busts httpd trunk's LDAP auth with these libraries until you set LDAPReferrals Off.)