cmake: improve OpenLDAP builds

- cmake: detect OpenLDAP based on function `ldap_init_fd`.
  autotools does this. autotools also publishes this detection result
  in `HAVE_LDAP_INIT_FD`. We don't mimic that with CMake as the source
  doesn't use this value. (it might need to be remove-listed in
  `scripts/cmp-config.pl` for future OpenLDAP test builds.)
  This also deletes existing self-declaration method via the
  CMake-specific `CURL_USE_OPENLDAP` configuration.

- cmake: define `LDAP_DEPRECATED=1` for OpenLDAP.
  Like autotools does. This fixes a long list of these warnings:
  ```
  /usr/local/opt/openldap/include/ldap.h:1049:5: warning: 'LDAP_DEPRECATED' is not defined, evaluates to 0 [-Wundef]
  ```

- cmake: delete LDAP TODO comment no longer relevant.

Also:

- autotools: replace domain name `dummy` with `0.0.0.0` in LDAP feature
  detection functions.

Ref: #11964 (effort to sync cmake detections with autotools)

Closes #12024
This commit is contained in:
Viktor Szakats 2023-10-03 18:17:37 +00:00
parent fd328fcaf1
commit 751e168d93
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
2 changed files with 9 additions and 14 deletions

View file

@ -421,7 +421,7 @@ AC_DEFUN([CURL_CHECK_HEADER_LDAP], [
#endif
#include <ldap.h>
]],[[
LDAP *ldp = ldap_init("dummy", LDAP_PORT);
LDAP *ldp = ldap_init("0.0.0.0", LDAP_PORT);
int res = ldap_unbind(ldp);
]])
],[
@ -470,7 +470,7 @@ AC_DEFUN([CURL_CHECK_HEADER_LDAP_SSL], [
#endif
#include <ldap_ssl.h>
]],[[
LDAP *ldp = ldapssl_init("dummy", LDAPS_PORT, 1);
LDAP *ldp = ldapssl_init("0.0.0.0", LDAPS_PORT, 1);
]])
],[
curl_cv_header_ldap_ssl_h="yes"
@ -547,7 +547,7 @@ AC_DEFUN([CURL_CHECK_LIBS_WINLDAP], [
]],[[
BERVAL *bvp = NULL;
BerElement *bep = ber_init(bvp);
LDAP *ldp = ldap_init("dummy", LDAP_PORT);
LDAP *ldp = ldap_init("0.0.0.0", LDAP_PORT);
ULONG res = ldap_unbind(ldp);
ber_free(bep, 1);
]])
@ -657,7 +657,7 @@ AC_DEFUN([CURL_CHECK_LIBS_LDAP], [
]],[[
BerValue *bvp = NULL;
BerElement *bep = ber_init(bvp);
LDAP *ldp = ldap_init("dummy", LDAP_PORT);
LDAP *ldp = ldap_init("0.0.0.0", LDAP_PORT);
int res = ldap_unbind(ldp);
ber_free(bep, 1);
]])