[MPlayer-cvslog] r37408 - trunk/configure

ib subversion at mplayerhq.hu
Mon Jun 1 00:15:16 CEST 2015


Author: ib
Date: Mon Jun  1 00:15:16 2015
New Revision: 37408

Log:
Support compiling without CPU optimization.

In case the compiler already creates CPU specific, optimized code
any automatic optimization by the use of -march/-mtune/-mcpu is
unwelcome, so add an option to be able to disable this optimization.

Modified:
   trunk/configure

Modified: trunk/configure
==============================================================================
--- trunk/configure	Sun May 31 23:56:43 2015	(r37407)
+++ trunk/configure	Mon Jun  1 00:15:16 2015	(r37408)
@@ -544,6 +544,7 @@ Available values are: all $msg_lang_all
 
 Miscellaneous options:
   --enable-runtime-cpudetection    enable runtime CPU detection [disable]
+  --disable-optimization disable compile time CPU code optimization [enable]
   --enable-cross-compile enable cross-compilation [autodetect]
   --cc=COMPILER          C compiler to build MPlayer [gcc]
   --host-cc=COMPILER     C compiler for tools needed while building [gcc]
@@ -656,6 +657,7 @@ _as=auto
 _nm=auto
 _yasm=yasm
 _runtime_cpudetection=no
+_optimization=yes
 _cross_compile=auto
 _prefix="/usr/local"
 ffmpeg_a=auto
@@ -1004,6 +1006,8 @@ for ac_option do
     ;;
   --enable-runtime-cpudetection)    _runtime_cpudetection=yes   ;;
   --disable-runtime-cpudetection)   _runtime_cpudetection=no    ;;
+  --enable-optimization)            _optimization=yes           ;;
+  --disable-optimization)           _optimization=no            ;;
   --enable-cross-compile)           _cross_compile=yes          ;;
   --disable-cross-compile)          _cross_compile=no           ;;
   --enable-mencoder)    _mencoder=yes   ;;
@@ -2170,9 +2174,11 @@ case "$host_arch" in
         cpuopt=-mcpu
     fi
 
-    echocheck "GCC & CPU optimization abilities"
+  test "$_optimization" = "no" && proc=none
+
+  echocheck "GCC & CPU optimization"
   if test "$_runtime_cpudetection" = no ; then
-    if test $cc_vendor != "intel" && test $cc_vendor != "clang" ; then
+    if test "$_optimization" = "yes" && test $cc_vendor != "intel" && test $cc_vendor != "clang" ; then
       cflag_check -march=native && proc=native
     fi
     if test "$proc" = "amdfam10"; then
@@ -2218,13 +2224,13 @@ case "$host_arch" in
       cflag_check -march=$proc $cpuopt=$proc  || proc=i386
     fi
     if test "$proc" = "i386" ; then
-      cflag_check -march=$proc $cpuopt=$proc  || proc=error
+      cflag_check -march=$proc $cpuopt=$proc  || proc=none
     fi
-    if test "$proc" = "error" ; then
-        echores "CPU optimization disabled. CPU not recognized or your compiler is too old."
+    if test "$proc" = "none" ; then
+      test "$_optimization" = "yes" && echores "CPU optimization disabled. CPU not recognized or your compiler is too old."
       _mcpu=""
       _march=""
-      _optimizing=""
+      _optimizing="$proc"
     elif test "$proc" = "i586-i686"; then
       _march="-march=i586"
       _mcpu="$cpuopt=i686"
@@ -2332,14 +2338,16 @@ case "$host_arch" in
         esac
         ;;
       *)
-        proc=error;;
+        proc=none;;
       esac
     fi # test "$_runtime_cpudetection" = no
 
-    echocheck "GCC & CPU optimization abilities"
+    test "$_optimization" = "no" && proc=none
+
+    echocheck "GCC & CPU optimization"
     # This is a stripped-down version of the i386 fallback.
     if test "$_runtime_cpudetection" = no ; then
-      if test $cc_vendor != "intel" && test $cc_vendor != "clang" ; then
+      if test "$_optimization" = "yes" && test $cc_vendor != "intel" && test $cc_vendor != "clang" ; then
         cflag_check -march=native && proc=native
       fi
       # --- AMD processors ---
@@ -2353,7 +2361,7 @@ case "$host_arch" in
       # versions don't really support 64-bit on amd64.
       # Is this a valid assumption? -Corey
       if test "$proc" = "athlon-xp"; then
-        cflag_check -march=$proc $cpuopt=$proc || proc=error
+        cflag_check -march=$proc $cpuopt=$proc || proc=none
       fi
       # --- Intel processors ---
       if test "$proc" = "atom" || test "$proc" = "corei7-avx" || test "$proc" = "corei7"; then
@@ -2369,13 +2377,13 @@ case "$host_arch" in
         cflag_check -march=$proc $cpuopt=$proc || proc=pentium4
       fi
       if test "$proc" = "pentium4"; then
-        cflag_check -march=$proc $cpuopt=$proc || proc=error
+        cflag_check -march=$proc $cpuopt=$proc || proc=none
       fi
 
       _march="-march=$proc"
       _mcpu="$cpuopt=$proc"
-      if test "$proc" = "error" ; then
-        echores "CPU optimization disabled. CPU not recognized or your compiler is too old."
+      if test "$proc" = "none" ; then
+        test "$_optimization" = "yes" && echores "CPU optimization disabled. CPU not recognized or your compiler is too old."
         _mcpu=""
         _march=""
       fi
@@ -2503,7 +2511,9 @@ case "$host_arch" in
         echores "$proc"
     fi
 
-    echocheck "GCC & CPU optimization abilities"
+    test "$_optimization" = "no" && proc=none
+
+    echocheck "GCC & CPU optimization"
 
     if test -n "$proc"; then
         case "$proc" in
@@ -2596,14 +2606,16 @@ EOF
     esac
     echores "$proc"
 
-    echocheck "GCC & CPU optimization abilities"
+    test "$_optimization" = "no" && proc=none
+
+    echocheck "GCC & CPU optimization"
     if test "$proc" = "ev68" ; then
       cc_check -mcpu=$proc || proc=ev67
     fi
     if test "$proc" = "ev67" ; then
       cc_check -mcpu=$proc || proc=ev6
     fi
-    _mcpu="-mcpu=$proc"
+    test "$_optimization" = "yes" && _mcpu="-mcpu=$proc"
     echores "$proc"
 
     test $_fast_clz = "auto" && _fast_clz=yes


More information about the MPlayer-cvslog mailing list