]> git.sesse.net Git - ffmpeg/blobdiff - configure
Replace every usage of -lvfw32 with what is particularly necessary for
[ffmpeg] / configure
index 7ad3c2638e400373756e937fab74d1444e2eb087..708cab030eca5817619b494bae1f63ac8e3048b7 100755 (executable)
--- a/configure
+++ b/configure
@@ -92,13 +92,13 @@ Configuration options:
   --enable-w32threads      use Win32 threads [no]
   --enable-x11grab         enable X11 grabbing [no]
   --disable-network        disable network support [no]
-  --disable-ipv6           disable IPv6 support [no]
   --disable-mpegaudio-hp   faster (but less accurate) MPEG audio decoding [no]
   --enable-gray            enable full grayscale support (slower color)
   --disable-swscale-alpha  disable alpha channel support in swscale
   --disable-fastdiv        disable table-based division
   --enable-small           optimize for size instead of speed
   --disable-aandct         disable AAN DCT code
+  --disable-dct            disable DCT code
   --disable-fft            disable FFT code
   --disable-golomb         disable Golomb code
   --disable-lpc            disable LPC code
@@ -106,6 +106,7 @@ Configuration options:
   --disable-rdft           disable RDFT code
   --disable-vaapi          disable VAAPI code
   --disable-vdpau          disable VDPAU code
+  --disable-dxva2          disable DXVA2 code
   --enable-runtime-cpudetect detect cpu capabilities at runtime (bigger binary)
   --enable-hardcoded-tables use hardcoded tables instead of runtime generation
   --enable-memalign-hack   emulate memalign, interferes with memory debuggers
@@ -208,6 +209,7 @@ Advanced options (experts only):
                            instruction selection, may crash on older CPUs)
   --enable-powerpc-perf    enable performance report on PPC
                            (requires enabling PMC)
+  --disable-asm            disable all assembler optimizations
   --disable-altivec        disable AltiVec optimizations
   --disable-amd3dnow       disable 3DNow! optimizations
   --disable-amd3dnowext    disable 3DNow! extended optimizations
