#MIN_CONFIG(3.0.0)

KDE_ENABLE_HIDDEN_VISIBILITY

AM_INIT_AUTOMAKE(basket, '1.0.3.1')
AC_C_BIGENDIAN
AC_CHECK_KDEMAXPATHLEN

KDE_CHECK_LARGEFILE

dnl -----------------------------------------------------------------
dnl AC_LIB_GPGME([ACTION-IF-TRUE], [ACTION-IF-FALSE])
dnl -----------------------------------------------------------------

OPTION="  --with-encryption=yes/no   compile with encryption support (gpgme)"

AC_DEFUN([AC_ENCRYPTION], [
  AH_TEMPLATE([HAVE_LIBGPGME], [Define if libgpgme is available])

  AC_ARG_WITH(encryption, [$OPTION], [
    if test "$withval" = "no"; then
      ac_gpg=
      $2
    elif test "$withval" = "yes"; then
      ac_gpg=yes
    else
      ac_gpg=yes
    fi
  ],[ac_gpg=yes])

  if test "$ac_gpg" != ""; then
    AM_PATH_GPGME(1.0.0, ac_libgpgme=yes, ac_libgpgme=no)
    AM_PATH_GPG_ERROR(1.0, ac_libgpgerror=yes, ac_libgpgerror=no)

    if test "$ac_libgpgme" != "no" -a "$ac_libgpgerror" != "no"; then
      AC_DEFINE([HAVE_LIBGPGME])
      ac_have_gpgme="yes"
      $1
    else
      :
      $2
    fi
  fi
  AM_CONDITIONAL(HAVE_LIBGPGME, test "$ac_have_gpgme" = "yes")
])

AC_ENCRYPTION([], [basket_warning_gpgme=yes])

KDE_CHECK_HEADER(kontact/core.h, [KONTACT_SUBDIR="yes"], [KONTACT_SUBDIR="no"])

if test "$KONTACT_SUBDIR" = "no"; then
	basket_warning_kontact=yes
	DO_NOT_COMPILE="$DO_NOT_COMPILE kontact_plugin"
fi

