summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--BUILD/SETUP.sh2
-rw-r--r--acinclude.m447
-rw-r--r--configure.in1
3 files changed, 49 insertions, 1 deletions
diff --git a/BUILD/SETUP.sh b/BUILD/SETUP.sh
index cf5405565b8..fdd0154fc99 100644
--- a/BUILD/SETUP.sh
+++ b/BUILD/SETUP.sh
@@ -40,7 +40,7 @@ c_warnings="$global_warnings -Wunused"
cxx_warnings="$global_warnings -Woverloaded-virtual -Wextern-inline -Wsign-promo -Wreorder -Wctor-dtor-privacy -Wnon-virtual-dtor"
alpha_cflags="-mcpu=ev6 -Wa,-mev6" # Not used yet
-pentium_cflags="-mpentiumpro"
+pentium_cflags=""
sparc_cflags=""
# be as fast as we can be without losing our ability to backtrace
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],
[\
diff --git a/configure.in b/configure.in
index f0855c93467..9ebf5e5ad74 100644
--- a/configure.in
+++ b/configure.in
@@ -1673,6 +1673,7 @@ AC_ARG_WITH(embedded-server,
[with_embedded_server=no]
)
+MYSQL_CHECK_CPU
MYSQL_CHECK_MYSQLFS
MYSQL_CHECK_VIO
MYSQL_CHECK_OPENSSL