Skip to content
Snippets Groups Projects
configure 62 KiB
Newer Older
  • Learn to ignore specific revisions
  •     if test $arch = "x86" -o $arch = "x86_64"; then
    
        if test -n "`$cc -v 2>&1 | grep xlc`"; then
    
            add_cflags "-qpdf2 -qlanglvl=extc99 -qmaxmem=-1 -qarch=auto -qtune=auto"
    
            gcc_version="`$cc -v 2>&1 | grep version | cut -d ' ' -f3-`"
            case "$gcc_version" in
                *2.95*)
    
                    add_cflags "-no-cpp-precomp -pipe -force_cpusubtype_ALL -Wno-sign-compare"
    
                    if test "$lshared" = no; then
                       needmdynamicnopic="yes"
                    fi
                    ;;
                *)
    
                    if test "$lshared" = no; then
                       needmdynamicnopic="yes"
                    fi
                    ;;
            esac
    
    fi
    
    if test $optimize != "no"; then
        add_cflags "-fomit-frame-pointer"
    
    # Can only do AltiVec on PowerPC
    if test $altivec = "default"; then
    
            601|ppc601|PowerPC601)
    
                add_cflags "-mcpu=601"
    
                if test $altivec = "yes"; then
                    echo "WARNING: Tuning for PPC601 but AltiVec enabled!";
                fi
                TUNECPU=ppc601
            ;;
            603*|ppc603*|PowerPC603*)
    
                add_cflags "-mcpu=603"
    
                if test $altivec = "yes"; then
                    echo "WARNING: Tuning for PPC603 but AltiVec enabled!";
                fi
                TUNECPU=ppc603
            ;;
            604*|ppc604*|PowerPC604*)
    
                add_cflags "-mcpu=604"
    
                if test $altivec = "yes"; then
                    echo "WARNING: Tuning for PPC604 but AltiVec enabled!";
                fi
                TUNECPU=ppc604
            ;;
            G3|g3|75*|ppc75*|PowerPC75*)
    
                add_cflags "-mcpu=750 -mpowerpc-gfxopt"
    
                if test $altivec = "yes"; then
                    echo "WARNING: Tuning for PPC75x but AltiVec enabled!";
                fi
                TUNECPU=ppc750
            ;;
            G4|g4|745*|ppc745*|PowerPC745*)
    
                add_cflags "-mcpu=7450 -mpowerpc-gfxopt"
    
                if test $altivec = "no"; then
                    echo "WARNING: Tuning for PPC745x but AltiVec disabled!";
                fi
                TUNECPU=ppc7450
            ;;
            74*|ppc74*|PowerPC74*)
    
                add_cflags "-mcpu=7400 -mpowerpc-gfxopt"
    
                if test $altivec = "no"; then
                    echo "WARNING: Tuning for PPC74xx but AltiVec disabled!";
                fi
                TUNECPU=ppc7400
            ;;
            G5|g5|970|ppc970|PowerPC970|power4*|Power4*)
    
                add_cflags "-mcpu=970 -mpowerpc-gfxopt -mpowerpc64"
    
                if test $altivec = "no"; then
                    echo "WARNING: Tuning for PPC970 but AltiVec disabled!";
                fi
                TUNECPU=ppc970
    
            # targets that do NOT support conditional mov (cmov)
            i[345]86|pentium|pentium-mmx|k6|k6-[23]|winchip-c6|winchip2|c3)
    
                cmov="no"
            ;;
            # targets that do support conditional mov (cmov)
            i686|pentiumpro|pentium[234]|pentium-m|prescott|athlon|athlon-tbird|athlon-4|athlon-[mx]p|nocona|athlon64|k8|opteron|athlon-fx)
                add_cflags "-march=$cpu"
                cmov=yes
    
                add_cflags "-mcpu=v9"
    
    # make sure we can execute files in $TMPDIR
    cat >$TMPE 2>>$logfile <<EOF
    #! /bin/sh
    EOF
    chmod +x $TMPE >>$logfile 2>&1
    if ! $TMPE >>$logfile 2>&1; then
        cat <<EOF
    Unable to create and execute files in $TMPDIR1.  Set the TMPDIR environment
    variable to another directory.
    EOF
        die "Sanity test failed."
    fi
    
    Måns Rullgård's avatar
    Måns Rullgård committed
    # compiler sanity check
    check_exec <<EOF
    int main(){
        return 0;
    }
    EOF
    if test "$?" != 0; then
        echo "$cc is unable to create an executable file."
        if test -z "$cross_prefix" -a "$cross_compile" = no; then
            echo "If $cc is a cross-compiler, use the --cross-compile option."
    
            echo "Only do this if you know what cross compiling means."
    
    Måns Rullgård's avatar
    Måns Rullgård committed
        fi
        die "C compiler test failed."
    fi
    
    
    # check for assembler specific support
    
    
    check_cc <<EOF && dcbzl=yes
    int main(void) {
        register long zero = 0;
        char data[1024];
        asm volatile("dcbzl %0, %1" : : "b" (data), "r" (zero));
    return 0;
    }
    EOF
    fi
    
    
    # AltiVec flags: The FSF version of GCC differs from the Apple version
    
            if test -n "`$cc -v 2>&1 | grep version | grep Apple`"; then
    
                add_cflags "-maltivec -mabi=altivec"
    
    check_header altivec.h && _altivec_h=yes || _altivec_h=no
    
    Diego Biurrun's avatar
    Diego Biurrun committed
    # check if our compiler supports Motorola AltiVec C API
    
    Måns Rullgård's avatar
    Måns Rullgård committed
        if test $_altivec_h = "yes"; then
            inc_altivec_h="#include <altivec.h>"
        else
            inc_altivec_h=
        fi
        check_cc <<EOF || altivec=no
    
    int main(void) {
        vector signed int v1, v2, v3;
        v1 = vec_add(v2,v3);
        return 0;
    }
    EOF
    fi
    
    # check armv5te instructions support
    
    if test $armv5te = "default" -a $arch = "armv4l"; then
    
        armv5te=no
        check_cc <<EOF && armv5te=yes
            int main(void) {
            __asm__ __volatile__ ("qadd r0, r0, r0");
            }
    EOF
    fi
    
    # check iwmmxt support
    
    if test $iwmmxt = "default" -a $arch = "armv4l"; then
    
        iwmmxt=no
        check_cc <<EOF && iwmmxt=yes
            int main(void) {
            __asm__ __volatile__ ("wunpckelub wr6, wr4");
            }
    EOF
    fi
    
    
    Diego Biurrun's avatar
    Diego Biurrun committed
    # mmi only available on mips
    
    Diego Biurrun's avatar
    Diego Biurrun committed
    # check if our compiler supports mmi
    
    enabled mmi && check_cc <<EOF || mmi="no"
    
    int main(void) {
        __asm__ ("lq \$2, 0(\$2)");
        return 0;
    }
    EOF
    
        check_ld <<EOF || die "endian test failed" && $TMPE && bigendian="yes"
    
    #include <inttypes.h>
    int main(int argc, char ** argv){
    
            volatile uint32_t i=0x01234567;
            return (*((uint8_t*)(&i))) == 0x67;
    
    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 "$arch" = "powerpc" -o "$arch" = "mips" ; then
    
    Måns Rullgård's avatar
    Måns Rullgård committed
            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" -a "$targetos" != "Darwin" -a \
            "$targetos" != "FreeBSD" ; then
    
        die "Error, no memalign() but SSE enabled, disable it or use --enable-memalign-hack."
    
    check_func localtime_r && localtime_r=yes || localtime_r=no
    
    enabled zlib && check_lib zlib.h zlibVersion -lz || zlib="no"
    
    # check for some common methods of building with pthread support
    # do this before the optional library checks as some of them require pthreads
    if enabled pthreads; then
        { check_cflags -pthread && check_ldflags -pthread; } ||
        { check_cflags -pthreads && check_ldflags -pthreads; } ||
        check_lib pthread.h pthread_create -lpthread ||
        check_func pthread_create ||
        die "ERROR: can't find pthreads library"
    fi
    
    # these are off by default, so fail if requested and not available
    enabled dts     && require libdts dts.h dts_init -ldts
    enabled libgsm  && require libgsm gsm.h gsm_create -lgsm
    enabled mp3lame && require LAME lame/lame.h lame_init -lmp3lame
    
    enabled vorbis  && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbis -lvorbisenc -logg
    
    enabled libogg  && require libogg ogg/ogg.h ogg_sync_init -logg
    
    enabled xvid    && require XviD xvid.h xvid_global -lxvidcore
    enabled x264    && require x264 x264.h x264_encoder_open -lx264
    enabled dc1394  && require libdc1394 libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394
    enabled sunmlib && require mediaLib mlib_types.h mlib_VectorSub_S16_U8_Mod -lmlib
    
    # Ugh, faac uses stdcall calling convention on win32 so we can't use
    # the generic test functions
    if enabled faac; then
        save_flags
        temp_extralibs -lfaac
        check_ld <<EOF && add_extralibs -lfaac || die "ERROR: libfaac not found"
    #include <stdint.h>
    #include <faac.h>
    int main(){
        char *id, *cpr;
        faacEncGetVersion(&id, &cpr);
        return 0;
    }
    EOF
        restore_flags
    fi
    
    
    # Ugh, recent faad2 versions have renamed all functions and #define the
    # old names in faad.h.  Generic tests won't work.
    if enabled faad; then
        save_flags
        temp_extralibs -lfaad
        check_ld <<EOF && add_extralibs -lfaad || die "ERROR: libfaad not found"
    #include <faad.h>
    int main(){
        faacDecOpen();
        return 0;
    }
    EOF
        restore_flags
    fi
    
    
    # Ugh, avisynth uses WINAPI calls. Generic tests won't work.
    if enabled avisynth; then
        save_flags
        temp_extralibs -lvfw32
        check_ld <<EOF && add_extralibs -lvfw32 || die "ERROR: vfw32 not found"
    #include <windows.h>
    #include <vfw.h>
    int main(){
        AVIFileInit();
        return 0;
    }
    EOF
        restore_flags
    fi
    
    
    
    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 && _restrict=$restrict_keyword && break
    
    void foo(char * $restrict_keyword p);
    EOF
    
    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
    
    Michael Niedermayer's avatar
    Michael Niedermayer committed
    fi
    
    
    if test "$targetos" = "CYGWIN" -a "$lstatic" = "yes" ; then
        vhook="no"
        echo
        echo "At the moment vhooks don't work on Cygwin static builds."
        echo "Patches welcome."
        echo
    fi
    
    
    if enabled vhook; then
        check_ldflags -rdynamic
        check_ldflags -export-dynamic
    fi
    
    Michael Niedermayer's avatar
    Michael Niedermayer committed
    
    
    ##########################################
    
    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
    
    enabled network && enabled ipv6 && 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
    
    enabled v4l2 && check_cc <<EOF || v4l2="no"
    
    #include <asm/types.h>
    #include <linux/videodev2.h>
    
    int dummy = V4L2_PIX_FMT_YUV420;
    
    struct v4l2_buffer dummy1;
    
    enabled debug && add_cflags -g
    
    # add some useful compiler flags if supported
    check_cflags -Wdeclaration-after-statement
    
    check_cflags -Wall
    check_cflags -Wno-switch
    
    Michael Niedermayer's avatar
    Michael Niedermayer committed
    check_cflags -Wdisabled-optimization
    check_cflags -Wpointer-arith
    check_cflags -Wredundant-decls
    check_cflags -Winline
    
    # add some linker flags
    check_ldflags '-Wl,--as-needed' '-Wl,-rpath-link,\$(BUILD_ROOT)/libavcodec' '-Wl,-rpath-link,\$(BUILD_ROOT)/libavformat' '-Wl,-rpath-link,\$(BUILD_ROOT)/libavutil'
    
    # not all compilers support -Os
    test "$optimize" = "small" && check_cflags -Os
    
        if test -n "`$cc -v 2>&1 | grep xlc`"; then
    
    # 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
    
                x86_64|ia64|alpha|sparc*) LIBOBJFLAGS="\$(PIC)" ;;
            esac
    
    if test "$gprof" = "yes" ; then
    
    # find if .align arg is power-of-two or not
    if test $asmalign_pot = "unknown"; then
        asmalign_pot="no"
        echo 'asm (".align 3");' | check_cc && asmalign_pot="yes"
    fi
    
    
    Diego Biurrun's avatar
    Diego Biurrun committed
    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 $arch = "x86" -o $arch = "x86_64"; then
    
    Måns Rullgård's avatar
    Måns Rullgård committed
        echo "MMX enabled      $mmx"
    
        echo "ARMv5TE enabled  $armv5te"
    
    Måns Rullgård's avatar
    Måns Rullgård committed
        echo "IWMMXT enabled   $iwmmxt"
    
    Måns Rullgård's avatar
    Måns Rullgård committed
        echo "MMI enabled      $mmi"
    
    Måns Rullgård's avatar
    Måns Rullgård committed
        echo "AltiVec enabled  $altivec"
    
        echo "dcbzl available  $dcbzl"
    
    Fabrice Bellard's avatar
    Fabrice Bellard committed
    echo "gprof enabled    $gprof"
    
    echo "libgsm enabled   $libgsm"
    
    echo "mp3lame enabled  $mp3lame"
    
    Diego Biurrun's avatar
    Diego Biurrun committed
    echo "Vorbis enabled   $vorbis"
    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"
    
    echo "Software Scaler enabled $swscaler"
    
    echo "AVISynth enabled $avisynth"
    
    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"
    
    echo ".align is power-of-two" $asmalign_pot
    
    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=$PREFIX" >> config.mak
    echo "prefix=\$(DESTDIR)\${PREFIX}" >> config.mak
    
    echo "libdir=\$(DESTDIR)$libdir" >> config.mak
    
    echo "shlibdir=\$(DESTDIR)$shlibdir" >> 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
    
    VHOOKCFLAGS="-fPIC $CFLAGS"
    
    test "$needmdynamicnopic" = yes && add_cflags -mdynamic-no-pic
    
    Nick Kurshev's avatar
    Nick Kurshev committed
    echo "OPTFLAGS=$CFLAGS" >> config.mak
    
    echo "VHOOKCFLAGS=$VHOOKCFLAGS">>config.mak
    
    echo "LDCONFIG=$LDCONFIG" >> config.mak
    
    echo "FFSERVERLDFLAGS=$FFSERVERLDFLAGS" >> config.mak
    
    echo "SHFLAGS=$SHFLAGS" >> config.mak
    
    echo "VHOOKSHFLAGS=$VHOOKSHFLAGS" >> config.mak
    
    echo "VHOOKLIBS=$VHOOKLIBS" >> 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=$targetos" >> config.mak
    
      echo "TARGET_ARCH_X86=yes" >> config.mak
    
      echo "#define ARCH_X86 1" >> $TMPH
    
    elif test "$arch" = "x86_64" ; then
    
      echo "TARGET_ARCH_X86_64=yes" >> config.mak
      echo "#define ARCH_X86_64 1" >> $TMPH
    
    elif test "$arch" = "armv4l" ; then
    
      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 "$arch" = "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
    
      echo "TARGET_ARCH_SPARC=yes" >> config.mak
      echo "#define ARCH_SPARC 1" >> $TMPH
    
    elif test "$arch" = "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
    
      echo "TARGET_ARCH_MIPS=yes" >> config.mak
      echo "#define ARCH_MIPS 1" >> $TMPH
    
    Alex Beregszaszi's avatar
    Alex Beregszaszi committed
      echo "TARGET_ARCH_SH4=yes" >> config.mak
      echo "#define ARCH_SH4 1" >> $TMPH
    
    elif test "$arch" = "parisc" ; then
    
      echo "TARGET_ARCH_PARISC=yes" >> config.mak
      echo "#define ARCH_PARISC 1" >> $TMPH
    
      echo "TARGET_ARCH_S390=yes" >> config.mak
      echo "#define ARCH_S390 1" >> $TMPH
    
      echo "TARGET_ARCH_M68K=yes" >> config.mak
      echo "#define ARCH_M68K 1" >> $TMPH
    
      echo "TARGET_ARCH_IA64=yes" >> config.mak
      echo "#define ARCH_IA64 1" >> $TMPH
    
      echo "TARGET_ARCH_BFIN=yes" >> config.mak
      echo "#define ARCH_BFIN 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 "$cmov" = "yes" ; then
      echo "TARGET_CMOV=yes" >> config.mak
      echo "#define HAVE_CMOV 1" >> $TMPH
    fi
    
    if test "$armv5te" = "yes" ; then
      echo "TARGET_ARMV5TE=yes" >> config.mak
      echo "#define HAVE_ARMV5TE 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 "$dcbzl" = "yes" ; then
      echo "#define HAVE_DCBZL 1" >> $TMPH
    else
      echo "#undef HAVE_DCBZL" >> $TMPH
    fi
    
    
    if test "$altivec" = "yes" ; then
      echo "TARGET_ALTIVEC=yes" >> config.mak
      echo "#define HAVE_ALTIVEC 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 "#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
    fi
    
    if test "$pthreads" = "yes" ; then
      echo "HAVE_PTHREADS=yes" >> config.mak
      echo "#define HAVE_PTHREADS 1" >> $TMPH
    
    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
    
    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
    
      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 "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
    
    Nick Kurshev's avatar
    Nick Kurshev committed
    fi
    
    echo "LIB_INSTALL_EXTRA_CMD=${LIB_INSTALL_EXTRA_CMD}" >> config.mak
    
    echo "EXTRALIBS=$extralibs" >> config.mak
    
    Diego Biurrun's avatar
    Diego Biurrun committed
    # If you do not want to use encoders, disable them.
    
    if echo "$ENCODER_LIST" | grep -q encoder; then
    
        echo "#define CONFIG_ENCODERS 1" >> $TMPH
        echo "CONFIG_ENCODERS=yes" >> config.mak
    fi
    
    Diego Biurrun's avatar
    Diego Biurrun committed
    # If you do not want to use decoders, disable them.
    
    if echo "$DECODER_LIST" | grep -q decoder; then
    
        echo "#define CONFIG_DECODERS 1" >> $TMPH
        echo "CONFIG_DECODERS=yes" >> config.mak
    fi
    
    if echo "$MUXER_LIST" | grep -q muxer; then
    
      echo "#define CONFIG_MUXERS 1" >> $TMPH
      echo "CONFIG_MUXERS=yes" >> config.mak
    fi
    
    # demuxers
    
    if echo "$DEMUXER_LIST" | grep -q demuxer; 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
    
    
    if test "$swscaler" = "yes" ; then
      echo "#define CONFIG_SWSCALER 1" >> $TMPH
      echo "CONFIG_SWSCALER=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 "$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 "$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