available options:
--help print this message
+ --disable-cli disables cli
+ --system-libx264 use system libx264 instead of internal
+ --enable-shared build shared library
+ --enable-static build static library
--disable-avs disables avisynth support (windows only)
--disable-lavf disables libavformat support
--disable-ffms disables ffmpegsource support
--enable-win32thread use win32threads (windows only)
--disable-swscale disables swscale support
--disable-asm disables platform-specific assembly optimizations
- --enable-debug adds -g, doesn't strip
- --enable-gprof adds -pg, doesn't strip
+ --disable-interlaced disables interlaced encoding support
+ --enable-debug adds -g
+ --enable-gprof adds -pg
+ --enable-strip adds -s
--enable-visualize enables visualization (X11 only)
--enable-pic build position-independent code
- --enable-shared build shared library
--bit-depth=BIT_DEPTH sets output bit depth (8-10), default 8
--extra-asflags=EASFLAGS add EASFLAGS to ASFLAGS
--extra-cflags=ECFLAGS add ECFLAGS to CFLAGS
includedir='${prefix}/include'
DEVNULL='/dev/null'
+cli="yes"
+cli_libx264="internal"
+shared="no"
+static="no"
avs="auto"
lavf="auto"
ffms="auto"
thread="auto"
swscale="auto"
asm="auto"
+interlaced="yes"
debug="no"
gprof="no"
+strip="no"
pic="no"
vis="no"
-shared="no"
bit_depth="8"
compiler="GNU"
EXE=""
# list of all preprocessor HAVE values we can define
-CONFIG_HAVE="MALLOC_H ALTIVEC ALTIVEC_H MMX ARMV6 ARMV6T2 NEON BEOSTHREAD POSIXTHREAD WIN32THREAD THREAD LOG2F VISUALIZE SWSCALE LAVF FFMS GPAC GF_MALLOC AVS GPL VECTOREXT"
+CONFIG_HAVE="MALLOC_H ALTIVEC ALTIVEC_H MMX ARMV6 ARMV6T2 NEON BEOSTHREAD POSIXTHREAD WIN32THREAD THREAD LOG2F VISUALIZE SWSCALE LAVF FFMS GPAC GF_MALLOC AVS GPL VECTOREXT INTERLACED"
# parse options
--includedir=*)
includedir="$optarg"
;;
+ --disable-cli)
+ cli="no"
+ ;;
+ --system-libx264)
+ cli_libx264="system"
+ ;;
+ --enable-shared)
+ shared="yes"
+ ;;
+ --enable-static)
+ static="yes"
+ ;;
--disable-asm)
asm="no"
;;
+ --disable-interlaced)
+ interlaced="no"
+ ;;
--disable-avs)
avs="no"
;;
LDFLAGS="$LDFLAGS -pg"
gprof="yes"
;;
+ --enable-strip)
+ strip="yes"
+ ;;
--enable-pic)
pic="yes"
;;
- --enable-shared)
- shared="yes"
- ;;
--enable-visualize)
vis="yes"
;;
esac
done
+[ "$cli" = "no" -a "$shared" = "no" -a "$static" = "no" ] && die "Nothing to build. Enable cli, shared or static."
+
CC="${CC-${cross_prefix}gcc}"
AR="${AR-${cross_prefix}ar}"
RANLIB="${RANLIB-${cross_prefix}ranlib}"
if [ $asm = auto -a $ARCH = ARM ] ; then
# set flags so neon is built by default
- echo $CFLAGS | grep -Eq '(-mcpu|-march|-mfpu|-mfloat-abi)' || CFLAGS="$CFLAGS -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp"
+ echo $CFLAGS | grep -Eq '(-mcpu|-march|-mfpu)' || CFLAGS="$CFLAGS -mcpu=cortex-a8 -mfpu=neon"
if cc_check '' '' '__asm__("rev ip, ip");' ; then define HAVE_ARMV6
cc_check '' '' '__asm__("movt r0, #0");' && define HAVE_ARMV6T2
if [ "$swscale" = "auto" ] ; then
swscale="no"
if ${cross_prefix}pkg-config --exists libswscale 2>/dev/null; then
- SWSCALE_LIBS="$SWSCALE_LIBS $(${cross_prefix}pkg-config --libs libswscale)"
- SWSCALE_CFLAGS="$SWSCALE_CFLAGS $(${cross_prefix}pkg-config --cflags libswscale)"
+ SWSCALE_LIBS="$SWSCALE_LIBS $(${cross_prefix}pkg-config --libs libswscale libavutil)"
+ SWSCALE_CFLAGS="$SWSCALE_CFLAGS $(${cross_prefix}pkg-config --cflags libswscale libavutil)"
fi
[ -z "$SWSCALE_LIBS" ] && SWSCALE_LIBS="-lswscale -lavutil"
- error="swscale must be at least version 0.9.0"
- if cc_check "libswscale/swscale.h" "$SWSCALE_CFLAGS $SWSCALE_LIBS" "sws_getContext(0,0,0,0,0,0,0,0,0,0);" ; then
- if cpp_check "libswscale/swscale.h" "$SWSCALE_CFLAGS" "LIBSWSCALE_VERSION_INT >= AV_VERSION_INT(0,9,0)" "$error"; then
- # we use colorspaces that were defined in libavutil r19775
- if cc_check "libavutil/pixfmt.h" "$SWSCALE_CFLAGS" "enum PixelFormat pixfmt = PIX_FMT_YUV422P16LE;" ; then
- swscale="yes"
- else
- echo "Warning: libavutil is too old, update to ffmpeg r19775+"
- fi
+ if cc_check "libswscale/swscale.h" "$SWSCALE_CFLAGS $SWSCALE_LIBS" "sws_init_context(0,0,0);" ; then
+ if cc_check "libavutil/pixdesc.h" "$SWSCALE_CFLAGS $SWSCALE_LIBS" "av_get_pix_fmt_name(0);" ; then
+ swscale="yes"
else
- echo "Warning: ${error}"
+ echo "Warning: av_get_pix_fmt_name is missing from libavutil, update for swscale support"
fi
fi
fi
done
fi
LAVF_LIBS="-L. $LAVF_LIBS"
- if cc_check libavformat/avformat.h "$LAVF_CFLAGS $LAVF_LIBS" "avcodec_decode_video2(0,0,0,0);" ; then
- if cpp_check libavcodec/avcodec.h "$LAVF_CFLAGS $LAVF_LIBS" "LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(52,64,0)" ; then
- if [ "$swscale" = "yes" ]; then
- lavf="yes"
- else
- echo "Warning: libavformat is not supported without swscale support"
- fi
+ if cc_check libavformat/avformat.h "$LAVF_CFLAGS $LAVF_LIBS" "avformat_open_input(0,0,0,0);" ; then
+ if [ "$swscale" = "yes" ]; then
+ lavf="yes"
else
- echo "Warning: libavcodec is too old, update to ffmpeg r22735+"
+ echo "Warning: libavformat is not supported without swscale support"
fi
fi
fi
fi
fi
-GPAC_LIBS="-lgpac_static"
-if [ $SYS = WINDOWS ]; then
- GPAC_LIBS="$GPAC_LIBS -lwinmm"
-fi
if [ "$gpac" = "auto" ] ; then
gpac="no"
+ cc_check "" -lz && GPAC_LIBS="-lgpac_static -lz" || GPAC_LIBS="-lgpac_static"
+ if [ "$SYS" = "WINDOWS" ] ; then
+ GPAC_LIBS="$GPAC_LIBS -lwinmm"
+ fi
if cc_check gpac/isomedia.h "$GPAC_LIBS" ; then
if cc_check gpac/isomedia.h "$GPAC_LIBS" "gf_isom_set_pixel_aspect_ratio(0,0,0,0,0);" ; then
gpac="yes"
fi
if [ "$debug" != "yes" -a "$gprof" != "yes" ]; then
- CFLAGS="$CFLAGS -s -fomit-frame-pointer"
+ CFLAGS="$CFLAGS -fomit-frame-pointer"
+fi
+
+if [ "$strip" = "yes" ]; then
+ CFLAGS="$CFLAGS -s"
LDFLAGS="$LDFLAGS -s"
fi
[ $gpl = yes ] && define HAVE_GPL && x264_gpl=1 || x264_gpl=0
+[ $interlaced = yes ] && define HAVE_INTERLACED && x264_interlaced=1 || x264_interlaced=0
+
#define undefined vars as 0
for var in $CONFIG_HAVE; do
grep -q "HAVE_$var 1" config.h || define HAVE_$var 0
# generate exported config file
cat > x264_config.h << EOF
-#define X264_BIT_DEPTH $bit_depth
-#define X264_GPL $x264_gpl
+#define X264_BIT_DEPTH $bit_depth
+#define X264_GPL $x264_gpl
+#define X264_INTERLACED $x264_interlaced
EOF
# generate config files
DEPMT=$DEPMT
LD=$LD
LDFLAGS=$LDFLAGS
-LDFLAGSCLI=$LDFLAGSCLI
LIBX264=$LIBX264
AR=$AR
RANLIB=$RANLIB
echo ' $(CC) $(CFLAGS) -c -Fo$@ $<' >> config.mak
fi
+if [ "$cli" = "yes" ]; then
+ echo 'default: cli' >> config.mak
+ echo 'install: install-cli' >> config.mak
+fi
+
if [ "$shared" = "yes" ]; then
API=$(grep '#define X264_BUILD' < x264.h | cut -f 3 -d ' ')
if [ "$SYS" = "WINDOWS" -o "$SYS" = "CYGWIN" ]; then
echo "SONAME=libx264.so.$API" >> config.mak
echo 'SOFLAGS=-shared -Wl,-soname,$(SONAME)' >> config.mak
fi
- echo 'default: $(SONAME)' >> config.mak
+ echo 'default: lib-shared' >> config.mak
+ echo 'install: install-lib-shared' >> config.mak
fi
+if [ "$static" = "yes" ]; then
+ echo 'default: lib-static' >> config.mak
+ echo 'install: install-lib-static' >> config.mak
+fi
+
+if [ "$cli_libx264" = "system" ] ; then
+ if [ "$shared" = "yes" ]; then
+ CLI_LIBX264='$(SONAME)'
+ elif ${cross_prefix}pkg-config --exists x264 2>/dev/null; then
+ LDFLAGSCLI="$LDFLAGSCLI $(${cross_prefix}pkg-config --libs x264)"
+ CLI_LIBX264=
+ else
+ die "Can not find system libx264"
+ fi
+else
+ CLI_LIBX264='$(LIBX264)'
+fi
+echo "LDFLAGSCLI = $LDFLAGSCLI" >> config.mak
+echo "CLI_LIBX264 = $CLI_LIBX264" >> config.mak
+
./version.sh >> config.h
pclibs="-L$libdir -lx264 $libpthread"
cat > conftest.log <<EOF
Platform: $ARCH
System: $SYS
+cli: $cli
+libx264: $cli_libx264
+shared: $shared
+static: $static
asm: $asm
+interlaced: $interlaced
avs: $avs
lavf: $lavf
ffms: $ffms
filters: $filters
debug: $debug
gprof: $gprof
+strip: $strip
PIC: $pic
-shared: $shared
visualize: $vis
bit depth: $bit_depth
EOF