Skip to content
Snippets Groups Projects
configure 78.3 KiB
Newer Older
# AltiVec flags: The FSF version of GCC differs from the Apple version
if enabled altivec; then
    check_cflags -maltivec -mabi=altivec &&
        { check_header altivec.h && inc_altivec_h="#include <altivec.h>" ; } ||
Måns Rullgård's avatar
Måns Rullgård committed
    # check if our compiler supports Motorola AltiVec C API
    check_cc <<EOF || disable altivec
int main(void) {
    vector signed int v1, v2, v3;
    v1 = vec_add(v2,v3);
    return 0;
}
EOF

    # check if our compiler supports braces for vector declarations
    check_cc <<EOF || die "You need a compiler that supports {} in AltiVec vector declarations."
int main (void) { (vector int) {1}; return 0; }
# We have to check if pld is a nop and disable it.
enabled arm     && check_asm pld     '"pld [r0]"'
enabled armv5te && check_asm armv5te '"qadd r0, r0, r0"'
enabled armv6   && check_asm armv6   '"sadd16 r0, r0, r0"'
enabled armv6t2 && check_asm armv6t2 '"movt r0, #0"'
enabled armvfp  && check_asm armvfp  '"fadds s0, s0, s0"'
enabled iwmmxt  && check_asm iwmmxt  '"wunpckelub wr6, wr4"'
enabled mmi     && check_asm mmi     '"lq $2, 0($2)"'
enabled neon    && check_asm neon    '"vadd.i16 q0, q0, q0"'
enabled vis     && check_asm vis     '"pdist %f0, %f0, %f0"' -mcpu=ultrasparc
enabled vis && add_cflags -mcpu=ultrasparc -mtune=ultrasparc
check_cc <<EOF || die "endian test failed"
unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
od -A n -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian
if check_func dlopen; then
    ldl=
elif check_func dlopen -ldl; then
    ldl=-ldl
# Solaris has nanosleep in -lrt, OpenSolaris no longer needs that
check_func nanosleep || { check_func nanosleep -lrt && add_extralibs -lrt; }

check_func  fork
check_func  gethrtime
check_func  getrusage
check_func  inet_aton $network_extralibs
check_func  posix_memalign
check_func_headers io.h setmode
check_func_headers lzo/lzo1x.h lzo1x_999_compress
check_func_headers windows.h GetProcessTimes
check_func_headers windows.h VirtualAlloc
check_header dlfcn.h
check_header malloc.h
check_header sys/resource.h
check_header termios.h
check_header vdpau/vdpau.h
check_header vdpau/vdpau_x11.h
check_header X11/extensions/XvMClib.h
if ! enabled_any memalign memalign_hack posix_memalign malloc_aligned &&
     enabled_any $need_memalign ; then
    die "Error, no aligned memory allocator but SSE enabled, disable it or use --enable-memalign-hack."
disabled  zlib || check_lib   zlib.h      zlibVersion -lz   || disable  zlib
disabled bzlib || check_lib2 bzlib.h BZ2_bzlibVersion -lbz2 || disable bzlib

# 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
Måns Rullgård's avatar
Måns Rullgård committed
    if check_func pthread_create; then
        :
    elif check_func pthread_create -pthread; then
        add_cflags -pthread
Måns Rullgård's avatar
Måns Rullgård committed
    elif check_func pthread_create -pthreads; then
        add_cflags -pthreads
    elif check_func pthread_create -lpthreadGC2; then
        add_extralibs -lpthreadGC2
Måns Rullgård's avatar
Måns Rullgård committed
    elif ! check_lib pthread.h pthread_create -lpthread; then
        die "ERROR: can't find pthreads library"
    fi
        test -n "$thread_type" &&
            die "ERROR: Only one thread type must be selected." ||
