Skip to content
Snippets Groups Projects
configure 104 KiB
Newer Older
  • Learn to ignore specific revisions
  • Måns Rullgård's avatar
    Måns Rullgård committed
        elif ! check_lib pthread.h pthread_create -lpthread; then
    
            test -n "$thread_type" &&
                die "ERROR: Only one thread type must be selected." ||
    
    check_lib math.h sin -lm && LIBM="-lm"
    
    enabled vaapi && require vaapi va/va.h vaInitialize -lva
    
    Måns Rullgård's avatar
    Måns Rullgård committed
    
    
    check_mathfunc exp2
    check_mathfunc exp2f
    
    check_mathfunc isinf
    check_mathfunc isnan
    
    check_mathfunc llrint
    
    check_mathfunc llrintf
    
    check_mathfunc log2
    check_mathfunc log2f
    check_mathfunc lrint
    check_mathfunc lrintf
    
    check_mathfunc rint
    
    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
    
    Stefano Sabatini's avatar
    Stefano Sabatini committed
    enabled frei0r     && { check_header frei0r.h || die "ERROR: frei0r.h header not found"; }
    
    enabled gnutls     && require_pkg_config gnutls gnutls/gnutls.h gnutls_global_init
    
    enabled libfaac    && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
    
    enabled libfdk_aac && require  libfdk_aac fdk-aac/aacenc_lib.h aacEncOpen -lfdk-aac
    
    enabled libfreetype && require_pkg_config freetype2 "ft2build.h freetype/freetype.h" FT_Init_FreeType
    
    enabled libgsm     && require  libgsm gsm/gsm.h gsm_create -lgsm
    
    enabled libilbc    && require  libilbc ilbc.h WebRtcIlbcfix_InitDecode -lilbc
    
    enabled libmp3lame && require  "libmp3lame >= 3.98.3" lame/lame.h lame_set_VBR_quality -lmp3lame
    
    enabled libopencore_amrnb  && require libopencore_amrnb opencore-amrnb/interf_dec.h Decoder_Interface_init -lopencore-amrnb
    enabled libopencore_amrwb  && require libopencore_amrwb opencore-amrwb/dec_if.h D_IF_init -lopencore-amrwb
    
    enabled libopencv  && require_pkg_config opencv opencv/cv.h cvCreateImageHeader
    
    enabled libopenjpeg && require libopenjpeg openjpeg.h opj_version -lopenjpeg
    
    enabled libpulse && require_pkg_config libpulse-simple pulse/simple.h pa_simple_new
    
    enabled librtmp    && require_pkg_config librtmp librtmp/rtmp.h RTMP_Socket
    enabled libschroedinger && require_pkg_config schroedinger-1.0 schroedinger/schro.h schro_init
    
    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 libvo_aacenc && require libvo_aacenc vo-aacenc/voAAC.h voGetAACEncAPI -lvo-aacenc
    
    enabled libvo_amrwbenc && require libvo_amrwbenc vo-amrwbenc/enc_if.h E_IF_init -lvo-amrwbenc
    
    enabled libvorbis  && require  libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg
    
    enabled libvpx     && {
        enabled libvpx_decoder && { check_lib2 "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_dec_init_ver -lvpx ||
                                    die "ERROR: libvpx decoder version must be >=0.9.1"; }
        enabled libvpx_encoder && { check_lib2 "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_enc_init_ver -lvpx ||
                                    die "ERROR: libvpx encoder version must be >=0.9.1"; } }
    
    enabled libx264    && require  libx264 x264.h x264_encoder_encode -lx264 &&
    
                          { check_cpp_condition x264.h "X264_BUILD >= 118" ||
                            die "ERROR: libx264 version must be >= 0.118."; }
    
    enabled libxavs    && require  libxavs xavs.h xavs_encoder_encode -lxavs
    
    enabled libxvid    && require  libxvid xvid.h xvid_global -lxvidcore
    
    enabled openssl    && { check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto ||
                            check_lib openssl/ssl.h SSL_library_init -lssl32 -leay32 ||
                            check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 ||
                            die "ERROR: openssl not found"; }
    
    Samuel Pitoiset's avatar
    Samuel Pitoiset committed
    if enabled gnutls; then
        { check_lib nettle/bignum.h nettle_mpz_get_str_256 -lnettle -lhogweed -lgmp && enable nettle; } ||
        { check_lib gcrypt.h gcry_mpi_new -lgcrypt && enable gcrypt; }
    fi
    
    
    # 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
    
    
    if check_pkg_config sdl SDL_events.h SDL_PollEvent; then
    
        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
    
    check_header linux/fb.h
    
    check_header linux/videodev2.h
    
    check_struct linux/videodev2.h "struct v4l2_frmivalenum" discrete
    
    
    check_header sys/videoio.h
    
    check_func_headers "windows.h vfw.h" capCreateCaptureWindow "$vfwcap_indev_extralibs"
    
    # check that WM_CAP_DRIVER_CONNECT is defined to the proper value
    # w32api 3.12 had it defined wrong
    check_cpp_condition vfw.h "WM_CAP_DRIVER_CONNECT > WM_USER" && enable vfwcap_defines
    
    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 sndio.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_func jack_port_get_latency_range -ljack
    
    enabled_any sndio_indev sndio_outdev && check_lib2 sndio.h sio_open -lsndio
    
    
    enabled libcdio &&
        check_lib2 "cdio/cdda.h cdio/paranoia.h" cdio_cddap_open "-lcdio_paranoia -lcdio_cdda -lcdio"
    
    
    enabled x11grab                                           &&
    require X11 X11/Xlib.h XOpenDisplay -lX11                 &&
    require Xext X11/extensions/XShm.h XShmCreateImage -lXext &&
    require Xfixes X11/extensions/Xfixes.h XFixesGetCursorImage -lXfixes
    
    # check for VDA header
    if ! disabled vda && check_header VideoDecodeAcceleration/VDADecoder.h; then
    
        enable vda && add_extralibs -framework CoreFoundation -framework VideoDecodeAcceleration -framework QuartzCore
    
    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-parentheses
    
    check_cflags -Wno-switch
    
    check_cflags -Wno-format-zero-length
    
    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
    
    check_cflags -Wstrict-prototypes
    
    enabled extra_warnings && check_cflags -Winline
    
    check_ldflags -Wl,--warn-common
    
    check_ldflags -Wl,-rpath-link=libswscale:libavfilter:libavdevice:libavformat:libavcodec:libavutil:libavresample
    
    test_ldflags -Wl,-Bsymbolic && append SHFLAGS -Wl,-Bsymbolic
    
    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_video       \
                      -Wl,--wrap,avcodec_encode_subtitle    \
    
    echo "X{};" > $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);} }
    
    EOF
        check_cc <<EOF && enable symver_gnu_asm
    __asm__(".symver ff_foo,av_foo@VERSION");
    void ff_foo(void) {}
    EOF
    fi
    
    if [ -n "$optflags" ]; then
        add_cflags $optflags
    elif enabled small; then
    
        add_cflags $cflags_size
    
        add_cflags $cflags_speed
    
        add_cflags $cflags_noopt
    
    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
    
        # 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
    
        check_cflags -wd144,167,556,1292,1419,10006,10148,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
    
        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 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-function-declaration
    
        check_cflags -Werror=missing-prototypes
    
        check_cflags -Werror=declaration-after-statement
    
    elif enabled llvm_gcc; then
        check_cflags -mllvm -stack-alignment=16
    
    elif enabled clang; then
    
        check_cflags -mllvm -stack-alignment=16
    
        check_cflags -Qunused-arguments
    
    elif enabled armcc; then
        # 2523: use of inline assembler 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
    
    enabled_any $THREADS_LIST      && enable threads
    
    check_deps $CONFIG_LIST       \
    
    enabled asm || { arch=c; disable $ARCH_LIST $ARCH_EXT_LIST; }
    
    ! enabled_any memalign posix_memalign aligned_malloc &&
    
        enabled_any $need_memalign && enable memalign_hack
    
    
    echo "install prefix            $prefix"
    
    Diego Biurrun's avatar
    Diego Biurrun committed
    echo "source path               $source_path"
    echo "C compiler                $cc"
    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 "${yasmexe}                      ${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 "AVX enabled               ${avx-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 "ARMv5TE enabled           ${armv5te-no}"
        echo "ARMv6 enabled             ${armv6-no}"
    
        echo "ARMv6T2 enabled           ${armv6t2-no}"
    
        echo "ARM VFP enabled           ${armvfp-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}"
    
    fi
    if enabled sparc; then
        echo "VIS enabled               ${vis-no}"
    
    echo "debug symbols             ${debug-no}"
    
    echo "optimize for size         ${small-no}"
    
    echo "optimizations             ${optimizations-no}"
    
    echo "static                    ${static-no}"
    echo "shared                    ${shared-no}"
    
    echo "network support           ${network-no}"
    echo "threading support         ${thread_type-no}"
    
    echo "safe bitstream reader     ${safe_bitstream_reader-no}"
    
    echo "SDL support               ${sdl-no}"
    
    echo "libdxva2 enabled          ${dxva2-no}"
    echo "libva enabled             ${vaapi-no}"
    echo "libvdpau enabled          ${vdpau-no}"
    
    echo "AVISynth enabled          ${avisynth-no}"
    
    Stefano Sabatini's avatar
    Stefano Sabatini committed
    echo "frei0r enabled            ${frei0r-no}"
    
    echo "gnutls enabled            ${gnutls-no}"
    
    echo "libcdio support           ${libcdio-no}"
    
    Ramiro Polla's avatar
    Ramiro Polla committed
    echo "libdc1394 support         ${libdc1394-no}"
    
    echo "libfaac enabled           ${libfaac-no}"
    
    echo "libfdk-aac enabled        ${libfdk_aac-no}"
    
    echo "libgsm enabled            ${libgsm-no}"
    
    echo "libilbc enabled           ${libilbc-no}"
    
    echo "libmp3lame enabled        ${libmp3lame-no}"
    
    echo "libopencore-amrnb support ${libopencore_amrnb-no}"
    echo "libopencore-amrwb support ${libopencore_amrwb-no}"
    
    echo "libopencv support         ${libopencv-no}"
    
    echo "libopenjpeg enabled       ${libopenjpeg-no}"
    
    echo "libpulse enabled          ${libpulse-no}"
    
    echo "librtmp enabled           ${librtmp-no}"
    
    echo "libschroedinger enabled   ${libschroedinger-no}"
    
    echo "libspeex enabled          ${libspeex-no}"
    
    echo "libtheora enabled         ${libtheora-no}"
    
    echo "libvo-aacenc support      ${libvo_aacenc-no}"
    
    echo "libvo-amrwbenc support    ${libvo_amrwbenc-no}"
    
    echo "libvorbis enabled         ${libvorbis-no}"
    
    James Zern's avatar
    James Zern committed
    echo "libvpx enabled            ${libvpx-no}"
    
    echo "libxavs enabled           ${libxavs-no}"
    
    echo "openssl enabled           ${openssl-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
    
        print_enabled '_*' $list | sort | pr -r -3 -t
    
    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..."
    
    
    test -e Makefile || $ln_s "$source_path/Makefile" .
    
    config_files="$TMPH config.mak"
    
    
    cat > config.mak <<EOF
    # Automatically generated by configure - do not modify!
    
    LIBAV_CONFIGURATION=$LIBAV_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
    
    DEPCCFLAGS=$DEPCCFLAGS \$(CPPFLAGS)
    DEPAS=$as
    DEPASFLAGS=$DEPASFLAGS \$(CPPFLAGS)
    
    AR=$ar
    RANLIB=$ranlib
    LN_S=$ln_s
    CPPFLAGS=$CPPFLAGS
    CFLAGS=$CFLAGS
    ASFLAGS=$ASFLAGS
    
    DLLTOOL=$dlltool
    
    AVSERVERLDFLAGS=$AVSERVERLDFLAGS
    
    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
    CCDEP=$CCDEP
    
    CC_DEPFLAGS=$CC_DEPFLAGS
    AS_DEPFLAGS=$AS_DEPFLAGS
    HOSTCC=$host_cc
    HOSTCFLAGS=$host_cflags
    HOSTEXESUF=$HOSTEXESUF
    HOSTLDFLAGS=$host_ldflags
    HOSTLIBS=$host_libs
    
    DEPHOSTCC=$host_cc
    DEPHOSTCCFLAGS=$DEPHOSTCCFLAGS \$(HOSTCCFLAGS)
    HOSTCCDEP=$HOSTCCDEP
    HOSTCCDEP_FLAGS=$HOSTCCDEP_FLAGS
    HOSTCC_DEPFLAGS=$HOSTCC_DEPFLAGS
    HOSTCC_O=$HOSTCC_O
    
    TARGET_EXEC=$target_exec
    TARGET_PATH=$target_path
    SDL_LIBS=$sdl_libs
    SDL_CFLAGS=$sdl_cflags
    LIB_INSTALL_EXTRA_CMD=$LIB_INSTALL_EXTRA_CMD
    EXTRALIBS=$extralibs
    
    INSTALL=install
    
    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}
    
    SAMPLES:=${samples:-\$(LIBAV_SAMPLES)}
    
        lcname=$1
        name=$(toupper $lcname)
        file=$source_path/$lcname/version.h
    
        eval $(grep "#define ${name}_VERSION_M" "$file" | awk '{ print $2"="$3 }')
        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
    
    get_version libavcodec
    get_version libavdevice
    get_version libavfilter
    get_version libavformat
    get_version libavresample
    get_version libavutil
    get_version libswscale
    
    cat > $TMPH <<EOF
    /* Automatically generated by configure - do not modify! */
    
    #ifndef LIBAV_CONFIG_H
    #define LIBAV_CONFIG_H
    #define LIBAV_CONFIGURATION "$(c_escape $LIBAV_CONFIGURATION)"
    
    #define LIBAV_LICENSE "$(c_escape $license)"
    
    #define AVCONV_DATADIR "$(eval c_escape $datadir)"
    
    #define CC_IDENT "$(c_escape ${cc_ident:-Unknown compiler})"
    
    #define restrict $_restrict
    #define EXTERN_PREFIX "${extern_prefix}"
    #define EXTERN_ASM ${extern_prefix}
    
    test -n "$malloc_prefix" &&
        echo "#define MALLOC_PREFIX $malloc_prefix" >>$TMPH
    
    
    if enabled yasm; then
        append config_files $TMPASM
        printf '' >$TMPASM
    fi
    
    
    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      \
    
    cat >>config.mak <<EOF
    LAVF_TESTS=$(print_enabled   -n _test $LAVF_TESTS)
    
    LAVFI_TESTS=$(print_enabled  -n _test $LAVFI_TESTS)
    
    SEEK_TESTS=$(print_enabled   -n _test $SEEK_TESTS)
    
    echo "#endif /* LIBAV_CONFIG_H */" >> $TMPH
    
    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
    
    
    test -n "$WARNINGS" && printf "\n$WARNINGS"
    
    
    # build pkg-config files
    
    pkgconfig_generate(){
    name=$1
    
    shortname=${name#lib}${build_suffix}
    
    comment=$2
    version=$3
    libs=$4
    requires=$5
    
    enabled ${name#lib} || return 0
    
    exec_prefix=\${prefix}
    
    Name: $name
    Description: $comment
    Version: $version
    
    Requires: $(enabled shared || echo $requires)
    
    Requires.private: $(enabled shared && echo $requires)
    
    Libs: -L\${libdir} -l${shortname} $(enabled shared || echo $libs)
    
    Libs.private: $(enabled shared && echo $libs)
    
    Cflags: -I\${includedir}
    
    cat <<EOF > $name/$name-uninstalled.pc
    
    libdir=\${pcfiledir}
    
    includedir=${source_path}
    
    Name: $name
    Description: $comment
    Version: $version
    Requires: $requires
    
    Libs: \${libdir}/${LIBPREF}${shortname}${LIBSUF} $libs
    
    pkgconfig_generate libavutil "Libav utility library" "$LIBAVUTIL_VERSION" "$LIBM"
    
    pkgconfig_generate libavcodec "Libav codec library" "$LIBAVCODEC_VERSION" "$extralibs" "libavutil = $LIBAVUTIL_VERSION"
    
    pkgconfig_generate libavformat "Libav container format library" "$LIBAVFORMAT_VERSION" "$extralibs" "libavcodec = $LIBAVCODEC_VERSION"
    pkgconfig_generate libavdevice "Libav device handling library" "$LIBAVDEVICE_VERSION" "$extralibs" "libavformat = $LIBAVFORMAT_VERSION"
    pkgconfig_generate libavfilter "Libav video filtering library" "$LIBAVFILTER_VERSION" "$extralibs"
    
    Justin Ruggles's avatar
    Justin Ruggles committed
    pkgconfig_generate libavresample "Libav audio resampling library" "$LIBAVRESAMPLE_VERSION" "$extralibs"
    
    pkgconfig_generate libswscale "Libav image rescaling library" "$LIBSWSCALE_VERSION" "$LIBM" "libavutil = $LIBAVUTIL_VERSION"