diff options
author | wm4 <wm4@nowhere> | 2012-07-29 17:20:57 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2012-07-30 01:37:28 +0200 |
commit | 74df1d8e05aa226c7e82a6d84f43c873ee234561 (patch) | |
tree | c75185bd2d82e06564c03c41577475f425e44edf | |
parent | a4bab723b30fe6190fb137b67bba521e55276cf6 (diff) | |
download | mpv-74df1d8e05aa226c7e82a6d84f43c873ee234561.tar.bz2 mpv-74df1d8e05aa226c7e82a6d84f43c873ee234561.tar.xz |
Remove compile time/runtime CPU detection, and drop some platforms
mplayer had three ways of enabling CPU specific assembler routines:
a) Enable them at compile time; crash if the CPU can't handle it.
b) Enable them at compile time, but let the configure script detect
your CPU. Your binary will only crash if you try to run it on a
different system that has less features than yours.
This was the default, I think.
c) Runtime detection.
The implementation of b) and c) suck. a) is not really feasible (it
sucks for users). Remove all code related to this, and use libav's CPU
detection instead. Now the configure script will always enable CPU
specific features, and disable them at runtime if libav reports them
not as available.
One implication is that now the compiler is always expected to handle
SSE (etc.) inline assembly at runtime, unless it's explicitly disabled.
Only checks for x86 CPU specific features are kept, the rest is either
unused or barely used.
Get rid of all the dump -mpcu, -march etc. flags. Trust the compiler
to select decent settings.
Get rid of support for the following operating systems:
- BSD/OS (some ancient BSD fork)
- QNX (don't care)
- BeOS (dead, Haiku support is still welcome)
- AIX (don't care)
- HP-UX (don't care)
- OS/2 (dead, actual support has been removed a while ago)
Remove the configure code for detecting the endianness. Instead, use
the standard header <endian.h>, which can be used if _GNU_SOURCE or
_BSD_SOURCE is defined. (Maybe these changes should have been in a
separate commit.)
Since this is a quite violent code removal orgy, and I'm testing only
on x86 32 bit Linux, expect regressions.
-rwxr-xr-x | configure | 1082 | ||||
-rw-r--r-- | cpudetect.c | 510 | ||||
-rw-r--r-- | cpudetect.h | 24 | ||||
-rw-r--r-- | libaf/af_format.c | 5 | ||||
-rw-r--r-- | libaf/af_format.h | 5 | ||||
-rw-r--r-- | libao2/ao_coreaudio.c | 3 | ||||
-rw-r--r-- | libao2/ao_oss.c | 3 | ||||
-rw-r--r-- | libmpcodecs/ad_hwac3.c | 4 | ||||
-rw-r--r-- | libmpcodecs/ad_liba52.c | 4 | ||||
-rw-r--r-- | libmpcodecs/img_format.h | 5 | ||||
-rw-r--r-- | libmpcodecs/vd_ffmpeg.c | 3 | ||||
-rw-r--r-- | libmpcodecs/vf.c | 3 | ||||
-rw-r--r-- | libmpcodecs/vf_scale.c | 6 | ||||
-rw-r--r-- | libmpdemux/asf.h | 6 | ||||
-rw-r--r-- | libmpdemux/aviheader.h | 5 | ||||
-rw-r--r-- | libmpdemux/ms_hdr.h | 3 | ||||
-rw-r--r-- | libvo/osd.c | 3 | ||||
-rw-r--r-- | libvo/osd_template.c | 2 | ||||
-rw-r--r-- | libvo/vo_x11.c | 5 | ||||
-rw-r--r-- | loader/win32.c | 28 | ||||
-rw-r--r-- | mplayer.c | 29 | ||||
-rw-r--r-- | stream/stream_cdda.c | 3 |
22 files changed, 126 insertions, 1615 deletions
@@ -186,29 +186,22 @@ die () { issystem() { test "$(echo $system_name | tr A-Z a-z)" = "$(echo $1 | tr A-Z a-z)" } -aix() { issystem "AIX"; } -amigaos() { issystem "AmigaOS"; } -beos() { issystem "BEOS"; } -bsdos() { issystem "BSD/OS"; } cygwin() { issystem "CYGWIN"; } darwin() { issystem "Darwin"; } dragonfly() { issystem "DragonFly"; } freebsd() { issystem "FreeBSD" || issystem "GNU/kFreeBSD"; } gnu() { issystem "GNU"; } -hpux() { issystem "HP-UX"; } linux() { issystem "Linux"; } mingw32() { issystem "MINGW32"; } morphos() { issystem "MorphOS"; } netbsd() { issystem "NetBSD"; } openbsd() { issystem "OpenBSD"; } -qnx() { issystem "QNX"; } win32() { cygwin || mingw32; } # arch test boolean functions -# x86/x86pc is used by QNX x86_32() { case "$host_arch" in - i[3-9]86|x86|x86pc|k5|k6|k6-2|k6-3|pentium*|athlon*|i586-i686) return 0 ;; + i[3-9]86|k5|k6|k6-2|k6-3|pentium*|athlon*|i586-i686) return 0 ;; *) return 1 ;; esac } @@ -429,7 +422,6 @@ Available values for --language-man are: all $man_lang_all Available values for --language-msg are: all $msg_lang_all Miscellaneous options: - --enable-runtime-cpudetection enable runtime CPU detection [disable] --enable-cross-compile enable cross-compilation [disable] --cc=COMPILER C compiler to build MPlayer [gcc] --pkg-config=PKGCONFIG pkg-config to find some libraries [pkg-config] @@ -439,22 +431,7 @@ Miscellaneous options: --with-install=PATH path to a custom install program Advanced options: - --enable-mmx enable MMX [autodetect] - --enable-mmxext enable MMX2 (Pentium III, Athlon) [autodetect] - --enable-3dnow enable 3DNow! [autodetect] - --enable-3dnowext enable extended 3DNow! [autodetect] - --enable-sse enable SSE [autodetect] - --enable-sse2 enable SSE2 [autodetect] - --enable-ssse3 enable SSSE3 [autodetect] --enable-shm enable shm [autodetect] - --enable-altivec enable AltiVec (PowerPC) [autodetect] - --enable-armv5te enable DSP extensions (ARM) [autodetect] - --enable-armv6 enable ARMv6 (ARM) [autodetect] - --enable-armv6t2 enable ARMv6t2 (ARM) [autodetect] - --enable-armvfp enable ARM VFP (ARM) [autodetect] - --enable-neon enable NEON (ARM) [autodetect] - --enable-iwmmxt enable iWMMXt (ARM) [autodetect] - --enable-big-endian force byte order to big-endian [autodetect] --enable-debug[=1-3] compile-in debugging information [disable] --enable-profile compile-in profiling information [disable] --disable-sighandler disable sighandler for crashes [enable] @@ -480,29 +457,11 @@ exit 0 # GOTCHA: the variables below defines the default behavior for autodetection # and have - unless stated otherwise - at least 2 states : yes no # If autodetection is available then the third state is: auto -_mmx=auto -_3dnow=auto -_3dnowext=auto -_mmxext=auto -_sse=auto -_sse2=auto -_ssse3=auto -_cmov=auto -_fast_cmov=auto -_fast_clz=auto -_armv5te=auto -_armv6=auto -_armv6t2=auto -_armvfp=auto -neon=auto -_iwmmxt=auto -_altivec=auto _install=install _pkg_config=auto _windres=auto _cc=auto test "$CC" && _cc="$CC" -_runtime_cpudetection=no _cross_compile=no _prefix="/usr/local" ffmpeg=auto @@ -606,7 +565,6 @@ _sighandler=yes _libdv=auto _cdda=auto _cddb=auto -_big_endian=auto _qtx=auto _coreaudio=auto _corevideo=auto @@ -741,8 +699,6 @@ for ac_option do ;; --enable-translation) _translation=yes ;; --disable-translation) _translation=no ;; - --enable-runtime-cpudetection) _runtime_cpudetection=yes ;; - --disable-runtime-cpudetection) _runtime_cpudetection=no ;; --enable-cross-compile) _cross_compile=yes ;; --disable-cross-compile) _cross_compile=no ;; --enable-mplayer) _mplayer=yes ;; @@ -923,8 +879,6 @@ for ac_option do --disable-select) _select=no ;; --enable-cddb) _cddb=yes ;; --disable-cddb) _cddb=no ;; - --enable-big-endian) _big_endian=yes ;; - --disable-big-endian) _big_endian=no ;; --enable-unrarexec) _unrar_exec=yes ;; --disable-unrarexec) _unrar_exec=no ;; --enable-ftp) _ftp=yes ;; @@ -979,42 +933,6 @@ for ac_option do --enable-win32dll) _win32dll=yes ;; --disable-win32dll) _win32dll=no ;; - --enable-sse) _sse=yes ;; - --disable-sse) _sse=no ;; - --enable-sse2) _sse2=yes ;; - --disable-sse2) _sse2=no ;; - --enable-ssse3) _ssse3=yes ;; - --disable-ssse3) _ssse3=no ;; - --enable-mmxext) _mmxext=yes ;; - --disable-mmxext) _mmxext=no ;; - --enable-3dnow) _3dnow=yes ;; - --disable-3dnow) _3dnow=no _3dnowext=no ;; - --enable-3dnowext) _3dnow=yes _3dnowext=yes ;; - --disable-3dnowext) _3dnowext=no ;; - --enable-cmov) _cmov=yes ;; - --disable-cmov) _cmov=no ;; - --enable-fast-cmov) _fast_cmov=yes ;; - --disable-fast-cmov) _fast_cmov=no ;; - --enable-fast-clz) _fast_clz=yes ;; - --disable-fast-clz) _fast_clz=no ;; - --enable-altivec) _altivec=yes ;; - --disable-altivec) _altivec=no ;; - --enable-armv5te) _armv5te=yes ;; - --disable-armv5te) _armv5te=no ;; - --enable-armv6) _armv6=yes ;; - --disable-armv6) _armv6=no ;; - --enable-armv6t2) _armv6t2=yes ;; - --disable-armv6t2) _armv6t2=no ;; - --enable-armvfp) _armvfp=yes ;; - --disable-armvfp) _armvfp=no ;; - --enable-neon) neon=yes ;; - --disable-neon) neon=no ;; - --enable-iwmmxt) _iwmmxt=yes ;; - --disable-iwmmxt) _iwmmxt=no ;; - --enable-mmx) _mmx=yes ;; - --disable-mmx) # 3Dnow! and MMX2 require MMX - _3dnow=no _3dnowext=no _mmx=no _mmxext=no ;; - *) echo "Unknown parameter: $ac_option" >&2 exit 1 @@ -1084,26 +1002,20 @@ if test -z "$_target" ; then # OS name system_name=$(uname -s 2>&1) case "$system_name" in - Linux|FreeBSD|NetBSD|OpenBSD|DragonFly|BSD/OS|Darwin|QNX|GNU|BeOS|MorphOS|AIX|AmigaOS) + Linux|FreeBSD|NetBSD|OpenBSD|DragonFly|Darwin|GNU|MorphOS) ;; Haiku) - system_name=BeOS + system_name=Haiku ;; GNU/kFreeBSD) system_name=FreeBSD ;; - HP-UX*) - system_name=HP-UX - ;; [cC][yY][gG][wW][iI][nN]*) system_name=CYGWIN ;; MINGW32*) system_name=MINGW32 ;; - OS/2*) - system_name=OS/2 - ;; *) system_name="$system_name-UNKNOWN" ;; @@ -1124,9 +1036,8 @@ if test -z "$_target" ; then # Maybe uname -m (machine hardware name) returns something we # recognize. - # x86/x86pc is used by QNX case "$(uname -m 2>&1)" in - x86_64|amd64|i[3-9]86*|x86|x86pc|k5|k6|k6_2|k6_3|k6-2|k6-3|pentium*|athlon*|i586_i686|i586-i686|BePC) host_arch=i386 ;; + x86_64|amd64|i[3-9]86*|k5|k6|k6_2|k6_3|k6-2|k6-3|pentium*|athlon*|i586_i686|i586-i686|BePC) host_arch=i386 ;; ia64) host_arch=ia64 ;; macppc|ppc) host_arch=ppc ;; ppc64) host_arch=ppc64 ;; @@ -1153,12 +1064,9 @@ else # if test -z "$_target" freebsd) system_name=FreeBSD ;; gnu/kfreebsd) system_name=FreeBSD ;; netbsd) system_name=NetBSD ;; - bsd/os) system_name=BSD/OS ;; openbsd) system_name=OpenBSD ;; dragonfly) system_name=DragonFly ;; - qnx) system_name=QNX ;; morphos) system_name=MorphOS ;; - amigaos) system_name=AmigaOS ;; mingw32*) system_name=MINGW32 ;; *) continue ;; esac @@ -1189,10 +1097,6 @@ if darwin; then _timer=timer-darwin.c fi -if aix ; then - extra_ldflags="$extra_ldflags -lC" -fi - if win32 ; then _exesuf=".exe" extra_cflags="$extra_cflags -fno-common" @@ -1211,29 +1115,12 @@ if mingw32 ; then extra_cflags="$extra_cflags -D__USE_MINGW_ANSI_STDIO=1" fi -if amigaos ; then - _select=no - _sighandler=no - _stream_cache=no - def_stream_cache="#undef CONFIG_STREAM_CACHE" - extra_cflags="-DNEWLIB -D__USE_INLINE__ $extra_cflags" -fi - -if qnx ; then - extra_ldflags="$extra_ldflags -lph" -fi - TMPC="$mplayer_tmpdir/tmp.c" TMPCPP="$mplayer_tmpdir/tmp.cpp" TMPEXE="$mplayer_tmpdir/tmp$_exesuf" TMPH="$mplayer_tmpdir/tmp.h" TMPS="$mplayer_tmpdir/tmp.S" -if test "$_runtime_cpudetection" = yes && ! x86 && ! ppc; then - die "Runtime CPU detection only works for x86, x86-64 and PPC!" -fi - - # Checking CC version... # Intel C++ Compilers (no autoselect, use CC=/some/binary ./configure) if test "$(basename $_cc)" = "icc" || test "$(basename $_cc)" = "ecc"; then @@ -1321,350 +1208,16 @@ fi # XXX: this should be ok.. _cpuinfo="echo" -if test "$_runtime_cpudetection" = no ; then - -# Cygwin has /proc/cpuinfo, but only supports Intel CPUs -# FIXME: Remove the cygwin check once AMD CPUs are supported -if test -r /proc/cpuinfo && ! cygwin; then - # Linux with /proc mounted, extract CPU information from it - _cpuinfo="cat /proc/cpuinfo" -elif test -r /compat/linux/proc/cpuinfo && ! x86 ; then - # FreeBSD with Linux emulation /proc mounted, - # extract CPU information from it - # Don't use it on x86 though, it never reports 3Dnow - _cpuinfo="cat /compat/linux/proc/cpuinfo" -elif darwin && ! x86 ; then - # use hostinfo on Darwin - _cpuinfo="hostinfo" -elif aix; then - # use 'lsattr' on AIX - _cpuinfo="lsattr -E -l proc0 -a type" -elif x86; then - # all other OSes try to extract CPU information from a small helper - # program cpuinfo instead - $_cc -o cpuinfo$_exesuf cpuinfo.c - _cpuinfo="./cpuinfo$_exesuf" -fi - -if x86 ; then - # gather more CPU information - pname=$($_cpuinfo | grep 'model name' | cut -d ':' -f 2 | head -n 1) - pvendor=$($_cpuinfo | grep 'vendor_id' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -n 1) - pfamily=$($_cpuinfo | grep 'cpu family' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -n 1) - pmodel=$($_cpuinfo | grep -v 'model name' | grep 'model' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -n 1) - pstepping=$($_cpuinfo | grep 'stepping' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -n 1) - - exts=$($_cpuinfo | egrep 'features|flags' | cut -d ':' -f 2 | head -n 1) - - pparam=$(echo $exts | sed -e s/xmm/sse/ -e s/kni/sse/) - # SSE implies MMX2, but not all SSE processors report the mmxext CPU flag. - pparam=$(echo $pparam | sed -e 's/sse/sse mmxext/') - - for ext in $pparam ; do - eval test \"\$_$ext\" = auto 2>/dev/null && eval _$ext=kernel_check - done - - echocheck "CPU vendor" - echores "$pvendor ($pfamily:$pmodel:$pstepping)" - - echocheck "CPU type" - echores "$pname" -fi - -fi # test "$_runtime_cpudetection" = no - -if x86 && test "$_runtime_cpudetection" = no ; then - extcheck() { - if test "$1" = kernel_check ; then - echocheck "kernel support of $2" - cat > $TMPC <<EOF -#include <stdlib.h> -#include <signal.h> -static void catch(int sig) { exit(1); } -int main(void) { - signal(SIGILL, catch); - __asm__ volatile ("$3":::"memory"); return 0; -} -EOF - - if cc_check && tmp_run ; then - eval _$2=yes - echores "yes" - _optimizing="$_optimizing $2" - return 0 - else - eval _$2=no - echores "failed" - echo "It seems that your kernel does not correctly support $2." - echo "To use $2 extensions in MPlayer, you have to upgrade/recompile your kernel!" - return 1 - fi - fi - return 0 - } - - extcheck $_mmx "mmx" "emms" - extcheck $_mmxext "mmxext" "sfence" - extcheck $_3dnow "3dnow" "femms" - extcheck $_3dnowext "3dnowext" "pswapd %%mm0, %%mm0" - extcheck $_sse "sse" "xorps %%xmm0, %%xmm0" || _gcc3_ext="$_gcc3_ext -mno-sse" - extcheck $_sse2 "sse2" "xorpd %%xmm0, %%xmm0" || _gcc3_ext="$_gcc3_ext -mno-sse2" - extcheck $_ssse3 "ssse3" "pabsd %%xmm0, %%xmm0" - extcheck $_cmov "cmov" "cmovb %%eax, %%ebx" - - if test "$_gcc3_ext" != ""; then - # if we had to disable sse/sse2 because the active kernel does not - # support this instruction set extension, we also have to tell - # gcc3 to not generate sse/sse2 instructions for normal C code - cflag_check $_march $_gcc3_ext && _march="$_march $_gcc3_ext" - fi - -fi - def_fast_64bit='#define HAVE_FAST_64BIT 0' -def_fast_unaligned='#define HAVE_FAST_UNALIGNED 0' arch_all='X86 IA64 SPARC ARM AVR32 SH4 PPC ALPHA MIPS PA_RISC S390 S390X VAX BFIN XTENSA TOMI GENERIC' subarch_all='X86_32 X86_64 PPC64' case "$host_arch" in i[3-9]86|x86|x86pc|k5|k6|k6-2|k6-3|pentium*|athlon*|i586-i686) - arch='x86' - subarch='x86_32' - def_fast_unaligned='#define HAVE_FAST_UNALIGNED 1' - iproc=486 - proc=i486 - - - if test "$_runtime_cpudetection" = no ; then - case "$pvendor" in - AuthenticAMD) - case "$pfamily" in - 3) proc=i386 iproc=386 ;; - 4) proc=i486 iproc=486 ;; - 5) iproc=586 # LGB: models are: K5/SSA5 K5 K5 K5 ? ? K6 K6 K6-2 K6-3 - # K6 model 13 are the K6-2+ and K6-III+, only differing in cache size. - if test "$pmodel" -eq 9 -o "$pmodel" -eq 13; then - proc=k6-3 - elif test "$pmodel" -eq 5 -o "$pmodel" -eq 10; then - proc=geode - elif test "$pmodel" -ge 8; then - proc=k6-2 - elif test "$pmodel" -ge 6; then - proc=k6 - else - proc=i586 - fi - ;; - 6) iproc=686 - # It's a bit difficult to determine the correct type of Family 6 - # AMD CPUs just from their signature. Instead, we check directly - # whether it supports SSE. - if test "$_sse" = yes; then - # gcc treats athlon-xp, athlon-4 and athlon-mp similarly. - proc=athlon-xp - else - # Again, gcc treats athlon and athlon-tbird similarly. - proc=athlon - fi - ;; - 15) iproc=686 - # k8 cpu-type only supported in gcc >= 3.4.0, but that will be - # caught and remedied in the optimization tests below. - proc=k8 - ;; - - *) proc=amdfam10 iproc=686 - test $_fast_clz = "auto" && _fast_clz=yes - ;; - esac - ;; - GenuineIntel) - case "$pfamily" in - 3) proc=i386 iproc=386 ;; - 4) proc=i486 iproc=486 ;; - 5) iproc=586 - if test "$pmodel" -eq 4 || test "$pmodel" -eq 8; then - proc=pentium-mmx # 4 is desktop, 8 is mobile - else - proc=i586 - fi - ;; - 6) iproc=686 - if test "$pmodel" -ge 15; then - proc=core2 - elif test "$pmodel" -eq 9 -o "$pmodel" -ge 13; then - proc=pentium-m - elif test "$pmodel" -ge 7; then - proc=pentium3 - elif test "$pmodel" -ge 3; then - proc=pentium2 - else - proc=i686 - fi - test $_fast_clz = "auto" && _fast_clz=yes - ;; - 15) iproc=686 - # A nocona in 32-bit mode has no more capabilities than a prescott. - if test "$pmodel" -ge 3; then - proc=prescott - else - proc=pentium4 - test $_fast_clz = "auto" && _fast_clz=yes - fi - test $_fast_cmov = "auto" && _fast_cmov=no - ;; - *) proc=prescott iproc=686 ;; - esac - ;; - CentaurHauls) - case "$pfamily" in - 5) iproc=586 - if test "$pmodel" -ge 8; then - proc=winchip2 - elif test "$pmodel" -ge 4; then - proc=winchip-c6 - else - proc=i586 - fi - ;; - 6) iproc=686 - if test "$pmodel" -ge 9; then - proc=c3-2 - else - proc=c3 - iproc=586 - fi - ;; - *) proc=i686 iproc=i686 ;; - esac - ;; - unknown) - case "$pfamily" in - 3) proc=i386 iproc=386 ;; - 4) proc=i486 iproc=486 ;; - *) proc=i586 iproc=586 ;; - esac - ;; - *) - proc=i586 iproc=586 ;; - esac - test $_fast_clz = "auto" && _fast_clz=no - fi # test "$_runtime_cpudetection" = no - - - # check that gcc supports our CPU, if not, fall back to earlier ones - # LGB: check -mcpu and -march swithing step by step with enabling - # to fall back till 386. - - # gcc >= 3.4.0 doesn't support -mcpu, we have to use -mtune instead - - if [ "$cc_vendor" = "gnu" ] && ([ "$_cc_major" -gt 3 ] || ( [ "$_cc_major" = 3 ] && [ "$_cc_minor" -ge 4 ])) ; then - cpuopt=-mtune - else - cpuopt=-mcpu - fi - - echocheck "GCC & CPU optimization abilities" - if test "$_runtime_cpudetection" = no ; then - if test $cc_vendor != "intel" && test $cc_vendor != "clang" ; then - cflag_check -march=native && proc=native - fi - if test "$proc" = "amdfam10"; then - cflag_check -march=$proc $cpuopt=$proc || proc=k8 - fi - if test "$proc" = "k8"; then - cflag_check -march=$proc $cpuopt=$proc || proc=athlon-xp - fi - if test "$proc" = "athlon-xp"; then - cflag_check -march=$proc $cpuopt=$proc || proc=athlon - fi - if test "$proc" = "k6-3" || test "$proc" = "k6-2"; then - cflag_check -march=$proc $cpuopt=$proc || proc=k6 - fi - if test "$proc" = "k6" || test "$proc" = "c3"; then - if ! cflag_check -march=$proc $cpuopt=$proc; then - if cflag_check -march=i586 $cpuopt=i686; then - proc=i586-i686 - else - proc=i586 - fi - fi - fi - if test "$proc" = "prescott" ; then - cflag_check -march=$proc $cpuopt=$proc || proc=pentium4 - fi - if test "$proc" = "core2" ; then - cflag_check -march=$proc $cpuopt=$proc || proc=pentium-m - fi - if test "$proc" = "pentium4" || test "$proc" = "pentium-m" || test "$proc" = "pentium3" || test "$proc" = "pentium2" || test "$proc" = "athlon" || test "$proc" = "c3-2" || test "$proc" = "geode"; then - cflag_check -march=$proc $cpuopt=$proc || proc=i686 - fi - if test "$proc" = "i686" || test "$proc" = "pentium-mmx" || test "$proc" = "winchip-c6" || test "$proc" = "winchip2"; then - cflag_check -march=$proc $cpuopt=$proc || proc=i586 - fi - if test "$proc" = "i586"; then - cflag_check -march=$proc $cpuopt=$proc || proc=i486 - fi - if test "$proc" = "i486" ; then - cflag_check -march=$proc $cpuopt=$proc || proc=i386 - fi - if test "$proc" = "i386" ; then - cflag_check -march=$proc $cpuopt=$proc || proc=error - fi - if test "$proc" = "error" ; then - echores "CPU optimization disabled. CPU not recognized or your compiler is too old." - _mcpu="" - _march="" - _optimizing="" - elif test "$proc" = "i586-i686"; then - _march="-march=i586" - _mcpu="$cpuopt=i686" - _optimizing="$proc" - else - _march="-march=$proc" - _mcpu="$cpuopt=$proc" - _optimizing="$proc" - fi - else # if test "$_runtime_cpudetection" = no - _mcpu="$cpuopt=generic" - # at least i486 required, for bswap instruction - _march="-march=i486" - cflag_check $_mcpu || _mcpu="$cpuopt=i686" - cflag_check $_mcpu || _mcpu="" - cflag_check $_march $_mcpu || _march="" - fi - - ## Gabucino : --target takes effect here (hopefully...) by overwriting - ## autodetected mcpu/march parameters - if test "$_target" ; then - # TODO: it may be a good idea to check GCC and fall back in all cases - if test "$host_arch" = "i586-i686"; then - _march="-march=i586" - _mcpu="$cpuopt=i686" - else - _march="-march=$host_arch" - _mcpu="$cpuopt=$host_arch" - fi - - proc="$host_arch" - - case "$proc" in - i386) iproc=386 ;; - i486) iproc=486 ;; - i586|k5|k6|k6-2|k6-3|pentium|pentium-mmx) iproc=586 ;; - i686|athlon*|pentium*) iproc=686 ;; - *) iproc=586 ;; - esac - fi - - if test $_cmov = "yes" && test $_fast_cmov = "auto" ; then - _fast_cmov="yes" - else - _fast_cmov="no" - fi - test $_fast_clz = "auto" && _fast_clz=yes - - echores "$proc" + arch='x86' + subarch='x86_32' + iproc=486 + proc=i486 ;; ia64) @@ -1676,111 +1229,13 @@ case "$host_arch" in x86_64|amd64) arch='x86' subarch='x86_64' - def_fast_unaligned='#define HAVE_FAST_UNALIGNED 1' def_fast_64bit='#define HAVE_FAST_64BIT 1' iproc='x86_64' - - # gcc >= 3.4.0 doesn't support -mcpu, we have to use -mtune instead - if test "$cc_vendor" = "gnu" && test "$_cc_major" -gt 3 -o "$_cc_major" -eq 3 -a "$_cc_minor" -ge 4 ; then - cpuopt=-mtune - else - cpuopt=-mcpu - fi - if test "$_runtime_cpudetection" = no ; then - case "$pvendor" in - AuthenticAMD) - case "$pfamily" in - 15) proc=k8 - test $_fast_clz = "auto" && _fast_clz=no - ;; - *) proc=amdfam10;; - esac - ;; - GenuineIntel) - case "$pfamily" in - 6) proc=core2;; - *) - # 64-bit prescotts exist, but as far as GCC is concerned they - # have the same capabilities as a nocona. - proc=nocona - test $_fast_cmov = "auto" && _fast_cmov=no - test $_fast_clz = "auto" && _fast_clz=no - ;; - esac - ;; - *) - proc=error;; - esac - fi # test "$_runtime_cpudetection" = no - - echocheck "GCC & CPU optimization abilities" - # 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 - cflag_check -march=native && proc=native - fi - # --- AMD processors --- - if test "$proc" = "amdfam10"; then - cflag_check -march=$proc $cpuopt=$proc || proc=k8 - fi - if test "$proc" = "k8"; then - cflag_check -march=$proc $cpuopt=$proc || proc=athlon-xp - fi - # This will fail if gcc version < 3.3, which is ok because earlier - # 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 - fi - # --- Intel processors --- - if test "$proc" = "core2"; then - cflag_check -march=$proc $cpuopt=$proc || proc=x86-64 - fi - if test "$proc" = "x86-64"; then - cflag_check -march=$proc $cpuopt=$proc || proc=nocona - fi - if test "$proc" = "nocona"; then - cflag_check -march=$proc $cpuopt=$proc || proc=pentium4 - fi - if test "$proc" = "pentium4"; then - cflag_check -march=$proc $cpuopt=$proc || proc=error - 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." - _mcpu="" - _march="" - fi - else # if test "$_runtime_cpudetection" = no - # x86-64 is an undocumented option, an intersection of k8 and nocona. - _march="-march=x86-64" - _mcpu="$cpuopt=generic" - cflag_check $_mcpu || _mcpu="x86-64" - cflag_check $_mcpu || _mcpu="" - cflag_check $_march $_mcpu || _march="" - fi - - _optimizing="$proc" - test $_fast_cmov = "auto" && _fast_cmov=yes - test $_fast_clz = "auto" && _fast_clz=yes - - echores "$proc" ;; sparc|sparc64) arch='sparc' iproc='sparc' - if test "$host_arch" = "sparc64" ; then - _vis='yes' - proc='ultrasparc' - def_fast_64bit='#define HAVE_FAST_64BIT 1' - else - proc=v8 - fi - _mcpu="-mcpu=$proc" - _optimizing="$proc" ;; arm*) @@ -1790,9 +1245,7 @@ case "$host_arch" in avr32) arch='avr32' - def_fast_unaligned='#define HAVE_FAST_UNALIGNED 1' iproc='avr32' - test $_fast_clz = "auto" && _fast_clz=yes ;; sh|sh4) @@ -1802,167 +1255,17 @@ case "$host_arch" in ppc|ppc64|powerpc|powerpc64) arch='ppc' - def_dcbzl='#define HAVE_DCBZL 0' - def_fast_unaligned='#define HAVE_FAST_UNALIGNED 1' iproc='ppc' - - if test "$host_arch" = "ppc64" -o "$host_arch" = "powerpc64" ; then - subarch='ppc64' - def_fast_64bit='#define HAVE_FAST_64BIT 1' - fi - echocheck "CPU type" - case $system_name in - Linux) - proc=$($_cpuinfo | grep 'cpu' | cut -d ':' -f 2 | cut -d ',' -f 1 | cut -b 2- | head -n 1) - if test -n "$($_cpuinfo | grep altivec)"; then - test $_altivec = auto && _altivec=yes - fi - ;; - Darwin) - proc=$($_cpuinfo | grep "Processor type" | cut -f 3 -d ' ' | sed 's/ppc//') - if [ $(sysctl -n hw.vectorunit) -eq 1 -o \ - "$(sysctl -n hw.optional.altivec 2> /dev/null)" = "1" ]; then - test $_altivec = auto && _altivec=yes - fi - ;; - NetBSD) - # only gcc 3.4 works reliably with AltiVec code under NetBSD - case $cc_version in - 2*|3.0*|3.1*|3.2*|3.3*) - ;; - *) - if [ $(sysctl -n machdep.altivec) -eq 1 ]; then - test $_altivec = auto && _altivec=yes - fi - ;; - esac - ;; - AIX) - proc=$($_cpuinfo | grep 'type' | cut -f 2 -d ' ' | sed 's/PowerPC_//') - ;; - esac - if test "$_altivec" = yes; then - echores "$proc altivec" - else - _altivec=no - echores "$proc" - fi - - echocheck "GCC & CPU optimization abilities" - - if test -n "$proc"; then - case "$proc" in - 601) _march='-mcpu=601' _mcpu='-mtune=601' ;; - 603) _march='-mcpu=603' _mcpu='-mtune=603' ;; - 603e|603ev) _march='-mcpu=603e' _mcpu='-mtune=603e' ;; - 604|604e|604r|604ev) _march='-mcpu=604' _mcpu='-mtune=604' ;; - 740|740/750|745/755) _march='-mcpu=740' _mcpu='-mtune=740' ;; - 750|750CX) _march='-mcpu=750' _mcpu='-mtune=750' ;; - POWER) _march='-mcpu=power' _mcpu='-mtune=power' ;; - POWER2) _march='-mcpu=power2' _mcpu='-mtune=power2' ;; - POWER3) _march='-mcpu=power3' _mcpu='-mtune=power3' ;; - *) ;; - esac - # gcc 3.1(.1) and up supports 7400 and 7450 - if test "$_cc_major" -ge "3" && test "$_cc_minor" -ge "1" || test "$_cc_major" -ge "4"; then - case "$proc" in - 7400*|7410*) _march='-mcpu=7400' _mcpu='-mtune=7400' ;; - 7447*|7450*|7455*) _march='-mcpu=7450' _mcpu='-mtune=7450' ;; - *) ;; - esac - fi - # gcc 3.2 and up supports 970 - if test "$_cc_major" -ge "3" && test "$_cc_minor" -ge "3" || test "$_cc_major" -ge "4"; then - case "$proc" in - 970*|PPC970*) _march='-mcpu=970' _mcpu='-mtune=970' - def_dcbzl='#define HAVE_DCBZL 1' ;; - *) ;; - esac - fi - # gcc 3.3 and up supports POWER4 - if test "$_cc_major" -ge "3" && test "$_cc_minor" -ge "3" || test "$_cc_major" -ge "4"; then - case "$proc" in - POWER4) _march='-mcpu=power4' _mcpu='-mtune=power4' ;; - *) ;; - esac - fi - # gcc 3.4 and up supports 440* - if test "$_cc_major" -ge "3" && test "$_cc_minor" -ge "4" || test "$_cc_major" -ge "4"; then - case "$proc" in - 440EP*) _march='-mcpu=440fp' _mcpu='-mtune=440fp' ;; - 440G* ) _march='-mcpu=440' _mcpu='-mtune=440' ;; - *) ;; - esac - fi - # gcc 4.0 and up supports POWER5 - if test "$_cc_major" -ge "4"; then - case "$proc" in - POWER5*) _march='-mcpu=power5' _mcpu='-mtune=power5' ;; - *) ;; - esac - fi - fi - - if test -n "$_mcpu"; then - _optimizing=$(echo $_mcpu | cut -c 8-) - echores "$_optimizing" - else - echores "none" - fi - - test $_fast_clz = "auto" && _fast_clz=yes - ;; |