diff --git a/libavcodec/x86/aacencdsp_init.c b/libavcodec/x86/aacencdsp_init.c
index 049a2417d9..7dca1d481b 100644
--- a/libavcodec/x86/aacencdsp_init.c
+++ b/libavcodec/x86/aacencdsp_init.c
@@ -34,6 +34,7 @@ void ff_aac_quantize_bands_sse2(int *out, const float *in, const float *scaled,
 
 av_cold void ff_aac_dsp_init_x86(AACEncContext *s)
 {
+#if HAVE_X86ASM
     int cpu_flags = av_get_cpu_flags();
 
     if (EXTERNAL_SSE(cpu_flags))
@@ -41,4 +42,5 @@ av_cold void ff_aac_dsp_init_x86(AACEncContext *s)
 
     if (EXTERNAL_SSE2(cpu_flags))
         s->quant_bands = ff_aac_quantize_bands_sse2;
+#endif /* HAVE_X86ASM */
 }
diff --git a/libavcodec/x86/aacpsdsp_init.c b/libavcodec/x86/aacpsdsp_init.c
index 0b0ee07db4..44d64f5340 100644
--- a/libavcodec/x86/aacpsdsp_init.c
+++ b/libavcodec/x86/aacpsdsp_init.c
@@ -51,6 +51,7 @@ void ff_ps_hybrid_analysis_ileave_sse(float (*out)[32][2], float L[2][38][64],
 
 av_cold void ff_psdsp_init_x86(PSDSPContext *s)
 {
+#if HAVE_X86ASM
     int cpu_flags = av_get_cpu_flags();
 
     if (EXTERNAL_SSE(cpu_flags)) {
@@ -71,4 +72,5 @@ av_cold void ff_psdsp_init_x86(PSDSPContext *s)
     if (EXTERNAL_FMA3(cpu_flags)) {
         s->hybrid_analysis        = ff_ps_hybrid_analysis_fma3;
     }
+#endif /* HAVE_X86ASM */
 }
diff --git a/libavcodec/x86/ac3dsp_init.c b/libavcodec/x86/ac3dsp_init.c
index 43b3b4ac85..76a8c0547d 100644
--- a/libavcodec/x86/ac3dsp_init.c
+++ b/libavcodec/x86/ac3dsp_init.c
@@ -35,6 +35,7 @@ void ff_ac3_extract_exponents_ssse3(uint8_t *exp, int32_t *coef, int nb_coefs);
 
 av_cold void ff_ac3dsp_init_x86(AC3DSPContext *c)
 {
+#if HAVE_X86ASM
     int cpu_flags = av_get_cpu_flags();
 
     if (EXTERNAL_SSE2(cpu_flags)) {
@@ -48,6 +49,7 @@ av_cold void ff_ac3dsp_init_x86(AC3DSPContext *c)
         if (!(cpu_flags & AV_CPU_FLAG_ATOM))
             c->extract_exponents = ff_ac3_extract_exponents_ssse3;
     }
+#endif /* HAVE_X86ASM */
 }
 
 #define DOWNMIX_FUNC_OPT(ch, opt)                                       \
@@ -68,6 +70,7 @@ DOWNMIX_FUNCS(fma3)
 
 void ff_ac3dsp_set_downmix_x86(AC3DSPContext *c)
 {
+#if HAVE_X86ASM
     int cpu_flags = av_get_cpu_flags();
 
 #define SET_DOWNMIX(ch, suf, SUF)                                       \
@@ -91,4 +94,5 @@ void ff_ac3dsp_set_downmix_x86(AC3DSPContext *c)
         SET_DOWNMIX_ALL(avx,  AVX)
         SET_DOWNMIX_ALL(fma3, FMA3)
     }
+#endif /* HAVE_X86ASM */
 }
diff --git a/libavcodec/x86/audiodsp_init.c b/libavcodec/x86/audiodsp_init.c
index 68aa3b2129..c5f410678e 100644
--- a/libavcodec/x86/audiodsp_init.c
+++ b/libavcodec/x86/audiodsp_init.c
@@ -41,6 +41,7 @@ void ff_vector_clipf_sse(float *dst, const float *src,
 
 av_cold void ff_audiodsp_init_x86(AudioDSPContext *c)
 {
+#if HAVE_X86ASM
     int cpu_flags = av_get_cpu_flags();
 
     if (EXTERNAL_SSE(cpu_flags))
@@ -59,4 +60,5 @@ av_cold void ff_audiodsp_init_x86(AudioDSPContext *c)
 
     if (EXTERNAL_AVX2_FAST(cpu_flags))
         c->scalarproduct_int16 = ff_scalarproduct_int16_avx2;
+#endif /* HAVE_X86ASM */
 }
diff --git a/libavcodec/x86/bswapdsp_init.c b/libavcodec/x86/bswapdsp_init.c
index 877bab1a2c..08551f6487 100644
--- a/libavcodec/x86/bswapdsp_init.c
+++ b/libavcodec/x86/bswapdsp_init.c
@@ -29,6 +29,7 @@ void ff_bswap32_buf_avx2(uint32_t *dst, const uint32_t *src, int w);
 
 av_cold void ff_bswapdsp_init_x86(BswapDSPContext *c)
 {
+#if HAVE_X86ASM
     int cpu_flags = av_get_cpu_flags();
 
     if (EXTERNAL_SSE2(cpu_flags))
@@ -37,4 +38,5 @@ av_cold void ff_bswapdsp_init_x86(BswapDSPContext *c)
         c->bswap_buf = ff_bswap32_buf_ssse3;
     if (EXTERNAL_AVX2_FAST(cpu_flags))
         c->bswap_buf = ff_bswap32_buf_avx2;
+#endif /* HAVE_X86ASM */
 }
diff --git a/libavcodec/x86/cavsdsp.c b/libavcodec/x86/cavsdsp.c
index 4ad977a034..ad755e7321 100644
--- a/libavcodec/x86/cavsdsp.c
+++ b/libavcodec/x86/cavsdsp.c
@@ -383,6 +383,7 @@ av_cold void ff_cavsdsp_init_x86(CAVSDSPContext *c)
         DSPFUNC(avg, 1,  8, mmxext);
     }
 #endif
+#if HAVE_X86ASM
 #if HAVE_MMX_EXTERNAL
     if (EXTERNAL_MMXEXT(cpu_flags)) {
         c->avg_cavs_qpel_pixels_tab[1][0] = avg_cavs_qpel8_mc00_mmxext;
@@ -397,4 +398,5 @@ av_cold void ff_cavsdsp_init_x86(CAVSDSPContext *c)
         c->idct_perm      = FF_IDCT_PERM_TRANSPOSE;
     }
 #endif
+#endif /* HAVE_X86ASM */
 }
diff --git a/libavcodec/x86/celt_pvq_init.c b/libavcodec/x86/celt_pvq_init.c
index 5a0669e6f2..b88a2f6225 100644
--- a/libavcodec/x86/celt_pvq_init.c
+++ b/libavcodec/x86/celt_pvq_init.c
@@ -31,6 +31,7 @@ extern float ff_pvq_search_exact_avx  (float *X, int *y, int K, int N);
 
 av_cold void ff_celt_pvq_init_x86(CeltPVQ *s)
 {
+#if HAVE_X86ASM
     int cpu_flags = av_get_cpu_flags();
 
     if (EXTERNAL_SSE2(cpu_flags))
@@ -41,4 +42,5 @@ av_cold void ff_celt_pvq_init_x86(CeltPVQ *s)
 
     if (EXTERNAL_AVX_FAST(cpu_flags))
         s->pvq_search = ff_pvq_search_exact_avx;
+#endif /* HAVE_X86ASM */
 }
diff --git a/libavcodec/x86/cfhddsp_init.c b/libavcodec/x86/cfhddsp_init.c
index c5d89561ae..a773c365c1 100644
--- a/libavcodec/x86/cfhddsp_init.c
+++ b/libavcodec/x86/cfhddsp_init.c
@@ -40,6 +40,7 @@ void ff_cfhd_horiz_filter_clip12_sse2(int16_t *output, const int16_t *low, const
 
 av_cold void ff_cfhddsp_init_x86(CFHDDSPContext *c, int depth, int bayer)
 {
+#if HAVE_X86ASM
     int cpu_flags = av_get_cpu_flags();
 
     if (EXTERNAL_SSE2(cpu_flags)) {
@@ -50,4 +51,5 @@ av_cold void ff_cfhddsp_init_x86(CFHDDSPContext *c, int depth, int bayer)
         if (depth == 12 && !bayer)
             c->horiz_filter_clip = ff_cfhd_horiz_filter_clip12_sse2;
     }
+#endif /* HAVE_X86ASM */
 }
diff --git a/libavcodec/x86/cfhdencdsp_init.c b/libavcodec/x86/cfhdencdsp_init.c
index 5cea39a80a..79b2f10bf7 100644
--- a/libavcodec/x86/cfhdencdsp_init.c
+++ b/libavcodec/x86/cfhdencdsp_init.c
@@ -38,6 +38,7 @@ void ff_cfhdenc_vert_filter_sse2(const int16_t *input, int16_t *low, int16_t *hi
 
 av_cold void ff_cfhdencdsp_init_x86(CFHDEncDSPContext *c)
 {
+#if HAVE_X86ASM
     int cpu_flags = av_get_cpu_flags();
 
 #if ARCH_X86_64
@@ -46,4 +47,5 @@ av_cold void ff_cfhdencdsp_init_x86(CFHDEncDSPContext *c)
         c->vert_filter = ff_cfhdenc_vert_filter_sse2;
     }
 #endif
+#endif /* HAVE_X86ASM */
 }
diff --git a/libavcodec/x86/dcadsp_init.c b/libavcodec/x86/dcadsp_init.c
index 3c125f33fd..0475841a40 100644
--- a/libavcodec/x86/dcadsp_init.c
+++ b/libavcodec/x86/dcadsp_init.c
@@ -34,6 +34,7 @@ LFE_FIR_FLOAT_FUNC(fma3)
 
 av_cold void ff_dcadsp_init_x86(DCADSPContext *s)
 {
+#if HAVE_X86ASM
     int cpu_flags = av_get_cpu_flags();
 
 #if ARCH_X86_32
@@ -48,4 +49,5 @@ av_cold void ff_dcadsp_init_x86(DCADSPContext *s)
     if (EXTERNAL_FMA3(cpu_flags))
         s->lfe_fir_float[0] = ff_lfe_fir0_float_fma3;
 #endif
+#endif /* HAVE_X86ASM */
 }
diff --git a/libavcodec/x86/dct_init.c b/libavcodec/x86/dct_init.c
index d0e4b34dd3..6756e1e12d 100644
--- a/libavcodec/x86/dct_init.c
+++ b/libavcodec/x86/dct_init.c
@@ -27,10 +27,12 @@ void ff_dct32_float_avx(FFTSample *out, const FFTSample *in);
 
 av_cold void ff_dct_init_x86(DCTContext *s)
 {
+#if HAVE_X86ASM
     int cpu_flags = av_get_cpu_flags();
 
     if (EXTERNAL_SSE2(cpu_flags))
         s->dct32 = ff_dct32_float_sse2;
     if (EXTERNAL_AVX_FAST(cpu_flags))
         s->dct32 = ff_dct32_float_avx;
+#endif
 }
diff --git a/libavcodec/x86/dnxhdenc_init.c b/libavcodec/x86/dnxhdenc_init.c
index fd6f15005a..612b70ad7a 100644
--- a/libavcodec/x86/dnxhdenc_init.c
+++ b/libavcodec/x86/dnxhdenc_init.c
@@ -30,8 +30,10 @@ void ff_get_pixels_8x4_sym_sse2(int16_t *block, const uint8_t *pixels,
 
 av_cold void ff_dnxhdenc_init_x86(DNXHDEncContext *ctx)
 {
+#if HAVE_X86ASM
     if (EXTERNAL_SSE2(av_get_cpu_flags())) {
         if (ctx->cid_table->bit_depth == 8)
             ctx->get_pixels_8x4_sym = ff_get_pixels_8x4_sym_sse2;
     }
+#endif /* HAVE_X86ASM */
 }
diff --git a/libavcodec/x86/exrdsp_init.c b/libavcodec/x86/exrdsp_init.c
index 63b3480d8f..f9696d7a91 100644
--- a/libavcodec/x86/exrdsp_init.c
+++ b/libavcodec/x86/exrdsp_init.c
@@ -34,6 +34,7 @@ void ff_predictor_avx2(uint8_t *src, ptrdiff_t size);
 
 av_cold void ff_exrdsp_init_x86(ExrDSPContext *dsp)
 {
+#if HAVE_X86ASM
     int cpu_flags = av_get_cpu_flags();
 
     if (EXTERNAL_SSE2(cpu_flags)) {
@@ -49,4 +50,5 @@ av_cold void ff_exrdsp_init_x86(ExrDSPContext *dsp)
         dsp->reorder_pixels = ff_reorder_pixels_avx2;
         dsp->predictor      = ff_predictor_avx2;
     }
+#endif /* HAVE_X86ASM */
 }
diff --git a/libavcodec/x86/fft_init.c b/libavcodec/x86/fft_init.c
index df79d57dc7..065e231edb 100644
--- a/libavcodec/x86/fft_init.c
+++ b/libavcodec/x86/fft_init.c
@@ -26,6 +26,7 @@
 
 av_cold void ff_fft_init_x86(FFTContext *s)
 {
+#if HAVE_X86ASM
     int cpu_flags = av_get_cpu_flags();
 
     if (s->nbits > 16)
@@ -44,4 +45,5 @@ av_cold void ff_fft_init_x86(FFTContext *s)
         s->fft_calc        = ff_fft_calc_avx;
         s->fft_permutation = FF_FFT_PERM_AVX;
     }
+#endif /* HAVE_X86ASM */
 }
diff --git a/libavcodec/x86/g722dsp_init.c b/libavcodec/x86/g722dsp_init.c
index 614695193b..700269d62a 100644
--- a/libavcodec/x86/g722dsp_init.c
+++ b/libavcodec/x86/g722dsp_init.c
@@ -28,8 +28,10 @@ void ff_g722_apply_qmf_sse2(const int16_t *prev_samples, int xout[2]);
 
 av_cold void ff_g722dsp_init_x86(G722DSPContext *dsp)
 {
+#if HAVE_X86ASM
     int cpu_flags = av_get_cpu_flags();
 
     if (EXTERNAL_SSE2(cpu_flags))
         dsp->apply_qmf = ff_g722_apply_qmf_sse2;
+#endif /* HAVE_X86ASM */
 }
diff --git a/libavcodec/x86/h263dsp_init.c b/libavcodec/x86/h263dsp_init.c
index ab81063233..57ec1640e3 100644
--- a/libavcodec/x86/h263dsp_init.c
+++ b/libavcodec/x86/h263dsp_init.c
@@ -30,10 +30,12 @@ void ff_h263_v_loop_filter_mmx(uint8_t *src, int stride, int qscale);
 
 av_cold void ff_h263dsp_init_x86(H263DSPContext *c)
 {
+#if HAVE_X86ASM
     int cpu_flags = av_get_cpu_flags();
 
     if (EXTERNAL_MMX(cpu_flags)) {
         c->h263_h_loop_filter = ff_h263_h_loop_filter_mmx;
         c->h263_v_loop_filter = ff_h263_v_loop_filter_mmx;
     }
+#endif /* HAVE_X86ASM */
 }
diff --git a/libavcodec/x86/h264_intrapred_init.c b/libavcodec/x86/h264_intrapred_init.c
index ee46927a24..5518961784 100644
--- a/libavcodec/x86/h264_intrapred_init.c
+++ b/libavcodec/x86/h264_intrapred_init.c
@@ -160,6 +160,7 @@ av_cold void ff_h264_pred_init_x86(H264PredContext *h, int codec_id,
                                    const int bit_depth,
                                    const int chroma_format_idc)
 {
+#if HAVE_X86ASM
     int cpu_flags = av_get_cpu_flags();
 
     if (bit_depth == 8) {
@@ -333,4 +334,5 @@ av_cold void ff_h264_pred_init_x86(H264PredContext *h, int codec_id,
             h->pred8x8l[HOR_UP_PRED         ] = ff_pred8x8l_horizontal_up_10_avx;
         }
     }
+#endif /* HAVE_X86ASM */
 }
diff --git a/libavcodec/x86/h264chroma_init.c b/libavcodec/x86/h264chroma_init.c
index 34934b6ad0..57d92ad107 100644
--- a/libavcodec/x86/h264chroma_init.c
+++ b/libavcodec/x86/h264chroma_init.c
@@ -65,6 +65,7 @@ CHROMA_MC(avg, 8, 10, avx)
 
 av_cold void ff_h264chroma_init_x86(H264ChromaContext *c, int bit_depth)
 {
+#if HAVE_X86ASM
     int high_bit_depth = bit_depth > 8;
     int cpu_flags      = av_get_cpu_flags();
 
@@ -105,4 +106,5 @@ av_cold void ff_h264chroma_init_x86(H264ChromaContext *c, int bit_depth)
         c->put_h264_chroma_pixels_tab[0] = ff_put_h264_chroma_mc8_10_avx;
         c->avg_h264_chroma_pixels_tab[0] = ff_avg_h264_chroma_mc8_10_avx;
     }
+#endif /* HAVE_X86ASM */
 }
diff --git a/libavcodec/x86/hevcdsp_init.c b/libavcodec/x86/hevcdsp_init.c
index c7060085a2..29c11246ae 100644
--- a/libavcodec/x86/hevcdsp_init.c
+++ b/libavcodec/x86/hevcdsp_init.c
@@ -699,6 +699,7 @@ SAO_EDGE_FILTER_FUNCS(12, avx2)
 
 void ff_hevc_dsp_init_x86(HEVCDSPContext *c, const int bit_depth)
 {
+#if HAVE_X86ASM
     int cpu_flags = av_get_cpu_flags();
 
     if (bit_depth == 8) {
@@ -1150,4 +1151,5 @@ void ff_hevc_dsp_init_x86(HEVCDSPContext *c, const int bit_depth)
             SAO_EDGE_INIT(12, avx2);
         }
     }
+#endif /* HAVE_X86ASM */
 }
