2 dnl Add --with-sunldap and --with-static-sunldap options. --with-sunldap
3 dnl defaults to the given value if not specified. If LDAP support is
4 dnl configured, HAVE_LDAP will be defined and the automake conditional
5 dnl ENABLE_LDAP will be set. LDAP_CFLAGS and LDAP_LIBS will be set
6 dnl appropriately, and --with-sunldap and --with-openldap is mutually exclusive.
8 AC_DEFUN([EVO_SUNLDAP_CHECK], [
11 AC_ARG_WITH([sunldap],
12 [AS_HELP_STRING([--with-sunldap],
13 [Enable SunLDAP support in evolution])])
14 AC_ARG_WITH([static-sunldap],
15 [AS_HELP_STRING([--with-static-sunldap],
16 [Link SunLDAP support statically into evolution])])
17 AC_CACHE_CHECK([for SunLDAP],[ac_cv_with_sunldap],[ac_cv_with_sunldap="${with_sunldap:=$default}"])
18 case $ac_cv_with_sunldap in
26 with_sunldap=$ac_cv_with_sunldap
27 LDAP_CFLAGS="-I$ac_cv_with_sunldap/include"
28 LDAP_LDFLAGS="-L$ac_cv_with_sunldap/lib"
32 if test "$with_sunldap" != no; then
33 AC_DEFINE(HAVE_LDAP,1,[Define if you have LDAP support])
34 AC_DEFINE(SUNLDAP, 1, [Define if you use SunLDAP])
36 case $with_static_sunldap in
38 with_static_sunldap=no
41 with_static_sunldap=yes
45 AC_CACHE_CHECK([if SunLDAP is version 2.x], [ac_cv_sunldap_version2], [
46 CPPFLAGS_save="$CPPFLAGS"
47 CPPFLAGS="$CPPFLAGS $LDAP_CFLAGS"
50 #if LDAP_VENDOR_VERSION >= 500
53 ],[ac_cv_sunldap_version2=yes],[ac_cv_sunldap_version2=no])
54 CPPFLAGS="$CPPFLAGS_save"
56 if test "$ac_cv_sunldap_version2" = no; then
57 AC_MSG_ERROR([evolution requires SunLDAP version >= 2])
60 AC_CHECK_LIB(resolv, res_query, [LDAP_LIBS="-lresolv"])
61 AC_CHECK_LIB(socket, bind, [LDAP_LIBS="$LDAP_LIBS -lsocket"])
62 AC_CHECK_LIB(nsl, gethostbyaddr, [LDAP_LIBS="$LDAP_LIBS -lnsl"])
63 AC_CHECK_LIB(ldap, ldap_open, [
64 if test $with_static_sunldap = "yes"; then
65 LDAP_LIBS="$with_sunldap/lib/libldap.a $LDAP_LIBS"
67 LDAP_LIBS="-lldap $LDAP_LIBS"
69 if test `uname -s` != "SunOS" ; then
70 AC_CHECK_LIB(lber, ber_get_tag, [
71 if test "$with_static_sunldap" = "yes"; then
72 LDAP_LIBS="$with_sunldap/lib/liblber.a $LDAP_LIBS"
73 # libldap might depend on OpenSSL... We need to pull
74 # in the dependency libs explicitly here since we're
75 # not using libtool for the configure test.
76 if test -f $with_sunldap/lib/libldap.la; then
77 LDAP_LIBS="`. $with_sunldap/lib/libldap.la; echo $dependency_libs` $LDAP_LIBS"
80 LDAP_LIBS="-llber $LDAP_LIBS"
81 fi], [LDAP_LIBS=""], [$LDAP_LDFLAGS $LDAP_LIBS])
83 LDAP_LIBS="$LDAP_LDFLAGS $LDAP_LIBS"
84 ], [LDAP_LIBS=""], [$LDAP_LDFLAGS $LDAP_LIBS])
86 if test -z "$LDAP_LIBS"; then
87 AC_MSG_ERROR([could not find SunLDAP libraries])
93 AM_CONDITIONAL(ENABLE_LDAP, test "$with_sunldap" != "no")