diff --git a/libavformat/tls.c b/libavformat/tls.c
index 7ce981735f0630ac215c56d1c7f2b2be422297ab..00fe876a42dae133f6622dfc3347b6dfb8171367 100644
--- a/libavformat/tls.c
+++ b/libavformat/tls.c
@@ -213,7 +213,7 @@ static int tls_open(URLContext *h, const char *uri, int flags, AVDictionary **op
     struct addrinfo hints = { 0 }, *ai = NULL;
     const char *proxy_path;
     int use_proxy;
-#if CONFIG_OPENSSL
+#if CONFIG_OPENSSL && !CONFIG_GNUTLS
     BIO *bio;
 #endif