@@ -355,11 +357,15 @@ disable_weak(){
 }
 
 enable_safe(){
-    enable $(echo "$*" | sed 's/[^A-Za-z0-9_ ]/_/g')
+    for var; do
+        enable $(echo "$var" | sed 's/[^A-Za-z0-9_]/_/g')
+    done
 }
 
 disable_safe(){
-    disable $(echo "$*" | sed 's/[^A-Za-z0-9_ ]/_/g')
+    for var; do
+        disable $(echo "$var" | sed 's/[^A-Za-z0-9_]/_/g')
+    done
 }
 
 do_enable_deep(){
@@ -446,11 +452,15 @@ check_deps(){
         eval dep_any="\$${cfg}_deps_any"
         eval dep_sel="\$${cfg}_select"
         eval dep_sgs="\$${cfg}_suggest"
+        eval dep_ifa="\$${cfg}_if"
+        eval dep_ifn="\$${cfg}_if_any"
 
-        pushvar cfg dep_all dep_any dep_sel dep_sgs
-        check_deps $dep_all $dep_any $dep_sel $dep_sgs
-        popvar cfg dep_all dep_any dep_sel dep_sgs
+        pushvar cfg dep_all dep_any dep_sel dep_sgs dep_ifa dep_ifn
+        check_deps $dep_all $dep_any $dep_sel $dep_sgs $dep_ifa $dep_ifn
+        popvar cfg dep_all dep_any dep_sel dep_sgs dep_ifa dep_ifn
 
+        [ -n "$dep_ifa" ] && { enabled_all $dep_ifa && enable_weak $cfg; }
+        [ -n "$dep_ifn" ] && { enabled_any $dep_ifn && enable_weak $cfg; }
         enabled_all  $dep_all || disable $cfg
         enabled_any  $dep_any || disable $cfg
         disabled_any $dep_sel && disable $cfg
@@ -478,6 +488,7 @@ print_config(){
             echo "${pfx}${ucname}=yes" >> $makefile
         else
             echo "#define ${pfx}${ucname} 0" >> $header
+            echo "!${pfx}${ucname}=yes" >> $makefile
         fi
     done
 }
@@ -574,11 +585,11 @@ check_as(){
 check_asm(){
     log check_asm "$@"
     name="$1"
-    asm="$2"
+    code="$2"
     shift 2
     disable $name
     check_as "$@" <<EOF && enable $name
-void foo(void){ __asm__ volatile($asm); }
+void foo(void){ __asm__ volatile($code); }
 EOF
 }
 
@@ -592,12 +603,12 @@ check_yasm(){
 
 check_ld(){
     log check_ld "$@"
-    check_cc || return
     flags=''
     libs=''
     for f; do
         test "${f}" = "${f#-l}" && flags="$flags $f" || libs="$libs $f"
     done
+    check_cc $($filter_cflags $flags) || return
     check_cmd $ld $LDFLAGS $flags -o $TMPE $TMPO $extralibs $libs
 }
 
@@ -617,13 +628,18 @@ int x;
 EOF
 }
 
-check_ldflags(){
-    log check_ldflags "$@"
-    check_ld "$@" <<EOF && add_ldflags "$@"
+test_ldflags(){
+    log test_ldflags "$@"
+    check_ld "$@" <<EOF
 int main(void){ return 0; }
 EOF
 }
 
+check_ldflags(){
+    log check_ldflags "$@"
+    test_ldflags "$@" && add_ldflags "$@"
+}
+
 check_header(){
     log check_header "$@"
     header=$1
@@ -669,7 +685,8 @@ check_cpp_condition(){
     log check_cpp_condition "$@"
     header=$1
     condition=$2
-    check_cpp <<EOF
+    shift 2
+    check_cpp $($filter_cppflags "$@") <<EOF
 #include <$header>
 #if !($condition)
 #error "unsatisfied condition: $condition"
@@ -694,11 +711,7 @@ check_lib2(){
     headers="$1"
     func="$2"
     shift 2
-    temp_extralibs "$@"
-    check_func_headers "$headers" $func && add_extralibs "$@"
-    err=$?
-    restore_flags
-    return $err
+    check_func_headers "$headers" $func "$@" && add_extralibs "$@"
 }
 
 check_exec(){
@@ -736,18 +749,36 @@ check_type(){
     headers=$1
     type=$2
     shift 2
-    disable $type
+    disable_safe "$type"
     incs=""
     for hdr in $headers; do
         incs="$incs
 #include <$hdr>"
     done
-    check_cc "$@" <<EOF && enable $type
+    check_cc "$@" <<EOF && enable_safe "$type"
 $incs
 $type v;
 EOF
 }
 
+check_struct(){
+    log check_type "$@"
+    headers=$1
+    struct=$2
+    member=$3
+    shift 3
+    disable_safe "${struct}_${member}"
+    incs=""
+    for hdr in $headers; do
+        incs="$incs
+#include <$hdr>"
+    done
+    check_cc "$@" <<EOF && enable_safe "${struct}_${member}"
+$incs
+const void *p = &(($struct *)0)->$member;
+EOF
+}
+
 require(){
     name="$1"
     header="$2"
@@ -801,6 +832,12 @@ apply(){
     "$@" < "$file" > "$file.tmp" && mv "$file.tmp" "$file" || rm "$file.tmp"
 }
 
+cp_if_changed(){
+    cmp -s "$1" "$2" &&
+        echo "$2 is unchanged" ||
+        cp -f "$1" "$2"
+}
+
 # CONFIG_LIST contains configurable options, while HAVE_LIST is for
 # system-dependent things.
 
@@ -826,7 +863,9 @@ CONFIG_LIST="
     avisynth
     beos_netserver
     bzlib
+    dct
     doc
+    dxva2
     fastdiv
     ffmpeg
     ffplay
@@ -837,7 +876,6 @@ CONFIG_LIST="
     gprof
     gray
     hardcoded_tables
-    ipv6
     libdc1394
     libdirac
     libfaac
@@ -927,14 +965,18 @@ ARCH_EXT_LIST='
     vis
 '
 
+HAVE_LIST_PUB='
+    bigendian
+'
+
 HAVE_LIST="
     $ARCH_EXT_LIST
+    $HAVE_LIST_PUB
     $THREADS_LIST
     alsa_asoundlib_h
     altivec_h
     arpa_inet_h
     attribute_packed
-    bigendian
     bswap
     closesocket
     cmov
@@ -950,10 +992,14 @@ HAVE_LIST="
     dos_paths
     ebp_available
     ebx_available
+    exp2
+    exp2f
     fast_64bit
+    fast_clz
     fast_cmov
     fast_unaligned
     fork
+    getaddrinfo
     gethrtime
     GetProcessTimes
     getrusage
@@ -965,6 +1011,7 @@ HAVE_LIST="
     libdc1394_2
     llrint
     log2
+    log2f
     loongson
     lrint
     lrintf
@@ -984,6 +1031,11 @@ HAVE_LIST="
     socklen_t
     soundcard_h
     poll_h
+    struct_addrinfo
+    struct_ipv6_mreq
+    struct_sockaddr_in6
+    struct_sockaddr_sa_len
+    struct_sockaddr_storage
     sys_mman_h
     sys_resource_h
     sys_select_h
@@ -1010,6 +1062,7 @@ CMDLINE_SELECT="
     $ARCH_EXT_LIST
     $CONFIG_LIST
     $THREADS_LIST
+    asm
     cross_compile
     debug
     extra_warnings
@@ -1062,30 +1115,40 @@ CMDLINE_APPEND="
 # code dependency declarations
 
 # architecture extensions
-altivec_deps="ppc"
-amd3dnow_deps="mmx"
-amd3dnowext_deps="amd3dnow"
+
 armv5te_deps="arm"
 armv6_deps="arm"
 armv6t2_deps="arm"
 armvfp_deps="arm"
 iwmmxt_deps="arm"
+neon_deps="arm"
+
 mmi_deps="mips"
+
+altivec_deps="ppc"
+ppc4xx_deps="ppc"
+
+vis_deps="sparc"
+
+x86_64_select="cmov fast_cmov"
+amd3dnow_deps="mmx"
+amd3dnowext_deps="amd3dnow"
 mmx_deps="x86"
 mmx2_deps="mmx"
-neon_deps="arm"
-ppc4xx_deps="ppc"
 sse_deps="mmx"
 ssse3_deps="sse"
-vis_deps="sparc"
+
+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"
 
 need_memalign="altivec neon sse"
 inline_asm_deps="!tms470"
 
 # decoders / encoders / hardware accelerators
-aac_decoder_select="fft mdct"
+aac_decoder_select="fft mdct aac_parser"
 aac_encoder_select="fft mdct"
-ac3_decoder_select="fft mdct"
+ac3_decoder_select="fft mdct ac3_parser"
 alac_encoder_select="lpc"
 atrac3_decoder_select="fft mdct"
 cavs_decoder_select="golomb"
@@ -1103,13 +1166,18 @@ flac_decoder_select="golomb"
 flac_encoder_select="golomb lpc"
 flashsv_decoder_select="zlib"
 flashsv_encoder_select="zlib"
+flv_decoder_select="h263_decoder"
 flv_encoder_select="h263_encoder"
 h261_encoder_select="aandct"
+h263_decoder_select="h263_parser"
 h263_encoder_select="aandct"
 h263_vaapi_hwaccel_deps="va_va_h"
 h263_vaapi_hwaccel_select="vaapi h263_decoder"
+h263i_decoder_select="h263_decoder"
 h263p_encoder_select="h263_encoder"
 h264_decoder_select="golomb"
+h264_dxva2_hwaccel_deps="dxva2api_h"
+h264_dxva2_hwaccel_select="dxva2 h264_decoder"
 h264_vaapi_hwaccel_deps="va_va_h"
 h264_vaapi_hwaccel_select="vaapi"
 h264_vdpau_decoder_deps="vdpau_vdpau_h vdpau_vdpau_x11_h"
@@ -1120,8 +1188,10 @@ jpegls_encoder_select="golomb"
 ljpeg_encoder_select="aandct"
 loco_decoder_select="golomb"
 mjpeg_encoder_select="aandct"
+mlp_decoder_select="mlp_parser"
 mpeg1video_encoder_select="aandct"
 mpeg2video_encoder_select="aandct"
+mpeg4_decoder_select="h263_decoder mpeg4video_parser"
 mpeg4_encoder_select="h263_encoder"
 mpeg_vdpau_decoder_deps="vdpau_vdpau_h vdpau_vdpau_x11_h"
 mpeg_vdpau_decoder_select="vdpau mpegvideo_decoder"
@@ -1131,17 +1201,24 @@ mpeg2_vaapi_hwaccel_deps="va_va_h"
 mpeg2_vaapi_hwaccel_select="vaapi mpeg2video_decoder"
 mpeg4_vaapi_hwaccel_deps="va_va_h"
 mpeg4_vaapi_hwaccel_select="vaapi mpeg4_decoder"
+mpeg4_vdpau_decoder_deps="vdpau_vdpau_h vdpau_vdpau_x11_h"
+mpeg4_vdpau_decoder_select="vdpau mpeg4_decoder"
 mpeg_xvmc_decoder_deps="X11_extensions_XvMClib_h"
 mpeg_xvmc_decoder_select="mpegvideo_decoder"
+msmpeg4v1_decoder_select="h263_decoder"
 msmpeg4v1_encoder_select="h263_encoder"
+msmpeg4v2_decoder_select="h263_decoder"
 msmpeg4v2_encoder_select="h263_encoder"
+msmpeg4v3_decoder_select="h263_decoder"
 msmpeg4v3_encoder_select="h263_encoder"
 nellymoser_decoder_select="fft mdct"
 nellymoser_encoder_select="fft mdct"
 png_decoder_select="zlib"
 png_encoder_select="zlib"
 qdm2_decoder_select="fft mdct rdft"
+rv10_decoder_select="h263_decoder"
 rv10_encoder_select="h263_encoder"
+rv20_decoder_select="h263_decoder"
 rv20_encoder_select="h263_encoder"
 rv30_decoder_select="golomb"
 rv40_decoder_select="golomb"
@@ -1154,7 +1231,9 @@ svq3_decoder_suggest="zlib"
 theora_decoder_select="vp3_decoder"
 tiff_decoder_suggest="zlib"
 tiff_encoder_suggest="zlib"
+truehd_decoder_select="mlp_decoder"
 tscc_decoder_select="zlib"
+vc1_decoder_select="h263_decoder"
 vc1_vaapi_hwaccel_deps="va_va_h"
 vc1_vaapi_hwaccel_select="vaapi vc1_decoder"
 vc1_vdpau_decoder_deps="vdpau_vdpau_h vdpau_vdpau_x11_h"
@@ -1167,7 +1246,9 @@ wmav1_decoder_select="fft mdct"
 wmav1_encoder_select="fft mdct"
 wmav2_decoder_select="fft mdct"
 wmav2_encoder_select="fft mdct"
+wmv1_decoder_select="h263_decoder"
 wmv1_encoder_select="h263_encoder"
+wmv2_decoder_select="h263_decoder"
 wmv2_encoder_select="h263_encoder"
 wmv3_decoder_select="vc1_decoder"
 wmv3_vaapi_hwaccel_select="vc1_vaapi_hwaccel"
@@ -1180,6 +1261,9 @@ zmbv_encoder_select="zlib"
 # parsers
 h264_parser_select="golomb"
 
+# bitstream_filters
+aac_adtstoasc_bsf_select="aac_parser"
+
 # external libraries
 libdirac_decoder_deps="libdirac !libschroedinger"
 libdirac_encoder_deps="libdirac"
@@ -1208,6 +1292,7 @@ ac3_demuxer_deps="ac3_parser"
 asf_stream_muxer_select="asf_muxer"
 avisynth_demuxer_deps="avisynth"
 dirac_demuxer_deps="dirac_parser"
+eac3_demuxer_select="ac3_parser"
 ipod_muxer_select="mov_muxer"
 libnut_demuxer_deps="libnut"
 libnut_muxer_deps="libnut"
@@ -1218,10 +1303,11 @@ mp3_demuxer_deps="mpegaudio_parser"
 mp4_muxer_select="mov_muxer"
 mpegtsraw_demuxer_select="mpegts_demuxer"
 mxf_d10_muxer_select="mxf_muxer"
+ogg_demuxer_select="golomb"
 psp_muxer_select="mov_muxer"
-rtp_muxer_deps="network rtp_protocol"
 rtsp_demuxer_deps="sdp_demuxer"
 sdp_demuxer_deps="rtp_protocol mpegts_demuxer"
+spdif_muxer_select="aac_parser"
 tg2_muxer_select="mov_muxer"
 tgp_muxer_select="mov_muxer"
 w64_demuxer_deps="wav_demuxer"
@@ -1245,9 +1331,9 @@ oss_outdev_deps_any="soundcard_h sys_soundcard_h"
 v4l_indev_deps="linux_videodev_h"
 v4l2_indev_deps_any="linux_videodev2_h sys_videoio_h"
 vfwcap_indev_deps="capCreateCaptureWindow"
-vfwcap_indev_extralibs="-lvfw32"
+vfwcap_indev_extralibs="-lavicap32"
 x11_grab_device_indev_deps="x11grab XShmCreateImage"
-x11_grab_device_indev_extralibs="-lX11 -lXext"
+x11_grab_device_indev_extralibs="-lX11 -lXext -lXfixes"
 
 # protocols
 gopher_protocol_deps="network"
@@ -1292,6 +1378,8 @@ ranlib="ranlib"
 strip="strip"
 yasmexe="yasm"
 
+nm_opts='-g'
+
 # machine
 arch=$(uname -m)
 cpu="generic"
@@ -1301,13 +1389,13 @@ target_os=$(tolower $(uname -s))
 host_os=$target_os
 
 # configurable options
+enable asm
 enable debug
 enable doc
 enable fastdiv
 enable ffmpeg
 enable ffplay
 enable ffserver
-enable ipv6
 enable mpegaudio_hp
 enable network
 enable optimizations
@@ -1404,7 +1492,7 @@ die_unknown(){
 show_list() {
     suffix=_$1
     shift
-    echo $* | sed s/$suffix//g | tr ' ' '\n' | sort
+    echo $* | sed s/$suffix//g | tr ' ' '\n' | sort | pr -3 -t
     exit 0
 }
 
@@ -1517,6 +1605,7 @@ tmpfile TMPE  $EXESUF
 tmpfile TMPH  .h
 tmpfile TMPO  .o
 tmpfile TMPS  .S
+tmpfile TMPV  .ver
 tmpfile TMPSH .sh
 
 unset -f mktemp
@@ -1602,10 +1691,12 @@ elif $cc -version 2>/dev/null | grep -q TMS470; then
                     ;;
                 -mfpu=neon)     echo --float_support=vfpv3 --neon ;;
                 -mfpu=vfp)      echo --float_support=vfpv2        ;;
+                -mfpu=vfpv3)    echo --float_support=vfpv3        ;;
                 -msoft-float)   echo --float_support=vfplib       ;;
                 -Os)            echo -O3 -mf=2                    ;;
                 -O[0-3])        echo $flag -mf=5                  ;;
                 -g)             echo -g -mn                       ;;
+                -pds=*)         echo $flag                        ;;
             esac
         done
     }
