try_exec(){
echo "Trying shell $1"
- type "$1" >/dev/null 2>&1 && exec "$@"
+ type "$1" > /dev/null 2>&1 && exec "$@"
}
unset foo
-(: ${foo%%bar}) 2>/dev/null
+(: ${foo%%bar}) 2> /dev/null
E1="$?"
-(: ${foo?}) 2>/dev/null
+(: ${foo?}) 2> /dev/null
E2="$?"
if test "$E1" != 0 || test "$E2" = 0; then
echo " --logfile=FILE log tests and output to FILE [config.err]"
echo " --disable-logging do not log configure debug information"
echo " --prefix=PREFIX install in PREFIX [$prefix]"
+ echo " --bindir=DIR install binaries in DIR [PREFIX/bin]"
echo " --libdir=DIR install libs in DIR [PREFIX/lib]"
echo " --shlibdir=DIR install shared libs in DIR [PREFIX/lib]"
echo " --incdir=DIR install includes in DIR [PREFIX/include]"
echo " --disable-network disable network support [default=no]"
echo " --disable-ipv6 disable ipv6 support [default=no]"
echo " --disable-zlib disable zlib [default=no]"
+ echo " --disable-bzlib disable bzlib [default=no]"
echo " --disable-vhook disable video hooking support"
echo " --disable-debug disable debugging symbols"
echo " --disable-mpegaudio-hp faster (but less accurate)"
}
log(){
- echo "$@" >>$logfile
+ echo "$@" >> $logfile
}
log_file(){
log BEGIN $1
- pr -n -t $1 >>$logfile
+ pr -n -t $1 >> $logfile
log END $1
}
}
flags_saved(){
- (: ${SAVE_CFLAGS?}) 2>/dev/null
+ (: ${SAVE_CFLAGS?}) 2> /dev/null
}
save_flags(){
check_cmd(){
log "$@"
- "$@" >>$logfile 2>&1
+ "$@" >> $logfile 2>&1
}
check_cc(){
log check_cc "$@"
- cat >$TMPC
+ cat > $TMPC
log_file $TMPC
check_cmd $cc $CFLAGS "$@" -c -o $TMPO $TMPC
}
check_cpp(){
log check_cpp "$@"
- cat >$TMPC
+ cat > $TMPC
log_file $TMPC
check_cmd $cc $CFLAGS "$@" -E -o $TMPO $TMPC
}
}
check_exec(){
- check_ld "$@" && { enabled cross_compile || $TMPE >>$logfile 2>&1; }
+ check_ld "$@" && { enabled cross_compile || $TMPE >> $logfile 2>&1; }
}
check_exec_crash(){
# can redirect the "Terminated" message from the shell. SIGBUS
# is not defined by standard C so it is used conditionally.
- (check_exec "$@") >>$logfile 2>&1 <<EOF
+ (check_exec "$@") >> $logfile 2>&1 <<EOF
#include <signal.h>
static void sighandler(int sig){
raise(SIGTERM);
avfilter_lavf
avisynth
beos_netserver
+ bzlib
ffmpeg
ffplay
ffserver
"
CMDLINE_SET='
arch
+ bindir
build_suffix
cc
cpu
target_os=$(tolower $(uname -s))
# libraries
+enable bzlib
enable zlib
# configurable options
LIB_INSTALL_EXTRA_CMD='$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
# gcc stupidly only outputs the basename of targets with -MM
-DEPEND_CMD='$(CC) $(CFLAGS) -MM -MG $< | sed "1s,^,$(@D)/,"'
+DEPEND_CMD='$(CC) $(CFLAGS) -MM -MG $< | sed -e "/^\#.*/d" -e "1s,^,$(@D)/,"'
# find source path
source_path="`dirname \"$0\"`"
esac
done
+disabled logging && logfile=/dev/null
+
+echo "# $0 $@" > $logfile
+set >> $logfile
+
cc="${cross_prefix}${cc}"
ar="${cross_prefix}${ar}"
nm="${cross_prefix}${nm}"
ranlib="${cross_prefix}${ranlib}"
strip="${cross_prefix}${strip}"
+# set temporary file name
+if test ! -z "$TMPDIR" ; then
+ TMPDIR1="${TMPDIR}"
+elif test ! -z "$TEMPDIR" ; then
+ TMPDIR1="${TEMPDIR}"
+else
+ TMPDIR1="/tmp"
+fi
+
+TMPC="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.c"
+TMPE="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}${EXESUF}"
+TMPH="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.h"
+TMPO="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.o"
+TMPS="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.S"
+TMPSH="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.sh"
+
+case "$arch" in
+ i386|i486|i586|i686|i86pc|BePC)
+ arch="x86_32"
+ enable fast_unaligned
+ ;;
+ x86_64|amd64)
+ arch="x86_32"
+ enable fast_unaligned
+ check_cc <<EOF && enable fast_64bit && arch="x86_64"
+ int test[sizeof(char*) - 7];
+EOF
+ ;;
+ # armv4l is a subset of armv[567]*l
+ arm|armv[4567]*l)
+ arch="armv4l"
+ ;;
+ alpha)
+ arch="alpha"
+ enable fast_64bit
+ ;;
+ "Power Macintosh"|ppc|powerpc)
+ arch="powerpc"
+ ;;
+ ppc64)
+ arch="powerpc"
+ enable fast_64bit
+ ;;
+ mips|mipsel|IP*)
+ arch="mips"
+ ;;
+ sun4u|sparc64)
+ arch="sparc64"
+ enable fast_64bit
+ ;;
+ sparc)
+ arch="sparc"
+ ;;
+ sh4)
+ arch="sh4"
+ ;;
+ parisc)
+ arch="parisc"
+ ;;
+ parisc64)
+ arch="parisc"
+ enable fast_64bit
+ ;;
+ s390|s390x)
+ arch="s390"
+ ;;
+ m68k)
+ arch="m68k"
+ ;;
+ ia64)
+ arch="ia64"
+ enable fast_64bit
+ ;;
+ bfin)
+ arch="bfin"
+ ;;
+ *)
+ arch="unknown"
+ ;;
+esac
+
+enable $arch
+enabled_any x86_32 x86_64 && enable x86
+enabled sparc64 && enable sparc
+
# OS specific
case $target_os in
beos|haiku|zeta)
;;
mingw32*)
target_os=mingw32
+ LIBTARGET=i386
+ if test $arch = x86_64; then
+ disable need_memalign
+ LIBTARGET=x64
+ fi
shlibdir="$bindir"
VHOOKSHFLAGS='-shared -L$(BUILD_ROOT)/libavformat -L$(BUILD_ROOT)/libavcodec -L$(BUILD_ROOT)/libavutil'
VHOOKLIBS='-lavformat$(BUILDSUF) -lavcodec$(BUILDSUF) -lavutil$(BUILDSUF) $(EXTRALIBS)'
EXESUF=".exe"
SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
- SLIB_EXTRA_CMD='-lib /machine:i386 /def:$$(@:$(SLIBSUF)=.def)'
- SLIB_INSTALL_EXTRA_CMD='-install -m 644 $(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib) "$(SHLIBDIR)/$(SLIBNAME:$(SLIBSUF)=.lib)"'
+ SLIB_EXTRA_CMD='-lib /machine:$(LIBTARGET) /def:$$(@:$(SLIBSUF)=.def) /out:$(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib)'
+ SLIB_INSTALL_EXTRA_CMD='-install -m 644 $(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib) "$(SHLIBDIR)/$(SLIBNAME:$(SLIBSUF)=.lib)"; \
+ install -m 644 $(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib) "$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib)"'
SLIB_UNINSTALL_EXTRA_CMD='rm -f "$(SHLIBDIR)/$(SLIBNAME:$(SLIBSUF)=.lib)"'
SHFLAGS='-shared -Wl,--output-def,$$(@:$(SLIBSUF)=.def) -Wl,--enable-runtime-pseudo-reloc -Wl,--enable-auto-image-base'
;;
;;
esac
-# set temporary file name
-if test ! -z "$TMPDIR" ; then
- TMPDIR1="${TMPDIR}"
-elif test ! -z "$TEMPDIR" ; then
- TMPDIR1="${TEMPDIR}"
-else
- TMPDIR1="/tmp"
-fi
-
-TMPC="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.c"
-TMPE="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}${EXESUF}"
-TMPH="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.h"
-TMPO="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.o"
-TMPS="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.S"
-TMPSH="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.sh"
-
-
add_extralibs $osextralibs
-disabled logging && logfile=/dev/null
-
-echo "# $0 $@" >$logfile
-set >>$logfile
-
-case "$arch" in
- i386|i486|i586|i686|i86pc|BePC)
- arch="x86_32"
- enable fast_unaligned
- ;;
- x86_64|amd64)
- arch="x86_32"
- enable fast_unaligned
- check_cc <<EOF && enable fast_64bit && arch="x86_64"
- int test[sizeof(char*) - 7];
-EOF
- ;;
- # armv4l is a subset of armv[567]*l
- arm|armv[4567]*l)
- arch="armv4l"
- ;;
- alpha)
- arch="alpha"
- enable fast_64bit
- ;;
- "Power Macintosh"|ppc|powerpc)
- arch="powerpc"
- ;;
- ppc64)
- arch="powerpc"
- enable fast_64bit
- ;;
- mips|mipsel|IP*)
- arch="mips"
- ;;
- sun4u|sparc64)
- arch="sparc64"
- enable fast_64bit
- ;;
- sparc)
- arch="sparc"
- ;;
- sh4)
- arch="sh4"
- ;;
- parisc)
- arch="parisc"
- ;;
- parisc64)
- arch="parisc"
- enable fast_64bit
- ;;
- s390|s390x)
- arch="s390"
- ;;
- m68k)
- arch="m68k"
- ;;
- ia64)
- arch="ia64"
- enable fast_64bit
- ;;
- bfin)
- arch="bfin"
- ;;
- *)
- arch="unknown"
- ;;
-esac
-
-enable $arch
-enabled_any x86_32 x86_64 && enable x86
-enabled sparc64 && enable sparc
-
# Combine FFLDFLAGS and the LDFLAGS environment variable.
LDFLAGS="$FFLDFLAGS $LDFLAGS"
fi
# make sure we can execute files in $TMPDIR
-cat >$TMPSH 2>>$logfile <<EOF
+cat > $TMPSH 2>> $logfile <<EOF
#! /bin/sh
EOF
-chmod +x $TMPSH >>$logfile 2>&1
-if ! $TMPSH >>$logfile 2>&1; then
+chmod +x $TMPSH >> $logfile 2>&1
+if ! $TMPSH >> $logfile 2>&1; then
cat <<EOF
Unable to create and execute files in $TMPDIR1. Set the TMPDIR environment
variable to another directory and make sure that $TMPDIR1 is not mounted
die "Error, no memalign() but SSE enabled, disable it or use --enable-memalign-hack."
fi
-enabled zlib && check_lib zlib.h zlibVersion -lz || disable zlib
+enabled zlib && check_lib zlib.h zlibVersion -lz || disable zlib
+enabled bzlib && check_lib bzlib.h BZ2_bzlibVersion -lbz2 || disable bzlib
# ffserver uses poll(),
# if it's not found we can emulate it using select().
enabled libmp3lame && require LAME lame/lame.h lame_init -lmp3lame -lm
enabled libnut && require libnut libnut.h nut_demuxer_init -lnut
enabled libschroedinger && add_cflags $(pkg-config --cflags schroedinger-1.0) \
- && require libschroedinger schroedinger/schro.h schro_init -lschroedinger-1.0 -lpthread -loil-0.3 -lm -lrt
+ && require libschroedinger schroedinger/schro.h schro_init $(pkg-config --libs schroedinger-1.0)
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 x264 x264.h x264_encoder_open -lx264 -lm
disable sdl_too_old
disable sdl
SDL_CONFIG="${cross_prefix}sdl-config"
-if "${SDL_CONFIG}" --version >/dev/null 2>&1; then
+if "${SDL_CONFIG}" --version > /dev/null 2>&1; then
sdl_cflags=`"${SDL_CONFIG}" --cflags`
temp_cflags $sdl_cflags
temp_extralibs `"${SDL_CONFIG}" --libs`
restore_flags
fi
-texi2html -version >/dev/null 2>&1 && enable texi2html || disable texi2html
+texi2html -version > /dev/null 2>&1 && enable texi2html || disable texi2html
check_type sys/socket.h socklen_t
# 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
fi
# PIC flags for shared library objects where they are needed
echo "libschroedinger enabled ${libschroedinger-no}"
echo "libtheora enabled ${libtheora-no}"
echo "libvorbis enabled ${libvorbis-no}"
-echo "x264 enabled ${libx264-no}"
-echo "XviD enabled ${libxvid-no}"
+echo "libx264 enabled ${libx264-no}"
+echo "libxvid enabled ${libxvid-no}"
echo "zlib enabled ${zlib-no}"
+echo "bzlib enabled ${bzlib-no}"
echo
for type in decoder encoder parser demuxer muxer protocol filter bsf indev outdev; do
echo
done
-enabled nonfree &&
- echo "License: unredistributable" ||
- (enabled gpl &&
- echo "License: GPL" ||
- echo "License: LGPL")
+license="LGPL"
+if enabled nonfree; then
+ license="unredistributable"
+elif enabled gpl; then
+ license="GPL"
+fi
+
+echo "License: $license"
echo "Creating config.mak and config.h..."
echo "#define FFMPEG_CONFIGURATION \"$FFMPEG_CONFIGURATION\"" >> $TMPH
echo "PREFIX=$prefix" >> config.mak
-echo "prefix=\$(DESTDIR)\$(PREFIX)" >> config.mak
echo "LIBDIR=\$(DESTDIR)$libdir" >> config.mak
echo "SHLIBDIR=\$(DESTDIR)$shlibdir" >> config.mak
echo "INCDIR=\$(DESTDIR)$incdir" >> config.mak
echo "STRIP=echo ignoring strip" >> config.mak
echo "OPTFLAGS=$CFLAGS" >> config.mak
-echo "VHOOKCFLAGS=$VHOOKCFLAGS">>config.mak
+echo "VHOOKCFLAGS=$VHOOKCFLAGS" >> config.mak
echo "LDFLAGS=$LDFLAGS" >> config.mak
echo "FFSERVERLDFLAGS=$FFSERVERLDFLAGS" >> config.mak
echo "SHFLAGS=$SHFLAGS" >> config.mak
if enabled shared; then
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
version=$3
libs=$4
requires=$5
-cat <<EOF >$name.pc
+cat <<EOF > $name.pc
prefix=$prefix
exec_prefix=\${prefix}
libdir=$libdir
Name: $name
Description: $comment
Version: $version
-Requires: $requires
+Requires: $(disabled shared && echo $requires)
+Requires.private: $(enabled shared && echo $requires)
Conflicts:
-Libs: -L\${libdir} -l${shortname}
-Libs.private: $libs
+Libs: -L\${libdir} -l${shortname} $(disabled shared && echo $libs)
+Libs.private: $(enabled shared && echo $libs)
Cflags: -I\${includedir}
EOF
-cat <<EOF >$name-uninstalled.pc
+cat <<EOF > $name-uninstalled.pc
prefix=
exec_prefix=
libdir=\${pcfiledir}/$name
Version: $version
Requires: $requires
Conflicts:
-Libs: \${libdir}/${LIBPREF}${shortname}${LIBSUF}
-Libs.private: $libs
+Libs: \${libdir}/${LIBPREF}${shortname}${LIBSUF} $libs
Cflags: -I\${includedir}
EOF
}