From a48079c520e49ab340f98e3df912ab7bdd76d44b Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@gmail.com>
Date: Thu, 23 Oct 2014 10:32:43 +0200
Subject: applying patch ffmpeg-0.11.5-gcc2.patch


diff --git a/cmdutils.c b/cmdutils.c
index 9afb54c..306dd4b 100644
--- a/cmdutils.c
+++ b/cmdutils.c
@@ -94,7 +94,7 @@ static void log_callback_report(void *ptr, int level, const char *fmt, va_list v
     char line[1024];
     static int print_prefix = 1;
 
-    va_copy(vl2, vl);
+    __va_copy(vl2, vl);
     av_log_default_callback(ptr, level, fmt, vl);
     av_log_format_line(ptr, level, fmt, vl2, line, sizeof(line), &print_prefix);
     va_end(vl2);
diff --git a/configure b/configure
index 66112bf..ee20361 100755
--- a/configure
+++ b/configure
@@ -1378,7 +1378,6 @@ avx_deps="ssse3"
 
 aligned_stack_if_any="ppc x86"
 fast_64bit_if_any="alpha ia64 mips64 parisc64 ppc64 sparc64 x86_64"
-fast_clz_if_any="alpha armv5te avr32 mips ppc x86"
 fast_unaligned_if_any="armv6 ppc x86"
 
 inline_asm_deps="!tms470"
@@ -1917,7 +1916,7 @@ AS_O='-o $@'
 CC_O='-o $@'
 CXX_O='-o $@'
 
-host_cflags='-D_ISOC99_SOURCE -O3 -g'
+host_cflags='-D_ISOC99_SOURCE -O2 -g'
 host_libs='-lm'
 
 target_path='$(CURDIR)'
@@ -2000,6 +1999,7 @@ for n in $COMPONENT_LIST; do
 done
 
 enable $ARCH_EXT_LIST $ALL_TESTS
+disable sse
 
 die_unknown(){
     echo "Unknown option \"$1\"."
@@ -2182,7 +2182,7 @@ if   $cc -v 2>&1 | grep -q '^gcc.*LLVM'; then
     cc_ident="llvm-gcc $($cc -dumpversion) $gcc_extra_ver"
     CC_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
     AS_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
-    speed_cflags='-O3'
+    speed_cflags='-O2'
     size_cflags='-Os'
 elif $cc -v 2>&1 | grep -qi ^gcc; then
     cc_type=gcc
@@ -2908,10 +2908,6 @@ check_cc <<EOF && enable attribute_packed
 struct { int x; } __attribute__((packed)) x;
 EOF
 
-check_cc <<EOF && enable attribute_may_alias
-union { int x; } __attribute__((may_alias)) x;
-EOF
-
 check_cc <<EOF || die "endian test failed"
 unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
 EOF
@@ -3192,8 +3188,6 @@ disabled crystalhd || check_lib libcrystalhd/libcrystalhd_if.h DtsCrystalHDVersi
 enabled vaapi && require vaapi va/va.h vaInitialize -lva
 
 check_mathfunc cbrtf
-check_mathfunc exp2
-check_mathfunc exp2f
 check_mathfunc llrint
 check_mathfunc llrintf
 check_mathfunc log2
diff --git a/ffprobe.c b/ffprobe.c
index d53ec11..41c5cec 100644
--- a/ffprobe.c
+++ b/ffprobe.c
@@ -312,7 +312,9 @@ static void writer_print_time(WriterContext *wctx, const char *key,
             writer_print_string(wctx, key, "N/A", 1);
         } else {
             double d = ts * av_q2d(*time_base);
-            value_string(buf, sizeof(buf), (struct unit_value){.val.d=d, .unit=unit_second_str});
+            struct unit_value value2 = {.unit=unit_second_str};
+            value2.val.d = d;
+            value_string(buf, sizeof(buf), value2);
             writer_print_string(wctx, key, buf, 0);
         }
     }
@@ -1187,8 +1189,8 @@ static void writer_register_all(void)
 #define print_str_opt(k, v)     writer_print_string(w, k, v, 1)
 #define print_time(k, v, tb)    writer_print_time(w, k, v, tb)
 #define print_ts(k, v)          writer_print_ts(w, k, v)
-#define print_val(k, v, u)      writer_print_string(w, k, \
-    value_string(val_str, sizeof(val_str), (struct unit_value){.val.i = v, .unit=u}), 0)
+#define print_val(k, v, u)      value2.val.i = v; value2.unit=u; writer_print_string(w, k, \
+    value_string(val_str, sizeof(val_str), value2), 0); 
 #define print_section_header(s) writer_print_section_header(w, s)
 #define print_section_footer(s) writer_print_section_footer(w, s)
 #define show_tags(metadata)     writer_show_tags(w, metadata)
