1
AC_DEFUN([MYSQL_CHECK_CPU],
2
[AC_CACHE_CHECK([if compiler supports optimizations for current cpu],
5
ac_save_CFLAGS="$CFLAGS"
6
if test -r /proc/cpuinfo ; then
7
cpuinfo="cat /proc/cpuinfo"
8
cpu_family=`$cpuinfo | grep 'cpu family' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -1`
9
cpu_vendor=`$cpuinfo | grep 'vendor_id' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -1`
11
if test "$cpu_vendor" = "AuthenticAMD"; then
12
if test $cpu_family -ge 6; then
13
cpu_set="athlon pentiumpro k5 pentium i486 i386";
14
elif test $cpu_family -eq 5; then
15
cpu_set="k5 pentium i486 i386";
16
elif test $cpu_family -eq 4; then
21
elif test "$cpu_vendor" = "GenuineIntel"; then
22
if test $cpu_family -ge 6; then
23
cpu_set="pentiumpro pentium i486 i386";
24
elif test $cpu_family -eq 5; then
25
cpu_set="pentium i486 i386";
26
elif test $cpu_family -eq 4; then
33
for ac_arg in $cpu_set;
35
CFLAGS="$ac_save_CFLAGS -mcpu=$ac_arg -march=$ac_arg -DCPU=$ac_arg"
36
AC_TRY_COMPILE([],[int i],mysql_cv_cpu=$ac_arg; break;, mysql_cv_cpu="unknown")
39
if test "$mysql_cv_cpu" = "unknown"
41
CFLAGS="$ac_save_CFLAGS"
44
AC_MSG_RESULT($mysql_cv_cpu)