]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fix ./configure detection of various LDAP functions (#1163)
authorAlex Rousskov <rousskov@measurement-factory.com>
Sun, 16 Oct 2022 21:59:28 +0000 (21:59 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Mon, 17 Oct 2022 03:16:35 +0000 (03:16 +0000)
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

acinclude/ldap.m4

index 88cfd119e93b2d2d4355db285dcdbb13b08f9fe2..36b5b73bd25b6c3f89436fcf22d63307d670d78e 100644 (file)
@@ -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)