@@ -1619,6 +1710,41 @@ elif $cc -V 2>&1 | grep -q Sun; then
     cc_version="AV_STRINGIFY(__SUNPRO_C)"
     DEPEND_CMD='$(DEPCC) $(DEPFLAGS) $< | sed -e "1s,^.*: ,$@: ," -e "\$$!s,\$$, \\\," -e "1!s,^.*: , ," > $(@:.o=.d)'
     DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -xM1'
+    filter_cflags=suncc_flags
+    suncc_flags(){
+        for flag; do
+            case $flag in
+                -march=*|-mcpu=*)
+                    case "${flag#*=}" in
+                        native)                   echo -xtarget=native       ;;
+                        v9)                       echo -xarch=sparc          ;;
+                        ultrasparc)               echo -xarch=sparcvis       ;;
+                        ultrasparc3|niagara*)     echo -xarch=sparcvis2      ;;
+                        i586|pentium)             echo -xchip=pentium        ;;
+                        i686|pentiumpro|pentium2) echo -xtarget=pentium_pro  ;;
+                        pentium3*|c3-2)           echo -xtarget=pentium3     ;;
+                        pentium-m)          echo -xarch=sse2 -xchip=pentium3 ;;
+                        pentium4*)          echo -xtarget=pentium4           ;;
+                        prescott|nocona)    echo -xarch=sse3 -xchip=pentium4 ;;
+                        *-sse3)             echo -xarch=sse3                 ;;
+                        core2)              echo -xarch=ssse3 -xchip=core2   ;;
+                        amdfam10|barcelona)       echo -xarch=sse4_1         ;;
+                        athlon-4|athlon-[mx]p)    echo -xarch=ssea           ;;
+                        k8|opteron|athlon64|athlon-fx)
+                                                  echo -xarch=sse2a          ;;
+                        athlon*)                  echo -xarch=pentium_proa   ;;
+                    esac
+                    ;;
+                -std=c99)             echo -xc99              ;;
+                -fomit-frame-pointer) echo -xregs=frameptr    ;;
+                -fPIC)                echo -KPIC -xcode=pic32 ;;
+                -Os)                  echo -O5 -xspace        ;;
+                -W*,*)                echo $flag              ;;
+                -f*-*|-W*)                                    ;;
+                *)                    echo $flag              ;;
+            esac
+        done
+    }
 fi
 
 test -n "$cc_type" && enable $cc_type || echolog "Unknown C compiler $cc"
@@ -1658,7 +1784,11 @@ if test "$cpu" = host; then
         gcc)
             check_native(){
                 $cc $1=native -v -c -o $TMPO $TMPC >$TMPE 2>&1 || return
-                awk "/$1=/{ match(\$0, /$1=(\\w+)/, a);print a[1];exit }" $TMPE
+                sed -n "/$1=/{
+                            s/.*$1=\\([^ ]*\\).*/\\1/
+                            p
+                            q
+                        }" $TMPE
             }
             cpu=$(check_native -march || check_native -mcpu)
         ;;
@@ -1667,99 +1797,163 @@ if test "$cpu" = host; then
     test "${cpu:-host}" = host && die "--cpu=host not supported with compiler $cc"
 fi
 
-# Add processor-specific flags
-case $cpu in
-    601|ppc601|PowerPC601)
-        cpuflags="-mcpu=601"
-    ;;
-    603*|ppc603*|PowerPC603*)
-        cpuflags="-mcpu=603"
-    ;;
-    604*|ppc604*|PowerPC604*)
-        cpuflags="-mcpu=604"
-    ;;
-    G3|g3|75*|ppc75*|PowerPC75*)
-        cpuflags="-mcpu=750 -mpowerpc-gfxopt"
-    ;;
-    G4|g4|745*|ppc745*|PowerPC745*)
-        cpuflags="-mcpu=7450 -mpowerpc-gfxopt"
-    ;;
-    74*|ppc74*|PowerPC74*)
-        cpuflags="-mcpu=7400 -mpowerpc-gfxopt"
-    ;;
-    G5|g5|970|ppc970|PowerPC970|power4*|Power4*)
-        cpuflags="-mcpu=970 -mpowerpc-gfxopt -mpowerpc64"
-    ;;
-    Cell|CELL|cell)
-        cpuflags="-mcpu=cell"
-        enable ldbrx
-    ;;
-    # targets that do NOT support conditional mov (cmov)
-    i[345]86|pentium|pentium-mmx|k6|k6-[23]|winchip-c6|winchip2|c3)
-        cpuflags="-march=$cpu"
-        disable cmov
-    ;;
-    # targets that do support conditional mov (cmov)
-    i686|pentiumpro|pentium[23]|pentium-m|athlon|athlon-tbird|athlon-4|athlon-[mx]p|athlon64|k8|opteron|athlon-fx|core2|amdfam10)
-        cpuflags="-march=$cpu"
-        enable cmov
-        enable fast_cmov
-    ;;
-    # targets that do support conditional mov but on which it's slow
-    pentium4|pentium4m|prescott|nocona)
-        cpuflags="-march=$cpu"
-        enable cmov
-        disable fast_cmov
-    ;;
-    sparc64)
-        cpuflags="-mcpu=v9"
-    ;;
-    arm11*|cortex*)
-        cpuflags="-mcpu=$cpu"
-        enable fast_unaligned
-    ;;
-    armv[67]*)
-        cpuflags="-march=$cpu"
-        enable fast_unaligned
-    ;;
-    armv*)
-        cpuflags="-march=$cpu"
-    ;;
+# Deal with common $arch aliases
+case "$arch" in
     arm*)
-        cpuflags="-mcpu=$cpu"
+        arch="arm"
     ;;
-    ev4|ev45|ev5|ev56|pca56|ev6|ev67)
-        enabled ccc && cpuflags="-arch $cpu" || cpuflags="-mcpu=$cpu"
+    mips|mipsel|IP*)
+        arch="mips"
     ;;
-    bf*)
-        cpuflags="-mcpu=$cpu"
+    mips64)
+        arch="mips"
+        subarch="mips64"
     ;;
-    mips*|[45]k*|[237]4k*|m4k|r*000|loongson2[ef])
-        cpuflags="-march=$cpu"
+    parisc|hppa)
+        arch="parisc"
     ;;
-    ap7[02]0[0-2])
-        subarch="avr32_ap"
-        cpuflags="-mpart=$cpu"
+    parisc64|hppa64)
+        arch="parisc"
+        subarch="parisc64"
     ;;
-    ap)
-        subarch="avr32_ap"
-        cpuflags="-march=$cpu"
+    "Power Macintosh"|ppc|powerpc)
+        arch="ppc"
     ;;
-    uc3[ab]*)
-        subarch="avr32_uc"
-        cpuflags="-mcpu=$cpu"
+    ppc64)
+        arch="ppc"
+        subarch="ppc64"
     ;;
-    uc)
-        subarch="avr32_uc"
-        cpuflags="-march=$cpu"
+    s390|s390x)
+        arch="s390"
     ;;
-    generic)
+    sh4|sh)
+        arch="sh4"
     ;;
-    *)
-        echo "WARNING: Unknown CPU \"$cpu\", ignored."
+    sun4u|sparc64)
+        arch="sparc"
+        subarch="sparc64"
+    ;;
+    i[3-6]86|i86pc|BePC|x86_64|amd64)
+        arch="x86"
     ;;
 esac
 
+is_in $arch $ARCH_LIST || echo "WARNING: unknown arch $arch"
+enable $arch
+
+# Add processor-specific flags
+if test "$cpu" = generic; then
+    : do nothing
+elif enabled ppc; then
+
+    case $cpu in
+        601|ppc601|PowerPC601)
+            cpuflags="-mcpu=601"
+        ;;
+        603*|ppc603*|PowerPC603*)
+            cpuflags="-mcpu=603"
+        ;;
+        604*|ppc604*|PowerPC604*)
+            cpuflags="-mcpu=604"
+        ;;
+        G3|g3|75*|ppc75*|PowerPC75*)
+            cpuflags="-mcpu=750 -mpowerpc-gfxopt"
+        ;;
+        G4|g4|745*|ppc745*|PowerPC745*)
+            cpuflags="-mcpu=7450 -mpowerpc-gfxopt"
+        ;;
+        74*|ppc74*|PowerPC74*)
+            cpuflags="-mcpu=7400 -mpowerpc-gfxopt"
+        ;;
+        G5|g5|970|ppc970|PowerPC970|power4*|Power4*)
+            cpuflags="-mcpu=970 -mpowerpc-gfxopt -mpowerpc64"
+        ;;
+        Cell|CELL|cell)
+            cpuflags="-mcpu=cell"
+            enable ldbrx
+        ;;
+    esac
+
+elif enabled x86; then
+
+    case $cpu in
+        i[345]86|pentium)
+            cpuflags="-march=$cpu"
+            disable mmx
+        ;;
+        # targets that do NOT support conditional mov (cmov)
+        pentium-mmx|k6|k6-[23]|winchip-c6|winchip2|c3)
+            cpuflags="-march=$cpu"
+            disable cmov
+        ;;
+        # targets that do support conditional mov (cmov)
+        i686|pentiumpro|pentium[23]|pentium-m|athlon|athlon-tbird|athlon-4|athlon-[mx]p|athlon64|k8|opteron|athlon-fx|core2|amdfam10)
+            cpuflags="-march=$cpu"
+            enable cmov
+            enable fast_cmov
+        ;;
+        # targets that do support conditional mov but on which it's slow
+        pentium4|pentium4m|prescott|nocona)
+            cpuflags="-march=$cpu"
+            enable cmov
+            disable fast_cmov
+        ;;
+    esac
+
+elif enabled sparc; then
+
+    case $cpu in
+        sparc64)
+            cpuflags="-mcpu=v9"
+        ;;
+    esac
+
+elif enabled arm; then
+
+    case $cpu in
+        armv*)
+            cpuflags="-march=$cpu"
+        ;;
+        *)
+            cpuflags="-mcpu=$cpu"
+        ;;
+    esac
+
+elif enabled alpha; then
+
+    enabled ccc && cpuflags="-arch $cpu" || cpuflags="-mcpu=$cpu"
+
+elif enabled bfin; then
+
+    cpuflags="-mcpu=$cpu"
+
+elif enabled mips; then
+
+    cpuflags="-march=$cpu"
+
+elif enabled avr32; then
+
+    case $cpu in
+        ap7[02]0[0-2])
+            subarch="avr32_ap"
+            cpuflags="-mpart=$cpu"
+        ;;
+        ap)
+            subarch="avr32_ap"
+            cpuflags="-march=$cpu"
+        ;;
+        uc3[ab]*)
+            subarch="avr32_uc"
+            cpuflags="-mcpu=$cpu"
+        ;;
+        uc)
+            subarch="avr32_uc"
+            cpuflags="-march=$cpu"
+        ;;
+    esac
+
+fi
+
 add_cflags $cpuflags
 add_asflags $cpuflags
 
@@ -1788,94 +1982,23 @@ EOF
 check_host_cflags -std=c99
 
 case "$arch" in
-    alpha)
-        arch="alpha"
-        enable fast_64bit
-        check_cflags -mieee
+    alpha|ia64|mips|parisc|sparc)
         spic=$shared
     ;;
