~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to config/ac-macros/check_cpu.m4

  • Committer: brian
  • Date: 2008-06-25 05:29:13 UTC
  • Revision ID: brian@localhost.localdomain-20080625052913-6upwo0jsrl4lnapl
clean slate

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
AC_DEFUN([MYSQL_CHECK_CPU],
 
2
[AC_CACHE_CHECK([if compiler supports optimizations for current cpu],
 
3
mysql_cv_cpu,[
 
4
 
 
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`
 
10
fi 
 
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
 
17
      cpu_set="i486 i386"
 
18
    else
 
19
      cpu_set="i386"
 
20
    fi
 
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
 
27
      cpu_set="i486 i386"
 
28
    else
 
29
      cpu_set="i386"
 
30
    fi
 
31
fi
 
32
 
 
33
for ac_arg in $cpu_set;
 
34
do
 
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")
 
37
done
 
38
 
 
39
if test "$mysql_cv_cpu" = "unknown"
 
40
then
 
41
  CFLAGS="$ac_save_CFLAGS"
 
42
  AC_MSG_RESULT(none)
 
43
else
 
44
  AC_MSG_RESULT($mysql_cv_cpu)
 
45
fi
 
46
])])
 
47