depends  automake   &&
depends  autoconf   &&
depends  e2fsprogs  &&
depends  groff      &&

optional_depends SSL                                 \
                 "--with-openssl=$INSTALL_ROOT/usr"  \
                 '--without-openssl'                 \
                 'for OpenSSL'                       &&

optional_depends JDK \
                 "--enable-java --with-javabase=$INSTALL_ROOT/usr/lib/j2sdk" \
                 "--disable-java" \
                 "to compile Java support" &&

if [[ "$CS_KERBEROS" == 'y' ]]; then
  optional_depends krb5                                 \
                   "--enable-gssapi=$INSTALL_ROOT/usr"  \
                   '--disable-gssapi'                   \
                   'for Kerberos authentication'
fi &&
if [[ "$CS_MECH" =~ 'saslauthd' ]]; then
  case "$CS_SASLD" in
    shadow)   ;; # TODO, didn't find appropriate option for configure
    PAM)      optional_depends linux-pam                       \
                               "--with-pam=$INSTALL_ROOT/usr"  \
                               '--without-pam'                 \
                               'saslauthd PAM backend' ;;
    LDAP)     optional_depends openldap                         \
                               "--with-ldap=$INSTALL_ROOT/usr"  \
                               '--without-ldap'                 \
                               'saslauthd LDAP backend';;
    KERBEROS) ;; # TODO, what's special about this one?
  esac
fi &&
if [[ "$CS_MECH" =~ 'auxprop' ]]; then
  case "$CS_DB" in
    berkeley) depends db   '--with-dblib=berkeley';;
        gdbm) depends gdbm '--with-dblib=gdbm'    ;;
  esac &&

  optional_depends openldap \
                   "--with-ldap=$INSTALL_ROOT/usr --enable-ldapdb" \
                   "--without-ldap --disable-ldapdb" \
                   "auxprop LDAP backend" &&

  optional_depends sqlite                                         \
                   "--enable-sql --with-sqlite3=$INSTALL_ROOT/usr"\
                   '--without-sqlite3'                            \
                   'auxprop SQLite backend'                       &&

  optional_depends sqlite2                                        \
                   "--enable-sql --with-sqlite=$INSTALL_ROOT/usr" \
                   '--without-sqlite'                             \
                   'auxprop SQLite2 backend'                      &&

  optional_depends MYSQL                                          \
                   "--enable-sql --with-mysql=$INSTALL_ROOT/usr"  \
                   '--without-mysql'                              \
                   'auxprop MySQL backend'                        &&

  optional_depends postgresql                                     \
                   "--enable-sql --with-pgsql=$INSTALL_ROOT/usr"  \
                   '--without-pgsql'                              \
                   'auxprop PostgreSQL backend'
fi
