File: check_cpu.m4

package info (click to toggle)
mysql-dfsg-5.0 5.0.32-7etch12
  • links: PTS
  • area: main
  • in suites: etch
  • size: 89,332 kB
  • ctags: 94,781
  • sloc: cpp: 436,297; ansic: 409,141; sh: 40,574; tcl: 30,484; perl: 27,872; yacc: 8,236; makefile: 5,532; java: 4,610; xml: 3,914; pascal: 3,462; sql: 2,673; awk: 1,338; asm: 1,061; sed: 772
file content (47 lines) | stat: -rw-r--r-- 1,326 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
AC_DEFUN([MYSQL_CHECK_CPU],
[AC_CACHE_CHECK([if compiler supports optimizations for current cpu],
mysql_cv_cpu,[

ac_save_CFLAGS="$CFLAGS"
if test -r /proc/cpuinfo ; then
  cpuinfo="cat /proc/cpuinfo"
  cpu_family=`$cpuinfo | grep 'cpu family' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -1`
  cpu_vendor=`$cpuinfo | grep 'vendor_id' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -1`
fi 
if test "$cpu_vendor" = "AuthenticAMD"; then
    if test $cpu_family -ge 6; then
      cpu_set="athlon pentiumpro k5 pentium i486 i386";
    elif test $cpu_family -eq 5; then
      cpu_set="k5 pentium i486 i386";
    elif test $cpu_family -eq 4; then
      cpu_set="i486 i386"
    else
      cpu_set="i386"
    fi
elif test "$cpu_vendor" = "GenuineIntel"; then
    if test $cpu_family -ge 6; then
      cpu_set="pentiumpro pentium i486 i386";
    elif test $cpu_family -eq 5; then
      cpu_set="pentium i486 i386";
    elif test $cpu_family -eq 4; then
      cpu_set="i486 i386"
    else
      cpu_set="i386"
    fi
fi

for ac_arg in $cpu_set;
do
  CFLAGS="$ac_save_CFLAGS -mcpu=$ac_arg -march=$ac_arg -DCPU=$ac_arg" 
  AC_TRY_COMPILE([],[int i],mysql_cv_cpu=$ac_arg; break;, mysql_cv_cpu="unknown")
done

if test "$mysql_cv_cpu" = "unknown"
then
  CFLAGS="$ac_save_CFLAGS"
  AC_MSG_RESULT(none)
else
  AC_MSG_RESULT($mysql_cv_cpu)
fi
])])