Måns Rullgård's avatar
Måns Rullgård committed
check_lib math.h sin -lm
Gwenole Beauchesne's avatar
Gwenole Beauchesne committed
check_lib va/va.h vaInitialize -lva
Måns Rullgård's avatar
Måns Rullgård committed

check_func llrint
check_func log2
check_func lrint
check_func lrintf
check_func round
check_func roundf
check_func truncf
# these are off by default, so fail if requested and not available
enabled avisynth   && require2 vfw32 "windows.h vfw.h" AVIFileInit -lvfw32
enabled libdirac   && add_cflags $(pkg-config --cflags dirac) &&
                      require  libdirac libdirac_decoder/dirac_parser.h dirac_decoder_init -ldirac_decoder &&
                      require  libdirac libdirac_encoder/dirac_encoder.h dirac_encoder_init -ldirac_encoder
enabled libfaac    && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
enabled libfaad    && require2 libfaad faad.h faacDecOpen -lfaad
enabled libgsm     && require  libgsm gsm.h gsm_create -lgsm
enabled libmp3lame && require  libmp3lame lame/lame.h lame_init -lmp3lame -lm
enabled libnut     && require  libnut libnut.h nut_demuxer_init -lnut
enabled libopencore_amrnb  && require libopencore_amrnb opencore-amrnb/interf_dec.h Decoder_Interface_init -lopencore-amrnb -lm
enabled libopencore_amrwb  && require libopencore_amrwb opencore-amrwb/dec_if.h D_IF_init -lopencore-amrwb -lm
enabled libopenjpeg && require libopenjpeg openjpeg.h opj_version -lopenjpeg
enabled libschroedinger && add_cflags $(pkg-config --cflags schroedinger-1.0) &&
                           require libschroedinger schroedinger/schro.h schro_init $(pkg-config --libs schroedinger-1.0)
enabled libspeex   && require  libspeex speex/speex.h speex_decoder_init -lspeex
enabled libtheora  && require  libtheora theora/theora.h theora_info_init -ltheora -logg
enabled libvorbis  && require  libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg
enabled libx264    && require  libx264 x264.h x264_encoder_open -lx264 -lm &&
                      { check_cpp_condition x264.h "X264_BUILD >= 65" ||
                        die "ERROR: libx264 version must be >= 0.65."; }
enabled libxvid    && require  libxvid xvid.h xvid_global -lxvidcore
enabled mlib       && require  mediaLib mlib_types.h mlib_VectorSub_S16_U8_Mod -lmlib
# libdc1394 check
if enabled libdc1394; then
    { check_lib dc1394/dc1394.h dc1394_new -ldc1394 -lraw1394 &&
        enable libdc1394_2; } ||
    { check_lib libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394 &&
        enable libdc1394_1; } ||
    die "ERROR: No version of libdc1394 found "
fi


_restrict=
for restrict_keyword in restrict __restrict__ __restrict; do
    check_cc <<EOF && _restrict=$restrict_keyword && break
void foo(char * $restrict_keyword p);
EOF
check_cc <<EOF && enable attribute_packed
struct { int x; } __attribute__((packed)) x;
EOF

disable sdl_too_old
disable sdl
SDL_CONFIG="${cross_prefix}sdl-config"
if "${SDL_CONFIG}" --version > /dev/null 2>&1; then
    sdl_cflags=$("${SDL_CONFIG}" --cflags)
Måns Rullgård's avatar
Måns Rullgård committed
    temp_cflags $sdl_cflags
    temp_extralibs $("${SDL_CONFIG}" --libs)
    if check_lib2 SDL.h SDL_Init; then
        _sdlversion=$("${SDL_CONFIG}" --version | sed 's/[^0-9]//g')
        if test "$_sdlversion" -lt 121 ; then
            enable sdl_too_old
Måns Rullgård's avatar
Måns Rullgård committed
            check_cc $sdl_cflags <<EOF && enable sdl_video_size