diff --git a/libavcodec/x86/hpeldsp_init.c b/libavcodec/x86/hpeldsp_init.c
index 09c48c341e..d8f4e45849 100644
--- a/libavcodec/x86/hpeldsp_init.c
+++ b/libavcodec/x86/hpeldsp_init.c
@@ -224,6 +224,7 @@ av_cold void ff_hpeldsp_init_x86(HpelDSPContext *c, int flags)
 {
     int cpu_flags = av_get_cpu_flags();
 
+#if HAVE_X86ASM
     if (INLINE_MMX(cpu_flags))
         hpeldsp_init_mmx(c, flags);
 
@@ -235,6 +236,7 @@ av_cold void ff_hpeldsp_init_x86(HpelDSPContext *c, int flags)
 
     if (EXTERNAL_SSSE3(cpu_flags))
         hpeldsp_init_ssse3(c, flags);
+#endif
 
     if (CONFIG_VP3_DECODER)
         ff_hpeldsp_vp3_init_x86(c, cpu_flags, flags);
diff --git a/libavcodec/x86/hpeldsp_vp3_init.c b/libavcodec/x86/hpeldsp_vp3_init.c
index 1dbd1ba6f9..3dd6c45afa 100644
--- a/libavcodec/x86/hpeldsp_vp3_init.c
+++ b/libavcodec/x86/hpeldsp_vp3_init.c
@@ -34,10 +34,12 @@ void ff_put_no_rnd_pixels8_y2_exact_mmxext(uint8_t *block,
 
 av_cold void ff_hpeldsp_vp3_init_x86(HpelDSPContext *c, int cpu_flags, int flags)
 {
+#if HAVE_X86ASM
     if (EXTERNAL_MMXEXT(cpu_flags)) {
         if (flags & AV_CODEC_FLAG_BITEXACT) {
             c->put_no_rnd_pixels_tab[1][1] = ff_put_no_rnd_pixels8_x2_exact_mmxext;
             c->put_no_rnd_pixels_tab[1][2] = ff_put_no_rnd_pixels8_y2_exact_mmxext;
         }
     }
+#endif /* HAVE_X86ASM */
 }
diff --git a/libavcodec/x86/huffyuvdsp_init.c b/libavcodec/x86/huffyuvdsp_init.c
index 239d3ca313..445137da87 100644
--- a/libavcodec/x86/huffyuvdsp_init.c
+++ b/libavcodec/x86/huffyuvdsp_init.c
@@ -35,6 +35,7 @@ void ff_add_hfyu_median_pred_int16_mmxext(uint16_t *dst, const uint16_t *top, co
 
 av_cold void ff_huffyuvdsp_init_x86(HuffYUVDSPContext *c, enum AVPixelFormat pix_fmt)
 {
+#if HAVE_X86ASM
     int cpu_flags = av_get_cpu_flags();
     const AVPixFmtDescriptor *pix_desc = av_pix_fmt_desc_get(pix_fmt);
 
@@ -50,4 +51,5 @@ av_cold void ff_huffyuvdsp_init_x86(HuffYUVDSPContext *c, enum AVPixelFormat pix
     if (EXTERNAL_AVX2_FAST(cpu_flags)) {
         c->add_int16 = ff_add_int16_avx2;
     }
+#endif
 }
diff --git a/libavcodec/x86/huffyuvencdsp_init.c b/libavcodec/x86/huffyuvencdsp_init.c
index c9c33b75b4..35d18a040c 100644
--- a/libavcodec/x86/huffyuvencdsp_init.c
+++ b/libavcodec/x86/huffyuvencdsp_init.c
@@ -37,6 +37,7 @@ void ff_sub_hfyu_median_pred_int16_mmxext(uint16_t *dst, const uint16_t *src1, c
 
 av_cold void ff_huffyuvencdsp_init_x86(HuffYUVEncDSPContext *c, enum AVPixelFormat pix_fmt)
 {
+#if HAVE_X86ASM
     av_unused int cpu_flags = av_get_cpu_flags();
     const AVPixFmtDescriptor *pix_desc = av_pix_fmt_desc_get(pix_fmt);
 
@@ -51,4 +52,5 @@ av_cold void ff_huffyuvencdsp_init_x86(HuffYUVEncDSPContext *c, enum AVPixelForm
     if (EXTERNAL_AVX2_FAST(cpu_flags)) {
         c->diff_int16 = ff_diff_int16_avx2;
     }
+#endif
 }
diff --git a/libavcodec/x86/idctdsp_init.c b/libavcodec/x86/idctdsp_init.c
index 4ade52a880..3f74da85cd 100644
--- a/libavcodec/x86/idctdsp_init.c
+++ b/libavcodec/x86/idctdsp_init.c
@@ -61,6 +61,7 @@ av_cold int ff_init_scantable_permutation_x86(uint8_t *idct_permutation,
 av_cold void ff_idctdsp_init_x86(IDCTDSPContext *c, AVCodecContext *avctx,
                                  unsigned high_bit_depth)
 {
+#if HAVE_X86ASM
     int cpu_flags = av_get_cpu_flags();
 
 #if ARCH_X86_32
@@ -159,4 +160,5 @@ av_cold void ff_idctdsp_init_x86(IDCTDSPContext *c, AVCodecContext *avctx,
         }
     }
 #endif
+#endif /* HAVE_X86ASM */
 }
diff --git a/libavcodec/x86/jpeg2000dsp_init.c b/libavcodec/x86/jpeg2000dsp_init.c
index 7310a1d0e1..0256be8046 100644
--- a/libavcodec/x86/jpeg2000dsp_init.c
+++ b/libavcodec/x86/jpeg2000dsp_init.c
@@ -33,6 +33,7 @@ void ff_rct_int_avx2 (void *src0, void *src1, void *src2, int csize);
 
 av_cold void ff_jpeg2000dsp_init_x86(Jpeg2000DSPContext *c)
 {
+#if HAVE_X86ASM
     int cpu_flags = av_get_cpu_flags();
     if (EXTERNAL_SSE(cpu_flags)) {
         c->mct_decode[FF_DWT97] = ff_ict_float_sse;
@@ -57,4 +58,5 @@ av_cold void ff_jpeg2000dsp_init_x86(Jpeg2000DSPContext *c)
     if (EXTERNAL_AVX2_FAST(cpu_flags)) {
         c->mct_decode[FF_DWT53] = ff_rct_int_avx2;
     }
+#endif /* HAVE_X86ASM */
 }
diff --git a/libavcodec/x86/lossless_videodsp_init.c b/libavcodec/x86/lossless_videodsp_init.c
index 5690cacaad..720cf98389 100644
--- a/libavcodec/x86/lossless_videodsp_init.c
+++ b/libavcodec/x86/lossless_videodsp_init.c
@@ -46,6 +46,7 @@ void ff_llviddsp_init_x86(LLVidDSPContext *c)
 {
     int cpu_flags = av_get_cpu_flags();
 
+#if HAVE_X86ASM
     if (EXTERNAL_SSE2(cpu_flags)) {
         c->add_bytes       = ff_add_bytes_sse2;
         c->add_median_pred = ff_add_median_pred_sse2;
@@ -67,4 +68,5 @@ void ff_llviddsp_init_x86(LLVidDSPContext *c)
         c->add_left_pred   = ff_add_left_pred_unaligned_avx2;
         c->add_gradient_pred = ff_add_gradient_pred_avx2;
     }
+#endif /* HAVE_X86ASM */
 }
diff --git a/libavcodec/x86/lossless_videoencdsp_init.c b/libavcodec/x86/lossless_videoencdsp_init.c
index 22a4014ef1..26cfcbb4b2 100644
--- a/libavcodec/x86/lossless_videoencdsp_init.c
+++ b/libavcodec/x86/lossless_videoencdsp_init.c
@@ -91,6 +91,7 @@ av_cold void ff_llvidencdsp_init_x86(LLVidEncDSPContext *c)
     }
 #endif /* HAVE_INLINE_ASM */
 
+#if HAVE_X86ASM
     if (EXTERNAL_SSE2(cpu_flags)) {
         c->diff_bytes = ff_diff_bytes_sse2;
     }
@@ -102,4 +103,5 @@ av_cold void ff_llvidencdsp_init_x86(LLVidEncDSPContext *c)
     if (EXTERNAL_AVX2_FAST(cpu_flags)) {
         c->diff_bytes = ff_diff_bytes_avx2;
     }
+#endif /* HAVE_X86ASM */
 }
diff --git a/libavcodec/x86/mdct15_init.c b/libavcodec/x86/mdct15_init.c
index ea7301e1e7..25653013a5 100644
--- a/libavcodec/x86/mdct15_init.c
+++ b/libavcodec/x86/mdct15_init.c
@@ -84,6 +84,7 @@ static void perm_twiddles(MDCT15Context *s)
 av_cold void ff_mdct15_init_x86(MDCT15Context *s)
 {
     int adjust_twiddles = 0;
+#if HAVE_X86ASM
     int cpu_flags = av_get_cpu_flags();
 
     if (EXTERNAL_SSE3(cpu_flags))
@@ -98,6 +99,7 @@ av_cold void ff_mdct15_init_x86(MDCT15Context *s)
     if (EXTERNAL_AVX2_FAST(cpu_flags))
         s->postreindex = ff_mdct15_postreindex_avx2;
 #endif
+#endif /* HAVE_X86ASM */
 
     if (adjust_twiddles)
         perm_twiddles(s);
diff --git a/libavcodec/x86/me_cmp_init.c b/libavcodec/x86/me_cmp_init.c
index bc1051c27e..527fdff4a9 100644
--- a/libavcodec/x86/me_cmp_init.c
+++ b/libavcodec/x86/me_cmp_init.c
@@ -242,6 +242,7 @@ av_cold void ff_me_cmp_init_x86(MECmpContext *c, AVCodecContext *avctx)
 
 #endif /* HAVE_INLINE_ASM */
 
+#if HAVE_X86ASM
     if (EXTERNAL_MMX(cpu_flags)) {
         c->sse[1]            = ff_sse8_mmx;
 #if HAVE_X86ASM
@@ -307,4 +308,5 @@ av_cold void ff_me_cmp_init_x86(MECmpContext *c, AVCodecContext *avctx)
         c->hadamard8_diff[1] = ff_hadamard8_diff_ssse3;
 #endif
     }
+#endif /* HAVE_X86ASM */
 }
diff --git a/libavcodec/x86/mlpdsp_init.c b/libavcodec/x86/mlpdsp_init.c
index 333a685f47..f7eca8cb76 100644
--- a/libavcodec/x86/mlpdsp_init.c
+++ b/libavcodec/x86/mlpdsp_init.c
@@ -200,10 +200,12 @@ av_cold void ff_mlpdsp_init_x86(MLPDSPContext *c)
     if (INLINE_MMX(cpu_flags))
         c->mlp_filter_channel = mlp_filter_channel_x86;
 #endif
+#if HAVE_X86ASM
 #if ARCH_X86_64
     if (EXTERNAL_SSE4(cpu_flags))
         c->mlp_rematrix_channel = ff_mlp_rematrix_channel_sse4;
     if (EXTERNAL_AVX2_FAST(cpu_flags) && cpu_flags & AV_CPU_FLAG_BMI2)
         c->mlp_rematrix_channel = ff_mlp_rematrix_channel_avx2_bmi2;
 #endif
+#endif /* HAVE_X86ASM */
 }
diff --git a/libavcodec/x86/mpegvideoencdsp_init.c b/libavcodec/x86/mpegvideoencdsp_init.c
index ec174b15aa..82f9df4cba 100644
--- a/libavcodec/x86/mpegvideoencdsp_init.c
+++ b/libavcodec/x86/mpegvideoencdsp_init.c
@@ -216,6 +216,7 @@ av_cold void ff_mpegvideoencdsp_init_x86(MpegvideoEncDSPContext *c,
 {
     int cpu_flags = av_get_cpu_flags();
 
+#if HAVE_X86ASM
     if (EXTERNAL_SSE2(cpu_flags)) {
         c->pix_sum     = ff_pix_sum16_sse2;
         c->pix_norm1   = ff_pix_norm1_sse2;
@@ -224,6 +225,7 @@ av_cold void ff_mpegvideoencdsp_init_x86(MpegvideoEncDSPContext *c,
     if (EXTERNAL_XOP(cpu_flags)) {
         c->pix_sum     = ff_pix_sum16_xop;
     }
+#endif /* HAVE_X86ASM */
 
 #if HAVE_INLINE_ASM
 
diff --git a/libavcodec/x86/opusdsp_init.c b/libavcodec/x86/opusdsp_init.c
index 582fbb4f0c..4598657116 100644
--- a/libavcodec/x86/opusdsp_init.c
+++ b/libavcodec/x86/opusdsp_init.c
@@ -27,10 +27,12 @@ float ff_opus_deemphasis_fma3(float *out, float *in, float coeff, int len);
 
 av_cold void ff_opus_dsp_init_x86(OpusDSP *ctx)
 {
+#if HAVE_X86ASM
     int cpu_flags = av_get_cpu_flags();
 
     if (EXTERNAL_FMA3(cpu_flags)) {
         ctx->postfilter = ff_opus_postfilter_fma3;
         ctx->deemphasis = ff_opus_deemphasis_fma3;
     }
+#endif /* HAVE_X86ASM */
 }
diff --git a/libavcodec/x86/pixblockdsp_init.c b/libavcodec/x86/pixblockdsp_init.c
index 51f2a0033a..9d3aac4c74 100644
--- a/libavcodec/x86/pixblockdsp_init.c
+++ b/libavcodec/x86/pixblockdsp_init.c
@@ -31,6 +31,7 @@ av_cold void ff_pixblockdsp_init_x86(PixblockDSPContext *c,
                                      AVCodecContext *avctx,
                                      unsigned high_bit_depth)
 {
+#if HAVE_X86ASM
     int cpu_flags = av_get_cpu_flags();
 
     if (EXTERNAL_SSE2(cpu_flags)) {
@@ -41,4 +42,5 @@ av_cold void ff_pixblockdsp_init_x86(PixblockDSPContext *c,
         c->diff_pixels_unaligned =
         c->diff_pixels = ff_diff_pixels_sse2;
     }
+#endif /* HAVE_X86ASM */
 }
diff --git a/libavcodec/x86/pngdsp_init.c b/libavcodec/x86/pngdsp_init.c
index e2cd5effe3..c6562f7abb 100644
--- a/libavcodec/x86/pngdsp_init.c
+++ b/libavcodec/x86/pngdsp_init.c
@@ -33,6 +33,7 @@ void ff_add_bytes_l2_sse2(uint8_t *dst, uint8_t *src1,
 
 av_cold void ff_pngdsp_init_x86(PNGDSPContext *dsp)
 {
+#if HAVE_X86ASM
     int cpu_flags = av_get_cpu_flags();
 
     if (EXTERNAL_MMXEXT(cpu_flags))
@@ -41,4 +42,5 @@ av_cold void ff_pngdsp_init_x86(PNGDSPContext *dsp)
         dsp->add_bytes_l2         = ff_add_bytes_l2_sse2;
     if (EXTERNAL_SSSE3(cpu_flags))
         dsp->add_paeth_prediction = ff_add_png_paeth_prediction_ssse3;
+#endif /* HAVE_X86ASM */
 }
diff --git a/libavcodec/x86/proresdsp_init.c b/libavcodec/x86/proresdsp_init.c
index bde79ab8c0..01e5e67236 100644
--- a/libavcodec/x86/proresdsp_init.c
+++ b/libavcodec/x86/proresdsp_init.c
@@ -32,6 +32,7 @@ void ff_prores_idct_put_10_avx (uint16_t *dst, ptrdiff_t linesize,
 
 av_cold void ff_proresdsp_init_x86(ProresDSPContext *dsp, AVCodecContext *avctx)
 {
+#if HAVE_X86ASM
 #if ARCH_X86_64
     int cpu_flags = av_get_cpu_flags();
 
@@ -47,4 +48,5 @@ av_cold void ff_proresdsp_init_x86(ProresDSPContext *dsp, AVCodecContext *avctx)
         }
     }
 #endif /* ARCH_X86_64 */
+#endif /* HAVE_X86ASM */
 }
diff --git a/libavcodec/x86/rv34dsp_init.c b/libavcodec/x86/rv34dsp_init.c
index caa5c2d653..f76bef39e1 100644
--- a/libavcodec/x86/rv34dsp_init.c
+++ b/libavcodec/x86/rv34dsp_init.c
@@ -32,6 +32,7 @@ void ff_rv34_idct_add_mmxext(uint8_t *dst, ptrdiff_t stride, int16_t *block);
 
 av_cold void ff_rv34dsp_init_x86(RV34DSPContext* c)
 {
+#if HAVE_X86ASM
     int cpu_flags = av_get_cpu_flags();
 
     if (EXTERNAL_MMXEXT(cpu_flags)) {
@@ -42,4 +43,5 @@ av_cold void ff_rv34dsp_init_x86(RV34DSPContext* c)
         c->rv34_idct_dc_add = ff_rv34_idct_dc_add_sse2;
     if (EXTERNAL_SSE4(cpu_flags))
         c->rv34_idct_dc_add = ff_rv34_idct_dc_add_sse4;
+#endif /* HAVE_X86ASM */
 }
diff --git a/libavcodec/x86/sbcdsp_init.c b/libavcodec/x86/sbcdsp_init.c
index 7416a86ac6..79914cc565 100644
--- a/libavcodec/x86/sbcdsp_init.c
+++ b/libavcodec/x86/sbcdsp_init.c
@@ -42,6 +42,7 @@ void ff_sbc_calc_scalefactors_mmx(int32_t sb_sample_f[16][2][8],
 
 av_cold void ff_sbcdsp_init_x86(SBCDSPContext *s)
 {
+#if HAVE_X86ASM
     int cpu_flags = av_get_cpu_flags();
 
     if (EXTERNAL_MMX(cpu_flags)) {
@@ -49,4 +50,5 @@ av_cold void ff_sbcdsp_init_x86(SBCDSPContext *s)
         s->sbc_analyze_8 = ff_sbc_analyze_8_mmx;
         s->sbc_calc_scalefactors = ff_sbc_calc_scalefactors_mmx;
     }
+#endif /* HAVE_X86ASM */
 }
diff --git a/libavcodec/x86/sbrdsp_init.c b/libavcodec/x86/sbrdsp_init.c
index 999f681220..d70ffa0d6c 100644
--- a/libavcodec/x86/sbrdsp_init.c
+++ b/libavcodec/x86/sbrdsp_init.c
@@ -57,6 +57,7 @@ void ff_sbr_autocorrelate_sse3(const float x[40][2], float phi[3][2][2]);
 
 av_cold void ff_sbrdsp_init_x86(SBRDSPContext *s)
 {
+#if HAVE_X86ASM
     int cpu_flags = av_get_cpu_flags();
 
     if (EXTERNAL_SSE(cpu_flags)) {
@@ -82,4 +83,5 @@ av_cold void ff_sbrdsp_init_x86(SBRDSPContext *s)
     if (EXTERNAL_SSE3(cpu_flags)) {
         s->autocorrelate = ff_sbr_autocorrelate_sse3;
     }
+#endif /* HAVE_X86ASM */
 }
diff --git a/libavcodec/x86/svq1enc_init.c b/libavcodec/x86/svq1enc_init.c
index daf573beba..c016811822 100644
--- a/libavcodec/x86/svq1enc_init.c
+++ b/libavcodec/x86/svq1enc_init.c
@@ -29,9 +29,11 @@ int ff_ssd_int8_vs_int16_sse2(const int8_t *pix1, const int16_t *pix2,
 
 av_cold void ff_svq1enc_init_x86(SVQ1EncDSPContext *c)
 {
+#if HAVE_X86ASM
     int cpu_flags = av_get_cpu_flags();
 
     if (EXTERNAL_SSE2(cpu_flags)) {
         c->ssd_int8_vs_int16 = ff_ssd_int8_vs_int16_sse2;
     }
+#endif /* HAVE_X86ASM */
 }
diff --git a/libavcodec/x86/utvideodsp_init.c b/libavcodec/x86/utvideodsp_init.c
index 2b436c6c5c..e81f6bf3c0 100644
--- a/libavcodec/x86/utvideodsp_init.c
+++ b/libavcodec/x86/utvideodsp_init.c
@@ -41,6 +41,7 @@ void ff_restore_rgb_planes10_avx2(uint16_t *src_r, uint16_t *src_g, uint16_t *sr
 
 av_cold void ff_utvideodsp_init_x86(UTVideoDSPContext *c)
 {
+#if HAVE_X86ASM
     int cpu_flags = av_get_cpu_flags();
 
     if (EXTERNAL_SSE2(cpu_flags)) {
@@ -51,4 +52,5 @@ av_cold void ff_utvideodsp_init_x86(UTVideoDSPContext *c)
         c->restore_rgb_planes   = ff_restore_rgb_planes_avx2;
         c->restore_rgb_planes10 = ff_restore_rgb_planes10_avx2;
     }
+#endif /* HAVE_X86ASM */
 }
diff --git a/libavcodec/x86/v210enc_init.c b/libavcodec/x86/v210enc_init.c
index 13a351dd1d..542bfe8b8a 100644
--- a/libavcodec/x86/v210enc_init.c
+++ b/libavcodec/x86/v210enc_init.c
@@ -36,6 +36,7 @@ void ff_v210_planar_pack_10_avx2(const uint16_t *y, const uint16_t *u,
 
 av_cold void ff_v210enc_init_x86(V210EncContext *s)
 {
+#if HAVE_X86ASM
     int cpu_flags = av_get_cpu_flags();
 
     if (EXTERNAL_SSSE3(cpu_flags)) {
@@ -52,4 +53,5 @@ av_cold void ff_v210enc_init_x86(V210EncContext *s)
         s->sample_factor_10 = 2;
         s->pack_line_10     = ff_v210_planar_pack_10_avx2;
     }
+#endif /* HAVE_X86ASM */
 }
diff --git a/libavcodec/x86/vorbisdsp_init.c b/libavcodec/x86/vorbisdsp_init.c
index 08a3bb2965..067b92e2a4 100644
--- a/libavcodec/x86/vorbisdsp_init.c
+++ b/libavcodec/x86/vorbisdsp_init.c
@@ -29,8 +29,10 @@ void ff_vorbis_inverse_coupling_sse(float *mag, float *ang,
 
 av_cold void ff_vorbisdsp_init_x86(VorbisDSPContext *dsp)
 {
+#if HAVE_X86ASM
     int cpu_flags = av_get_cpu_flags();
 
     if (EXTERNAL_SSE(cpu_flags))
         dsp->vorbis_inverse_coupling = ff_vorbis_inverse_coupling_sse;
+#endif /* HAVE_X86ASM */
 }
diff --git a/libavcodec/x86/vp3dsp_init.c b/libavcodec/x86/vp3dsp_init.c
index f54fa57b3e..7d69956d22 100644
--- a/libavcodec/x86/vp3dsp_init.c
+++ b/libavcodec/x86/vp3dsp_init.c
@@ -42,6 +42,7 @@ void ff_put_vp_no_rnd_pixels8_l2_mmx(uint8_t *dst, const uint8_t *a,
 
 av_cold void ff_vp3dsp_init_x86(VP3DSPContext *c, int flags)
 {
+#if HAVE_X86ASM
     int cpu_flags = av_get_cpu_flags();
 
     if (EXTERNAL_MMX(cpu_flags)) {
@@ -61,4 +62,5 @@ av_cold void ff_vp3dsp_init_x86(VP3DSPContext *c, int flags)
         c->idct_put  = ff_vp3_idct_put_sse2;
         c->idct_add  = ff_vp3_idct_add_sse2;
     }
+#endif /* HAVE_X86ASM */
 }
diff --git a/libavcodec/x86/vp6dsp_init.c b/libavcodec/x86/vp6dsp_init.c
index 83d45ec36c..6a3bf36bae 100644
--- a/libavcodec/x86/vp6dsp_init.c
+++ b/libavcodec/x86/vp6dsp_init.c
@@ -30,9 +30,11 @@ void ff_vp6_filter_diag4_sse2(uint8_t *dst, uint8_t *src, ptrdiff_t stride,
 
 av_cold void ff_vp6dsp_init_x86(VP56DSPContext *c)
 {
+#if HAVE_X86ASM
     int cpu_flags = av_get_cpu_flags();
 
     if (EXTERNAL_SSE2(cpu_flags)) {
         c->vp6_filter_diag4 = ff_vp6_filter_diag4_sse2;
     }
+#endif /* HAVE_X86ASM */
 }
diff --git a/libavfilter/x86/af_afir_init.c b/libavfilter/x86/af_afir_init.c
index e53817b9c0..3561d9fe3f 100644
--- a/libavfilter/x86/af_afir_init.c
+++ b/libavfilter/x86/af_afir_init.c
@@ -29,6 +29,7 @@ void ff_fcmul_add_avx(float *sum, const float *t, const float *c,
 
 av_cold void ff_afir_init_x86(AudioFIRDSPContext *s)
 {
+#if HAVE_X86ASM
     int cpu_flags = av_get_cpu_flags();
 
     if (EXTERNAL_SSE3(cpu_flags)) {
@@ -37,4 +38,5 @@ av_cold void ff_afir_init_x86(AudioFIRDSPContext *s)
     if (EXTERNAL_AVX_FAST(cpu_flags)) {
         s->fcmul_add = ff_fcmul_add_avx;
     }
+#endif /* HAVE_X86ASM */
 }
diff --git a/libavfilter/x86/af_anlmdn_init.c b/libavfilter/x86/af_anlmdn_init.c
index 30eff6f644..047d88b795 100644
--- a/libavfilter/x86/af_anlmdn_init.c
+++ b/libavfilter/x86/af_anlmdn_init.c
@@ -27,9 +27,11 @@ float ff_compute_distance_ssd_sse(const float *f1, const float *f2,
 
 av_cold void ff_anlmdn_init_x86(AudioNLMDNDSPContext *s)
 {
+#if HAVE_X86ASM
     int cpu_flags = av_get_cpu_flags();
 
     if (EXTERNAL_SSE(cpu_flags)) {
         s->compute_distance_ssd = ff_compute_distance_ssd_sse;
     }
+#endif /* HAVE_X86ASM */
 }
diff --git a/libavfilter/x86/af_volume_init.c b/libavfilter/x86/af_volume_init.c
index 88f5a9679a..28cfbe1ce1 100644
--- a/libavfilter/x86/af_volume_init.c
+++ b/libavfilter/x86/af_volume_init.c
@@ -35,6 +35,7 @@ void ff_scale_samples_s32_avx(uint8_t *dst, const uint8_t *src, int len,
 
 av_cold void ff_volume_init_x86(VolumeContext *vol)
 {
+#if HAVE_X86ASM
     int cpu_flags = av_get_cpu_flags();
     enum AVSampleFormat sample_fmt = av_get_packed_sample_fmt(vol->sample_fmt);
 
@@ -57,4 +58,5 @@ av_cold void ff_volume_init_x86(VolumeContext *vol)
             vol->samples_align = 8;
         }
     }
+#endif /* HAVE_X86ASM */
 }
diff --git a/libavfilter/x86/avf_showcqt_init.c b/libavfilter/x86/avf_showcqt_init.c
index 2320b30239..1a5534a12e 100644
--- a/libavfilter/x86/avf_showcqt_init.c
+++ b/libavfilter/x86/avf_showcqt_init.c
@@ -46,6 +46,7 @@ static void permute_coeffs_01452367(float *v, int len)
 
 av_cold void ff_showcqt_init_x86(ShowCQTContext *s)
 {
+#if HAVE_X86ASM
     int cpuflags = av_get_cpu_flags();
 
 #define SELECT_CQT_CALC(type, TYPE, align, perm) \
@@ -60,4 +61,5 @@ if (EXTERNAL_##TYPE(cpuflags)) { \
     SELECT_CQT_CALC(fma4, FMA4, 4, 0); // using xmm
     SELECT_CQT_CALC(avx,  AVX_FAST,  8, 01452367);
     SELECT_CQT_CALC(fma3, FMA3_FAST, 8, 01452367);
+#endif /* HAVE_X86ASM */
 }
diff --git a/libavfilter/x86/colorspacedsp_init.c b/libavfilter/x86/colorspacedsp_init.c
index f01db4baf4..66c25cb361 100644
--- a/libavfilter/x86/colorspacedsp_init.c
+++ b/libavfilter/x86/colorspacedsp_init.c
@@ -78,6 +78,7 @@ void ff_multiply3x3_sse2(int16_t *data[3], ptrdiff_t stride, int w, int h,
 
 void ff_colorspacedsp_x86_init(ColorSpaceDSPContext *dsp)
 {
+#if HAVE_X86ASM
     int cpu_flags = av_get_cpu_flags();
 
 #if ARCH_X86_64
@@ -118,4 +119,5 @@ void ff_colorspacedsp_x86_init(ColorSpaceDSPContext *dsp)
         dsp->multiply3x3 = ff_multiply3x3_sse2;
     }
 #endif
+#endif /* HAVE_X86ASM */
 }
diff --git a/libavfilter/x86/vf_atadenoise_init.c b/libavfilter/x86/vf_atadenoise_init.c
index eb621e172c..8ec98f1a82 100644
--- a/libavfilter/x86/vf_atadenoise_init.c
+++ b/libavfilter/x86/vf_atadenoise_init.c
@@ -36,6 +36,7 @@ void ff_atadenoise_filter_row8_serial_sse4(const uint8_t *src, uint8_t *dst,
 
 av_cold void ff_atadenoise_init_x86(ATADenoiseDSPContext *dsp, int depth, int algorithm, const float *sigma)
 {
+#if HAVE_X86ASM
     int cpu_flags = av_get_cpu_flags();
 
     for (int p = 0; p < 4; p++) {
@@ -49,4 +50,5 @@ av_cold void ff_atadenoise_init_x86(ATADenoiseDSPContext *dsp, int depth, int al
         }
 #endif
     }
+#endif /* HAVE_X86ASM */
 }
diff --git a/libavfilter/x86/vf_blend_init.c b/libavfilter/x86/vf_blend_init.c
index c326c43362..6d57bf7eac 100644
--- a/libavfilter/x86/vf_blend_init.c
+++ b/libavfilter/x86/vf_blend_init.c
@@ -102,6 +102,7 @@ BLEND_FUNC(xor_16, avx2)
 
 av_cold void ff_blend_init_x86(FilterParams *param, int depth)
 {
+#if HAVE_X86ASM
     int cpu_flags = av_get_cpu_flags();
 
     if (depth == 8) {
@@ -200,4 +201,5 @@ av_cold void ff_blend_init_x86(FilterParams *param, int depth)
         }
 #endif /* ARCH_X86_64 */
     }
+#endif /* HAVE_X86ASM */
 }
diff --git a/libavfilter/x86/vf_bwdif_init.c b/libavfilter/x86/vf_bwdif_init.c
index e24e5cd9b1..ec0ee6af85 100644
--- a/libavfilter/x86/vf_bwdif_init.c
+++ b/libavfilter/x86/vf_bwdif_init.c
@@ -44,6 +44,7 @@ void ff_bwdif_filter_line_12bit_ssse3(void *dst, void *prev, void *cur, void *ne
 
 av_cold void ff_bwdif_init_x86(BWDIFContext *bwdif)
 {
+#if HAVE_X86ASM
     YADIFContext *yadif = &bwdif->yadif;
     int cpu_flags = av_get_cpu_flags();
     int bit_depth = (!yadif->csp) ? 8 : yadif->csp->comp[0].depth;
@@ -59,4 +60,5 @@ av_cold void ff_bwdif_init_x86(BWDIFContext *bwdif)
         if (EXTERNAL_SSSE3(cpu_flags))
             bwdif->filter_line = ff_bwdif_filter_line_12bit_ssse3;
     }
+#endif /* HAVE_X86ASM */
 }
diff --git a/libavfilter/x86/vf_convolution_init.c b/libavfilter/x86/vf_convolution_init.c
index b78a47d02b..fc9cd49de7 100644
--- a/libavfilter/x86/vf_convolution_init.c
+++ b/libavfilter/x86/vf_convolution_init.c
@@ -31,6 +31,7 @@ void ff_filter_3x3_sse4(uint8_t *dst, int width,
 
 av_cold void ff_convolution_init_x86(ConvolutionContext *s)
 {
+#if HAVE_X86ASM
 #if ARCH_X86_64
     int i;
     int cpu_flags = av_get_cpu_flags();
@@ -43,4 +44,5 @@ av_cold void ff_convolution_init_x86(ConvolutionContext *s)
         }
     }
 #endif
+#endif /* HAVE_X86ASM */
 }
diff --git a/libavfilter/x86/vf_framerate_init.c b/libavfilter/x86/vf_framerate_init.c
index 9d40faf0a4..b4a9dc574d 100644
--- a/libavfilter/x86/vf_framerate_init.c
+++ b/libavfilter/x86/vf_framerate_init.c
@@ -27,6 +27,7 @@ void ff_blend_frames16_avx2(BLEND_FUNC_PARAMS);
 
 void ff_framerate_init_x86(FrameRateContext *s)
 {
+#if HAVE_X86ASM
     int cpu_flags = av_get_cpu_flags();
     if (s->bitdepth == 8) {
         if (EXTERNAL_AVX2_FAST(cpu_flags))
@@ -39,4 +40,5 @@ void ff_framerate_init_x86(FrameRateContext *s)
         else if (EXTERNAL_SSE4(cpu_flags))
             s->blend = ff_blend_frames16_sse4;
     }
+#endif /* HAVE_X86ASM */
 }
diff --git a/libavfilter/x86/vf_fspp_init.c b/libavfilter/x86/vf_fspp_init.c
index 8e00317cb7..3618b70dc3 100644
--- a/libavfilter/x86/vf_fspp_init.c
+++ b/libavfilter/x86/vf_fspp_init.c
@@ -36,6 +36,7 @@ void ff_row_fdct_mmx(int16_t *data, const uint8_t *pixels, ptrdiff_t line_size,
 
 av_cold void ff_fspp_init_x86(FSPPContext *s)
 {
+#if HAVE_X86ASM
     int cpu_flags = av_get_cpu_flags();
 
     if (EXTERNAL_MMX(cpu_flags)) {
@@ -46,4 +47,5 @@ av_cold void ff_fspp_init_x86(FSPPContext *s)
         s->row_idct     = ff_row_idct_mmx;
         s->row_fdct     = ff_row_fdct_mmx;
     }
+#endif /* HAVE_X86ASM */
 }
diff --git a/libavfilter/x86/vf_gblur_init.c b/libavfilter/x86/vf_gblur_init.c
index b47f6fbffb..01e1b82131 100644
--- a/libavfilter/x86/vf_gblur_init.c
+++ b/libavfilter/x86/vf_gblur_init.c
@@ -39,6 +39,7 @@ void ff_verti_slice_avx512(float *buffer, int width, int height, int column_begi
 
 av_cold void ff_gblur_init_x86(GBlurContext *s)
 {
+#if HAVE_X86ASM
     int cpu_flags = av_get_cpu_flags();
 
     if (EXTERNAL_SSE(cpu_flags)) {
@@ -70,4 +71,5 @@ av_cold void ff_gblur_init_x86(GBlurContext *s)
         }
     }
 #endif
+#endif /* HAVE_X86ASM */
 }
diff --git a/libavfilter/x86/vf_hflip_init.c b/libavfilter/x86/vf_hflip_init.c
index 0ac399b0d4..743b368ee9 100644
--- a/libavfilter/x86/vf_hflip_init.c
+++ b/libavfilter/x86/vf_hflip_init.c
@@ -30,6 +30,7 @@ void ff_hflip_short_avx2(const uint8_t *src, uint8_t *dst, int w);
 
 av_cold void ff_hflip_init_x86(FlipContext *s, int step[4], int nb_planes)
 {
+#if HAVE_X86ASM
     int cpu_flags = av_get_cpu_flags();
     int i;
 
@@ -50,4 +51,5 @@ av_cold void ff_hflip_init_x86(FlipContext *s, int step[4], int nb_planes)
             }
         }
     }
+#endif /* HAVE_X86ASM */
 }
diff --git a/libavfilter/x86/vf_limiter_init.c b/libavfilter/x86/vf_limiter_init.c
index 07c733dc21..2c26f90f0f 100644
--- a/libavfilter/x86/vf_limiter_init.c
+++ b/libavfilter/x86/vf_limiter_init.c
@@ -29,6 +29,7 @@ void ff_limiter_16bit_sse4(const uint8_t *src, uint8_t *dst,
 
 void ff_limiter_init_x86(LimiterDSPContext *dsp, int bpp)
 {
+#if HAVE_X86ASM
     int cpu_flags = av_get_cpu_flags();
 
     if (EXTERNAL_SSE2(cpu_flags)) {
@@ -41,4 +42,5 @@ void ff_limiter_init_x86(LimiterDSPContext *dsp, int bpp)
             dsp->limiter = ff_limiter_16bit_sse4;
         }
     }
+#endif /* HAVE_X86ASM */
 }
diff --git a/libavfilter/x86/vf_maskedclamp_init.c b/libavfilter/x86/vf_maskedclamp_init.c
index 2a5388abac..94217cf485 100644
--- a/libavfilter/x86/vf_maskedclamp_init.c
+++ b/libavfilter/x86/vf_maskedclamp_init.c
@@ -34,6 +34,7 @@ void ff_maskedclamp16_sse4(const uint8_t *bsrc, uint8_t *dst,
 
 av_cold void ff_maskedclamp_init_x86(MaskedClampDSPContext *dsp, int depth)
 {
+#if HAVE_X86ASM
     int cpu_flags = av_get_cpu_flags();
 
     if (EXTERNAL_SSE2(cpu_flags) && depth <= 8) {
@@ -43,4 +44,5 @@ av_cold void ff_maskedclamp_init_x86(MaskedClampDSPContext *dsp, int depth)
     if (EXTERNAL_SSE4(cpu_flags) && depth > 8) {
         dsp->maskedclamp = ff_maskedclamp16_sse4;
     }
+#endif /* HAVE_X86ASM */
 }
diff --git a/libavfilter/x86/vf_maskedmerge_init.c b/libavfilter/x86/vf_maskedmerge_init.c
index 73ab888083..2eee4a36c2 100644
--- a/libavfilter/x86/vf_maskedmerge_init.c
+++ b/libavfilter/x86/vf_maskedmerge_init.c
@@ -32,9 +32,11 @@ void ff_maskedmerge8_sse2(const uint8_t *bsrc, const uint8_t *osrc,
 
 av_cold void ff_maskedmerge_init_x86(MaskedMergeContext *s)
 {
+#if HAVE_X86ASM
     int cpu_flags = av_get_cpu_flags();
 
     if (EXTERNAL_SSE2(cpu_flags) && s->depth == 8) {
         s->maskedmerge = ff_maskedmerge8_sse2;
     }
+#endif /* HAVE_X86ASM */
 }
diff --git a/libavfilter/x86/vf_overlay_init.c b/libavfilter/x86/vf_overlay_init.c
index d4218b18f6..9f7d9c4909 100644
--- a/libavfilter/x86/vf_overlay_init.c
+++ b/libavfilter/x86/vf_overlay_init.c
@@ -35,6 +35,7 @@ int ff_overlay_row_22_sse4(uint8_t *d, uint8_t *da, uint8_t *s, uint8_t *a,
 av_cold void ff_overlay_init_x86(OverlayContext *s, int format, int pix_format,
                                  int alpha_format, int main_has_alpha)
 {
+#if HAVE_X86ASM
     int cpu_flags = av_get_cpu_flags();
 
     if (EXTERNAL_SSE4(cpu_flags) &&
@@ -62,4 +63,5 @@ av_cold void ff_overlay_init_x86(OverlayContext *s, int format, int pix_format,
         s->blend_row[1] = ff_overlay_row_22_sse4;
         s->blend_row[2] = ff_overlay_row_22_sse4;
     }
+#endif /* HAVE_X86ASM */
 }
diff --git a/libavfilter/x86/vf_pp7_init.c b/libavfilter/x86/vf_pp7_init.c
index 165b0dd5d0..ed5ab82794 100644
--- a/libavfilter/x86/vf_pp7_init.c
+++ b/libavfilter/x86/vf_pp7_init.c
@@ -27,8 +27,10 @@ void ff_pp7_dctB_mmx(int16_t *dst, int16_t *src);
 
 av_cold void ff_pp7_init_x86(PP7Context *p)
 {
+#if HAVE_X86ASM
     int cpu_flags = av_get_cpu_flags();
 
     if (EXTERNAL_MMX(cpu_flags))
         p->dctB = ff_pp7_dctB_mmx;
+#endif /* HAVE_X86ASM */
 }
diff --git a/libavfilter/x86/vf_psnr_init.c b/libavfilter/x86/vf_psnr_init.c
index c387812204..82be86d923 100644
--- a/libavfilter/x86/vf_psnr_init.c
+++ b/libavfilter/x86/vf_psnr_init.c
@@ -27,6 +27,7 @@ uint64_t ff_sse_line_16bit_sse2(const uint8_t *buf, const uint8_t *ref, int w);
 
 void ff_psnr_init_x86(PSNRDSPContext *dsp, int bpp)
 {
+#if HAVE_X86ASM
     int cpu_flags = av_get_cpu_flags();
 
     if (EXTERNAL_SSE2(cpu_flags)) {
@@ -36,4 +37,5 @@ void ff_psnr_init_x86(PSNRDSPContext *dsp, int bpp)
             dsp->sse_line = ff_sse_line_16bit_sse2;
         }
     }
+#endif /* HAVE_X86ASM */
 }
diff --git a/libavfilter/x86/vf_removegrain_init.c b/libavfilter/x86/vf_removegrain_init.c
index 07314b3244..ff5f4771d2 100644
--- a/libavfilter/x86/vf_removegrain_init.c
+++ b/libavfilter/x86/vf_removegrain_init.c
@@ -49,6 +49,7 @@ void ff_rg_fl_mode_24_sse2(uint8_t *dst, uint8_t *src, ptrdiff_t stride, int pix
 
 av_cold void ff_removegrain_init_x86(RemoveGrainContext *rg)
 {
+#if HAVE_X86ASM
 #if CONFIG_GPL
     int cpu_flags = av_get_cpu_flags();
     int i;
@@ -85,4 +86,5 @@ av_cold void ff_removegrain_init_x86(RemoveGrainContext *rg)
             }
     }
 #endif /* CONFIG_GPL */
+#endif /* HAVE_X86ASM */
 }
diff --git a/libavfilter/x86/vf_ssim_init.c b/libavfilter/x86/vf_ssim_init.c
index ddc91f791a..b5c55bd875 100644
--- a/libavfilter/x86/vf_ssim_init.c
+++ b/libavfilter/x86/vf_ssim_init.c
@@ -32,6 +32,7 @@ double ff_ssim_end_line_sse4(const int (*sum0)[4], const int (*sum1)[4], int w);
 
 void ff_ssim_init_x86(SSIMDSPContext *dsp)
 {
+#if HAVE_X86ASM
     int cpu_flags = av_get_cpu_flags();
 
 #if ARCH_X86_64
@@ -42,4 +43,5 @@ void ff_ssim_init_x86(SSIMDSPContext *dsp)
         dsp->ssim_end_line = ff_ssim_end_line_sse4;
     if (EXTERNAL_XOP(cpu_flags))
         dsp->ssim_4x4_line = ff_ssim_4x4_line_xop;
+#endif /* HAVE_X86ASM */
 }
diff --git a/libavfilter/x86/vf_stereo3d_init.c b/libavfilter/x86/vf_stereo3d_init.c
index da160a89a0..abd682ee80 100644
--- a/libavfilter/x86/vf_stereo3d_init.c
+++ b/libavfilter/x86/vf_stereo3d_init.c
@@ -29,9 +29,11 @@ void ff_anaglyph_sse4(uint8_t *dst, uint8_t *lsrc, uint8_t *rsrc,
 
 void ff_stereo3d_init_x86(Stereo3DDSPContext *dsp)
 {
+#if HAVE_X86ASM
     int cpu_flags = av_get_cpu_flags();
 
     if (EXTERNAL_SSE4(cpu_flags)) {
         dsp->anaglyph = ff_anaglyph_sse4;
     }
+#endif /* HAVE_X86ASM */
 }
diff --git a/libavfilter/x86/vf_threshold_init.c b/libavfilter/x86/vf_threshold_init.c
index 8e42296791..151a94f429 100644
--- a/libavfilter/x86/vf_threshold_init.c
+++ b/libavfilter/x86/vf_threshold_init.c
@@ -39,6 +39,7 @@ THRESHOLD_FUNC(16, avx2)
 
 av_cold void ff_threshold_init_x86(ThresholdContext *s)
 {
+#if HAVE_X86ASM
     int cpu_flags = av_get_cpu_flags();
 
     if (s->depth == 8) {
@@ -56,4 +57,5 @@ av_cold void ff_threshold_init_x86(ThresholdContext *s)
             s->threshold = ff_threshold16_avx2;
         }
     }
+#endif /* HAVE_X86ASM */
 }
diff --git a/libavfilter/x86/vf_tinterlace_init.c b/libavfilter/x86/vf_tinterlace_init.c
index 1c25a2bb7a..c30a3247a2 100644
--- a/libavfilter/x86/vf_tinterlace_init.c
+++ b/libavfilter/x86/vf_tinterlace_init.c
@@ -56,6 +56,7 @@ void ff_lowpass_line_complex_12_sse2(uint8_t *dstp, ptrdiff_t linesize,
 
 av_cold void ff_tinterlace_init_x86(TInterlaceContext *s)
 {
+#if HAVE_X86ASM
     int cpu_flags = av_get_cpu_flags();
 
     if (s->csp->comp[0].depth > 8) {
@@ -89,4 +90,5 @@ av_cold void ff_tinterlace_init_x86(TInterlaceContext *s)
             }
         }
     }
+#endif /* HAVE_X86ASM */
 }
diff --git a/libavfilter/x86/vf_transpose_init.c b/libavfilter/x86/vf_transpose_init.c
index 95c56eab73..7db2e66258 100644
--- a/libavfilter/x86/vf_transpose_init.c
+++ b/libavfilter/x86/vf_transpose_init.c
@@ -36,6 +36,7 @@ void ff_transpose_8x8_16_sse2(uint8_t *src,
 
 av_cold void ff_transpose_init_x86(TransVtable *v, int pixstep)
 {
+#if HAVE_X86ASM
     int cpu_flags = av_get_cpu_flags();
 
     if (EXTERNAL_SSE2(cpu_flags) && pixstep == 1) {
@@ -45,4 +46,5 @@ av_cold void ff_transpose_init_x86(TransVtable *v, int pixstep)
     if (EXTERNAL_SSE2(cpu_flags) && pixstep == 2) {
         v->transpose_8x8 = ff_transpose_8x8_16_sse2;
     }
+#endif /* HAVE_X86ASM */
 }
diff --git a/libavfilter/x86/vf_v360_init.c b/libavfilter/x86/vf_v360_init.c
index 2b2b06dd40..6b1b3811aa 100644
--- a/libavfilter/x86/vf_v360_init.c
+++ b/libavfilter/x86/vf_v360_init.c
@@ -43,6 +43,7 @@ void ff_remap2_16bit_line_avx2(uint8_t *dst, int width, const uint8_t *src, ptrd
 
 av_cold void ff_v360_init_x86(V360Context *s, int depth)
 {
+#if HAVE_X86ASM
     int cpu_flags = av_get_cpu_flags();
 
     if (EXTERNAL_AVX2_FAST(cpu_flags) && s->interp == NEAREST && depth <= 8)
@@ -68,4 +69,5 @@ av_cold void ff_v360_init_x86(V360Context *s, int depth)
                                           s->interp == MITCHELL) && depth <= 8)
         s->remap_line = ff_remap4_8bit_line_avx2;
 #endif
+#endif /* HAVE_X86ASM */
 }
diff --git a/libavfilter/x86/vf_w3fdif_init.c b/libavfilter/x86/vf_w3fdif_init.c
index 6d677d651d..d023ef7a49 100644
--- a/libavfilter/x86/vf_w3fdif_init.c
+++ b/libavfilter/x86/vf_w3fdif_init.c
@@ -47,6 +47,7 @@ void ff_w3fdif_scale_sse2(uint8_t *out_pixel, const int32_t *work_pixel,
 
 av_cold void ff_w3fdif_init_x86(W3FDIFDSPContext *dsp, int depth)
 {
+#if HAVE_X86ASM
     int cpu_flags = av_get_cpu_flags();
 
     if (EXTERNAL_SSE2(cpu_flags) && depth <= 8) {
@@ -61,4 +62,5 @@ av_cold void ff_w3fdif_init_x86(W3FDIFDSPContext *dsp, int depth)
         dsp->filter_complex_high = ff_w3fdif_complex_high_sse2;
     }
 #endif
+#endif /* HAVE_X86ASM */
 }
diff --git a/libavfilter/x86/vf_yadif_init.c b/libavfilter/x86/vf_yadif_init.c
index 257c3f9199..54917fa104 100644
--- a/libavfilter/x86/vf_yadif_init.c
+++ b/libavfilter/x86/vf_yadif_init.c
@@ -49,6 +49,7 @@ void ff_yadif_filter_line_10bit_ssse3(void *dst, void *prev, void *cur,
 
 av_cold void ff_yadif_init_x86(YADIFContext *yadif)
 {
+#if HAVE_X86ASM
     int cpu_flags = av_get_cpu_flags();
     int bit_depth = (!yadif->csp) ? 8
                                   : yadif->csp->comp[0].depth;
@@ -71,4 +72,5 @@ av_cold void ff_yadif_init_x86(YADIFContext *yadif)
         if (EXTERNAL_SSSE3(cpu_flags))
             yadif->filter_line = ff_yadif_filter_line_ssse3;
     }
+#endif /* HAVE_X86ASM */
 }
diff --git a/libavutil/x86/fixed_dsp_init.c b/libavutil/x86/fixed_dsp_init.c
index d3f4b2e325..eb84027dbf 100644
--- a/libavutil/x86/fixed_dsp_init.c
+++ b/libavutil/x86/fixed_dsp_init.c
@@ -27,9 +27,11 @@ void ff_butterflies_fixed_sse2(int *av_restrict src0, int *av_restrict src1, int
 
 av_cold void ff_fixed_dsp_init_x86(AVFixedDSPContext *fdsp)
 {
+#if HAVE_X86ASM
     int cpu_flags = av_get_cpu_flags();
 
     if (EXTERNAL_SSE2(cpu_flags)) {
         fdsp->butterflies_fixed = ff_butterflies_fixed_sse2;
     }
+#endif /* HAVE_X86ASM */
 }
diff --git a/libavutil/x86/float_dsp_init.c b/libavutil/x86/float_dsp_init.c
index ad6b506259..7495c0b9a8 100644
--- a/libavutil/x86/float_dsp_init.c
+++ b/libavutil/x86/float_dsp_init.c
@@ -80,6 +80,7 @@ void ff_butterflies_float_sse(float *av_restrict src0, float *av_restrict src1,
 
 av_cold void ff_float_dsp_init_x86(AVFloatDSPContext *fdsp)
 {
+#if HAVE_X86ASM
     int cpu_flags = av_get_cpu_flags();
 
     if (EXTERNAL_SSE(cpu_flags)) {
@@ -115,4 +116,5 @@ av_cold void ff_float_dsp_init_x86(AVFloatDSPContext *fdsp)
         fdsp->vector_dmac_scalar = ff_vector_dmac_scalar_fma3;
         fdsp->scalarproduct_float = ff_scalarproduct_float_fma3;
     }
+#endif /* HAVE_X86ASM */
 }
diff --git a/libavutil/x86/imgutils_init.c b/libavutil/x86/imgutils_init.c
index 91a16cf594..feac5d6fc7 100644
--- a/libavutil/x86/imgutils_init.c
+++ b/libavutil/x86/imgutils_init.c
@@ -34,6 +34,7 @@ int ff_image_copy_plane_uc_from_x86(uint8_t       *dst, ptrdiff_t dst_linesize,
                                     const uint8_t *src, ptrdiff_t src_linesize,
                                     ptrdiff_t bytewidth, int height)
 {
+#if HAVE_X86ASM
     int cpu_flags = av_get_cpu_flags();
     ptrdiff_t bw_aligned = FFALIGN(bytewidth, 64);
 
@@ -42,6 +43,7 @@ int ff_image_copy_plane_uc_from_x86(uint8_t       *dst, ptrdiff_t dst_linesize,
         ff_image_copy_plane_uc_from_sse4(dst, dst_linesize, src, src_linesize,
                                          bw_aligned, height);
     else
+#endif /* HAVE_X86ASM */
         return AVERROR(ENOSYS);
 
     return 0;
diff --git a/libavutil/x86/lls_init.c b/libavutil/x86/lls_init.c
index c786376915..67470185da 100644
--- a/libavutil/x86/lls_init.c
+++ b/libavutil/x86/lls_init.c
@@ -31,6 +31,7 @@ double ff_evaluate_lls_sse2(LLSModel *m, const double *var, int order);
 
 av_cold void ff_init_lls_x86(LLSModel *m)
 {
+#if HAVE_X86ASM
     int cpu_flags = av_get_cpu_flags();
     if (EXTERNAL_SSE2(cpu_flags)) {
         m->update_lls = ff_update_lls_sse2;
@@ -43,4 +44,5 @@ av_cold void ff_init_lls_x86(LLSModel *m)
     if (EXTERNAL_FMA3_FAST(cpu_flags)) {
         m->update_lls = ff_update_lls_fma3;
     }
+#endif /* HAVE_X86ASM */
 }
diff --git a/libavutil/x86/pixelutils_init.c b/libavutil/x86/pixelutils_init.c
index c3c0662414..a2f842041d 100644
--- a/libavutil/x86/pixelutils_init.c
+++ b/libavutil/x86/pixelutils_init.c
@@ -47,6 +47,7 @@ int ff_pixelutils_sad_u_32x32_avx2(const uint8_t *src1, ptrdiff_t stride1,
 
 void ff_pixelutils_sad_init_x86(av_pixelutils_sad_fn *sad, int aligned)
 {
+#if HAVE_X86ASM
     int cpu_flags = av_get_cpu_flags();
 
     // The best way to use SSE2 would be to do 2 SADs in parallel,
@@ -82,4 +83,5 @@ void ff_pixelutils_sad_init_x86(av_pixelutils_sad_fn *sad, int aligned)
         case 2: sad[4] = ff_pixelutils_sad_a_32x32_avx2; break; // src1   aligned, src2   aligned
         }
     }
+#endif /* HAVE_X86ASM */
 }
diff --git a/libswresample/x86/audio_convert_init.c b/libswresample/x86/audio_convert_init.c
index f6d36f9ca6..d9eb43e1d5 100644
--- a/libswresample/x86/audio_convert_init.c
+++ b/libswresample/x86/audio_convert_init.c
@@ -52,6 +52,7 @@ av_cold void swri_audio_convert_init_x86(struct AudioConvert *ac,
             ac->simd_f =  ff_int32_to_int16_a_ ## cap;\
     }
 
+#if HAVE_X86ASM
 MULTI_CAPS_FUNC(SSE2, sse2)
 
     if(EXTERNAL_SSE(mm_flags)) {
@@ -172,4 +173,5 @@ MULTI_CAPS_FUNC(SSE2, sse2)
         if(   out_fmt == AV_SAMPLE_FMT_S32  && in_fmt == AV_SAMPLE_FMT_FLT || out_fmt == AV_SAMPLE_FMT_S32P && in_fmt == AV_SAMPLE_FMT_FLTP)
             ac->simd_f =  ff_float_to_int32_a_avx2;
     }
+#endif /* HAVE_X86ASM */
 }
diff --git a/libswresample/x86/resample_init.c b/libswresample/x86/resample_init.c
index d13ccd4833..4eebf5d6f9 100644
--- a/libswresample/x86/resample_init.c
+++ b/libswresample/x86/resample_init.c
@@ -51,6 +51,7 @@ av_cold void swri_resample_dsp_x86_init(ResampleContext *c)
 
     switch(c->format){
     case AV_SAMPLE_FMT_S16P:
+#if HAVE_X86ASM
         if (EXTERNAL_SSE2(mm_flags)) {
             c->dsp.resample_linear = ff_resample_linear_int16_sse2;
             c->dsp.resample_common = ff_resample_common_int16_sse2;
@@ -59,8 +60,10 @@ av_cold void swri_resample_dsp_x86_init(ResampleContext *c)
             c->dsp.resample_linear = ff_resample_linear_int16_xop;
             c->dsp.resample_common = ff_resample_common_int16_xop;
         }
+#endif /* HAVE_X86ASM */
         break;
     case AV_SAMPLE_FMT_FLTP:
+#if HAVE_X86ASM
         if (EXTERNAL_SSE(mm_flags)) {
             c->dsp.resample_linear = ff_resample_linear_float_sse;
             c->dsp.resample_common = ff_resample_common_float_sse;
@@ -77,8 +80,10 @@ av_cold void swri_resample_dsp_x86_init(ResampleContext *c)
             c->dsp.resample_linear = ff_resample_linear_float_fma4;
             c->dsp.resample_common = ff_resample_common_float_fma4;
         }
+#endif /* HAVE_X86ASM */
         break;
     case AV_SAMPLE_FMT_DBLP:
+#if HAVE_X86ASM
         if (EXTERNAL_SSE2(mm_flags)) {
             c->dsp.resample_linear = ff_resample_linear_double_sse2;
             c->dsp.resample_common = ff_resample_common_double_sse2;
@@ -91,6 +96,7 @@ av_cold void swri_resample_dsp_x86_init(ResampleContext *c)
             c->dsp.resample_linear = ff_resample_linear_double_fma3;
             c->dsp.resample_common = ff_resample_common_double_fma3;
         }
+#endif /* HAVE_X86ASM */
         break;
     }
 }
diff --git a/libswscale/x86/rgb2rgb.c b/libswscale/x86/rgb2rgb.c
index b325e5dbd5..e39f327bf2 100644
--- a/libswscale/x86/rgb2rgb.c
+++ b/libswscale/x86/rgb2rgb.c
@@ -151,6 +151,7 @@ av_cold void rgb2rgb_init_x86(void)
         rgb2rgb_init_avx();
 #endif /* HAVE_INLINE_ASM */
 
+#if HAVE_X86ASM
     if (EXTERNAL_MMXEXT(cpu_flags)) {
         shuffle_bytes_2103 = ff_shuffle_bytes_2103_mmxext;
     }
@@ -178,4 +179,5 @@ av_cold void rgb2rgb_init_x86(void)
         uyvytoyuv422 = ff_uyvytoyuv422_avx;
     }
 #endif
+#endif /* HAVE_X86ASM */
 }
diff --git a/libswscale/x86/swscale.c b/libswscale/x86/swscale.c
index ff16398988..0a14262916 100644
--- a/libswscale/x86/swscale.c
+++ b/libswscale/x86/swscale.c
@@ -529,6 +529,7 @@ switch(c->dstBpc){ \
              else                ASSIGN_SCALE_FUNC2(hscalefn, X8, opt1, opt2); \
              break; \
     }
+#if HAVE_X86ASM
     if (EXTERNAL_SSE2(cpu_flags)) {
         ASSIGN_SSE_SCALE_FUNC(c->hyScale, c->hLumFilterSize, sse2, sse2);
         ASSIGN_SSE_SCALE_FUNC(c->hcScale, c->hChrFilterSize, sse2, sse2);
@@ -805,4 +806,5 @@ switch(c->dstBpc){ \
     }
 
 #endif
+#endif /* HAVE_X86ASM */
 }
