Skip to content
Snippets Groups Projects
configure 88.1 KiB
Newer Older
  • Learn to ignore specific revisions
  • Måns Rullgård's avatar
    Måns Rullgård committed
            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
    
    
    Måns Rullgård's avatar
    Måns Rullgård committed
        case $cpu in
            sparc64)
                cpuflags="-mcpu=v9"
            ;;
        esac
    
        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 avr32; then
    
    
    Måns Rullgård's avatar
    Måns Rullgård committed
        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
    
    add_cflags $cpuflags
    add_asflags $cpuflags
    
    
    # compiler sanity check
    check_exec <<EOF
    int main(void){ return 0; }
    EOF
    if test "$?" != 0; then
        echo "$cc is unable to create an executable file."
        if test -z "$cross_prefix" && ! enabled cross_compile ; then
            echo "If $cc is a cross-compiler, use the --enable-cross-compile option."
            echo "Only do this if you know what cross compiling means."
        fi
        die "C compiler test failed."
    fi
    
    
    add_cppflags -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112
    
    check_cflags -std=c99
    
    check_cc -D_FILE_OFFSET_BITS=64 <<EOF && add_cppflags -D_FILE_OFFSET_BITS=64
    
    check_cc -D_LARGEFILE_SOURCE <<EOF && add_cppflags -D_LARGEFILE_SOURCE
    
    check_host_cflags -std=c99
    
    
    case "$arch" in
    
        alpha|ia64|mips|parisc|sparc)
    
            spic=$shared
    
            subarch="x86_32"
    
            check_cc <<EOF && subarch="x86_64"
    
            int test[(int)sizeof(char*) - 7];
    
            if test "$subarch" = "x86_64"; then
    
                spic=$shared
    
    enable $subarch
    
    enabled spic && enable pic
    
            prefix_default="$HOME/config"
    
            # 3 gcc releases known for BeOS, each with ugly bugs
    
            gcc_version="$($cc -v 2>&1 | grep version | cut -d ' ' -f3-)"
    
            case "$gcc_version" in
              2.9-beos-991026*|2.9-beos-000224*) echo "R5/GG gcc"
                disable mmx
                ;;
              *20010315*) echo "BeBits gcc"
    
                add_cflags -fno-expensive-optimizations
    
                ;;
            esac
            SHFLAGS=-nostart
            # enable BeOS things
            enable audio_beos
            # no need for libm, but the inet stuff
            # Check for BONE
            # XXX: actually should check for NOT net_server
    
            if echo $BEINCLUDES | grep -q 'headers/be/bone'; then
    
                network_extralibs="-lbind -lsocket"
            else
                enable beos_netserver
                network_extralibs="-lnet"
            fi ;;
        sunos)
            FFSERVERLDFLAGS=""
    
            SHFLAGS='-shared -Wl,-h,$$(@F)'
    
            enabled x86 && SHFLAGS="-mimpure-text $SHFLAGS"
    
            add_cppflags -D__EXTENSIONS__
    
            nm_opts='-P -g'
    
            oss_indev_extralibs="-lossaudio"
            oss_outdev_extralibs="-lossaudio"
    
            add_cppflags -D_XOPEN_SOURCE=600
    
            # On OpenBSD 4.5. the compiler does not use PIC unless
            # explicitly using -fPIC. FFmpeg builds fine without PIC,
            # however the generated executable will not do anything
            # (simply quits with exit-code 1, no crash, no output).
    
            # Thus explicitly enable PIC here.
    
            oss_indev_extralibs="-lossaudio"
            oss_outdev_extralibs="-lossaudio"
    
            ;;
        bsd/os)
            osextralibs="-lpoll -lgnugetopt"
            strip="strip -d"
            ;;
        darwin)
    
            SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(SHLIBDIR)/$(SLIBNAME),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR) -Wl,-read_only_relocs,suppress'
    
            strip="strip -x"
            FFLDFLAGS="-Wl,-dynamic,-search_paths_first"
            SLIBSUF=".dylib"
            SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME).$(LIBVERSION)$(SLIBSUF)'
            SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME).$(LIBMAJOR)$(SLIBSUF)'
            FFSERVERLDFLAGS=-Wl,-bind_at_load
    
    Loren Merritt's avatar
    Loren Merritt committed
            objformat="macho"
    
            enabled x86_64 && objformat="macho64"
    
            enabled_any pic shared ||
    
                { check_cflags -mdynamic-no-pic && add_asflags -mdynamic-no-pic; }
    
            if test $target_os = "mingw32ce"; then
    
            LIBTARGET=i386
    
                LIBTARGET=x64
    
            elif enabled arm; then
                LIBTARGET=arm
    
            disable ffserver
            SLIBPREF=""
            SLIBSUF=".dll"
            SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
            SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
    
            SLIB_EXTRA_CMD='-lib.exe /machine:$(LIBTARGET) /def:$$(@:$(SLIBSUF)=.def) /out:$(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib)'
    
            SLIB_INSTALL_EXTRA_CMD='-install -m 644 $(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib) "$(SHLIBDIR)/$(SLIBNAME:$(SLIBSUF)=.lib)"; \
    
                install -m 644 $(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib) "$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib)"; \
                install -d "$(LIBDIR)"; \
                install -m 644 $(SUBDIR)lib$(SLIBNAME:$(SLIBSUF)=.dll.a) "$(LIBDIR)/lib$(SLIBNAME:$(SLIBSUF)=.dll.a)"'
    
            SLIB_UNINSTALL_EXTRA_CMD='rm -f "$(SHLIBDIR)/$(SLIBNAME:$(SLIBSUF)=.lib)"'
    
            SHFLAGS='-shared -Wl,--output-def,$$(@:$(SLIBSUF)=.def) -Wl,--out-implib,$(SUBDIR)lib$(SLIBNAME:$(SLIBSUF)=.dll.a) -Wl,--enable-runtime-pseudo-reloc -Wl,--enable-auto-image-base'
    
    Loren Merritt's avatar
    Loren Merritt committed
            objformat="win32"
    
            check_cflags -fno-common
    
    Ramiro Polla's avatar
    Ramiro Polla committed
                check_cpp_condition _mingw.h "(__MINGW32_MAJOR_VERSION > 3) || (__MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION >= 15)" ||
                    die "ERROR: MinGW runtime version must be >= 3.15."
    
                enabled_any avisynth vfwcap_indev &&
    
    Ramiro Polla's avatar
    Ramiro Polla committed
                    { 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."; }
    
    Ramiro Polla's avatar
    Ramiro Polla committed
            fi
    
            SLIBPREF="cyg"
            SLIBSUF=".dll"
            SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
            SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
            SHFLAGS='-shared -Wl,--enable-auto-image-base'
    
    Loren Merritt's avatar
    Loren Merritt committed
            objformat="win32"
    
            check_cflags -fno-common
    
    Michael Kostylev's avatar
    Michael Kostylev committed
        *-dos|freedos|opendos)
    
            disable ffplay ffserver
    
    Michael Kostylev's avatar
    Michael Kostylev committed
            disable $INDEV_LIST $OUTDEV_LIST
            network_extralibs="-lsocket"
    
            objformat="coff"
    
        os/2*)
            strip="lxlite"
            ln_s="cp -f"
            FFLDFLAGS="-Zomf -Zbin-files -Zargs-wild -Zmap"
    
    Måns Rullgård's avatar
    Måns Rullgård committed
            SHFLAGS='$(SUBDIR)$(NAME).def -Zdll -Zomf'
    
            FFSERVERLDFLAGS=""
    
            SLIBPREF=""
            SLIBSUF=".dll"
            SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
            SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(shell echo $(NAME) | cut -c1-6)$(LIBMAJOR)$(SLIBSUF)'
    
    Måns Rullgård's avatar
    Måns Rullgård committed
            SLIB_CREATE_DEF_CMD='echo LIBRARY $(SLIBNAME_WITH_MAJOR) INITINSTANCE TERMINSTANCE > $(SUBDIR)$(NAME).def; \
              echo PROTMODE >> $(SUBDIR)$(NAME).def; \
              echo CODE PRELOAD MOVEABLE DISCARDABLE >> $(SUBDIR)$(NAME).def; \
              echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $(SUBDIR)$(NAME).def; \
              echo EXPORTS >> $(SUBDIR)$(NAME).def; \
              emxexp -o $(OBJS) >> $(SUBDIR)$(NAME).def'
            SLIB_EXTRA_CMD='emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(NAME).def; \
              emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib $(SUBDIR)$(NAME).def;'
            SLIB_INSTALL_EXTRA_CMD='install -m 644 $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib "$(LIBDIR)"'
    
            SLIB_UNINSTALL_EXTRA_CMD='rm -f "$(LIBDIR)"/$(LIBPREF)$(NAME)_dll.a "$(LIBDIR)"/$(LIBPREF)$(NAME)_dll.lib'
    
            die "Unknown OS '$target_os'."
    
    check_cpp_condition stdlib.h "defined(__PIC__) || defined(__pic__) || defined(PIC)" && enable pic
    
    
    set_default $PATHS_LIST
    
    
    Fabrice Bellard's avatar
    Fabrice Bellard committed
    
    
    # Combine FFLDFLAGS and the LDFLAGS environment variable.
    LDFLAGS="$FFLDFLAGS $LDFLAGS"
    
    # we need to build at least one lib type
    
    if ! enabled_any static shared; then
    
        cat <<EOF
    At least one library type must be built.
    Specify --enable-static to build the static libraries or --enable-shared to
    build the shared libraries as well. To only build the shared libraries specify
    --disable-static in addition to --enable-shared.
    EOF
        exit 1;
    fi
    
    
    disabled static && LIBNAME=""
    
    if enabled_any libfaad libfaadbin ; then
        if check_header faad.h; then
    
    Diego Biurrun's avatar
    Diego Biurrun committed
            check_cc <<EOF
    
    #include <faad.h>
    #ifndef FAAD2_VERSION
    ok faad1
    #endif
    
    int main(void) { return 0; }
    
    EOF
            test $? = 0 && enable libfaad2
        else
    
            die "FAAD test failed."
    
        enabled $1 || { enabled $2 && die "$2 is $1 and --enable-$1 is not specified."; }
    
    }
    
    die_license_disabled gpl libfaad2
    die_license_disabled gpl libx264
    die_license_disabled gpl libxvid
    die_license_disabled gpl postproc
    die_license_disabled gpl x11grab
    
    
    die_license_disabled nonfree libfaac
    
    die_license_disabled version3 libopencore_amrnb
    die_license_disabled version3 libopencore_amrwb
    
    
    enabled version3 && { enabled gpl && enable gplv3 || enable lgplv3; }
    
    check_deps $ARCH_EXT_LIST
    
    disabled optimizations || check_cflags -fomit-frame-pointer
    
        add_cppflags -DPIC
        add_cflags   -fPIC
        add_asflags  -fPIC
    
    check_cc <<EOF || die "Symbol mangling check failed."
    int ff_extern;
    EOF
    
    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
    void foo(void) { __asm__ volatile ("" ::); }
    EOF
    
    _restrict=
    for restrict_keyword in restrict __restrict__ __restrict; do
        check_cc <<EOF && _restrict=$restrict_keyword && break
    void foo(char * $restrict_keyword p);
    EOF
    done
    
    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
    
    od -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian
    
    if enabled alpha; then
    
        check_cflags -mieee
    
    elif enabled arm; then
    
        check_ld <<EOF && enable vfp_args
    __asm__ (".eabi_attribute 28, 1");
    int main(void) { return 0; }
    EOF
    
        # We have to check if pld is a nop and disable it.
        check_asm pld '"pld [r0]"'
    
        enabled armv5te && check_asm armv5te '"qadd r0, r0, r0"'
        enabled armv6   && check_asm armv6   '"sadd16 r0, r0, r0"'
        enabled armv6t2 && check_asm armv6t2 '"movt r0, #0"'
        enabled armvfp  && check_asm armvfp  '"fadds s0, s0, s0"'
        enabled iwmmxt  && check_asm iwmmxt  '"wunpckelub wr6, wr4"'
        enabled neon    && check_asm neon    '"vadd.i16 q0, q0, q0"'
    
        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"'
        enabled mmi     && check_asm mmi     '"lq $2, 0($2)"'
    
    elif enabled ppc; then
    
        enable local_aligned_8 local_aligned_16
    
    
        check_asm dcbzl     '"dcbzl 0, 1"'
        check_asm ppc4xx    '"maclhw r10, r11, r12"'
    
        check_asm xform_asm '"lwzx %1, %y0" :: "Z"(*(int*)0), "r"(0)'
    
    
        # AltiVec flags: The FSF version of GCC differs from the Apple version
        if enabled altivec; then
            check_cflags -maltivec -mabi=altivec &&
            { check_header altivec.h && inc_altivec_h="#include <altivec.h>" ; } ||
            check_cflags -faltivec
    
            # check if our compiler supports Motorola AltiVec C API
            check_cc <<EOF || disable altivec
    $inc_altivec_h
    int main(void) {
        vector signed int v1, v2, v3;
        v1 = vec_add(v2,v3);
        return 0;
    }
    EOF
    
            # check if our compiler supports braces for vector declarations
            check_cc <<EOF || die "You need a compiler that supports {} in AltiVec vector declarations."
    $inc_altivec_h
    int main (void) { (vector int) {1}; return 0; }
    EOF
        fi
    
    elif enabled sparc; then
    
        enabled vis && check_asm vis '"pdist %f0, %f0, %f0"' -mcpu=ultrasparc &&
            add_cflags -mcpu=ultrasparc -mtune=ultrasparc
    
    elif enabled x86; then
    
        enable local_aligned_8 local_aligned_16
    
    
        # 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_crash <<EOF && enable ebp_available
    
        __asm__ volatile (
    
    Reimar Döffinger's avatar
    Reimar Döffinger committed
        # check whether EBX is available on x86
    
        check_asm ebx_available '""::"b"(0)' &&
            check_asm ebx_available '"":::"%ebx"'
    
        # check whether more than 10 operands are supported
        check_cc <<EOF && enable ten_operands
    int main(void) {
        int x=0;
        __asm__ volatile(
            ""
            :"+&rm"(x), "+&rm"(x), "+&rm"(x), "+&rm"(x), "+&rm"(x), "+&rm"(x)
        );
        return 0;
    }
    EOF
    
    
        # check whether binutils is new enough to compile SSSE3/MMX2
    
        enabled ssse3 && check_asm ssse3 '"pabsw %xmm0, %xmm0"'
    
        enabled mmx2  && check_asm mmx2  '"pmaxub %mm0, %mm1"'
    
    
        check_asm bswap '"bswap %%eax" ::: "%eax"'
    
    Loren Merritt's avatar
    Loren Merritt committed
    
    
        YASMFLAGS="-f $objformat -DARCH_$(toupper $subarch)"
    
    Loren Merritt's avatar
    Loren Merritt committed
        enabled     x86_64        && append YASMFLAGS "-m amd64"
    
        enabled     pic           && append YASMFLAGS "-DPIC"
    
        test -n "$extern_prefix"  && append YASMFLAGS "-DPREFIX"
    
    Loren Merritt's avatar
    Loren Merritt committed
        case "$objformat" in
            elf) enabled debug && append YASMFLAGS "-g dwarf2" ;;
        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
    
    
    if check_func dlopen; then
        ldl=
    elif check_func dlopen -ldl; then
        ldl=-ldl
    
    # Solaris has nanosleep in -lrt, OpenSolaris no longer needs that
    check_func nanosleep || { check_func nanosleep -lrt && add_extralibs -lrt; }
    
    
    check_func  getaddrinfo $network_extralibs
    
    check_struct "sys/time.h sys/resource.h" "struct rusage" ru_maxrss
    
    check_func  inet_aton $network_extralibs
    
    check_func  isatty
    
    check_func  ${malloc_prefix}memalign            && enable memalign
    
    check_func  ${malloc_prefix}posix_memalign      && enable posix_memalign
    
    Måns Rullgård's avatar
    Måns Rullgård committed
    check_func  setrlimit
    
    check_func  strerror_r
    
    check_func_headers io.h setmode
    
    check_func_headers lzo/lzo1x.h lzo1x_999_compress
    
    check_lib2 "windows.h psapi.h" GetProcessMemoryInfo -lpsapi
    
    check_func_headers windows.h GetProcessTimes
    
    check_func_headers windows.h VirtualAlloc
    
    check_header dlfcn.h
    
    Laurent Aimar's avatar
    Laurent Aimar committed
    check_header dxva2api.h
    
    check_header malloc.h
    
    check_header sys/resource.h
    
    check_header termios.h
    
    check_header vdpau/vdpau.h
    check_header vdpau/vdpau_x11.h
    
    check_header X11/extensions/XvMClib.h
    
    check_struct dxva2api.h DXVA_PictureParameters wDecodedPictureIndex
    
    
    if ! enabled_any memalign memalign_hack posix_memalign malloc_aligned &&
         enabled_any $need_memalign ; then
    
        die "Error, no aligned memory allocator but SSE enabled, disable it or use --enable-memalign-hack."
    
    disabled  zlib || check_lib   zlib.h      zlibVersion -lz   || disable  zlib
    
    disabled bzlib || check_lib2 bzlib.h BZ2_bzlibVersion -lbz2 || disable bzlib
    
    
    # check for some common methods of building with pthread support
    # do this before the optional library checks as some of them require pthreads
    if enabled pthreads; then
    
    Måns Rullgård's avatar
    Måns Rullgård committed
        if check_func pthread_create; then
            :
        elif check_func pthread_create -pthread; then
            add_cflags -pthread
    
    Måns Rullgård's avatar
    Måns Rullgård committed
        elif check_func pthread_create -pthreads; then
            add_cflags -pthreads
    
        elif check_func pthread_create -lpthreadGC2; then
            add_extralibs -lpthreadGC2
    
    Måns Rullgård's avatar
    Måns Rullgård committed
        elif ! check_lib pthread.h pthread_create -lpthread; then
            die "ERROR: can't find pthreads library"
        fi
    
            test -n "$thread_type" &&
                die "ERROR: Only one thread type must be selected." ||
    
    Måns Rullgård's avatar
    Måns Rullgård committed
    check_lib math.h sin -lm
    
    Gwenole Beauchesne's avatar
    Gwenole Beauchesne committed
    check_lib va/va.h vaInitialize -lva
    
    Måns Rullgård's avatar
    Måns Rullgård committed
    
    
    check_mathfunc exp2
    check_mathfunc exp2f
    check_mathfunc llrint
    check_mathfunc log2
    check_mathfunc log2f
    check_mathfunc lrint
    check_mathfunc lrintf
    check_mathfunc round
    check_mathfunc roundf
    check_mathfunc truncf
    
    # these are off by default, so fail if requested and not available
    
    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)
    
    enabled libfaac    && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
    enabled libfaad    && require2 libfaad faad.h faacDecOpen -lfaad
    
    enabled libgsm     && require  libgsm gsm/gsm.h gsm_create -lgsm
    
    enabled libmp3lame && require  libmp3lame lame/lame.h lame_init -lmp3lame -lm
    
    enabled libnut     && require  libnut libnut.h nut_demuxer_init -lnut
    
    enabled libopencore_amrnb  && require libopencore_amrnb opencore-amrnb/interf_dec.h Decoder_Interface_init -lopencore-amrnb -lm
    enabled libopencore_amrwb  && require libopencore_amrwb opencore-amrwb/dec_if.h D_IF_init -lopencore-amrwb -lm
    
    enabled libopenjpeg && require libopenjpeg openjpeg.h opj_version -lopenjpeg
    
    enabled librtmp    && require  librtmp librtmp/rtmp.h RTMP_Init -lrtmp
    
    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/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 >= 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
    
    # libdc1394 check
    if enabled libdc1394; then
        { check_lib dc1394/dc1394.h dc1394_new -ldc1394 -lraw1394 &&
            enable libdc1394_2; } ||
        { check_lib libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394 &&
            enable libdc1394_1; } ||
        die "ERROR: No version of libdc1394 found "
    fi
    
    
    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)
    
        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
    
    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
        elif check_header winsock2.h ; then
    
            check_func_headers winsock2.h closesocket -lws2 && \
                network_extralibs="-lws2" || \
            { 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
    
    check_header linux/videodev.h
    check_header linux/videodev2.h
    
    check_header sys/videoio.h
    
    check_func_headers "windows.h vfw.h" capCreateCaptureWindow "$vfwcap_indev_extralibs"
    
    Ramiro Polla's avatar
    Ramiro Polla committed
    
    
    # check for ioctl_meteor.h, ioctl_bt848.h and alternatives
    
    Ramiro Polla's avatar
    Ramiro Polla committed
    { check_header dev/bktr/ioctl_meteor.h &&
      check_header dev/bktr/ioctl_bt848.h; } ||
    { check_header machine/ioctl_meteor.h &&
      check_header machine/ioctl_bt848.h; } ||
    { check_header dev/video/meteor/ioctl_meteor.h &&
      check_header dev/video/bktr/ioctl_bt848.h; } ||
    check_header dev/ic/bt8xx.h
    
    check_header sys/soundcard.h
    check_header soundcard.h
    
    enabled_any alsa_indev alsa_outdev && check_lib2 alsa/asoundlib.h snd_pcm_htimestamp -lasound
    
    enabled jack_indev && check_lib2 jack/jack.h jack_client_open -ljack
    
    check_header X11/Xlib.h                 &&
    check_header X11/extensions/XShm.h      &&
    
    check_header X11/extensions/Xfixes.h    &&
    
    check_func XOpenDisplay -lX11           &&
    
    Roxis's avatar
    Roxis committed
    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; }
    
    enabled debug && add_cflags -g"$debuglevel" && add_asflags -g"$debuglevel"
    
    
    # add some useful compiler flags if supported
    check_cflags -Wdeclaration-after-statement
    
    check_cflags -Wall
    check_cflags -Wno-switch
    
    Michael Niedermayer's avatar
    Michael Niedermayer committed
    check_cflags -Wdisabled-optimization
    check_cflags -Wpointer-arith
    check_cflags -Wredundant-decls
    
    check_cflags -Wno-pointer-sign
    
    check_cflags -Wcast-qual
    
    check_cflags -Wwrite-strings
    
    check_cflags -Wmissing-prototypes
    
    enabled extra_warnings && check_cflags -Winline
    
    check_ldflags -Wl,--warn-common
    
    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'
    
    
        optimizations="small"
    elif enabled optimizations; then
    
    check_cflags -fno-math-errno
    
    Måns Rullgård's avatar
    Måns Rullgård committed
        # Just warnings, no remarks
        check_cflags -w1
        # -wd: Disable following warnings
        # 144, 167, 556: -Wno-pointer-sign
        # 10006: ignoring unknown option -fno-signed-zeros
        # 10156: ignoring option '-W'; no argument required
    
        check_cflags -wd144,167,556,10006,10156
    
    Måns Rullgård's avatar
    Måns Rullgård committed
        # 11030: Warning unknown option --as-needed
        # 10156: ignoring option '-export'; no argument required
        check_ldflags -wd10156,11030
        # Allow to compile with optimizations
        check_ldflags -march=$cpu
    
        # icc 11.0 and 11.1 work with ebp_available, but don't pass the test
        enable ebp_available
    
    elif enabled ccc; then
        # disable some annoying warnings
        add_cflags -msg_disable cvtu32to64
        add_cflags -msg_disable embedcomment
        add_cflags -msg_disable needconstext
        add_cflags -msg_disable nomainieee
        add_cflags -msg_disable ptrmismatch1
        add_cflags -msg_disable unreachcode
    
    elif enabled gcc; then
        check_cflags -fno-tree-vectorize
    
        check_cflags -Werror=implicit
    
        check_cflags -Werror=missing-prototypes
    
    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
    
        add_cflags -Wrvct,--diag_suppress=1207
    
    elif enabled tms470; then
        add_cflags -pds=824 -pds=837
    
        add_cflags  -p
        add_ldflags -p
    
    Diego Biurrun's avatar
    Diego Biurrun committed
    # Find out if the .align argument is a power of two or not.
    
    check_asm asmalign_pot '".align 3"'
    
    enabled_any $THREADS_LIST      && enable threads
    
    check_deps $CONFIG_LIST       \
    
               $PARSER_LIST       \
               $BSF_LIST          \
               $DEMUXER_LIST      \
               $MUXER_LIST        \
    
    enabled asm || disable $ARCH_LIST $ARCH_EXT_LIST
    
    
    echo "install prefix            $prefix"
    
    Diego Biurrun's avatar
    Diego Biurrun committed
    echo "source path               $source_path"
    echo "C compiler                $cc"
    
    Diego Biurrun's avatar
    Diego Biurrun committed
    echo ".align is power-of-two    $asmalign_pot"
    
    Diego Biurrun's avatar
    Diego Biurrun committed
    echo "ARCH                      $arch ($cpu)"
    
    if test "$build_suffix" != ""; then
        echo "build suffix              $build_suffix"
    
    if test "$extra_version" != ""; then
        echo "version string suffix     $extra_version"
    fi
    
    echo "big-endian                ${bigendian-no}"
    
    echo "runtime cpu detection     ${runtime_cpudetect-no}"
    
        echo "yasm                      ${yasm-no}"
    
        echo "MMX enabled               ${mmx-no}"
    
        echo "MMX2 enabled              ${mmx2-no}"
    
        echo "3DNow! extended enabled   ${amd3dnowext-no}"
    
        echo "SSE enabled               ${sse-no}"
    
        echo "SSSE3 enabled             ${ssse3-no}"
    
        echo "CMOV enabled              ${cmov-no}"
        echo "CMOV is fast              ${fast_cmov-no}"
    
        echo "EBX available             ${ebx_available-no}"
        echo "EBP available             ${ebp_available-no}"
    
        echo "10 operands supported     ${ten_operands-no}"
    
        echo "ARMv5TE enabled           ${armv5te-no}"
        echo "ARMv6 enabled             ${armv6-no}"
    
        echo "ARMv6T2 enabled           ${armv6t2-no}"
    
        echo "ARM VFP enabled           ${armvfp-no}"
    
        echo "IWMMXT enabled            ${iwmmxt-no}"
    
        echo "NEON enabled              ${neon-no}"
    
        echo "MMI enabled               ${mmi-no}"
    
        echo "AltiVec enabled           ${altivec-no}"
    
        echo "PPC 4xx optimizations     ${ppc4xx-no}"
    
        echo "dcbzl available           ${dcbzl-no}"
    
        echo "performance report        ${powerpc_perf-no}"
    fi
    if enabled sparc; then
        echo "VIS enabled               ${vis-no}"
    
    echo "gprof enabled             ${gprof-no}"
    echo "debug symbols             ${debug-no}"
    
    echo "strip symbols             ${stripping-no}"
    
    echo "optimizations             ${optimizations-no}"
    
    echo "static                    ${static-no}"
    echo "shared                    ${shared-no}"
    
    echo "postprocessing support    ${postproc-no}"
    
    echo "filters using lavformat   ${avfilter_lavf-no}"
    
    echo "network support           ${network-no}"
    echo "threading support         ${thread_type-no}"
    echo "SDL support               ${sdl-no}"
    echo "Sun medialib support      ${mlib-no}"
    echo "AVISynth enabled          ${avisynth-no}"
    
    Ramiro Polla's avatar
    Ramiro Polla committed
    echo "libdc1394 support         ${libdc1394-no}"
    
    echo "libdirac enabled          ${libdirac-no}"
    
    echo "libfaac enabled           ${libfaac-no}"
    echo "libfaad enabled           ${libfaad-no}"
    
    echo "libfaad dlopened          ${libfaadbin-no}"
    
    echo "libgsm enabled            ${libgsm-no}"
    echo "libmp3lame enabled        ${libmp3lame-no}"
    echo "libnut enabled            ${libnut-no}"
    
    echo "libopencore-amrnb support ${libopencore_amrnb-no}"
    echo "libopencore-amrwb support ${libopencore_amrwb-no}"
    
    echo "libopenjpeg enabled       ${libopenjpeg-no}"
    
    echo "librtmp enabled           ${librtmp-no}"
    
    echo "libschroedinger enabled   ${libschroedinger-no}"
    
    echo "libspeex enabled          ${libspeex-no}"
    
    echo "libtheora enabled         ${libtheora-no}"
    echo "libvorbis enabled         ${libvorbis-no}"
    
    echo "libx264 enabled           ${libx264-no}"
    echo "libxvid enabled           ${libxvid-no}"
    
    echo "zlib enabled              ${zlib-no}"
    
    echo "bzlib enabled             ${bzlib-no}"
    
    Fabrice Bellard's avatar
    Fabrice Bellard committed
    
    
    for type in decoder encoder hwaccel parser demuxer muxer protocol filter bsf indev outdev; do
    
        echo "Enabled ${type}s:"
    
        eval list=\$$(toupper $type)_LIST
    
        for part in $list; do
    
            enabled $part && echo ${part%_*}
        done | sort | pr -3 -t
        echo
    
    license="LGPL version 2.1 or later"
    
    if enabled nonfree; then
    
        license="nonfree and unredistributable"
    
    elif enabled gplv3; then
        license="GPL version 3 or later"
    elif enabled lgplv3; then
        license="LGPL version 3 or later"
    
    elif enabled gpl; then
    
        license="GPL version 2 or later"
    
    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
    
            libavcodec/${arch}/Makefile
    
            libavdevice/Makefile
            libavfilter/Makefile
            libavformat/Makefile
            libavutil/Makefile
            libpostproc/Makefile
            libswscale/Makefile
        "
    
        map 'mkdir -p $v' $DIRS;
    
        map 'test -f "$source_path/$v" && $ln_s "$source_path/$v" $v' $FILES
    
    enabled stripping || strip="echo skipping strip"
    
    
    cat > config.mak <<EOF
    # Automatically generated by configure - do not modify!
    ifndef FFMPEG_CONFIG_MAK
    FFMPEG_CONFIG_MAK=1
    FFMPEG_CONFIGURATION=$FFMPEG_CONFIGURATION
    prefix=$prefix
    LIBDIR=\$(DESTDIR)$libdir
    SHLIBDIR=\$(DESTDIR)$shlibdir
    INCDIR=\$(DESTDIR)$incdir
    BINDIR=\$(DESTDIR)$bindir
    DATADIR=\$(DESTDIR)$datadir
    MANDIR=\$(DESTDIR)$mandir
    SRC_PATH="$source_path"
    SRC_PATH_BARE=$source_path
    BUILD_ROOT="$PWD"
    ARCH=$arch
    CC=$cc
    AS=$as
    LD=$ld
    DEPCC=$dep_cc
    YASM=$yasmexe
    
    Måns Rullgård's avatar
    Måns Rullgård committed
    CP=cp -p
    
    LN_S=$ln_s
    STRIP=$strip
    CPPFLAGS=$CPPFLAGS
    CFLAGS=$CFLAGS
    ASFLAGS=$ASFLAGS
    CC_O=$CC_O
    LDFLAGS=$LDFLAGS
    FFSERVERLDFLAGS=$FFSERVERLDFLAGS
    SHFLAGS=$SHFLAGS
    YASMFLAGS=$YASMFLAGS
    BUILDSUF=$build_suffix
    FULLNAME=$FULLNAME
    LIBPREF=$LIBPREF
    LIBSUF=$LIBSUF
    LIBNAME=$LIBNAME
    SLIBPREF=$SLIBPREF
    SLIBSUF=$SLIBSUF
    EXESUF=$EXESUF
    EXTRA_VERSION=$extra_version
    DEPFLAGS=$DEPFLAGS
    CCDEP=$CCDEP
    ASDEP=$ASDEP
    CC_DEPFLAGS=$CC_DEPFLAGS
    AS_DEPFLAGS=$AS_DEPFLAGS
    HOSTCC=$host_cc
    HOSTCFLAGS=$host_cflags
    HOSTEXESUF=$HOSTEXESUF