int main(int argc, char **argv){
    const SDL_VideoInfo *vi = SDL_GetVideoInfo();
    int w = vi->current_w;
    return 0;
}
EOF
texi2html -version > /dev/null 2>&1 && enable texi2html || disable texi2html
if enabled network; then
    check_type "sys/types.h sys/socket.h" socklen_t
    # Prefer arpa/inet.h over winsock2
    if check_header arpa/inet.h ; then
        check_func closesocket
    elif check_header winsock2.h ; then
        check_func_headers winsock2.h closesocket -lws2 && \
            network_extralibs="-lws2" || \
        { check_func_headers winsock2.h closesocket -lws2_32 && \
            network_extralibs="-lws2_32"; }
        check_type ws2tcpip.h socklen_t
enabled network && enabled ipv6 && check_ld <<EOF && enable ipv6 || disable ipv6
#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_header linux/videodev.h
check_header linux/videodev2.h
check_header sys/videoio.h
check_func_headers "windows.h vfw.h" capCreateCaptureWindow -lvfw32
Ramiro Polla's avatar
Ramiro Polla committed

# check for ioctl_meteor.h, ioctl_bt848.h and alternatives
Ramiro Polla's avatar
Ramiro Polla committed
{ check_header dev/bktr/ioctl_meteor.h &&
  check_header dev/bktr/ioctl_bt848.h; } ||
{ check_header machine/ioctl_meteor.h &&
  check_header machine/ioctl_bt848.h; } ||
{ check_header dev/video/meteor/ioctl_meteor.h &&
  check_header dev/video/bktr/ioctl_bt848.h; } ||
check_header dev/ic/bt8xx.h
check_header sys/soundcard.h
check_header soundcard.h
enabled alsa_demuxer || enabled alsa_muxer && check_lib2 alsa/asoundlib.h snd_pcm_htimestamp -lasound
enabled jack_demuxer && check_lib2 jack/jack.h jack_client_open -ljack
check_header X11/Xlib.h                 &&
check_header X11/extensions/XShm.h      &&
check_func XOpenDisplay -lX11           &&
check_func XShmCreateImage -lX11 -lXext
enabled debug && add_cflags -g"$debuglevel"

# 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 -Wno-pointer-sign
check_cflags -Wcast-qual
check_cflags -Wwrite-strings
enabled extra_warnings && check_cflags -Winline
check_ldflags -Wl,--warn-common
check_ldflags -Wl,--as-needed
check_ldflags '-Wl,-rpath-link,\$(BUILD_ROOT)/libpostproc -Wl,-rpath-link,\$(BUILD_ROOT)/libswscale -Wl,-rpath-link,\$(BUILD_ROOT)/libavfilter -Wl,-rpath-link,\$(BUILD_ROOT)/libavdevice -Wl,-rpath-link,\$(BUILD_ROOT)/libavformat -Wl,-rpath-link,\$(BUILD_ROOT)/libavcodec -Wl,-rpath-link,\$(BUILD_ROOT)/libavutil'
check_ldflags -Wl,-Bsymbolic
if enabled small; then
    check_cflags -Os            # not all compilers support -Os
    optimizations="small"
elif enabled optimizations; then
        add_cflags  -O5
        add_ldflags -O5
    elif enabled ccc; then
        add_cflags -fast
        add_cflags -O3
check_cflags -fno-math-errno
Måns Rullgård's avatar
Måns Rullgård committed
    # Just warnings, no remarks
    check_cflags -w1
    # -wd: Disable following warnings
    # 144, 167, 556: -Wno-pointer-sign
    # 10006: ignoring unknown option -fno-signed-zeros
    # 10156: ignoring option '-W'; no argument required
    check_cflags -wd144,167,556,10006,10156
    # 11030: Warning unknown option --as-needed
    # 10156: ignoring option '-export'; no argument required
    check_ldflags -wd10156,11030
    # Allow to compile with optimizations
    check_ldflags -march=$cpu
    # icc 11.0 and 11.1 work with ebp_available, but don't pass the test
    enable ebp_available
elif enabled ccc; then
    # disable some annoying warnings
    add_cflags -msg_disable cvtu32to64
    add_cflags -msg_disable embedcomment
    add_cflags -msg_disable needconstext
    add_cflags -msg_disable nomainieee
    add_cflags -msg_disable ptrmismatch1
    add_cflags -msg_disable unreachcode
elif enabled gcc; then
    check_cflags -fno-tree-vectorize
# PIC flags for shared library objects where they are needed
    # LIBOBJFLAGS may have already been set in the OS configuration
    if test -z "$LIBOBJFLAGS" ; then
        case "${subarch-$arch}" in
            x86_64|ia64|alpha|sparc*|power*|parisc*|mips*) LIBOBJFLAGS='$(PIC)' ;;
    add_cflags  -p
    add_ldflags -p
Diego Biurrun's avatar
Diego Biurrun committed
# Find out if the .align argument is a power of two or not.
check_asm asmalign_pot '".align 3"'
enabled_any $DECODER_LIST      && enable decoders
enabled_any $ENCODER_LIST      && enable encoders
enabled_any $HWACCEL_LIST      && enable hwaccels
enabled_any $BSF_LIST          && enable bsfs
enabled_any $DEMUXER_LIST      && enable demuxers
enabled_any $MUXER_LIST        && enable muxers
enabled_any $INDEV_LIST        && enable demuxers
enabled_any $OUTDEV_LIST       && enable muxers
enabled_any $PROTOCOL_LIST     && enable protocols

enabled_any $THREADS_LIST      && enable threads

check_deps $CONFIG_LIST       \
           $PARSER_LIST       \
           $BSF_LIST          \
           $DEMUXER_LIST      \
           $MUXER_LIST        \
echo "install prefix            $prefix"
Diego Biurrun's avatar
Diego Biurrun committed
echo "source path               $source_path"
echo "C compiler                $cc"
Diego Biurrun's avatar
Diego Biurrun committed
echo ".align is power-of-two    $asmalign_pot"
Diego Biurrun's avatar
Diego Biurrun committed
echo "ARCH                      $arch ($cpu)"
if test "$build_suffix" != ""; then
    echo "build suffix              $build_suffix"
if test "$extra_version" != ""; then
    echo "version string suffix     $extra_version"
fi
echo "big-endian                ${bigendian-no}"
echo "runtime cpu detection     ${runtime_cpudetect-no}"
    echo "yasm                      ${yasm-no}"
    echo "MMX enabled               ${mmx-no}"
    echo "MMX2 enabled              ${mmx2-no}"
    echo "3DNow! extended enabled   ${amd3dnowext-no}"
    echo "SSE enabled               ${sse-no}"
    echo "SSSE3 enabled             ${ssse3-no}"
    echo "CMOV enabled              ${cmov-no}"
    echo "CMOV is fast              ${fast_cmov-no}"
    echo "EBX available             ${ebx_available-no}"
    echo "EBP available             ${ebp_available-no}"
    echo "10 operands supported     ${ten_operands-no}"
    echo "ARMv5TE enabled           ${armv5te-no}"
    echo "ARMv6 enabled             ${armv6-no}"
    echo "ARMv6T2 enabled           ${armv6t2-no}"
    echo "ARM VFP enabled           ${armvfp-no}"
    echo "IWMMXT enabled            ${iwmmxt-no}"
    echo "NEON enabled              ${neon-no}"
    echo "MMI enabled               ${mmi-no}"
    echo "AltiVec enabled           ${altivec-no}"
    echo "PPC 4xx optimizations     ${ppc4xx-no}"
    echo "dcbzl available           ${dcbzl-no}"
    echo "performance report        ${powerpc_perf-no}"
fi
if enabled sparc; then
    echo "VIS enabled               ${vis-no}"
echo "gprof enabled             ${gprof-no}"
echo "debug symbols             ${debug-no}"
echo "strip symbols             ${stripping-no}"
echo "optimizations             ${optimizations-no}"
echo "static                    ${static-no}"
echo "shared                    ${shared-no}"
echo "postprocessing support    ${postproc-no}"
echo "filters using lavformat   ${avfilter_lavf-no}"
echo "network support           ${network-no}"
    echo "IPv6 support              ${ipv6-no}"
echo "threading support         ${thread_type-no}"
echo "SDL support               ${sdl-no}"
if enabled sdl_too_old; then
Diego Biurrun's avatar
Diego Biurrun committed
    echo "-> Your SDL version is too old - please upgrade to have FFplay/SDL support."
fi
echo "Sun medialib support      ${mlib-no}"
echo "AVISynth enabled          ${avisynth-no}"
Ramiro Polla's avatar
Ramiro Polla committed
echo "libdc1394 support         ${libdc1394-no}"
echo "libdirac enabled          ${libdirac-no}"
echo "libfaac enabled           ${libfaac-no}"
echo "libfaad enabled           ${libfaad-no}"
echo "libfaad dlopened          ${libfaadbin-no}"
echo "libgsm enabled            ${libgsm-no}"
echo "libmp3lame enabled        ${libmp3lame-no}"
echo "libnut enabled            ${libnut-no}"
echo "libopencore-amrnb support ${libopencore_amrnb-no}"
echo "libopencore-amrwb support ${libopencore_amrwb-no}"
echo "libopenjpeg enabled       ${libopenjpeg-no}"
echo "libschroedinger enabled   ${libschroedinger-no}"
echo "libspeex enabled          ${libspeex-no}"
echo "libtheora enabled         ${libtheora-no}"
echo "libvorbis enabled         ${libvorbis-no}"
echo "libx264 enabled           ${libx264-no}"
echo "libxvid enabled           ${libxvid-no}"
echo "zlib enabled              ${zlib-no}"
echo "bzlib enabled             ${bzlib-no}"
Fabrice Bellard's avatar
Fabrice Bellard committed

for type in decoder encoder hwaccel parser demuxer muxer protocol filter bsf indev outdev; do
    echo "Enabled ${type}s:"
    eval list=\$$(toupper $type)_LIST
    for part in $list; do
        enabled $part && echo ${part%_*}
    done | sort | pr -3 -t
    echo
license="LGPL version 2.1 or later"
if enabled nonfree; then
    license="nonfree and unredistributable"
elif enabled gplv3; then
    license="GPL version 3 or later"
elif enabled lgplv3; then
    license="LGPL version 3 or later"
elif enabled gpl; then
    license="GPL version 2 or later"
echo "Creating config.mak and config.h..."

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 "#ifndef FFMPEG_CONFIG_H" >> $TMPH
echo "#define FFMPEG_CONFIG_H" >> $TMPH
echo "#define FFMPEG_CONFIGURATION \"$(c_escape $FFMPEG_CONFIGURATION)\"" >> $TMPH
echo "#define FFMPEG_DATADIR \"$(eval c_escape $datadir)\"" >> $TMPH
Fabrice Bellard's avatar
Fabrice Bellard committed

echo "ifndef FFMPEG_CONFIG_MAK" >> config.mak
echo "FFMPEG_CONFIG_MAK=1" >> config.mak

