diff --git a/libavcodec/flashsv.c b/libavcodec/flashsv.c
index b5905e1ea42830c937c52990dad408aafd796a3d..36847738d6f434bfeee523c2f53179aacc2a7389 100644
--- a/libavcodec/flashsv.c
+++ b/libavcodec/flashsv.c
@@ -49,6 +49,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#ifdef CONFIG_ZLIB
 #include <zlib.h>
 
 #include "common.h"
@@ -257,3 +258,4 @@ AVCodec flashsv_decoder = {
     CODEC_CAP_DR1,
     .pix_fmts = (enum PixelFormat[]){PIX_FMT_BGR24, -1},
 };
+#endif //CONFIG_ZLIB