@@ -1199,6 +1201,7 @@ static void show_packet(WriterContext *w, AVFormatContext *fmt_ctx, AVPacket *pk
     AVStream *st = fmt_ctx->streams[pkt->stream_index];
     AVBPrint pbuf;
     const char *s;
+    struct unit_value value2;
 
     av_bprint_init(&pbuf, 1, AV_BPRINT_SIZE_UNLIMITED);
 
@@ -1227,6 +1230,7 @@ static void show_frame(WriterContext *w, AVFrame *frame, AVStream *stream)
 {
     AVBPrint pbuf;
     const char *s;
+    struct unit_value value2;
 
     av_bprint_init(&pbuf, 1, AV_BPRINT_SIZE_UNLIMITED);
 
@@ -1356,6 +1360,7 @@ static void show_stream(WriterContext *w, AVFormatContext *fmt_ctx, int stream_i
     const char *s;
     AVRational display_aspect_ratio;
     AVBPrint pbuf;
+    struct unit_value value2;
 
     av_bprint_init(&pbuf, 1, AV_BPRINT_SIZE_UNLIMITED);
 
@@ -1446,7 +1451,7 @@ static void show_stream(WriterContext *w, AVFormatContext *fmt_ctx, int stream_i
     print_fmt("time_base",      "%d/%d", stream->time_base.num,      stream->time_base.den);
     print_time("start_time",    stream->start_time, &stream->time_base);
     print_time("duration",      stream->duration,   &stream->time_base);
-    if (dec_ctx->bit_rate > 0) print_val    ("bit_rate", dec_ctx->bit_rate, unit_bit_per_second_str);
+    if (dec_ctx->bit_rate > 0) { print_val    ("bit_rate", dec_ctx->bit_rate, unit_bit_per_second_str); }
     else                       print_str_opt("bit_rate", "N/A");
     if (stream->nb_frames) print_fmt    ("nb_frames", "%"PRId64, stream->nb_frames);
     else                   print_str_opt("nb_frames", "N/A");
@@ -1472,6 +1477,7 @@ static void show_format(WriterContext *w, AVFormatContext *fmt_ctx)
 {
     char val_str[128];
     int64_t size = fmt_ctx->pb ? avio_size(fmt_ctx->pb) : -1;
+    struct unit_value value2;
 
     print_section_header("format");
     print_str("filename",         fmt_ctx->filename);
@@ -1480,9 +1486,9 @@ static void show_format(WriterContext *w, AVFormatContext *fmt_ctx)
     print_str("format_long_name", fmt_ctx->iformat->long_name);
     print_time("start_time",      fmt_ctx->start_time, &AV_TIME_BASE_Q);
     print_time("duration",        fmt_ctx->duration,   &AV_TIME_BASE_Q);
-    if (size >= 0) print_val    ("size", size, unit_byte_str);
+    if (size >= 0) { print_val    ("size", size, unit_byte_str); }
     else           print_str_opt("size", "N/A");
-    if (fmt_ctx->bit_rate > 0) print_val    ("bit_rate", fmt_ctx->bit_rate, unit_bit_per_second_str);
+    if (fmt_ctx->bit_rate > 0) { print_val    ("bit_rate", fmt_ctx->bit_rate, unit_bit_per_second_str); }
     else                       print_str_opt("bit_rate", "N/A");
     show_tags(fmt_ctx->metadata);
     print_section_footer("format");
diff --git a/ffserver.c b/ffserver.c
index a0efa54..0d1684a 100644
--- a/ffserver.c
+++ b/ffserver.c
@@ -305,7 +305,7 @@ static int rtp_new_av_stream(HTTPContext *c,
 static const char *my_program_name;
 static const char *my_program_dir;
 
-static const char *config_filename = "/etc/ffserver.conf";
+static const char *config_filename = "/packages/ffmpeg-0.11.1-2/.settings/ffserver.conf";
 
 static int ffserver_debug;
 static int ffserver_daemon;
@@ -4659,7 +4659,7 @@ static const OptionDef options[] = {
 #include "cmdutils_common_opts.h"
     { "n", OPT_BOOL, {(void *)&no_launch }, "enable no-launch mode" },
     { "d", 0, {(void*)opt_debug}, "enable debug mode" },
-    { "f", HAS_ARG | OPT_STRING, {(void*)&config_filename }, "use configfile instead of /etc/ffserver.conf", "configfile" },
+    { "f", HAS_ARG | OPT_STRING, {(void*)&config_filename }, "use configfile instead of /packages/ffmpeg-0.11.1-2/.settings/ffserver.conf", "configfile" },
     { NULL },
 };
 
diff --git a/libavcodec/pngenc.c b/libavcodec/pngenc.c
index c29435b..1f73bc4 100644
--- a/libavcodec/pngenc.c
+++ b/libavcodec/pngenc.c
@@ -55,8 +55,9 @@ static void png_get_interlaced_row(uint8_t *dst, int row_size,
     int x, mask, dst_x, j, b, bpp;
     uint8_t *d;
     const uint8_t *s;
+    int mask_tmp[] = {0x80, 0x08, 0x88, 0x22, 0xaa, 0x55, 0xff};
 
-    mask =  (int[]){0x80, 0x08, 0x88, 0x22, 0xaa, 0x55, 0xff}[pass];
+    mask =  mask_tmp[pass];
     switch(bits_per_pixel) {
     case 1:
         memset(dst, 0, row_size);
diff --git a/libavfilter/af_aresample.c b/libavfilter/af_aresample.c
index 90e8781..bdba6db 100644
--- a/libavfilter/af_aresample.c
+++ b/libavfilter/af_aresample.c
@@ -103,20 +103,23 @@ static int query_formats(AVFilterContext *ctx)
     ff_channel_layouts_ref(in_layouts,      &inlink->out_channel_layouts);
 
     if(out_rate > 0) {
-        out_samplerates = avfilter_make_format_list((int[]){ out_rate, -1 });
+       int samplerate_tmp[] = { out_rate, -1 };
+       out_samplerates = avfilter_make_format_list(samplerate_tmp);
     } else {
         out_samplerates = ff_all_samplerates();
     }
     avfilter_formats_ref(out_samplerates, &outlink->in_samplerates);
 
     if(out_format != AV_SAMPLE_FMT_NONE) {
-        out_formats = avfilter_make_format_list((int[]){ out_format, -1 });
+       int format_tmp[] = { out_format, -1 };
+        out_formats = avfilter_make_format_list(format_tmp);
     } else
         out_formats = avfilter_make_all_formats(AVMEDIA_TYPE_AUDIO);
     avfilter_formats_ref(out_formats, &outlink->in_formats);
 
     if(out_layout) {
-        out_layouts = avfilter_make_format64_list((int64_t[]){ out_layout, -1 });
+        int64_t layout_tmp[] = { out_layout, -1 };
+        out_layouts = avfilter_make_format64_list(layout_tmp);
     } else
         out_layouts = ff_all_channel_layouts();
     ff_channel_layouts_ref(out_layouts, &outlink->in_channel_layouts);
diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
index e73cf8d..0bff2d6 100644
--- a/libavutil/pixdesc.c
+++ b/libavutil/pixdesc.c
@@ -1117,12 +1117,6 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
         .log2_chroma_h = 1,
         .flags = PIX_FMT_HWACCEL,
     },
-    [PIX_FMT_VDA_VLD] = {
-        .name = "vda_vld",
-        .log2_chroma_w = 1,
-        .log2_chroma_h = 1,
-        .flags = PIX_FMT_HWACCEL,
-    },
     [PIX_FMT_GRAY8A] = {
         .name = "gray8a",
         .nb_components = 2,
diff --git a/libswresample/x86/swresample_x86.c b/libswresample/x86/swresample_x86.c
index 6cd6073..5436bc3 100644
--- a/libswresample/x86/swresample_x86.c
+++ b/libswresample/x86/swresample_x86.c
@@ -25,7 +25,7 @@
 #define PROTO2(pre, out, cap) PROTO(pre, int16, out, cap) PROTO(pre, int32, out, cap) PROTO(pre, float, out, cap)
 #define PROTO3(pre, cap) PROTO2(pre, int16, cap) PROTO2(pre, int32, cap) PROTO2(pre, float, cap)
 #define PROTO4(pre) PROTO3(pre, mmx) PROTO3(pre, sse) PROTO3(pre, sse2) PROTO3(pre, ssse3) PROTO3(pre, sse4) PROTO3(pre, avx)
-PROTO4()
+PROTO4( )
 PROTO4(_pack_2ch)
 PROTO4(_pack_6ch)
 PROTO4(_unpack_2ch)
diff --git a/libswscale/swscale_unscaled.c b/libswscale/swscale_unscaled.c
index 52951e0..74a61b8 100644
--- a/libswscale/swscale_unscaled.c
+++ b/libswscale/swscale_unscaled.c
@@ -472,38 +472,41 @@ static int planarRgbToRgbWrapper(SwsContext *c, const uint8_t *src[],
     }
 
     switch (c->dstFormat) {
-    case PIX_FMT_BGR24:
-        gbr24ptopacked24((const uint8_t *[]) { src[1], src[0], src[2] },
-                         (int []) { srcStride[1], srcStride[0], srcStride[2] },
-                         dst[0] + srcSliceY * dstStride[0], dstStride[0],
+    case PIX_FMT_BGR24: {
+        const uint8_t* src2[] =  {src[1], src[0], src[2]};
+        int srcStride2[] = {srcStride[1], srcStride[0], srcStride[2]};
+        gbr24ptopacked24(src2, srcStride2, dst[0] + srcSliceY * dstStride[0], dstStride[0],
                          srcSliceH, c->srcW);
         break;
 
-    case PIX_FMT_RGB24:
-        gbr24ptopacked24((const uint8_t *[]) { src[2], src[0], src[1] },
-                         (int []) { srcStride[2], srcStride[0], srcStride[1] },
-                         dst[0] + srcSliceY * dstStride[0], dstStride[0],
-                         srcSliceH, c->srcW);
+    }
+    case PIX_FMT_RGB24: {
+        const uint8_t* src2[] =  {src[2], src[0], src[1]};
+        int srcStride2[] = {srcStride[2], srcStride[0], srcStride[1]};
+        gbr24ptopacked24(src2, srcStride2, dst[0] + srcSliceY * dstStride[0], dstStride[0],
+                          srcSliceH, c->srcW);
         break;
-
+    }
     case PIX_FMT_ARGB:
         alpha_first = 1;
-    case PIX_FMT_RGBA:
-        gbr24ptopacked32((const uint8_t *[]) { src[2], src[0], src[1] },
-                         (int []) { srcStride[2], srcStride[0], srcStride[1] },
-                         dst[0] + srcSliceY * dstStride[0], dstStride[0],
-                         srcSliceH, alpha_first, c->srcW);
-        break;
-
+    case PIX_FMT_RGBA: {
+        const uint8_t* src2[] =  {src[2], src[0], src[1]};
+        int srcStride2[] = {srcStride[2], srcStride[0], srcStride[1]};
+        gbr24ptopacked32(src2, srcStride2,
+                          dst[0] + srcSliceY * dstStride[0], dstStride[0],
+                          srcSliceH, alpha_first, c->srcW);
+         break;
+    }
     case PIX_FMT_ABGR:
         alpha_first = 1;
-    case PIX_FMT_BGRA:
-        gbr24ptopacked32((const uint8_t *[]) { src[1], src[0], src[2] },
-                         (int []) { srcStride[1], srcStride[0], srcStride[2] },
-                         dst[0] + srcSliceY * dstStride[0], dstStride[0],
-                         srcSliceH, alpha_first, c->srcW);
-        break;
-
+    case PIX_FMT_BGRA: {
+        const uint8_t* src2[] =  {src[1], src[0], src[2]};
+        int srcStride2[] = {srcStride[1], srcStride[0], srcStride[2]};
+        gbr24ptopacked32(src2, srcStride2,
+                          dst[0] + srcSliceY * dstStride[0], dstStride[0],
+                          srcSliceH, alpha_first, c->srcW);
+         break;
+    }
     default:
         av_log(c, AV_LOG_ERROR,
                "unsupported planar RGB conversion %s -> %s\n",
-- 
1.8.3.4


From bb2b8ce280cca96855ebbe3475b9e134f0d35427 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@gmail.com>
Date: Thu, 23 Oct 2014 11:09:11 +0200
Subject: Avoid utf8 in doc to make texi2pod happy.


diff --git a/doc/filters.texi b/doc/filters.texi
index 324a154..7303a7d 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -2924,7 +2924,7 @@ Tile several successive frames together.
 It accepts as argument the tile size (i.e. the number of lines and columns)
 in the form "@var{w}x@var{h}".
 
-For example, produce 8×8 PNG tiles of all keyframes (@option{-skip_frame
+For example, produce 8x8 PNG tiles of all keyframes (@option{-skip_frame
 nokey}) in a movie:
 @example
 ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
-- 
1.8.3.4


From 21b82aeed933d7a1811fd8b57866db841762b4be Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@gmail.com>
Date: Thu, 23 Oct 2014 11:09:37 +0200
Subject: fix ffprobe when GPL libs are disabled.

libpostproc is not built in that case.

diff --git a/ffprobe.c b/ffprobe.c
index 41c5cec..95712b4 100644
--- a/ffprobe.c
+++ b/ffprobe.c
@@ -1664,7 +1664,7 @@ static void ffprobe_show_library_versions(WriterContext *w)
     SHOW_LIB_VERSION(avfilter,   AVFILTER);
     SHOW_LIB_VERSION(swscale,    SWSCALE);
     SHOW_LIB_VERSION(swresample, SWRESAMPLE);
-    SHOW_LIB_VERSION(postproc,   POSTPROC);
+//    SHOW_LIB_VERSION(postproc,   POSTPROC);
     writer_print_chapter_footer(w, "library_versions");
 }
 
-- 
1.8.3.4


From a4f7f2a2d6634d1bd9c832b1c7103e58087c4306 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@gmail.com>
Date: Thu, 23 Oct 2014 21:02:26 +0200
Subject: gcc2 hacks.

ffmpeg relies on the compiler optimizing:

    #define FOO 0
    if(FOO) call_foo();

gcc2 doesn't seem to do that, and in the end the lib can't be loaded
because of missing symbol call_foo. So replace the if with #ifdef to
make things work.

Note that this shouldn't disable anything that wasn't already. Stuff is
disabled because either of:
- ARM/PPC/other CPU specific
- GPL licensed (we don't currently enable those parts - they need more
	patches)
- Uses 3dnow (manually disabled - doesn't compile here) or AVX (not
	enabled by buildsystem)

diff --git a/libavcodec/aacpsdsp.c b/libavcodec/aacpsdsp.c
index e90c50b..84c4a49 100644
--- a/libavcodec/aacpsdsp.c
+++ b/libavcodec/aacpsdsp.c
@@ -209,6 +209,7 @@ av_cold void ff_psdsp_init(PSDSPContext *s)
     s->stereo_interpolate[0]  = ps_stereo_interpolate_c;
     s->stereo_interpolate[1]  = ps_stereo_interpolate_ipdopd_c;
 
-    if (ARCH_ARM)
+#if ARCH_ARM
         ff_psdsp_init_arm(s);
+#endif
 }
diff --git a/libavcodec/ac3dsp.c b/libavcodec/ac3dsp.c
index 581e5f5..a4c1721 100644
--- a/libavcodec/ac3dsp.c
+++ b/libavcodec/ac3dsp.c
@@ -228,8 +228,9 @@ av_cold void ff_ac3dsp_init(AC3DSPContext *c, int bit_exact)
     c->sum_square_butterfly_int32 = ac3_sum_square_butterfly_int32_c;
     c->sum_square_butterfly_float = ac3_sum_square_butterfly_float_c;
 
-    if (ARCH_ARM)
+#if ARCH_ARM
         ff_ac3dsp_init_arm(c, bit_exact);
+#endif
     if (HAVE_MMX)
         ff_ac3dsp_init_x86(c, bit_exact);
 }
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index ac05b9b..9bfabd5 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -54,6 +54,7 @@ void avcodec_register_all(void)
     initialized = 1;
 
     /* hardware accelerators */
+#ifndef __HAIKU__
     REGISTER_HWACCEL (H263_VAAPI, h263_vaapi);
     REGISTER_HWACCEL (H264_DXVA2, h264_dxva2);
     REGISTER_HWACCEL (H264_VAAPI, h264_vaapi);
@@ -67,6 +68,7 @@ void avcodec_register_all(void)
     REGISTER_HWACCEL (VC1_VAAPI, vc1_vaapi);
     REGISTER_HWACCEL (WMV3_DXVA2, wmv3_dxva2);
     REGISTER_HWACCEL (WMV3_VAAPI, wmv3_vaapi);
+#endif
 
     /* video codecs */
     REGISTER_ENCODER (A64MULTI, a64multi);
@@ -115,7 +117,9 @@ void avcodec_register_all(void)
     REGISTER_DECODER (ESCAPE124, escape124);
     REGISTER_DECODER (ESCAPE130, escape130);
     REGISTER_DECODER (EXR, exr);
+#ifndef __HAIKU__
     REGISTER_ENCDEC  (FFV1, ffv1);
+#endif
     REGISTER_ENCDEC  (FFVHUFF, ffvhuff);
     REGISTER_ENCDEC  (FLASHSV, flashsv);
     REGISTER_ENCDEC  (FLASHSV2, flashsv2);
@@ -130,8 +134,10 @@ void avcodec_register_all(void)
     REGISTER_DECODER (H263I, h263i);
     REGISTER_ENCODER (H263P, h263p);
     REGISTER_DECODER (H264, h264);
+#ifndef __HAIKU__
     REGISTER_DECODER (H264_CRYSTALHD, h264_crystalhd);
     REGISTER_DECODER (H264_VDPAU, h264_vdpau);
+#endif
     REGISTER_ENCDEC  (HUFFYUV, huffyuv);
     REGISTER_DECODER (IDCIN, idcin);
     REGISTER_DECODER (IFF_BYTERUN1, iff_byterun1);
@@ -155,17 +161,23 @@ void avcodec_register_all(void)
     REGISTER_DECODER (MJPEGB, mjpegb);
     REGISTER_DECODER (MMVIDEO, mmvideo);
     REGISTER_DECODER (MOTIONPIXELS, motionpixels);
+#ifndef __HAIKU__
     REGISTER_DECODER (MPEG_XVMC, mpeg_xvmc);
+#endif
     REGISTER_ENCDEC  (MPEG1VIDEO, mpeg1video);
     REGISTER_ENCDEC  (MPEG2VIDEO, mpeg2video);
     REGISTER_ENCDEC  (MPEG4, mpeg4);
+#ifndef __HAIKU__
     REGISTER_DECODER (MPEG4_CRYSTALHD, mpeg4_crystalhd);
     REGISTER_DECODER (MPEG4_VDPAU, mpeg4_vdpau);
+#endif
     REGISTER_DECODER (MPEGVIDEO, mpegvideo);
+#ifndef __HAIKU__
     REGISTER_DECODER (MPEG_VDPAU, mpeg_vdpau);
     REGISTER_DECODER (MPEG1_VDPAU, mpeg1_vdpau);
     REGISTER_DECODER (MPEG2_CRYSTALHD, mpeg2_crystalhd);
     REGISTER_DECODER (MSMPEG4_CRYSTALHD, msmpeg4_crystalhd);
+#endif
     REGISTER_DECODER (MSMPEG4V1, msmpeg4v1);
     REGISTER_ENCDEC  (MSMPEG4V2, msmpeg4v2);
     REGISTER_ENCDEC  (MSMPEG4V3, msmpeg4v3);
@@ -229,8 +241,10 @@ void avcodec_register_all(void)
     REGISTER_DECODER (VB, vb);
     REGISTER_DECODER (VBLE, vble);
     REGISTER_DECODER (VC1, vc1);
+#ifndef __HAIKU__
     REGISTER_DECODER (VC1_CRYSTALHD, vc1_crystalhd);
     REGISTER_DECODER (VC1_VDPAU, vc1_vdpau);
+#endif
     REGISTER_DECODER (VC1IMAGE, vc1image);
     REGISTER_DECODER (VCR1, vcr1);
     REGISTER_DECODER (VMDVIDEO, vmdvideo);
@@ -245,8 +259,10 @@ void avcodec_register_all(void)
     REGISTER_ENCDEC  (WMV1, wmv1);
     REGISTER_ENCDEC  (WMV2, wmv2);
     REGISTER_DECODER (WMV3, wmv3);
+#ifndef __HAIKU__
     REGISTER_DECODER (WMV3_CRYSTALHD, wmv3_crystalhd);
     REGISTER_DECODER (WMV3_VDPAU, wmv3_vdpau);
+#endif
     REGISTER_DECODER (WMV3IMAGE, wmv3image);
     REGISTER_DECODER (WNV1, wnv1);
     REGISTER_DECODER (XAN_WC3, xan_wc3);
@@ -284,7 +300,9 @@ void avcodec_register_all(void)
     REGISTER_ENCDEC  (FLAC, flac);
     REGISTER_ENCDEC  (G723_1, g723_1);
     REGISTER_DECODER (G729, g729);
+#ifndef __HAIKU__
     REGISTER_DECODER (GSM, gsm);
+#endif
     REGISTER_DECODER (GSM_MS, gsm_ms);
     REGISTER_DECODER (IMC, imc);
     REGISTER_DECODER (MACE3, mace3);
@@ -405,6 +423,7 @@ void avcodec_register_all(void)
     REGISTER_ENCDEC  (XSUB, xsub);
 
     /* external libraries */
+#ifndef __HAIKU__
     REGISTER_DECODER (LIBCELT, libcelt);
     REGISTER_ENCODER (LIBFAAC, libfaac);
     REGISTER_ENCDEC  (LIBGSM, libgsm);
@@ -414,19 +433,26 @@ void avcodec_register_all(void)
     REGISTER_DECODER (LIBOPENCORE_AMRWB, libopencore_amrwb);
     REGISTER_ENCDEC  (LIBOPENJPEG, libopenjpeg);
     REGISTER_ENCDEC  (LIBSCHROEDINGER, libschroedinger);
+#endif
     REGISTER_ENCDEC  (LIBSPEEX, libspeex);
+#ifndef __HAIKU__
     REGISTER_DECODER (LIBSTAGEFRIGHT_H264, libstagefright_h264);
+#endif
     REGISTER_ENCODER (LIBTHEORA, libtheora);
+#ifndef __HAIKU__
     REGISTER_ENCDEC  (LIBUTVIDEO, libutvideo);
     REGISTER_ENCODER (LIBVO_AACENC, libvo_aacenc);
     REGISTER_ENCODER (LIBVO_AMRWBENC, libvo_amrwbenc);
+#endif
     REGISTER_ENCDEC  (LIBVORBIS, libvorbis);
     REGISTER_ENCDEC  (LIBVPX, libvpx);
+#ifndef __HAIKU__
     REGISTER_ENCODER (LIBX264, libx264);
     REGISTER_ENCODER (LIBX264RGB, libx264rgb);
     REGISTER_ENCODER (LIBXAVS, libxavs);
     REGISTER_ENCODER (LIBXVID, libxvid);
     REGISTER_ENCODER (LIBAACPLUS, libaacplus);
+#endif
 
     /* text */
     REGISTER_DECODER (BINTEXT, bintext);
diff --git a/libavcodec/dcadsp.c b/libavcodec/dcadsp.c
index dd4994d..94dd52c 100644
--- a/libavcodec/dcadsp.c
+++ b/libavcodec/dcadsp.c
@@ -47,5 +47,7 @@ static void dca_lfe_fir_c(float *out, const float *in, const float *coefs,
 void ff_dcadsp_init(DCADSPContext *s)
 {
     s->lfe_fir = dca_lfe_fir_c;
-    if (ARCH_ARM) ff_dcadsp_init_arm(s);
+#if ARCH_ARM
+	ff_dcadsp_init_arm(s);
+#endif
 }
diff --git a/libavcodec/dsputil.c b/libavcodec/dsputil.c
index a13540d..8254e3a 100644
--- a/libavcodec/dsputil.c
+++ b/libavcodec/dsputil.c
@@ -3170,13 +3170,25 @@ av_cold void ff_dsputil_init(DSPContext* c, AVCodecContext *avctx)
 
 
     if (HAVE_MMX)        ff_dsputil_init_mmx   (c, avctx);
-    if (ARCH_ARM)        ff_dsputil_init_arm   (c, avctx);
-    if (HAVE_VIS)        ff_dsputil_init_vis   (c, avctx);
-    if (ARCH_ALPHA)      ff_dsputil_init_alpha (c, avctx);
-    if (ARCH_PPC)        ff_dsputil_init_ppc   (c, avctx);
-    if (HAVE_MMI)        ff_dsputil_init_mmi   (c, avctx);
-    if (ARCH_SH4)        ff_dsputil_init_sh4   (c, avctx);
-    if (ARCH_BFIN)       ff_dsputil_init_bfin  (c, avctx);
+#if ARCH_ARM
+	ff_dsputil_init_arm   (c, avctx);
+#endif
+#if HAVE_VIS
+    ff_dsputil_init_vis   (c, avctx);
+#endif
+#if ARCH_ALPHA
+	ff_dsputil_init_alpha (c, avctx);
+#elif ARCH_PPC
+    ff_dsputil_init_ppc   (c, avctx);
+#endif
+#if HAVE_MMI
+    ff_dsputil_init_mmi   (c, avctx);
+#endif
+#if ARCH_SH4
+    ff_dsputil_init_sh4   (c, avctx);
+#elif ARCH_BFIN
+    ff_dsputil_init_bfin  (c, avctx);
+#endif
 
     for (i = 0; i < 4; i++) {
         for (j = 0; j < 16; j++) {
diff --git a/libavcodec/fft.c b/libavcodec/fft.c
index 6b93a5c..2d0618c 100644
--- a/libavcodec/fft.c
+++ b/libavcodec/fft.c
@@ -158,13 +158,19 @@ av_cold int ff_fft_init(FFTContext *s, int nbits, int inverse)
 #endif
 
 #if CONFIG_FFT_FLOAT
-    if (ARCH_ARM)     ff_fft_init_arm(s);
-    if (HAVE_ALTIVEC) ff_fft_init_altivec(s);
+#if ARCH_ARM
+    ff_fft_init_arm(s);
+#endif
+#if HAVE_ALTIVEC
+    ff_fft_init_altivec(s);
+#endif
     if (HAVE_MMX)     ff_fft_init_mmx(s);
     if (CONFIG_MDCT)  s->mdct_calcw = s->mdct_calc;
 #else
     if (CONFIG_MDCT)  s->mdct_calcw = ff_mdct_calcw_c;
-    if (ARCH_ARM)     ff_fft_fixed_init_arm(s);
+#if ARCH_ARM
+    ff_fft_fixed_init_arm(s);
+#endif
 #endif
 
     for(j=4; j<=nbits; j++) {
diff --git a/libavcodec/fmtconvert.c b/libavcodec/fmtconvert.c
index c03117c..9a1ec1e 100644
--- a/libavcodec/fmtconvert.c
+++ b/libavcodec/fmtconvert.c
@@ -82,8 +82,12 @@ av_cold void ff_fmt_convert_init(FmtConvertContext *c, AVCodecContext *avctx)
     c->float_to_int16_interleave  = float_to_int16_interleave_c;
     c->float_interleave           = ff_float_interleave_c;
 
-    if (ARCH_ARM) ff_fmt_convert_init_arm(c, avctx);
-    if (HAVE_ALTIVEC) ff_fmt_convert_init_altivec(c, avctx);
+#if ARCH_ARM
+    ff_fmt_convert_init_arm(c, avctx);
+#endif
+#if HAVE_ALTIVEC
+    ff_fmt_convert_init_altivec(c, avctx);
+#endif
     if (HAVE_MMX) ff_fmt_convert_init_x86(c, avctx);
 }
 
diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
index 4d3c7b8..25bd9fc 100644
--- a/libavcodec/h263dec.c
+++ b/libavcodec/h263dec.c
@@ -648,10 +648,12 @@ retry:
 
     if (!s->divx_packed) ff_thread_finish_setup(avctx);
 
-    if (CONFIG_MPEG4_VDPAU_DECODER && (s->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU)) {
+#if CONFIG_MPEG4_VDPAU_DECODER
+    if (s->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU) {
         ff_vdpau_mpeg4_decode_picture(s, s->gb.buffer, s->gb.buffer_end - s->gb.buffer);
         goto frame_end;
     }
+#endif
 
     if (avctx->hwaccel) {
         if (avctx->hwaccel->start_frame(avctx, s->gb.buffer, s->gb.buffer_end - s->gb.buffer) < 0)
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 1e6326f..0e45c37 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -2746,9 +2746,10 @@ static int field_end(H264Context *h, int in_setup)
         ff_thread_report_progress(&s->current_picture_ptr->f, INT_MAX,
                                   s->picture_structure == PICT_BOTTOM_FIELD);
 
-    if (CONFIG_H264_VDPAU_DECODER &&
-        s->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU)
+#if CONFIG_H264_VDPAU_DECODER
+    if (s->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU)
         ff_vdpau_h264_set_reference_frames(s);
+#endif
 
     if (in_setup || !(avctx->active_thread_type & FF_THREAD_FRAME)) {
         if (!s->dropable) {
@@ -2767,9 +2768,10 @@ static int field_end(H264Context *h, int in_setup)
                    "hardware accelerator failed to decode picture\n");
     }
 
-    if (CONFIG_H264_VDPAU_DECODER &&
-        s->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU)
+#if CONFIG_H264_VDPAU_DECODER
+    if (s->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU)
         ff_vdpau_h264_picture_complete(s);
+#endif
 
     /*
      * FIXME: Error handling code does not seem to support interlaced
@@ -4394,9 +4396,10 @@ again:
                     if (s->avctx->hwaccel &&
                         s->avctx->hwaccel->start_frame(s->avctx, NULL, 0) < 0)
                         return -1;
-                    if (CONFIG_H264_VDPAU_DECODER &&
-                        s->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU)
+#if CONFIG_H264_VDPAU_DECODER
+                    if (s->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU)
                         ff_vdpau_h264_picture_start(s);
+#endif
                 }
 
                 if (hx->redundant_pic_count == 0 &&
@@ -4412,14 +4415,15 @@ again:
                                                          &buf[buf_index - consumed],
                                                          consumed) < 0)
                             return -1;
-                    } else if (CONFIG_H264_VDPAU_DECODER &&
-                               s->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU) {
+#if CONFIG_H264_VDPAU_DECODER
+                    } else if (s->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU) {
                         static const uint8_t start_code[] = {
                             0x00, 0x00, 0x01 };
                         ff_vdpau_add_data_chunk(s, start_code,
                                                 sizeof(start_code));
                         ff_vdpau_add_data_chunk(s, &buf[buf_index - consumed],
                                                 consumed);
+#endif
                     } else
                         context_count++;
                 }
diff --git a/libavcodec/h264dsp.c b/libavcodec/h264dsp.c
index bd35aa3..0bc9037 100644
--- a/libavcodec/h264dsp.c
+++ b/libavcodec/h264dsp.c
@@ -111,7 +111,11 @@ void ff_h264dsp_init(H264DSPContext *c, const int bit_depth, const int chroma_fo
         break;
     }
 
-    if (ARCH_ARM) ff_h264dsp_init_arm(c, bit_depth, chroma_format_idc);
-    if (HAVE_ALTIVEC) ff_h264dsp_init_ppc(c, bit_depth, chroma_format_idc);
+#if ARCH_ARM
+	ff_h264dsp_init_arm(c, bit_depth, chroma_format_idc);
+#endif
+#if HAVE_ALTIVEC
+	ff_h264dsp_init_ppc(c, bit_depth, chroma_format_idc);
+#endif
     if (HAVE_MMX) ff_h264dsp_init_x86(c, bit_depth, chroma_format_idc);
 }
diff --git a/libavcodec/h264pred.c b/libavcodec/h264pred.c
index a174b4c..19921d8 100644
--- a/libavcodec/h264pred.c
+++ b/libavcodec/h264pred.c
@@ -532,6 +532,8 @@ void ff_h264_pred_init(H264PredContext *h, int codec_id, const int bit_depth, co
             break;
     }
 
-    if (ARCH_ARM) ff_h264_pred_init_arm(h, codec_id, bit_depth, chroma_format_idc);
+#if ARCH_ARM
+    ff_h264_pred_init_arm(h, codec_id, bit_depth, chroma_format_idc);
+#endif
     if (HAVE_MMX) ff_h264_pred_init_x86(h, codec_id, bit_depth, chroma_format_idc);
 }
diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c
index bcee1d8..25c573d 100644
--- a/libavcodec/mpeg12.c
+++ b/libavcodec/mpeg12.c
@@ -834,12 +834,14 @@ static int mpeg_decode_mb(MpegEncContext *s, DCTELEM block[12][64])
             memset(s->last_mv, 0, sizeof(s->last_mv)); /* reset mv prediction */
         s->mb_intra = 1;
         // if 1, we memcpy blocks in xvmcvideo
-        if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration > 1) {
+#if CONFIG_MPEG_XVMC_DECODER
+		if (s->avctx->xvmc_acceleration > 1) {
             ff_xvmc_pack_pblocks(s, -1); // inter are always full blocks
             if (s->swap_uv) {
                 exchange_uv(s);
             }
         }
+#endif
 
         if (s->codec_id == CODEC_ID_MPEG2VIDEO) {
             if (s->flags2 & CODEC_FLAG2_FAST) {
@@ -1052,12 +1054,14 @@ static int mpeg_decode_mb(MpegEncContext *s, DCTELEM block[12][64])
             }
 
             //if 1, we memcpy blocks in xvmcvideo
-            if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration > 1) {
+#if CONFIG_MPEG_XVMC_DECODER
+			if (s->avctx->xvmc_acceleration > 1) {
                 ff_xvmc_pack_pblocks(s, cbp);
                 if (s->swap_uv) {
                     exchange_uv(s);
                 }
             }
+#endif
 
             if (s->codec_id == CODEC_ID_MPEG2VIDEO) {
                 if (s->flags2 & CODEC_FLAG2_FAST) {
@@ -1656,9 +1660,11 @@ static int mpeg_field_start(MpegEncContext *s, const uint8_t *buf, int buf_size)
 
 // MPV_frame_start will call this function too,
 // but we need to call it on every field
-    if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration)
+#if CONFIG_MPEG_XVMC_DECODER 
+	if (s->avctx->xvmc_acceleration)
         if (ff_xvmc_field_start(s, avctx) < 0)
             return -1;
+#endif
 
     return 0;
 }
@@ -1762,8 +1768,10 @@ static int mpeg_decode_slice(MpegEncContext *s, int mb_y,
 
     for (;;) {
         // If 1, we memcpy blocks in xvmcvideo.
-        if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration > 1)
+#if CONFIG_MPEG_XVMC_DECODER 
+		if (s->avctx->xvmc_acceleration > 1)
             ff_xvmc_init_block(s); // set s->block
+#endif
 
         if (mpeg_decode_mb(s, s->block) < 0)
             return -1;
@@ -1954,8 +1962,10 @@ static int slice_end(AVCodecContext *avctx, AVFrame *pict)
             av_log(avctx, AV_LOG_ERROR, "hardware accelerator failed to decode picture\n");
     }
 
-    if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration)
+#if CONFIG_MPEG_XVMC_DECODER 
+	if (s->avctx->xvmc_acceleration)
         ff_xvmc_field_end(s);
+#endif
 
     /* end of slice reached */
     if (/*s->mb_y << field_pic == s->mb_height &&*/ !s->first_field && !s->first_slice) {
@@ -2332,9 +2342,10 @@ static int decode_chunks(AVCodecContext *avctx,
                         s2->error_count += s2->thread_context[i]->error_count;
                 }
 
-                if (CONFIG_VDPAU && uses_vdpau(avctx))
+#if CONFIG_VDPAU
+				if (uses_vdpau(avctx))
                     ff_vdpau_mpeg_picture_complete(s2, buf, buf_size, s->slice_count);
-
+#endif
 
                 if (slice_end(avctx, picture)) {
                     if (s2->last_picture_ptr || s2->low_delay) //FIXME merge with the stuff in mpeg_decode_slice
diff --git a/libavcodec/mpegaudiodsp.c b/libavcodec/mpegaudiodsp.c
index cc12dd9..2e8d214 100644
--- a/libavcodec/mpegaudiodsp.c
+++ b/libavcodec/mpegaudiodsp.c
@@ -40,7 +40,11 @@ void ff_mpadsp_init(MPADSPContext *s)
     s->imdct36_blocks_float = ff_imdct36_blocks_float;
     s->imdct36_blocks_fixed = ff_imdct36_blocks_fixed;
 
-    if (ARCH_ARM)     ff_mpadsp_init_arm(s);
+#if ARCH_ARM
+    ff_mpadsp_init_arm(s);
+#endif
     if (HAVE_MMX)     ff_mpadsp_init_mmx(s);
-    if (HAVE_ALTIVEC) ff_mpadsp_init_altivec(s);
+#if HAVE_ALTIVEC
+    ff_mpadsp_init_altivec(s);
+#endif
 }
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 705951a..b4ebe84 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -1327,8 +1327,10 @@ int ff_MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx)
         update_noise_reduction(s);
     }
 
-    if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration)
+#if CONFIG_MPEG_XVMC_DECODER
+	if (s->avctx->xvmc_acceleration)
         return ff_xvmc_field_start(s, avctx);
+#endif
 
     return 0;
 }
@@ -1340,9 +1342,12 @@ void ff_MPV_frame_end(MpegEncContext *s)
     int i;
     /* redraw edges for the frame if decoding didn't complete */
     // just to make sure that all data is rendered.
-    if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration) {
+#if CONFIG_MPEG_XVMC_DECODER 
+	if (s->avctx->xvmc_acceleration) {
         ff_xvmc_field_end(s);
-   } else if((s->error_count || s->encoding || !(s->avctx->codec->capabilities&CODEC_CAP_DRAW_HORIZ_BAND)) &&
+   } else 
+#endif
+	   if((s->error_count || s->encoding || !(s->avctx->codec->capabilities&CODEC_CAP_DRAW_HORIZ_BAND)) &&
               !s->avctx->hwaccel &&
               !(s->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU) &&
               s->unrestricted_mv &&
@@ -2271,10 +2276,12 @@ void MPV_decode_mb_internal(MpegEncContext *s, DCTELEM block[12][64],
                             int lowres_flag, int is_mpeg12)
 {
     const int mb_xy = s->mb_y * s->mb_stride + s->mb_x;
-    if(CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration){
+#if CONFIG_MPEG_XVMC_DECODER
+	if (s->avctx->xvmc_acceleration){
         ff_xvmc_decode_mb(s);//xvmc uses pblocks
         return;
     }
+#endif
 
     if(s->avctx->debug&FF_DEBUG_DCT_COEFF) {
        /* save DCT coefficients */
diff --git a/libavcodec/rdft.c b/libavcodec/rdft.c
index ebddd8b..66918f9 100644
--- a/libavcodec/rdft.c
+++ b/libavcodec/rdft.c
@@ -122,7 +122,9 @@ av_cold int ff_rdft_init(RDFTContext *s, int nbits, enum RDFTransformType trans)
 #endif
     s->rdft_calc   = ff_rdft_calc_c;
 
-    if (ARCH_ARM) ff_rdft_init_arm(s);
+#if ARCH_ARM
+    ff_rdft_init_arm(s);
+#endif
 
     return 0;
 }
diff --git a/libavcodec/rv34dsp.c b/libavcodec/rv34dsp.c
index 1ddcea4..93bd66f 100644
--- a/libavcodec/rv34dsp.c
+++ b/libavcodec/rv34dsp.c
@@ -134,8 +134,9 @@ av_cold void ff_rv34dsp_init(RV34DSPContext *c, DSPContext* dsp) {
     c->rv34_idct_add    = rv34_idct_add_c;
     c->rv34_idct_dc_add = rv34_idct_dc_add_c;
 
-    if (HAVE_NEON)
+#if HAVE_NEON
         ff_rv34dsp_init_neon(c, dsp);
+#endif
     if (HAVE_MMX)
         ff_rv34dsp_init_x86(c, dsp);
 }
diff --git a/libavcodec/rv40dsp.c b/libavcodec/rv40dsp.c
index 8ba10be..d1b922c 100644
--- a/libavcodec/rv40dsp.c
+++ b/libavcodec/rv40dsp.c
@@ -604,6 +604,7 @@ av_cold void ff_rv40dsp_init(RV34DSPContext *c, DSPContext* dsp) {
 
     if (HAVE_MMX)
         ff_rv40dsp_init_x86(c, dsp);
-    if (HAVE_NEON)
+#if HAVE_NEON
         ff_rv40dsp_init_neon(c, dsp);
+#endif
 }
diff --git a/libavcodec/sbrdsp.c b/libavcodec/sbrdsp.c
index 8c88fb3..1b514f4 100644
--- a/libavcodec/sbrdsp.c
+++ b/libavcodec/sbrdsp.c
@@ -241,8 +241,9 @@ av_cold void ff_sbrdsp_init(SBRDSPContext *s)
     s->hf_apply_noise[2] = sbr_hf_apply_noise_2;
     s->hf_apply_noise[3] = sbr_hf_apply_noise_3;
 
-    if (ARCH_ARM)
+#if ARCH_ARM
         ff_sbrdsp_init_arm(s);
+#endif
     if (HAVE_MMX)
         ff_sbrdsp_init_x86(s);
 }
diff --git a/libavcodec/synth_filter.c b/libavcodec/synth_filter.c
index 5f10530..6022355 100644
--- a/libavcodec/synth_filter.c
+++ b/libavcodec/synth_filter.c
@@ -60,5 +60,7 @@ av_cold void ff_synth_filter_init(SynthFilterContext *c)
 {
     c->synth_filter_float = synth_filter_float;
 
-    if (ARCH_ARM) ff_synth_filter_init_arm(c);
+#if ARCH_ARM
+	ff_synth_filter_init_arm(c);
+#endif
 }
diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index 309194e..bc266d6 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -5545,10 +5545,12 @@ static int vc1_decode_frame(AVCodecContext *avctx, void *data,
     s->me.qpel_put = s->dsp.put_qpel_pixels_tab;
     s->me.qpel_avg = s->dsp.avg_qpel_pixels_tab;
 
-    if ((CONFIG_VC1_VDPAU_DECODER)
-        &&s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU)
+#if CONFIG_VC1_VDPAU_DECODER
+    if (s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU)
         ff_vdpau_vc1_decode_picture(s, buf_start, (buf + buf_size) - buf_start);
-    else if (avctx->hwaccel) {
+    else 
+#endif
+	if (avctx->hwaccel) {
         if (avctx->hwaccel->start_frame(avctx, buf, buf_size) < 0)
             goto err;
         if (avctx->hwaccel->decode_slice(avctx, buf_start, (buf + buf_size) - buf_start) < 0)
diff --git a/libavcodec/vc1dsp.c b/libavcodec/vc1dsp.c
index da7593f..90ede54 100644
--- a/libavcodec/vc1dsp.c
+++ b/libavcodec/vc1dsp.c
@@ -846,8 +846,9 @@ av_cold void ff_vc1dsp_init(VC1DSPContext* dsp) {
     dsp->sprite_v_double_twoscale = sprite_v_double_twoscale_c;
 #endif
 
-    if (HAVE_ALTIVEC)
+#if HAVE_ALTIVEC
         ff_vc1dsp_init_altivec(dsp);
+#endif
     if (HAVE_MMX)
         ff_vc1dsp_init_mmx(dsp);
 }
diff --git a/libavcodec/vp56dsp.c b/libavcodec/vp56dsp.c
index c629343..d4d9e1c 100644
--- a/libavcodec/vp56dsp.c
+++ b/libavcodec/vp56dsp.c
@@ -88,6 +88,8 @@ void ff_vp56dsp_init(VP56DSPContext *s, enum CodecID codec)
         }
     }
 
-    if (ARCH_ARM) ff_vp56dsp_init_arm(s, codec);
+#if ARCH_ARM
+	ff_vp56dsp_init_arm(s, codec);
+#endif
     if (HAVE_MMX) ff_vp56dsp_init_x86(s, codec);
 }
diff --git a/libavcodec/vp8dsp.c b/libavcodec/vp8dsp.c
index 1ee070c..423410e 100644
--- a/libavcodec/vp8dsp.c
+++ b/libavcodec/vp8dsp.c
@@ -522,8 +522,9 @@ av_cold void ff_vp8dsp_init(VP8DSPContext *dsp)
 
     if (HAVE_MMX)
         ff_vp8dsp_init_x86(dsp);
-    if (HAVE_ALTIVEC)
+#if HAVE_ALTIVEC
         ff_vp8dsp_init_altivec(dsp);
-    if (ARCH_ARM)
+#elif ARCH_ARM
         ff_vp8dsp_init_arm(dsp);
+#endif
 }
diff --git a/libavcodec/x86/ac3dsp_mmx.c b/libavcodec/x86/ac3dsp_mmx.c
index 54fa380..b797268 100644
--- a/libavcodec/x86/ac3dsp_mmx.c
+++ b/libavcodec/x86/ac3dsp_mmx.c
@@ -59,16 +59,19 @@ av_cold void ff_ac3dsp_init_x86(AC3DSPContext *c, int bit_exact)
         c->ac3_lshift_int16 = ff_ac3_lshift_int16_mmx;
         c->ac3_rshift_int32 = ff_ac3_rshift_int32_mmx;
     }
+#if HAVE_AMD3DNOW
     if (mm_flags & AV_CPU_FLAG_3DNOW && HAVE_AMD3DNOW) {
         c->extract_exponents = ff_ac3_extract_exponents_3dnow;
         if (!bit_exact) {
             c->float_to_fixed24 = ff_float_to_fixed24_3dnow;
         }
     }
+#endif
     if (mm_flags & AV_CPU_FLAG_MMX2 && HAVE_MMX2) {
         c->ac3_exponent_min = ff_ac3_exponent_min_mmxext;
         c->ac3_max_msb_abs_int16 = ff_ac3_max_msb_abs_int16_mmx2;
     }
+#if HAVE_SSE
     if (mm_flags & AV_CPU_FLAG_SSE && HAVE_SSE) {
         c->float_to_fixed24 = ff_float_to_fixed24_sse;
     }
@@ -83,6 +86,8 @@ av_cold void ff_ac3dsp_init_x86(AC3DSPContext *c, int bit_exact)
             c->ac3_rshift_int32 = ff_ac3_rshift_int32_sse2;
         }
     }
+#endif
+#if HAVE_SSSE3
     if (mm_flags & AV_CPU_FLAG_SSSE3 && HAVE_SSSE3) {
         c->ac3_max_msb_abs_int16 = ff_ac3_max_msb_abs_int16_ssse3;
         if (!(mm_flags & AV_CPU_FLAG_ATOM)) {
@@ -90,4 +95,5 @@ av_cold void ff_ac3dsp_init_x86(AC3DSPContext *c, int bit_exact)
         }
     }
 #endif
+#endif
 }
diff --git a/libavcodec/x86/fft.c b/libavcodec/x86/fft.c
index 7c21335..4b0d908 100644
--- a/libavcodec/x86/fft.c
+++ b/libavcodec/x86/fft.c
@@ -25,6 +25,7 @@ av_cold void ff_fft_init_mmx(FFTContext *s)
 {
 #if HAVE_YASM
     int has_vectors = av_get_cpu_flags();
+#if HAVE_AMD3DNOW
     if (has_vectors & AV_CPU_FLAG_3DNOW && HAVE_AMD3DNOW) {
         /* 3DNow! for K6-2/3 */
         s->imdct_calc = ff_imdct_calc_3dn;
@@ -37,6 +38,8 @@ av_cold void ff_fft_init_mmx(FFTContext *s)
         s->imdct_half = ff_imdct_half_3dn2;
         s->fft_calc   = ff_fft_calc_3dn2;
     }
+#endif
+#if HAVE_SSE
     if (has_vectors & AV_CPU_FLAG_SSE && HAVE_SSE) {
         /* SSE for P3/P4/K8 */
         s->imdct_calc  = ff_imdct_calc_sse;
@@ -45,6 +48,8 @@ av_cold void ff_fft_init_mmx(FFTContext *s)
         s->fft_calc    = ff_fft_calc_sse;
         s->fft_permutation = FF_FFT_PERM_SWAP_LSBS;
     }
+#endif
+#if HAVE_AVX
     if (has_vectors & AV_CPU_FLAG_AVX && HAVE_AVX && s->nbits >= 5) {
         /* AVX for SB */
         s->imdct_half      = ff_imdct_half_avx;
@@ -52,6 +57,7 @@ av_cold void ff_fft_init_mmx(FFTContext *s)
         s->fft_permutation = FF_FFT_PERM_AVX;
     }
 #endif
+#endif
 }
 
 #if CONFIG_DCT
@@ -59,12 +65,16 @@ av_cold void ff_dct_init_mmx(DCTContext *s)
 {
 #if HAVE_YASM
     int has_vectors = av_get_cpu_flags();
+#if HAVE_SSE
     if (has_vectors & AV_CPU_FLAG_SSE && HAVE_SSE)
         s->dct32 = ff_dct32_float_sse;
     if (has_vectors & AV_CPU_FLAG_SSE2 && HAVE_SSE)
         s->dct32 = ff_dct32_float_sse2;
+#endif
+#if HAVE_AVX
     if (has_vectors & AV_CPU_FLAG_AVX && HAVE_AVX)
         s->dct32 = ff_dct32_float_avx;
 #endif
+#endif
 }
 #endif
diff --git a/libavcodec/x86/h264dsp_mmx.c b/libavcodec/x86/h264dsp_mmx.c
index 063e3de..6a2c7d9 100644
--- a/libavcodec/x86/h264dsp_mmx.c
+++ b/libavcodec/x86/h264dsp_mmx.c
@@ -420,6 +420,7 @@ void ff_h264dsp_init_x86(H264DSPContext *c, const int bit_depth, const int chrom
                 c->biweight_h264_pixels_tab[0]= ff_h264_biweight_16_ssse3;
                 c->biweight_h264_pixels_tab[1]= ff_h264_biweight_8_ssse3;
             }
+#if HAVE_AVX
             if (HAVE_AVX && mm_flags&AV_CPU_FLAG_AVX) {
 #if HAVE_ALIGNED_STACK
                 c->h264_v_loop_filter_luma = ff_deblock_v_luma_8_avx;
@@ -428,6 +429,7 @@ void ff_h264dsp_init_x86(H264DSPContext *c, const int bit_depth, const int chrom
                 c->h264_h_loop_filter_luma_intra = ff_deblock_h_luma_intra_8_avx;
 #endif
             }
+#endif
         }
     }
 #endif
diff --git a/libavcodec/x86/v210-init.c b/libavcodec/x86/v210-init.c
index c961178..b61f1e8 100644
--- a/libavcodec/x86/v210-init.c
+++ b/libavcodec/x86/v210-init.c
@@ -34,15 +34,19 @@ av_cold void v210_x86_init(V210DecContext *s)
         if (cpu_flags & AV_CPU_FLAG_SSSE3)
             s->unpack_frame = ff_v210_planar_unpack_aligned_ssse3;
 
+#if HAVE_AVX
         if (HAVE_AVX && cpu_flags & AV_CPU_FLAG_AVX)
             s->unpack_frame = ff_v210_planar_unpack_aligned_avx;
+#endif
     }
     else {
         if (cpu_flags & AV_CPU_FLAG_SSSE3)
             s->unpack_frame = ff_v210_planar_unpack_unaligned_ssse3;
 
+#if HAVE_AVX
         if (HAVE_AVX && cpu_flags & AV_CPU_FLAG_AVX)
             s->unpack_frame = ff_v210_planar_unpack_unaligned_avx;
+#endif
     }
 #endif
 }
diff --git a/libavdevice/alldevices.c b/libavdevice/alldevices.c
index 86ebfee..8424bdd 100644
--- a/libavdevice/alldevices.c
+++ b/libavdevice/alldevices.c
@@ -38,6 +38,7 @@ void avdevice_register_all(void)
     initialized = 1;
 
     /* devices */
+#ifndef __HAIKU__
     REGISTER_INOUTDEV (ALSA, alsa);
     REGISTER_INDEV    (BKTR, bktr);
     REGISTER_INDEV    (DSHOW, dshow);
@@ -58,4 +59,5 @@ void avdevice_register_all(void)
     /* external libraries */
     REGISTER_INDEV    (LIBCDIO, libcdio);
     REGISTER_INDEV    (LIBDC1394, libdc1394);
+#endif
 }
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index b9d44f2..2a95845 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -43,12 +43,16 @@ void avfilter_register_all(void)
     REGISTER_FILTER (ASHOWINFO,   ashowinfo,   af);
     REGISTER_FILTER (ASPLIT,      asplit,      af);
     REGISTER_FILTER (ASTREAMSYNC, astreamsync, af);
+#ifndef __HAIKU__
     REGISTER_FILTER (ASYNCTS,     asyncts,     af);
+#endif
     REGISTER_FILTER (EARWAX,      earwax,      af);
     REGISTER_FILTER (PAN,         pan,         af);
     REGISTER_FILTER (SILENCEDETECT, silencedetect, af);
     REGISTER_FILTER (VOLUME,      volume,      af);
+#ifndef __HAIKU__
     REGISTER_FILTER (RESAMPLE,    resample,    af);
+#endif
 
     REGISTER_FILTER (AEVALSRC,    aevalsrc,    asrc);
     REGISTER_FILTER (AMOVIE,      amovie,      asrc);
@@ -57,37 +61,53 @@ void avfilter_register_all(void)
     REGISTER_FILTER (ABUFFERSINK, abuffersink, asink);
     REGISTER_FILTER (ANULLSINK,   anullsink,   asink);
 
+#ifndef __HAIKU__
     REGISTER_FILTER (ASS,         ass,         vf);
+#endif
     REGISTER_FILTER (BBOX,        bbox,        vf);
     REGISTER_FILTER (BLACKDETECT, blackdetect, vf);
+#ifndef __HAIKU__
     REGISTER_FILTER (BLACKFRAME,  blackframe,  vf);
     REGISTER_FILTER (BOXBLUR,     boxblur,     vf);
     REGISTER_FILTER (COLORMATRIX, colormatrix, vf);
+#endif
     REGISTER_FILTER (COPY,        copy,        vf);
     REGISTER_FILTER (CROP,        crop,        vf);
+#ifndef __HAIKU__
     REGISTER_FILTER (CROPDETECT,  cropdetect,  vf);
     REGISTER_FILTER (DELOGO,      delogo,      vf);
+#endif
     REGISTER_FILTER (DESHAKE,     deshake,     vf);
     REGISTER_FILTER (DRAWBOX,     drawbox,     vf);
+#ifndef __HAIKU__
     REGISTER_FILTER (DRAWTEXT,    drawtext,    vf);
+#endif
     REGISTER_FILTER (FADE,        fade,        vf);
     REGISTER_FILTER (FIELDORDER,  fieldorder,  vf);
     REGISTER_FILTER (FIFO,        fifo,        vf);
     REGISTER_FILTER (FORMAT,      format,      vf);
     REGISTER_FILTER (FPS,         fps,         vf);
+#ifndef __HAIKU__
     REGISTER_FILTER (FREI0R,      frei0r,      vf);
+#endif
     REGISTER_FILTER (GRADFUN,     gradfun,     vf);
     REGISTER_FILTER (HFLIP,       hflip,       vf);
+#ifndef __HAIKU__
     REGISTER_FILTER (HQDN3D,      hqdn3d,      vf);
+#endif
     REGISTER_FILTER (IDET,        idet,        vf);
     REGISTER_FILTER (LUT,         lut,         vf);
     REGISTER_FILTER (LUTRGB,      lutrgb,      vf);
     REGISTER_FILTER (LUTYUV,      lutyuv,      vf);
+#ifndef __HAIKU__
     REGISTER_FILTER (MP,          mp,          vf);
+#endif
     REGISTER_FILTER (NEGATE,      negate,      vf);
     REGISTER_FILTER (NOFORMAT,    noformat,    vf);
     REGISTER_FILTER (NULL,        null,        vf);
+#ifndef __HAIKU__
     REGISTER_FILTER (OCV,         ocv,         vf);
+#endif
     REGISTER_FILTER (OVERLAY,     overlay,     vf);
     REGISTER_FILTER (PAD,         pad,         vf);
     REGISTER_FILTER (PIXDESCTEST, pixdesctest, vf);
@@ -101,23 +121,33 @@ void avfilter_register_all(void)
     REGISTER_FILTER (SHOWINFO,    showinfo,    vf);
     REGISTER_FILTER (SLICIFY,     slicify,     vf);
     REGISTER_FILTER (SPLIT,       split,       vf);
+#ifndef __HAIKU__
     REGISTER_FILTER (SUPER2XSAI,  super2xsai,  vf);
+#endif
     REGISTER_FILTER (SWAPUV,      swapuv,      vf);
     REGISTER_FILTER (THUMBNAIL,   thumbnail,   vf);
     REGISTER_FILTER (TILE,        tile,        vf);
+#ifndef __HAIKU__
     REGISTER_FILTER (TINTERLACE,  tinterlace,  vf);
+#endif
     REGISTER_FILTER (TRANSPOSE,   transpose,   vf);
     REGISTER_FILTER (UNSHARP,     unsharp,     vf);
     REGISTER_FILTER (VFLIP,       vflip,       vf);
+#ifndef __HAIKU__
     REGISTER_FILTER (YADIF,       yadif,       vf);
+#endif
 
     REGISTER_FILTER (CELLAUTO,    cellauto,    vsrc);
     REGISTER_FILTER (COLOR,       color,       vsrc);
+#ifndef __HAIKU__
     REGISTER_FILTER (FREI0R,      frei0r_src,  vsrc);
+#endif
     REGISTER_FILTER (LIFE,        life,        vsrc);
     REGISTER_FILTER (MANDELBROT,  mandelbrot,  vsrc);
     REGISTER_FILTER (MOVIE,       movie,       vsrc);
+#ifndef __HAIKU__
     REGISTER_FILTER (MPTESTSRC,   mptestsrc,   vsrc);
+#endif
     REGISTER_FILTER (NULLSRC,     nullsrc,     vsrc);
     REGISTER_FILTER (RGBTESTSRC,  rgbtestsrc,  vsrc);
     REGISTER_FILTER (TESTSRC,     testsrc,     vsrc);
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index 1862449..2c849b3 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -67,7 +67,9 @@ void av_register_all(void)
     REGISTER_MUXER    (ASF_STREAM, asf_stream);
     REGISTER_MUXDEMUX (AU, au);
     REGISTER_MUXDEMUX (AVI, avi);
+#ifndef __HAIKU__
     REGISTER_DEMUXER  (AVISYNTH, avisynth);
+#endif
     REGISTER_MUXER    (AVM2, avm2);
     REGISTER_DEMUXER  (AVS, avs);
     REGISTER_DEMUXER  (BETHSOFTVID, bethsoftvid);
@@ -92,7 +94,9 @@ void av_register_all(void)
     REGISTER_DEMUXER  (DXA, dxa);
     REGISTER_DEMUXER  (EA, ea);
     REGISTER_DEMUXER  (EA_CDATA, ea_cdata);
+#ifndef __HAIKU__
     REGISTER_MUXDEMUX (EAC3, eac3);
+#endif
     REGISTER_MUXDEMUX (FFM, ffm);
     REGISTER_MUXDEMUX (FFMETADATA, ffmetadata);
     REGISTER_MUXDEMUX (FILMSTRIP, filmstrip);
@@ -121,7 +125,9 @@ void av_register_all(void)
     REGISTER_DEMUXER  (INGENIENT, ingenient);
     REGISTER_DEMUXER  (IPMOVIE, ipmovie);
     REGISTER_MUXER    (IPOD, ipod);
+#ifndef __HAIKU__
     REGISTER_MUXER    (ISMV, ismv);
+#endif
     REGISTER_DEMUXER  (ISS, iss);
     REGISTER_DEMUXER  (IV8, iv8);
     REGISTER_MUXDEMUX (IVF, ivf);
@@ -146,7 +152,9 @@ void av_register_all(void)
     REGISTER_MUXDEMUX (MP3, mp3);
     REGISTER_MUXER    (MP4, mp4);
     REGISTER_DEMUXER  (MPC, mpc);
+#ifndef __HAIKU__
     REGISTER_DEMUXER  (MPC8, mpc8);
+#endif
     REGISTER_MUXER    (MPEG1SYSTEM, mpeg1system);
     REGISTER_MUXER    (MPEG1VCD, mpeg1vcd);
     REGISTER_MUXER    (MPEG1VIDEO, mpeg1video);
@@ -262,7 +270,9 @@ void av_register_all(void)
 #if FF_API_APPLEHTTP_PROTO
     REGISTER_PROTOCOL (APPLEHTTP, applehttp);
 #endif
+#ifndef __HAIKU__
     REGISTER_PROTOCOL (BLURAY, bluray);
+#endif
     REGISTER_PROTOCOL (CACHE, cache);
     REGISTER_PROTOCOL (CONCAT, concat);
     REGISTER_PROTOCOL (CRYPTO, crypto);
@@ -271,23 +281,31 @@ void av_register_all(void)
     REGISTER_PROTOCOL (HLS, hls);
     REGISTER_PROTOCOL (HTTP, http);
     REGISTER_PROTOCOL (HTTPPROXY, httpproxy);
+#ifndef __HAIKU__
     REGISTER_PROTOCOL (HTTPS, https);
+#endif
     REGISTER_PROTOCOL (MMSH, mmsh);
     REGISTER_PROTOCOL (MMST, mmst);
     REGISTER_PROTOCOL (MD5,  md5);
     REGISTER_PROTOCOL (PIPE, pipe);
     REGISTER_PROTOCOL (RTMP, rtmp);
     REGISTER_PROTOCOL (RTP, rtp);
+#ifndef __HAIKU__
     REGISTER_PROTOCOL (SCTP, sctp);
+#endif
     REGISTER_PROTOCOL (TCP, tcp);
+#ifndef __HAIKU__
     REGISTER_PROTOCOL (TLS, tls);
+#endif
     REGISTER_PROTOCOL (UDP, udp);
 
     /* external libraries */
+#ifndef __HAIKU__
     REGISTER_MUXDEMUX (LIBNUT, libnut);
     REGISTER_PROTOCOL (LIBRTMP, librtmp);
     REGISTER_PROTOCOL (LIBRTMPE, librtmpe);
     REGISTER_PROTOCOL (LIBRTMPS, librtmps);
     REGISTER_PROTOCOL (LIBRTMPT, librtmpt);
     REGISTER_PROTOCOL (LIBRTMPTE, librtmpte);
+#endif
 }
diff --git a/libavutil/cpu.c b/libavutil/cpu.c
index b911880..56cac12 100644
--- a/libavutil/cpu.c
+++ b/libavutil/cpu.c
@@ -32,9 +32,13 @@ int av_get_cpu_flags(void)
     if (checked)
         return flags;
 
-    if (ARCH_ARM) flags = ff_get_cpu_flags_arm();
-    if (ARCH_PPC) flags = ff_get_cpu_flags_ppc();
-    if (ARCH_X86) flags = ff_get_cpu_flags_x86();
+#if ARCH_ARM
+	flags = ff_get_cpu_flags_arm();
+#elif ARCH_PPC
+    flags = ff_get_cpu_flags_ppc();
+#else
+    flags = ff_get_cpu_flags_x86();
+#endif
 
     checked = 1;
     return flags;
diff --git a/libswresample/x86/swresample_x86.c b/libswresample/x86/swresample_x86.c
index 5436bc3..b1b6d3c 100644
--- a/libswresample/x86/swresample_x86.c
+++ b/libswresample/x86/swresample_x86.c
@@ -129,6 +129,7 @@ MULTI_CAPS_FUNC(AV_CPU_FLAG_SSE, sse)
                 ac->simd_f =  ff_pack_6ch_float_to_int32_a_sse4;
         }
     }
+#if HAVE_AVX
     if(HAVE_AVX && mm_flags & AV_CPU_FLAG_AVX) {
         if(   out_fmt == AV_SAMPLE_FMT_FLT  && in_fmt == AV_SAMPLE_FMT_S32 || out_fmt == AV_SAMPLE_FMT_FLTP && in_fmt == AV_SAMPLE_FMT_S32P)
             ac->simd_f =  ff_int32_to_float_a_avx;
@@ -141,4 +142,5 @@ MULTI_CAPS_FUNC(AV_CPU_FLAG_SSE, sse)
                 ac->simd_f =  ff_pack_6ch_float_to_int32_a_avx;
         }
     }
+#endif
 }
diff --git a/libswscale/swscale.c b/libswscale/swscale.c
index 5dd4124..5dc0f11 100644
--- a/libswscale/swscale.c
+++ b/libswscale/swscale.c
@@ -736,8 +736,9 @@ SwsFunc ff_getSwsFunc(SwsContext *c)
 
     if (HAVE_MMX)
         ff_sws_init_swScale_mmx(c);
-    if (HAVE_ALTIVEC)
+#if HAVE_ALTIVEC
         ff_sws_init_swScale_altivec(c);
+#endif
 
     return swScale;
 }
diff --git a/libswscale/swscale_unscaled.c b/libswscale/swscale_unscaled.c
index 74a61b8..b46a710 100644
--- a/libswscale/swscale_unscaled.c
+++ b/libswscale/swscale_unscaled.c
@@ -984,10 +984,11 @@ void ff_get_unscaled_swscale(SwsContext *c)
             c->swScale = planarCopyWrapper;
     }
 
-    if (ARCH_BFIN)
+#if ARCH_BFIN
         ff_bfin_get_unscaled_swscale(c);
-    if (HAVE_ALTIVEC)
+#elif HAVE_ALTIVEC
         ff_swscale_get_unscaled_altivec(c);
+#endif
 }
 
 static void reset_ptr(const uint8_t *src[], int format)
diff --git a/libswscale/utils.c b/libswscale/utils.c
index dc489de..e5098b9 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -778,9 +778,11 @@ int sws_setColorspaceDetails(struct SwsContext *c, const int inv_table[4],
                              contrast, saturation);
     // FIXME factorize
 
-    if (HAVE_ALTIVEC && av_get_cpu_flags() & AV_CPU_FLAG_ALTIVEC)
+#if HAVE_ALITVEC
+    if (av_get_cpu_flags() & AV_CPU_FLAG_ALTIVEC)
         ff_yuv2rgb_init_tables_altivec(c, inv_table, brightness,
                                        contrast, saturation);
+#endif
     return 0;
 }
 
diff --git a/libswscale/x86/swscale_mmx.c b/libswscale/x86/swscale_mmx.c
index 0c8732c..2810500 100644
--- a/libswscale/x86/swscale_mmx.c
+++ b/libswscale/x86/swscale_mmx.c
@@ -524,6 +524,7 @@ switch(c->dstBpc){ \
             c->yuv2plane1 = ff_yuv2plane1_16_sse4;
     }
 
+#if HAVE_AVX
     if (HAVE_AVX && cpu_flags & AV_CPU_FLAG_AVX) {
         ASSIGN_VSCALEX_FUNC(c->yuv2planeX, avx,);
         ASSIGN_VSCALE_FUNC(c->yuv2plane1, avx, avx, 1);
@@ -552,4 +553,5 @@ switch(c->dstBpc){ \
         }
     }
 #endif
+#endif
 }
diff --git a/libswscale/yuv2rgb.c b/libswscale/yuv2rgb.c
index 446b433..e3e8036 100644
--- a/libswscale/yuv2rgb.c
+++ b/libswscale/yuv2rgb.c
@@ -536,12 +536,15 @@ SwsFunc ff_yuv2rgb_get_func_ptr(SwsContext *c)
 
     if (HAVE_MMX)
         t = ff_yuv2rgb_init_mmx(c);
-    else if (HAVE_VIS)
+    else {
+#if HAVE_VIS
         t = ff_yuv2rgb_init_vis(c);
-    else if (HAVE_ALTIVEC)
+#elif HAVE_ALTIVEC
         t = ff_yuv2rgb_init_altivec(c);
-    else if (ARCH_BFIN)
+#elif ARCH_BFIN
         t = ff_yuv2rgb_get_func_ptr_bfin(c);
+#endif
+	}
 
     if (t)
         return t;
-- 
1.8.3.4

