📄 configure
字号:
cat > $TMPC << EOFint main(void) { return 0; }EOF if test "$_runtime_cpudetection" = no ; then if test "$proc" = "athlon-xp" || test "$proc" = "athlon-4" || test "$proc" = "athlon-tbird"; then cc_check -march=$proc $cpuopt=$proc || proc=athlon fi if test "$proc" = "k6-3" || test "$proc" = "k6-2"; then cc_check -march=$proc $cpuopt=$proc || proc=k6 fi if test "$proc" = "k6"; then if not cc_check -march=$proc $cpuopt=$proc; then if cc_check -march=i586 $cpuopt=i686; then proc=i586-i686 else proc=i586 fi fi fi if test "$proc" = "pentium4" || test "$proc" = "pentium3" || test "$proc" = "pentium2" || test "$proc" = "athlon"; then cc_check -march=$proc $cpuopt=$proc || proc=i686 fi if test "$proc" = "i686" || test "$proc" = "pentium-mmx"; then cc_check -march=$proc $cpuopt=$proc || proc=i586 fi if test "$proc" = "i586" ; then cc_check -march=$proc $cpuopt=$proc || proc=i486 fi if test "$proc" = "i486" ; then cc_check -march=$proc $cpuopt=$proc || proc=i386 fi if test "$proc" = "i386" ; then cc_check -march=$proc $cpuopt=$proc || proc=error fi if test "$proc" = "error" ; then echores "Your $_cc does not even support \"i386\" for '-march' and '$cpuopt'." _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 # i686 is probably the most common CPU - optimize for it _mcpu="$cpuopt=i686" # at least i486 required, for bswap instruction _march="-march=i486" cc_check $_mcpu || _mcpu="" cc_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 echores "$proc" ;; ia64) _def_arch='#define ARCH_IA64 1' _target_arch='TARGET_ARCH_IA64 = yes' iproc='ia64' proc='' _march='' _mcpu='' _optimizing='' ;; x86_64|amd64) _def_arch='#define ARCH_X86_64 1' _target_arch='TARGET_ARCH_X86_64 = yes' iproc='x86_64' proc='' _march='' _mcpu='' _optimizing='' x86_exts_check ;; sparc) _def_arch='#define ARCH_SPARC 1' _target_arch='TARGET_ARCH_SPARC = yes' iproc='sparc' if sunos ; then echocheck "CPU type" karch=`uname -m` case "`echo $karch`" in sun4) proc=v7 ;; sun4c) proc=v7 ;; sun4d) proc=v8 ;; sun4m) proc=v8 ;; sun4u) proc=v9 _vis='yes' _def_vis='#define HAVE_VIS = yes' ;; *) ;; esac echores "$proc" else proc=v8 fi _march='' _mcpu="-mcpu=$proc" _optimizing="$proc" ;; sparc64) _def_arch='#define ARCH_SPARC 1' _target_arch='TARGET_ARCH_SPARC = yes' _vis='yes' _def_vis='#define HAVE_VIS = yes' iproc='sparc' proc='v9' _march='' _mcpu="-mcpu=$proc" _optimizing="$proc" ;; arm|armv4l|armv5tel) _def_arch='#define ARCH_ARMV4L 1' _target_arch='TARGET_ARCH_ARMV4L = yes' iproc='arm' proc='' _march='' _mcpu='' _optimizing='' ;; ppc) _def_arch='#define ARCH_POWERPC 1' _target_arch='TARGET_ARCH_POWERPC = yes' iproc='ppc' proc='' _march='' _mcpu='' _optimizing='' _altivec=no echocheck "CPU type" if linux && test -n "$_cpuinfo"; then proc=`$_cpuinfo | grep 'cpu' | cut -d ':' -f 2 | cut -d ',' -f 1 | cut -b 2- | _head 1` if test -n "`$_cpuinfo | grep altivec`"; then _altivec=yes fi fi if darwin ; then proc=`$_cpuinfo | grep "Processor type" | cut -f 3 -d ' ' | sed 's/ppc//'` if [ `sysctl -n hw.vectorunit` -eq 1 ]; then _altivec=yes elif [ "`sysctl -n hw.optional.altivec 2>/dev/null`" = 1 ]; then _altivec=yes fi fi # only gcc 3.4 works reliably with altivec code under netbsd if netbsd ; then case $cc_version in 2*|3.0*|3.1*|3.2*|3.3*) ;; *) if [ `sysctl -n machdep.altivec` -eq 1 ]; then _altivec=yes fi ;; esac fi if test "$_altivec" = yes; then echores "$proc altivec" else 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' ;; *) ;; esac # gcc 3.1(.1) and up supports 7400 and 7450 if test "$_cc_major" -ge "3" && test "$_cc_minor" -ge "1"; then case "$proc" in 7400*|7410*) _march='-mcpu=7400' _mcpu='-mtune=7400' ;; 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"; then case "$proc" in 970*) _march='-mcpu=970' _mcpu='-mtune=970' ;; *) ;; esac fi fi if test -n "$_mcpu"; then _optimizing=`echo $_mcpu | cut -c 8-` echores "$_optimizing" else echores "none" fi ;; alpha) _def_arch='#define ARCH_ALPHA 1' _target_arch='TARGET_ARCH_ALPHA = yes' iproc='alpha' _march='' echocheck "CPU type" cat > $TMPC << EOFint main() { unsigned long ver, mask; asm ("implver %0" : "=r" (ver)); asm ("amask %1, %0" : "=r" (mask) : "r" (-1)); printf("%ld-%x\n", ver, ~mask); return 0;}EOF $_cc -o "$TMPO" "$TMPC" case `"$TMPO"` in 0-0) proc="ev4"; cpu_understands_mvi="0";; 1-0) proc="ev5"; cpu_understands_mvi="0";; 1-1) proc="ev56"; cpu_understands_mvi="0";; 1-101) proc="pca56"; cpu_understands_mvi="1";; 2-303) proc="ev6"; cpu_understands_mvi="1";; 2-307) proc="ev67"; cpu_understands_mvi="1";; 2-1307) proc="ev68"; cpu_understands_mvi="1";; esac echores "$proc" echocheck "GCC & CPU optimization abilities" 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" echores "$proc" _optimizing="$proc" echocheck "MVI instruction support in GCC" if test "$_cc_major" -ge "3" && test "$cpu_understands_mvi" = "1" ; then _def_gcc_mvi_support="#define CAN_COMPILE_ALPHA_MVI 1" echores "yes" else _def_gcc_mvi_support="#undef CAN_COMPILE_ALPHA_MVI" echores "no, GCC = `( $_cc -dumpversion ) 2>&1` (must be >= 3), CPU = $proc (must be pca56 or later)" fi ;; mips) _def_arch='#define ARCH_SGI_MIPS 1' _target_arch='TARGET_ARCH_SGI_MIPS = yes' iproc='sgi-mips' proc='' _march='' _mcpu='' _optimizing='' if irix ; then echocheck "CPU type" proc=`hinv -c processor | grep CPU | cut -d " " -f3` case "`echo $proc`" in R3000) _march='-mips1' _mcpu='-mtune=r2000' ;; R4000) _march='-mips3' _mcpu='-mtune=r4000' ;; R4400) _march='-mips3' _mcpu='-mtune=r4400' ;; R4600) _march='-mips3' _mcpu='-mtune=r4600' ;; R5000) _march='-mips4' _mcpu='-mtune=r5000' ;; R8000|R10000|R12000|R14000|R16000) _march='-mips4' _mcpu='-mtune=r8000' ;; esac echores "$proc" fi ;; hppa) _def_arch='#define ARCH_PA_RISC 1' _target_arch='TARGET_ARCH_PA_RISC = yes' iproc='PA-RISC' proc='' _march='' _mcpu='' _optimizing='' ;; s390) _def_arch='#define ARCH_S390 1' _target_arch='TARGET_ARCH_S390 = yes' iproc='390' proc='' _march='' _mcpu='' _optimizing='' ;; s390x) _def_arch='#define ARCH_S390X 1' _target_arch='TARGET_ARCH_S390X = yes' iproc='390x' proc='' _march='' _mcpu='' _optimizing='' ;; vax) _def_arch='#define ARCH_VAX 1' _target_arch='TARGET_ARCH_VAX = yes' iproc='vax' proc='' _march='' _mcpu='' _optimizing='' ;; *) echo "The architecture of your CPU ($host_arch) is not supported by this configure script" echo "It seems nobody has ported MPlayer to your OS or CPU type yet." die "unsupported architecture $host_arch" ;;esacif test "$_runtime_cpudetection" = yes ; then if x86; then _mmx=yes _3dnow=yes _3dnowex=yes _mmx2=yes _sse=yes _sse2=yes _mtrr=yes fi if ppc; then _altivec=yes fifiif x86 && test "$_runtime_cpudetection" = no ; then extcheck() { if test "$1" = yes ; then echocheck "kernel support of $2" cat > $TMPC <<EOF#include <signal.h>void catch() { exit(1); }int main(void){ signal(SIGILL, catch); __asm__ __volatile__ ("$3":::"memory");return(0);}EOF if ( cc_check && $TMPO ) > /dev/null 2>&1 ; then echores "yes" _optimizing="$_optimizing $2" return 0 else 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" || _mmx=no extcheck $_mmx2 "mmx2" "sfence" || _mmx2=no extcheck $_3dnow "3dnow" "femms" || _3dnow=no extcheck $_3dnowex "3dnowex" "pswapd %%mm0, %%mm0" || _3dnowex=no extcheck $_sse "sse" "xorps %%xmm0, %%xmm0" || _sse=no _gcc3_ext="$_gcc3_ext -mno-sse" extcheck $_sse2 "sse2" "xorpd %%xmm0, %%xmm0" || _sse2=no _gcc3_ext="$_gcc3_ext -mno-sse2" echocheck "mtrr support" echores "$_mtrr" if test "$_mtrr" = yes ; then _optimizing="$_optimizing mtrr" fi 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 cat > $TMPC << EOFint main(void) { return 0; }EOF cc_check $_march $_gcc3_ext && _march="$_march $_gcc3_ext" fifiechocheck "assembler support of -pipe option"cat > $TMPC << EOF
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -