Skip to content
Snippets Groups Projects
configure 147 KiB
Newer Older
  • Learn to ignore specific revisions
  • check_header sys/time.h
    
    check_header unistd.h
    
    check_header vdpau/vdpau.h
    check_header vdpau/vdpau_x11.h
    
    check_header VideoDecodeAcceleration/VDADecoder.h
    
    check_header windows.h
    
    check_header X11/extensions/XvMClib.h
    
    check_header asm/types.h
    
    disabled  zlib || check_lib   zlib.h      zlibVersion -lz   || disable  zlib
    
    disabled bzlib || check_lib2 bzlib.h BZ2_bzlibVersion -lbz2 || disable bzlib
    
    if ! disabled w32threads && ! enabled pthreads; then
    
        check_func_headers "windows.h process.h" _beginthreadex && enable w32threads
    
    # check for some common methods of building with pthread support
    # do this before the optional library checks as some of them require pthreads
    
    if ! disabled pthreads && ! enabled w32threads && ! enabled os2threads; 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
    
            test -n "$thread_type" &&
                die "ERROR: Only one thread type must be selected." ||
    
    if enabled pthreads; then
      check_func pthread_cancel
    fi
    
    
    enabled sync_val_compare_and_swap && enable atomics_gcc
    
    enabled machine_rw_barrier && enabled atomic_cas_ptr && enable atomics_suncc
    
    enabled MemoryBarrier && enable atomics_win32
    
    
    check_lib math.h sin -lm && LIBM="-lm"
    
    disabled crystalhd || check_lib libcrystalhd/libcrystalhd_if.h DtsCrystalHDVersion -lcrystalhd || disable crystalhd
    
    Måns Rullgård's avatar
    Måns Rullgård committed
    
    
    atan2f_args=2
    ldexpf_args=2
    powf_args=2
    
    for func in $MATH_FUNCS; do
    
        eval check_mathfunc $func \${${func}_args:-1}
    
    # these are off by default, so fail if requested and not available
    
    d s's avatar
    d s committed
    enabled avisynth   && { { check_lib2 "windows.h" LoadLibrary; } ||
                            { check_lib2 "dlfcn.h" dlopen -ldl; } ||
                            die "ERROR: LoadLibrary/dlopen not found for avisynth"; }
    
    enabled fontconfig && require_pkg_config fontconfig "fontconfig/fontconfig.h" FcInit
    
    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 libiec61883 && require libiec61883 libiec61883/iec61883.h iec61883_cmp_connect -lraw1394 -lavc1394 -lrom1394 -liec61883
    
    tipok's avatar
    tipok committed
    enabled libaacplus && require  "libaacplus >= 2.0.0" aacplus.h aacplusEncOpen -laacplus
    
    enabled libass     && require_pkg_config libass ass/ass.h ass_library_init
    
    Petri Hintukainen's avatar
    Petri Hintukainen committed
    enabled libbluray  && require libbluray libbluray/bluray.h bd_open -lbluray
    
    enabled libcelt    && require libcelt celt/celt.h celt_decode -lcelt0 &&
                          { check_lib celt/celt.h celt_decoder_create_custom -lcelt0 ||
    
                            die "ERROR: libcelt must be installed and version must be >= 0.11.0."; }
    
    Paul B Mahol's avatar
    Paul B Mahol committed
    enabled libcaca    && require_pkg_config caca caca.h caca_create_canvas
    
    enabled libfaac    && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
    
    enabled libfdk_aac && require  libfdk_aac fdk-aac/aacenc_lib.h aacEncOpen -lfdk-aac
    
    flite_libs="-lflite_cmu_time_awb -lflite_cmu_us_awb -lflite_cmu_us_kal -lflite_cmu_us_kal16 -lflite_cmu_us_rms -lflite_cmu_us_slt -lflite_usenglish -lflite_cmulex -lflite"
    
    enabled libflite   && require2 libflite "flite/flite.h" flite_init $flite_libs
    
    enabled libfreetype && require_pkg_config freetype2 "ft2build.h freetype/freetype.h" FT_Init_FreeType
    
    enabled libgsm     && { for gsm_hdr in "gsm.h" "gsm/gsm.h"; do
                                check_lib "${gsm_hdr}" gsm_create -lgsm && break;
                            done || die "ERROR: libgsm not found"; }
    
    enabled libilbc    && require  libilbc ilbc.h WebRtcIlbcfix_InitDecode -lilbc
    
    Clément Bœsch's avatar
    Clément Bœsch committed
    enabled libmodplug && require  libmodplug libmodplug/modplug.h ModPlug_Load -lmodplug
    
    enabled libmp3lame && require  "libmp3lame >= 3.98.3" lame/lame.h lame_set_VBR_quality -lmp3lame
    
    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
    enabled libopencore_amrwb  && require libopencore_amrwb opencore-amrwb/dec_if.h D_IF_init -lopencore-amrwb
    
    enabled libopencv  && require_pkg_config opencv opencv/cxcore.h cvCreateImageHeader
    
    enabled libopenjpeg && { check_lib openjpeg-1.5/openjpeg.h opj_version -lopenjpeg ||
                             check_lib openjpeg.h opj_version -lopenjpeg ||
                             die "ERROR: libopenjpeg not found"; }
    
    enabled libopus    && require_pkg_config opus opus_multistream.h opus_multistream_decoder_create
    
    enabled libpulse && require_pkg_config libpulse-simple pulse/simple.h pa_simple_new
    
    enabled libquvi    && require_pkg_config libquvi quvi/quvi.h quvi_init
    
    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 libshine   && require_pkg_config shine shine/layer3.h shine_encode_frame
    
    enabled libsoxr    && require  libsoxr soxr.h soxr_create -lsoxr
    
    enabled libspeex   && require  libspeex speex/speex.h speex_decoder_init -lspeex
    
    Mohamed Naufal's avatar
    Mohamed Naufal committed
    enabled libstagefright_h264  && require_cpp libstagefright_h264 "binder/ProcessState.h media/stagefright/MetaData.h
    
        media/stagefright/MediaBufferGroup.h media/stagefright/MediaDebug.h media/stagefright/MediaDefs.h
    
        media/stagefright/OMXClient.h media/stagefright/OMXCodec.h" android::OMXClient -lstagefright -lmedia -lutils -lbinder -lgnustl_static
    
    enabled libtheora  && require  libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
    
    enabled libtwolame && require  libtwolame twolame.h twolame_init -ltwolame &&
                          { check_lib twolame.h twolame_encode_buffer_float32_interleaved -ltwolame ||
    
                            die "ERROR: libtwolame must be installed and version must be >= 0.3.10"; }
    
    enabled libutvideo    && require_cpp utvideo "stdint.h stdlib.h utvideo/utvideo.h utvideo/Codec.h" 'CCodec*' -lutvideo -lstdc++
    
    enabled libv4l2    && require_pkg_config libv4l2 libv4l2.h v4l2_ioctl
    
    enabled libvidstab && require_pkg_config vidstab vid.stab/libvidstab.h vsMotionDetectInit
    
    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_vp8_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_vp8_encoder && { check_lib2 "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_enc_init_ver VP8E_SET_MAX_INTRA_BITRATE_PCT" -lvpx ||
                                    die "ERROR: libvpx encoder version must be >=0.9.7"; }
    
        enabled libvpx_vp9_decoder && { check_lib2 "vpx/vpx_decoder.h vpx/vp8dx.h" "vpx_codec_vp9_dx" -lvpx || disable libvpx_vp9_decoder;  }
        enabled libvpx_vp9_encoder && { check_lib2 "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_vp9_cx" -lvpx || disable libvpx_vp9_encoder; } }
    
    enabled libx264    && require  libx264 x264.h x264_encoder_encode -lx264 &&
    
                          { check_cpp_condition x264.h "X264_BUILD >= 118" ||
    
                            die "ERROR: libx264 must be installed and version must be >= 0.118."; }
    
    enabled libxavs    && require  libxavs xavs.h xavs_encoder_encode -lxavs
    
    enabled libxvid    && require  libxvid xvid.h xvid_global -lxvidcore
    
    Stefano Sabatini's avatar
    Stefano Sabatini committed
    enabled libzmq     && require_pkg_config libzmq zmq.h zmq_ctx_new
    
    enabled openal     && { { for al_libs in "${OPENAL_LIBS}" "-lopenal" "-lOpenAL32"; do
                            check_lib 'AL/al.h' alGetError "${al_libs}" && break; done } ||
                            die "ERROR: openal not found"; } &&
                          { check_cpp_condition "AL/al.h" "defined(AL_VERSION_1_1)" ||
    
                            die "ERROR: openal must be installed and version must be 1.1 or compatible"; }
    
    enabled opencl     && { check_lib2 OpenCL/cl.h clEnqueueNDRangeKernel -Wl,-framework,OpenCL ||
                            check_lib2 CL/cl.h clEnqueueNDRangeKernel -lOpenCL ||
                            die "ERROR: opencl not found"; } &&
                          { check_cpp_condition "OpenCL/cl.h" "defined(CL_VERSION_1_2)" ||
                            check_cpp_condition "CL/cl.h" "defined(CL_VERSION_1_2)" ||
                            die "ERROR: opencl must be installed and version must be 1.2 or compatible"; }
    
    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
    
    
    SDL_CONFIG="${cross_prefix}sdl-config"
    
    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 &&
    
        check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) < 0x010300" $sdl_cflags &&
        enable sdl
    
    else
      if "${SDL_CONFIG}" --version > /dev/null 2>&1; then
    
        sdl_cflags=$("${SDL_CONFIG}" --cflags)
        sdl_libs=$("${SDL_CONFIG}" --libs)
    
        check_func_headers SDL_version.h SDL_Linked_Version $sdl_cflags $sdl_libs &&
    
        check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201" $sdl_cflags &&
    
        check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) < 0x010300" $sdl_cflags &&
        enable sdl
    
    enabled sdl && add_cflags $sdl_cflags && add_extralibs $sdl_libs
    
    texi2html --help 2> /dev/null | grep -q 'init-file' && enable texi2html || disable texi2html
    
    makeinfo --version > /dev/null 2>&1 && enable makeinfo  || disable makeinfo
    
    perl --version > /dev/null 2>&1 && enable perl || disable perl
    
    pod2man --help > /dev/null 2>&1 && enable pod2man || disable pod2man
    
    rsync --help 2> /dev/null | grep -q 'contimeout' && enable rsync_contimeout || disable rsync_contimeout
    
    check_header linux/fb.h
    
    check_header linux/videodev.h
    check_header linux/videodev2.h
    
    check_code cc linux/videodev2.h "struct v4l2_frmsizeenum vfse; vfse.discrete.width = 0;" && enable_safe 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
    
    
    Ramiro Polla's avatar
    Ramiro Polla committed
    check_type "dshow.h" IBaseFilter
    
    
    # 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
    
    if check_struct sys/soundcard.h audio_buf_info bytes; then
        enable_safe sys/soundcard.h
    else
        check_cc -D__BSD_VISIBLE -D__XSI_VISIBLE <<EOF && add_cppflags -D__BSD_VISIBLE -D__XSI_VISIBLE && enable_safe sys/soundcard.h
        #include <sys/soundcard.h>
        audio_buf_info abc;
    EOF
    fi
    
    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 sem_timedwait &&
    
        check_func jack_port_get_latency_range -ljack
    
    enabled_any sndio_indev sndio_outdev && check_lib2 sndio.h sio_open -lsndio
    
    
    if enabled libcdio; then
        check_lib2 "cdio/cdda.h cdio/paranoia.h" cdio_cddap_open -lcdio_paranoia -lcdio_cdda -lcdio || check_lib2 "cdio/paranoia/cdda.h cdio/paranoia/paranoia.h" cdio_cddap_open -lcdio_paranoia -lcdio_cdda -lcdio
    fi
    
    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
    
    enabled vaapi &&
        check_lib va/va.h vaInitialize -lva ||
        disable vaapi
    
    enabled vdpau &&
    
        check_cpp_condition vdpau/vdpau.h "defined VDP_DECODER_PROFILE_MPEG4_PART2_ASP" ||
    
        disable vdpau
    
    # 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
    
    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 -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=libpostproc:libswresample: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 [ -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
    
    
    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
    
        check_cflags -wd144,167,188,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
    
        # 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 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=implicit-function-declaration
    
        check_cflags -Werror=missing-prototypes
    
        check_cflags -Werror=return-type
    
        check_cflags -Werror=vla
    
    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
    
        check_cflags -Werror=implicit-function-declaration
        check_cflags -Werror=missing-prototypes
    
        check_cflags -Werror=return-type
    
    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
    
    elif enabled msvc; then
        enabled x86_32 && disable aligned_stack
    
    elif enabled icl; then
        enabled x86_32 && disable aligned_stack
        check_cflags -W1 # Just warnings, no remark spam
        # basically -fstrict-aliasing for icl that doesn't work (correctly) on 13.x+
        check_cpp_condition "windows.h" "__ICL < 1300" && add_cflags -Qansi-alias
        # icl will pass the inline asm tests but inline asm is currently not supported (build will fail)
        disable inline_asm
    
    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_any $THREADS_LIST      && enable threads
    
    enabled_any $ATOMICS_LIST      && enable atomics_native
    
    enabled asm || { arch=c; disable $ARCH_LIST $ARCH_EXT_LIST; }
    
    
    if test $target_os = "haiku"; then
    
    ! enabled_any memalign posix_memalign aligned_malloc &&
    
        enabled_any $need_memalign && 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
    
    
    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 "$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}"
    
        echo "AVX enabled               ${avx-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}"
    
        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 "MIPS32R2 enabled          ${mips32r2-no}"
        echo "MIPS DSP R1 enabled       ${mipsdspr1-no}"
        echo "MIPS DSP R2 enabled       ${mipsdspr2-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 "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 "SDL support               ${sdl-no}"
    
    echo "opencl enabled            ${opencl-no}"
    
    echo "libshine enabled          ${libshine-no}"
    
    echo "texi2html enabled         ${texi2html-no}"
    
    echo "perl enabled              ${perl-no}"
    
    echo "pod2man enabled           ${pod2man-no}"
    echo "makeinfo enabled          ${makeinfo-no}"
    
    test -n "$random_seed" &&
        echo "random seed               ${random_seed}"
    
    Fabrice Bellard's avatar
    Fabrice Bellard committed
    
    
    echo "External libraries:"
    print_enabled '' $EXTERNAL_LIBRARY_LIST | print_3_columns
    echo
    
    
    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_3_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 || $ln_s "$source_path/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
    MANDIR=\$(DESTDIR)$mandir
    
    SRC_PATH=$source_path
    
    ifndef MAIN_MAKEFILE
    SRC_PATH:=\$(SRC_PATH:.%=..%)
    endif
    
    Mohamed Naufal's avatar
    Mohamed Naufal committed
    CXX=$cxx
    
    DEPCCFLAGS=$DEPCCFLAGS \$(CPPFLAGS)
    DEPAS=$as
    DEPASFLAGS=$DEPASFLAGS \$(CPPFLAGS)
    
    ARFLAGS=$arflags
    AR_O=$ar_o
    
    Mohamed Naufal's avatar
    Mohamed Naufal committed
    CXXFLAGS=$CXXFLAGS
    
    CXX_C=$CXX_C
    
    Mohamed Naufal's avatar
    Mohamed Naufal committed
    CXX_O=$CXX_O
    
    LD_LIB=$LD_LIB
    LD_PATH=$LD_PATH
    
    LDFLAGS-ffserver=$FFSERVERLDFLAGS
    
    SHFLAGS=$(echo $($ldflags_filter $SHFLAGS))
    
    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)}
    
    LIBS-ffplay=$sdl_libs
    CFLAGS-ffplay=$sdl_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}
    
    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")
    
        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
    
    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 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 HAVE_MMX2 HAVE_MMXEXT
    
    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 doc
    echo "@c auto-generated by configure" > 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$WARNINGS"
        enabled fatal_warnings && exit 1
    fi
    
    # 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
        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} -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} -l${shortname} $(enabled shared || echo $libs)
    
    lavfi_libs="libavutil${build_suffix} = $LIBAVUTIL_VERSION"
    enabled libavfilter_deps_avcodec    && prepend lavfi_libs "libavcodec${build_suffix} = $LIBAVCODEC_VERSION,"
    enabled libavfilter_deps_avformat   && prepend lavfi_libs "libavformat${build_suffix} = $LIBAVFORMAT_VERSION,"
    enabled libavfilter_deps_avresample && prepend lavfi_libs "libavresample${build_suffix} = $LIBAVRESAMPLE_VERSION,"
    enabled libavfilter_deps_swscale    && prepend lavfi_libs "libswscale${build_suffix} = $LIBSWSCALE_VERSION,"
    enabled libavfilter_deps_swresample && prepend lavfi_libs "libswresample${build_suffix} = $LIBSWRESAMPLE_VERSION,"
    enabled libavfilter_deps_postproc   && prepend lavfi_libs "libpostproc${build_suffix} = $LIBPOSTPROC_VERSION,"
    lavfi_libs=${lavfi_libs%, }
    
    lavd_libs="libavformat${build_suffix} = $LIBAVFORMAT_VERSION"
    enabled lavfi_indev && prepend lavd_libs "libavfilter${build_suffix} = $LIBAVFILTER_VERSION,"
    
    pkgconfig_generate libavutil "FFmpeg utility library" "$LIBAVUTIL_VERSION" "$LIBM"
    
    pkgconfig_generate libavcodec "FFmpeg codec library" "$LIBAVCODEC_VERSION" "$extralibs" "libavutil${build_suffix} = $LIBAVUTIL_VERSION"
    pkgconfig_generate libavformat "FFmpeg container format library" "$LIBAVFORMAT_VERSION" "$extralibs" "libavcodec${build_suffix} = $LIBAVCODEC_VERSION"
    
    pkgconfig_generate libavdevice "FFmpeg device handling library" "$LIBAVDEVICE_VERSION" "$extralibs" "$lavd_libs"
    
    pkgconfig_generate libavfilter "FFmpeg audio/video filtering library" "$LIBAVFILTER_VERSION" "$extralibs" "$lavfi_libs"
    
    pkgconfig_generate libpostproc "FFmpeg postprocessing library" "$LIBPOSTPROC_VERSION" "" "libavutil${build_suffix} = $LIBAVUTIL_VERSION"
    pkgconfig_generate libavresample "Libav audio resampling library" "$LIBAVRESAMPLE_VERSION" "$extralibs" "libavutil${build_suffix} = $LIBAVUTIL_VERSION"
    pkgconfig_generate libswscale "FFmpeg image rescaling library" "$LIBSWSCALE_VERSION" "$LIBM" "libavutil${build_suffix} = $LIBAVUTIL_VERSION"
    pkgconfig_generate libswresample "FFmpeg audio resampling library" "$LIBSWRESAMPLE_VERSION" "$LIBM" "libavutil${build_suffix} = $LIBAVUTIL_VERSION"
    
    
    fix_ffmpeg_remote(){
        git_remote_from=$1
        git_remote_to=$2
    
        fixme_remote=$(git --git-dir=$source_path/.git --work-tree=$source_path remote -v | grep $git_remote_from | cut -f 1 | sort | uniq)
    
        if [ "$fixme_remote" != "" ]; then
            echolog "
    Outdated domain in git config, the official domain for ffmpeg git is since
    November 2011, source.ffmpeg.org, both the old and the new point to the same
    repository and server. To update it enter the following commands:
    "
            for remote in $fixme_remote; do
                echolog "git remote set-url $remote $git_remote_to"
            done
        fi
    }
    
    if test -f "$source_path/.git/config"; then
        remote_from=git.videolan.org
        remote_to=source.ffmpeg.org
        fix_ffmpeg_remote git@$remote_from:ffmpeg   git@$remote_to:ffmpeg
        fix_ffmpeg_remote git://$remote_from/ffmpeg git://$remote_to/ffmpeg
    fi