From: Alex Rousskov Date: Sun, 16 Oct 2022 21:59:28 +0000 (+0000) Subject: Fix ./configure detection of various LDAP functions (#1163) X-Git-Tag: SQUID_6_0_1~88 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=959f72e0c1844f68ecfe9e74fab5dc965a11b4c5;p=thirdparty%2Fsquid.git Fix ./configure detection of various LDAP functions (#1163) Commit 0d57ed2 started using $LIBLDAP_LIBS as AC_CHECK_LIB() argument, but that does not work because AC_CHECK_LIB() expects a library name (X) rather than a linker option (-lX). The macro adds a "-l" prefix itself: checking for ldap_url_desc2str in -l-lldap -llber... no checking for ldap_url_parse in -l-lldap -llber... no checking for ldap_start_tls_s in -l-lldap -llber... no --- diff --git a/acinclude/ldap.m4 b/acinclude/ldap.m4 index 88cfd119e9..36b5b73bd2 100644 --- a/acinclude/ldap.m4 +++ b/acinclude/ldap.m4 @@ -85,13 +85,18 @@ AC_DEFUN([SQUID_CHECK_LDAP_API],[ AC_CHECK_LIB(ldap,[ldapssl_client_init],[ AC_DEFINE(HAVE_LDAPSSL_CLIENT_INIT,1,[Define to 1 if you have ldapssl_client_init]) ]) - AC_CHECK_LIB($LIBLDAP_LIBS,[ldap_url_desc2str],[ + dnl Extract library names for AC_SEARCH_LIBS() to iterate. + LIBLDAP_NAMES="`echo "$LIBLDAP_LIBS" | sed -e 's/-l//g'`" + dnl If a AC_SEARCH_LIBS() finds a required library X then subsequent calls + dnl may produce a misleading "none required" result for the same library X + dnl because the first successful search adds -lX to LIBS. + AC_SEARCH_LIBS([ldap_url_desc2str],[$LIBLDAP_NAMES],[ AC_DEFINE(HAVE_LDAP_URL_DESC2STR,1,[Define to 1 if you have ldap_url_desc2str]) ]) - AC_CHECK_LIB($LIBLDAP_LIBS,[ldap_url_parse],[ + AC_SEARCH_LIBS([ldap_url_parse],[$LIBLDAP_NAMES],[ AC_DEFINE(HAVE_LDAP_URL_PARSE,1,[Define to 1 if you have ldap_url_parse]) ]) - AC_CHECK_LIB($LIBLDAP_LIBS,[ldap_start_tls_s],[ + AC_SEARCH_LIBS([ldap_start_tls_s],[$LIBLDAP_NAMES],[ AC_DEFINE(HAVE_LDAP_START_TLS_S,1,[Define to 1 if you have ldap_start_tls_s]) ]) SQUID_STATE_ROLLBACK(squid_ldap_state)