diff options
author | unknown <tonu@x153.internalnet> | 2001-08-09 06:07:19 +0800 |
---|---|---|
committer | unknown <tonu@x153.internalnet> | 2001-08-09 06:07:19 +0800 |
commit | ea4a4de32f94829d30fc7aded8f2999e96d68ac8 (patch) | |
tree | 5ba72f5682b7e285fb68a942c12db8b3f0874059 /acinclude.m4 | |
parent | 4bb40187438bdfb8b1d8b091399bd01e0e3425c1 (diff) | |
download | mariadb-git-ea4a4de32f94829d30fc7aded8f2999e96d68ac8.tar.gz |
Added CPU automatic detection. It examines /proc/cpuinfo (if exists) and finds out flags for -mcpu and -march.
TODO is --with-cpu configure option to force some other processor type.
Problem is not big as any Intel 686+ CPU will use -mcpu=pentiumpro anyway. Exceptions are Athlons and 586 processors.
BUILD/SETUP.sh:
Removed hardcoded processor type as it will be added later by configure
acinclude.m4:
Added CPU automatic detection
configure.in:
Added CPU automatic detection
Diffstat (limited to 'acinclude.m4')
-rw-r--r-- | acinclude.m4 | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/acinclude.m4 b/acinclude.m4 index d2c74d1c0a4..c8135970334 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -642,6 +642,53 @@ fi AC_MSG_RESULT($ac_cv_conv_longlong_to_float) ]) +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>=6; then + cpu_set="athlon pentiumpro k5 pentium i486 i386"; + elif test $cpu_family=5; then + cpu_set="k5 pentium i486 i386"; + elif test $cpu_family=4; then + cpu_set="i486 i386" + else + cpu_set="i386" + fi +elif test "$cpu_vendor" = "GenuineIntel"; then + if test $cpu_family>=6; then + cpu_set=" pentiumpro pentium i486 i386"; + elif test $cpu_family=5; then + cpu_set="pentium i486 i386"; + elif test $cpu_family=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" + echo "trying $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 +])) + AC_DEFUN(MYSQL_CHECK_VIO, [ AC_ARG_WITH([vio], [\ |