diff options
Diffstat (limited to 'BUILD')
-rw-r--r-- | BUILD/Makefile.am | 1 | ||||
-rwxr-xr-x | BUILD/SETUP.sh | 13 | ||||
-rwxr-xr-x | BUILD/check-cpu | 81 | ||||
-rwxr-xr-x | BUILD/compile-pentium-debug-yassl | 13 |
4 files changed, 103 insertions, 5 deletions
diff --git a/BUILD/Makefile.am b/BUILD/Makefile.am index 9f3c55c20d5..d60672e05f8 100644 --- a/BUILD/Makefile.am +++ b/BUILD/Makefile.am @@ -29,6 +29,7 @@ EXTRA_DIST = FINISH.sh \ compile-pentium-debug-max \ compile-pentium-debug-no-bdb \ compile-pentium-debug-openssl \ + compile-pentium-debug-yassl \ compile-pentium-gcov \ compile-pentium-gprof \ compile-pentium-max \ diff --git a/BUILD/SETUP.sh b/BUILD/SETUP.sh index f84dfd4b22d..a507d30e518 100755 --- a/BUILD/SETUP.sh +++ b/BUILD/SETUP.sh @@ -53,11 +53,14 @@ max_leave_isam_configs="--with-innodb --with-berkeley-db --with-ndbcluster --wit max_no_es_configs="$max_leave_isam_configs --without-isam" max_configs="$max_no_es_configs --with-embedded-server" -alpha_cflags="-mcpu=ev6 -Wa,-mev6" # Not used yet -amd64_cflags="" # If dropping '--with-big-tables', add here "-DBIG_TABLES" -pentium_cflags="-mcpu=pentiumpro" -pentium64_cflags="-mcpu=nocona -m64" -ppc_cflags="-mpowerpc -mcpu=powerpc" +path=`dirname $0` +. "$path/check-cpu" + +alpha_cflags="$check_cpu_cflags -Wa,-m$cpu_flag" +amd64_cflags="$check_cpu_cflags" +pentium_cflags="$check_cpu_cflags" +pentium64_cflags="$check_cpu_cflags -m64" +ppc_cflags="$check_cpu_cflags" sparc_cflags="" # be as fast as we can be without losing our ability to backtrace diff --git a/BUILD/check-cpu b/BUILD/check-cpu new file mode 100755 index 00000000000..553df39191f --- /dev/null +++ b/BUILD/check-cpu @@ -0,0 +1,81 @@ +#!/bin/sh +# +# Check cpu of current machine and find the +# best compiler optimization flags for gcc +# +# + +if test -r /proc/cpuinfo ; then + cpuinfo="cat /proc/cpuinfo" + cpu_family=`$cpuinfo | grep 'family' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -1` + if test -z "$cpu_family" ; then + cpu_family=`$cpuinfo | grep 'cpu' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -1` + fi + cpu_vendor=`$cpuinfo | grep 'vendor_id' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -1` + model_name=`$cpuinfo | grep 'model name' | cut -d ':' -f 2 | head -1` + if test -z "$model_name" ; then + model_name=`$cpuinfo | grep 'cpu model' | cut -d ':' -f 2 | head -1` + fi + if test -z "$model_name" ; then + model_name=`uname -m` + fi +fi + +case "$cpu_family--$model_name" in + Alpha*EV6*) + cpu_flag="ev6"; + ;; + *Xeon*) + cpu_flag="nocona"; + ;; + *Pentium*4*CPU*) + cpu_flag="pentium4"; + ;; + *Athlon*64*) + cpu_flag="athlon64"; + ;; + *Athlon*) + cpu_flag="athlon"; + ;; + *Itanium*) + # Don't need to set any flags for itanium(at the moment) + cpu_flag=""; + ;; + *ppc) + cpu_flag="powerpc"; + ;; + *) + cpu_flag=""; + ;; +esac + +if test -z "$cpu_flag"; then + echo "BUILD/check-cpu: Oops, could not findout what kind of cpu this machine is using." + check_cpu_flags="" + return +fi + +echo "cpu_flag: $cpu_flag" + +if test -z "$CC" ; then + cc="gcc"; +else + cc=$CC + +fi + +cc_ver=`$cc --version | sed 1q` +cc_verno=`echo $cc_ver | sed -e 's/[^0-9. ]//g; s/^ *//g; s/ .*//g'` + +case "$cc_ver--$cc_verno" in + *GCC*--3.4*|*GCC*--3.5*|*GCC*--4.*) + check_cpu_cflags="-mtune=$cpu_flag -march=$cpu_flag" + ;; + *GCC*) + check_cpu_cflags="-mcpu=$cpu_flag -march=$cpu_flag" + ;; + *) + check_cpu_cflags="" + ;; +esac +echo $check_cpu_cflags diff --git a/BUILD/compile-pentium-debug-yassl b/BUILD/compile-pentium-debug-yassl new file mode 100755 index 00000000000..666e73d0267 --- /dev/null +++ b/BUILD/compile-pentium-debug-yassl @@ -0,0 +1,13 @@ +#! /bin/sh + +path=`dirname $0` +. "$path/SETUP.sh" + +extra_flags="$pentium_cflags $debug_cflags" +c_warnings="$c_warnings $debug_extra_warnings" +cxx_warnings="$cxx_warnings $debug_extra_warnings" +extra_configs="$pentium_configs $debug_configs" + +extra_configs="$extra_configs --with-debug=full --with-yassl" + +. "$path/FINISH.sh" |