. "$GRIMOIRE/depends_one_of.function"

depends  gmp  &&
depends  zlib  &&

optional_depends_one_of  CURL_SSL \
                         gnutls '--with-ssl --with-gnutls --without-openssl --without-nss --without-mbedtls --without-wolfssl' \
                         openssl '--with-ssl --without-gnutls --with-openssl --without-nss --without-mbedtls --without-wolfssl' \
                         libressl '--with-ssl --without-gnutls --with-openssl --without-nss --without-mbedtls --without-wolfssl' \
                         -sub PEM nss '--with-ssl --without-gnutls --without-openssl --with-nss --without-mbedtls --without-wolfssl' \
                         mbedtls '--with-ssl --without-gnutls --without-openssl --without-nss --with-mbedtls --without-wolfssl' \
                         wolfssl '--with-ssl --without-gnutls --without-openssl --without-nss --without-mbedtls --with-wolfssl' \
                         '--without-ssl --without-ca-bundle' \
                         'SSL library' &&

if [[ "$CURL_SSL" != "none" ]]; then
  depends  ca-certificates "--with-ca-bundle=$INSTALL_ROOT/etc/ssl/certs/ca-certificates.crt"
fi &&

optional_depends  krb5 \
                  "--with-gssapi" \
                  "--without-gssapi" \
                  "GSSAPI support" &&

optional_depends  libpsl \
                  "--with-libpsl" \
                  "--without-libpsl" \
                  "for libpsl support" &&

optional_depends  libssh2 \
                  "--with-libssh2" \
                  '--without-libssh2' \
                  "for SSH (SCP and SFTP) support"     &&

optional_depends rtmpdump \
                 "" \
                 '--without-librtmp' \
                 "for RTMP streaming media support" &&

optional_depends  c-ares \
                  "--enable-ares=$INSTALL_ROOT/usr" \
                  '--disable-ares' \
                  "to performs DNS requests and name resolves asynchronously"  &&

optional_depends  libidn2 \
                  "--with-libidn2=$INSTALL_ROOT/usr" \
                  '--without-libidn2' \
                  'for International Domain Name support'  &&

if [[ "$CURL_SSL" != "none" ]]; then
  optional_depends  openldap \
                    '--enable-ldap --enable-ldaps' \
                    '--disable-ldap --disable-ldaps' \
                    'for Lightweight Directory Access Protocol support'
else
  optional_depends  openldap \
                    '--enable-ldap' \
                    '--disable-ldap' \
                    'for Lightweight Directory Access Protocol support'
fi &&

optional_depends  nghttp2 \
                  "--with-nghttp2" \
                  "--without-nghttp2" \
                  "for HTTP/2 support" &&

optional_depends  nghttp3 \
                  "--with-nghttp3" \
                  "--without-nghttp3" \
                  "for HTTP/3 support"   &&

if is_depends_enabled ${SPELL} nghttp3; then
  depends -sub WITHSSL ngtcp2
fi &&

optional_depends brotli \
                 "--with-brotli" \
                 "--without-brotli" \
                 "for Brotli compression support" &&

optional_depends zstd \
                 "--with-zstd" \
                 "--without-zstd" \
                 "for Zstd compression support"
