Skip to content
Snippets Groups Projects
configure 160 KiB
Newer Older
  • Learn to ignore specific revisions
  • 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 CONFIG_THIS_YEAR 2013
    
    #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
    
    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} $(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)
    
    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