Commit 4a3e43f2 authored by Guillaume BIENKOWSKI's avatar Guillaume BIENKOWSKI

Use PKGCONFIG when possible for LDAP

parent 3944782c
......@@ -177,19 +177,39 @@ AC_ARG_ENABLE(ldap,
)
if test "$enable_ldap" = "true"; then
AC_CHECK_LIB(sasl2, sasl_client_init , [foo=bar],
[AC_MSG_ERROR(You need SASL for LDAP support)]
PKG_CHECK_MODULES(LDAP, [openldap],[found_ldap=yes], [found_ldap=no])
if test "$found_ldap" = "no"; then
AC_CHECK_LIB(ldap,ldap_initialize, [LDAP_LIBS="-lldap -llber"],
[AC_MSG_ERROR([You need libldap for LDAP support])]
)
AC_CHECK_LIB(ldap,ldap_initialize, LDAP_LIBS="-lldap -llber -lsasl2",
[AC_MSG_ERROR(You need libldap for LDAP support)]
)
AC_CHECK_HEADERS(ldap.h)
AC_CHECK_HEADERS(sasl/sasl.h)
AC_CHECK_HEADERS(ldap.h, [foo=bar], [AC_MSG_ERROR( [ldap.h not found] ) ] )
found_ldap=yes
fi
PKG_CHECK_MODULES(SASL, [libsasl2],[found_sasl=yes],[found_sasl=no] )
if test "$found_sasl" = "no"; then
AC_CHECK_LIB(sasl2, sasl_client_init , [SASL_LIBS="-lsasl2"],
[AC_MSG_ERROR([You need SASL for LDAP support] ) ]
)
AC_CHECK_HEADERS(sasl/sasl.h,foo=bar, [AC_MSG_ERROR([sasl/sasl.h not found])])
found_sasl=yes
fi
AC_SUBST(LDAP_CFLAGS)
AC_SUBST(LDAP_LIBS)
AC_DEFINE(BUILD_LDAP,1,[Defined if LDAP build option enabled])
AC_SUBST(SASL_CFLAGS)
AC_SUBST(SASL_LIBS)
if test "$found_ldap$found_sasl" = "yesyes"; then
AC_DEFINE(BUILD_LDAP,1,[Defined if LDAP build option enabled])
else
AC_MSG_ERROR([Can't use LDAP due to previous errors])
fi
fi
AM_CONDITIONAL(BUILD_LDAP, test x$enable_ldap != xfalse)
dnl conditionnal build of console interface.
......
......@@ -109,7 +109,7 @@ liblinphone_la_LIBADD= \
$(LIBSOUP_LIBS) \
$(SQLITE3_LIBS) \
$(LIBXML2_LIBS) \
$(LDAP_LIBS)
$(LDAP_LIBS) $(SASL_LIBS)
if ENABLE_TESTS
......@@ -144,7 +144,8 @@ AM_CFLAGS=\
$(VIDEO_CFLAGS) \
$(TUNNEL_CFLAGS) \
$(SQLITE3_CFLAGS) \
$(LIBXML2_CFLAGS)
$(LIBXML2_CFLAGS) \
$(LDAP_CFLAGS) $(SASL_CFLAGS)
if BUILD_WIZARD
AM_CFLAGS+= -DBUILD_WIZARD
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment