]> git.sesse.net Git - ffmpeg/blobdiff - configure
add multiple inclusion guards to headers
[ffmpeg] / configure
index 6b841d52362048390861e44e7a1d8f7f5f25d235..ac5effcbb8d021177ac8ab617ec5fa41794acdee 100755 (executable)
--- a/configure
+++ b/configure
@@ -62,7 +62,6 @@ show_help(){
   echo "  --shlibdir=DIR           install shared libs in DIR [PREFIX/lib]"
   echo "  --incdir=DIR             install includes in DIR [PREFIX/include/ffmpeg]"
   echo "  --mandir=DIR             install man page in DIR [PREFIX/man]"
-  echo "  --enable-mingwce         enable MinGW native/cross WinCE compile"
   echo "  --enable-static          build static libraries [default=yes]"
   echo "  --disable-static         do not build static libraries [default=no]"
   echo "  --enable-shared          build shared libraries [default=no]"
@@ -84,7 +83,8 @@ show_help(){
   echo "  --enable-liba52          enable GPLed liba52 support [default=no]"
   echo "  --enable-liba52bin       open liba52.so.0 at runtime [default=no]"
   echo "  --enable-avisynth        allow reading AVISynth script files [default=no]"
-  echo "  --enable-libdts          enable GPLed libdts support [default=no]"
+  echo "  --enable-libamr-nb       enable libamr-nb floating point audio codec"
+  echo "  --enable-libamr-wb       enable libamr-wb floating point audio codec"
   echo "  --enable-libfaac         enable FAAC support via libfaac [default=no]"
   echo "  --enable-libfaad         enable FAAD support via libfaad [default=no]"
   echo "  --enable-libfaadbin      build FAAD support with runtime linking [default=no]"
@@ -96,13 +96,9 @@ show_help(){
   echo "  --enable-libtheora       enable Theora encoding via libtheora [default=no]"
   echo "  --enable-libvorbis       enable Vorbis en/decoding via libvorbis,"
   echo "                           native implementations exist [default=no]"
-  echo "  --enable-x264            enable H.264 encoding via x264 [default=no]"
-  echo "  --enable-xvid            enable Xvid encoding via xvidcore,"
+  echo "  --enable-libx264         enable H.264 encoding via x264 [default=no]"
+  echo "  --enable-libxvid         enable Xvid encoding via xvidcore,"
   echo "                           native MPEG-4/Xvid encoder exists [default=no]"
-  echo "  --enable-amr-nb          enable amr-nb floating point audio codec"
-  echo "  --enable-amr-nb-fixed    enable amr-nb fixed-point codec"
-  echo "  --enable-amr-wb          enable amr-wb floating point audio codec"
-  echo "  --enable-amr-if2         enable amr-wb IF2 audio codec"
   echo ""
   echo "Advanced options (experts only):"
   echo "  --source-path=PATH       path to source code [$source_path]"
@@ -138,7 +134,6 @@ show_help(){
   echo "  --disable-debug          disable debugging symbols"
   echo "  --disable-mpegaudio-hp   faster (but less accurate)"
   echo "                           MPEG audio decoding [default=no]"
-  echo "  --disable-protocols      disable I/O protocols support [default=no]"
   echo "  --disable-ffmpeg         disable ffmpeg build"
   echo "  --disable-ffserver       disable ffserver build"
   echo "  --disable-ffplay         disable ffplay build"
@@ -159,6 +154,12 @@ show_help(){
   echo "  --enable-parser=NAME     enables parser NAME"
   echo "  --disable-parser=NAME    disables parser NAME"
   echo "  --disable-parsers        disables all parsers"
+  echo "  --enable-bsf=NAME        enables bitstream filter NAME"
+  echo "  --disable-bsf=NAME       disables bitstream filter NAME"
+  echo "  --disable-bsfs           disables all bitstream filters"
+  echo "  --enable-protocol=NAME   enables protocol NAME"
+  echo "  --disable-protocol=NAME  disables protocol NAME"
+  echo "  --disable-protocols      disables all protocols"
   echo
   echo "Developer options (useful when working on FFmpeg itself):"
   echo "  --enable-gprof           enable profiling with gprof [$gprof]"
@@ -309,10 +310,13 @@ print_config(){
     makefile=$3
     shift 3
     for cfg; do
+        ucname="`toupper $cfg`"
         if enabled $cfg; then
-            ucname="${pfx}`toupper $cfg`"
-            echo "#define ${ucname} 1" >> $header
-            echo "${ucname}=yes" >> $makefile
+            echo "#define ${pfx}${ucname} 1" >> $header
+            echo "#define ENABLE_${ucname} 1" >> $header
+            echo "${pfx}${ucname}=yes" >> $makefile
+        else
+            echo "#define ENABLE_${ucname} 0" >> $header
         fi
     done
 }
@@ -486,6 +490,32 @@ check_exec(){
     check_ld "$@" && { enabled cross_compile || $TMPE >>$logfile 2>&1; }
 }
 
+check_exec_crash(){
+    code=`cat`
+
+    # exit() is not async signal safe.  _Exit (C99) and _exit (POSIX)
+    # are safe but may not be available everywhere.  Thus we use
+    # raise(SIGTERM) instead.  The check is run in a subshell so we
+    # can redirect the "Terminated" message from the shell.  SIGBUS
+    # is not defined by standard C so it is used conditionally.
+
+    (check_exec "$@") >>$logfile 2>&1 <<EOF
+#include <signal.h>
+static void sighandler(int sig){
+    raise(SIGTERM);
+}
+int main(){
+    signal(SIGILL, sighandler);
+    signal(SIGFPE, sighandler);
+    signal(SIGSEGV, sighandler);
+#ifdef SIGBUS
+    signal(SIGBUS, sighandler);
+#endif
+    { $code }
+}
+EOF
+}
+
 require(){
     name="$1"
     header="$2"
@@ -529,12 +559,9 @@ CONFIG_LIST='
     encoders
     decoders
     parsers
+    bsfs
     muxers
     demuxers
-    amr
-    amr_nb
-    amr_nb_fixed
-    amr_wb
     audio_beos
     audio_oss
     avisynth
@@ -542,8 +569,6 @@ CONFIG_LIST='
     bktr
     dc1394
     dv1394
-    ebp_available
-    ebx_available
     ffmpeg
     ffplay
     ffserver
@@ -552,7 +577,9 @@ CONFIG_LIST='
     ipv6
     liba52
     liba52bin
-    libdts
+    libamr
+    libamr_nb
+    libamr_wb
     libfaac
     libfaad
     libfaadbin
@@ -562,6 +589,8 @@ CONFIG_LIST='
     libogg
     libtheora
     libvorbis
+    libx264
+    libxvid
     memalign_hack
     mpegaudio_hp
     network
@@ -572,10 +601,7 @@ CONFIG_LIST='
     vhook
     v4l
     v4l2
-    wince
     x11grab
-    x264
-    xvid
     zlib
 '
 
@@ -586,12 +612,37 @@ THREADS_LIST='
     w32threads
 '
 
-HAVE_LIST="
-    $THREADS_LIST
+ARCH_LIST='
+    alpha
+    armv4l
+    bfin
+    ia64
+    m68k
+    mips
+    parisc
+    powerpc
+    s390
+    sh4
+    sparc
+    sparc64
+    x86
+    x86_32
+    x86_64
+'
+
+ARCH_EXT_LIST='
     altivec
-    altivec_h
     armv5te
     armv6
+    iwmmxt
+    mmi
+    mmx
+'
+
+HAVE_LIST="
+    $ARCH_EXT_LIST
+    $THREADS_LIST
+    altivec_h
     arpa_inet_h
     byteswap_h
     cmov
@@ -603,12 +654,14 @@ HAVE_LIST="
     dev_video_bktr_ioctl_bt848_h
     dlfcn_h
     dlopen
+    ebp_available
+    ebx_available
     fast_64bit
     fast_cmov
+    fast_unaligned
     freetype2
     imlib2
     inet_aton
-    iwmmxt
     localtime_r
     lrintf
     machine_ioctl_bt848_h
@@ -616,66 +669,72 @@ HAVE_LIST="
     malloc_h
     memalign
     mlib
-    mmi
-    mmx
     os2
     sdl
     sdl_video_size
     soundcard_h
+    ssse3
     sys_poll_h
     sys_soundcard_h
     threads
 "
 
-TARGET_LIST='
-    altivec
-    armv5te
-    armv6
-    iwmmxt
-    mmi
-    mmx
-'
-
 CMDLINE_SELECT="
+    $ARCH_EXT_LIST
     $CONFIG_LIST
-    $TARGET_LIST
     $THREADS_LIST
-    amr_if2
     debug
     extra_warnings
     shared
     static
 "
 
+# code dependency declarations
+
+# decoders / encoders
 dxa_decoder_deps="zlib"
 flashsv_decoder_deps="zlib"
 flashsv_encoder_deps="zlib"
+flv_decoder_deps="h263_decoder"
+h263_decoder_deps="h263_parser mpeg4video_parser"
+h263i_decoder_deps="h263_decoder"
+h264_decoder_deps="h264_parser"
 mpeg_xvmc_decoder_deps="xvmc"
+mpeg4_decoder_deps="h263_decoder"
+msmpeg4v1_decoder_deps="h263_decoder"
+msmpeg4v2_decoder_deps="h263_decoder"
+msmpeg4v3_decoder_deps="h263_decoder"
 png_decoder_deps="zlib"
 png_encoder_deps="zlib"
-x264_encoder_deps="x264"
-xvid_encoder_deps="xvid"
+vc1_decoder_deps="h263_decoder"
+wmv1_decoder_deps="h263_decoder"
+wmv2_decoder_deps="h263_decoder"
+wmv3_decoder_deps="h263_decoder"
 zmbv_decoder_deps="zlib"
 zmbv_encoder_deps="zlib"
 
-aac_decoder_deps="libfaad"
+# external libraries
 mpeg4aac_decoder_deps="libfaad"
-amr_nb_decoder_deps_any="amr_nb amr_nb_fixed"
-amr_nb_encoder_deps_any="amr_nb amr_nb_fixed"
-amr_wb_decoder_deps="amr_wb"
-amr_wb_encoder_deps="amr_wb"
-dts_decoder_deps="libdts"
-faac_encoder_deps="libfaac"
 liba52_decoder_deps="liba52"
+libamr_nb_decoder_deps="libamr_nb"
+libamr_nb_encoder_deps="libamr_nb"
+libamr_wb_decoder_deps="libamr_wb"
+libamr_wb_encoder_deps="libamr_wb"
+libfaac_encoder_deps="libfaac"
+libfaad_decoder_deps="libfaad"
 libgsm_decoder_deps="libgsm"
 libgsm_encoder_deps="libgsm"
 libgsm_ms_decoder_deps="libgsm"
 libgsm_ms_encoder_deps="libgsm"
+libmp3lame_encoder_deps="libmp3lame"
 libtheora_encoder_deps="libtheora"
-mp3lame_encoder_deps="libmp3lame"
-oggvorbis_decoder_deps="libvorbis"
-oggvorbis_encoder_deps="libvorbis"
+libvorbis_decoder_deps="libvorbis"
+libvorbis_encoder_deps="libvorbis"
+libx264_encoder_deps="libx264"
+libxvid_encoder_deps="libxvid"
 
+# demuxers / muxers
+ac3_demuxer_deps="ac3_parser"
 audio_demuxer_deps_any="audio_oss audio_beos"
 audio_muxer_deps_any="audio_oss audio_beos"
 dc1394_demuxer_deps="dc1394"
@@ -683,18 +742,27 @@ dv1394_demuxer_deps="dv1394"
 gxf_muxer_deps="gpl"
 libnut_demuxer_deps="libnut"
 libnut_muxer_deps="libnut"
+mp3_demuxer_deps="mpegaudio_parser"
 ogg_muxer_deps="libogg"
 redir_demuxer_deps="network"
-rtp_muxer_deps="network"
-rtsp_demuxer_deps="network"
-sdp_demuxer_deps="network"
+rtp_muxer_deps="network mpegts_demuxer"
+rtsp_demuxer_deps="rtp_protocol rtp_muxer"
+sdp_demuxer_deps="rtsp_demuxer"
 v4l2_demuxer_deps="v4l2"
-video_grab_device_demuxer_deps_any="v4l bktr"
+video_grab_bktr_demuxer_deps="bktr"
+video_grab_v4l_demuxer_deps="v4l"
 x11_grab_device_demuxer_deps="x11grab"
 
+# protocols
+http_protocol_deps="network"
+rtp_protocol_deps="udp_protocol"
+tcp_protocol_deps="network"
+udp_protocol_deps="network"
+
+# programs
 ffplay_deps="sdl"
-ffserver_deps="network protocols muxers"
-network_deps="protocols"
+ffserver_deps="muxers rtp_protocol"
+
 
 # set temporary file name
 if test ! -z "$TMPDIR" ; then
@@ -741,6 +809,7 @@ powerpc_perf="no"
 mmx="default"
 cmov="no"
 fast_cmov="no"
+fast_unaligned="no"
 armv5te="default"
 armv6="default"
 iwmmxt="default"
@@ -750,10 +819,9 @@ mmi="default"
 bigendian="no"
 
 # OS
-targetos=`uname -s`
+targetos=$(tolower $(uname -s))
 beos_netserver="no"
 os2="no"
-wince="no"
 
 # non-library system interfaces
 audio_beos="default"
@@ -764,17 +832,14 @@ v4l2="yes"
 v4l="yes"
 
 # libraries
-amr_if2="no"
-amr_nb="no"
-amr_nb_fixed="no"
-amr_wb="no"
 avisynth="no"
 dc1394="no"
 dlfcn_h="no"
 dlopen="no"
 liba52="no"
 liba52bin="no"
-libdts="no"
+libamr_nb="no"
+libamr_wb="no"
 libfaac="no"
 libfaad2="no"
 libfaad="no"
@@ -785,10 +850,10 @@ libnut="no"
 libogg="no"
 libtheora="no"
 libvorbis="no"
+libx264="no"
+libxvid="no"
 mlib="no"
 x11grab="no"
-x264="no"
-xvid="no"
 zlib="yes"
 
 # configurable options
@@ -823,7 +888,7 @@ thread_type="no"
 SHFLAGS='-shared -Wl,-soname,$@'
 VHOOKSHFLAGS='$(SHFLAGS)'
 LIBOBJFLAGS=""
-FFLDFLAGS=-Wl,--warn-common
+FFLDFLAGS=
 LDLATEFLAGS='-Wl,-rpath-link,\$(BUILD_ROOT)/libavcodec -Wl,-rpath-link,\$(BUILD_ROOT)/libavformat -Wl,-rpath-link,\$(BUILD_ROOT)/libavutil'
 FFSERVERLDFLAGS=-Wl,-E
 LDCONFIG="ldconfig"
@@ -857,13 +922,15 @@ fi
 
 FFMPEG_CONFIGURATION="$@"
 
-ENCODER_LIST=`sed -n 's/^[^#]*ENC.*, *\(.*\)).*/\1_encoder/p' "$source_path/libavcodec/allcodecs.c"`
-DECODER_LIST=`sed -n 's/^[^#]*DEC.*, *\(.*\)).*/\1_decoder/p' "$source_path/libavcodec/allcodecs.c"`
-PARSER_LIST=`sed -n 's/^[^#]*PARSER.*, *\(.*\)).*/\1_parser/p' "$source_path/libavcodec/allcodecs.c"`
-MUXER_LIST=`sed -n 's/^[^#]*_MUX.*, *\(.*\)).*/\1_muxer/p' "$source_path/libavformat/allformats.c"`
-DEMUXER_LIST=`sed -n 's/^[^#]*DEMUX.*, *\(.*\)).*/\1_demuxer/p' "$source_path/libavformat/allformats.c"`
+ENCODER_LIST=`sed -n 's/^[^#]*ENC.*(.*, *\(.*\)).*/\1_encoder/p' "$source_path/libavcodec/allcodecs.c"`
+DECODER_LIST=`sed -n 's/^[^#]*DEC.*(.*, *\(.*\)).*/\1_decoder/p' "$source_path/libavcodec/allcodecs.c"`
+PARSER_LIST=`sed -n 's/^[^#]*PARSER.*(.*, *\(.*\)).*/\1_parser/p' "$source_path/libavcodec/allcodecs.c"`
+BSF_LIST=`sed -n 's/^[^#]*BSF.*(.*, *\(.*\)).*/\1_bsf/p' "$source_path/libavcodec/allcodecs.c"`
+MUXER_LIST=`sed -n 's/^[^#]*_MUX.*(.*, *\(.*\)).*/\1_muxer/p' "$source_path/libavformat/allformats.c"`
+DEMUXER_LIST=`sed -n 's/^[^#]*DEMUX.*(.*, *\(.*\)).*/\1_demuxer/p' "$source_path/libavformat/allformats.c"`
+PROTOCOL_LIST=`sed -n 's/^[^#]*PROTOCOL.*(.*, *\(.*\)).*/\1_protocol/p' "$source_path/libavformat/allformats.c"`
 
-enable $ENCODER_LIST $DECODER_LIST $PARSER_LIST $MUXER_LIST $DEMUXER_LIST
+enable $ENCODER_LIST $DECODER_LIST $PARSER_LIST $MUXER_LIST $DEMUXER_LIST $PROTOCOL_LIST $BSF_LIST
 
 die_unknown(){
     echo "Unknown option \"$1\"."
@@ -912,8 +979,6 @@ for opt do
   ;;
   --cpu=*) cpu="$optval"
   ;;
-  --enable-mingwce) wince="yes"
-  ;;
   --disable-opts) optimize="no"
   ;;
   --enable-small) optimize="small"
@@ -932,10 +997,14 @@ for opt do
   ;;
   --disable-parsers) disable $PARSER_LIST
   ;;
+  --disable-bsfs) disable $BSF_LIST
+  ;;
+  --disable-protocols) disable $PROTOCOL_LIST
+  ;;
   --enable-*=*|--disable-*=*)
   eval `echo "$opt" | sed 's/=/-/;s/--/action=/;s/-/ thing=/;s/-/ name=/'`
   case "$thing" in
-      encoder|decoder|muxer|demuxer|parser) $action ${optval}_${thing} ;;
+      encoder|decoder|muxer|demuxer|parser|bsf|protocol) $action ${optval}_${thing} ;;
       *) die_unknown "$opt" ;;
   esac
   ;;
@@ -955,9 +1024,11 @@ done
 case "$arch" in
   i386|i486|i586|i686|i86pc|BePC)
     arch="x86_32"
+    enable fast_unaligned
   ;;
   x86_64|amd64)
     arch="x86_32"
+    enable fast_unaligned
     canon_arch="`$cc -dumpmachine | sed -e 's,\([^-]*\)-.*,\1,'`"
     if [ x"$canon_arch" = x"x86_64" -o x"$canon_arch" = x"amd64" ]; then
       if [ -z "`echo $CFLAGS | grep -- -m32`"  ]; then
@@ -1021,7 +1092,7 @@ esac
 
 # OS specific
 osextralibs="-lm"
-case `tolower $targetos` in
+case $targetos in
   beos|haiku|zeta)
     PREFIX="$HOME/config"
     # helps building libavcodec
@@ -1101,21 +1172,13 @@ case `tolower $targetos` in
     FFSERVERLDFLAGS=-Wl,-bind_at_load
     ;;
   mingw32*)
