]> git.sesse.net Git - ffmpeg/blobdiff - configure
More variable renaming
[ffmpeg] / configure
index dada8615d5779bc16016fa43930422c5e1325ccd..c4c906909045b972908510132d289396af233fe3 100755 (executable)
--- a/configure
+++ b/configure
 
 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
@@ -59,6 +59,7 @@ show_help(){
   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]"
@@ -132,6 +133,7 @@ show_help(){
   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)"
@@ -186,12 +188,12 @@ show_help(){
 }
 
 log(){
-    echo "$@" >>$logfile
+    echo "$@" >> $logfile
 }
 
 log_file(){
     log BEGIN $1
-    pr -n -t $1 >>$logfile
+    pr -n -t $1 >> $logfile
     log END $1
 }
 
@@ -350,7 +352,7 @@ print_config(){
 }
 
 flags_saved(){
-    (: ${SAVE_CFLAGS?}) 2>/dev/null
+    (: ${SAVE_CFLAGS?}) 2> /dev/null
 }
 
 save_flags(){
@@ -406,19 +408,19 @@ add_extralibs(){
 
 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
 }
@@ -526,7 +528,7 @@ check_lib2(){
 }
 
 check_exec(){
-    check_ld "$@" && { enabled cross_compile || $TMPE >>$logfile 2>&1; }
+    check_ld "$@" && { enabled cross_compile || $TMPE >> $logfile 2>&1; }
 }
 
 check_exec_crash(){
@@ -538,7 +540,7 @@ 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);
@@ -630,6 +632,7 @@ CONFIG_LIST="
     avfilter_lavf
     avisynth
     beos_netserver
+    bzlib
     ffmpeg
     ffplay
     ffserver
@@ -711,6 +714,7 @@ HAVE_LIST="
     $ARCH_EXT_LIST
     $THREADS_LIST
     altivec_h
+    altivec_vector_braces
     arpa_inet_h
     bswap
     byteswap_h
@@ -781,6 +785,7 @@ CMDLINE_SELECT="
 "
 CMDLINE_SET='
     arch
+    bindir
     build_suffix
     cc
     cpu
@@ -917,6 +922,7 @@ cpu="generic"
 target_os=$(tolower $(uname -s))
 
 # libraries
+enable bzlib
 enable zlib
 
 # configurable options
@@ -950,7 +956,7 @@ SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
 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\"`"
@@ -1057,12 +1063,102 @@ for opt do
     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)
@@ -1130,6 +1226,11 @@ case $target_os in
         ;;
     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)'
@@ -1143,7 +1244,7 @@ case $target_os in
         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) /out:$(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(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)"'
@@ -1212,99 +1313,8 @@ case $target_os in
         ;;
 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"
 
@@ -1446,11 +1456,11 @@ if test $cpu != "generic"; then
 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
@@ -1522,13 +1532,10 @@ fi
 # 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 ||
+        { check_header altivec.h && inc_altivec_h="#include <altivec.h>" ; } ||
         check_cflags -faltivec
 
     # check if our compiler supports Motorola AltiVec C API
-    enabled altivec_h &&
-        inc_altivec_h="#include <altivec.h>" ||
-        inc_altivec_h=
     check_cc <<EOF || disable altivec
 $inc_altivec_h
 int main(void) {
@@ -1536,6 +1543,13 @@ int main(void) {
     v1 = vec_add(v2,v3);
     return 0;
 }
+EOF
+
+    # check if our compiler supports braces for vector declarations
+    check_cc <<EOF && enable altivec_vector_braces
+$inc_altivec_h
+#define AVV(x...) {x}
+int main (void) { (vector int) AVV(1); return 0; }
 EOF
 fi
 
@@ -1586,7 +1600,8 @@ if ! enabled_any memalign memalign_hack && enabled need_memalign ; then
     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().
@@ -1700,7 +1715,7 @@ check_foo_config freetype2 freetype ft2build.h FT_Init_FreeType
 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`
@@ -1723,7 +1738,7 @@ EOF
     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
 
@@ -1955,9 +1970,10 @@ echo "libnut enabled            ${libnut-no}"
 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
@@ -1969,11 +1985,14 @@ for type in decoder encoder parser demuxer muxer protocol filter bsf indev outde
     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..."
 
@@ -1984,7 +2003,6 @@ echo "#define FFMPEG_CONFIG_H" >> $TMPH
 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
@@ -1999,7 +2017,7 @@ enabled stripping &&
     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
@@ -2051,6 +2069,7 @@ get_version LIBAVFILTER libavfilter/avfilter.h
 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
@@ -2156,7 +2175,7 @@ comment=$2
 version=$3
 libs=$4
 requires=$5
-cat <<EOF >$name.pc
+cat <<EOF > $name.pc
 prefix=$prefix
 exec_prefix=\${prefix}
 libdir=$libdir
@@ -2165,13 +2184,14 @@ includedir=$incdir
 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
@@ -2182,8 +2202,7 @@ Description: $comment
 Version: $version
 Requires: $requires
 Conflicts:
-Libs: \${libdir}/${LIBPREF}${shortname}${LIBSUF}
-Libs.private: $libs
+Libs: \${libdir}/${LIBPREF}${shortname}${LIBSUF} $libs
 Cflags: -I\${includedir}
 EOF
 }
@@ -2192,9 +2211,9 @@ pkgconfig_generate libavutil "FFmpeg utility library" "$LIBAVUTIL_VERSION"
 pkgconfig_generate libavcodec "FFmpeg codec library" "$LIBAVCODEC_VERSION" "$extralibs" "$pkg_requires libavutil = $LIBAVUTIL_VERSION"
 pkgconfig_generate libavformat "FFmpeg container format library" "$LIBAVFORMAT_VERSION" "$extralibs" "$pkg_requires libavcodec = $LIBAVCODEC_VERSION"
 pkgconfig_generate libavdevice "FFmpeg device handling library" "$LIBAVDEVICE_VERSION" "$extralibs" "$pkg_requires libavformat = $LIBAVFORMAT_VERSION"
-enabled avfilter && \
+enabled avfilter &&
     pkgconfig_generate libavfilter "FFmpeg video filtering library" "$LIBAVFILTER_VERSION" "$extralibs" "$pkg_requires libavutil = $LIBAVUTIL_VERSION"
-enabled postproc && \
+enabled postproc &&
     pkgconfig_generate libpostproc "FFmpeg post processing library" "$LIBPOSTPROC_VERSION"
 if enabled swscale; then
     pkgconfig_generate libswscale "FFmpeg image rescaling library" "$LIBSWSCALE_VERSION" "" "libavutil = $LIBAVUTIL_VERSION"