diff --git a/libavcodec/alac.c b/libavcodec/alac.c
index 827c0db191ea551a8cdaf5ee84b3a4996ef02f3f..1842e7b3bbf77afe40296546a167a12412b01d60 100644
--- a/libavcodec/alac.c
+++ b/libavcodec/alac.c
@@ -609,12 +609,14 @@ static av_cold int alac_decode_init(AVCodecContext * avctx)
     return 0;
 }
 
+#if HAVE_THREADS
 static int init_thread_copy(AVCodecContext *avctx)
 {
     ALACContext *alac = avctx->priv_data;
     alac->avctx = avctx;
     return allocate_buffers(alac);
 }
+#endif
 
 static const AVOption options[] = {
     { "extra_bits_bug", "Force non-standard decoding process",
diff --git a/libavcodec/exr.c b/libavcodec/exr.c
index 3b6b245187075230f6d208dca1368c3fea220ec1..86a99086fe5966de535c0591887fad4d3a282f98 100644
--- a/libavcodec/exr.c
+++ b/libavcodec/exr.c
@@ -1426,6 +1426,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
     return 0;
 }
 
+#if HAVE_THREADS
 static int decode_init_thread_copy(AVCodecContext *avctx)
 {    EXRContext *s = avctx->priv_data;
 
@@ -1436,6 +1437,7 @@ static int decode_init_thread_copy(AVCodecContext *avctx)
 
     return 0;
 }
+#endif
 
 static av_cold int decode_end(AVCodecContext *avctx)
 {
diff --git a/libavcodec/ffv1dec.c b/libavcodec/ffv1dec.c
index 662ef13fff1c0fece482e2eeb922432138e8aa0d..a8d5e33da9c3f43ce6ed71a3c9e8f94dfb13d8fc 100644
--- a/libavcodec/ffv1dec.c
+++ b/libavcodec/ffv1dec.c
@@ -1017,6 +1017,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac
     return buf_size;
 }
 
+#if HAVE_THREADS
 static int init_thread_copy(AVCodecContext *avctx)
 {
     FFV1Context *f = avctx->priv_data;
@@ -1042,6 +1043,7 @@ static int init_thread_copy(AVCodecContext *avctx)
 
     return 0;
 }
+#endif
 
 static void copy_fields(FFV1Context *fsdst, FFV1Context *fssrc, FFV1Context *fsrc)
 {
@@ -1071,6 +1073,7 @@ static void copy_fields(FFV1Context *fsdst, FFV1Context *fssrc, FFV1Context *fsr
     }
 }
 
+#if HAVE_THREADS
 static int update_thread_context(AVCodecContext *dst, const AVCodecContext *src)
 {
     FFV1Context *fsrc = src->priv_data;
@@ -1114,6 +1117,7 @@ static int update_thread_context(AVCodecContext *dst, const AVCodecContext *src)
 
     return 0;
 }
+#endif
 
 AVCodec ff_ffv1_decoder = {
     .name           = "ffv1",
diff --git a/libavcodec/flacdec.c b/libavcodec/flacdec.c
index 8653da7d2ae04d8190df4c676a15164ad4f15efa..126f4e00df6c684fbdfee108e117397d3a34ad03 100644
--- a/libavcodec/flacdec.c
+++ b/libavcodec/flacdec.c
@@ -623,6 +623,7 @@ static int flac_decode_frame(AVCodecContext *avctx, void *data,
     return bytes_read;
 }
 
+#if HAVE_THREADS
 static int init_thread_copy(AVCodecContext *avctx)
 {
     FLACContext *s = avctx->priv_data;
@@ -633,6 +634,7 @@ static int init_thread_copy(AVCodecContext *avctx)
         return allocate_buffers(s);
     return 0;
 }
+#endif
 
 static av_cold int flac_decode_close(AVCodecContext *avctx)
 {
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 8b95003f7546cb58b5655883be32114019628855..b662e562f50d1e1d4f499b1abdb6e23a0216105c 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -701,6 +701,7 @@ av_cold int ff_h264_decode_init(AVCodecContext *avctx)
     return 0;
 }
 
+#if HAVE_THREADS
 static int decode_init_thread_copy(AVCodecContext *avctx)
 {
     H264Context *h = avctx->priv_data;
@@ -719,6 +720,7 @@ static int decode_init_thread_copy(AVCodecContext *avctx)
 
     return 0;
 }
+#endif
 
 /**
  * Run setup operations that must be run after slice header decoding.
diff --git a/libavcodec/huffyuvdec.c b/libavcodec/huffyuvdec.c
index a700abb9418c2b621377f415014873153b6b240c..7314519fca1f176d13f2a39d00aa41a79ac1f1b1 100644
--- a/libavcodec/huffyuvdec.c
+++ b/libavcodec/huffyuvdec.c
@@ -571,6 +571,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
     return ret;
 }
 
+#if HAVE_THREADS
 static av_cold int decode_init_thread_copy(AVCodecContext *avctx)
 {
     HYuvContext *s = avctx->priv_data;
@@ -595,6 +596,7 @@ static av_cold int decode_init_thread_copy(AVCodecContext *avctx)
 
     return 0;
 }
+#endif
 
 /** Subset of GET_VLC for use in hand-roller VLC code */
 #define VLC_INTERN(dst, table, gb, name, bits, max_depth)   \
diff --git a/libavcodec/mdec.c b/libavcodec/mdec.c
index a9b7e8215e0a1fbe4f783fba343889064c043b10..1cc4ca4742f3f54d72466fb004c5a87d682b631a 100644
--- a/libavcodec/mdec.c
+++ b/libavcodec/mdec.c
@@ -233,6 +233,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
     return 0;
 }
 
+#if HAVE_THREADS
 static av_cold int decode_init_thread_copy(AVCodecContext *avctx)
 {
     MDECContext * const a = avctx->priv_data;
@@ -241,6 +242,7 @@ static av_cold int decode_init_thread_copy(AVCodecContext *avctx)
 
     return 0;
 }
+#endif
 
 static av_cold int decode_end(AVCodecContext *avctx)
 {
diff --git a/libavcodec/mimic.c b/libavcodec/mimic.c
index f5853b5c48fad715ee5a72f806a71e666753198a..d3f9c0764a00950becae49a6313a186ecdeeba40 100644
--- a/libavcodec/mimic.c
+++ b/libavcodec/mimic.c
@@ -167,6 +167,7 @@ static av_cold int mimic_decode_init(AVCodecContext *avctx)
     return 0;
 }
 
+#if HAVE_THREADS
 static int mimic_decode_update_thread_context(AVCodecContext *avctx, const AVCodecContext *avctx_from)
 {
     MimicContext *dst = avctx->priv_data, *src = avctx_from->priv_data;
@@ -191,6 +192,7 @@ static int mimic_decode_update_thread_context(AVCodecContext *avctx, const AVCod
 
     return 0;
 }
+#endif
 
 static const int8_t vlcdec_lookup[9][64] = {
     {    0, },
@@ -454,6 +456,7 @@ static int mimic_decode_frame(AVCodecContext *avctx, void *data,
     return buf_size;
 }
 
+#if HAVE_THREADS
 static av_cold int mimic_init_thread_copy(AVCodecContext *avctx)
 {
     MimicContext *ctx = avctx->priv_data;
@@ -469,6 +472,7 @@ static av_cold int mimic_init_thread_copy(AVCodecContext *avctx)
 
     return 0;
 }
+#endif
 
 AVCodec ff_mimic_decoder = {
     .name                  = "mimic",
diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index 21ccf6ca2556774fced03ac6ba8daeb6fc1b89ae..21a347001ed332edb0eb6af82c0945fcc2c166d0 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -1139,6 +1139,7 @@ static av_cold int mpeg_decode_init(AVCodecContext *avctx)
     return 0;
 }
 
+#if HAVE_THREADS
 static int mpeg_decode_update_thread_context(AVCodecContext *avctx,
                                              const AVCodecContext *avctx_from)
 {
@@ -1163,6 +1164,7 @@ static int mpeg_decode_update_thread_context(AVCodecContext *avctx,
 
     return 0;
 }
+#endif
 
 static void quant_matrix_rebuild(uint16_t *matrix, const uint8_t *old_perm,
                                  const uint8_t *new_perm)
diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c
index f15747f6ab5bdf4e8bfc19b3ed208b4d54220dd5..5c388c4044664e95fd34183a3b9307959f12f7f5 100644
--- a/libavcodec/mpeg4videodec.c
+++ b/libavcodec/mpeg4videodec.c
@@ -2688,6 +2688,7 @@ int ff_mpeg4_frame_end(AVCodecContext *avctx, const uint8_t *buf, int buf_size)
     return 0;
 }
 
+#if HAVE_THREADS
 static int mpeg4_update_thread_context(AVCodecContext *dst,
                                        const AVCodecContext *src)
 {
@@ -2707,6 +2708,7 @@ static int mpeg4_update_thread_context(AVCodecContext *dst,
 
     return 0;
 }
+#endif
 
 static av_cold int decode_init(AVCodecContext *avctx)
 {
diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c
index bd84ee994ff94af1dc8be4d5f52ed10b4ccaf7f0..d18014142afabbb12aacf488e399e8f29a86bd4c 100644
--- a/libavcodec/pngdec.c
+++ b/libavcodec/pngdec.c
@@ -1340,6 +1340,7 @@ end:
 }
 #endif
 
+#if HAVE_THREADS
 static int update_thread_context(AVCodecContext *dst, const AVCodecContext *src)
 {
     PNGDecContext *psrc = src->priv_data;
@@ -1387,6 +1388,7 @@ static int update_thread_context(AVCodecContext *dst, const AVCodecContext *src)
 
     return 0;
 }
+#endif
 
 static av_cold int png_dec_init(AVCodecContext *avctx)
 {
diff --git a/libavcodec/takdec.c b/libavcodec/takdec.c
index 2acdb924c399b7c53b6d17cf5688c82d677fe509..5395596cfc2c3cccddf75ccb172f022b6480c34c 100644
--- a/libavcodec/takdec.c
+++ b/libavcodec/takdec.c
@@ -908,6 +908,7 @@ static int tak_decode_frame(AVCodecContext *avctx, void *data,
     return pkt->size;
 }
 
+#if HAVE_THREADS
 static int init_thread_copy(AVCodecContext *avctx)
 {
     TAKDecContext *s = avctx->priv_data;
@@ -926,6 +927,7 @@ static int update_thread_context(AVCodecContext *dst,
     memcpy(&tdst->ti, &tsrc->ti, sizeof(TAKStreamInfo));
     return 0;
 }
+#endif
 
 static av_cold int tak_decode_close(AVCodecContext *avctx)
 {
diff --git a/libavcodec/tta.c b/libavcodec/tta.c
index 1e2e9c4ef4c44619cfa6d2e9313146ea818d87d1..1ed90fe49eaa4b8502c6042e8db682603f50fec0 100644
--- a/libavcodec/tta.c
+++ b/libavcodec/tta.c
@@ -387,6 +387,7 @@ error:
     return ret;
 }
 
+#if HAVE_THREADS
 static int init_thread_copy(AVCodecContext *avctx)
 {
     TTAContext *s = avctx->priv_data;
@@ -404,6 +405,7 @@ static av_cold int tta_decode_close(AVCodecContext *avctx) {
 
     return 0;
 }
+#endif
 
 #define OFFSET(x) offsetof(TTAContext, x)
 #define DEC (AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_AUDIO_PARAM)
diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c
index 09e6f75ec4e4239d1a2d112511949f59e1f51395..1e5547443f5b1b93d4250e1e1c494a77e83aa6f0 100644
--- a/libavcodec/vp3.c
+++ b/libavcodec/vp3.c
@@ -1930,6 +1930,7 @@ static int ref_frames(Vp3DecodeContext *dst, Vp3DecodeContext *src)
     return 0;
 }
 
+#if HAVE_THREADS
 static int vp3_update_thread_context(AVCodecContext *dst, const AVCodecContext *src)
 {
     Vp3DecodeContext *s = dst->priv_data, *s1 = src->priv_data;
@@ -1989,6 +1990,7 @@ static int vp3_update_thread_context(AVCodecContext *dst, const AVCodecContext *
 
     return update_frames(dst);
 }
+#endif
 
 static int vp3_decode_frame(AVCodecContext *avctx,
                             void *data, int *got_frame,
@@ -2221,6 +2223,7 @@ static int read_huffman_tree(AVCodecContext *avctx, GetBitContext *gb)
     return 0;
 }
 
+#if HAVE_THREADS
 static int vp3_init_thread_copy(AVCodecContext *avctx)
 {
     Vp3DecodeContext *s = avctx->priv_data;
@@ -2237,6 +2240,7 @@ static int vp3_init_thread_copy(AVCodecContext *avctx)
 
     return init_frames(s);
 }
+#endif
 
 #if CONFIG_THEORA_DECODER
 static const enum AVPixelFormat theora_pix_fmts[4] = {
diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c
index cb0c7cdc02655ca32d7fc9d0c55112138edacce4..64037fc089749d4d5b33da9dd4b3ef71efe6770d 100644
--- a/libavcodec/vp8.c
+++ b/libavcodec/vp8.c
@@ -2769,6 +2769,7 @@ av_cold int ff_vp8_decode_init(AVCodecContext *avctx)
 }
 
 #if CONFIG_VP8_DECODER
+#if HAVE_THREADS
 static av_cold int vp8_decode_init_thread_copy(AVCodecContext *avctx)
 {
     VP8Context *s = avctx->priv_data;
@@ -2819,6 +2820,7 @@ static int vp8_decode_update_thread_context(AVCodecContext *dst,
 
     return 0;
 }
+#endif /* HAVE_THREADS */
 #endif /* CONFIG_VP8_DECODER */
 
 #if CONFIG_VP7_DECODER
diff --git a/libavcodec/vp9.c b/libavcodec/vp9.c
index f1183e8e751eb30020eb4325aad6e74aed1cfb70..ed0d905a0adb433596f2f65478304ab7189f3109 100644
--- a/libavcodec/vp9.c
+++ b/libavcodec/vp9.c
@@ -4307,6 +4307,7 @@ static av_cold int vp9_decode_init(AVCodecContext *ctx)
     return init_frames(ctx);
 }
 
+#if HAVE_THREADS
 static av_cold int vp9_decode_init_thread_copy(AVCodecContext *avctx)
 {
     return init_frames(avctx);
@@ -4359,6 +4360,7 @@ static int vp9_decode_update_thread_context(AVCodecContext *dst, const AVCodecCo
 
     return 0;
 }
+#endif
 
 static const AVProfile profiles[] = {
     { FF_PROFILE_VP9_0, "Profile 0" },
diff --git a/libavcodec/wavpack.c b/libavcodec/wavpack.c
index 9bafe65e0e6c61b08e71da28050d90bb02e8f11b..d20556d312331558fe60189ba5e3ca3366c0a486 100644
--- a/libavcodec/wavpack.c
+++ b/libavcodec/wavpack.c
@@ -597,12 +597,14 @@ static av_cold int wv_alloc_frame_context(WavpackContext *c)
     return 0;
 }
 
+#if HAVE_THREADS
 static int init_thread_copy(AVCodecContext *avctx)
 {
     WavpackContext *s = avctx->priv_data;
     s->avctx = avctx;
     return 0;
 }
+#endif
 
 static av_cold int wavpack_decode_init(AVCodecContext *avctx)
 {