Lines 732-752
Link Here
|
732 |
# check that gcc supports our CPU, if not, fall back to earlier ones |
732 |
# check that gcc supports our CPU, if not, fall back to earlier ones |
733 |
# LGB: check -mcpu and -march swithing step by step with enabling |
733 |
# LGB: check -mcpu and -march swithing step by step with enabling |
734 |
# to fall back till 386. |
734 |
# to fall back till 386. |
735 |
|
735 |
# gcc >= 3.4.0 doesn't support -mcpu, we have to use -mtune instead |
|
|
736 |
if [ "$_cc_major" -gt 3 ] || ( [ "$_cc_major" = 3 ] && [ "$_cc_minor" -ge 4 ]) ; then |
737 |
cpuopt=-mtune |
738 |
else |
739 |
cpuopt=-mcpu |
740 |
fi |
741 |
|
736 |
echocheck "GCC & CPU optimization abilities" |
742 |
echocheck "GCC & CPU optimization abilities" |
737 |
cat > $TMPC << EOF |
743 |
cat > $TMPC << EOF |
738 |
int main(void) { return 0; } |
744 |
int main(void) { return 0; } |
739 |
EOF |
745 |
EOF |
740 |
if test "$_runtime_cpudetection" = no ; then |
746 |
if test "$_runtime_cpudetection" = no ; then |
741 |
if test "$proc" = "athlon-xp" || test "$proc" = "athlon-4" || test "$proc" = "athlon-tbird"; then |
747 |
if test "$proc" = "athlon-xp" || test "$proc" = "athlon-4" || test "$proc" = "athlon-tbird"; then |
742 |
cc_check -march=$proc -mcpu=$proc || proc=athlon |
748 |
cc_check -march=$proc $cpuopt=$proc || proc=athlon |
743 |
fi |
749 |
fi |
744 |
if test "$proc" = "k6-3" || test "$proc" = "k6-2"; then |
750 |
if test "$proc" = "k6-3" || test "$proc" = "k6-2"; then |
745 |
cc_check -march=$proc -mcpu=$proc || proc=k6 |
751 |
cc_check -march=$proc $cpuopt=$proc || proc=k6 |
746 |
fi |
752 |
fi |
747 |
if test "$proc" = "k6"; then |
753 |
if test "$proc" = "k6"; then |
748 |
if not cc_check -march=$proc -mcpu=$proc; then |
754 |
if not cc_check -march=$proc -$cpuopt=$proc; then |
749 |
if cc_check -march=i586 -mcpu=i686; then |
755 |
if cc_check -march=i586 $cpuopt=i686; then |
750 |
proc=i586-i686 |
756 |
proc=i586-i686 |
751 |
else |
757 |
else |
752 |
proc=i586 |
758 |
proc=i586 |
Lines 754-790
Link Here
|
754 |
fi |
760 |
fi |
755 |
fi |
761 |
fi |
756 |
if test "$proc" = "pentium4" || test "$proc" = "pentium3" || test "$proc" = "pentium2" || test "$proc" = "athlon"; then |
762 |
if test "$proc" = "pentium4" || test "$proc" = "pentium3" || test "$proc" = "pentium2" || test "$proc" = "athlon"; then |
757 |
cc_check -march=$proc -mcpu=$proc || proc=i686 |
763 |
cc_check -march=$proc $cpuopt=$proc || proc=i686 |
758 |
fi |
764 |
fi |
759 |
if test "$proc" = "i686" || test "$proc" = "pentium-mmx"; then |
765 |
if test "$proc" = "i686" || test "$proc" = "pentium-mmx"; then |
760 |
cc_check -march=$proc -mcpu=$proc || proc=i586 |
766 |
cc_check -march=$proc $cpuopt=$proc || proc=i586 |
761 |
fi |
767 |
fi |
762 |
if test "$proc" = "i586" ; then |
768 |
if test "$proc" = "i586" ; then |
763 |
cc_check -march=$proc -mcpu=$proc || proc=i486 |
769 |
cc_check -march=$proc $cpuopt=$proc || proc=i486 |
764 |
fi |
770 |
fi |
765 |
if test "$proc" = "i486" ; then |
771 |
if test "$proc" = "i486" ; then |
766 |
cc_check -march=$proc -mcpu=$proc || proc=i386 |
772 |
cc_check -march=$proc $cpuopt=$proc || proc=i386 |
767 |
fi |
773 |
fi |
768 |
if test "$proc" = "i386" ; then |
774 |
if test "$proc" = "i386" ; then |
769 |
cc_check -march=$proc -mcpu=$proc || proc=error |
775 |
cc_check -march=$proc $cpuopt=$proc || proc=error |
770 |
fi |
776 |
fi |
771 |
if test "$proc" = "error" ; then |
777 |
if test "$proc" = "error" ; then |
772 |
echores "Your $_cc does not even support \"i386\" for '-march' and '-mcpu'." |
778 |
echores "Your $_cc does not even support \"i386\" for '-march' and '$cpuopt'." |
773 |
_mcpu="" |
779 |
_mcpu="" |
774 |
_march="" |
780 |
_march="" |
775 |
_optimizing="" |
781 |
_optimizing="" |
776 |
elif test "$proc" = "i586-i686"; then |
782 |
elif test "$proc" = "i586-i686"; then |
777 |
_march="-march=i586" |
783 |
_march="-march=i586" |
778 |
_mcpu="-mcpu=i686" |
784 |
_mcpu="$cpuopt=i686" |
779 |
_optimizing="$proc" |
785 |
_optimizing="$proc" |
780 |
else |
786 |
else |
781 |
_march="-march=$proc" |
787 |
_march="-march=$proc" |
782 |
_mcpu="-mcpu=$proc" |
788 |
_mcpu="$cpuopt=$proc" |
783 |
_optimizing="$proc" |
789 |
_optimizing="$proc" |
784 |
fi |
790 |
fi |
785 |
else |
791 |
else |
786 |
# i686 is probably the most common CPU - optimize for it |
792 |
# i686 is probably the most common CPU - optimize for it |
787 |
_mcpu="-mcpu=i686" |
793 |
_mcpu="$cpuopt=i686" |
788 |
# at least i486 required, for bswap instruction |
794 |
# at least i486 required, for bswap instruction |
789 |
_march="-march=i486" |
795 |
_march="-march=i486" |
790 |
cc_check $_mcpu || _mcpu="" |
796 |
cc_check $_mcpu || _mcpu="" |
Lines 797-806
Link Here
|
797 |
# TODO: it may be a good idea to check GCC and fall back in all cases |
803 |
# TODO: it may be a good idea to check GCC and fall back in all cases |
798 |
if test "$host_arch" = "i586-i686"; then |
804 |
if test "$host_arch" = "i586-i686"; then |
799 |
_march="-march=i586" |
805 |
_march="-march=i586" |
800 |
_mcpu="-mcpu=i686" |
806 |
_mcpu="$cpuopt=i686" |
801 |
else |
807 |
else |
802 |
_march="-march=$host_arch" |
808 |
_march="-march=$host_arch" |
803 |
_mcpu="-mcpu=$host_arch" |
809 |
_mcpu="$cpuopt=$host_arch" |
804 |
fi |
810 |
fi |
805 |
|
811 |
|
806 |
proc="$host_arch" |
812 |
proc="$host_arch" |