comparison configure @ 31550:0b34520a1c84

Replace some more manual compiler flag checks with cflag_check function.
author diego
date Thu, 01 Jul 2010 23:52:01 +0000
parents 0c9300413b28
children 61494fd9176c
comparison
equal deleted inserted replaced
31549:77723c0716bb 31550:0b34520a1c84
1797 1797
1798 if test "$_gcc3_ext" != ""; then 1798 if test "$_gcc3_ext" != ""; then
1799 # if we had to disable sse/sse2 because the active kernel does not 1799 # if we had to disable sse/sse2 because the active kernel does not
1800 # support this instruction set extension, we also have to tell 1800 # support this instruction set extension, we also have to tell
1801 # gcc3 to not generate sse/sse2 instructions for normal C code 1801 # gcc3 to not generate sse/sse2 instructions for normal C code
1802 cat > $TMPC << EOF 1802 cflag_check $_march $_gcc3_ext && _march="$_march $_gcc3_ext"
1803 int main(void) { return 0; }
1804 EOF
1805 cc_check $_march $_gcc3_ext && _march="$_march $_gcc3_ext"
1806 fi 1803 fi
1807 1804
1808 fi 1805 fi
1809 1806
1810 1807
1953 else 1950 else
1954 cpuopt=-mcpu 1951 cpuopt=-mcpu
1955 fi 1952 fi
1956 1953
1957 echocheck "GCC & CPU optimization abilities" 1954 echocheck "GCC & CPU optimization abilities"
1958 cat > $TMPC << EOF
1959 int main(void) { return 0; }
1960 EOF
1961 if test "$_runtime_cpudetection" = no ; then 1955 if test "$_runtime_cpudetection" = no ; then
1962 if test $cc_vendor != "intel" && test $cc_vendor != "clang" ; then 1956 if test $cc_vendor != "intel" && test $cc_vendor != "clang" ; then
1963 cc_check -march=native && proc=native 1957 cflag_check -march=native && proc=native
1964 fi 1958 fi
1965 if test "$proc" = "amdfam10"; then 1959 if test "$proc" = "amdfam10"; then
1966 cc_check -march=$proc $cpuopt=$proc || proc=k8 1960 cflag_check -march=$proc $cpuopt=$proc || proc=k8
1967 fi 1961 fi
1968 if test "$proc" = "k8"; then 1962 if test "$proc" = "k8"; then
1969 cc_check -march=$proc $cpuopt=$proc || proc=athlon-xp 1963 cflag_check -march=$proc $cpuopt=$proc || proc=athlon-xp
1970 fi 1964 fi
1971 if test "$proc" = "athlon-xp"; then 1965 if test "$proc" = "athlon-xp"; then
1972 cc_check -march=$proc $cpuopt=$proc || proc=athlon 1966 cflag_check -march=$proc $cpuopt=$proc || proc=athlon
1973 fi 1967 fi
1974 if test "$proc" = "k6-3" || test "$proc" = "k6-2"; then 1968 if test "$proc" = "k6-3" || test "$proc" = "k6-2"; then
1975 cc_check -march=$proc $cpuopt=$proc || proc=k6 1969 cflag_check -march=$proc $cpuopt=$proc || proc=k6
1976 fi 1970 fi
1977 if test "$proc" = "k6" || test "$proc" = "c3"; then 1971 if test "$proc" = "k6" || test "$proc" = "c3"; then
1978 if ! cc_check -march=$proc $cpuopt=$proc; then 1972 if ! cflag_check -march=$proc $cpuopt=$proc; then
1979 if cc_check -march=i586 $cpuopt=i686; then 1973 if cflag_check -march=i586 $cpuopt=i686; then
1980 proc=i586-i686 1974 proc=i586-i686
1981 else 1975 else
1982 proc=i586 1976 proc=i586
1983 fi 1977 fi
1984 fi 1978 fi
1985 fi 1979 fi
1986 if test "$proc" = "prescott" ; then 1980 if test "$proc" = "prescott" ; then
1987 cc_check -march=$proc $cpuopt=$proc || proc=pentium4 1981 cflag_check -march=$proc $cpuopt=$proc || proc=pentium4
1988 fi 1982 fi
1989 if test "$proc" = "core2" ; then 1983 if test "$proc" = "core2" ; then
1990 cc_check -march=$proc $cpuopt=$proc || proc=pentium-m 1984 cflag_check -march=$proc $cpuopt=$proc || proc=pentium-m
1991 fi 1985 fi
1992 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 1986 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
1993 cc_check -march=$proc $cpuopt=$proc || proc=i686 1987 cflag_check -march=$proc $cpuopt=$proc || proc=i686
1994 fi 1988 fi
1995 if test "$proc" = "i686" || test "$proc" = "pentium-mmx" || test "$proc" = "winchip-c6" || test "$proc" = "winchip2"; then 1989 if test "$proc" = "i686" || test "$proc" = "pentium-mmx" || test "$proc" = "winchip-c6" || test "$proc" = "winchip2"; then
1996 cc_check -march=$proc $cpuopt=$proc || proc=i586 1990 cflag_check -march=$proc $cpuopt=$proc || proc=i586
1997 fi 1991 fi
1998 if test "$proc" = "i586"; then 1992 if test "$proc" = "i586"; then
1999 cc_check -march=$proc $cpuopt=$proc || proc=i486 1993 cflag_check -march=$proc $cpuopt=$proc || proc=i486
2000 fi 1994 fi
2001 if test "$proc" = "i486" ; then 1995 if test "$proc" = "i486" ; then
2002 cc_check -march=$proc $cpuopt=$proc || proc=i386 1996 cflag_check -march=$proc $cpuopt=$proc || proc=i386
2003 fi 1997 fi
2004 if test "$proc" = "i386" ; then 1998 if test "$proc" = "i386" ; then
2005 cc_check -march=$proc $cpuopt=$proc || proc=error 1999 cflag_check -march=$proc $cpuopt=$proc || proc=error
2006 fi 2000 fi
2007 if test "$proc" = "error" ; then 2001 if test "$proc" = "error" ; then
2008 echores "CPU optimization disabled. CPU not recognized or your compiler is too old." 2002 echores "CPU optimization disabled. CPU not recognized or your compiler is too old."
2009 _mcpu="" 2003 _mcpu=""
2010 _march="" 2004 _march=""
2020 fi 2014 fi
2021 else # if test "$_runtime_cpudetection" = no 2015 else # if test "$_runtime_cpudetection" = no
2022 _mcpu="$cpuopt=generic" 2016 _mcpu="$cpuopt=generic"
2023 # at least i486 required, for bswap instruction 2017 # at least i486 required, for bswap instruction
2024 _march="-march=i486" 2018 _march="-march=i486"
2025 cc_check $_mcpu || _mcpu="$cpuopt=i686" 2019 cflag_check $_mcpu || _mcpu="$cpuopt=i686"
2026 cc_check $_mcpu || _mcpu="" 2020 cflag_check $_mcpu || _mcpu=""
2027 cc_check $_march $_mcpu || _march="" 2021 cflag_check $_march $_mcpu || _march=""
2028 fi 2022 fi
2029 2023
2030 ## Gabucino : --target takes effect here (hopefully...) by overwriting 2024 ## Gabucino : --target takes effect here (hopefully...) by overwriting
2031 ## autodetected mcpu/march parameters 2025 ## autodetected mcpu/march parameters
2032 if test "$_target" ; then 2026 if test "$_target" ; then