]> git.sesse.net Git - ffmpeg/blobdiff - configure
Check for sys/mman.h and set appropriate definitions.
[ffmpeg] / configure
index 4bea3209a1ecec521081e1f8703ee184c12647ec..46996db35b5a7b46ee2ca5540bbb4ca3332c440a 100755 (executable)
--- a/configure
+++ b/configure
@@ -699,6 +699,7 @@ ARCH_EXT_LIST='
     iwmmxt
     mmi
     mmx
+    mmx2
     ssse3
     vis
 '
@@ -753,6 +754,7 @@ HAVE_LIST="
     socklen_t
     soundcard_h
     poll_h
+    sys_mman_h
     sys_select_h
     sys_soundcard_h
     termios_h
@@ -780,6 +782,7 @@ armv6_deps="armv4l"
 iwmmxt_deps="armv4l"
 mmi_deps="mips"
 mmx_deps="x86"
+mmx2_deps="x86"
 ssse3_deps="x86"
 vis_deps="sparc"
 
@@ -888,6 +891,7 @@ bindir='$(PREFIX)/bin'
 # toolchain
 cc="gcc"
 ar="ar"
+nm="nm"
 ranlib="ranlib"
 make="make"
 strip="strip"
@@ -934,6 +938,10 @@ 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) -MM $(CFLAGS) $(filter-out %.h,$^) | sed "s,[0-9a-z._-]*: \($(SRC_DIR)/\)*\([a-z0-9]*/\)[^/]* ,\\2&,"'
+VHOOK_DEPEND_CMD='$(CC) -MM $(VHOOKCFLAGS) $(filter-out %.h,$^) | sed "s,^\([a-z]\),vhook/\\1,"'
+
 # find source path
 source_path="`dirname \"$0\"`"
 enable source_path_used
@@ -1081,7 +1089,7 @@ case "$arch" in
         enable fast_unaligned
         canon_arch="`$cc -dumpmachine | sed -e 's,\([^-]*\)-.*,\1,'`"
         if [ x"$canon_arch" = x"x86_64" -o x"$canon_arch" = x"amd64" ]; then
-            if [ -z "`echo $CFLAGS | grep -- -m32`"  ]; then
+            if ! echo $CFLAGS | grep -q -- -m32; then
                 arch="x86_64"
                 enable fast_64bit
             fi
@@ -1166,7 +1174,7 @@ case $targetos in
         # no need for libm, but the inet stuff
         # Check for BONE
         # XXX: actually should check for NOT net_server
-        if (echo $BEINCLUDES|grep 'headers/be/bone' >/dev/null); then
+        if echo $BEINCLUDES | grep -q 'headers/be/bone'; then
             network_extralibs="-lbind -lsocket"
         else
             enable beos_netserver
@@ -1311,6 +1319,7 @@ LDFLAGS="$FFLDFLAGS $LDFLAGS"
 test -n "$cross_prefix" && enable cross_compile
 cc="${cross_prefix}${cc}"
 ar="${cross_prefix}${ar}"
+nm="${cross_prefix}${nm}"
 ranlib="${cross_prefix}${ranlib}"
 strip="${cross_prefix}${strip}"
 
@@ -1368,13 +1377,13 @@ test -z "$need_memalign" && need_memalign="$mmx"
 
 #Darwin CC versions
 if test $targetos = darwin; then
-    if test -n "`$cc -v 2>&1 | grep xlc`"; then
+    if $cc -v 2>&1 | grep -q xlc; then
         add_cflags "-qpdf2 -qlanglvl=extc99 -qmaxmem=-1 -qarch=auto -qtune=auto"
     else
         add_cflags "-pipe"
         check_cflags "-force_cpusubtype_ALL"
         check_cflags "-Wno-sign-compare"
-        disabled shared && add_cflags -mdynamic-no-pic
+        enabled shared || add_cflags -mdynamic-no-pic
     fi
 fi
 
@@ -1487,6 +1496,12 @@ if test "$?" != 0; then
     die "C compiler test failed."
 fi
 
+check_cc <<EOF || die "Symbol mangling check failed."
+int ff_extern;
+EOF
+sym=$($nm -P -g $TMPO)
+extern_prefix=${sym%%ff_extern*}
+
 check_asm inline_asm '""'
 
 if enabled x86; then
@@ -1505,8 +1520,9 @@ EOF
     # check wether EBX is available on x86
     check_asm ebx_available '"":::"%ebx"'
 
-    # check whether binutils is new enough to compile SSSE3
+    # check whether binutils is new enough to compile SSSE3/MMX2
     enabled ssse3 && check_asm ssse3 '"pabsw %xmm0, %xmm0"'
+    enabled mmx2  && check_asm mmx2  '"movss %xmm0, %xmm0"'
 
     check_asm bswap '"bswap %%eax" ::: "%eax"'
 fi
@@ -1528,11 +1544,9 @@ fi
 
 # AltiVec flags: The FSF version of GCC differs from the Apple version
 if enabled altivec; then
-    test -n "`$cc -v 2>&1 | grep version | grep Apple`" &&
-        add_cflags "-faltivec" ||
-        add_cflags "-maltivec -mabi=altivec"
-
-    check_header altivec.h
+    check_cflags -maltivec -mabi=altivec &&
+        check_header altivec.h ||
+        check_cflags -faltivec
 
     # check if our compiler supports Motorola AltiVec C API
     enabled altivec_h &&
@@ -1561,7 +1575,7 @@ enabled vis && add_cflags "-mcpu=ultrasparc -mtune=ultrasparc"
 check_cc <<EOF || die "endian test failed"
 unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
 EOF
-tr -c -d BIGE < $TMPO | grep -q BIGE && enable bigendian
+od -A n -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian
 
 # ---
 # check availability of some header files
@@ -1584,6 +1598,7 @@ check_header byteswap.h
 check_header conio.h
 check_header dlfcn.h
 check_header malloc.h
+check_header sys/mman.h
 check_header termios.h
 
 if ! enabled_any memalign memalign_hack && enabled need_memalign ; then
@@ -1800,7 +1815,7 @@ if enabled small; then
     check_cflags -Os            # not all compilers support -Os
     optimizations="small"
 elif enabled optimizations; then
-    if test -n "`$cc -v 2>&1 | grep xlc`"; then
+    if $cc -v 2>&1 | grep -q xlc; then
         add_cflags  "-O5"
         add_ldflags "-O5"
     else
@@ -1991,6 +2006,8 @@ echo "LIBNAME=$LIBNAME" >> config.mak
 echo "SLIBPREF=$SLIBPREF" >> config.mak
 echo "SLIBSUF=$SLIBSUF" >> config.mak
 echo "EXESUF=$EXESUF" >> config.mak
+echo "DEPEND_CMD=$DEPEND_CMD" >> config.mak
+echo "VHOOK_DEPEND_CMD=$VHOOK_DEPEND_CMD" >> config.mak
 
 if enabled bigendian; then
     echo "WORDS_BIGENDIAN=yes" >> config.mak
@@ -2066,6 +2083,7 @@ enabled asmalign_pot &&
     printf '#define ASMALIGN(ZEROBITS) ".align " #ZEROBITS "\\n\\t"\n' >> $TMPH ||
     printf '#define ASMALIGN(ZEROBITS) ".align 1<<" #ZEROBITS "\\n\\t"\n' >> $TMPH
 
+echo "#define EXTERN_PREFIX \"${extern_prefix}\"" >> $TMPH
 
 echo "#endif /* FFMPEG_CONFIG_H */" >> $TMPH