Skip to content
Snippets Groups Projects
configure 126 KiB
Newer Older
  • Learn to ignore specific revisions
  •     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
    
        name=$1
        file=$source_path/$2
    
    # This condition will be removed when we stop supporting old libpostproc versions
    if ! test "$name" = LIBPOSTPROC || test "$postproc_version" = current; then
    
        eval $(grep "#define ${name}_VERSION_M" "$file" | awk '{ print $2"="$3 }')
        eval ${name}_VERSION=\$${name}_VERSION_MAJOR.\$${name}_VERSION_MINOR.\$${name}_VERSION_MICRO
    
        lcname=$(tolower $name)
        eval echo "${lcname}_VERSION=\$${name}_VERSION" >> config.mak
        eval echo "${lcname}_VERSION_MAJOR=\$${name}_VERSION_MAJOR" >> config.mak
    
    get_version_old LIBPOSTPROC libpostproc/postprocess.h
    get_version_old LIBSWRESAMPLE libswresample/swresample.h
    
    
    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 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
    
    
    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_FATE_TESTS=$(print_enabled -n _test $LAVF_FATE_TESTS)
    
    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 /* 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
    
    
    test "$postproc_version" != current && cat >> $TMPH <<EOF
    #define LIBPOSTPROC_VERSION_MAJOR $LIBPOSTPROC_VERSION_MAJOR
    #define LIBPOSTPROC_VERSION_MINOR $LIBPOSTPROC_VERSION_MINOR
    #define LIBPOSTPROC_VERSION_MICRO $LIBPOSTPROC_VERSION_MICRO
    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}
    
    
    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)
    
    libavfilter_pc_deps=""
    enabled libavfilter_deps_avcodec    && prepend libavfilter_pc_deps "libavcodec = $LIBAVCODEC_VERSION,"
    enabled libavfilter_deps_avformat   && prepend libavfilter_pc_deps "libavformat = $LIBAVFORMAT_VERSION,"
    enabled libavfilter_deps_swscale    && prepend libavfilter_pc_deps "libswscale = $LIBSWSCALE_VERSION,"
    enabled libavfilter_deps_swresample && prepend libavfilter_pc_deps "libswresample = $LIBSWRESAMPLE_VERSION,"
    
    enabled libavfilter_deps_postproc   && prepend libavfilter_pc_deps "libpostproc = $LIBPOSTPROC_VERSION,"
    
    libavfilter_pc_deps=${libavfilter_pc_deps%, }
    
    
    libavdevice_pc_deps="libavformat = $LIBAVFORMAT_VERSION"
    enabled lavfi_indev && prepend libavdevice_pc_deps "libavfilter = $LIBAVFILTER_VERSION,"
    
    
    pkgconfig_generate libavutil "FFmpeg utility library" "$LIBAVUTIL_VERSION" "$LIBM"
    
    pkgconfig_generate libavcodec "FFmpeg codec library" "$LIBAVCODEC_VERSION" "$extralibs" "libavutil = $LIBAVUTIL_VERSION"
    
    pkgconfig_generate libavformat "FFmpeg container format library" "$LIBAVFORMAT_VERSION" "$extralibs" "libavcodec = $LIBAVCODEC_VERSION"
    
    pkgconfig_generate libavdevice "FFmpeg device handling library" "$LIBAVDEVICE_VERSION" "$extralibs" "$libavdevice_pc_deps"
    
    pkgconfig_generate libavfilter "FFmpeg video filtering library" "$LIBAVFILTER_VERSION" "$extralibs" "$libavfilter_pc_deps"
    
    pkgconfig_generate libpostproc "FFmpeg postprocessing library" "$LIBPOSTPROC_VERSION" "" "libavutil = $LIBAVUTIL_VERSION"
    
    Justin Ruggles's avatar
    Justin Ruggles committed
    pkgconfig_generate libavresample "Libav audio resampling library" "$LIBAVRESAMPLE_VERSION" "$extralibs"
    
    pkgconfig_generate libswscale "FFmpeg image rescaling library" "$LIBSWSCALE_VERSION" "$LIBM" "libavutil = $LIBAVUTIL_VERSION"
    
    pkgconfig_generate libswresample "FFmpeg audio rescaling library" "$LIBSWRESAMPLE_VERSION" "$LIBM" "libavutil = $LIBAVUTIL_VERSION"