Skip to content
Snippets Groups Projects
configure 58.8 KiB
Newer Older
  • Learn to ignore specific revisions
  • if test "$iwmmxt" = "yes" ; then
      echo "TARGET_IWMMXT=yes" >> config.mak
      echo "#define HAVE_IWMMXT 1" >> $TMPH
    fi
    
    if test "$mmi" = "yes" ; then
      echo "TARGET_MMI=yes" >> config.mak
      echo "#define HAVE_MMI 1" >> $TMPH
    fi
    
    if test "$altivec" = "yes" ; then
      echo "TARGET_ALTIVEC=yes" >> config.mak
      echo "#define HAVE_ALTIVEC 1" >> $TMPH
    
    if test "$sdl" = "yes" ; then
    
      echo "SDL_LIBS=`"${SDL_CONFIG}" --libs`" >> config.mak
      echo "SDL_CFLAGS=`"${SDL_CONFIG}" --cflags`" >> config.mak
    
    if test "$texi2html" = "yes"; then
      echo "BUILD_DOC=yes" >> config.mak
    fi
    
    sws_version=`grep '#define LIBSWSCALE_VERSION ' "$source_path/libswscale/swscale.h" | sed 's/[^0-9\.]//g'`
    
    pp_version=`grep '#define LIBPOSTPROC_VERSION ' "$source_path/libpostproc/postprocess.h" | sed 's/[^0-9\.]//g'`
    
    lavc_version=`grep '#define LIBAVCODEC_VERSION ' "$source_path/libavcodec/avcodec.h" | sed 's/[^0-9\.]//g'`
    lavf_version=`grep '#define LIBAVFORMAT_VERSION ' "$source_path/libavformat/avformat.h" | sed 's/[^0-9\.]//g'`
    lavu_version=`grep '#define LIBAVUTIL_VERSION ' "$source_path/libavutil/avutil.h" | sed 's/[^0-9\.]//g'`
    
    
    
    
    Zdenek Kabelac's avatar
    Zdenek Kabelac committed
    if test "$lshared" = "yes" ; then
    
    Nick Kurshev's avatar
    Nick Kurshev committed
      echo "BUILD_SHARED=yes" >> config.mak
    
      echo "PIC=-fPIC -DPIC" >> config.mak
    
      echo "SPPMAJOR=${pp_version%%.*}" >> config.mak
      echo "SPPVERSION=$pp_version" >> config.mak
    
      echo "LAVCMAJOR=${lavc_version%%.*}" >> config.mak
    
      echo "LAVCVERSION=$lavc_version" >> config.mak
    
      echo "LAVFMAJOR=${lavf_version%%.*}" >> config.mak
    
      echo "LAVFVERSION=$lavf_version" >> config.mak
    
      echo "LAVUMAJOR=${lavu_version%%.*}" >> config.mak
    
      echo "LAVUVERSION=$lavu_version" >> config.mak
    
      echo "SWSMAJOR=${sws_version%%.*}" >> config.mak
      echo "SWSVERSION=$sws_version" >> config.mak
    
      echo "SLIBNAME=${SLIBNAME}" >> config.mak
    
      echo "SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}" >> config.mak
      echo "SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}" >> config.mak
    
      echo "SLIB_EXTRA_CMD=${SLIB_EXTRA_CMD}" >> config.mak
    
      echo "SLIB_INSTALL_EXTRA_CMD=${SLIB_INSTALL_EXTRA_CMD}" >> config.mak
    
    Nick Kurshev's avatar
    Nick Kurshev committed
    fi
    
    echo "LIB_INSTALL_EXTRA_CMD=${LIB_INSTALL_EXTRA_CMD}" >> config.mak
    
    echo "EXTRALIBS=$extralibs" >> config.mak
    
    enabled_any $ENCODER_LIST && enable encoders
    enabled_any $DECODER_LIST && enable decoders
    enabled_any $MUXER_LIST   && enable muxers
    enabled_any $DEMUXER_LIST && enable demuxers
    
    enabled_any pthreads beosthreads os2threads w32threads && enable threads
    
    
    check_deps $CONFIG_LIST $HAVE_LIST $DECODER_LIST $ENCODER_LIST $PARSER_LIST \
        $DEMUXER_LIST $MUXER_LIST
    
    
    print_config HAVE_   $TMPH config.mak $HAVE_LIST
    print_config CONFIG_ $TMPH config.mak $CONFIG_LIST
    
    if test "$targetos" = "Darwin"; then
    
    echo "#define restrict $_restrict" >> $TMPH
    
    
    if test "$optimize" = "small"; then
      echo "#define always_inline"  >> $TMPH
    
      echo "#define CONFIG_SMALL 1" >> $TMPH
    
    echo "SRC_PATH=\"$source_path\"" >> config.mak
    echo "SRC_PATH_BARE=$source_path" >> config.mak
    echo "BUILD_ROOT=\"$PWD\"" >> config.mak
    
    if test "$amr_if2" = "yes" ; then
      echo "AMR_CFLAGS=-DIF2=1" >> config.mak
    fi
    
    
    # Apparently it's not possible to portably echo a backslash.
    
    if test "$asmalign_pot" = "yes" ; then
    
      printf '#define ASMALIGN(ZEROBITS) ".align " #ZEROBITS "\\n\\t"\n' >> $TMPH
    
      printf '#define ASMALIGN(ZEROBITS) ".align 1<<" #ZEROBITS "\\n\\t"\n' >> $TMPH
    
    for codec in $DECODER_LIST $ENCODER_LIST $PARSER_LIST $DEMUXER_LIST $MUXER_LIST; do
    
        ucname="`toupper $codec`"
    
        config_name="CONFIG_$ucname"
        enabled_name="ENABLE_$ucname"
        if enabled $codec; then
            echo "#define $config_name 1" >> $TMPH
            echo "#define $enabled_name 1" >> $TMPH
            echo "$config_name=yes" >> config.mak
        else
            echo "#define $enabled_name 0" >> $TMPH
        fi
    
    # Do not overwrite config.h if unchanged to avoid superfluous rebuilds.
    
    Måns Rullgård's avatar
    Måns Rullgård committed
    if ! cmp -s $TMPH config.h; then
    
            mv -f $TMPH config.h
    else
            echo "config.h is unchanged"
    fi
    
    rm -f $TMPO $TMPC $TMPE $TMPS $TMPH
    
    # build tree in object directory if source path is different from current one
    if test "$source_path_used" = "yes" ; then
        DIRS="\
             doc \
             libavformat \
             libavcodec \
             libavcodec/alpha \
             libavcodec/armv4l \
             libavcodec/bfin \
             libavcodec/i386 \
             libavcodec/sparc \
             libavcodec/mlib \
             libavcodec/ppc \
             libavcodec/liba52 \
    
             libavcodec/amr \
             libavcodec/amr_float \
             libavcodec/amrwb_float \
    
             libpostproc \
             libavutil \
             libswscale \
             tests \
             vhook \
             "
        FILES="\
              Makefile \
              common.mak \
              libavformat/Makefile \
              libavcodec/Makefile \
              libpostproc/Makefile \
              libavutil/Makefile \
              libswscale/Makefile \
              tests/Makefile \
              vhook/Makefile \
              doc/Makefile \
              doc/texi2pod.pl \
              "
        for dir in $DIRS ; do
                mkdir -p $dir
        done
        for f in $FILES ; do
            ln -sf "$source_path/$f" $f
        done
    fi
    
    # build pkg-config files
    
    # FIXME: libdir and includedir are hardcoded and may differ from the real path.
    
    pkgconfig_generate(){
    name=$1
    comment=$2
    version=$3
    libs=$4
    requires=$5
    include=$6
    cat <<EOF >$name.pc
    
    exec_prefix=\${prefix}
    
    includedir=\${prefix}/include
    
    Name: $name
    Description: $comment
    Version: $version
    Requires: $requires
    
    Libs: -L\${libdir} $libs
    Cflags: -I\${includedir} -I\${includedir}/$include
    
    pkgconfig_generate_uninstalled(){
    name=$1
    
    shortname=${name#lib}
    
    comment=$2
    version=$3
    libs=$4
    requires=$5
    cat <<EOF >$name-uninstalled.pc
    
    libdir=\${pcfiledir}/$name
    includedir=\${pcfiledir}/$name
    
    Name: $name
    Description: $comment
    Version: $version
    Requires: $requires
    
    Libs: \${libdir}/${LIBPREF}${shortname}${LIBSUF} $libs
    
    Måns Rullgård's avatar
    Måns Rullgård committed
    pkgconfig_generate libavutil "FFmpeg utility library" "$lavu_version" -lavutil "" ffmpeg
    
    pkgconfig_generate_uninstalled libavutil "FFmpeg utility library" "$lavu_version"
    
    pkgconfig_generate libavcodec "FFmpeg codec library" "$lavc_version" "-lavcodec $extralibs" "$pkg_requires libavutil = $lavu_version" ffmpeg
    pkgconfig_generate_uninstalled libavcodec "FFmpeg codec library" "$lavc_version" "$extralibs" "$pkg_requires libavutil = $lavu_version"
    
    pkgconfig_generate libavformat "FFmpeg container format library" "$lavf_version" "-lavformat $extralibs" "$pkg_requires libavcodec = $lavc_version" ffmpeg
    pkgconfig_generate_uninstalled libavformat "FFmpeg container format library" "$lavf_version" "$extralibs" "$pkg_requires libavcodec = $lavc_version"
    
    if test "$pp" = "yes"; then
      pkgconfig_generate libpostproc "FFmpeg post processing library" "$pp_version" -lpostproc "" postproc
      pkgconfig_generate_uninstalled libpostproc "FFmpeg post processing library" "$pp_version"
    fi
    
    if test "$swscaler" != "no"; then
    
      pkgconfig_generate libswscale "FFmpeg image rescaling library" "$sws_version" "-lswscale" "libavutil = $lavu_version" swscale
      pkgconfig_generate_uninstalled libswscale "FFmpeg image rescaling library" "$sws_version" "" "libavutil = $lavu_version"
    
      pkgconfig_generate libswscale "FFmpeg image rescaling library" "$sws_version" "" "$pkg_requires libavcodec = $lavc_version" swscale
      pkgconfig_generate_uninstalled libswscale "FFmpeg image rescaling library" "$sws_version" "" "$pkg_requires libavcodec = $lavc_version"
    
      apply libswscale.pc sed s/^Libs:.*$/Libs:/
      apply libswscale-uninstalled.pc sed s/^Libs:.*$/Libs:/