dnl -*- mode: Autoconf; -*-
dnl Invoke autogen.sh to produce a configure script.

SE_ARG_ENABLE_BACKEND(dav,
                      webdav,
                      [AS_HELP_STRING([--enable-dav],
                                      [enable WebDAV based backends (CalDAV) (default off)])],
                      [enable_dav="$enableval"],
                      [enable_dav="no"]
                     )

if test "$enable_dav" = "yes"; then
        need_ical="yes"
        PKG_CHECK_MODULES(NEON, neon >= 0.29,
                          [AC_DEFINE(HAVE_LIBNEON_SYSTEM_PROXY, 1, [ne_session_system_proxy() available])
                           AC_DEFINE(HAVE_LIBNEON_OPTIONS, 1, [ne_options2() and NE_CAP_* defines available])],
                          [PKG_CHECK_MODULES(NEON, neon >= 0.27)])
        AC_DEFINE(ENABLE_DAV, 1, [DAV available])
        AC_DEFINE(ENABLE_ICAL, 1, [libical in use])
        BACKEND_CPPFLAGS="$BACKEND_CPPFLAGS $NEON_CFLAGS"
fi

AC_ARG_ENABLE(neon-compatibility,
              AS_HELP_STRING([--enable-neon-compatibility],
                             [increase compatibility with binary libneon installations by loading libneon[-gnutls].27.so dynamically instead of linking against it]),
              [enable_neon_compat="$enableval"],
              [enable_neon_compat="no"]
              )
if test "$enable_neon_compat" = "yes"; then
        AC_DEFINE(NEON_COMPATIBILITY, 1, [dynamically open libneon])
        NEON_LIBS="`echo $NEON_LIBS | sed -e 's/\(-lneon\(-gnutls\)*\|[^ ]*libneon\(-gnutls\)*.la\)/-ldl/'`"
fi
AM_CONDITIONAL([NEON_COMPATIBILITY], [test "$enable_neon_compat" = "yes"])