echo "FFMPEG_CONFIGURATION=$FFMPEG_CONFIGURATION" >> config.mak
echo "prefix=$prefix" >> config.mak
echo "LIBDIR=\$(DESTDIR)$libdir" >> config.mak
echo "SHLIBDIR=\$(DESTDIR)$shlibdir" >> config.mak
echo "INCDIR=\$(DESTDIR)$incdir" >> config.mak
echo "BINDIR=\$(DESTDIR)$bindir" >> config.mak
echo "DATADIR=\$(DESTDIR)$datadir" >> config.mak
echo "MANDIR=\$(DESTDIR)$mandir" >> config.mak
echo "SRC_PATH=\"$source_path\"" >> config.mak
echo "SRC_PATH_BARE=$source_path" >> config.mak
echo "BUILD_ROOT=\"$PWD\"" >> config.mak
echo "CC=$cc" >> config.mak
echo "AS=$as" >> config.mak
echo "LD=$ld" >> config.mak
echo "DEPCC=$dep_cc" >> config.mak
Loren Merritt's avatar
Loren Merritt committed
echo "YASM=$yasmexe" >> config.mak
echo "AR=$ar" >> config.mak
Michael Niedermayer's avatar
Michael Niedermayer committed
echo "RANLIB=$ranlib" >> config.mak
echo "LN_S=$ln_s" >> config.mak
    echo "STRIP=$strip" >> config.mak ||
Måns Rullgård's avatar
Måns Rullgård committed
    echo "STRIP=echo ignoring strip" >> config.mak
echo "CPPFLAGS=$CPPFLAGS" >> config.mak
echo "CFLAGS=$CFLAGS" >> config.mak
echo "ASFLAGS=$ASFLAGS" >> config.mak
echo "CC_O=$CC_O" >> config.mak
echo "FFSERVERLDFLAGS=$FFSERVERLDFLAGS" >> config.mak
echo "SHFLAGS=$SHFLAGS" >> config.mak
Loren Merritt's avatar
Loren Merritt committed
echo "YASMFLAGS=$YASMFLAGS" >> config.mak
echo "LIBOBJFLAGS=$LIBOBJFLAGS" >> config.mak
echo "BUILD_STATIC=$static" >> config.mak
echo "BUILDSUF=$build_suffix" >> config.mak
echo "FULLNAME=$FULLNAME" >> config.mak
echo "LIBPREF=$LIBPREF" >> config.mak
echo "LIBSUF=$LIBSUF" >> config.mak
echo "LIBNAME=$LIBNAME" >> config.mak
echo "SLIBPREF=$SLIBPREF" >> config.mak
echo "SLIBSUF=$SLIBSUF" >> config.mak
echo "EXESUF=$EXESUF" >> config.mak
echo "EXTRA_VERSION=$extra_version" >> config.mak
echo "DEPEND_CMD=$DEPEND_CMD" >> config.mak
echo "DEPFLAGS=$DEPFLAGS" >> config.mak
echo "HOSTCC=$host_cc" >> config.mak
echo "HOSTCFLAGS=$host_cflags" >> config.mak
echo "HOSTEXESUF=$HOSTEXESUF" >> config.mak
echo "HOSTLDFLAGS=$host_ldflags" >> config.mak
echo "HOSTLIBS=$host_libs" >> config.mak
echo "TARGET_EXEC=$target_exec" >> config.mak
echo "TARGET_PATH=$target_path" >> config.mak
if enabled bigendian; then
    echo "WORDS_BIGENDIAN=yes" >> config.mak
    echo "#define WORDS_BIGENDIAN 1" >> $TMPH
    echo "SDL_LIBS=$("${SDL_CONFIG}" --libs)" >> config.mak
    echo "SDL_CFLAGS=$("${SDL_CONFIG}" --cflags)" >> config.mak
