---
 libavcodec/x86/ac3dsp_init.c         |    2 +-
 libavcodec/x86/cavsdsp.c             |    6 ++++--
 libavcodec/x86/dnxhdenc.c            |    2 +-
 libavcodec/x86/dsputil_mmx.c         |   12 ++++++------
 libavcodec/x86/dsputilenc_mmx.c      |   18 +++++++++---------
 libavcodec/x86/fmtconvert_init.c     |    2 +-
 libavcodec/x86/h264_intrapred_init.c |   18 +++++++++---------
 libavcodec/x86/h264dsp_init.c        |   22 +++++++++++-----------
 libavcodec/x86/lpc.c                 |    2 +-
 libavcodec/x86/motion_est.c          |    7 ++++---
 libavcodec/x86/mpegaudiodec.c        |    2 +-
 libavcodec/x86/mpegvideo.c           |    4 ++--
 libavcodec/x86/pngdsp_init.c         |    8 ++++----
 libavcodec/x86/proresdsp_init.c      |    4 ++--
 libavcodec/x86/rv34dsp_init.c        |    6 +++---
 libavcodec/x86/rv40dsp_init.c        |   10 +++++-----
 libavcodec/x86/sbrdsp_init.c         |    2 +-
 libavcodec/x86/snowdsp.c             |    6 +++---
 libavcodec/x86/vc1dsp_mmx.c          |   16 ++++++++--------
 libavcodec/x86/vp3dsp_init.c         |    2 +-
 libavcodec/x86/vp56dsp_init.c        |    4 ++--
 libavcodec/x86/vp8dsp_init.c         |   14 +++++++-------
 libswscale/x86/rgb2rgb.c             |    2 +-
 libswscale/x86/swscale.c             |   14 +++++++-------
 libswscale/x86/yuv2rgb.c             |    2 +-
 25 files changed, 95 insertions(+), 92 deletions(-)

diff --git a/libavcodec/x86/ac3dsp_init.c b/libavcodec/x86/ac3dsp_init.c
index a564c33..9cffc74 100644
--- a/libavcodec/x86/ac3dsp_init.c
+++ b/libavcodec/x86/ac3dsp_init.c
@@ -53,7 +53,7 @@ av_cold void ff_ac3dsp_init_x86(AC3DSPContext *c, int 
bit_exact)
 #if HAVE_YASM
     int mm_flags = av_get_cpu_flags();
 
