X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=configure;h=08be5391379617abed1335963804f4707ed1ee24;hb=d2dada763c6114b6245c6b468dfc2287123d12c5;hp=e12ffaf97ef21ead1566f8c78271f2fd9dcf8444;hpb=6bf1398b824c013184548277eb8f2dbccd4d6fc5;p=x264 diff --git a/configure b/configure index e12ffaf9..08be5391 100755 --- a/configure +++ b/configure @@ -12,29 +12,48 @@ echo " --enable-mp4-output enables mp4 output (using gpac)" echo " --enable-vfw compiles the VfW frontend" echo " --enable-pthread enables multithreaded encoding" echo " --enable-debug adds -g, doesn't strip" +echo " --enable-gprof adds -pg, doesn't strip" echo " --enable-visualize enables visualization (X11 only)" +echo " --extra-asflags=EASFLAGS add EASFLAGS to ASFLAGS" echo " --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS" echo " --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS" echo "" exit 1 fi +cc_check() { + rm -f conftest* + cat > conftest.c << EOF +#include <$1> +int main () { $3 return 0; } +EOF + $CC $CFLAGS $LDFLAGS $2 conftest.c -o conftest 2>$DEVNULL + TMP="$?" + rm -f conftest.c conftest + return $TMP +} + +rm -f config.h config.mak x264.pc + prefix='/usr/local' -eprefix='${prefix}' -bindir='${eprefix}/bin' -libdir='${eprefix}/lib' +exec_prefix='${prefix}' +bindir='${exec_prefix}/bin' +libdir='${exec_prefix}/lib' includedir='${prefix}/include' +DEVNULL='/dev/null' -avis_input="no" -mp4_output="no" -pthread="no" +avis_input="auto" +mp4_output="auto" +pthread="auto" debug="no" +gprof="no" vfw="no" vis="no" CC="gcc" CFLAGS="-Wall -I. -O4 -ffast-math -D__X264__" LDFLAGS="" +HAVE_GETOPT_LONG=1 AS="nasm" ASFLAGS="-f elf" @@ -56,6 +75,10 @@ case "$UNAMES" in SYS="FREEBSD" LDFLAGS="$LDFLAGS -lm" ;; + NetBSD) + SYS="NETBSD" + LDFLAGS="$LDFLAGS -lm" + ;; Linux) SYS="LINUX" CFLAGS="$CFLAGS -DHAVE_MALLOC_H" @@ -67,11 +90,21 @@ case "$UNAMES" in LDFLAGS="$LDFLAGS -mno-cygwin" ASFLAGS="-f win32 -DPREFIX" EXE=".exe" + DEVNULL="NUL" + vfw="yes" ;; MINGW*) SYS="MINGW" ASFLAGS="-f win32 -DPREFIX" EXE=".exe" + DEVNULL="NUL" + vfw="yes" + ;; + SunOS) + SYS="SunOS" + CFLAGS="$CFLAGS -DHAVE_MALLOC_H" + LDFLAGS="$LDFLAGS -lm" + HAVE_GETOPT_LONG=0 ;; *) echo "Unknown system $UNAMES, edit the configure" @@ -84,6 +117,10 @@ case "$UNAMEM" in i386|i486|i586|i686|BePC) ARCH="X86" CFLAGS="$CFLAGS -DHAVE_MMXEXT -DHAVE_SSE2" + if [ $SYS = MACOSX ] + then + ASFLAGS="-f macho -DPREFIX" + fi ;; x86_64) ARCH="X86_64" @@ -100,6 +137,37 @@ case "$UNAMEM" in CFLAGS="$CFLAGS -maltivec -mabi=altivec" fi ;; + sun4m|sun4d|sparc|sparc64) + ARCH="Sparc" + ;; + sun4u) + ARCH="UltraSparc" + CFLAGS="$CFLAGS -mcpu=ultrasparc" + LDFLAGS="$LDFLAGS -mcpu=ultrasparc" + AS="as" + ASFLAGS="-xarch=v8plusa" + ;; + ia64) + ARCH="IA64" + ;; + alpha) + ARCH="ALPHA" + ;; + mips|mipsel) + ARCH="MIPS" + ;; + m68k) + ARCH="M68K" + ;; + arm|armv5tel) + ARCH="ARM" + ;; + s390|s390x) + ARCH="S390" + ;; + parisc|parisc64) + ARCH="PARISC" + ;; *) echo "Unknown platform $UNAMEM, edit the configure" exit 1 @@ -113,36 +181,36 @@ CFLAGS="$CFLAGS -DARCH_$ARCH -DSYS_$SYS" for opt do optarg="${opt#*=}" case "$opt" in - --prefix=*) - prefix="$optarg" - ;; - --exec-prefix=*) - eprefix="$optarg" - ;; - --bindir=*) - bindir="$optarg" - ;; - --libdir=*) - libdir="$optarg" - ;; - --includedir=*) - includedir="$optarg" - ;; + --prefix=*) + prefix="$optarg" + ;; + --exec-prefix=*) + exec_prefix="$optarg" + ;; + --bindir=*) + bindir="$optarg" + ;; + --libdir=*) + libdir="$optarg" + ;; + --includedir=*) + includedir="$optarg" + ;; --enable-avis-input) - if [ $SYS = CYGWIN -o $SYS = MINGW ]; then - CFLAGS="$CFLAGS -DAVIS_INPUT" - LDFLAGS="$LDFLAGS -lvfw32" - avis_input="yes" - fi + avis_input="yes" + ;; + --disable-avis-input) + avis_input="no" ;; --enable-mp4-output) - CFLAGS="$CFLAGS -DMP4_OUTPUT" - LDFLAGS="$LDFLAGS -lm4systems_static" - if [ $SYS = CYGWIN -o $SYS = MINGW ]; then - LDFLAGS="$LDFLAGS -lwinmm" - fi mp4_output="yes" ;; + --disable-mp4-output) + mp4_output="no" + ;; + --extra-asflags=*) + ASFLAGS="$ASFLAGS ${opt#--extra-asflags=}" + ;; --extra-cflags=*) CFLAGS="$CFLAGS ${opt#--extra-cflags=}" VFW_CFLAGS="${opt#--extra-cflags=}" @@ -152,23 +220,26 @@ for opt do VFW_LDFLAGS="${opt#--extra-ldflags=}" ;; --enable-pthread) - CFLAGS="$CFLAGS -DHAVE_PTHREAD=1" pthread="yes" - case $SYS in - MINGW|CYGWIN|BEOS) - ;; - *) - LDFLAGS="$LDFLAGS -lpthread" - ;; - esac + ;; + --disable-pthread) + pthread="no" ;; --enable-debug) CFLAGS="$CFLAGS -g" debug="yes" ;; + --enable-gprof) + CFLAGS="$CFLAGS -pg" + LDFLAGS="$LDFLAGS -pg" + gprof="yes" + ;; --enable-vfw) vfw="yes" ;; + --disable-vfw) + vfw="no" + ;; --enable-visualize) LDFLAGS="$LDFLAGS -L/usr/X11R6/lib -lX11" CFLAGS="$CFLAGS -DVISUALIZE=1" @@ -180,17 +251,73 @@ for opt do esac done -VFWFLAGS= -if [ "$debug" != "yes" ]; then +# autodetect options that weren't forced nor disabled + +if test "$pthread" = "auto" ; then + case $SYS in + MINGW|CYGWIN|BEOS) + pthread="yes" + ;; + *) + pthread="no" + cc_check pthread.h -lpthread && pthread="yes" + ;; + esac +fi +if test "$pthread" = "yes" ; then + CFLAGS="$CFLAGS -DHAVE_PTHREAD=1" + case $SYS in + MINGW|CYGWIN|BEOS) + ;; + *) LDFLAGS="$LDFLAGS -lpthread" + ;; + esac +fi + +MP4_LDFLAGS="-lgpac_static" +if [ $SYS = CYGWIN -o $SYS = MINGW ]; then + MP4_LDFLAGS="$MP4_LDFLAGS -lwinmm" +fi +if [ "$mp4_output" = "auto" ] ; then + mp4_output="no" + cc_check gpac/isomedia.h "$MP4_LDFLAGS" && mp4_output="yes" +fi +if [ "$mp4_output" = "yes" ] ; then + echo "#define MP4_OUTPUT" >> config.h + LDFLAGS="$LDFLAGS $MP4_LDFLAGS" +fi + +if [ "$avis_input" = "auto" ] ; then + if [ $SYS = CYGWIN -o $SYS = MINGW ]; then + avis_input="yes" + else + avis_input="no"; + fi +fi +if [ "$avis_input" = "yes" ] ; then + echo "#define AVIS_INPUT" >> config.h + LDFLAGS="$LDFLAGS -lvfw32" +fi + +if [ "$debug" != "yes" -a "$gprof" != "yes" ]; then CFLAGS="$CFLAGS -s -fomit-frame-pointer" LDFLAGS="$LDFLAGS -s" VFW_LDFLAGS="$VFW_LDFLAGS -s" fi -rm -f config.mak +if cc_check "stdio.h" "" "fseeko(stdin,0,0);" ; then + echo "#define fseek fseeko" >> config.h + echo "#define ftell ftello" >> config.h +elif cc_check "stdio.h" "" "fseeko64(stdin,0,0);" ; then + echo "#define fseek fseeko64" >> config.h + echo "#define ftell ftello64" >> config.h +fi + +# generate config files + cat > config.mak << EOF prefix=$prefix -eprefix=$eprefix +exec_prefix=$exec_prefix bindir=$bindir libdir=$libdir includedir=$includedir @@ -204,6 +331,9 @@ ASFLAGS=$ASFLAGS VFW=$vfw EXE=$EXE VIS=$vis +HAVE_GETOPT_LONG=$HAVE_GETOPT_LONG +DEVNULL=$DEVNULL +CONFIGURE_ARGS=$@ EOF if [ "$vfw" = "yes" ]; then @@ -215,6 +345,22 @@ EOF echo "default: x264vfw.dll" >> config.mak fi +./version.sh + +cat > x264.pc << EOF +prefix=$prefix +exec_prefix=$exec_prefix +libdir=$libdir +includedir=$includedir + +Name: x264 +Description: H.264 (MPEG4 AVC) encoder library +Version: $(grep POINTVER < config.h | sed -e 's/.* "//; s/".*//') +Libs: -L$libdir -lx264 +Cflags: -I$includedir +EOF + + echo "Platform: $ARCH" echo "System: $SYS" echo "avis input: $avis_input" @@ -222,7 +368,8 @@ echo "mp4 output: $mp4_output" echo "pthread: $pthread" echo "vfw: $vfw" echo "debug: $debug" +echo "gprof: $gprof" echo "visualize: $vis" echo -echo "You can run 'make' now." +echo "You can run 'make' or 'make fprofiled' now."