Skip to content
Snippets Groups Projects
configure 220 KiB
Newer Older
  • Learn to ignore specific revisions
  • enabled vdpau &&
    
        check_cpp_condition vdpau/vdpau.h "defined VDP_DECODER_PROFILE_MPEG4_PART2_ASP" ||
    
        disable vdpau
    
    enabled vdpau && enabled xlib &&
    
        check_lib2 "vdpau/vdpau.h vdpau/vdpau_x11.h" vdp_device_create_x11 -lvdpau &&
    
    if enabled x86; then
        case $target_os in
            mingw32*|mingw64*|win32|win64|linux|cygwin*)
                ;;
            *)
                disable nvenc
                ;;
        esac
    else
        disable nvenc
    
    enabled nvenc &&
        check_cc -I$source_path <<EOF || disable nvenc
    #include "compat/nvenc/nvEncodeAPI.h"
    NV_ENCODE_API_FUNCTION_LIST flist;
    void f(void) { struct { const GUID guid; } s[] = { { NV_ENC_PRESET_HQ_GUID } }; }
    int main(void) { return 0; }
    EOF
    
    
    # Funny iconv installations are not unusual, so check it after all flags have been set
    
    disabled iconv || check_func_headers iconv.h iconv || check_lib2 iconv.h iconv -liconv || disable iconv
    
    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
    
    Michael Niedermayer's avatar
    Michael Niedermayer committed
    check_cflags -Wdisabled-optimization
    check_cflags -Wpointer-arith
    check_cflags -Wredundant-decls
    
    check_cflags -Wwrite-strings
    
    check_cflags -Wmissing-prototypes
    
    check_cflags -Wstrict-prototypes
    
    check_cflags -Wempty-body
    
    enabled extra_warnings && check_cflags -Winline
    
    enabled extra_warnings && check_cflags -Wcast-qual
    
    check_disable_warning(){
        warning_flag=-W${1#-Wno-}
        test_cflags $warning_flag && add_cflags $1
    }
    
    check_disable_warning -Wno-parentheses
    check_disable_warning -Wno-switch
    check_disable_warning -Wno-format-zero-length
    check_disable_warning -Wno-pointer-sign
    
    check_disable_warning -Wno-unused-const-variable
    
    check_ldflags -Wl,--warn-common
    
    check_ldflags -Wl,-rpath-link=libpostproc:libswresample:libswscale:libavfilter:libavdevice:libavformat:libavcodec:libavutil:libavresample
    
    enabled rpath && add_ldexeflags -Wl,-rpath,$libdir
    
    enabled rpath && add_ldlibflags -Wl,-rpath,$libdir
    
    test_ldflags -Wl,-Bsymbolic && append SHFLAGS -Wl,-Bsymbolic
    
    # add some strip flags
    # -wN '..@*' is more selective than -x, but not available everywhere.
    
    check_stripflags -wN \'..@*\' || check_stripflags -x
    
    enabled neon_clobber_test &&
        check_ldflags -Wl,--wrap,avcodec_open2              \
                      -Wl,--wrap,avcodec_decode_audio4      \
                      -Wl,--wrap,avcodec_decode_video2      \
                      -Wl,--wrap,avcodec_decode_subtitle2   \
                      -Wl,--wrap,avcodec_encode_audio2      \
                      -Wl,--wrap,avcodec_encode_video2      \
    
                      -Wl,--wrap,avcodec_send_packet        \
                      -Wl,--wrap,avcodec_receive_frame      \
    
                      -Wl,--wrap,avcodec_send_frame         \
                      -Wl,--wrap,avcodec_receive_packet     \
    
                      -Wl,--wrap,avcodec_encode_subtitle    \
    
                      -Wl,--wrap,swr_convert                \
    
                      -Wl,--wrap,avresample_convert ||
    
    enabled xmm_clobber_test &&
    
        check_ldflags -Wl,--wrap,avcodec_open2              \
                      -Wl,--wrap,avcodec_decode_audio4      \
                      -Wl,--wrap,avcodec_decode_video2      \
                      -Wl,--wrap,avcodec_decode_subtitle2   \
                      -Wl,--wrap,avcodec_encode_audio2      \
    
                      -Wl,--wrap,avcodec_encode_video2      \
    
                      -Wl,--wrap,avcodec_encode_subtitle    \
    
                      -Wl,--wrap,avcodec_send_packet        \
                      -Wl,--wrap,avcodec_receive_frame      \
    
                      -Wl,--wrap,avcodec_send_frame         \
                      -Wl,--wrap,avcodec_receive_packet     \
    
                      -Wl,--wrap,swr_convert                \
    
                      -Wl,--wrap,avresample_convert         \
    
    check_ld "cc" <<EOF && enable proper_dce
    
    extern const int array[512];
    static inline int func(void) { return array[0]; }
    int main(void) { return 0; }
    EOF
    
    if enabled proper_dce; then
        echo "X { local: *; };" > $TMPV
        if test_ldflags -Wl,${version_script},$TMPV; then
            append SHFLAGS '-Wl,${version_script},\$(SUBDIR)lib\$(NAME).ver'
            check_cc <<EOF && enable symver_asm_label
    
    void ff_foo(void) __asm__ ("av_foo@VERSION");
    
    void ff_foo(void) { ${inline_asm+__asm__($quotes);} }
    
            check_cc <<EOF && enable symver_gnu_asm
    
    __asm__(".symver ff_foo,av_foo@VERSION");
    void ff_foo(void) {}
    EOF
    
    if [ -z "$optflags" ]; then
        if enabled small; then
            optflags=$cflags_size
        elif enabled optimizations; then
            optflags=$cflags_speed
        else
            optflags=$cflags_noopt
        fi
    
    
    check_optflags(){
        check_cflags "$@"
        enabled lto && check_ldflags "$@"
    }
    
    
    if enabled lto; then
        test "$cc_type" != "$ld_type" && die "LTO requires same compiler and linker"
        check_cflags  -flto
        check_ldflags -flto $cpuflags
    
        disable inline_asm_direct_symbol_refs
    
    
    check_optflags $optflags
    check_optflags -fno-math-errno
    check_optflags -fno-signed-zeros
    
    enabled ftrapv && check_cflags -ftrapv
    
    
    check_cc -mno-red-zone <<EOF && noredzone_flags="-mno-red-zone"
    int x;
    EOF
    
    
    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
    
        # 188: enumerated type mixed with another type
    
        # 1292: attribute "foo" ignored
    
        # 1419: external declaration in primary source file
    
    Måns Rullgård's avatar
    Måns Rullgård committed
        # 10006: ignoring unknown option -fno-signed-zeros
    
        # 10148: ignoring unknown option -Wno-parentheses
    
    Måns Rullgård's avatar
    Måns Rullgård committed
        # 10156: ignoring option '-W'; no argument required
    
        # 13200: No EMMS instruction before call to function
        # 13203: No EMMS instruction before return from function
        check_cflags -wd144,167,188,556,1292,1419,10006,10148,10156,13200,13203
    
    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
    
        # icc 11.0 and 11.1 work with ebp_available, but don't pass the test
        enable ebp_available
    
        # The test above does not test linking
        enabled lto && disable symver_asm_label
    
        if enabled x86_32; then
    
            icc_version=$($cc -dumpversion)
    
            test ${icc_version%%.*} -ge 11 &&
                check_cflags -falign-stack=maintain-16-byte ||
    
    elif enabled ccc; then
        # disable some annoying warnings
    
        add_cflags -msg_disable bitnotint
        add_cflags -msg_disable mixfuncvoid
        add_cflags -msg_disable nonstandcast
        add_cflags -msg_disable unsupieee
    
    elif enabled gcc; then
    
        check_optflags -fno-tree-vectorize
    
        check_cflags -Werror=format-security
    
        check_cflags -Werror=implicit-function-declaration
    
        check_cflags -Werror=missing-prototypes
    
        check_cflags -Werror=return-type
    
        check_cflags -Werror=vla
    
        check_cflags -fdiagnostics-color=auto
    
        enabled extra_warnings || check_disable_warning -Wno-maybe-uninitialized
    
    elif enabled llvm_gcc; then
        check_cflags -mllvm -stack-alignment=16
    
    elif enabled clang; then
    
        check_cflags -mllvm -stack-alignment=16
    
        check_cflags -mstack-alignment=16
    
        check_cflags -Qunused-arguments
    
        check_cflags -Werror=implicit-function-declaration
        check_cflags -Werror=missing-prototypes
    
        check_cflags -Werror=return-type
    
    Luca Barbato's avatar
    Luca Barbato committed
    elif enabled cparser; then
        add_cflags -Wno-missing-variable-declarations
        add_cflags -Wno-empty-statement
    
    elif enabled armcc; then
    
        add_cflags -W${armcc_opt},--diag_suppress=4343 # hardfp compat
        add_cflags -W${armcc_opt},--diag_suppress=3036 # using . as system include dir
    
        # 2523: use of inline assembly is deprecated
    
        add_cflags -W${armcc_opt},--diag_suppress=2523
        add_cflags -W${armcc_opt},--diag_suppress=1207
    
        add_cflags -W${armcc_opt},--diag_suppress=1293 # assignment in condition
    
        add_cflags -W${armcc_opt},--diag_suppress=3343 # hardfp compat
    
        add_cflags -W${armcc_opt},--diag_suppress=167  # pointer sign
        add_cflags -W${armcc_opt},--diag_suppress=513  # pointer sign
    
    elif enabled tms470; then
        add_cflags -pds=824 -pds=837
    
    elif enabled pathscale; then
        add_cflags -fstrict-overflow -OPT:wrap_around_unsafe_opt=OFF
    
    elif enabled_any msvc icl; then
    
        enabled x86_32 && disable aligned_stack
    
        enabled_all x86_32 debug && add_cflags -Oy-
    
        enabled debug && add_ldflags -debug
    
        enable pragma_deprecated
    
        if enabled icl; then
    
            # -Qansi-alias is basically -fstrict-aliasing, but does not work
            # (correctly) on icl 13.x.
            check_cpp_condition "windows.h" "__ICL < 1300 || __ICL >= 1400" &&
                add_cflags -Qansi-alias
    
            # Some inline asm is not compilable in debug
            if enabled debug; then
                disable ebp_available
                disable ebx_available
            fi
    
        # msvcrt10 x64 incorrectly enables log2, only msvcrt12 (MSVC 2013) onwards actually has log2.
    
        check_cpp_condition crtversion.h "_VC_CRT_MAJOR_VERSION >= 12" || disable log2
    
        # The CRT headers contain __declspec(restrict) in a few places, but if redefining
        # restrict, this might break. MSVC 2010 and 2012 fail with __declspec(__restrict)
        # (as it ends up if the restrict redefine is done before including stdlib.h), while
        # MSVC 2013 and newer can handle it fine.
        # If this declspec fails, force including stdlib.h before the restrict redefinition
        # happens in config.h.
        if [ $_restrict != restrict ]; then
            check_cc <<EOF || add_cflags -FIstdlib.h
    __declspec($_restrict) void* foo(int);
    EOF
        fi
    
        check_func strtoll || add_cflags -Dstrtoll=_strtoi64
    
        # the new SSA optimzer in VS2015 U3 is mis-optimizing some parts of the code
        # this flag should be re-checked on newer compiler releases and put under a
        # version check once its fixed
        check_cflags -d2SSAOptimizer-
    
        eval "type=\$$varname"
        if [ $type = "msvc" ]; then
            check_${pfx}cc <<EOF || add_${pfx}cflags -Dinline=__inline
    static inline int foo(int a) { return a; }
    EOF
        fi
    done
    
    
    case $as_type in
        clang)
            add_asflags -Qunused-arguments
        ;;
    esac
    
    case $ld_type in
        clang)
            check_ldflags -Qunused-arguments
        ;;
    esac
    
    
    Mans Rullgard's avatar
    Mans Rullgard committed
    case $target_os in
    
        osf1)
            enabled ccc && add_ldflags '-Wl,-expect_unresolved,*'
        ;;
    
    Mans Rullgard's avatar
    Mans Rullgard committed
        plan9)
            add_cppflags -Dmain=plan9_main
        ;;
    esac
    
    
    enabled asm || { arch=c; disable $ARCH_LIST $ARCH_EXT_LIST; }
    
    
    enabled threads && ! enabled pthreads && ! enabled atomics_native && die "non pthread threading without atomics not supported, try adding --enable-pthreads or --cpu=i486 or higher if you are on x86"
    
    
    if test $target_os = "haiku"; then
    
    enabled_all dxva2 dxva2api_cobj CoTaskMemFree &&
    
        prepend ffmpeg_libs $($ldflags_filter "-lole32" "-luser32") &&
    
    ! enabled_any memalign posix_memalign aligned_malloc &&
    
        enabled simd_align_16 && enable memalign_hack
    
    # add_dep lib dep
    # -> enable ${lib}_deps_${dep}
    # -> add $dep to ${lib}_deps only once
    add_dep() {
        lib=$1
        dep=$2
        enabled "${lib}_deps_${dep}" && return 0
        enable  "${lib}_deps_${dep}"
        prepend "${lib}_deps" $dep
    }
    
    # merge deps lib components
    # merge all ${component}_deps into ${lib}_deps and ${lib}_deps_*
    merge_deps() {
        lib=$1
        shift
        for comp in $*; do
            enabled $comp || continue
            eval "dep=\"\$${comp}_deps\""
            for d in $dep; do
                add_dep $lib $d
            done
        done
    }
    
    merge_deps libavfilter $FILTER_LIST
    
    
    map 'enabled $v && intrinsics=${v#intrinsics_}' $INTRINSICS_LIST
    
    
    for thread in $THREADS_LIST; do
        if enabled $thread; then
            test -n "$thread_type" &&
                die "ERROR: Only one thread type must be selected." ||
                thread_type="$thread"
        fi
    done
    
    
    enabled zlib && add_cppflags -DZLIB_CONST
    
    
    # conditional library dependencies, in linking order
    
    Paul B Mahol's avatar
    Paul B Mahol committed
    enabled afftfilt_filter     && prepend avfilter_deps "avcodec"
    
    enabled amovie_filter       && prepend avfilter_deps "avformat avcodec"
    enabled aresample_filter    && prepend avfilter_deps "swresample"
    enabled asyncts_filter      && prepend avfilter_deps "avresample"
    enabled atempo_filter       && prepend avfilter_deps "avcodec"
    
    enabled cover_rect_filter   && prepend avfilter_deps "avformat avcodec"
    
    enabled ebur128_filter && enabled swresample && prepend avfilter_deps "swresample"
    
    enabled elbg_filter         && prepend avfilter_deps "avcodec"
    
    enabled fftfilt_filter      && prepend avfilter_deps "avcodec"
    
    enabled find_rect_filter    && prepend avfilter_deps "avformat avcodec"
    
    enabled mcdeint_filter      && prepend avfilter_deps "avcodec"
    
    enabled movie_filter    && prepend avfilter_deps "avformat avcodec"
    
    enabled pan_filter          && prepend avfilter_deps "swresample"
    enabled pp_filter           && prepend avfilter_deps "postproc"
    enabled removelogo_filter   && prepend avfilter_deps "avformat avcodec swscale"
    
    enabled resample_filter && prepend avfilter_deps "avresample"
    
    enabled sab_filter          && prepend avfilter_deps "swscale"
    
    enabled scale_filter    && prepend avfilter_deps "swscale"
    
    enabled scale2ref_filter    && prepend avfilter_deps "swscale"
    
    enabled sofalizer_filter    && prepend avfilter_deps "avcodec"
    
    enabled showcqt_filter      && prepend avfilter_deps "avformat avcodec swscale"
    
    enabled showfreqs_filter    && prepend avfilter_deps "avcodec"
    
    enabled showspectrum_filter && prepend avfilter_deps "avcodec"
    enabled smartblur_filter    && prepend avfilter_deps "swscale"
    
    enabled spectrumsynth_filter && prepend avfilter_deps "avcodec"
    
    enabled subtitles_filter    && prepend avfilter_deps "avformat avcodec"
    
    enabled uspp_filter         && prepend avfilter_deps "avcodec"
    
    
    enabled lavfi_indev         && prepend avdevice_deps "avfilter"
    
    enabled opus_decoder    && prepend avcodec_deps "swresample"
    
    expand_deps(){
        lib_deps=${1}_deps
        eval "deps=\$$lib_deps"
        append $lib_deps $(map 'eval echo \$${v}_deps' $deps)
        unique $lib_deps
    }
    
    
    #we have to remove gpl from the deps here as some code assumes all lib deps are libs
    postproc_deps="$(filter_out 'gpl' $postproc_deps)"
    
    
    map 'expand_deps $v' $LIBRARY_LIST
    
    
    echo "install prefix            $prefix"
    
    Diego Biurrun's avatar
    Diego Biurrun committed
    echo "source path               $source_path"
    echo "C compiler                $cc"
    
    echo "C library                 $libc_type"
    
    if test "$host_cc" != "$cc"; then
        echo "host C compiler           $host_cc"
    
        echo "host C library            $host_libc_type"
    
    Diego Biurrun's avatar
    Diego Biurrun committed
    echo "ARCH                      $arch ($cpu)"
    
    if test "$build_suffix" != ""; then
        echo "build suffix              $build_suffix"
    
    if test "$progs_suffix" != ""; then
        echo "progs suffix              $progs_suffix"
    fi
    
    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 "${yasmexe}                      ${yasm-no}"
    
        echo "MMX enabled               ${mmx-no}"
    
        echo "MMXEXT enabled            ${mmxext-no}"
    
        echo "3DNow! extended enabled   ${amd3dnowext-no}"
    
        echo "SSE enabled               ${sse-no}"
    
        echo "SSSE3 enabled             ${ssse3-no}"
    
    Rodger Combs's avatar
    Rodger Combs committed
        echo "AESNI enabled             ${aesni-no}"
    
        echo "AVX enabled               ${avx-no}"
    
        echo "XOP enabled               ${xop-no}"
    
        echo "FMA3 enabled              ${fma3-no}"
    
        echo "i686 features enabled     ${i686-no}"
    
        echo "CMOV is fast              ${fast_cmov-no}"
    
        echo "EBX available             ${ebx_available-no}"
        echo "EBP available             ${ebp_available-no}"
    
    if enabled aarch64; then
        echo "NEON enabled              ${neon-no}"
        echo "VFP enabled               ${vfp-no}"
    fi
    
        echo "ARMv5TE enabled           ${armv5te-no}"
        echo "ARMv6 enabled             ${armv6-no}"
    
        echo "ARMv6T2 enabled           ${armv6t2-no}"
    
        echo "VFP enabled               ${vfp-no}"
    
        echo "NEON enabled              ${neon-no}"
    
        echo "THUMB enabled             ${thumb-no}"
    
        echo "MIPS FPU enabled          ${mipsfpu-no}"
    
        echo "MIPS DSP R1 enabled       ${mipsdsp-no}"
    
        echo "MIPS DSP R2 enabled       ${mipsdspr2-no}"
    
        echo "MIPS MSA enabled          ${msa-no}"
    
        echo "LOONGSON MMI enabled      ${mmi-no}"
    
        echo "AltiVec enabled           ${altivec-no}"
    
        echo "VSX enabled               ${vsx-no}"
        echo "POWER8 enabled            ${power8-no}"
    
        echo "PPC 4xx optimizations     ${ppc4xx-no}"
    
        echo "dcbzl available           ${dcbzl-no}"
    
    echo "debug symbols             ${debug-no}"
    
    echo "strip symbols             ${stripping-no}"
    
    echo "optimize for size         ${small-no}"
    
    echo "optimizations             ${optimizations-no}"
    
    echo "static                    ${static-no}"
    echo "shared                    ${shared-no}"
    
    echo "postprocessing support    ${postproc-no}"
    
    echo "network support           ${network-no}"
    echo "threading support         ${thread_type-no}"
    
    echo "safe bitstream reader     ${safe_bitstream_reader-no}"
    
    echo "SDL2 support              ${sdl2-no}"
    
    echo "opencl enabled            ${opencl-no}"
    
    Matthieu Bouron's avatar
    Matthieu Bouron committed
    echo "JNI support               ${jni-no}"
    
    echo "texi2html enabled         ${texi2html-no}"
    
    echo "perl enabled              ${perl-no}"
    
    echo "pod2man enabled           ${pod2man-no}"
    echo "makeinfo enabled          ${makeinfo-no}"
    
    echo "makeinfo supports HTML    ${makeinfo_html-no}"
    
    test -n "$random_seed" &&
        echo "random seed               ${random_seed}"
    
    Fabrice Bellard's avatar
    Fabrice Bellard committed
    
    
    echo "Enabled programs:"
    
    print_enabled '' $PROGRAM_LIST | print_in_columns
    
    echo "External libraries:"
    
    print_enabled '' $EXTERNAL_LIBRARY_LIST | print_in_columns
    
    echo "External libraries providing hardware acceleration:"
    
    print_enabled '' $HWACCEL_LIBRARY_LIST | print_in_columns
    
    print_enabled '' $LIBRARY_LIST | print_in_columns
    
    for type in decoder encoder hwaccel parser demuxer muxer protocol filter bsf indev outdev; do
    
        echo "Enabled ${type}s:"
    
        eval list=\$$(toupper $type)_LIST
    
        print_enabled '_*' $list | print_in_columns
    
    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, config.h, and doc/config.texi..."
    
    test -e Makefile || echo "include $source_path/Makefile" > Makefile
    
    enabled stripping || strip="echo skipping strip"
    
    
    config_files="$TMPH config.mak doc/config.texi"
    
    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
    
    DOCDIR=\$(DESTDIR)$docdir
    
    PKGCONFIGDIR=\$(DESTDIR)$pkgconfigdir
    
    INSTALL_NAME_DIR=$install_name_dir
    
    SRC_PATH=$source_path
    
    ifndef MAIN_MAKEFILE
    SRC_PATH:=\$(SRC_PATH:.%=..%)
    endif
    
    INTRINSICS=$intrinsics
    
    Mohamed Naufal's avatar
    Mohamed Naufal committed
    CXX=$cxx
    
    Luca Barbato's avatar
    Luca Barbato committed
    OBJCC=$objcc
    
    DEPCCFLAGS=$DEPCCFLAGS \$(CPPFLAGS)
    DEPAS=$as
    DEPASFLAGS=$DEPASFLAGS \$(CPPFLAGS)
    
    ARFLAGS=$arflags
    AR_O=$ar_o
    
    STRIP=$strip
    
    LN_S=$ln_s
    CPPFLAGS=$CPPFLAGS
    CFLAGS=$CFLAGS
    
    Mohamed Naufal's avatar
    Mohamed Naufal committed
    CXXFLAGS=$CXXFLAGS
    
    Luca Barbato's avatar
    Luca Barbato committed
    OBJCFLAGS=$OBJCFLAGS
    
    Luca Barbato's avatar
    Luca Barbato committed
    OBJCC_C=$OBJCC_C
    OBJCC_E=$OBJCC_E
    OBJCC_O=$OBJCC_O
    
    CXX_C=$CXX_C
    
    Mohamed Naufal's avatar
    Mohamed Naufal committed
    CXX_O=$CXX_O
    
    LD_LIB=$LD_LIB
    LD_PATH=$LD_PATH
    
    DOXYGEN=$doxygen
    
    LDEXEFLAGS=$LDEXEFLAGS
    
    LDLIBFLAGS=$LDLIBFLAGS
    
    SHFLAGS=$(echo $($ldflags_filter $SHFLAGS))
    
    ASMSTRIPFLAGS=$ASMSTRIPFLAGS
    
    YASMFLAGS=$YASMFLAGS
    BUILDSUF=$build_suffix
    
    PROGSSUF=$progs_suffix
    
    FULLNAME=$FULLNAME
    LIBPREF=$LIBPREF
    LIBSUF=$LIBSUF
    LIBNAME=$LIBNAME
    SLIBPREF=$SLIBPREF
    SLIBSUF=$SLIBSUF
    EXESUF=$EXESUF
    EXTRA_VERSION=$extra_version
    CCDEP=$CCDEP
    
    Mohamed Naufal's avatar
    Mohamed Naufal committed
    CXXDEP=$CXXDEP
    
    CC_DEPFLAGS=$CC_DEPFLAGS
    AS_DEPFLAGS=$AS_DEPFLAGS
    HOSTCC=$host_cc
    
    HOSTEXESUF=$HOSTEXESUF
    HOSTLDFLAGS=$host_ldflags
    HOSTLIBS=$host_libs
    
    DEPHOSTCC=$host_cc
    DEPHOSTCCFLAGS=$DEPHOSTCCFLAGS \$(HOSTCCFLAGS)
    HOSTCCDEP=$HOSTCCDEP
    HOSTCCDEP_FLAGS=$HOSTCCDEP_FLAGS
    HOSTCC_DEPFLAGS=$HOSTCC_DEPFLAGS
    
    HOSTLD_O=$HOSTLD_O
    
    TARGET_EXEC=$target_exec $target_exec_args
    
    TARGET_SAMPLES=${target_samples:-\$(SAMPLES)}
    
    Marton Balint's avatar
    Marton Balint committed
    CFLAGS-ffplay=${sdl2_cflags}
    
    ZLIB=$($ldflags_filter -lz)
    
    LIB_INSTALL_EXTRA_CMD=$LIB_INSTALL_EXTRA_CMD
    EXTRALIBS=$extralibs
    
    COMPAT_OBJS=$compat_objs
    
    LIBTARGET=${LIBTARGET}
    SLIBNAME=${SLIBNAME}
    SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}
    SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}
    SLIB_CREATE_DEF_CMD=${SLIB_CREATE_DEF_CMD}
    SLIB_EXTRA_CMD=${SLIB_EXTRA_CMD}
    
    SLIB_INSTALL_NAME=${SLIB_INSTALL_NAME}
    SLIB_INSTALL_LINKS=${SLIB_INSTALL_LINKS}
    SLIB_INSTALL_EXTRA_LIB=${SLIB_INSTALL_EXTRA_LIB}
    SLIB_INSTALL_EXTRA_SHLIB=${SLIB_INSTALL_EXTRA_SHLIB}
    
    VERSION_SCRIPT_POSTPROCESS_CMD=${VERSION_SCRIPT_POSTPROCESS_CMD}
    
    SAMPLES:=${samples:-\$(FATE_SAMPLES)}
    
    NOREDZONE_FLAGS=$noredzone_flags
    
        name=$(toupper $lcname)
        file=$source_path/$lcname/version.h
    
        eval $(awk "/#define ${name}_VERSION_M/ { print \$2 \"=\" \$3 }" "$file")
    
        enabled raise_major && eval ${name}_VERSION_MAJOR=$((${name}_VERSION_MAJOR+100))
    
        eval ${name}_VERSION=\$${name}_VERSION_MAJOR.\$${name}_VERSION_MINOR.\$${name}_VERSION_MICRO
    
        eval echo "${lcname}_VERSION=\$${name}_VERSION" >> config.mak
        eval echo "${lcname}_VERSION_MAJOR=\$${name}_VERSION_MAJOR" >> config.mak
    
        eval echo "${lcname}_VERSION_MINOR=\$${name}_VERSION_MINOR" >> config.mak
    
    map 'get_version $v' $LIBRARY_LIST
    
    map 'eval echo "${v}_FFLIBS=\$${v}_deps" >> config.mak' $LIBRARY_LIST
    
    print_program_libs(){
        eval "program_libs=\$${1}_libs"
        eval echo "LIBS-${1}=${program_libs}" >> config.mak
    }
    
    map 'print_program_libs $v' $PROGRAM_LIST
    
    
    cat > $TMPH <<EOF
    /* Automatically generated by configure - do not modify! */
    
    #ifndef FFMPEG_CONFIG_H
    #define FFMPEG_CONFIG_H
    #define FFMPEG_CONFIGURATION "$(c_escape $FFMPEG_CONFIGURATION)"
    
    #define FFMPEG_LICENSE "$(c_escape $license)"
    
    #define CONFIG_THIS_YEAR 2016
    
    #define FFMPEG_DATADIR "$(eval c_escape $datadir)"
    
    #define AVCONV_DATADIR "$(eval c_escape $datadir)"
    
    #define CC_IDENT "$(c_escape ${cc_ident:-Unknown compiler})"
    
    #define av_restrict $_restrict
    
    #define EXTERN_PREFIX "${extern_prefix}"
    #define EXTERN_ASM ${extern_prefix}
    
    #define BUILDSUF "$build_suffix"
    
    #define HAVE_MMX2 HAVE_MMXEXT
    
    #define SWS_MAX_FILTER_SIZE $sws_max_filter_size
    
    test -n "$assert_level" &&
        echo "#define ASSERT_LEVEL $assert_level" >>$TMPH
    
    
    test -n "$malloc_prefix" &&
        echo "#define MALLOC_PREFIX $malloc_prefix" >>$TMPH
    
    
    if enabled yasm; then
        append config_files $TMPASM
        printf '' >$TMPASM
    fi
    
    
    enabled getenv || echo "#define getenv(x) NULL" >> $TMPH
    
    
    mkdir -p tests/api
    
    echo "@c auto-generated by configure - do not modify! " > doc/config.texi
    
    print_config ARCH_   "$config_files" $ARCH_LIST
    print_config HAVE_   "$config_files" $HAVE_LIST
    print_config CONFIG_ "$config_files" $CONFIG_LIST       \
    
    Måns Rullgård's avatar
    Måns Rullgård committed
                                         $CONFIG_EXTRA      \
    
    echo "#endif /* FFMPEG_CONFIG_H */" >> $TMPH
    
    echo "endif # FFMPEG_CONFIG_MAK" >> config.mak
    
    Diego Biurrun's avatar
    Diego Biurrun committed
    # Do not overwrite an unchanged config.h to avoid superfluous rebuilds.
    
    cp_if_changed $TMPH config.h
    
    enabled yasm && cp_if_changed $TMPASM config.asm
    
    
    cat > $TMPH <<EOF
    /* Generated by ffconf */
    #ifndef AVUTIL_AVCONFIG_H
    #define AVUTIL_AVCONFIG_H
    EOF
    
    
    print_config AV_HAVE_ $TMPH $HAVE_LIST_PUB
    
    
    echo "#endif /* AVUTIL_AVCONFIG_H */" >> $TMPH
    
    cp_if_changed $TMPH libavutil/avconfig.h
    
    
    if test -n "$WARNINGS"; then
    
        printf "\n%s%s$WARNINGS%s" "$warn_color" "$bold_color" "$reset_color"
    
        enabled fatal_warnings && exit 1
    fi
    
    # generate the lists of enabled components
    print_enabled_components(){
        file=$1
        struct_name=$2
        name=$3
        shift 3
        echo "static const $struct_name *$name[] = {" > $TMPH
        for c in $*; do
            enabled $c && printf "    &ff_%s,\n" $c >> $TMPH
        done
        echo "    NULL };" >> $TMPH
        cp_if_changed $TMPH $file
    }
    
    print_enabled_components libavcodec/bsf_list.c AVBitStreamFilter bitstream_filters $BSF_LIST
    print_enabled_components libavformat/protocol_list.c URLProtocol url_protocols $PROTOCOL_LIST
    
    
    # build pkg-config files
    
        eval printf "\"lib${1}${build_suffix} >= \$LIB$(toupper ${1})_VERSION, \""
    
    pkgconfig_generate(){
    
        name=$1
        shortname=${name#lib}${build_suffix}
        comment=$2
        version=$3
        libs=$4
    
        requires=$(map 'lib_version $v' $(eval echo \$${name#lib}_deps))
        requires=${requires%, }
    
        enabled ${name#lib} || return 0
        mkdir -p $name
    
        cat <<EOF > $name/$name${build_suffix}.pc
    
    exec_prefix=\${prefix}
    
    Name: $name
    Description: $comment
    Version: $version
    
    Requires: $(enabled shared || echo $requires)
    
    Requires.private: $(enabled shared && echo $requires)
    
    Libs: -L\${libdir} $(enabled rpath && echo "-Wl,-rpath,\${libdir}") -l${shortname} $(enabled shared || echo $libs)
    
    Libs.private: $(enabled shared && echo $libs)
    
    Cflags: -I\${includedir}
    
    
    mkdir -p doc/examples/pc-uninstalled
    includedir=${source_path}
    [ "$includedir" = . ] && includedir="\${pcfiledir}/../../.."
    
        cat <<EOF > doc/examples/pc-uninstalled/$name.pc
    
    libdir=\${pcfiledir}/../../../$name
    includedir=${includedir}
    
    Name: $name
    Description: $comment
    Version: $version
    Requires: $requires
    
    Libs: -L\${libdir} -Wl,-rpath,\${libdir} -l${shortname} $(enabled shared || echo $libs)
    
    pkgconfig_generate libavutil     "FFmpeg utility library"               "$LIBAVUTIL_VERSION"     "$LIBRT $LIBM"
    
    pkgconfig_generate libavcodec    "FFmpeg codec library"                 "$LIBAVCODEC_VERSION"    "$extralibs"
    pkgconfig_generate libavformat   "FFmpeg container format library"      "$LIBAVFORMAT_VERSION"   "$extralibs"
    pkgconfig_generate libavdevice   "FFmpeg device handling library"       "$LIBAVDEVICE_VERSION"   "$extralibs"
    pkgconfig_generate libavfilter   "FFmpeg audio/video filtering library" "$LIBAVFILTER_VERSION"   "$extralibs"
    pkgconfig_generate libpostproc   "FFmpeg postprocessing library"        "$LIBPOSTPROC_VERSION"   ""
    
    pkgconfig_generate libavresample "Libav audio resampling library"       "$LIBAVRESAMPLE_VERSION" "$LIBM"
    
    pkgconfig_generate libswscale    "FFmpeg image rescaling library"       "$LIBSWSCALE_VERSION"    "$LIBM"
    
    pkgconfig_generate libswresample "FFmpeg audio resampling library"      "$LIBSWRESAMPLE_VERSION" "$LIBM $LIBSOXR"