if enabled texi2html; then
get_version(){
    name=$1
    file=$source_path/$2
    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 LIBSWSCALE  libswscale/swscale.h
get_version LIBPOSTPROC libpostproc/postprocess.h
get_version LIBAVCODEC  libavcodec/avcodec.h
get_version LIBAVDEVICE libavdevice/avdevice.h
get_version LIBAVFORMAT libavformat/avformat.h
get_version LIBAVUTIL   libavutil/avutil.h
get_version LIBAVFILTER libavfilter/avfilter.h
    echo "BUILD_SHARED=yes" >> config.mak
    echo "PIC=-fPIC -DPIC" >> config.mak
    echo "LIBTARGET=${LIBTARGET}" >> 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_CREATE_DEF_CMD=${SLIB_CREATE_DEF_CMD}" >> config.mak
    echo "SLIB_EXTRA_CMD=${SLIB_EXTRA_CMD}" >> config.mak
    echo "SLIB_INSTALL_EXTRA_CMD=${SLIB_INSTALL_EXTRA_CMD}" >> config.mak
    echo "SLIB_UNINSTALL_EXTRA_CMD=${SLIB_UNINSTALL_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
print_config ARCH_   $TMPH config.mak $ARCH_LIST
print_config HAVE_   $TMPH config.mak $HAVE_LIST
print_config CONFIG_ $TMPH config.mak $CONFIG_LIST       \
                                      $PARSER_LIST       \
                                      $BSF_LIST          \
                                      $DEMUXER_LIST      \
                                      $MUXER_LIST        \
echo "#define restrict $_restrict" >> $TMPH

    echo "#define av_always_inline"  >> $TMPH
# Apparently it's not possible to portably echo a backslash.
enabled asmalign_pot &&
    printf '#define ASMALIGN(ZEROBITS) ".align " #ZEROBITS "\\n\\t"\n' >> $TMPH ||
Diego Biurrun's avatar
Diego Biurrun committed
    printf '#define ASMALIGN(ZEROBITS) ".align 1 << " #ZEROBITS "\\n\\t"\n' >> $TMPH
echo "#define EXTERN_PREFIX \"${extern_prefix}\"" >> $TMPH
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.
cmp -s $TMPH config.h &&
    echo "config.h is unchanged" ||
    mv -f $TMPH config.h
# build tree in object directory if source path is different from current one
if enabled source_path_used; then
        libavcodec/arm    \
        libavcodec/bfin   \
        libavcodec/mlib   \
        libavcodec/ppc    \
        libavcodec/sh4    \
        libavcodec/sparc  \
        libswscale/bfin   \
        libswscale/mlib   \
        libswscale/ppc    \
        libswscale/sparc  \
        libswscale/x86    \
Måns Rullgård's avatar
Måns Rullgård committed
        subdir.mak           \
        libavformat/Makefile \
        libavutil/Makefile   \
        libpostproc/Makefile \
        libswscale/Makefile  \
        "
    for dir in $DIRS ; do
    done
    for f in $FILES ; do
# build pkg-config files
pkgconfig_generate(){
name=$1
shortname=${name#lib}${build_suffix}
comment=$2
version=$3
libs=$4
requires=$5
exec_prefix=\${prefix}
Name: $name
Description: $comment
Version: $version
Requires: $(disabled shared && echo $requires)
Requires.private: $(enabled shared && echo $requires)
Libs: -L\${libdir} -l${shortname} $(disabled shared && echo $libs)
Libs.private: $(enabled shared && echo $libs)
Cflags: -I\${includedir}
cat <<EOF > $name/$name-uninstalled.pc
libdir=\${pcfiledir}
includedir=${source_path}
Name: $name
Description: $comment
Version: $version
Requires: $requires
Libs: \${libdir}/${LIBPREF}${shortname}${LIBSUF} $libs
pkgconfig_generate libavutil "FFmpeg utility library" "$LIBAVUTIL_VERSION"
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" "libavformat = $LIBAVFORMAT_VERSION"
enabled avfilter &&
    pkgconfig_generate libavfilter "FFmpeg video filtering library" "$LIBAVFILTER_VERSION" "$extralibs" "libavutil = $LIBAVUTIL_VERSION"
enabled postproc &&
    pkgconfig_generate libpostproc "FFmpeg post processing library" "$LIBPOSTPROC_VERSION"
pkgconfig_generate libswscale "FFmpeg image rescaling library" "$LIBSWSCALE_VERSION" "" "libavutil = $LIBAVUTIL_VERSION"