-    arm|armv[4567]*l)
-        arch="arm"
-    ;;
-    avr32)
-    ;;
-    bfin)
-        arch="bfin"
-    ;;
-    ia64)
-        arch="ia64"
-        enable fast_64bit
-        spic=$shared
-        # HACK: currently fails to build if .bss is > 4MB and shared libs are built
-        enabled shared && enable_weak hardcoded_tables
-    ;;
-    m68k)
-        arch="m68k"
-    ;;
-    mips|mipsel|IP*)
-        arch="mips"
-        spic=$shared
-    ;;
-    mips64)
-        arch="mips"
-        subarch="mips64"
-        enable fast_64bit
-        spic=$shared
-    ;;
-    parisc|hppa)
-        arch="parisc"
-        spic=$shared
-    ;;
-    parisc64|hppa64)
-        arch="parisc"
-        enable fast_64bit
-        spic=$shared
-    ;;
-    "Power Macintosh"|ppc|powerpc)
-        arch="ppc"
-        enable fast_unaligned
-    ;;
-    ppc64)
-        arch="ppc"
-        subarch="ppc64"
-        enable fast_64bit
-        enable fast_unaligned
-    ;;
-    s390|s390x)
-        arch="s390"
-    ;;
-    sh4|sh)
-        arch="sh4"
-    ;;
-    sparc)
-        arch="sparc"
-        spic=$shared
-    ;;
-    sun4u|sparc64)
-        arch="sparc"
-        subarch="sparc64"
-        enable fast_64bit
-        spic=$shared
-    ;;
-    i386|i486|i586|i686|i86pc|BePC|x86_64|amd64)
-        arch="x86"
+    x86)
         subarch="x86_32"
-        enable fast_unaligned
-        check_cc <<EOF && enable fast_64bit && subarch="x86_64" && spic=$shared
+        check_cc <<EOF && subarch="x86_64"
         int test[(int)sizeof(char*) - 7];
 EOF
         if test "$subarch" = "x86_64"; then
-            enable cmov
-            enable fast_cmov
+            spic=$shared
         fi
     ;;
-    *)
-        arch="unknown"
-    ;;
 esac
 
-enable $arch $subarch
+enable $subarch
 enabled spic && enable pic
+check_cpp_condition stdlib.h "defined(__PIC__) || defined(__pic__) || defined(PIC)" && enable pic
 
 # OS specific
 case $target_os in
@@ -1909,6 +2032,7 @@ case $target_os in
         enabled x86 && SHFLAGS="-mimpure-text $SHFLAGS"
         network_extralibs="-lsocket -lnsl"
         add_cppflags -D__EXTENSIONS__
+        nm_opts='-P -g'
         ;;
     netbsd)
         oss_indev_extralibs="-lossaudio"
@@ -1948,6 +2072,8 @@ case $target_os in
             { check_cflags -mdynamic-no-pic && add_asflags -mdynamic-no-pic; }
         ;;
     mingw32*)
+        # Only WinXP or greater are supported
+        add_cflags -D_WIN32_WINNT=0x0501
         if test $target_os = "mingw32ce"; then
             disable network
         else
@@ -1982,7 +2108,7 @@ case $target_os in
             enabled_any avisynth vfwcap_indev &&
                 { check_cpp_condition w32api.h "(__W32API_MAJOR_VERSION > 3) || (__W32API_MAJOR_VERSION == 3 && __W32API_MINOR_VERSION >= 13)" ||
                   die "ERROR: avisynth and vfwcap_indev require w32api version 3.13 or later."; }
-            fi
+        fi
         ;;
     cygwin*)
         target_os=cygwin
@@ -2112,7 +2238,7 @@ enabled pic && enable_pic
 check_cc <<EOF || die "Symbol mangling check failed."
 int ff_extern;
 EOF
-sym=$($nm -P -g $TMPO | grep ff_extern)
+sym=$($nm $nm_opts $TMPO | awk '/ff_extern/{ print substr($0, match($0, /[^ \t]*ff_extern/)) }')
 extern_prefix=${sym%%ff_extern*}
 
 check_cc <<EOF && enable inline_asm
@@ -2133,9 +2259,13 @@ EOF
 check_cc <<EOF || die "endian test failed"
 unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
 EOF
-od -A n -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian
+od -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian
 
-if enabled arm; then
+if enabled alpha; then
+
+    check_cflags -mieee
+
+elif enabled arm; then
 
     check_cflags -marm
 
@@ -2156,6 +2286,11 @@ EOF
 
     enabled_all armv6t2 shared !pic && enable_pic
 
+elif enabled ia64; then
+
+    # HACK: currently fails to build if .bss is > 4MB and shared libs are built
+    enabled shared && enable_weak hardcoded_tables
+
 elif enabled mips; then
 
     check_asm loongson '"dmult.g $1, $2, $3"'
@@ -2237,10 +2372,15 @@ EOF
     test -n "$extern_prefix"  && append YASMFLAGS "-DPREFIX"
     case "$objformat" in
         elf) enabled debug && append YASMFLAGS "-g dwarf2" ;;
-        macho64)              append YASMFLAGS "-DPIC" ;;
     esac
     disabled yasm || { check_yasm "pabsw xmm0, xmm0" && enable yasm; }
 
+    case "$cpu" in
+        athlon*|opteron*|k8*|pentium|pentium-mmx|prescott|nocona|atom|geode)
+            disable fast_clz
+        ;;
+    esac
+
 fi
 
 if check_func dlopen; then
@@ -2253,6 +2393,7 @@ fi
 check_func nanosleep || { check_func nanosleep -lrt && add_extralibs -lrt; }
 
 check_func  fork
+check_func  getaddrinfo $network_extralibs
 check_func  gethrtime
 check_func  getrusage
 check_func  inet_aton $network_extralibs
@@ -2267,6 +2408,7 @@ check_func_headers windows.h VirtualAlloc
 
 check_header conio.h
 check_header dlfcn.h
+check_header dxva2api.h
 check_header malloc.h
 check_header poll.h
 check_header sys/mman.h
@@ -2314,8 +2456,11 @@ done
 check_lib math.h sin -lm
 check_lib va/va.h vaInitialize -lva
 
+check_func exp2
+check_func exp2f
 check_func llrint
 check_func log2
+check_func log2f
 check_func lrint
 check_func lrintf
 check_func round
@@ -2323,7 +2468,7 @@ check_func roundf
 check_func truncf
 
 # these are off by default, so fail if requested and not available
-enabled avisynth   && require2 vfw32 "windows.h vfw.h" AVIFileInit -lvfw32
+enabled avisynth   && require2 vfw32 "windows.h vfw.h" AVIFileInit -lavifil32
 enabled libdirac   && add_cflags $(pkg-config --cflags dirac) &&
                       require  libdirac libdirac_decoder/dirac_parser.h dirac_decoder_init $(pkg-config --libs dirac) &&
                       require  libdirac libdirac_encoder/dirac_encoder.h dirac_encoder_init $(pkg-config --libs dirac)
@@ -2338,11 +2483,11 @@ enabled libopenjpeg && require libopenjpeg openjpeg.h opj_version -lopenjpeg
 enabled libschroedinger && add_cflags $(pkg-config --cflags schroedinger-1.0) &&
                            require libschroedinger schroedinger/schro.h schro_init $(pkg-config --libs schroedinger-1.0)
 enabled libspeex   && require  libspeex speex/speex.h speex_decoder_init -lspeex
-enabled libtheora  && require  libtheora theora/theora.h theora_info_init -ltheora -logg
+enabled libtheora  && require  libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
 enabled libvorbis  && require  libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg
 enabled libx264    && require  libx264 x264.h x264_encoder_encode -lx264 -lm &&
-                      { check_cpp_condition x264.h "X264_BUILD >= 78" ||
-                        die "ERROR: libx264 version must be >= 0.78."; }
+                      { check_cpp_condition x264.h "X264_BUILD >= 83" ||
+                        die "ERROR: libx264 version must be >= 0.83."; }
 enabled libxvid    && require  libxvid xvid.h xvid_global -lxvidcore
 enabled mlib       && require  mediaLib mlib_types.h mlib_VectorSub_S16_U8_Mod -lmlib
 
@@ -2355,37 +2500,25 @@ if enabled libdc1394; then
     die "ERROR: No version of libdc1394 found "
 fi
 
-disable sdl_too_old
-disable sdl
 SDL_CONFIG="${cross_prefix}sdl-config"
 if "${SDL_CONFIG}" --version > /dev/null 2>&1; then
     sdl_cflags=$("${SDL_CONFIG}" --cflags)
     sdl_libs=$("${SDL_CONFIG}" --libs)
-    temp_cflags $sdl_cflags
-    temp_extralibs $sdl_libs
-    if check_lib2 SDL.h SDL_Init; then
-        _sdlversion=$("${SDL_CONFIG}" --version | sed 's/[^0-9]//g')
-        if test "$_sdlversion" -lt 121 ; then
-            enable sdl_too_old
-        else
-            enable sdl
-            check_cc $sdl_cflags <<EOF && enable sdl_video_size
-#include <SDL.h>
-int main(int argc, char **argv){
-    const SDL_VideoInfo *vi = SDL_GetVideoInfo();
-    int w = vi->current_w;
-    return 0;
-}
-EOF
-        fi
-    fi
-    restore_flags
+    check_func_headers SDL.h SDL_Init $sdl_cflags $sdl_libs &&
+    check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201" $sdl_cflags &&
+    enable sdl &&
+    check_struct SDL.h SDL_VideoInfo current_w $sdl_cflags && enable sdl_video_size
 fi
 
 texi2html -version > /dev/null 2>&1 && enable texi2html || disable texi2html
 
 if enabled network; then
     check_type "sys/types.h sys/socket.h" socklen_t
+    check_type netdb.h "struct addrinfo"
+    check_type netinet/in.h "struct ipv6_mreq"
+    check_type netinet/in.h "struct sockaddr_in6"
+    check_type "sys/types.h sys/socket.h" "struct sockaddr_storage"
+    check_struct "sys/types.h sys/socket.h" "struct sockaddr" sa_len
     # Prefer arpa/inet.h over winsock2
     if check_header arpa/inet.h ; then
         check_func closesocket
@@ -2395,30 +2528,21 @@ if enabled network; then
         { check_func_headers winsock2.h closesocket -lws2_32 && \
             network_extralibs="-lws2_32"; }
         check_type ws2tcpip.h socklen_t
+        check_type ws2tcpip.h "struct addrinfo"
+        check_type ws2tcpip.h "struct ipv6_mreq"
+        check_type ws2tcpip.h "struct sockaddr_in6"
+        check_type ws2tcpip.h "struct sockaddr_storage"
+        check_struct winsock2.h "struct sockaddr" sa_len
     else
         disable network
     fi
 fi
 
-enabled_all network ipv6 && check_ld <<EOF || disable ipv6
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <netdb.h>
-int main(void) {
-    struct sockaddr_storage saddr;
-    struct ipv6_mreq mreq6;
-    getaddrinfo(0,0,0,0);
-    getnameinfo(0,0,0,0,0,0,0);
-    IN6_IS_ADDR_MULTICAST((const struct in6_addr *)0);
-}
-EOF
-
 check_header linux/videodev.h
 check_header linux/videodev2.h
 check_header sys/videoio.h
 
-check_func_headers "windows.h vfw.h" capCreateCaptureWindow -lvfw32
+check_func_headers "windows.h vfw.h" capCreateCaptureWindow "$vfwcap_indev_extralibs"
 
 # check for ioctl_meteor.h, ioctl_bt848.h and alternatives
 { check_header dev/bktr/ioctl_meteor.h &&
@@ -2439,8 +2563,17 @@ enabled jack_indev && check_lib2 jack/jack.h jack_client_open -ljack
 enabled x11grab                         &&
 check_header X11/Xlib.h                 &&
 check_header X11/extensions/XShm.h      &&
+check_header X11/extensions/Xfixes.h    &&
 check_func XOpenDisplay -lX11           &&
-check_func XShmCreateImage -lX11 -lXext
+check_func XShmCreateImage -lX11 -lXext &&
+check_func XFixesGetCursorImage -lX11 -lXext -lXfixes
+
+if ! disabled vdpau && enabled vdpau_vdpau_h; then
+check_cpp_condition \
+    vdpau/vdpau.h "defined VDP_DECODER_PROFILE_MPEG4_PART2_ASP" ||
+    { echolog "Please upgrade to libvdpau >= 0.2 if you would like vdpau support." &&
+      disable vdpau; }
+fi
 
 enabled debug && add_cflags -g"$debuglevel" && add_asflags -g"$debuglevel"
 
@@ -2464,6 +2597,10 @@ check_ldflags -Wl,--as-needed
 check_ldflags '-Wl,-rpath-link,\$(BUILD_ROOT)/libpostproc -Wl,-rpath-link,\$(BUILD_ROOT)/libswscale -Wl,-rpath-link,\$(BUILD_ROOT)/libavfilter -Wl,-rpath-link,\$(BUILD_ROOT)/libavdevice -Wl,-rpath-link,\$(BUILD_ROOT)/libavformat -Wl,-rpath-link,\$(BUILD_ROOT)/libavcodec -Wl,-rpath-link,\$(BUILD_ROOT)/libavutil'
 check_ldflags -Wl,-Bsymbolic
 
+echo "X{};" > $TMPV
+test_ldflags -Wl,--version-script,$TMPV &&
+    append SHFLAGS '-Wl,--version-script,\$(SUBDIR)lib\$(NAME).ver'
+
 if enabled small; then
     check_cflags -Os            # not all compilers support -Os
     optimizations="small"
@@ -2471,6 +2608,8 @@ elif enabled optimizations; then
     if enabled xlc; then
         add_cflags  -O5
         add_ldflags -O5
+    elif enabled suncc; then
+        add_cflags -O5
     elif enabled ccc; then
         add_cflags -fast
     else
@@ -2507,6 +2646,11 @@ elif enabled gcc; then
     check_cflags -fno-tree-vectorize
 elif enabled clang; then
     check_cflags -Qunused-arguments
+elif enabled armcc; then
+    # 2523: use of inline assembler is deprecated
+    add_cflags -Wrvct,--diag_suppress=2523
+elif enabled tms470; then
+    add_cflags -pds=824 -pds=837
 fi
 
 if enabled gprof; then
@@ -2545,6 +2689,8 @@ check_deps $CONFIG_LIST       \
            $OUTDEV_LIST       \
            $PROTOCOL_LIST     \
 
+enabled asm || disable $ARCH_LIST $ARCH_EXT_LIST
+
 echo "install prefix            $prefix"
 echo "source path               $source_path"
 echo "C compiler                $cc"
@@ -2602,14 +2748,8 @@ echo "postprocessing support    ${postproc-no}"
 echo "new filter support        ${avfilter-no}"
 echo "filters using lavformat   ${avfilter_lavf-no}"
 echo "network support           ${network-no}"
-if enabled network; then
-    echo "IPv6 support              ${ipv6-no}"
-fi
 echo "threading support         ${thread_type-no}"
 echo "SDL support               ${sdl-no}"
-if enabled sdl_too_old; then
-    echo "-> Your SDL version is too old - please upgrade to have FFplay/SDL support."
-fi
 echo "Sun medialib support      ${mlib-no}"
 echo "AVISynth enabled          ${avisynth-no}"
 echo "libdc1394 support         ${libdc1394-no}"
@@ -2657,6 +2797,44 @@ echo "License: $license"
 
 echo "Creating config.mak and config.h..."
 
+# build tree in object directory if source path is different from current one
+if enabled source_path_used; then
+    DIRS="
+        doc
+        libavcodec
+        libavcodec/$arch
+        libavdevice
+        libavfilter
+        libavformat
+        libavutil
+        libavutil/$arch
+        libpostproc
+        libswscale
+        libswscale/$arch
+        tests
+        tools
+    "
+    FILES="
+        Makefile
+        common.mak
+        subdir.mak
+        doc/texi2pod.pl
+        libavcodec/Makefile
+        libavdevice/Makefile
+        libavfilter/Makefile
+        libavformat/Makefile
+        libavutil/Makefile
+        libpostproc/Makefile
+        libswscale/Makefile
+    "
+    for dir in $DIRS ; do
+        mkdir -p $dir
+    done
+    for f in $FILES ; do
+        $ln_s "$source_path/$f" $f
+    done
+fi
+
 enabled stripping || strip="echo skipping strip"
 
 cat > config.mak <<EOF
@@ -2755,6 +2933,7 @@ cat > $TMPH <<EOF
 #ifndef FFMPEG_CONFIG_H
 #define FFMPEG_CONFIG_H
 #define FFMPEG_CONFIGURATION "$(c_escape $FFMPEG_CONFIGURATION)"
+#define FFMPEG_LICENSE "$(c_escape $license)"
 #define FFMPEG_DATADIR "$(eval c_escape $datadir)"
 #define CC_TYPE "$cc_type"
 #define CC_VERSION $cc_version
@@ -2788,48 +2967,19 @@ echo "#endif /* FFMPEG_CONFIG_H */" >> $TMPH
 echo "endif # FFMPEG_CONFIG_MAK" >> config.mak
 
 # Do not overwrite an unchanged config.h to avoid superfluous rebuilds.
-cmp -s $TMPH config.h &&
-    echo "config.h is unchanged" ||
-    mv -f $TMPH config.h
+cp_if_changed $TMPH config.h
 
-# build tree in object directory if source path is different from current one
-if enabled source_path_used; then
-    DIRS="
-        doc
-        libavcodec
-        libavcodec/$arch
-        libavdevice
-        libavfilter
-        libavformat
-        libavutil
-        libavutil/$arch
-        libpostproc
-        libswscale
-        libswscale/$arch
-        tests
-        tools
-    "
-    FILES="
-        Makefile
-        common.mak
-        subdir.mak
-        doc/texi2pod.pl
-        libavcodec/Makefile
-        libavdevice/Makefile
-        libavfilter/Makefile
-        libavformat/Makefile
-        libavutil/Makefile
-        libpostproc/Makefile
-        libswscale/Makefile
-    "
-    for dir in $DIRS ; do
-        mkdir -p $dir
-    done
-    for f in $FILES ; do
-        $ln_s "$source_path/$f" $f
-    done
-fi
+cat > $TMPH <<EOF
+/* Generated by ffconf */
+#ifndef AVUTIL_AVCONFIG_H
+#define AVUTIL_AVCONFIG_H
+EOF
+
+print_config AV_HAVE_ $TMPH /dev/null $HAVE_LIST_PUB
+
+echo "#endif /* AVUTIL_AVCONFIG_H */" >> $TMPH
 
+cp_if_changed $TMPH libavutil/avconfig.h
 
 # build pkg-config files