List:Internals« Previous MessageNext Message »
From:msvensson Date:April 27 2005 12:50pm
Subject:bk commit into 4.1 tree (msvensson:1.2209) BUG#9263
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 repository of msvensson. When msvensson does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.2209 05/04/27 12:50:37 msvensson@neptunus.(none) +2 -0
  Bug#9263 GCC4: -mcpu is depricated, use -mtune or -march instead
     - Made a script that selects the best compiler optimizations for the current cpu.
     - Use the script from BUILD/SETUP.sh 

  BUILD/check-cpu
    1.1 05/04/27 12:50:35 msvensson@neptunus.(none) +77 -0

  BUILD/check-cpu
    1.0 05/04/27 12:50:35 msvensson@neptunus.(none) +0 -0
    BitKeeper file /home/msvensson/mysql/mysql-4.1/BUILD/check-cpu

  BUILD/SETUP.sh
    1.33 05/04/27 12:50:34 msvensson@neptunus.(none) +8 -5
    Run check-cpu and use the compiler optimization flags it outputs 

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	msvensson
# Host:	neptunus.(none)
# Root:	/home/msvensson/mysql/mysql-4.1
--- New file ---
+++ BUILD/check-cpu	05/04/27 12:50:35
#!/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
else
  exit 0
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="i386";
    ;;
esac

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


--- 1.32/BUILD/SETUP.sh	2005-01-27 12:13:28 +01:00
+++ 1.33/BUILD/SETUP.sh	2005-04-27 12:50:34 +02:00
@@ -53,11 +53,14 @@
 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="-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 -DBIG_TABLES"
+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
Thread
bk commit into 4.1 tree (msvensson:1.2209) BUG#9263msvensson27 Apr