-    if (mm_flags & AV_CPU_FLAG_MMX) {
+    if (mm_flags & AV_CPU_FLAG_MMX && HAVE_MMX) {
         c->ac3_exponent_min = ff_ac3_exponent_min_mmx;
         c->ac3_max_msb_abs_int16 = ff_ac3_max_msb_abs_int16_mmx;
         c->ac3_lshift_int16 = ff_ac3_lshift_int16_mmx;
diff --git a/libavcodec/x86/cavsdsp.c b/libavcodec/x86/cavsdsp.c
index e940039..f0a5cf1 100644
--- a/libavcodec/x86/cavsdsp.c
+++ b/libavcodec/x86/cavsdsp.c
@@ -486,7 +486,9 @@ void ff_cavsdsp_init_mmx(CAVSDSPContext *c, AVCodecContext 
*avctx)
     int mm_flags = av_get_cpu_flags();
 
 #if HAVE_INLINE_ASM
-    if (mm_flags & AV_CPU_FLAG_MMXEXT) ff_cavsdsp_init_mmx2(c, avctx);
-    if (mm_flags & AV_CPU_FLAG_3DNOW) ff_cavsdsp_init_3dnow(c, avctx);
+    if (mm_flags & AV_CPU_FLAG_MMXEXT && HAVE_MMXEXT)
+        ff_cavsdsp_init_mmx2(c, avctx);
+    if (mm_flags & AV_CPU_FLAG_3DNOW && HAVE_AMD3DNOW)
+        ff_cavsdsp_init_3dnow(c, avctx);
 #endif /* HAVE_INLINE_ASM */
 }
diff --git a/libavcodec/x86/dnxhdenc.c b/libavcodec/x86/dnxhdenc.c
index c344afe..27176b1 100644
--- a/libavcodec/x86/dnxhdenc.c
+++ b/libavcodec/x86/dnxhdenc.c
@@ -57,7 +57,7 @@ static void get_pixels_8x4_sym_sse2(DCTELEM *block, const 
uint8_t *pixels, int l
 void ff_dnxhdenc_init_x86(DNXHDEncContext *ctx)
 {
 #if HAVE_INLINE_ASM
-    if (av_get_cpu_flags() & AV_CPU_FLAG_SSE2) {
+    if (av_get_cpu_flags() & AV_CPU_FLAG_SSE2 && HAVE_SSE2) {
         if (ctx->cid_table->bit_depth == 8)
             ctx->get_pixels_8x4_sym = get_pixels_8x4_sym_sse2;
     }
diff --git a/libavcodec/x86/dsputil_mmx.c b/libavcodec/x86/dsputil_mmx.c
index 1c10e91..519b72e 100644
--- a/libavcodec/x86/dsputil_mmx.c
+++ b/libavcodec/x86/dsputil_mmx.c
@@ -2796,7 +2796,7 @@ static void dsputil_init_3dnow(DSPContext *c, 
AVCodecContext *avctx,
     c->vorbis_inverse_coupling = vorbis_inverse_coupling_3dnow;
 
 #if HAVE_7REGS
-    if (mm_flags & AV_CPU_FLAG_CMOV)
+    if (mm_flags & AV_CPU_FLAG_CMOV && HAVE_CMOV)
         c->add_hfyu_median_prediction = add_hfyu_median_prediction_cmov;
 #endif
 #endif /* HAVE_INLINE_ASM */
@@ -3010,7 +3010,7 @@ void ff_dsputil_init_mmx(DSPContext *c, AVCodecContext 
*avctx)
 {
     int mm_flags = av_get_cpu_flags();
 
-    if (mm_flags & AV_CPU_FLAG_MMX) {
+    if (mm_flags & AV_CPU_FLAG_MMX && HAVE_MMX) {
 #if HAVE_INLINE_ASM
         const int idct_algo = avctx->idct_algo;
 
@@ -3044,7 +3044,7 @@ void ff_dsputil_init_mmx(DSPContext *c, AVCodecContext 
*avctx)
         dsputil_init_mmx(c, avctx, mm_flags);
     }
 
-    if (mm_flags & AV_CPU_FLAG_MMXEXT)
+    if (mm_flags & AV_CPU_FLAG_MMXEXT && HAVE_MMXEXT)
         dsputil_init_mmx2(c, avctx, mm_flags);
 
     if (mm_flags & AV_CPU_FLAG_3DNOW && HAVE_AMD3DNOW)
@@ -3056,16 +3056,16 @@ void ff_dsputil_init_mmx(DSPContext *c, AVCodecContext 
*avctx)
     if (mm_flags & AV_CPU_FLAG_SSE && HAVE_SSE)
         dsputil_init_sse(c, avctx, mm_flags);
 
-    if (mm_flags & AV_CPU_FLAG_SSE2)
+    if (mm_flags & AV_CPU_FLAG_SSE2 && HAVE_SSE2)
         dsputil_init_sse2(c, avctx, mm_flags);
 
-    if (mm_flags & AV_CPU_FLAG_SSSE3)
+    if (mm_flags & AV_CPU_FLAG_SSSE3 && HAVE_SSSE3)
         dsputil_init_ssse3(c, avctx, mm_flags);
 
     if (mm_flags & AV_CPU_FLAG_SSE4 && HAVE_SSE4)
         dsputil_init_sse4(c, avctx, mm_flags);
 
-    if (mm_flags & AV_CPU_FLAG_AVX)
+    if (mm_flags & AV_CPU_FLAG_AVX && HAVE_AVX)
         dsputil_init_avx(c, avctx, mm_flags);
 
     if (CONFIG_ENCODERS)
diff --git a/libavcodec/x86/dsputilenc_mmx.c b/libavcodec/x86/dsputilenc_mmx.c
index 712c15b..baf5024 100644
--- a/libavcodec/x86/dsputilenc_mmx.c
+++ b/libavcodec/x86/dsputilenc_mmx.c
@@ -1105,13 +1105,13 @@ void ff_dsputilenc_init_mmx(DSPContext* c, 
AVCodecContext *avctx)
 #if HAVE_INLINE_ASM
     int bit_depth = avctx->bits_per_raw_sample;
 
-    if (mm_flags & AV_CPU_FLAG_MMX) {
+    if (mm_flags & AV_CPU_FLAG_MMX && HAVE_MMX) {
         const int dct_algo = avctx->dct_algo;
         if (avctx->bits_per_raw_sample <= 8 &&
             (dct_algo==FF_DCT_AUTO || dct_algo==FF_DCT_MMX)) {
-            if(mm_flags & AV_CPU_FLAG_SSE2){
+            if (mm_flags & AV_CPU_FLAG_SSE2 && HAVE_SSE2) {
                 c->fdct = ff_fdct_sse2;
-            } else if (mm_flags & AV_CPU_FLAG_MMXEXT) {
+            } else if (mm_flags & AV_CPU_FLAG_MMXEXT && HAVE_MMXEXT) {
                 c->fdct = ff_fdct_mmx2;
             }else{
                 c->fdct = ff_fdct_mmx;
@@ -1144,7 +1144,7 @@ void ff_dsputilenc_init_mmx(DSPContext* c, AVCodecContext 
*avctx)
 
         c->ssd_int8_vs_int16 = ssd_int8_vs_int16_mmx;
 
-        if (mm_flags & AV_CPU_FLAG_MMXEXT) {
+        if (mm_flags & AV_CPU_FLAG_MMXEXT && HAVE_MMXEXT) {
             c->sum_abs_dctelem= sum_abs_dctelem_mmx2;
             c->vsad[4]= vsad_intra16_mmx2;
 
@@ -1155,7 +1155,7 @@ void ff_dsputilenc_init_mmx(DSPContext* c, AVCodecContext 
*avctx)
             c->sub_hfyu_median_prediction= sub_hfyu_median_prediction_mmx2;
         }
 
-        if(mm_flags & AV_CPU_FLAG_SSE2){
+        if (mm_flags & AV_CPU_FLAG_SSE2 && HAVE_SSE2) {
             if (bit_depth <= 8)
                 c->get_pixels = get_pixels_sse2;
             c->sum_abs_dctelem= sum_abs_dctelem_sse2;
@@ -1171,7 +1171,7 @@ void ff_dsputilenc_init_mmx(DSPContext* c, AVCodecContext 
*avctx)
         }
 #endif
 
-        if(mm_flags & AV_CPU_FLAG_3DNOW){
+        if (mm_flags & AV_CPU_FLAG_3DNOW && HAVE_AMD3DNOW) {
             if(!(avctx->flags & CODEC_FLAG_BITEXACT)){
                 c->try_8x8basis= try_8x8basis_3dnow;
             }
@@ -1181,16 +1181,16 @@ void ff_dsputilenc_init_mmx(DSPContext* c, 
AVCodecContext *avctx)
 #endif /* HAVE_INLINE_ASM */
 
 #if HAVE_YASM
-    if (mm_flags & AV_CPU_FLAG_MMX) {
+    if (mm_flags & AV_CPU_FLAG_MMX && HAVE_MMX) {
         c->hadamard8_diff[0] = ff_hadamard8_diff16_mmx;
         c->hadamard8_diff[1] = ff_hadamard8_diff_mmx;
 
-        if (mm_flags & AV_CPU_FLAG_MMXEXT) {
+        if (mm_flags & AV_CPU_FLAG_MMXEXT && HAVE_MMXEXT) {
             c->hadamard8_diff[0] = ff_hadamard8_diff16_mmx2;
             c->hadamard8_diff[1] = ff_hadamard8_diff_mmx2;
         }
 
-        if (mm_flags & AV_CPU_FLAG_SSE2){
+        if (mm_flags & AV_CPU_FLAG_SSE2 && HAVE_SSE2) {
             c->sse[0] = ff_sse16_sse2;
 
 #if HAVE_ALIGNED_STACK
diff --git a/libavcodec/x86/fmtconvert_init.c b/libavcodec/x86/fmtconvert_init.c
index 5229496..365f662 100644
--- a/libavcodec/x86/fmtconvert_init.c
+++ b/libavcodec/x86/fmtconvert_init.c
@@ -117,7 +117,7 @@ void ff_fmt_convert_init_x86(FmtConvertContext *c, 
AVCodecContext *avctx)
 #if HAVE_YASM
     int mm_flags = av_get_cpu_flags();
 
-    if (mm_flags & AV_CPU_FLAG_MMX) {
+    if (HAVE_MMX && mm_flags & AV_CPU_FLAG_MMX) {
         c->float_interleave = float_interleave_mmx;
 
         if (HAVE_AMD3DNOW && mm_flags & AV_CPU_FLAG_3DNOW) {
diff --git a/libavcodec/x86/h264_intrapred_init.c 
b/libavcodec/x86/h264_intrapred_init.c
index 6832989..efe1aa3 100644
--- a/libavcodec/x86/h264_intrapred_init.c
+++ b/libavcodec/x86/h264_intrapred_init.c
@@ -173,7 +173,7 @@ void ff_h264_pred_init_x86(H264PredContext *h, int 
codec_id, const int bit_depth
     int mm_flags = av_get_cpu_flags();
 
     if (bit_depth == 8) {
-        if (mm_flags & AV_CPU_FLAG_MMX) {
+        if (mm_flags & AV_CPU_FLAG_MMX && HAVE_MMX) {
             h->pred16x16[VERT_PRED8x8         ] = ff_pred16x16_vertical_mmx;
             h->pred16x16[HOR_PRED8x8          ] = ff_pred16x16_horizontal_mmx;
             if (chroma_format_idc == 1) {
@@ -188,7 +188,7 @@ void ff_h264_pred_init_x86(H264PredContext *h, int 
codec_id, const int bit_depth
                 if (chroma_format_idc == 1)
                     h->pred8x8  [PLANE_PRED8x8] = ff_pred8x8_plane_mmx;
                 if (codec_id == AV_CODEC_ID_SVQ3) {
-                    if (mm_flags & AV_CPU_FLAG_CMOV)
+                    if (mm_flags & AV_CPU_FLAG_CMOV && HAVE_CMOV)
                         h->pred16x16[PLANE_PRED8x8] = 
ff_pred16x16_plane_svq3_mmx;
                 } else if (codec_id == AV_CODEC_ID_RV40) {
                     h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_rv40_mmx;
@@ -198,7 +198,7 @@ void ff_h264_pred_init_x86(H264PredContext *h, int 
codec_id, const int bit_depth
             }
         }
 
-        if (mm_flags & AV_CPU_FLAG_MMXEXT) {
+        if (mm_flags & AV_CPU_FLAG_MMXEXT && HAVE_MMXEXT) {
             h->pred16x16[HOR_PRED8x8            ] = 
ff_pred16x16_horizontal_mmx2;
             h->pred16x16[DC_PRED8x8             ] = ff_pred16x16_dc_mmx2;
             if (chroma_format_idc == 1)
@@ -250,11 +250,11 @@ void ff_h264_pred_init_x86(H264PredContext *h, int 
codec_id, const int bit_depth
             }
         }
 
-        if (mm_flags & AV_CPU_FLAG_SSE) {
+        if (mm_flags & AV_CPU_FLAG_SSE && HAVE_SSE) {
             h->pred16x16[VERT_PRED8x8] = ff_pred16x16_vertical_sse;
         }
 
-        if (mm_flags & AV_CPU_FLAG_SSE2) {
+        if (mm_flags & AV_CPU_FLAG_SSE2 && HAVE_SSE2) {
             h->pred16x16[DC_PRED8x8           ] = ff_pred16x16_dc_sse2;
             h->pred8x8l [DIAG_DOWN_LEFT_PRED  ] = ff_pred8x8l_down_left_sse2;
             h->pred8x8l [DIAG_DOWN_RIGHT_PRED ] = ff_pred8x8l_down_right_sse2;
@@ -277,7 +277,7 @@ void ff_h264_pred_init_x86(H264PredContext *h, int 
codec_id, const int bit_depth
             }
         }
 
-        if (mm_flags & AV_CPU_FLAG_SSSE3) {
+        if (mm_flags & AV_CPU_FLAG_SSSE3 && HAVE_SSSE3) {
             h->pred16x16[HOR_PRED8x8          ] = 
ff_pred16x16_horizontal_ssse3;
             h->pred16x16[DC_PRED8x8           ] = ff_pred16x16_dc_ssse3;
             if (chroma_format_idc == 1)
@@ -308,7 +308,7 @@ void ff_h264_pred_init_x86(H264PredContext *h, int 
codec_id, const int bit_depth
             }
         }
     } else if (bit_depth == 10) {
-        if (mm_flags & AV_CPU_FLAG_MMXEXT) {
+        if (mm_flags & AV_CPU_FLAG_MMXEXT && HAVE_MMXEXT) {
             h->pred4x4[DC_PRED             ] = ff_pred4x4_dc_10_mmxext;
             h->pred4x4[HOR_UP_PRED         ] = 
ff_pred4x4_horizontal_up_10_mmxext;
 
@@ -324,7 +324,7 @@ void ff_h264_pred_init_x86(H264PredContext *h, int 
codec_id, const int bit_depth
             h->pred16x16[VERT_PRED8x8      ] = ff_pred16x16_vertical_10_mmxext;
             h->pred16x16[HOR_PRED8x8       ] = 
ff_pred16x16_horizontal_10_mmxext;
         }
-        if (mm_flags & AV_CPU_FLAG_SSE2) {
+        if (mm_flags & AV_CPU_FLAG_SSE2 && HAVE_SSE2) {
             h->pred4x4[DIAG_DOWN_LEFT_PRED ] = ff_pred4x4_down_left_10_sse2;
             h->pred4x4[DIAG_DOWN_RIGHT_PRED] = ff_pred4x4_down_right_10_sse2;
             h->pred4x4[VERT_LEFT_PRED      ] = 
ff_pred4x4_vertical_left_10_sse2;
@@ -356,7 +356,7 @@ void ff_h264_pred_init_x86(H264PredContext *h, int 
codec_id, const int bit_depth
             h->pred16x16[VERT_PRED8x8      ] = ff_pred16x16_vertical_10_sse2;
             h->pred16x16[HOR_PRED8x8       ] = ff_pred16x16_horizontal_10_sse2;
         }
-        if (mm_flags & AV_CPU_FLAG_SSSE3) {
+        if (mm_flags & AV_CPU_FLAG_SSSE3 && HAVE_SSSE3) {
             h->pred4x4[DIAG_DOWN_RIGHT_PRED] = ff_pred4x4_down_right_10_ssse3;
             h->pred4x4[VERT_RIGHT_PRED     ] = 
ff_pred4x4_vertical_right_10_ssse3;
             h->pred4x4[HOR_DOWN_PRED       ] = 
ff_pred4x4_horizontal_down_10_ssse3;
diff --git a/libavcodec/x86/h264dsp_init.c b/libavcodec/x86/h264dsp_init.c
index 69ad472..28c9c77 100644
--- a/libavcodec/x86/h264dsp_init.c
+++ b/libavcodec/x86/h264dsp_init.c
@@ -218,11 +218,11 @@ void ff_h264dsp_init_x86(H264DSPContext *c, const int 
bit_depth,
 #if HAVE_YASM
     int mm_flags = av_get_cpu_flags();
 
-    if (chroma_format_idc == 1 && mm_flags & AV_CPU_FLAG_MMXEXT)
+    if (chroma_format_idc == 1 && mm_flags & AV_CPU_FLAG_MMXEXT && HAVE_MMXEXT)
         c->h264_loop_filter_strength = ff_h264_loop_filter_strength_mmx2;
 
     if (bit_depth == 8) {
-        if (mm_flags & AV_CPU_FLAG_MMX) {
+        if (mm_flags & AV_CPU_FLAG_MMX && HAVE_MMX) {
             c->h264_idct_dc_add   =
             c->h264_idct_add      = ff_h264_idct_add_8_mmx;
             c->h264_idct8_dc_add  =
@@ -233,10 +233,10 @@ void ff_h264dsp_init_x86(H264DSPContext *c, const int 
bit_depth,
             if (chroma_format_idc == 1)
                 c->h264_idct_add8 = ff_h264_idct_add8_8_mmx;
             c->h264_idct_add16intra = ff_h264_idct_add16intra_8_mmx;
-            if (mm_flags & AV_CPU_FLAG_CMOV)
+            if (mm_flags & AV_CPU_FLAG_CMOV && HAVE_CMOV)
                 c->h264_luma_dc_dequant_idct = 
ff_h264_luma_dc_dequant_idct_mmx;
 
-            if (mm_flags & AV_CPU_FLAG_MMXEXT) {
+            if (mm_flags & AV_CPU_FLAG_MMXEXT && HAVE_MMXEXT) {
                 c->h264_idct_dc_add  = ff_h264_idct_dc_add_8_mmx2;
                 c->h264_idct8_dc_add = ff_h264_idct8_dc_add_8_mmx2;
                 c->h264_idct_add16   = ff_h264_idct_add16_8_mmx2;
@@ -265,7 +265,7 @@ void ff_h264dsp_init_x86(H264DSPContext *c, const int 
bit_depth,
                 c->biweight_h264_pixels_tab[1] = ff_h264_biweight_8_mmx2;
                 c->biweight_h264_pixels_tab[2] = ff_h264_biweight_4_mmx2;
 
-                if (mm_flags & AV_CPU_FLAG_SSE2) {
+                if (mm_flags & AV_CPU_FLAG_SSE2 && HAVE_SSE2) {
                     c->h264_idct8_add  = ff_h264_idct8_add_8_sse2;
 
                     c->h264_idct_add16 = ff_h264_idct_add16_8_sse2;
@@ -288,11 +288,11 @@ void ff_h264dsp_init_x86(H264DSPContext *c, const int 
bit_depth,
                     c->h264_h_loop_filter_luma_intra = 
ff_deblock_h_luma_intra_8_sse2;
 #endif /* HAVE_ALIGNED_STACK */
                 }
-                if (mm_flags & AV_CPU_FLAG_SSSE3) {
+                if (mm_flags & AV_CPU_FLAG_SSSE3 && HAVE_SSSE3) {
                     c->biweight_h264_pixels_tab[0] = ff_h264_biweight_16_ssse3;
                     c->biweight_h264_pixels_tab[1] = ff_h264_biweight_8_ssse3;
                 }
-                if (mm_flags & AV_CPU_FLAG_AVX && HAVE_ALIGNED_STACK) {
+                if (mm_flags & AV_CPU_FLAG_AVX && HAVE_AVX && 
HAVE_ALIGNED_STACK) {
                     c->h264_v_loop_filter_luma       = ff_deblock_v_luma_8_avx;
                     c->h264_h_loop_filter_luma       = ff_deblock_h_luma_8_avx;
                     c->h264_v_loop_filter_luma_intra = 
ff_deblock_v_luma_intra_8_avx;
@@ -301,8 +301,8 @@ void ff_h264dsp_init_x86(H264DSPContext *c, const int 
bit_depth,
             }
         }
     } else if (bit_depth == 10) {
-        if (mm_flags & AV_CPU_FLAG_MMX) {
-            if (mm_flags & AV_CPU_FLAG_MMXEXT) {
+        if (mm_flags & AV_CPU_FLAG_MMX && HAVE_MMX) {
+            if (mm_flags & AV_CPU_FLAG_MMXEXT && HAVE_MMXEXT) {
 #if ARCH_X86_32
                 c->h264_v_loop_filter_chroma       = 
ff_deblock_v_chroma_10_mmx2;
                 c->h264_v_loop_filter_chroma_intra = 
ff_deblock_v_chroma_intra_10_mmx2;
@@ -312,7 +312,7 @@ void ff_h264dsp_init_x86(H264DSPContext *c, const int 
bit_depth,
                 c->h264_h_loop_filter_luma_intra   = 
ff_deblock_h_luma_intra_10_mmx2;
 #endif /* ARCH_X86_32 */
                 c->h264_idct_dc_add = ff_h264_idct_dc_add_10_mmx2;
-                if (mm_flags & AV_CPU_FLAG_SSE2) {
+                if (mm_flags & AV_CPU_FLAG_SSE2 && HAVE_SSE2) {
                     c->h264_idct_add     = ff_h264_idct_add_10_sse2;
                     c->h264_idct8_dc_add = ff_h264_idct8_dc_add_10_sse2;
 
@@ -342,7 +342,7 @@ void ff_h264dsp_init_x86(H264DSPContext *c, const int 
bit_depth,
                     c->h264_h_loop_filter_luma_intra = 
ff_deblock_h_luma_intra_10_sse2;
 #endif /* HAVE_ALIGNED_STACK */
                 }
-                if (mm_flags & AV_CPU_FLAG_SSE4) {
+                if (mm_flags & AV_CPU_FLAG_SSE4 && HAVE_SSE4) {
                     c->weight_h264_pixels_tab[0] = ff_h264_weight_16_10_sse4;
                     c->weight_h264_pixels_tab[1] = ff_h264_weight_8_10_sse4;
                     c->weight_h264_pixels_tab[2] = ff_h264_weight_4_10_sse4;
diff --git a/libavcodec/x86/lpc.c b/libavcodec/x86/lpc.c
index 82f7761..5765cb8 100644
--- a/libavcodec/x86/lpc.c
+++ b/libavcodec/x86/lpc.c
@@ -146,7 +146,7 @@ av_cold void ff_lpc_init_x86(LPCContext *c)
     int mm_flags = av_get_cpu_flags();
 
 #if HAVE_INLINE_ASM
-    if (mm_flags & (AV_CPU_FLAG_SSE2|AV_CPU_FLAG_SSE2SLOW)) {
+    if (mm_flags & (AV_CPU_FLAG_SSE2 | AV_CPU_FLAG_SSE2SLOW) && HAVE_SSE2) {
         c->lpc_apply_welch_window = lpc_apply_welch_window_sse2;
         c->lpc_compute_autocorr   = lpc_compute_autocorr_sse2;
     }
diff --git a/libavcodec/x86/motion_est.c b/libavcodec/x86/motion_est.c
index 6eb44d4..1e678cb 100644
--- a/libavcodec/x86/motion_est.c
+++ b/libavcodec/x86/motion_est.c
@@ -433,7 +433,7 @@ void ff_dsputil_init_pix_mmx(DSPContext* c, AVCodecContext 
*avctx)
 #if HAVE_INLINE_ASM
     int mm_flags = av_get_cpu_flags();
 
-    if (mm_flags & AV_CPU_FLAG_MMX) {
+    if (mm_flags & AV_CPU_FLAG_MMX && HAVE_MMX) {
         c->pix_abs[0][0] = sad16_mmx;
         c->pix_abs[0][1] = sad16_x2_mmx;
         c->pix_abs[0][2] = sad16_y2_mmx;
@@ -446,7 +446,7 @@ void ff_dsputil_init_pix_mmx(DSPContext* c, AVCodecContext 
*avctx)
         c->sad[0]= sad16_mmx;
         c->sad[1]= sad8_mmx;
     }
-    if (mm_flags & AV_CPU_FLAG_MMXEXT) {
+    if (mm_flags & AV_CPU_FLAG_MMXEXT && HAVE_MMXEXT) {
         c->pix_abs[0][0] = sad16_mmx2;
         c->pix_abs[1][0] = sad8_mmx2;
 
@@ -462,7 +462,8 @@ void ff_dsputil_init_pix_mmx(DSPContext* c, AVCodecContext 
*avctx)
             c->pix_abs[1][3] = sad8_xy2_mmx2;
         }
     }
-    if ((mm_flags & AV_CPU_FLAG_SSE2) && !(mm_flags & AV_CPU_FLAG_3DNOW) && 
avctx->codec_id != AV_CODEC_ID_SNOW) {
+    if ((mm_flags & AV_CPU_FLAG_SSE2) && !(mm_flags & AV_CPU_FLAG_3DNOW) &&
+        HAVE_SSE2 && avctx->codec_id != AV_CODEC_ID_SNOW) {
         c->sad[0]= sad16_sse2;
     }
 #endif /* HAVE_INLINE_ASM */
diff --git a/libavcodec/x86/mpegaudiodec.c b/libavcodec/x86/mpegaudiodec.c
index bc552f7..47b15c2 100644
--- a/libavcodec/x86/mpegaudiodec.c
+++ b/libavcodec/x86/mpegaudiodec.c
@@ -239,7 +239,7 @@ void ff_mpadsp_init_mmx(MPADSPContext *s)
     }
 
 #if HAVE_INLINE_ASM
-    if (mm_flags & AV_CPU_FLAG_SSE2) {
+    if (mm_flags & AV_CPU_FLAG_SSE2 && HAVE_SSE2) {
         s->apply_window_float = apply_window_mp3;
     }
 #endif /* HAVE_INLINE_ASM */
diff --git a/libavcodec/x86/mpegvideo.c b/libavcodec/x86/mpegvideo.c
index 077031a..6a15ea0 100644
--- a/libavcodec/x86/mpegvideo.c
+++ b/libavcodec/x86/mpegvideo.c
@@ -589,7 +589,7 @@ void ff_MPV_common_init_x86(MpegEncContext *s)
 #if HAVE_INLINE_ASM
     int mm_flags = av_get_cpu_flags();
 
-    if (mm_flags & AV_CPU_FLAG_MMX) {
+    if (mm_flags & AV_CPU_FLAG_MMX && HAVE_MMX) {
         s->dct_unquantize_h263_intra = dct_unquantize_h263_intra_mmx;
         s->dct_unquantize_h263_inter = dct_unquantize_h263_inter_mmx;
         s->dct_unquantize_mpeg1_intra = dct_unquantize_mpeg1_intra_mmx;
@@ -598,7 +598,7 @@ void ff_MPV_common_init_x86(MpegEncContext *s)
             s->dct_unquantize_mpeg2_intra = dct_unquantize_mpeg2_intra_mmx;
         s->dct_unquantize_mpeg2_inter = dct_unquantize_mpeg2_inter_mmx;
 
-        if (mm_flags & AV_CPU_FLAG_SSE2) {
+        if (mm_flags & AV_CPU_FLAG_SSE2 && HAVE_SSE2) {
             s->denoise_dct= denoise_dct_sse2;
         } else {
                 s->denoise_dct= denoise_dct_mmx;
diff --git a/libavcodec/x86/pngdsp_init.c b/libavcodec/x86/pngdsp_init.c
index aa21847..6365cea 100644
--- a/libavcodec/x86/pngdsp_init.c
+++ b/libavcodec/x86/pngdsp_init.c
@@ -38,14 +38,14 @@ void ff_pngdsp_init_x86(PNGDSPContext *dsp)
     int flags = av_get_cpu_flags();
 
 #if ARCH_X86_32
-    if (flags & AV_CPU_FLAG_MMX)
+    if (flags & AV_CPU_FLAG_MMX && HAVE_MMX)
         dsp->add_bytes_l2         = ff_add_bytes_l2_mmx;
 #endif
-    if (flags & AV_CPU_FLAG_MMXEXT)
+    if (flags & AV_CPU_FLAG_MMXEXT && HAVE_MMXEXT)
         dsp->add_paeth_prediction = ff_add_png_paeth_prediction_mmx2;
-    if (flags & AV_CPU_FLAG_SSE2)
+    if (flags & AV_CPU_FLAG_SSE2 && HAVE_SSE2)
         dsp->add_bytes_l2         = ff_add_bytes_l2_sse2;
-    if (flags & AV_CPU_FLAG_SSSE3)
+    if (flags & AV_CPU_FLAG_SSSE3 && HAVE_SSSE3)
         dsp->add_paeth_prediction = ff_add_png_paeth_prediction_ssse3;
 #endif
 }
diff --git a/libavcodec/x86/proresdsp_init.c b/libavcodec/x86/proresdsp_init.c
index b94c261..7f21b3a 100644
--- a/libavcodec/x86/proresdsp_init.c
+++ b/libavcodec/x86/proresdsp_init.c
@@ -34,12 +34,12 @@ void ff_proresdsp_x86_init(ProresDSPContext *dsp)
 #if ARCH_X86_64 && HAVE_YASM
     int flags = av_get_cpu_flags();
 
-    if (flags & AV_CPU_FLAG_SSE2) {
+    if (flags & AV_CPU_FLAG_SSE2 && HAVE_SSE2) {
         dsp->idct_permutation_type = FF_TRANSPOSE_IDCT_PERM;
         dsp->idct_put = ff_prores_idct_put_10_sse2;
     }
 
-    if (flags & AV_CPU_FLAG_SSE4) {
+    if (flags & AV_CPU_FLAG_SSE4 && HAVE_SSE4) {
         dsp->idct_permutation_type = FF_TRANSPOSE_IDCT_PERM;
         dsp->idct_put = ff_prores_idct_put_10_sse4;
     }
diff --git a/libavcodec/x86/rv34dsp_init.c b/libavcodec/x86/rv34dsp_init.c
index b07ad89..c6a7160 100644
--- a/libavcodec/x86/rv34dsp_init.c
+++ b/libavcodec/x86/rv34dsp_init.c
@@ -35,13 +35,13 @@ av_cold void ff_rv34dsp_init_x86(RV34DSPContext* c, 
DSPContext *dsp)
 #if HAVE_YASM
     int mm_flags = av_get_cpu_flags();
 
-    if (mm_flags & AV_CPU_FLAG_MMX)
+    if (mm_flags & AV_CPU_FLAG_MMX && HAVE_MMX)
         c->rv34_idct_dc_add = ff_rv34_idct_dc_add_mmx;
-    if (mm_flags & AV_CPU_FLAG_MMXEXT) {
+    if (mm_flags & AV_CPU_FLAG_MMXEXT && HAVE_MMXEXT) {
         c->rv34_inv_transform_dc = ff_rv34_idct_dc_noround_mmx2;
         c->rv34_idct_add         = ff_rv34_idct_add_mmx2;
     }
-    if (mm_flags & AV_CPU_FLAG_SSE4)
+    if (mm_flags & AV_CPU_FLAG_SSE4 && HAVE_SSE4)
         c->rv34_idct_dc_add = ff_rv34_idct_dc_add_sse4;
 #endif
 }
diff --git a/libavcodec/x86/rv40dsp_init.c b/libavcodec/x86/rv40dsp_init.c
index cf52b41..3cab826 100644
--- a/libavcodec/x86/rv40dsp_init.c
+++ b/libavcodec/x86/rv40dsp_init.c
@@ -188,7 +188,7 @@ void ff_rv40dsp_init_x86(RV34DSPContext *c, DSPContext *dsp)
 #if HAVE_YASM
     int mm_flags = av_get_cpu_flags();
 
-    if (mm_flags & AV_CPU_FLAG_MMX) {
+    if (mm_flags & AV_CPU_FLAG_MMX && HAVE_MMX) {
         c->put_chroma_pixels_tab[0] = ff_put_rv40_chroma_mc8_mmx;
         c->put_chroma_pixels_tab[1] = ff_put_rv40_chroma_mc4_mmx;
 #if HAVE_INLINE_ASM
@@ -201,7 +201,7 @@ void ff_rv40dsp_init_x86(RV34DSPContext *c, DSPContext *dsp)
         QPEL_MC_SET(put_, _mmx)
 #endif
     }
-    if (mm_flags & AV_CPU_FLAG_MMXEXT) {
+    if (mm_flags & AV_CPU_FLAG_MMXEXT && HAVE_MMXEXT) {
         c->avg_chroma_pixels_tab[0] = ff_avg_rv40_chroma_mc8_mmx2;
         c->avg_chroma_pixels_tab[1] = ff_avg_rv40_chroma_mc4_mmx2;
         c->rv40_weight_pixels_tab[0][0] = ff_rv40_weight_func_rnd_16_mmx2;
@@ -211,14 +211,14 @@ void ff_rv40dsp_init_x86(RV34DSPContext *c, DSPContext 
*dsp)
 #if ARCH_X86_32
         QPEL_MC_SET(avg_, _mmx2)
 #endif
-    } else if (mm_flags & AV_CPU_FLAG_3DNOW) {
+    } else if (mm_flags & AV_CPU_FLAG_3DNOW && HAVE_AMD3DNOW) {
         c->avg_chroma_pixels_tab[0] = ff_avg_rv40_chroma_mc8_3dnow;
         c->avg_chroma_pixels_tab[1] = ff_avg_rv40_chroma_mc4_3dnow;
 #if ARCH_X86_32
         QPEL_MC_SET(avg_, _3dnow)
 #endif
     }
-    if (mm_flags & AV_CPU_FLAG_SSE2) {
+    if (mm_flags & AV_CPU_FLAG_SSE2 && HAVE_SSE2) {
         c->rv40_weight_pixels_tab[0][0] = ff_rv40_weight_func_rnd_16_sse2;
         c->rv40_weight_pixels_tab[0][1] = ff_rv40_weight_func_rnd_8_sse2;
         c->rv40_weight_pixels_tab[1][0] = ff_rv40_weight_func_nornd_16_sse2;
@@ -226,7 +226,7 @@ void ff_rv40dsp_init_x86(RV34DSPContext *c, DSPContext *dsp)
         QPEL_MC_SET(put_, _sse2)
         QPEL_MC_SET(avg_, _sse2)
     }
-    if (mm_flags & AV_CPU_FLAG_SSSE3) {
+    if (mm_flags & AV_CPU_FLAG_SSSE3 && HAVE_SSSE3) {
         c->rv40_weight_pixels_tab[0][0] = ff_rv40_weight_func_rnd_16_ssse3;
         c->rv40_weight_pixels_tab[0][1] = ff_rv40_weight_func_rnd_8_ssse3;
         c->rv40_weight_pixels_tab[1][0] = ff_rv40_weight_func_nornd_16_ssse3;
diff --git a/libavcodec/x86/sbrdsp_init.c b/libavcodec/x86/sbrdsp_init.c
index 0ffe5b9..b88ddb4 100644
--- a/libavcodec/x86/sbrdsp_init.c
+++ b/libavcodec/x86/sbrdsp_init.c
@@ -32,7 +32,7 @@ void ff_sbrdsp_init_x86(SBRDSPContext *s)
     if (HAVE_YASM) {
         int mm_flags = av_get_cpu_flags();
 
-        if (mm_flags & AV_CPU_FLAG_SSE) {
+        if (mm_flags & AV_CPU_FLAG_SSE && HAVE_SSE) {
             s->sum_square = ff_sbr_sum_square_sse;
             s->hf_g_filt = ff_sbr_hf_g_filt_sse;
         }
diff --git a/libavcodec/x86/snowdsp.c b/libavcodec/x86/snowdsp.c
index fb190d8..42ac5d5 100644
--- a/libavcodec/x86/snowdsp.c
+++ b/libavcodec/x86/snowdsp.c
@@ -880,8 +880,8 @@ void ff_dwt_init_x86(DWTContext *c)
 #if HAVE_INLINE_ASM
     int mm_flags = av_get_cpu_flags();
 
-    if (mm_flags & AV_CPU_FLAG_MMX) {
-        if(mm_flags & AV_CPU_FLAG_SSE2 & 0){
+    if (mm_flags & AV_CPU_FLAG_MMX && HAVE_MMX) {
+        if (mm_flags & AV_CPU_FLAG_SSE2 & 0 && HAVE_SSE2) {
             c->horizontal_compose97i = ff_snow_horizontal_compose97i_sse2;
 #if HAVE_7REGS
             c->vertical_compose97i = ff_snow_vertical_compose97i_sse2;
@@ -889,7 +889,7 @@ void ff_dwt_init_x86(DWTContext *c)
             c->inner_add_yblock = ff_snow_inner_add_yblock_sse2;
         }
         else{
-            if (mm_flags & AV_CPU_FLAG_MMXEXT) {
+            if (mm_flags & AV_CPU_FLAG_MMXEXT && HAVE_MMXEXT) {
             c->horizontal_compose97i = ff_snow_horizontal_compose97i_mmx;
 #if HAVE_7REGS
             c->vertical_compose97i = ff_snow_vertical_compose97i_mmx;
diff --git a/libavcodec/x86/vc1dsp_mmx.c b/libavcodec/x86/vc1dsp_mmx.c
index f7ca714..f528302 100644
--- a/libavcodec/x86/vc1dsp_mmx.c
+++ b/libavcodec/x86/vc1dsp_mmx.c
@@ -737,7 +737,7 @@ void ff_vc1dsp_init_mmx(VC1DSPContext *dsp)
     int mm_flags = av_get_cpu_flags();
 
 #if HAVE_INLINE_ASM
-    if (mm_flags & AV_CPU_FLAG_MMX) {
+    if (mm_flags & AV_CPU_FLAG_MMX && HAVE_MMX) {
         dsp->put_vc1_mspel_pixels_tab[ 0] = ff_put_vc1_mspel_mc00_mmx;
         dsp->put_vc1_mspel_pixels_tab[ 4] = put_vc1_mspel_mc01_mmx;
         dsp->put_vc1_mspel_pixels_tab[ 8] = put_vc1_mspel_mc02_mmx;
@@ -759,7 +759,7 @@ void ff_vc1dsp_init_mmx(VC1DSPContext *dsp)
         dsp->put_vc1_mspel_pixels_tab[15] = put_vc1_mspel_mc33_mmx;
     }
 
-    if (mm_flags & AV_CPU_FLAG_MMXEXT) {
+    if (mm_flags & AV_CPU_FLAG_MMXEXT && HAVE_MMXEXT) {
         dsp->avg_vc1_mspel_pixels_tab[ 0] = ff_avg_vc1_mspel_mc00_mmx2;
         dsp->avg_vc1_mspel_pixels_tab[ 4] = avg_vc1_mspel_mc01_mmx2;
         dsp->avg_vc1_mspel_pixels_tab[ 8] = avg_vc1_mspel_mc02_mmx2;
@@ -796,29 +796,29 @@ void ff_vc1dsp_init_mmx(VC1DSPContext *dsp)
         dsp->vc1_h_loop_filter16 = vc1_h_loop_filter16_ ## EXT
 
 #if HAVE_YASM
-    if (mm_flags & AV_CPU_FLAG_MMX) {
+    if (mm_flags & AV_CPU_FLAG_MMX && HAVE_MMX) {
         dsp->put_no_rnd_vc1_chroma_pixels_tab[0]= 
ff_put_vc1_chroma_mc8_mmx_nornd;
     }
 
-    if (mm_flags & AV_CPU_FLAG_MMXEXT) {
+    if (mm_flags & AV_CPU_FLAG_MMXEXT && HAVE_MMXEXT) {
         ASSIGN_LF(mmx2);
         dsp->avg_no_rnd_vc1_chroma_pixels_tab[0]= 
ff_avg_vc1_chroma_mc8_mmx2_nornd;
-    } else if (mm_flags & AV_CPU_FLAG_3DNOW) {
+    } else if (mm_flags & AV_CPU_FLAG_3DNOW && HAVE_AMD3DNOW) {
         dsp->avg_no_rnd_vc1_chroma_pixels_tab[0]= 
ff_avg_vc1_chroma_mc8_3dnow_nornd;
     }
 
-    if (mm_flags & AV_CPU_FLAG_SSE2) {
+    if (mm_flags & AV_CPU_FLAG_SSE2 && HAVE_SSE2) {
         dsp->vc1_v_loop_filter8  = ff_vc1_v_loop_filter8_sse2;
         dsp->vc1_h_loop_filter8  = ff_vc1_h_loop_filter8_sse2;
         dsp->vc1_v_loop_filter16 = vc1_v_loop_filter16_sse2;
         dsp->vc1_h_loop_filter16 = vc1_h_loop_filter16_sse2;
     }
-    if (mm_flags & AV_CPU_FLAG_SSSE3) {
+    if (mm_flags & AV_CPU_FLAG_SSSE3 && HAVE_SSSE3) {
         ASSIGN_LF(ssse3);
         dsp->put_no_rnd_vc1_chroma_pixels_tab[0]= 
ff_put_vc1_chroma_mc8_ssse3_nornd;
         dsp->avg_no_rnd_vc1_chroma_pixels_tab[0]= 
ff_avg_vc1_chroma_mc8_ssse3_nornd;
     }
-    if (mm_flags & AV_CPU_FLAG_SSE4) {
+    if (mm_flags & AV_CPU_FLAG_SSE4 && HAVE_SSE4) {
         dsp->vc1_h_loop_filter8  = ff_vc1_h_loop_filter8_sse4;
         dsp->vc1_h_loop_filter16 = vc1_h_loop_filter16_sse4;
     }
diff --git a/libavcodec/x86/vp3dsp_init.c b/libavcodec/x86/vp3dsp_init.c
index 45af041..f38f551 100644
--- a/libavcodec/x86/vp3dsp_init.c
+++ b/libavcodec/x86/vp3dsp_init.c
@@ -58,7 +58,7 @@ av_cold void ff_vp3dsp_init_x86(VP3DSPContext *c, int flags)
         }
     }
 
-    if (cpuflags & AV_CPU_FLAG_SSE2) {
+    if (HAVE_SSE2 && cpuflags & AV_CPU_FLAG_SSE2) {
         c->idct_put  = ff_vp3_idct_put_sse2;
         c->idct_add  = ff_vp3_idct_add_sse2;
         c->idct_perm = FF_TRANSPOSE_IDCT_PERM;
diff --git a/libavcodec/x86/vp56dsp_init.c b/libavcodec/x86/vp56dsp_init.c
index aa5f5e5..e97aa19 100644
--- a/libavcodec/x86/vp56dsp_init.c
+++ b/libavcodec/x86/vp56dsp_init.c
@@ -37,12 +37,12 @@ av_cold void ff_vp56dsp_init_x86(VP56DSPContext* c, enum 
AVCodecID codec)
 
     if (CONFIG_VP6_DECODER && codec == AV_CODEC_ID_VP6) {
 #if ARCH_X86_32
-        if (mm_flags & AV_CPU_FLAG_MMX) {
+        if (mm_flags & AV_CPU_FLAG_MMX && HAVE_MMX) {
             c->vp6_filter_diag4 = ff_vp6_filter_diag4_mmx;
         }
 #endif
 
-        if (mm_flags & AV_CPU_FLAG_SSE2) {
+        if (mm_flags & AV_CPU_FLAG_SSE2 && HAVE_SSE2) {
             c->vp6_filter_diag4 = ff_vp6_filter_diag4_sse2;
         }
     }
diff --git a/libavcodec/x86/vp8dsp_init.c b/libavcodec/x86/vp8dsp_init.c
index 04cfecc..09c28eb 100644
--- a/libavcodec/x86/vp8dsp_init.c
+++ b/libavcodec/x86/vp8dsp_init.c
@@ -320,7 +320,7 @@ av_cold void ff_vp8dsp_init_x86(VP8DSPContext* c)
 #if HAVE_YASM
     int mm_flags = av_get_cpu_flags();
 
-    if (mm_flags & AV_CPU_FLAG_MMX) {
+    if (mm_flags & AV_CPU_FLAG_MMX && HAVE_MMX) {
         c->vp8_idct_dc_add    = ff_vp8_idct_dc_add_mmx;
         c->vp8_idct_dc_add4uv = ff_vp8_idct_dc_add4uv_mmx;
 #if ARCH_X86_32
@@ -351,7 +351,7 @@ av_cold void ff_vp8dsp_init_x86(VP8DSPContext* c)
 
     /* note that 4-tap width=16 functions are missing because w=16
      * is only used for luma, and luma is always a copy or sixtap. */
-    if (mm_flags & AV_CPU_FLAG_MMXEXT) {
+    if (mm_flags & AV_CPU_FLAG_MMXEXT && HAVE_MMXEXT) {
         VP8_MC_FUNC(2, 4, mmx2);
         VP8_BILINEAR_MC_FUNC(2, 4, mmx2);
 #if ARCH_X86_32
@@ -375,14 +375,14 @@ av_cold void ff_vp8dsp_init_x86(VP8DSPContext* c)
 #endif
     }
 
-    if (mm_flags & AV_CPU_FLAG_SSE) {
+    if (mm_flags & AV_CPU_FLAG_SSE && HAVE_SSE) {
         c->vp8_idct_add                         = ff_vp8_idct_add_sse;
         c->vp8_luma_dc_wht                      = ff_vp8_luma_dc_wht_sse;
         c->put_vp8_epel_pixels_tab[0][0][0]     =
         c->put_vp8_bilinear_pixels_tab[0][0][0] = ff_put_vp8_pixels16_sse;
     }
 
-    if (mm_flags & (AV_CPU_FLAG_SSE2|AV_CPU_FLAG_SSE2SLOW)) {
+    if (mm_flags & (AV_CPU_FLAG_SSE2 | AV_CPU_FLAG_SSE2SLOW) && HAVE_SSE2) {
         VP8_LUMA_MC_FUNC(0, 16, sse2);
         VP8_MC_FUNC(1, 8, sse2);
         VP8_BILINEAR_MC_FUNC(0, 16, sse2);
@@ -399,7 +399,7 @@ av_cold void ff_vp8dsp_init_x86(VP8DSPContext* c)
 #endif
     }
 
-    if (mm_flags & AV_CPU_FLAG_SSE2) {
+    if (mm_flags & AV_CPU_FLAG_SSE2 && HAVE_SSE2) {
         c->vp8_idct_dc_add4y          = ff_vp8_idct_dc_add4y_sse2;
 
         c->vp8_h_loop_filter_simple = ff_vp8_h_loop_filter_simple_sse2;
@@ -413,7 +413,7 @@ av_cold void ff_vp8dsp_init_x86(VP8DSPContext* c)
 #endif
     }
 
-    if (mm_flags & AV_CPU_FLAG_SSSE3) {
+    if (mm_flags & AV_CPU_FLAG_SSSE3 && HAVE_SSSE3) {
         VP8_LUMA_MC_FUNC(0, 16, ssse3);
         VP8_MC_FUNC(1, 8, ssse3);
         VP8_MC_FUNC(2, 4, ssse3);
@@ -437,7 +437,7 @@ av_cold void ff_vp8dsp_init_x86(VP8DSPContext* c)
 #endif
     }
 
-    if (mm_flags & AV_CPU_FLAG_SSE4) {
+    if (mm_flags & AV_CPU_FLAG_SSE4 && HAVE_SSE4) {
         c->vp8_idct_dc_add                  = ff_vp8_idct_dc_add_sse4;
 
         c->vp8_h_loop_filter_simple   = ff_vp8_h_loop_filter_simple_sse4;
diff --git a/libswscale/x86/rgb2rgb.c b/libswscale/x86/rgb2rgb.c
index 3116ed6..47c669d 100644
--- a/libswscale/x86/rgb2rgb.c
+++ b/libswscale/x86/rgb2rgb.c
@@ -133,7 +133,7 @@ av_cold void rgb2rgb_init_x86(void)
 #if HAVE_INLINE_ASM
     int cpu_flags = av_get_cpu_flags();
 
-    if (cpu_flags & AV_CPU_FLAG_MMX)
+    if (HAVE_MMX      && cpu_flags & AV_CPU_FLAG_MMX)
         rgb2rgb_init_MMX();
     if (HAVE_AMD3DNOW && cpu_flags & AV_CPU_FLAG_3DNOW)
         rgb2rgb_init_3DNOW();
diff --git a/libswscale/x86/swscale.c b/libswscale/x86/swscale.c
index 9683c0c..9ea3d37 100644
--- a/libswscale/x86/swscale.c
+++ b/libswscale/x86/swscale.c
@@ -306,7 +306,7 @@ av_cold void ff_sws_init_swScale_mmx(SwsContext *c)
     int cpu_flags = av_get_cpu_flags();
 
 #if HAVE_INLINE_ASM
-    if (cpu_flags & AV_CPU_FLAG_MMX)
+    if (cpu_flags & AV_CPU_FLAG_MMX && HAVE_MMX)
         sws_init_swScale_MMX(c);
 #if HAVE_MMXEXT
     if (cpu_flags & AV_CPU_FLAG_MMXEXT)
@@ -357,7 +357,7 @@ switch(c->dstBpc){ \
                 c->chrToYV12 = ff_ ## x ## ToUV_ ## opt; \
             break
 #if ARCH_X86_32
-    if (cpu_flags & AV_CPU_FLAG_MMX) {
+    if (cpu_flags & AV_CPU_FLAG_MMX && HAVE_MMX) {
         ASSIGN_MMX_SCALE_FUNC(c->hyScale, c->hLumFilterSize, mmx, mmx);
         ASSIGN_MMX_SCALE_FUNC(c->hcScale, c->hChrFilterSize, mmx, mmx);
         ASSIGN_VSCALE_FUNC(c->yuv2plane1, mmx, mmx2, cpu_flags & 
AV_CPU_FLAG_MMXEXT);
@@ -392,7 +392,7 @@ switch(c->dstBpc){ \
             break;
         }
     }
-    if (cpu_flags & AV_CPU_FLAG_MMXEXT) {
+    if (cpu_flags & AV_CPU_FLAG_MMXEXT && HAVE_MMXEXT) {
         ASSIGN_VSCALEX_FUNC(c->yuv2planeX, mmx2, , 1);
     }
 #endif
@@ -404,7 +404,7 @@ switch(c->dstBpc){ \
              else                ASSIGN_SCALE_FUNC2(hscalefn, X8, opt1, opt2); 
\
              break; \
     }
-    if (cpu_flags & AV_CPU_FLAG_SSE2) {
+    if (cpu_flags & AV_CPU_FLAG_SSE2 && HAVE_SSE2) {
         ASSIGN_SSE_SCALE_FUNC(c->hyScale, c->hLumFilterSize, sse2, sse2);
         ASSIGN_SSE_SCALE_FUNC(c->hcScale, c->hChrFilterSize, sse2, sse2);
         ASSIGN_VSCALEX_FUNC(c->yuv2planeX, sse2, ,
@@ -441,7 +441,7 @@ switch(c->dstBpc){ \
             break;
         }
     }
-    if (cpu_flags & AV_CPU_FLAG_SSSE3) {
+    if (cpu_flags & AV_CPU_FLAG_SSSE3 && HAVE_SSSE3) {
         ASSIGN_SSE_SCALE_FUNC(c->hyScale, c->hLumFilterSize, ssse3, ssse3);
         ASSIGN_SSE_SCALE_FUNC(c->hcScale, c->hChrFilterSize, ssse3, ssse3);
         switch (c->srcFormat) {
@@ -451,7 +451,7 @@ switch(c->dstBpc){ \
             break;
         }
     }
-    if (cpu_flags & AV_CPU_FLAG_SSE4) {
+    if (cpu_flags & AV_CPU_FLAG_SSE4 && HAVE_SSE4) {
         /* Xto15 don't need special sse4 functions */
         ASSIGN_SSE_SCALE_FUNC(c->hyScale, c->hLumFilterSize, sse4, ssse3);
         ASSIGN_SSE_SCALE_FUNC(c->hcScale, c->hChrFilterSize, sse4, ssse3);
@@ -462,7 +462,7 @@ switch(c->dstBpc){ \
             c->yuv2plane1 = ff_yuv2plane1_16_sse4;
     }
 
-    if (cpu_flags & AV_CPU_FLAG_AVX) {
+    if (cpu_flags & AV_CPU_FLAG_AVX && HAVE_AVX) {
         ASSIGN_VSCALEX_FUNC(c->yuv2planeX, avx, ,
                             HAVE_ALIGNED_STACK || ARCH_X86_64);
         ASSIGN_VSCALE_FUNC(c->yuv2plane1, avx, avx, 1);
diff --git a/libswscale/x86/yuv2rgb.c b/libswscale/x86/yuv2rgb.c
index 9375549..2fe0e3a 100644
--- a/libswscale/x86/yuv2rgb.c
+++ b/libswscale/x86/yuv2rgb.c
@@ -87,7 +87,7 @@ av_cold SwsFunc ff_yuv2rgb_init_mmx(SwsContext *c)
     }
 #endif
 
-    if (cpu_flags & AV_CPU_FLAG_MMX) {
+    if (cpu_flags & AV_CPU_FLAG_MMX && HAVE_MMX) {
         switch (c->dstFormat) {
             case PIX_FMT_RGB32:
                 if (c->srcFormat == PIX_FMT_YUVA420P) {
-- 
1.7.1

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to