aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2007-10-19 16:15:42 +0000
committerYang Tse <yangsita@gmail.com>2007-10-19 16:15:42 +0000
commite8d3710aff10014acb7adbf2bb721dbd53258e4f (patch)
tree88128914c463b46adca6da51c5e081656be6a0be
parentd0fe681a28edab36ca47e96122958017305427f3 (diff)
Add custom check for WINLDAP libraries.
In CURL_CHECK_LIBS_WINLDAP and CURL_CHECK_LIBS_LDAP, check first with no additional library even when the optional list of libraries has been given.
-rw-r--r--acinclude.m4100
1 files changed, 96 insertions, 4 deletions
diff --git a/acinclude.m4 b/acinclude.m4
index fc987ce90..165b46896 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -480,6 +480,99 @@ AC_DEFUN([CURL_CHECK_HEADER_LDAPSSL], [
])
+dnl CURL_CHECK_LIBS_WINLDAP
+dnl -------------------------------------------------
+dnl Check for libraries needed for WINLDAP support,
+dnl and prepended to LIBS any needed libraries.
+dnl This macro can take an optional parameter with a
+dnl white space separated list of libraries to check
+dnl before the WINLDAP default ones.
+
+AC_DEFUN([CURL_CHECK_LIBS_WINLDAP], [
+ AC_REQUIRE([CURL_CHECK_HEADER_WINBER])dnl
+ #
+ AC_MSG_CHECKING([for WINLDAP libraries])
+ #
+ u_libs=""
+ #
+ ifelse($1,,,[
+ for x_lib in $1; do
+ case "$x_lib" in
+ -l*)
+ l_lib="$x_lib"
+ ;;
+ *)
+ l_lib="-l$x_lib"
+ ;;
+ esac
+ if test -z "$u_libs"; then
+ u_libs="$l_lib"
+ else
+ u_libs="$u_libs $l_lib"
+ fi
+ done
+ ])
+ #
+ curl_cv_save_LIBS=$LIBS
+ curl_cv_ldap_LIBS="unknown"
+ #
+ for x_nlibs in '' "$u_libs" \
+ '-lwldap32' ; do
+ if test -z "$x_nlibs"; then
+ LIBS="$curl_cv_save_LIBS"
+ else
+ LIBS="$x_nlibs $curl_cv_save_LIBS"
+ fi
+ AC_LINK_IFELSE([
+ AC_LANG_PROGRAM([
+#undef inline
+#ifdef HAVE_WINDOWS_H
+#ifndef WIN32_LEAN_AND_MEAN
+#define WIN32_LEAN_AND_MEAN
+#endif
+#include <windows.h>
+#ifdef HAVE_WINLDAP_H
+#include <winldap.h>
+#endif
+#ifdef HAVE_WINBER_H
+#include <winber.h>
+#endif
+#endif
+ ],[
+ BERVAL *bvp = NULL;
+ BerElement *bep = ber_init(bvp);
+ LDAP *ldp = ldap_init("dummy", LDAP_PORT);
+ ULONG res = ldap_unbind(ldp);
+ ber_free(bep, 1);
+ ])
+ ],[
+ curl_cv_ldap_LIBS="$x_nlibs"
+ break
+ ])
+ done
+ #
+ LIBS=$curl_cv_save_LIBS
+ #
+ case X-"$curl_cv_ldap_LIBS" in
+ X-unknown)
+ AC_MSG_RESULT([cannot find WINLDAP libraries])
+ ;;
+ X-)
+ AC_MSG_RESULT([no additional lib required])
+ ;;
+ *)
+ if test -z "$curl_cv_save_LIBS"; then
+ LIBS="$curl_cv_ldap_LIBS"
+ else
+ LIBS="$curl_cv_ldap_LIBS $curl_cv_save_LIBS"
+ fi
+ AC_MSG_RESULT([$curl_cv_ldap_LIBS])
+ ;;
+ esac
+ #
+])
+
+
dnl CURL_CHECK_LIBS_LDAP
dnl -------------------------------------------------
dnl Check for libraries needed for LDAP support,
@@ -491,6 +584,8 @@ dnl before the default ones.
AC_DEFUN([CURL_CHECK_LIBS_LDAP], [
AC_REQUIRE([CURL_CHECK_HEADER_LDAP])dnl
#
+ AC_MSG_CHECKING([for LDAP libraries])
+ #
u_libs=""
#
ifelse($1,,,[
@@ -511,13 +606,10 @@ AC_DEFUN([CURL_CHECK_LIBS_LDAP], [
done
])
#
- AC_MSG_CHECKING([for LDAP libraries])
- #
curl_cv_save_LIBS=$LIBS
curl_cv_ldap_LIBS="unknown"
#
- for x_nlibs in "$u_libs" \
- '' \
+ for x_nlibs in '' "$u_libs" \
'-lldap' \
'-llber -lldap' \
'-lldap -llber' \