[FFmpeg-devel] [PATCH] configure: support --cpu=host to tune for the host system

Mans Rullgard mans
Mon Aug 3 02:59:50 CEST 2009


This requires a gcc version with -march=native or -mcpu=native support,
which is somewhat random for non-x86.
---
 configure |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/configure b/configure
index 69c0d01..299d3b9 100755
--- a/configure
+++ b/configure
@@ -1582,6 +1582,22 @@ if test -n "$sysroot"; then
     esac
 fi
 
+if test "$cpu" = host; then
+    enabled cross_compile && die "--cpu=host makes no sense when cross-compiling."
+
+    case "$cc_type" in
+        gcc)
+            check_native(){
+                $cc $1=native -v -c -o $TMPO $TMPC >$TMPE 2>&1 || return
+                awk "/$1=/{ match(\$0, /$1=(\\w+)/, a);print a[1];exit }" $TMPE
+            }
+            cpu=$(check_native -march || check_native -mcpu)
+        ;;
+    esac
+
+    test "${cpu:-host}" = host && die "--cpu=host not supported with compiler $cc"
+fi
+
 # Add processor-specific flags
 case $cpu in
     601|ppc601|PowerPC601)
-- 
1.6.4




More information about the ffmpeg-devel mailing list