Commit 5f2bfcce authored by Mikael Ronstrom's avatar Mikael Ronstrom

merge updates of build_mccge.sh and check-cpu

parents 0b3a1807 0876ef05
...@@ -71,9 +71,10 @@ cat <<EOF ...@@ -71,9 +71,10 @@ cat <<EOF
same type as that on which you intend to run MySQL/MySQL Cluster. same type as that on which you intend to run MySQL/MySQL Cluster.
The simplest possible way to run this script is to allow it to use the The simplest possible way to run this script is to allow it to use the
built-in defaults everywhere, invoking it simply as: built-in defaults everywhere, invoking it simply as (from top-level
MySQL directory):
shell> ./build_mccge.sh shell> BUILD/build_mccge.sh
This performs the following operations: This performs the following operations:
1) Detects the operating system. Currently, Linux, FreeBSD, Solaris 1) Detects the operating system. Currently, Linux, FreeBSD, Solaris
...@@ -128,7 +129,7 @@ cat <<EOF ...@@ -128,7 +129,7 @@ cat <<EOF
information in the binary then use --debug. information in the binary then use --debug.
If your aim is not to build MySQL Cluster Carrier Grade Edition, you If your aim is not to build MySQL Cluster Carrier Grade Edition, you
can also use this script to build MySQL Classic and MySQL Pro can also use this script to build MySQL Classic and MySQL Enterprise Pro
versions; see the --extended-help for descriptions of these packages. versions; see the --extended-help for descriptions of these packages.
EOF EOF
} }
...@@ -147,7 +148,13 @@ Usage: $0 [options] ...@@ -147,7 +148,13 @@ Usage: $0 [options]
configure configure
--extended-help Show extended help message --extended-help Show extended help message
--without-debug Build non-debug version --without-debug Build non-debug version
--use-comment Set the comment in the build
--with-fast-mutexes Use try/retry method of acquiring mutex
--with-debug Build debug version --with-debug Build debug version
--with-link-time-optimizer
Link time optimizations enabled (Requires GCC 4.5
if GCC used), available for icc as well. This flag
is only considered if also fast is set.
--configure-only Stop after running configure. --configure-only Stop after running configure.
--use-autotools Start by running autoconf, automake,.. tools --use-autotools Start by running autoconf, automake,.. tools
--no-autotools Start from configure --no-autotools Start from configure
...@@ -297,6 +304,7 @@ extended_usage() ...@@ -297,6 +304,7 @@ extended_usage()
by MySQL (cannot be overridden). by MySQL (cannot be overridden).
--with-ssl: Enable use of yaSSL library included in the MySQL source --with-ssl: Enable use of yaSSL library included in the MySQL source
if possible (GCC and same CC and CXX).
(cannot be overridden). (cannot be overridden).
--with-pic: Build all binaries using position independent assembler --with-pic: Build all binaries using position independent assembler
...@@ -377,17 +385,17 @@ extended_usage() ...@@ -377,17 +385,17 @@ extended_usage()
Compiler options: Compiler options:
----------------- -----------------
This section describes the compiler options for each of the different This section describes the compiler options for each of the different
platforms supported by this script. platforms supported by this script.
The --fast option adds -mtune=cpu_arg to the C/C++ flags (provides The --fast option adds -mtune=cpu_arg to the C/C++ flags (provides
support for Nocona, K8, and other processors). support for Nocona, K8, and other processors).
Use of the --debug option adds -g to the C/C++ flags. Use of the --debug option adds -g to the C/C++ flags.
In all cases it is possible to override the definition of CC and CXX In all cases it is possible to override the definition of CC and CXX
by calling the script as follows: by calling the script as follows:
CC="/usr/local/bin/gcc" CXX="/usr/local/bin/gcc" BUILD/build_mccge.sh CC="/usr/local/bin/gcc" CXX="/usr/local/bin/gcc" BUILD/build_mccge.sh
FreeBSD/x86/gcc FreeBSD/x86/gcc
--------------- ---------------
...@@ -411,15 +419,19 @@ extended_usage() ...@@ -411,15 +419,19 @@ extended_usage()
On Itanium we also add -no-ftz and to CC and C++ flags. On Itanium we also add -no-ftz and to CC and C++ flags.
The non-debug versions also add the following: Note that if the user of this script sets CC or CXX explicitly then
C/C++ flags += -O3 unroll2 -ip also -static-libgcc and -static-intel needs to be set in the CC and
CXX.
The fast version adds: The non-debug versions also add the following:
C/C++ flags += -ipo C/C++ flags += -O3 unroll2 -ip
On discovery of a Core 2 Duo architecture while using icc, -xT is also The fast version adds (if --with-link-time-optimizer is used):
added to the C/C++ flags; this provides optimisations specific to Core C/C++ flags += -ipo
2 Duo. This is added only when the --fast flag is set.
On discovery of a Core 2 Duo architecture while using icc, -xT is also
added to the C/C++ flags; this provides optimisations specific to Core
2 Duo. This is added only when the --fast flag is set.
Solaris/x86/gcc Solaris/x86/gcc
--------------- ---------------
...@@ -445,7 +457,7 @@ extended_usage() ...@@ -445,7 +457,7 @@ extended_usage()
Sparc v9 binaries, also -mt is set in all those since we're always Sparc v9 binaries, also -mt is set in all those since we're always
building a multithreaded program. building a multithreaded program.
C flags = -xstrconst C flags = -xstrconst This flag is set only on SPARC
C++ flags = -noex C++ flags = -noex
Set the following C/C++ flags: Set the following C/C++ flags:
...@@ -458,8 +470,10 @@ extended_usage() ...@@ -458,8 +470,10 @@ extended_usage()
Set the C++ flag: Set the C++ flag:
-noex -noex
-features=no%except This flag is set only on x86
When compiling with fast we set: When compiling with fast we set (-ipo only used if we have
set --with-link-time-optimizer):
C/C++ flags: -xtarget=native -xunroll=3 -xipo C/C++ flags: -xtarget=native -xunroll=3 -xipo
LDFLAGS: -xipo LDFLAGS: -xipo
...@@ -471,6 +485,11 @@ extended_usage() ...@@ -471,6 +485,11 @@ extended_usage()
When compiling with fast on x86 we also set: When compiling with fast on x86 we also set:
C/C++ flags: -xregs=frameptr C/C++ flags: -xregs=frameptr
When not compiling with fast we set on x86
C/C++ flags: -xregs=no%frameptr
On SPARC we set
ASFLAGS = LDFLAGS = C/C++ flags = -xarch=sparc
The optimisation level is The optimisation level is
-xO Debug builds -xO Debug builds
...@@ -480,17 +499,19 @@ extended_usage() ...@@ -480,17 +499,19 @@ extended_usage()
MacOSX/x86/gcc MacOSX/x86/gcc
-------------- --------------
C/C++ flags include -fno-common -arch i386. C/C++ flags include -fno-common -arch i386.
When 64-bits builds then i386 is replaced by x86_64.
Non-debug versions also add -Os -felide-constructors, where "-Os" Non-debug versions also add -Os -felide-constructors, where "-Os"
means the build is space-optimised as long as the space optimisations means the build is space-optimised as long as the space optimisations
do not negatively affect performance. Debug versions use -O. do not negatively affect performance. Debug versions use -O.
Mac OS X builds will always be 32-bit by default, when --64 is added Mac OS X builds will always be 32-bit by default, when --64 is added
the build will be 64 bit instead. Thus the flag --m64 is added only the build will be 64 bit instead. Thus the flag --m64 is added only
when specifically given as an option. when specifically given as an option.
EOF EOF
} }
with_usage() with_usage()
{ {
cat <<EOF cat <<EOF
...@@ -593,13 +614,13 @@ parse_cpu_type() ...@@ -593,13 +614,13 @@ parse_cpu_type()
case "$cpu_type" in case "$cpu_type" in
x86 ) x86 )
cpu_type="x86" cpu_type="x86"
if test "x$m64" != "x" ; then if test "x$m64" = "x" ; then
m64="no" m64="no"
fi fi
;; ;;
x86_64 ) x86_64 )
cpu_type="x86" cpu_type="x86"
if test "x$m64" != "x" ; then if test "x$m64" = "x" ; then
m64="yes" m64="yes"
fi fi
;; ;;
...@@ -629,10 +650,7 @@ parse_compiler() ...@@ -629,10 +650,7 @@ parse_compiler()
icc ) icc )
compiler="icc" compiler="icc"
;; ;;
forte ) forte | SunStudio | sunstudio )
compiler="forte"
;;
SunStudio | sunstudio )
compiler="forte" compiler="forte"
;; ;;
*) *)
...@@ -653,12 +671,21 @@ parse_options() ...@@ -653,12 +671,21 @@ parse_options()
--datadir=*) --datadir=*)
datadir=`get_key_value "$1"` datadir=`get_key_value "$1"`
;; ;;
--with-link-time-optimizer)
with_link_time_optimizer="yes"
;;
--without-debug) --without-debug)
with_debug_flag="no" with_debug_flag="no"
if test "x$fast_flag" != "xyes" ; then if test "x$fast_flag" != "xyes" ; then
fast_flag="generic" fast_flag="generic"
fi fi
;; ;;
--use-comment)
without_comment="no"
;;
--with-fast-mutexes)
with_fast_mutexes="yes"
;;
--use-tcmalloc) --use-tcmalloc)
use_tcmalloc="yes" use_tcmalloc="yes"
;; ;;
...@@ -817,9 +844,11 @@ set_cpu_base() ...@@ -817,9 +844,11 @@ set_cpu_base()
fi fi
case "$cpu_arg" in case "$cpu_arg" in
core2 | nocona | prescott | pentium* | i*86 ) core2 | nocona | prescott | pentium* | i*86 )
# Intel CPU
cpu_base_type="x86" cpu_base_type="x86"
;; ;;
athlon* | opteron* ) athlon* | opteron* | k6 | k8 )
# AMD CPU
cpu_base_type="x86" cpu_base_type="x86"
;; ;;
sparc ) sparc )
...@@ -871,15 +900,15 @@ init_configure_commands() ...@@ -871,15 +900,15 @@ init_configure_commands()
cxxflags="$cxx_warnings $base_cxxflags $compiler_flags" cxxflags="$cxx_warnings $base_cxxflags $compiler_flags"
configure="./configure $base_configs $with_flags" configure="./configure $base_configs $with_flags"
flags="CC=\"$CC\" CFLAGS=\"$cflags\" CXX=\"$CXX\" CXXFLAGS=\"$cxxflags\"" env_flags="CC=\"$CC\" CFLAGS=\"$cflags\" CXX=\"$CXX\" CXXFLAGS=\"$cxxflags\""
if test "x$LDFLAGS" != "x" ; then if test "x$LDFLAGS" != "x" ; then
flags="$flags LDFLAGS=\"$LDFLAGS\"" env_flags="$env_flags LDFLAGS=\"$LDFLAGS\""
fi fi
if test "x$ASFLAGS" != "x" ; then if test "x$ASFLAGS" != "x" ; then
flags="$flags ASFLAGS=\"$ASFLAGS\"" env_flags="$env_flags ASFLAGS=\"$ASFLAGS\""
fi fi
commands="$commands commands="$commands
$flags $configure" $env_flags $configure"
} }
# #
...@@ -1081,6 +1110,18 @@ set_debug_flag() ...@@ -1081,6 +1110,18 @@ set_debug_flag()
fi fi
} }
#
# We compile in SSL support if we can, this isn't possible if CXX
# and CC aren't the same and we're not using GCC.
#
set_ssl()
{
if test "x$compiler" = "xgcc" && \
test "x$CC" = "x$CXX" ; then
base_configs="$base_configs --with-ssl"
fi
}
# #
# Base options used by all packages # Base options used by all packages
# #
...@@ -1105,10 +1146,13 @@ set_base_configs() ...@@ -1105,10 +1146,13 @@ set_base_configs()
base_configs="$base_configs --enable-local-infile" base_configs="$base_configs --enable-local-infile"
base_configs="$base_configs --enable-thread-safe-client" base_configs="$base_configs --enable-thread-safe-client"
base_configs="$base_configs --with-big-tables" base_configs="$base_configs --with-big-tables"
base_configs="$base_configs --with-extra-charsets=complex" base_configs="$base_configs --with-extra-charsets=all"
base_configs="$base_configs --with-ssl" if test "x$with_fast_mutexes" = "xyes" ; then
base_configs="$base_configs --with-fast-mutexes"
fi
base_configs="$base_configs --with-pic" base_configs="$base_configs --with-pic"
base_configs="$base_configs --with-csv-storage-engine" base_configs="$base_configs --with-csv-storage-engine"
base_configs="$base_configs --with-perfschema"
} }
# #
...@@ -1139,7 +1183,9 @@ set_ndb_engine() ...@@ -1139,7 +1183,9 @@ set_ndb_engine()
set_pro_package() set_pro_package()
{ {
base_configs="$base_configs --with-comment=\"MySQL Pro $version_text built from source\"" if test "x$without_comment" != "xyes" ; then
base_configs="$base_configs --with-comment=\"MySQL Enterprise Pro $version_text built from source\""
fi
if test "x$with_debug_flag" = "xyes" ; then if test "x$with_debug_flag" = "xyes" ; then
base_configs="$base_configs --with-server-suffix=\"-debug\"" base_configs="$base_configs --with-server-suffix=\"-debug\""
fi fi
...@@ -1147,33 +1193,37 @@ set_pro_package() ...@@ -1147,33 +1193,37 @@ set_pro_package()
set_cge_extended_package() set_cge_extended_package()
{ {
if test "x$gpl" = "xno" ; then if test "x$without_comment" != "xyes" ; then
echo "Cannot build Extended Carrier Grade Edition as Commercial version" base_configs="$base_configs --with-comment=\"MySQL Cluster Carrier Grade Extended Edition $version_text built from source\""
fi fi
base_configs="$base_configs --with-comment=\"MySQL Cluster Carrier Grade Extended Edition $version_text built from source\""
if test "x$with_debug_flag" = "xyes" ; then if test "x$with_debug_flag" = "xyes" ; then
base_configs="$base_configs --with-server-suffix=\"-cge-extended-debug\"" base_configs="$base_configs --with-server-suffix=\"-cge-extended-debug\""
else else
base_configs="$base_configs --with-server-suffix=\"-cge-extended"\" base_configs="$base_configs --with-server-suffix=\"-cge-extended\""
fi fi
} }
set_cge_package() set_cge_package()
{ {
base_configs="$base_configs --with-comment=\"MySQL Cluster Carrier Grade Edition $version_text built from source\"" if test "x$without_comment" != "xyes" ; then
base_configs="$base_configs --with-comment=\"MySQL Cluster Carrier Grade Edition $version_text built from source\""
fi
if test "x$with_debug_flag" = "xyes" ; then if test "x$with_debug_flag" = "xyes" ; then
base_configs="$base_configs --with-server-suffix=\"-cge-debug\"" base_configs="$base_configs --with-server-suffix=\"-cge-debug\""
else else
base_configs="$base_configs --with-server-suffix=\"-cge"\" base_configs="$base_configs --with-server-suffix=\"-cge\""
fi fi
} }
set_classic_package() set_classic_package()
{ {
base_configs="$base_configs --with-comment=\"MySQL Classic $version_text built from source\"" if test "x$without_comment" != "xyes" ; then
base_configs="$base_configs --with-comment=\"MySQL Classic $version_text built from source\""
fi
if test "x$with_debug_flag" = "xyes" ; then if test "x$with_debug_flag" = "xyes" ; then
base_configs="$base_configs --with-server-suffix=\"-debug\"" base_configs="$base_configs --with-server-suffix=\"-debug\""
fi fi
base_configs="$base_configs --without-example-storage-engine"
} }
# #
...@@ -1204,10 +1254,10 @@ set_gcc_special_options() ...@@ -1204,10 +1254,10 @@ set_gcc_special_options()
set_cc_and_cxx_for_gcc() set_cc_and_cxx_for_gcc()
{ {
if test "x$CC" = "x" ; then if test "x$CC" = "x" ; then
CC="gcc -static-libgcc" CC="gcc -static-libgcc -fno-exceptions"
fi fi
if test "x$CXX" = "x" ; then if test "x$CXX" = "x" ; then
CXX="gcc -static-libgcc" CXX="gcc -static-libgcc -fno-exceptions"
fi fi
} }
...@@ -1266,6 +1316,61 @@ set_bsd_configs() ...@@ -1266,6 +1316,61 @@ set_bsd_configs()
set_cc_and_cxx_for_gcc set_cc_and_cxx_for_gcc
} }
check_64_bits()
{
echo "Checking for 32/64-bits compilation"
echo "int main() { return 0; }" > temp_test.c
if test "x$m64" = "xyes" ; then
cmd="$CC $compile_flags -m64 temp_test.c"
if ! $cmd 2>1 ; then
m64="no"
echo "Changing to 32-bits since 64-bits didn't work"
else
echo "Will use 64-bits"
fi
else
cmd="$CC $compile_flags -m32 temp_test.c"
if ! $cmd 2>1 ; then
m64="yes"
echo "Changing to 64-bits since 32-bits didn't work"
else
echo "Will use 32-bits"
fi
fi
rm temp_test.c
}
#
# Get GCC version
#
get_gcc_version()
{
# check if compiler is gcc and dump its version
cc_verno=`$cc -dumpversion 2>/dev/null`
if test "x$?" = "x0" ; then
set -- `echo $cc_verno | tr '.' ' '`
cc_ver="GCC"
cc_major=$1
cc_minor=$2
cc_patch=$3
gcc_version=`expr $cc_major '*' 100 '+' $cc_minor`
fi
}
#
# Link Time Optimizer in GCC (LTO) uses a parameter -flto
# which was added to GCC 4.5, if --with-link-time-optimizer
# is set then use this feature
#
check_for_link_time_optimizer()
{
get_gcc_version
if test "$gcc_version" -ge 405 && \
test "x$with_link_time_optimizer" = "xyes" ; then
compiler_flags="$compiler_flags -flto"
LDFLAGS="$LDFLAGS -flto"
fi
}
# #
# Linux Section # Linux Section
# #
...@@ -1284,20 +1389,22 @@ set_linux_configs() ...@@ -1284,20 +1389,22 @@ set_linux_configs()
fi fi
if test "x$compiler" = "xgcc" ; then if test "x$compiler" = "xgcc" ; then
set_cc_and_cxx_for_gcc set_cc_and_cxx_for_gcc
if test "x$m64" = "xyes" ; then
compiler_flags="$compiler_flags -m64"
else
compiler_flags="$compiler_flags -m32"
fi
if test "x$fast_flag" != "xno" ; then if test "x$fast_flag" != "xno" ; then
if test "x$fast_flag" = "xyes" ; then if test "x$fast_flag" = "xyes" ; then
compiler_flags="$compiler_flags -O3" compiler_flags="$compiler_flags -O3"
check_for_link_time_optimizer
else else
compiler_flags="$compiler_flags -O2" compiler_flags="$compiler_flags -O2"
fi fi
else else
compiler_flags="$compiler_flags -O0" compiler_flags="$compiler_flags -O0"
fi fi
check_64_bits
if test "x$m64" = "xyes" ; then
compiler_flags="$compiler_flags -m64"
else
compiler_flags="$compiler_flags -m32"
fi
# configure will set proper compiler flags for gcc on Linux # configure will set proper compiler flags for gcc on Linux
elif test "x$compiler" = "xicc" ; then elif test "x$compiler" = "xicc" ; then
compiler_flags="$compiler_flags -mp -restrict" compiler_flags="$compiler_flags -mp -restrict"
...@@ -1307,8 +1414,10 @@ set_linux_configs() ...@@ -1307,8 +1414,10 @@ set_linux_configs()
fi fi
if test "x$fast_flag" != "xno" ; then if test "x$fast_flag" != "xno" ; then
compiler_flags="$compiler_flags -O3 -unroll2 -ip" compiler_flags="$compiler_flags -O3 -unroll2 -ip"
if test "x$fast_flag" = "xyes" ; then if test "x$fast_flag" = "xyes" && \
test "x$with_link_time_optimizer" = "xyes" ; then
compiler_flags="$compiler_flags -ipo" compiler_flags="$compiler_flags -ipo"
LDFLAGS="$LDFLAGS -ipo"
fi fi
fi fi
else else
...@@ -1323,11 +1432,16 @@ set_linux_configs() ...@@ -1323,11 +1432,16 @@ set_linux_configs()
set_solaris_configs() set_solaris_configs()
{ {
# Use mtmalloc as malloc, see Tim Cook blog # Use mtmalloc as malloc, see Tim Cook blog
base_configs="$base_configs --with-mysqld-libs=-lmtmalloc" # For information on optimal compiler settings, see article at
# http://developers.sun.com/solaris/articles/mysql_perf_tune.html
# by Luojia Chen at Sun.
base_configs="$base_configs --with-named-curses=-lcurses" base_configs="$base_configs --with-named-curses=-lcurses"
case "`uname -a`" in case "`uname -a`" in
*5.8* | *5.9* | *5.10* | *5.11*) *5.8* | *5.9* )
;;
*5.10* | *5.11*)
base_configs="$base_configs --with-mysqld-libs=-lmtmalloc"
;; ;;
*) *)
usage "Only versions 8,9, 10 and 11 supported for Solaris" usage "Only versions 8,9, 10 and 11 supported for Solaris"
...@@ -1361,6 +1475,7 @@ set_solaris_configs() ...@@ -1361,6 +1475,7 @@ set_solaris_configs()
if test "x$fast_flag" = "xyes" ; then if test "x$fast_flag" = "xyes" ; then
LDFLAGS="$LDFLAGS -O3" LDFLAGS="$LDFLAGS -O3"
compiler_flags="$compiler_flags -O3" compiler_flags="$compiler_flags -O3"
check_for_link_time_optimizer
else else
if test "x$fast_flag" = "xgeneric" ; then if test "x$fast_flag" = "xgeneric" ; then
LDFLAGS="$LDFLAGS -O2" LDFLAGS="$LDFLAGS -O2"
...@@ -1373,44 +1488,50 @@ set_solaris_configs() ...@@ -1373,44 +1488,50 @@ set_solaris_configs()
else else
#Using Forte compiler (SunStudio) #Using Forte compiler (SunStudio)
set_cc_and_cxx_for_forte set_cc_and_cxx_for_forte
base_cflags="$base_cflags -xstrconst"
compiler_flags="$compiler_flags -mt" compiler_flags="$compiler_flags -mt"
LD_FLAGS="$LD_FLAGS -mt" LDFLAGS="$LDFLAGS -mt"
compiler_flags="$compiler_flags -fsimple=1" compiler_flags="$compiler_flags -fsimple=1"
compiler_flags="$compiler_flags -ftrap=%none" compiler_flags="$compiler_flags -ftrap=%none"
compiler_flags="$compiler_flags -xbuiltin=%all" compiler_flags="$compiler_flags -xbuiltin=%all"
compiler_flags="$compiler_flags -xlibmil" compiler_flags="$compiler_flags -xlibmil"
compiler_flags="$compiler_flags -xlibmopt" compiler_flags="$compiler_flags -xlibmopt"
base_cxxflags="$base_cxxflags -noex"
if test "x$fast_flag" = "xyes" ; then if test "x$fast_flag" = "xyes" ; then
compiler_flags="$compiler_flags -xtarget=native" compiler_flags="$compiler_flags -xtarget=native"
compiler_flags="$compiler_flags -xipo"
compiler_flags="$compiler_flags -xunroll=3" compiler_flags="$compiler_flags -xunroll=3"
LD_FLAGS="$LD_FLAGS -xipo" if test "x$with_link_time_optimizer" = "xyes" ; then
compiler_flags="$compiler_flags -xipo"
LDFLAGS="$LDFLAGS -xipo"
fi
else else
compiler_flags="$compiler_flags -xtarget=generic" compiler_flags="$compiler_flags -xtarget=generic"
fi fi
if test "x$cpu_base_type" = "xx86" ; then if test "x$cpu_base_type" = "xx86" ; then
compiler_flags="$compiler_flags -nofstore" compiler_flags="$compiler_flags -nofstore"
base_cxx_flags="$base_cxx_flags -features=no%except"
if test "x$fast_flag" = "xyes" ; then if test "x$fast_flag" = "xyes" ; then
compiler_flags="$compiler_flags -xregs=frameptr" compiler_flags="$compiler_flags -xregs=frameptr"
compiler_flags="$compiler_flags -xO4" compiler_flags="$compiler_flags -xO4"
elif test "x$fast_flag" = "xgeneric" ; then
compiler_flags="$compiler_flags -xO2"
else else
compiler_flags="$compiler_flags -xO0" compiler_flags="$compiler_flags -xregs=no%frameptr"
if test "x$fast_flag" = "xgeneric" ; then
compiler_flags="$compiler_flags -xO2"
else
compiler_flags="$compiler_flags -xO0"
fi
fi fi
else else
#Using SPARC cpu with SunStudio (Forte) compiler #Using SPARC cpu with SunStudio (Forte) compiler
ASFLAGS="$ASFLAGS -xarch=sparc" ASFLAGS="$ASFLAGS -xarch=sparc"
LDFLAGS="$LDFLAGS -xarch=sparc" LDFLAGS="$LDFLAGS -xarch=sparc"
base_cxxflags="$base_cxxflags -noex"
base_cflags="$base_cflags -xstrconst"
compiler_flags="$compiler_flags -xarch=sparc" compiler_flags="$compiler_flags -xarch=sparc"
if test "x$fast_flag" = "xyes" ; then if test "x$fast_flag" = "xyes" ; then
compiler_flags="$compiler_flags -xbinopt=prepare" compiler_flags="$compiler_flags -xbinopt=prepare"
LDFLAGS="$LDFLAGS -xbinopt=prepare" LDFLAGS="$LDFLAGS -xbinopt=prepare"
compiler_flags="$compiler_flags -xO4" compiler_flags="$compiler_flags -xO4"
elif test "x$fast_flag" = "xgeneric" ; then elif test "x$fast_flag" = "xgeneric" ; then
compiler_flags="$compiler_flags -xO2" compiler_flags="$compiler_flags -xO3"
else else
compiler_flags="$compiler_flags -xO0" compiler_flags="$compiler_flags -xO0"
fi fi
...@@ -1432,7 +1553,7 @@ set_macosx_configs() ...@@ -1432,7 +1553,7 @@ set_macosx_configs()
# optimisations also when not in fast mode. # optimisations also when not in fast mode.
# #
base_cxxflags="$base_cxxflags -felide-constructors" base_cxxflags="$base_cxxflags -felide-constructors"
base_cxxflags="$base_cxxflags -fno-common" compiler_flags="$compiler_flags -fno-common"
if test "x$m64" = "xyes" ; then if test "x$m64" = "xyes" ; then
compiler_flags="$compiler_flags -m64" compiler_flags="$compiler_flags -m64"
compiler_flags="$compiler_flags -arch x86_64" compiler_flags="$compiler_flags -arch x86_64"
...@@ -1526,7 +1647,7 @@ fi ...@@ -1526,7 +1647,7 @@ fi
cpu_type= cpu_type=
package= package=
prefix="/usr/local/mysql" prefix="/usr/local/mysql"
parallelism="4" parallelism="8"
fast_flag="generic" fast_flag="generic"
compiler="gcc" compiler="gcc"
gpl="yes" gpl="yes"
...@@ -1562,6 +1683,10 @@ engine_configs= ...@@ -1562,6 +1683,10 @@ engine_configs=
ASFLAGS= ASFLAGS=
LDFLAGS= LDFLAGS=
use_tcmalloc= use_tcmalloc=
without_comment="yes"
with_fast_mutexes=
with_link_time_optimizer=
gcc_version="0"
set_defaults_based_on_environment set_defaults_based_on_environment
...@@ -1656,7 +1781,7 @@ elif test "x$os" = "xbsd" ; then ...@@ -1656,7 +1781,7 @@ elif test "x$os" = "xbsd" ; then
else else
die "Operating system not supported by this script" die "Operating system not supported by this script"
fi fi
set_ssl
# #
# Final step before setting up commands is to set up proper make and # Final step before setting up commands is to set up proper make and
# proper libtoolize versions, and to determine whether to use ccache. # proper libtoolize versions, and to determine whether to use ccache.
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
# best compiler optimization flags for gcc # best compiler optimization flags for gcc
# Will return result in: # Will return result in:
# cpu_arg : Type of CPU # cpu_arg : Type of CPU
# low_cpu_arg : Type of CPU used up until GCC v3.3
# check_cpu_args : Arguments for GCC compiler settings # check_cpu_args : Arguments for GCC compiler settings
# #
...@@ -33,7 +34,7 @@ check_compiler_cpu_flags () { ...@@ -33,7 +34,7 @@ check_compiler_cpu_flags () {
case `gcc -dumpmachine` in case `gcc -dumpmachine` in
i?86-* | x86_64-*) i?86-* | x86_64-*)
if test "$cc_comp" -lt 304 ; then if test "$cc_comp" -lt 304 ; then
check_cpu_cflags="-mcpu=${cpu_arg}" check_cpu_cflags="-mcpu=${low_cpu_arg}"
elif test "$cc_comp" -ge 402 ; then elif test "$cc_comp" -ge 402 ; then
check_cpu_cflags="-mtune=native" check_cpu_cflags="-mtune=native"
else else
...@@ -141,9 +142,10 @@ check_cpu () { ...@@ -141,9 +142,10 @@ check_cpu () {
# detect CPU shortname as used by gcc options # detect CPU shortname as used by gcc options
# this list is not complete, feel free to add further entries # this list is not complete, feel free to add further entries
cpu_arg="" cpu_arg=""
case "$cpu_family--$model_name--$spu_arch" in low_cpu_arg=""
case "$cpu_vendor--$cpu_family--$model_name--$spu_arch" in
# DEC Alpha # DEC Alpha
Alpha*EV6*) *Alpha*EV6*)
cpu_arg="ev6"; cpu_arg="ev6";
;; ;;
#Core 2 Duo #Core 2 Duo
...@@ -172,6 +174,13 @@ check_cpu () { ...@@ -172,6 +174,13 @@ check_cpu () {
*Pentium*4*Mobile*) *Pentium*4*Mobile*)
cpu_arg="pentium4m" cpu_arg="pentium4m"
;; ;;
*Pentium\(R\)*\ M*)
cpu_arg="pentium-m"
low_cpu_arg="pentium3"
;;
*Pentium\(R\)*\ D*)
cpu_arg="prescott"
;;
*Pentium*4*) *Pentium*4*)
cpu_arg="pentium4" cpu_arg="pentium4"
;; ;;
...@@ -196,6 +205,12 @@ check_cpu () { ...@@ -196,6 +205,12 @@ check_cpu () {
*Celeron*) *Celeron*)
cpu_arg="pentium2" cpu_arg="pentium2"
;; ;;
*Atom*)
cpu_arg="prescott"
;;
*GenuineIntel*)
cpu_arg="pentium"
;;
*Turion*) *Turion*)
cpu_arg="athlon64" cpu_arg="athlon64"
;; ;;
...@@ -205,9 +220,30 @@ check_cpu () { ...@@ -205,9 +220,30 @@ check_cpu () {
*Athlon*) *Athlon*)
cpu_arg="athlon" cpu_arg="athlon"
;; ;;
*AMD-K7*)
cpu_arg="athlon"
;;
*Athlon*XP\ *)
cpu_arg="athlon-xp"
;;
*AMD*Sempron\(tm\)*)
cpu_arg="athlon-mp"
;;
*AMD*Athlon\(tm\)\ 64*)
cpu_arg="k8"
;;
*Opteron*) *Opteron*)
cpu_arg="opteron" cpu_arg="opteron"
;; ;;
*Phenom*)
cpu_arg="k8"
;;
*AuthenticAMD*)
cpu_arg="k6"
;;
*VIA\ *)
cpu_arg="i686"
;;
# MacOSX / Intel # MacOSX / Intel
*i386*i486*) *i386*i486*)
cpu_arg="pentium-m" cpu_arg="pentium-m"
...@@ -239,6 +275,10 @@ check_cpu () { ...@@ -239,6 +275,10 @@ check_cpu () {
;; ;;
esac esac
if test "x$low_cpu_arg" = "x" ; then
low_cpu_arg="$cpu_arg"
fi
if test -z "$cpu_arg" ; then if test -z "$cpu_arg" ; then
if test "$CPUINFO" != " " ; then if test "$CPUINFO" != " " ; then
# fallback to uname if necessary # fallback to uname if necessary
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment