]> git.sesse.net Git - ffmpeg/blobdiff - configure
configure: add foo_select facility
[ffmpeg] / configure
index 6b7d1f2131c3ce6042540b3431ca264d758a3ef3..073181b53b95c824a5c7c8db1174299347ee955e 100755 (executable)
--- a/configure
+++ b/configure
@@ -8,7 +8,8 @@
 #
 
 # Prevent locale nonsense from breaking basic text processing.
-export LC_ALL=C
+LC_ALL=C
+export LC_ALL
 
 # make sure we are running under a compatible shell
 # try to make this part work with most shells
@@ -101,6 +102,7 @@ show_help(){
   echo "  --enable-libnut          enable NUT (de)muxing via libnut,"
   echo "                           native demuxer exists [default=no]"
   echo "  --enable-libschroedinger enable Dirac support via libschroedinger [default=no]"
+  echo "  --enable-libspeex        enable Speex decoding via libspeex [default=no]"
   echo "  --enable-libtheora       enable Theora encoding via libtheora [default=no]"
   echo "  --enable-libvorbis       enable Vorbis encoding via libvorbis,"
   echo "                           native implementation exists [default=no]"
@@ -191,7 +193,7 @@ show_help(){
   echo "  --disable-stripping      disable stripping of executables and shared libraries"
   echo ""
   echo "NOTE: Object files are built at the place where configure is launched."
-  exit 1
+  exit 0
 }
 
 log(){
@@ -307,6 +309,7 @@ disabled_any(){
     for opt; do
         disabled $opt && return 0
     done
+    return 1
 }
 
 set_default(){
@@ -333,17 +336,20 @@ check_deps(){
 
         eval dep_all="\$${cfg}_deps"
         eval dep_any="\$${cfg}_deps_any"
+        eval dep_sel="\$${cfg}_select"
 
-        pushvar cfg dep_all dep_any
-        check_deps $dep_all $dep_any
-        popvar cfg dep_all dep_any
+        pushvar cfg dep_all dep_any dep_sel
+        check_deps $dep_all $dep_any $dep_sel
+        popvar cfg dep_all dep_any dep_sel
 
         enabled_all $dep_all || disable $cfg
         enabled_any $dep_any || disable $cfg
+        disabled_any $dep_sel && disable $cfg
 
         if enabled $cfg; then
             eval dep_extralibs="\$${cfg}_extralibs"
             test -n "$dep_extralibs" && add_extralibs $dep_extralibs
+            enable $dep_sel
         fi
 
         disable ${cfg}_checking
@@ -447,7 +453,7 @@ check_asm(){
     asm="$2"
     shift 2
     check_cc "$@" <<EOF && enable $name || disable $name
-int foo(void){ asm volatile($asm); }
+int foo(void){ __asm__ volatile($asm); }
 EOF
 }
 
@@ -527,6 +533,18 @@ int main(int argc, char **argv){
 EOF
 }
 
+check_cpp_condition(){
+    log check_cpp_condition "$@"
+    header=$1
+    condition=$2
+    check_cpp <<EOF
+#include <$header>
+#if !($condition)
+#error "unsatisfied condition: $condition"
+#endif
+EOF
+}
+
 check_lib(){
     log check_lib "$@"
     header="$1"
@@ -679,6 +697,7 @@ CONFIG_LIST="
     libmp3lame
     libnut
     libschroedinger
+    libspeex
     libtheora
     libvorbis
     libx264
@@ -742,7 +761,6 @@ HAVE_LIST="
     altivec_h
     arpa_inet_h
     bswap
-    byteswap_h
     closesocket
     cmov
     conio_h
@@ -754,6 +772,7 @@ HAVE_LIST="
     dev_video_bktr_ioctl_bt848_h
     dlfcn_h
     dlopen
+    dos_paths
     ebp_available
     ebx_available
     fast_64bit
@@ -848,9 +867,6 @@ neon_deps="armv4l"
 ssse3_deps="x86"
 vis_deps="sparc"
 
-# system headers and functions
-byteswap_h_deps="!armv4l"
-
 # decoders / encoders
 ac3_decoder_deps="gpl"
 dxa_decoder_deps="zlib"
@@ -881,6 +897,7 @@ libgsm_ms_encoder_deps="libgsm"
 libmp3lame_encoder_deps="libmp3lame"
 libschroedinger_decoder_deps="libschroedinger"
 libschroedinger_encoder_deps="libschroedinger"
+libspeex_decoder_deps="libspeex"
 libtheora_encoder_deps="libtheora"
 libvorbis_encoder_deps="libvorbis"
 libx264_encoder_deps="libx264"
@@ -943,7 +960,7 @@ mandir_default='${prefix}/share/man'
 shlibdir_default="$libdir_default"
 
 # toolchain
-cc="gcc"
+cc_default="gcc"
 yasmexe="yasm"
 ar="ar"
 nm="nm"
@@ -994,8 +1011,9 @@ SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)'
 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 -e "/^\#.*/d" -e "1s,^,$(@D)/," -e "s,\\([[:space:]]\\)\\(version\\.h\\),\\1\$$(BUILD_ROOT_REL)/\\2,"'
+# gcc stupidly only outputs the basename of targets with -MM, but we need the
+# full relative path for objects in subdirectories for non-recursive Make.
+DEPEND_CMD='$(CC) $(CFLAGS) -MM -MG $< | sed -e "/^\#.*/d" -e "s,^[[:space:]]*$(*F)\\.o,$(@D)/$(*F).o," -e "s,\\([[:space:]]\\)\\(version\\.h\\),\\1\$$(BUILD_ROOT_REL)/\\2,"'
 
 # find source path
 source_path="`dirname \"$0\"`"
@@ -1093,7 +1111,7 @@ for opt do
     --help|-h) show_help
     ;;
     *)
-    optname="${opt%=*}"
+    optname="${opt%%=*}"
     optname="${optname#--}"
     optname=$(echo "$optname" | sed 's/-/_/g')
     is_in $optname $CMDLINE_SET || die_unknown $opt
@@ -1107,13 +1125,15 @@ disabled logging && logfile=/dev/null
 echo "# $0 $@" > $logfile
 set >> $logfile
 
-cc="${cross_prefix}${cc}"
+cc_default="${cross_prefix}${cc_default}"
 yasmexe="${cross_prefix}${yasmexe}"
 ar="${cross_prefix}${ar}"
 nm="${cross_prefix}${nm}"
 ranlib="${cross_prefix}${ranlib}"
 strip="${cross_prefix}${strip}"
 
+set_default cc
+
 # set temporary file name
 if test ! -z "$TMPDIR" ; then
     TMPDIR1="${TMPDIR}"
@@ -1130,7 +1150,6 @@ TMPO="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.o"
 TMPS="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.S"
 TMPSH="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.sh"
 
-check_cflags -fasm
 check_cflags -std=c99
 
 case "$arch" in
@@ -1155,10 +1174,12 @@ EOF
     ;;
     "Power Macintosh"|ppc|powerpc)
         arch="powerpc"
+        enable fast_unaligned
     ;;
     ppc64)
         arch="powerpc"
         enable fast_64bit
+        enable fast_unaligned
     ;;
     mips|mipsel|IP*)
         arch="mips"
@@ -1295,6 +1316,7 @@ case $target_os in
         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'
         objformat="win32"
+        enable dos_paths
         ;;
     cygwin*)
         target_os=cygwin
@@ -1312,6 +1334,7 @@ case $target_os in
         SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
         SHFLAGS='-shared -Wl,--enable-auto-image-base'
         objformat="win32"
+        enable dos_paths
         ;;
     *-dos|freedos|opendos)
         disable ffplay ffserver vhook
@@ -1319,6 +1342,7 @@ case $target_os in
         network_extralibs="-lsocket"
         EXESUF=".exe"
         objformat="win32"
+        enable dos_paths
         ;;
     linux)
         enable dv1394
@@ -1350,6 +1374,7 @@ case $target_os in
         SLIB_INSTALL_EXTRA_CMD='install -m 644 $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib "$(LIBDIR)"'
         SLIB_UNINSTALL_EXTRA_CMD='rm -f "$(LIBDIR)"/$(LIBPREF)$(NAME)_dll.a "$(LIBDIR)"/$(LIBPREF)$(NAME)_dll.lib'
         disable vhook
+        enable dos_paths
         ;;
     interix)
         disable vhook
@@ -1494,7 +1519,14 @@ if test $cpu != "generic"; then
         sparc64)
             add_cflags "-mcpu=v9"
         ;;
-        arm*|cortex*)
+        arm11*|cortex*)
+            add_cflags "-mcpu=$cpu"
+            enable fast_unaligned
+        ;;
+        armv*)
+            add_cflags "-march=$cpu"
+        ;;
+        arm*)
             add_cflags "-mcpu=$cpu"
         ;;
         *)
@@ -1546,7 +1578,7 @@ if enabled x86; then
     # base pointer is cleared in the inline assembly code.
     check_exec_crash <<EOF && enable ebp_available
     volatile int i=0;
-    asm volatile (
+    __asm__ volatile (
         "xorl %%ebp, %%ebp"
     ::: "%ebp");
     return i;
@@ -1575,14 +1607,7 @@ fi
 # check for assembler specific support
 
 if test $arch = "powerpc"; then
-check_cc <<EOF && enable dcbzl
-int main(void) {
-    register long zero = 0;
-    char data[1024];
-    asm volatile("dcbzl %0, %1" : : "b" (data), "r" (zero));
-return 0;
-}
-EOF
+    check_asm dcbzl '"dcbzl 0, 1"'
 fi
 
 # check for SIMD availability
@@ -1646,7 +1671,6 @@ check_func  memalign
 check_func  mkstemp
 check_func_headers windows.h GetProcessTimes
 
-check_header byteswap.h
 check_header conio.h
 check_header dlfcn.h
 check_header malloc.h
@@ -1703,19 +1727,22 @@ done
 enabled avisynth   && require2 vfw32 "windows.h vfw.h" AVIFileInit -lvfw32
 enabled libamr_nb  && require  libamrnb amrnb/interf_dec.h Speech_Decode_Frame_init -lamrnb -lm
 enabled libamr_wb  && require  libamrwb amrwb/dec_if.h D_IF_init -lamrwb -lm
-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 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  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 $(pkg-config --libs schroedinger-1.0)
+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  x264 x264.h x264_encoder_open -lx264 -lm
+enabled libx264    && require  x264 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  Xvid xvid.h xvid_global -lxvidcore
 enabled mlib       && require  mediaLib mlib_types.h mlib_VectorSub_S16_U8_Mod -lmlib
 
@@ -1913,7 +1940,7 @@ VHOOKCFLAGS="-fPIC"
 # Find out if the .align argument is a power of two or not.
 if test $asmalign_pot = "unknown"; then
     disable asmalign_pot
-    echo 'asm (".align 3");' | check_cc && enable asmalign_pot
+    echo '__asm__ (".align 3");' | check_cc && enable asmalign_pot
 fi
 
 enabled_any $DECODER_LIST      && enable decoders
@@ -2017,6 +2044,7 @@ echo "libgsm enabled            ${libgsm-no}"
 echo "libmp3lame enabled        ${libmp3lame-no}"
 echo "libnut enabled            ${libnut-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}"