# needs soelim from groff #14734
depends groff &&

optional_depends  SYSTEM-LOGGER         \
                  '--enable-syslog'     \
                  '--disable-syslog'    \
                  'for syslog support'  &&

case $OPENLDAP_TLS in
  none) OPTS="--without-tls $OPTS"
  ;;
  openssl) depends SSL "--with-tls=openssl"
  ;;
  gnutls) depends gnutls "--with-tls=gnutls"
  ;;
  moznss) depends nss "--with-tls=moznss" &&
          depends nspr
  ;;
esac &&

optional_depends LIBSASL \
                 '--with-cyrus-sasl' \
                 '--without-cyrus-sasl' \
                 'for SASL authentication, if SLAPD is a backend authenticator for SASL, say "no"' &&

if list_find "$OPENLDAP_OPTS" "--enable-slapd"; then
  case OPENLDAP_MP in
    auto) OPTS="--with-mp=auto $OPTS"
    ;;
    bignum) depends SSL "--with-mp=bignum"
    ;;
    gmp) depends gmp "--with-mp=gmp"
    ;;
  esac &&

  if is_depends_enabled $SPELL $(get_spell_provider $SPELL LIBSASL); then
    config_query_option OPENLDAP_OPTS "Enable (Cyrus) SASL password verification?" n \
                                      "--enable-spasswd" \
                                      "--disable-spasswd"
  fi &&

  optional_depends openslp \
                   '--enable-slp' \
                   '--disable-slp' \
                   'for SLPv2 support' &&

  optional_depends tcp_wrappers \
                   '--enable-wrappers' \
                   '--disable-wrappers' \
                   'for TCP wrappers support' &&

  optional_depends db \
                   '--enable-bdb=mod --enable-hdb=mod' \
                   '--disable-bdb --disable-hdb' \
                   'for Berkeley DB backend (recommended)' &&

  optional_depends ODBC-MGR            \
                   '--enable-sql=mod'  \
                   '--disable-sql'     \
                   'for SQL backend' &&

  if is_depends_enabled $SPELL $(get_spell_provider $SPELL ODBC-MGR); then
    case $(get_spell_provider $SPELL ODBC-MGR) in
      libiodbc) depends libiodbc "--with-odbc=iodbc"
      ;;
      unixodbc) depends unixodbc "--with-odbc=unixodbc"
      ;;
    esac
  fi &&

  optional_depends -sub NDB MYSQL \
                            "--enable-ndb=mod" \
                            "--enable-ndb=no" \
                            "for MySQL/MariaDB NDB Cluster backend" &&

  optional_depends perl                 \
                   '--enable-perl=mod'  \
                   '--disable-perl'     \
                   'for Perl backend (write your own storage backend)' &&

  optional_depends bash                  \
                   '--enable-shell=mod'  \
                   '--disable-shell'     \
                   'for shell backend (write your own storage backend)' &&

  optional_depends shadow                 \
                   '--enable-passwd=mod'  \
                   '--disable-passwd'     \
                   'for passwd backend'
fi &&
optional_depends icu '' '' 'Unicode support'
