Mercurial > mplayer.hg
comparison configure @ 11007:48b7d7aa444d
configure altivec patch by Magnus Damm <damm@opensource.se>
* CC is not checked for Altivec support (see above).
The patch adds checks for FSF-style flags and Darwin-style flags.
The check is performed regardless of the gcc version.
* Disabling of Altivec.
--disable-altivec is broken today if /proc/cpuinfo shows that your cpu
supports altivec. The patch takes care of that.
* "GCC & CPU optimization abilities" always show that it is optimizing
for the cpu configure is running on, it should show the optimization that
is enabled for gcc instead. Cosmetic change only, but confusing as it is
today IMHO.
* Runtime CPU-detection now enables altivec for powerpc.
Now with the patch it should be possible to use --enable-altivec,
--disable-altivec, --enable-runtime-cpudetection regardless of powerpc cpu type.
The configure script handles altivec support in the following order:
1. Altivec is enabled by default if your cpu supports it.
2. --enable-runtime-cpudetection will enable altivec support.
3. If you have forced altivec on/off with --enable-altivec/--disable-altivec, then
your selection will override the previous altivec configuration.
4. If altivec is enabled but the compiler doesn't support it, altivec gets turned off.
author | attila |
---|---|
date | Sat, 04 Oct 2003 23:06:04 +0000 |
parents | d48eccbbb984 |
children | afdf982f0673 |
comparison
equal
deleted
inserted
replaced
11006:fae1fe725886 | 11007:48b7d7aa444d |
---|---|
831 _target_arch='TARGET_ARCH_POWERPC = yes' | 831 _target_arch='TARGET_ARCH_POWERPC = yes' |
832 iproc='ppc' | 832 iproc='ppc' |
833 proc='' | 833 proc='' |
834 _march='' | 834 _march='' |
835 _mcpu='' | 835 _mcpu='' |
836 _optimizing='' | |
836 _altivec=no | 837 _altivec=no |
837 _altivec_gcc_flags='' | |
838 | 838 |
839 echocheck "CPU type" | 839 echocheck "CPU type" |
840 if linux && test -n "$_cpuinfo"; then | 840 if linux && test -n "$_cpuinfo"; then |
841 proc=`$_cpuinfo | grep 'cpu' | cut -d ':' -f 2 | cut -d ',' -f 1 | cut -b 2- | head -1` | 841 proc=`$_cpuinfo | grep 'cpu' | cut -d ':' -f 2 | cut -d ',' -f 1 | cut -b 2- | head -1` |
842 if test -n "`$_cpuinfo | grep altivec`"; then | 842 if test -n "`$_cpuinfo | grep altivec`"; then |
843 _altivec=yes | 843 _altivec=yes |
844 _altivec_gcc_flags='-maltivec -mabi=altivec' | |
845 fi | 844 fi |
846 fi | 845 fi |
847 if darwin ; then | 846 if darwin ; then |
848 if [ `sysctl -n hw.vectorunit` -eq 1 ]; then | 847 if [ `sysctl -n hw.vectorunit` -eq 1 ]; then |
849 _altivec=yes | 848 _altivec=yes |
850 _altivec_gcc_flags='-faltivec' | |
851 fi | 849 fi |
852 fi | 850 fi |
853 echores "$proc" | 851 if test "$_altivec" = yes; then |
852 echores "$proc altivec" | |
853 else | |
854 echores "$proc" | |
855 fi | |
854 | 856 |
855 echocheck "GCC & CPU optimization abilities" | 857 echocheck "GCC & CPU optimization abilities" |
858 | |
856 if test -n "$proc"; then | 859 if test -n "$proc"; then |
857 case "$proc" in | 860 case "$proc" in |
858 601) _march='-mcpu=601' _mcpu='-mtune=601' ;; | 861 601) _march='-mcpu=601' _mcpu='-mtune=601' ;; |
859 603) _march='-mcpu=603' _mcpu='-mtune=603' ;; | 862 603) _march='-mcpu=603' _mcpu='-mtune=603' ;; |
860 603e|603ev) _march='-mcpu=603e' _mcpu='-mtune=603e' ;; | 863 603e|603ev) _march='-mcpu=603e' _mcpu='-mtune=603e' ;; |
870 7450*|7455*) _march='-mcpu=7450' _mcpu='-mtune=7450' ;; | 873 7450*|7455*) _march='-mcpu=7450' _mcpu='-mtune=7450' ;; |
871 *) ;; | 874 *) ;; |
872 esac | 875 esac |
873 fi | 876 fi |
874 fi | 877 fi |
875 echores "$proc" | 878 |
876 | 879 if test -n "$_mcpu"; then |
877 _optimizing="$proc" | 880 _optimizing=`echo $_mcpu | cut -c 8-` |
878 | 881 echores "$_optimizing" |
879 _mcpu="$_mcpu $_altivec_gcc_flags" | 882 else |
883 echores "none" | |
884 fi | |
885 | |
880 ;; | 886 ;; |
881 | 887 |
882 alpha) | 888 alpha) |
883 _def_arch='#define ARCH_ALPHA 1' | 889 _def_arch='#define ARCH_ALPHA 1' |
884 _target_arch='TARGET_ARCH_ALPHA = yes' | 890 _target_arch='TARGET_ARCH_ALPHA = yes' |
985 _mmx2=yes | 991 _mmx2=yes |
986 _sse=yes | 992 _sse=yes |
987 _sse2=yes | 993 _sse2=yes |
988 _mtrr=yes | 994 _mtrr=yes |
989 fi | 995 fi |
990 _optimizing="Runtime CPU-Detection enabled" | 996 if ppc; then |
997 _altivec=yes | |
998 fi | |
991 fi | 999 fi |
992 | 1000 |
993 if x86 && test "$_runtime_cpudetection" = no ; then | 1001 if x86 && test "$_runtime_cpudetection" = no ; then |
994 extcheck() { | 1002 extcheck() { |
995 if test "$1" = yes ; then | 1003 if test "$1" = yes ; then |
1602 echo "Upgrade binutils to ${_pref_as_version} ..." | 1610 echo "Upgrade binutils to ${_pref_as_version} ..." |
1603 die "obsolete binutils version" | 1611 die "obsolete binutils version" |
1604 fi | 1612 fi |
1605 fi | 1613 fi |
1606 | 1614 |
1615 if ppc ; then | |
1616 | |
1617 # check if altivec is supported by the compiler, and how to enable it | |
1618 | |
1619 _altivec_gcc_flags='' | |
1620 | |
1621 if test "$_altivec" = yes -o "$_runtime_cpudetection" = yes ; then | |
1622 echocheck "GCC altivec support" | |
1623 | |
1624 p='' | |
1625 cat > $TMPC << EOF | |
1626 int main() { | |
1627 return 0; | |
1628 } | |
1629 EOF | |
1630 FSF_flags='-maltivec -mabi=altivec' | |
1631 Darwin_flags='-faltivec' | |
1632 | |
1633 if test -z "$p"; then | |
1634 cc_check $FSF_flags && p='FSF' | |
1635 fi | |
1636 if test -z "$p"; then | |
1637 cc_check $Darwin_flags && p='Darwin' | |
1638 fi | |
1639 | |
1640 case $p in | |
1641 FSF) _altivec_gcc_flags="$FSF_flags" _altivec=yes ;; | |
1642 Darwin) _altivec_gcc_flags="$Darwin_flags" _altivec=yes ;; | |
1643 *) _altivec=no ;; | |
1644 esac | |
1645 | |
1646 if test -z "$p"; then | |
1647 p=none | |
1648 else | |
1649 p="$p-style ($_altivec_gcc_flags)" | |
1650 fi | |
1651 | |
1652 echores "$p" | |
1653 fi | |
1654 | |
1655 # check if <altivec.h> should be included | |
1656 | |
1657 _def_altivec_h='#undef HAVE_ALTIVEC_H' | |
1658 _def_altivec='#undef HAVE_ALTIVEC' | |
1659 | |
1660 if test "$_altivec" = yes ; then | |
1661 echocheck "altivec.h" | |
1662 cat > $TMPC << EOF | |
1663 #include <altivec.h> | |
1664 int main(void) { return 0; } | |
1665 EOF | |
1666 _have_altivec_h=no | |
1667 cc_check $_altivec_gcc_flags && _have_altivec_h=yes | |
1668 if test "$_have_altivec_h" = yes ; then | |
1669 _def_altivec_h='#define HAVE_ALTIVEC_H 1' | |
1670 _def_altivec='#define HAVE_ALTIVEC 1' | |
1671 fi | |
1672 echores "$_have_altivec_h" | |
1673 fi | |
1674 | |
1675 # disable runtime cpudetection if | |
1676 # - we cannot generate altivec code | |
1677 # - altivec is disabled by the user | |
1678 | |
1679 if test "$_runtime_cpudetection" = yes -a "$_altivec" = no ; then | |
1680 _runtime_cpudetection=no | |
1681 fi | |
1682 | |
1683 # show that we are optimizing for altivec (if enabled and supported) | |
1684 | |
1685 if test "$_runtime_cpudetection" = no -a "$_altivec" = yes ; then | |
1686 _optimizing="$_optimizing altivec" | |
1687 fi | |
1688 | |
1689 # if altivec is enabled, make sure the correct flags turn up in CFLAGS | |
1690 | |
1691 if test "$_altivec" = yes ; then | |
1692 _mcpu="$_mcpu $_altivec_gcc_flags" | |
1693 fi | |
1694 fi | |
1695 | |
1607 _def_mmx='#undef HAVE_MMX' | 1696 _def_mmx='#undef HAVE_MMX' |
1608 test "$_mmx" = yes && _def_mmx='#define HAVE_MMX 1' | 1697 test "$_mmx" = yes && _def_mmx='#define HAVE_MMX 1' |
1609 _def_mmx2='#undef HAVE_MMX2' | 1698 _def_mmx2='#undef HAVE_MMX2' |
1610 test "$_mmx2" = yes && _def_mmx2='#define HAVE_MMX2 1' | 1699 test "$_mmx2" = yes && _def_mmx2='#define HAVE_MMX2 1' |
1611 _def_3dnow='#undef HAVE_3DNOW' | 1700 _def_3dnow='#undef HAVE_3DNOW' |
1614 test "$_3dnowex" = yes && _def_3dnowex='#define HAVE_3DNOWEX 1' | 1703 test "$_3dnowex" = yes && _def_3dnowex='#define HAVE_3DNOWEX 1' |
1615 _def_sse='#undef HAVE_SSE' | 1704 _def_sse='#undef HAVE_SSE' |
1616 test "$_sse" = yes && _def_sse='#define HAVE_SSE 1' | 1705 test "$_sse" = yes && _def_sse='#define HAVE_SSE 1' |
1617 _def_sse2='#undef HAVE_SSE2' | 1706 _def_sse2='#undef HAVE_SSE2' |
1618 test "$_sse2" = yes && _def_sse2='#define HAVE_SSE2 1' | 1707 test "$_sse2" = yes && _def_sse2='#define HAVE_SSE2 1' |
1619 _def_altivec='#undef HAVE_ALTIVEC' | |
1620 test "$_altivec" = yes && _def_altivec='#define HAVE_ALTIVEC 1' | |
1621 | |
1622 | 1708 |
1623 # Checking kernel version... | 1709 # Checking kernel version... |
1624 if x86 && linux ; then | 1710 if x86 && linux ; then |
1625 _k_verc_problem=no | 1711 _k_verc_problem=no |
1626 kernel_version=`uname -r 2>&1` | 1712 kernel_version=`uname -r 2>&1` |
1794 fi | 1880 fi |
1795 echores "$_sighandler" | 1881 echores "$_sighandler" |
1796 | 1882 |
1797 echocheck "runtime cpudetection" | 1883 echocheck "runtime cpudetection" |
1798 if test "$_runtime_cpudetection" = yes ; then | 1884 if test "$_runtime_cpudetection" = yes ; then |
1885 _optimizing="Runtime CPU-Detection enabled" | |
1799 _def_runtime_cpudetection='#define RUNTIME_CPUDETECT 1' | 1886 _def_runtime_cpudetection='#define RUNTIME_CPUDETECT 1' |
1800 else | 1887 else |
1801 _def_runtime_cpudetection='#undef RUNTIME_CPUDETECT' | 1888 _def_runtime_cpudetection='#undef RUNTIME_CPUDETECT' |
1802 fi | 1889 fi |
1803 echores "$_runtime_cpudetection" | 1890 echores "$_runtime_cpudetection" |
2065 _def_mman='#define HAVE_SYS_MMAN_H 1' | 2152 _def_mman='#define HAVE_SYS_MMAN_H 1' |
2066 else | 2153 else |
2067 _def_mman='#undef HAVE_SYS_MMAN_H' | 2154 _def_mman='#undef HAVE_SYS_MMAN_H' |
2068 fi | 2155 fi |
2069 echores "$_mman" | 2156 echores "$_mman" |
2070 | |
2071 if ppc && test "$_altivec" = "yes" ; then | |
2072 echocheck "altivec.h" | |
2073 cat > $TMPC << EOF | |
2074 #include <altivec.h> | |
2075 int main(void) { return 0; } | |
2076 EOF | |
2077 _have_altivec_h=no | |
2078 cc_check $_altivec_gcc_flags && _have_altivec_h=yes | |
2079 if test "$_have_altivec_h" = yes ; then | |
2080 _def_altivec_h='#define HAVE_ALTIVEC_H 1' | |
2081 else | |
2082 _def_altivec_h='#undef HAVE_ALTIVEC_H' | |
2083 fi | |
2084 echores "$_have_altivec_h" | |
2085 else | |
2086 _def_altivec_h='#undef HAVE_ALTIVEC_H' | |
2087 fi | |
2088 | 2157 |
2089 echocheck "dynamic loader" | 2158 echocheck "dynamic loader" |
2090 cat > $TMPC << EOF | 2159 cat > $TMPC << EOF |
2091 #include <dlfcn.h> | 2160 #include <dlfcn.h> |
2092 int main(void) { dlopen(0, 0); dlclose(0); dlsym(0, 0); return 0; } | 2161 int main(void) { dlopen(0, 0); dlclose(0); dlsym(0, 0); return 0; } |