Browse code

configure: support --cpu=host to tune for the host system

This requires a gcc version with -march=native or -mcpu=native support,
which is somewhat random for non-x86.

Originally committed as revision 19602 to svn://svn.ffmpeg.org/ffmpeg/trunk

Måns Rullgård authored on 2009/08/07 00:45:19
Showing 1 changed files
... ...
@@ -1582,6 +1582,22 @@ if test -n "$sysroot"; then
1582 1582
     esac
1583 1583
 fi
1584 1584
 
1585
+if test "$cpu" = host; then
1586
+    enabled cross_compile && die "--cpu=host makes no sense when cross-compiling."
1587
+
1588
+    case "$cc_type" in
1589
+        gcc)
1590
+            check_native(){
1591
+                $cc $1=native -v -c -o $TMPO $TMPC >$TMPE 2>&1 || return
1592
+                awk "/$1=/{ match(\$0, /$1=(\\w+)/, a);print a[1];exit }" $TMPE
1593
+            }
1594
+            cpu=$(check_native -march || check_native -mcpu)
1595
+        ;;
1596
+    esac
1597
+
1598
+    test "${cpu:-host}" = host && die "--cpu=host not supported with compiler $cc"
1599
+fi
1600
+
1585 1601
 # Add processor-specific flags
1586 1602
 case $cpu in
1587 1603
     601|ppc601|PowerPC601)