Skip to content
Snippets Groups Projects
configure 53.3 KiB
Newer Older
  • Learn to ignore specific revisions
  • Fabrice Bellard's avatar
    Fabrice Bellard committed
        EXESUF=".exe"
    
        if test "$force_prefix" != yes; then prefix="/c/Program Files/FFmpeg"; fi
        if test "$force_libdir" != yes; then bindir="$prefix"; fi
    
    Fabrice Bellard's avatar
    Fabrice Bellard committed
    if test -z "$cross_prefix" ; then
    
    Måns Rullgård's avatar
    Måns Rullgård committed
        # ---
        # big/little-endian test
        check_ld <<EOF
    
    #include <inttypes.h>
    int main(int argc, char ** argv){
    
            volatile uint32_t i=0x01234567;
            return (*((uint8_t*)(&i))) == 0x67;
    
    Måns Rullgård's avatar
    Måns Rullgård committed
        if test $? = 0 ; then
            $TMPE && bigendian="yes"
        else
            echo big/little test failed
        fi
    
    Fabrice Bellard's avatar
    Fabrice Bellard committed
    else
    
    Måns Rullgård's avatar
    Måns Rullgård committed
        # programs cannot be launched if cross compiling, so make a static guess
        if test "$cpu" = "powerpc" -o "$cpu" = "mips" ; then
            bigendian="yes"
        fi
    
    check_header inttypes.h || inttypes=no
    
    check_cc <<EOF || emu_fast_int=yes
    
    #include <inttypes.h>
    int main(int argc, char ** argv){
    
            volatile uint_fast64_t i=0x01234567;
            return 0;
    
    Nick Kurshev's avatar
    Nick Kurshev committed
    # ---
    # check availability of some header files
    
    _memalign=no
    _malloc_h=no
    
    if check_header malloc.h; then
        _malloc_h=yes
        _memalign=yes
        check_func memalign || _memalign="no"
    
    if test "$_memalign" = "no" -a "$mmx" = "yes" -a "$memalignhack" != "yes"; then
    
    Diego Biurrun's avatar
    Diego Biurrun committed
        echo "Error, no memalign() but SSE enabled, disable it or use --enable-memalign-hack."
    
    check_func localtime_r && localtime_r=yes || localtime_r=no
    
        temp_extralibs -lz
        check_header zlib.h && check_func zlibVersion || zlib="no"
        # XXX: more tests needed - runtime test
        restore_flags
    
        extralibs="$extralibs -lz"
    
    if test "$lzo" = "yes" -a "$gpl" = "yes"; then
    
        temp_extralibs -llzo
        check_header lzo1x.h && check_func lzo_version || lzo="no"
        restore_flags
    
    fi
    if test "$lzo" = "yes"; then
    
        extralibs="$extralibs -llzo"
    
    check_exec <<EOF && have_lrintf=yes || have_lrintf=no
    
    #define _ISOC9X_SOURCE  1
    #include <math.h>
    int main( void ) { return (lrintf(3.999f) > 0)?0:1; }
    EOF
    
    
    _restrict=
    for restrict_keyword in restrict __restrict__ __restrict; do
    
        check_cc <<EOF
    void foo(char * $restrict_keyword p);
    EOF
        if test $? = 0; then
            _restrict=$restrict_keyword
            break;
        fi
    
    # test gcc version to see if vector builtins can be used
    # currently only used on i386 for MMX builtins
    
    check_cc -msse <<EOF && builtin_vector=yes || builtin_vector=no
    
    int main(void) {
    
    #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2)
    return 0;
    #else
    #error no vector builtins
    #endif
    }
    EOF
    
    
    # test for mm3dnow.h
    
    test "$cpu" = "x86_64" && march=k8 || march=athlon
    check_cc -march=$march <<EOF && mm3dnow=yes || mm3dnow=no
    
    #include <mm3dnow.h>
    int main(void) {
    
    check_cflags -Wdeclaration-after-statement
    
    check_header dlfcn.h && dlfcn=yes
    
    temp_extralibs -ldl
    if check_func dlopen; then
        dlopen=yes
        ldl=-ldl
    
    if check_func dlopen; then
        dlopen=yes
        ldl=
    
    Måns Rullgård's avatar
    Måns Rullgård committed
    if test "$vhook" = "default"; then
        vhook="$dlopen"
    
    Michael Niedermayer's avatar
    Michael Niedermayer committed
    if test "$vhook" = "yes" -o "$a52bin" = "yes" -o "$faadbin" = "yes"; then
    
    Måns Rullgård's avatar
    Måns Rullgård committed
        extralibs="$extralibs $ldl"
    
    ##########################################
    
    Diego Biurrun's avatar
    Diego Biurrun committed
    # imlib check
    
    temp_extralibs -lImlib2
    check_ld <<EOF && imlib2=yes || imlib2=no
    
    #include <X11/Xlib.h>
    #include <Imlib2.h>
    int main( void ) { return (int) imlib_load_font("foo"); }
    EOF
    
    ##########################################
    
    Diego Biurrun's avatar
    Diego Biurrun committed
    # FreeType check
    
      if (freetype-config --version) >/dev/null 2>&1 ; then
    
          temp_cflags `freetype-config --cflags`
          temp_extralibs `freetype-config --libs`
          check_ld <<EOF && freetype2=yes
    #include <ft2build.h>
    int main( void ) { return (int) FT_Init_FreeType(0); }
    EOF
          restore_flags
    
    ##########################################
    
    Diego Biurrun's avatar
    Diego Biurrun committed
    # SDL check
    
    
    sdl_too_old=no
    sdl=no
    
    SDL_CONFIG="${cross_prefix}sdl-config"
    if ("${SDL_CONFIG}" --version) >/dev/null 2>&1 ; then
    
        temp_cflags `"${SDL_CONFIG}" --cflags`
        temp_extralibs `"${SDL_CONFIG}" --libs`
        check_ld <<EOF
    #include <SDL.h>
    #undef main /* We don't want SDL to override our main() */
    int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
    EOF
        if test $? = 0; then
            _sdlversion=`"${SDL_CONFIG}" --version | sed 's/[^0-9]//g'`
    
            if test "$_sdlversion" -lt 121 ; then
    
                sdl_too_old=yes
            else
                sdl=yes
    
                check_cc <<EOF && sdl_video_size=yes || sdl_video_size=no
    #include <SDL.h>
    int main(void){
        const SDL_VideoInfo *vi = SDL_GetVideoInfo();
        int w = vi->current_w;
        return 0;
    }
    EOF
    
    ##########################################
    
    Diego Biurrun's avatar
    Diego Biurrun committed
    # texi2html check
    
    if (texi2html -version) >/dev/null 2>&1; then
    
    ##########################################
    
    Diego Biurrun's avatar
    Diego Biurrun committed
    # IPv6 check
    
    test "$network" = "yes" && check_ld <<EOF && ipv6=yes || ipv6=no
    
    #include <sys/types.h>
    #include <sys/socket.h>
    #include <netinet/in.h>
    #include <netdb.h>
    int main( void ) {
      struct sockaddr_storage saddr;
      struct ipv6_mreq mreq6;
      getaddrinfo(0,0,0,0);
      getnameinfo(0,0,0,0,0,0,0);
    
      IN6_IS_ADDR_MULTICAST((const struct in6_addr *)0);
    
    # check for video4linux2 --- V4L2_PIX_FMT_YUV420
    
    test "$v4l2" = "yes" && check_cc <<EOF || v4l2="no"
    
    #include <asm/types.h>
    #include <linux/videodev2.h>
    
    int dummy = V4L2_PIX_FMT_YUV420;
    
    struct v4l2_buffer dummy1;
    
    check_cflags -Wall
    check_cflags -Wno-switch
    
    Måns Rullgård's avatar
    Måns Rullgård committed
    if test "$sdl" = "no"; then
        ffplay=no
    
        CFLAGS="-g $CFLAGS"
    
    #  CFLAGS=${CFLAGS//-O3/-Os}
    
        CFLAGS="$CFLAGS -Os"
    
    if test "$optimize" = "yes"; then
    
        if test -n "`$cc -v 2>&1 | grep xlc`"; then
    
            CFLAGS="$CFLAGS -O5"
            LDFLAGS="$LDFLAGS -O5"
    
            CFLAGS="-O3 $CFLAGS"
    
    # PIC flags for shared library objects where they are needed
    if test "$lshared" = "yes" ; then
    
    Måns Rullgård's avatar
    Måns Rullgård committed
        # LIBOBJFLAGS may have already been set in the OS configuration
        if test -z "$LIBOBJFLAGS" ; then
            if test "$cpu" = "x86_64" -o "$cpu" = "ia64" -o "$cpu" = "alpha" ; then
                LIBOBJFLAGS="\$(PIC)"
            fi
    
    Fabrice Bellard's avatar
    Fabrice Bellard committed
    if test x"$bindir" = x""; then
    
    Måns Rullgård's avatar
    Måns Rullgård committed
        bindir="${prefix}/bin"
    
    Måns Rullgård's avatar
    Måns Rullgård committed
        libdir="${prefix}/lib"
    
    Diego Biurrun's avatar
    Diego Biurrun committed
    if test x"$incdir" = x""; then
    
    Måns Rullgård's avatar
    Måns Rullgård committed
        incdir="${prefix}/include/ffmpeg"
    
    if test x"$mandir" = x""; then
    
    Måns Rullgård's avatar
    Måns Rullgård committed
        mandir="${prefix}/man"
    
    Diego Biurrun's avatar
    Diego Biurrun committed
    echo "install prefix   $prefix"
    echo "source path      $source_path"
    
    Fabrice Bellard's avatar
    Fabrice Bellard committed
    echo "C compiler       $cc"
    
    echo "make             $make"
    
    if test "$BUILDSUF" != ""; then
    
    Måns Rullgård's avatar
    Måns Rullgård committed
        echo "build suffix     $BUILDSUF"
    
    Diego Biurrun's avatar
    Diego Biurrun committed
    echo "big-endian       $bigendian"
    
    echo "broken inttypes.h $emu_fast_int"
    
    if test $cpu = "x86" -o $cpu = "x86_64"; then
    
    Måns Rullgård's avatar
    Måns Rullgård committed
        echo "MMX enabled      $mmx"
        echo "Vector Builtins  $builtin_vector"
        echo "3DNow! Builtins  $mm3dnow"
    
    Måns Rullgård's avatar
    Måns Rullgård committed
        echo "IWMMXT enabled   $iwmmxt"
    
    if test $cpu = "mips"; then
    
    Måns Rullgård's avatar
    Måns Rullgård committed
        echo "MMI enabled      $mmi"
    
    fi
    if test $cpu = "powerpc"; then
    
    Måns Rullgård's avatar
    Måns Rullgård committed
        echo "AltiVec enabled  $altivec"
    
    Fabrice Bellard's avatar
    Fabrice Bellard committed
    echo "gprof enabled    $gprof"
    
    echo "lzo enabled      $lzo"
    
    echo "libgsm enabled   $libgsm"
    
    echo "mp3lame enabled  $mp3lame"
    
    Diego Biurrun's avatar
    Diego Biurrun committed
    echo "Vorbis enabled   $vorbis"
    echo "Theora enabled   $theora"
    echo "FAAD enabled     $faad"
    
    echo "faadbin enabled  $faadbin"
    
    Diego Biurrun's avatar
    Diego Biurrun committed
    echo "FAAC enabled     $faac"
    echo "XviD enabled     $xvid"
    
    Fabrice Bellard's avatar
    Fabrice Bellard committed
    echo "a52 support      $a52"
    
    Zdenek Kabelac's avatar
    Zdenek Kabelac committed
    echo "a52 dlopened     $a52bin"
    
    Diego Biurrun's avatar
    Diego Biurrun committed
    echo "DTS support      $dts"
    
    echo "pp support       $pp"
    
    Diego Biurrun's avatar
    Diego Biurrun committed
    echo "shared           $lshared"
    
    Diego Biurrun's avatar
    Diego Biurrun committed
    echo "video hooking    $vhook"
    
    echo "SDL support      $sdl"
    if test $sdl_too_old = "yes"; then
    
    Måns Rullgård's avatar
    Måns Rullgård committed
        echo "-> Your SDL version is too old - please upgrade to have FFplay/SDL support."
    
    Måns Rullgård's avatar
    Måns Rullgård committed
    if test "$vhook" = "yes"; then
        echo "Imlib2 support   $imlib2"
        echo "FreeType support $freetype2"
    
    echo "Sun medialib support"  $sunmlib
    
    echo "pthreads support"      $pthreads
    
    Zdenek Kabelac's avatar
    Zdenek Kabelac committed
    echo "AMR-NB float support"  $amr_nb
    echo "AMR-NB fixed support"  $amr_nb_fixed
    
    echo "AMR-WB float support"  $amr_wb
    
    echo "network support      $network"
    if test "$network" = "yes" ; then
    
    Måns Rullgård's avatar
    Måns Rullgård committed
        echo "IPv6 support         $ipv6"
    
    Måns Rullgård's avatar
    Måns Rullgård committed
        echo "License: LGPL"
    
    Måns Rullgård's avatar
    Måns Rullgård committed
        echo "License: GPL"
    
    Fabrice Bellard's avatar
    Fabrice Bellard committed
    
    
    Diego Biurrun's avatar
    Diego Biurrun committed
    echo "Creating config.mak and config.h..."
    
    Fabrice Bellard's avatar
    Fabrice Bellard committed
    
    
    date >> config.log
    echo "   $0 $FFMPEG_CONFIGURATION" >> config.log
    
    Diego Biurrun's avatar
    Diego Biurrun committed
    echo "# Automatically generated by configure - do not modify!" > config.mak
    echo "/* Automatically generated by configure - do not modify! */" > $TMPH
    
    echo "#define FFMPEG_CONFIGURATION "'"'"$FFMPEG_CONFIGURATION"'"' >> $TMPH
    
    Fabrice Bellard's avatar
    Fabrice Bellard committed
    
    
    echo "prefix=\$(DESTDIR)$prefix" >> config.mak
    echo "libdir=\$(DESTDIR)$libdir" >> config.mak
    
    Diego Biurrun's avatar
    Diego Biurrun committed
    echo "incdir=\$(DESTDIR)$incdir" >> config.mak
    
    echo "bindir=\$(DESTDIR)$bindir" >> config.mak
    echo "mandir=\$(DESTDIR)$mandir" >> config.mak
    
    echo "MAKE=$make" >> config.mak
    
    echo "CC=$cc" >> config.mak
    echo "AR=$ar" >> config.mak
    
    Michael Niedermayer's avatar
    Michael Niedermayer committed
    echo "RANLIB=$ranlib" >> config.mak
    
    Måns Rullgård's avatar
    Måns Rullgård committed
        echo "STRIP=$strip" >> config.mak
        echo "INSTALLSTRIP=$installstrip" >> config.mak
    
    Måns Rullgård's avatar
    Måns Rullgård committed
        echo "STRIP=echo ignoring strip" >> config.mak
        echo "INSTALLSTRIP=" >> config.mak
    
    Diego Biurrun's avatar
    Diego Biurrun committed
    # SHCFLAGS is a copy of CFLAGS without -mdynamic-no-pic, used when building
    
    # shared modules on OS/X (vhook/Makefile).
    SHCFLAGS=$CFLAGS
    if test "$needmdynamicnopic" = yes; then
       CFLAGS="$CFLAGS -mdynamic-no-pic"
    fi
    
    
    Nick Kurshev's avatar
    Nick Kurshev committed
    echo "OPTFLAGS=$CFLAGS" >> config.mak
    
    echo "LDCONFIG=$LDCONFIG" >> config.mak
    
    echo "FFSLDFLAGS=$FFSLDFLAGS" >> config.mak
    
    echo "SHFLAGS=$SHFLAGS" >> config.mak
    
    echo "LIBOBJFLAGS=$LIBOBJFLAGS" >> config.mak
    
    echo "BUILD_STATIC=$lstatic" >> config.mak
    
    echo "BUILDSUF=$BUILDSUF" >> config.mak
    
    echo "LIBPREF=$LIBPREF" >> config.mak
    
    echo "LIBSUF=\${BUILDSUF}$LIBSUF" >> config.mak
    
    if test "$lstatic" = "yes" ; then
      echo "LIB=$LIB" >> config.mak
    
    else # Some Make complain if this variable does not exist.
      echo "LIB=" >> config.mak
    
    echo "SLIBPREF=$SLIBPREF" >> config.mak
    
    echo "SLIBSUF=\${BUILDSUF}$SLIBSUF" >> config.mak
    echo "EXESUF=\${BUILDSUF}$EXESUF" >> config.mak
    
    echo "TARGET_OS=$TARGET_OS" >> config.mak
    
    Zdenek Kabelac's avatar
    Zdenek Kabelac committed
    if test "$cpu" = "x86" ; then
    
      echo "TARGET_ARCH_X86=yes" >> config.mak
    
      echo "#define ARCH_X86 1" >> $TMPH
    
    elif test "$cpu" = "x86_64" ; then
      echo "TARGET_ARCH_X86_64=yes" >> config.mak
      echo "#define ARCH_X86_64 1" >> $TMPH
    
      echo "TARGET_ARCH_ARMV4L=yes" >> config.mak
    
      echo "#define ARCH_ARMV4L 1" >> $TMPH
    
      echo "TARGET_ARCH_ALPHA=yes" >> config.mak
    
      echo "#define ARCH_ALPHA 1" >> $TMPH
    
    elif test "$cpu" = "sparc64" ; then
      echo "TARGET_ARCH_SPARC64=yes" >> config.mak
      echo "#define ARCH_SPARC64 1" >> $TMPH
    
      echo "TARGET_ARCH_SPARC=yes" >> config.mak
      echo "#define ARCH_SPARC 1" >> $TMPH
    elif test "$cpu" = "sparc" ; then
      echo "TARGET_ARCH_SPARC=yes" >> config.mak
      echo "#define ARCH_SPARC 1" >> $TMPH
    
    elif test "$cpu" = "powerpc" ; then
      echo "TARGET_ARCH_POWERPC=yes" >> config.mak
      echo "#define ARCH_POWERPC 1" >> $TMPH
    
      if test $POWERPCMODE = "32bits"; then
        echo "#define POWERPC_MODE_32BITS 1" >> $TMPH
      else
        echo "#define POWERPC_MODE_64BITS 1" >> $TMPH
      fi
    
      if test "$powerpc_perf" = "yes"; then
        echo "#define POWERPC_PERFORMANCE_REPORT 1" >> $TMPH
      fi
    
    elif test "$cpu" = "mips" ; then
      echo "TARGET_ARCH_MIPS=yes" >> config.mak
      echo "#define ARCH_MIPS 1" >> $TMPH
    
    Alex Beregszaszi's avatar
    Alex Beregszaszi committed
    elif test "$cpu" = "sh4" ; then
      echo "TARGET_ARCH_SH4=yes" >> config.mak
      echo "#define ARCH_SH4 1" >> $TMPH
    
    elif test "$cpu" = "parisc" ; then
      echo "TARGET_ARCH_PARISC=yes" >> config.mak
      echo "#define ARCH_PARISC 1" >> $TMPH
    elif test "$cpu" = "s390" ; then
      echo "TARGET_ARCH_S390=yes" >> config.mak
      echo "#define ARCH_S390 1" >> $TMPH
    elif test "$cpu" = "m68k" ; then
      echo "TARGET_ARCH_M68K=yes" >> config.mak
      echo "#define ARCH_M68K 1" >> $TMPH
    elif test "$cpu" = "ia64" ; then
      echo "TARGET_ARCH_IA64=yes" >> config.mak
      echo "#define ARCH_IA64 1" >> $TMPH
    
    Alex Beregszaszi's avatar
    Alex Beregszaszi committed
    fi
    
    if test "$bigendian" = "yes" ; then
      echo "WORDS_BIGENDIAN=yes" >> config.mak
      echo "#define WORDS_BIGENDIAN 1" >> $TMPH
    
    if test "$inttypes" != "yes" ; then
      echo "#define EMULATE_INTTYPES 1" >> $TMPH
    
    if test "$emu_fast_int" = "yes" ; then
    
      echo "#define EMULATE_FAST_INT 1" >> $TMPH
    
    Zdenek Kabelac's avatar
    Zdenek Kabelac committed
    if test "$mmx" = "yes" ; then
    
      echo "TARGET_MMX=yes" >> config.mak
    
      echo "#define HAVE_MMX 1" >> $TMPH
    
      echo "#define __CPU__ 586" >> $TMPH
    
    Fabrice Bellard's avatar
    Fabrice Bellard committed
    fi
    
    if test "$builtin_vector" = "yes" ; then
      echo "TARGET_BUILTIN_VECTOR=yes" >> config.mak
      echo "#define HAVE_BUILTIN_VECTOR 1" >> $TMPH
    fi
    
    if test "$mm3dnow" = "yes" ; then
      echo "TARGET_BUILTIN_3DNOW=yes" >> config.mak
      echo "#define HAVE_MM3DNOW 1" >> $TMPH
    fi
    
    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
    
      echo "// Enable the next line to use the reference C code instead of AltiVec" >> $TMPH
      echo "// #define ALTIVEC_USE_REFERENCE_C_CODE 1" >> $TMPH
    
      if test "$_altivec_h" = "yes" ; then
        echo "#define HAVE_ALTIVEC_H 1" >> $TMPH
      else
    
    Alex Beregszaszi's avatar
    1l  
    Alex Beregszaszi committed
        echo "#undef HAVE_ALTIVEC_H" >> $TMPH
    
    Zdenek Kabelac's avatar
    Zdenek Kabelac committed
    if test "$gprof" = "yes" ; then
    
      echo "TARGET_GPROF=yes" >> config.mak
    
      echo "#define HAVE_GPROF 1" >> $TMPH
    
    Fabrice Bellard's avatar
    Fabrice Bellard committed
    fi
    
    if test "$localtime_r" = "yes" ; then
      echo "#define HAVE_LOCALTIME_R 1" >> $TMPH
    fi
    
    if test "$imlib2" = "yes" ; then
      echo "HAVE_IMLIB2=yes" >> config.mak
    fi
    
    if test "$freetype2" = "yes" ; then
      echo "HAVE_FREETYPE2=yes" >> config.mak
    fi
    
    if test "$sunmlib" = "yes" ; then
      echo "HAVE_MLIB=yes" >> config.mak
      echo "#define HAVE_MLIB 1" >> $TMPH
      extralibs="$extralibs -lmlib"
    fi
    
    if test "$pthreads" = "yes" ; then
      echo "HAVE_PTHREADS=yes" >> config.mak
      echo "#define HAVE_PTHREADS 1" >> $TMPH
    
      if test $targetos != FreeBSD -a $targetos != OpenBSD ; then
    
    if test "$sdl" = "yes" ; then
      echo "CONFIG_SDL=yes" >> config.mak
    
      echo "SDL_LIBS=`"${SDL_CONFIG}" --libs`" >> config.mak
      echo "SDL_CFLAGS=`"${SDL_CONFIG}" --cflags`" >> config.mak
    
      if test "$sdl_video_size" = "yes"; then
        echo "#define HAVE_SDL_VIDEO_SIZE 1" >> $TMPH
      fi
    
    if test "$texi2html" = "yes"; then
      echo "BUILD_DOC=yes" >> config.mak
    fi
    
    if test "$have_lrintf" = "yes" ; then
      echo "#define HAVE_LRINTF 1" >> $TMPH
    fi
    
    if test "$vhook" = "yes" ; then
      echo "BUILD_VHOOK=yes" >> config.mak
      echo "#define HAVE_VHOOK 1" >> $TMPH
    fi
    
    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
    
      echo "#define BUILD_SHARED_AV 1" >> $TMPH
    
    Nick Kurshev's avatar
    Nick Kurshev committed
      echo "BUILD_SHARED=yes" >> config.mak
    
      echo "PIC=-fPIC -DPIC" >> config.mak
    
      echo "SPPMAJOR=${lavc_version%%.*}" >> config.mak
    
      echo "SPPVERSION=$lavc_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 "SLIBNAME=${SLIBNAME}" >> config.mak
    
      echo "SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}" >> config.mak
      echo "SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}" >> config.mak
    
    Nick Kurshev's avatar
    Nick Kurshev committed
    fi
    
    echo "EXTRALIBS=$extralibs" >> config.mak
    
    version=`grep '#define FFMPEG_VERSION ' "$source_path/libavcodec/avcodec.h" |
    
     cut -d '"' -f 2`
    echo "VERSION=$version" >>config.mak
    
    Diego Biurrun's avatar
    Diego Biurrun committed
    # If you do not want to use encoders, disable them.
    
    echo "#define CONFIG_ENCODERS 1" >> $TMPH
    
    Diego Biurrun's avatar
    Diego Biurrun committed
    # If you do not want to use decoders, disable them.
    
    echo "#define CONFIG_DECODERS 1" >> $TMPH
    
    # muxers
    if test "$muxers" = "yes" ; then
      echo "#define CONFIG_MUXERS 1" >> $TMPH
      echo "CONFIG_MUXERS=yes" >> config.mak
    fi
    
    # demuxers
    if test "$demuxers" = "yes" ; then
      echo "#define CONFIG_DEMUXERS 1" >> $TMPH
      echo "CONFIG_DEMUXERS=yes" >> config.mak
    fi
    
    
    Fabrice Bellard's avatar
    Fabrice Bellard committed
    # AC3
    if test "$a52" = "yes" ; then
      echo "#define CONFIG_AC3 1" >> $TMPH
      echo "CONFIG_AC3=yes" >> config.mak
    
    Fabrice Bellard's avatar
    Fabrice Bellard committed
      if test "$a52bin" = "yes" ; then
        echo "#define CONFIG_A52BIN 1" >> $TMPH
        echo "CONFIG_A52BIN=yes" >> config.mak
      fi
    fi
    
    
    # DTS
    if test "$dts" = "yes" ; then
      echo "#define CONFIG_DTS 1" >> $TMPH
      echo "CONFIG_DTS=yes" >> config.mak
    fi
    
    
    # PP
    if test "$pp" = "yes" ; then
      echo "#define CONFIG_PP 1" >> $TMPH
      echo "CONFIG_PP=yes" >> config.mak
    fi
    
    
    Diego Biurrun's avatar
    Diego Biurrun committed
    # MPEG audio high precision mode
    
    if test "$mpegaudio_hp" = "yes" ; then
      echo "#define CONFIG_MPEGAUDIO_HP 1" >> $TMPH
    fi
    
    
    Fabrice Bellard's avatar
    Fabrice Bellard committed
    if test "$v4l" = "yes" ; then
      echo "#define CONFIG_VIDEO4LINUX 1" >> $TMPH
      echo "CONFIG_VIDEO4LINUX=yes" >> config.mak
    fi
    
    
    Luca Abeni's avatar
    Luca Abeni committed
    if test "$v4l2" = "yes" ; then
      echo "#define CONFIG_VIDEO4LINUX2 1" >> $TMPH
      echo "CONFIG_VIDEO4LINUX2=yes" >> config.mak
    fi
    
    
    if test "$bktr" = "yes" ; then
      echo "#define CONFIG_BKTR 1" >> $TMPH
      echo "CONFIG_BKTR=yes" >> config.mak
    fi
    
    
    if test "$dv1394" = "yes" ; then
      echo "#define CONFIG_DV1394 1" >> $TMPH
      echo "CONFIG_DV1394=yes" >> config.mak
    fi
    
    
    if test "$dc1394" = "yes" ; then
      echo "#define CONFIG_DC1394 1" >> $TMPH
      echo "CONFIG_DC1394=yes" >> config.mak
    fi
    
    
    if test "$dlopen" = "yes" ; then
      echo "#define CONFIG_HAVE_DLOPEN 1" >> $TMPH
    fi
    
    if test "$dlfcn" = "yes" ; then
      echo "#define CONFIG_HAVE_DLFCN 1" >> $TMPH
    fi
    
    
    Fabrice Bellard's avatar
    Fabrice Bellard committed
    if test "$audio_oss" = "yes" ; then
      echo "#define CONFIG_AUDIO_OSS 1" >> $TMPH
      echo "CONFIG_AUDIO_OSS=yes" >> config.mak
    
    Zdenek Kabelac's avatar
    Zdenek Kabelac committed
    fi
    
    
    if test "$audio_beos" = "yes" ; then
      echo "#define CONFIG_AUDIO_BEOS 1" >> $TMPH
      echo "CONFIG_AUDIO_BEOS=yes" >> config.mak
    fi
    
    
    Fabrice Bellard's avatar
    Fabrice Bellard committed
    if test "$network" = "yes" ; then
      echo "#define CONFIG_NETWORK 1" >> $TMPH
      echo "CONFIG_NETWORK=yes" >> config.mak
    
    if test "$ipv6" = "yes" ; then
      echo "#define CONFIG_IPV6 1" >> $TMPH
    fi
    
    
    if test "$zlib" = "yes" ; then
      echo "#define CONFIG_ZLIB 1" >> $TMPH
      echo "CONFIG_ZLIB=yes" >> config.mak
    fi
    
    
    if test "$lzo" = "yes" ; then
      echo "#define CONFIG_LZO 1" >> $TMPH
      echo "CONFIG_LZO=yes" >> config.mak
    fi
    
    
    if test "$libgsm" = "yes" ; then
      echo "#define CONFIG_LIBGSM 1" >> $TMPH
      echo "CONFIG_LIBGSM=yes" >> config.mak
    fi
    
    
    Zdenek Kabelac's avatar
    Zdenek Kabelac committed
    if test "$mp3lame" = "yes" ; then
    
      echo "#define CONFIG_MP3LAME 1" >> $TMPH
    
      echo "CONFIG_MP3LAME=yes" >> config.mak
    fi
    
    
      echo "#define CONFIG_LIBOGG 1" >> $TMPH
      echo "CONFIG_LIBOGG=yes" >> config.mak
    fi
    
    
    if test "$vorbis" = "yes" ; then
    
      echo "#define CONFIG_LIBVORBIS 1" >> $TMPH
      echo "CONFIG_LIBVORBIS=yes" >> config.mak
    fi
    
    if test "$theora" = "yes" ; then
      echo "#define CONFIG_LIBTHEORA 1" >> $TMPH
      echo "CONFIG_LIBTHEORA=yes" >> config.mak
    
    if test "$faad" = "yes" ; then
      echo "#define CONFIG_FAAD 1" >> $TMPH
      echo "CONFIG_FAAD=yes" >> config.mak
    fi
    
    if test "$faadbin" = "yes" ; then
      echo "#define CONFIG_FAADBIN 1" >> $TMPH
    
      echo "CONFIG_FAADBIN=yes" >> config.mak
    
    if test "$faac" = "yes" ; then
      echo "#define CONFIG_FAAC 1" >> $TMPH
      echo "CONFIG_FAAC=yes" >> config.mak
    fi
    
    
    if test "$xvid" = "yes" ; then
      echo "#define CONFIG_XVID 1" >> $TMPH
      echo "CONFIG_XVID=yes" >> config.mak
    fi
    
    
    if test "$x264" = "yes" ; then
      echo "#define CONFIG_X264 1" >> $TMPH
      echo "CONFIG_X264=yes" >> config.mak
    fi
    
    
    if test "$mingw32" = "yes" ; then
      echo "#define CONFIG_WIN32 1" >> $TMPH
      echo "CONFIG_WIN32=yes" >> config.mak
    
      echo "HAVE_W32THREADS=yes" >> config.mak
      echo "#define HAVE_W32THREADS 1" >> $TMPH
    
      echo "#define __MINGW32__ 1" >> $TMPH
    
    if test "$mingwce" = "yes" ; then
      echo "#define CONFIG_WIN32 1" >> $TMPH
      echo "CONFIG_WIN32=yes" >> config.mak
      echo "#define CONFIG_WINCE 1" >> $TMPH
      echo "CONFIG_WINCE=yes" >> config.mak
      echo "#ifndef __MINGW32__" >> $TMPH
      echo "#define __MINGW32__ 1" >> $TMPH
      echo "#endif" >> $TMPH
    fi
    
    
    if test "$os2" = "yes" ; then
      echo "#define CONFIG_OS2 1" >> $TMPH
      echo "CONFIG_OS2=yes" >> config.mak
    
      echo "HAVE_OS2THREADS=yes" >> config.mak
      echo "#define HAVE_OS2THREADS 1" >> $TMPH
      echo "#define HAVE_THREADS 1" >> $TMPH
    
    if test "$TARGET_OS" = "SunOS" ; then
      echo "#define CONFIG_SUNOS 1" >> $TMPH
    fi
    
    
    if test "$TARGET_OS" = "BeOS" ; then
      echo "HAVE_BEOSTHREADS=yes" >> config.mak
      echo "#define HAVE_BEOSTHREADS 1" >> $TMPH
      echo "#define HAVE_THREADS 1" >> $TMPH
    fi
    
    
    if test "$darwin" = "yes"; then
      echo "#define CONFIG_DARWIN 1"  >> $TMPH
      echo "CONFIG_DARWIN=yes" >> config.mak
    fi
    
    
    Zdenek Kabelac's avatar
    Zdenek Kabelac committed
    if test "$_malloc_h" = "yes" ; then
    
      echo "#define HAVE_MALLOC_H 1" >> $TMPH
    
    Nick Kurshev's avatar
    Nick Kurshev committed
    else
    
      echo "#undef  HAVE_MALLOC_H" >> $TMPH
    
    Zdenek Kabelac's avatar
    Zdenek Kabelac committed
    if test "$_memalign" = "yes" ; then
    
      echo "#define HAVE_MEMALIGN 1" >> $TMPH
    else
      echo "#undef  HAVE_MEMALIGN" >> $TMPH
    fi
    
    
    if test "$memalignhack" = "yes" ; then
      echo "#define MEMALIGN_HACK 1" >> $TMPH
    fi
    
    
    
    if test "$netserver" = "yes" ; then
      echo "#define CONFIG_BEOS_NETSERVER 1" >> $TMPH
      echo "CONFIG_BEOS_NETSERVER=yes" >> config.mak
    fi
    
    
    if test "$need_inet_aton" = "yes" ; then
      echo "NEED_INET_ATON=yes" >> config.mak
    fi
    
    
    Zdenek Kabelac's avatar
    Zdenek Kabelac committed
    if test "$simpleidct" = "yes" ; then
    
      echo "#define SIMPLE_IDCT 1" >> $TMPH
    fi
    
    
    if test "$protocols" = "yes" ; then
      echo "#define CONFIG_PROTOCOLS 1" >> $TMPH
      echo "CONFIG_PROTOCOLS=yes" >> config.mak
    fi
    
    
    if test "$ffserver" = "yes" ; then
      echo "#define CONFIG_FFSERVER 1" >> $TMPH
      echo "CONFIG_FFSERVER=yes" >> config.mak
    fi
    
    
    if test "$ffplay" = "yes" ; then
      echo "CONFIG_FFPLAY=yes" >> config.mak
    fi
    
    
    if test "$gpl" = "yes" ; then
      echo "#define CONFIG_GPL 1" >> $TMPH
      echo "CONFIG_GPL=yes" >> config.mak
    fi
    
    
    echo "#define restrict $_restrict" >> $TMPH
    
    
    if test "$optimize" = "small"; then
      echo "#define always_inline"  >> $TMPH
    fi
    
    
    # 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/i386 \
             libavcodec/sparc \
             libavcodec/mlib \
             libavcodec/ppc \
             libavcodec/liba52 \
    
             libpostproc \
    
             libavutil \
             tests \
             vhook \
             "
        FILES="\
              Makefile \
              libavformat/Makefile \
              libavcodec/Makefile \
    
              libpostproc/Makefile \
    
              libavutil/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
    
    echo "SRC_PATH=$source_path" >> config.mak
    
    echo "BUILD_ROOT=$PWD" >> config.mak
    
    if test "$amr" = "yes" ; then
      echo "#define AMR 1" >> $TMPH
      echo "AMR=yes" >> config.mak
    fi
    
    
    if test "$amr_wb" = "yes" ; then
      echo "#define AMR_WB 1" >> $TMPH
      echo "AMR_WB=yes" >> config.mak
      echo
      echo "AMR WB FLOAT NOTICE ! Make sure you have downloaded TS26.204"
      echo "V5.1.0 from "
      echo "http://www.3gpp.org/ftp/Specs/archive/26_series/26.204/26204-510.zip"
      echo "and extracted the source to libavcodec/amrwb_float"
    fi
    
    
    if test "$amr_nb" = "yes" ; then
      echo "#define AMR_NB 1" >> $TMPH
      echo "AMR_NB=yes" >> config.mak
      echo
    
      echo "AMR NB FLOAT NOTICE ! Make sure you have downloaded TS26.104"
      echo "REL-5 V5.1.0 from "
    
    Diego Biurrun's avatar
    Diego Biurrun committed
      echo "http://www.3gpp.org/ftp/Specs/archive/26_series/26.104/26104-510.zip"
    
      echo "and extracted the source to libavcodec/amr_float"
      echo "If you try this on alpha, you may need to change Word32 to int in amr/typedef.h"
    fi
    
    
    Zdenek Kabelac's avatar
    Zdenek Kabelac committed
    if test "$amr_nb_fixed" = "yes" ; then
      echo "#define AMR_NB_FIXED 1" >> $TMPH
    
    Diego Biurrun's avatar
    Diego Biurrun committed
      echo "AMR_NB_FIXED=yes" >> config.mak
    
    Diego Biurrun's avatar
    Diego Biurrun committed
      echo
    
    Zdenek Kabelac's avatar
    Zdenek Kabelac committed
      echo "AMR NB FIXED POINT NOTICE! Make sure you have downloaded TS26.073 "
      echo "REL-5 version 5.1.0 from "
    
    Diego Biurrun's avatar
    Diego Biurrun committed
      echo "http://www.3gpp.org/ftp/Specs/archive/26_series/26.073/26073-510.zip"
    
      echo "and extracted src to libavcodec/amr"
    
    Zdenek Kabelac's avatar
    Zdenek Kabelac committed
      echo "You must also add -DMMS_IO and remove -pedantic-errors to/from CFLAGS in libavcodec/amr/makefile."
      echo "i.e. CFLAGS = -Wall -I. \$(CFLAGS_\$(MODE)) -D\$(VAD) -DMMS_IO"
    
    if test "$amr_if2" = "yes" ; then
      echo "AMR_CFLAGS=-DIF2=1" >> config.mak
    fi
    
    
        echo "#define CONFIG_`echo $codec | tr a-z A-Z` 1" >> $TMPH
        echo "CONFIG_`echo $codec | tr a-z A-Z`=yes" >> config.mak
    
    # Do not overwrite config.h if unchanged to avoid superfluous rebuilds.
    diff $TMPH config.h >/dev/null 2>&1
    
            mv -f $TMPH config.h
    else
            echo "config.h is unchanged"
    fi
    
    rm -f $TMPO $TMPC $TMPE $TMPS $TMPH
    
    Diego Biurrun's avatar
    Diego Biurrun committed
    # build pkg-config files libav*.pc and libpostproc.pc
    
    # libavutil.pc
    cat <<EOF >libavutil.pc
    prefix=$prefix
    exec_prefix=\${prefix}
    libdir=\${exec_prefix}/lib
    includedir=\${prefix}/include
    
    Name: libavutil
    Description: FFmpeg utility library
    Version: $lavu_version
    
    Conflicts:
    Libs: -L\${libdir} -lavutil
    Cflags: -I\${includedir} -I\${includedir}/ffmpeg
    EOF
    
    cat <<EOF >libavutil-uninstalled.pc
    prefix=
    exec_prefix=
    libdir=\${pcfiledir}/libavutil
    includedir=\${pcfiledir}/libavutil
    
    Name: libavutil
    Description: FFmpeg utility library
    Version: $lavu_version
    
    Conflicts:
    Libs: \${libdir}/${LIBPREF}avutil${LIBSUF}
    Cflags: -I\${includedir}
    EOF
    
    
    # libavcodec.pc
    cat <<EOF >libavcodec.pc
    prefix=$prefix
    exec_prefix=\${prefix}
    libdir=\${exec_prefix}/lib
    includedir=\${prefix}/include
    
    Name: libavcodec
    Description: FFmpeg codec library
    
    Requires: $pkg_requires libavutil = $lavu_version
    
    Conflicts:
    Libs: -L\${libdir} -lavcodec $extralibs
    Cflags: -I\${includedir} -I\${includedir}/ffmpeg
    EOF
    
    cat <<EOF >libavcodec-uninstalled.pc
    prefix=
    exec_prefix=
    libdir=\${pcfiledir}/libavcodec
    includedir=\${pcfiledir}/libavcodec
    
    Name: libavcodec
    Description: FFmpeg codec library