-    if enabled_all shared static; then
-        cat <<EOF
-You can only build one library type at once on MinGW.
-Specify --disable-static --enable-shared to only build
-the shared libraries. To build only the static libraries
-you do not need to pass additional options.
-EOF
-        exit 1
-    fi
+    targetos=mingw32
+    shlibdir="$bindir"
     dv1394="no"
+    VHOOKSHFLAGS='-shared -L$(BUILD_ROOT)/libavformat -L$(BUILD_ROOT)/libavcodec -L$(BUILD_ROOT)/libswscale -L$(BUILD_ROOT)/libavutil'
+    VHOOKLIBS='-lavformat$(BUILDSUF) -lavcodec$(BUILDSUF) -lswscale$(BUILDSUF) -lavutil$(BUILDSUF) $(EXTRALIBS)'
     ffserver="no"
     network="no"
-    if enabled wince; then
-        protocols="no"
-    fi
     SLIBPREF=""
     SLIBSUF=".dll"
     EXESUF=".exe"
@@ -1123,11 +1186,11 @@ EOF
     SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(NAME)-$(LIBMAJOR)$(SLIBSUF)'
     SLIB_EXTRA_CMD="-lib /machine:i386 /def:\$(@:${SLIBSUF}=.def)"
     SLIB_INSTALL_EXTRA_CMD="-install -m 644 \$(SLIBNAME_WITH_MAJOR:\$(SLIBSUF)=.lib) \"\$(shlibdir)/\$(SLIBNAME_WITH_MAJOR:\$(SLIBSUF)=.lib)\""
-    SHFLAGS="-shared -Wl,--output-def,\$(@:${SLIBSUF}=.def),--out-implib,lib\$(SLIBNAME:\$(SLIBSUF)=.dll.a) -Wl,--enable-runtime-pseudo-reloc"
-    add_extralibs -lws2_32
+    SHFLAGS="-shared -Wl,--output-def,\$(@:${SLIBSUF}=.def),--out-implib,lib\$(SLIBNAME:\$(SLIBSUF)=.dll.a) -Wl,--enable-runtime-pseudo-reloc -Wl,--enable-auto-image-base"
+    enabled network && add_extralibs -lws2_32
     ;;
   cygwin*)
-    targetos=CYGWIN
+    targetos=cygwin
     shlibdir="$bindir"
     dv1394="no"
     VHOOKSHFLAGS='-shared -L$(BUILD_ROOT)/libavformat -L$(BUILD_ROOT)/libavcodec -L$(BUILD_ROOT)/libswscale -L$(BUILD_ROOT)/libavutil'
@@ -1138,13 +1201,13 @@ EOF
     SLIBSUF=".dll"
     SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
     SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(NAME)-$(LIBMAJOR)$(SLIBSUF)'
-    SHFLAGS='-shared -Wl,--out-implib=lib$(NAME).dll.a'
+    SHFLAGS='-shared -Wl,--out-implib=lib$(NAME).dll.a -Wl,--enable-auto-image-base'
     ;;
   linux)
     LDLATEFLAGS="-Wl,--as-needed $LDLATEFLAGS"
     ;;
   irix*)
-    targetos=IRIX
+    targetos=irix
     ranlib="echo ignoring ranlib"
     ;;
   os/2)
@@ -1192,10 +1255,6 @@ ar="${cross_prefix}${ar}"
 ranlib="${cross_prefix}${ranlib}"
 strip="${cross_prefix}${strip}"
 
-# Disable core dumps so that intentional execution of broken apps doesn't
-# pollute the current directory.
-ulimit -c 0
-
 # we need to build at least one lib type
 if disabled_all static shared; then
     cat <<EOF
@@ -1236,9 +1295,8 @@ if disabled gpl ; then
     }
     die_gpl_disabled "The Postprocessing code" pp
     die_gpl_disabled "liba52"                  liba52
-    die_gpl_disabled "libxvidcore"             xvid
-    die_gpl_disabled "x264"                    x264
-    die_gpl_disabled "libdts"                  libdts
+    die_gpl_disabled "libx264"                 libx264
+    die_gpl_disabled "libxvidcore"             libxvid
     die_gpl_disabled "FAAD2"                   libfaad2
     die_gpl_disabled "The X11 grabber"         x11grab
     die_gpl_disabled "The software scaler"     swscaler
@@ -1257,30 +1315,17 @@ test -z "$need_memalign" && need_memalign="$mmx"
 
 #Darwin CC versions
 needmdynamicnopic="no"
-if test $targetos = Darwin; then
+if test $targetos = darwin; then
     if test -n "`$cc -v 2>&1 | grep xlc`"; then
         add_cflags "-qpdf2 -qlanglvl=extc99 -qmaxmem=-1 -qarch=auto -qtune=auto"
     else
-        gcc_version="`$cc -v 2>&1 | grep version | cut -d ' ' -f3-`"
-        case "$gcc_version" in
-            *2.95*)
-                add_cflags "-no-cpp-precomp -pipe"
-                ;;
-            *[34].*)
-                add_cflags "-no-cpp-precomp -pipe -force_cpusubtype_ALL -Wno-sign-compare"
-                if disabled shared; then
-                   needmdynamicnopic="yes"
-                fi
-                ;;
-            *)
-                add_cflags "-no-cpp-precomp -pipe"
-                if disabled shared; then
-                   needmdynamicnopic="yes"
-                fi
-                ;;
-        esac
+        add_cflags "-no-cpp-precomp -pipe"
+        check_cflags "-force_cpusubtype_ALL"
+        check_cflags "-Wno-sign-compare"
+        disabled shared && needmdynamicnopic="yes"
     fi
 fi
+enabled needmdynamicnopic && add_cflags -mdynamic-no-pic
 
 disabled optimize || add_cflags -fomit-frame-pointer
 
@@ -1329,6 +1374,11 @@ if test $cpu != "generic"; then
             warn_altivec disabled PPC970
             POWERPCMODE="64bits"
         ;;
+        Cell|CELL|cell)
+            add_cflags "-mcpu=cell"
+            warn_altivec disabled Cell
+            POWERPCMODE="64bits"
+        ;;
         # targets that do NOT support conditional mov (cmov)
         i[345]86|pentium|pentium-mmx|k6|k6-[23]|winchip-c6|winchip2|c3)
             add_cflags "-march=$cpu"
@@ -1351,7 +1401,7 @@ if test $cpu != "generic"; then
         ;;
         bf*) #bf531 bf532 bf533 bf561 bf5xx all get this config
             add_cflags "-mfdpic"
-            add_ldflags "-mfdpic -Wl,--defsym,__stacksize=0x40000"
+            add_ldflags "-mfdpic"
         ;;
         *)
         echo "WARNING: Unknown CPU \"$cpu\", ignored."
@@ -1398,26 +1448,16 @@ if test "$?" != 0; then
 fi
 
 if test $arch = "x86_32" -o $arch = "x86_64"; then
-    if test "$targetos" = "mingw32" -o "$targetos" = "CYGWIN"; then
-        cat <<EOF
-WARNING: The following test might cause a testapp to crash (intentionally)
-resulting in the appearance of a dialog box. Please click "Don't send" and
-ignore it.
-EOF
-    fi
-
     # check whether EBP is available on x86
     # As 'i' is stored on the stack, this program will crash
     # if the base pointer is used to access it because the
     # base pointer is cleared in the inline assembly code.
-    check_exec <<EOF && enable ebp_available
-int main(){
+    check_exec_crash <<EOF && enable ebp_available
     volatile int i=0;
     asm volatile (
         "xorl %%ebp, %%ebp"
     ::: "%ebp");
     return i;
-}
 EOF
 
     # check wether EBX is available on x86
@@ -1425,6 +1465,13 @@ EOF
 int main(){
     asm volatile ("":::"%ebx");
 }
+EOF
+
+    # check whether binutils is new enough to compile SSSE3
+    check_cc <<EOF && enable ssse3
+int main(){
+    asm volatile ("pabsw %xmm0, %xmm0");
+}
 EOF
 fi
 
@@ -1585,21 +1632,20 @@ for thread in $THREADS_LIST; do
     fi
 done
 
-enabled_any amr_nb amr_nb_fixed amr_wb amr_if2 && enable amr
-enabled_all amr_nb amr_nb_fixed &&
-    die "Only one of amr_nb and amr_nb_fixed may be enabled."
+enabled_any libamr_nb libamr_wb && enable libamr
 
 # these are off by default, so fail if requested and not available
 enabled liba52     && require liba52 a52dec/a52.h a52_init -la52
-enabled libdts     && require libdts dts.h dts_init -ldts -lm
+enabled libamr_nb  && require libamrnb amrnb/interf_dec.h Speech_Decode_Frame_init -lamrnb -lm
+enabled libamr_wb  && require libamrwb amrwb/dec_if.h D_IF_init -lamrwb -lm
 enabled libgsm     && require libgsm gsm.h gsm_create -lgsm
 enabled libmp3lame && require LAME lame/lame.h lame_init -lmp3lame -lm
 enabled libtheora  && require libtheora theora/theora.h theora_info_init -ltheora -logg
 enabled libvorbis  && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbis -lvorbisenc -logg
 enabled libogg     && require libogg ogg/ogg.h ogg_sync_init -logg
 enabled libnut     && require libnut libnut.h nut_demuxer_init -lnut
-enabled xvid       && require XviD xvid.h xvid_global -lxvidcore
-enabled x264       && require x264 x264.h x264_encoder_open -lx264
+enabled libx264    && require x264 x264.h x264_encoder_open -lx264
+enabled libxvid    && require Xvid xvid.h xvid_global -lxvidcore
 enabled dc1394     && require libdc1394 libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394
 enabled mlib       && require mediaLib mlib_types.h mlib_VectorSub_S16_U8_Mod -lmlib
 enabled libfaac    && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
@@ -1630,14 +1676,16 @@ elif check_func dlopen -ldl; then
     ldl=-ldl
 fi
 
+check_func fork
+
 test "$vhook" = "default" && vhook="$dlopen"
 
 enabled_any vhook liba52bin libfaadbin ffserver && add_extralibs $ldl
 
-if test "$targetos" = "CYGWIN" && enabled static ; then
+if test "$targetos" = cygwin -o "$targetos" = mingw32 && enabled_all static vhook ; then
     vhook="no"
     echo
-    echo "At the moment vhooks don't work on Cygwin static builds."
+    echo "At the moment vhooks don't work on Cygwin or MinGW static builds."
     echo "Patches welcome."
     echo
 fi
@@ -1744,6 +1792,7 @@ check_cflags -Wno-pointer-sign
 enabled extra_warnings && check_cflags -Winline
 
 # add some linker flags
+check_ldflags -Wl,--warn-common
 check_ldflags $LDLATEFLAGS
 
 # not all compilers support -Os
@@ -1773,8 +1822,7 @@ if enabled gprof; then
     add_ldflags "-p"
 fi
 
-VHOOKCFLAGS="-fPIC $CFLAGS"
-enabled needmdynamicnopic && add_cflags -mdynamic-no-pic
+VHOOKCFLAGS="-fPIC `echo $CFLAGS | sed s/-mdynamic-no-pic//`"
 
 # find if .align arg is power-of-two or not
 if test $asmalign_pot = "unknown"; then
@@ -1782,15 +1830,17 @@ if test $asmalign_pot = "unknown"; then
     echo 'asm (".align 3");' | check_cc && asmalign_pot="yes"
 fi
 
-enabled_any $ENCODER_LIST && enable encoders
-enabled_any $DECODER_LIST && enable decoders
-enabled_any $MUXER_LIST   && enable muxers
-enabled_any $DEMUXER_LIST && enable demuxers
+enabled_any $ENCODER_LIST  && enable encoders
+enabled_any $DECODER_LIST  && enable decoders
+enabled_any $MUXER_LIST    && enable muxers
+enabled_any $DEMUXER_LIST  && enable demuxers
+enabled_any $PROTOCOL_LIST && enable protocols
+enabled_any $BSF_LIST      && enable bsfs
 
-enabled_any $THREADS_LIST && enable threads
+enabled_any $THREADS_LIST  && enable threads
 
 check_deps $CONFIG_LIST $HAVE_LIST $DECODER_LIST $ENCODER_LIST $PARSER_LIST \
-    $DEMUXER_LIST $MUXER_LIST
+    $BSF_LIST $DEMUXER_LIST $MUXER_LIST $PROTOCOL_LIST
 
 enabled libogg    && append pkg_requires "ogg >= 1.1"
 enabled libtheora && append pkg_requires "theora"
@@ -1850,7 +1900,8 @@ echo "Sun medialib support      $mlib"
 echo "AVISynth enabled          $avisynth"
 echo "liba52 support            $liba52"
 echo "liba52 dlopened           $liba52bin"
-echo "libdts support            $libdts"
+echo "libamr-nb support         $libamr_nb"
+echo "libamr-wb support         $libamr_wb"
 echo "libfaac enabled           $libfaac"
 echo "libfaad enabled           $libfaad"
 echo "faadbin enabled           $libfaadbin"
@@ -1860,13 +1911,9 @@ echo "libnut enabled            $libnut"
 echo "libogg enabled            $libogg"
 echo "libtheora enabled         $libtheora"
 echo "libvorbis enabled         $libvorbis"
-echo "x264 enabled              $x264"
-echo "XviD enabled              $xvid"
+echo "x264 enabled              $libx264"
+echo "XviD enabled              $libxvid"
 echo "zlib enabled              $zlib"
-echo "AMR-NB float support      $amr_nb"
-echo "AMR-NB fixed support      $amr_nb_fixed"
-echo "AMR-WB float support      $amr_wb"
-echo "AMR-WB IF2 support        $amr_if2"
 if disabled gpl; then
     echo "License: LGPL"
 else
@@ -1918,25 +1965,18 @@ echo "SLIBPREF=$SLIBPREF" >> config.mak
 echo "SLIBSUF=\${BUILDSUF}$SLIBSUF" >> config.mak
 echo "EXESUF=\${BUILDSUF}$EXESUF" >> config.mak
 
-ucarch=`toupper $arch`
-echo "TARGET_ARCH_${ucarch}=yes" >> config.mak
-echo "#define ARCH_${ucarch} 1" >> $TMPH
+enable $arch
 
 # special cases
+enabled_any x86_32 x86_64 && enable x86
+enabled     sparc64       && enable sparc
+
 case "$arch" in
-    x86_32|x86_64)
-        echo "TARGET_ARCH_X86=yes" >> config.mak
-        echo "#define ARCH_X86 1" >> $TMPH
-        ;;
     powerpc)
         if test "$POWERPCMODE" = "64bits"; then
             echo "#define POWERPC_MODE_64BITS 1" >> $TMPH
         fi
         ;;
-    sparc64)
-        echo "TARGET_ARCH_SPARC=yes" >> config.mak
-        echo "#define ARCH_SPARC 1" >> $TMPH
-        ;;
 esac
 
 if enabled bigendian; then
@@ -1985,11 +2025,18 @@ fi
 echo "LIB_INSTALL_EXTRA_CMD=${LIB_INSTALL_EXTRA_CMD}" >> config.mak
 echo "EXTRALIBS=$extralibs" >> config.mak
 
+print_config ARCH_   $TMPH config.mak $ARCH_LIST
 print_config HAVE_   $TMPH config.mak $HAVE_LIST
-print_config CONFIG_ $TMPH config.mak $CONFIG_LIST
-print_config TARGET_ $TMPH config.mak $TARGET_LIST
-
-if test "$targetos" = "Darwin"; then
+print_config CONFIG_ $TMPH config.mak $CONFIG_LIST   \
+                                      $DECODER_LIST  \
+                                      $ENCODER_LIST  \
+                                      $PARSER_LIST   \
+                                      $BSF_LIST      \
+                                      $DEMUXER_LIST  \
+                                      $MUXER_LIST    \
+                                      $PROTOCOL_LIST \
+
+if test "$targetos" = darwin; then
   echo "#define CONFIG_DARWIN 1"  >> $TMPH
 fi
 
@@ -2004,10 +2051,6 @@ echo "SRC_PATH=\"$source_path\"" >> config.mak
 echo "SRC_PATH_BARE=$source_path" >> config.mak
 echo "BUILD_ROOT=\"$PWD\"" >> config.mak
 
-if enabled amr_if2; then
-  echo "AMR_CFLAGS=-DIF2=1" >> config.mak
-fi
-
 # Apparently it's not possible to portably echo a backslash.
 if enabled asmalign_pot; then
   printf '#define ASMALIGN(ZEROBITS) ".align " #ZEROBITS "\\n\\t"\n' >> $TMPH
@@ -2016,19 +2059,6 @@ else
 fi
 
 
-for codec in $DECODER_LIST $ENCODER_LIST $PARSER_LIST $DEMUXER_LIST $MUXER_LIST; do
-    ucname="`toupper $codec`"
-    config_name="CONFIG_$ucname"
-    enabled_name="ENABLE_$ucname"
-    if enabled $codec; then
-        echo "#define $config_name 1" >> $TMPH
-        echo "#define $enabled_name 1" >> $TMPH
-        echo "$config_name=yes" >> config.mak
-    else
-        echo "#define $enabled_name 0" >> $TMPH
-    fi
-done
-
 # Do not overwrite config.h if unchanged to avoid superfluous rebuilds.
 if ! cmp -s $TMPH config.h; then
         mv -f $TMPH config.h
@@ -2051,9 +2081,6 @@ if enabled source_path_used; then
          libavcodec/sparc \
          libavcodec/mlib \
          libavcodec/ppc \
-         libavcodec/amr \
-         libavcodec/amr_float \
-         libavcodec/amrwb_float \
          libpostproc \
          libavutil \
          libswscale \
@@ -2070,7 +2097,6 @@ if enabled source_path_used; then
           libswscale/Makefile \
           tests/Makefile \
           vhook/Makefile \
-          doc/Makefile \
           doc/texi2pod.pl \
           "
     for dir in $DIRS ; do