Commit f601c035 authored by Mikael Ronstrom's avatar Mikael Ronstrom

Updated build_mccge.sh and added support for more cpu's in check-cpu

parent 061769d7
...@@ -63,41 +63,50 @@ sysadmin_usage() ...@@ -63,41 +63,50 @@ sysadmin_usage()
cat <<EOF cat <<EOF
This script can be used to build MySQL Cluster Carrier Grade Edition This script can be used to build MySQL Cluster Carrier Grade Edition
based on a source code release you received from MySQL. based on a source code release you received from MySQL. It can also
be used to build many variants other variants of MySQL, in particular
various performance-optimised versions of MySQL.
It is assumed that you are building on a computer which is of the It is assumed that you are building on a computer which is of the
same type as that on which you intend to run 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
10/11, and Mac OS X are supported by this script. 8/9/10/11, and Mac OS X are supported by this script.
2) Detect the type of CPU being used. Currently supported processors 2) Detect the type of CPU being used. Currently supported processors
are: x86 for all supported operating systems, Itanium for Linux are: x86 for all supported operating systems, Itanium for Linux
with GCC, and SPARC for Solaris using the Forte compiler. with GCC, and x86 + SPARC for Solaris using the Forte compiler and
finally x86 on Linux using the Intel compiler.
3) Invokes the GCC compiler. 3) Invokes the GCC compiler.
4) Builds a set of MySQL Cluster Carrier Grade Edition binaries; for 4) Builds a set of MySQL/MySQL Cluster binaries; for
more information about these, see --extended-help. more information about these, see --extended-help.
5) Default compiler is always gcc.
The default version assumes that you have a source code tarball from The default version assumes that you have a source code tarball from
which you are building, and thus autoconf and automake do not need to which you are building, and thus autoconf and automake do not need to
be run. If you have downloaded a BitKeeper tree then you should read be run. If you have downloaded a BitKeeper tree then you should read
--developer-help. --developer-help.
If you are building MySQL Cluster Carrier Grade Edition for commercial If you are building MySQL/MySQL Cluster for commercial
use then you need to set the --commercial flag to ensure that the use then you need to set the --commercial flag to ensure that the
commercial libraries are compiled in, rather than the GPL-only commercial libraries are compiled in, rather than the GPL-only
libraries. The default is to build a GPL version of MySQL Cluster libraries. The default is to build a GPL version of MySQL Cluster
Carrier Grade Edition. Carrier Grade Edition.
If your building on a Solaris SPARC machine you must set If your building on a Solaris SPARC machine and you want to compile
using SunStudio you must set
--compiler=forte; if you want to build using the Intel compiler on --compiler=forte; if you want to build using the Intel compiler on
Linux, you need to set --compiler=icc. Linux, you need to set --compiler=icc.
A synonym for forte is SunStudio, so one can also use
--compiler=SunStudio.
If you want to make sure that a 64-bit version is built then you If you want to make sure that a 64-bit version is built then you
should add the flag --64. This is always set on Solaris machines and should add the flag --64. This is always set on Solaris machines and
when check-cpu is able to discover that a 64-bit CPU is being used. If when check-cpu is able to discover that a 64-bit CPU is being used. If
...@@ -120,7 +129,7 @@ cat <<EOF ...@@ -120,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
} }
...@@ -133,13 +142,20 @@ Usage: $0 [options] ...@@ -133,13 +142,20 @@ Usage: $0 [options]
--help Show this help message. --help Show this help message.
--sysadmin-help Show help for system administrators wishing --sysadmin-help Show help for system administrators wishing
to build MySQL Cluster Carrier Grade Edition to build MySQL Cluster Carrier Grade Edition
or other MySQL versions.
--developer-help Show help for developers trying to build MySQL --developer-help Show help for developers trying to build MySQL
--with-help Show extended help on --with-xxx options to --with-help Show extended help on --with-xxx options to
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-debug=full Build with full debug. --with-debug=full Build with full debug.
--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
...@@ -155,10 +171,10 @@ Usage: $0 [options] ...@@ -155,10 +171,10 @@ Usage: $0 [options]
MySQL use MySQL use
--commercial Use commercial libraries --commercial Use commercial libraries
--gpl Use gpl libraries --gpl Use gpl libraries
--compiler=[gcc|icc|forte] Select compiler --compiler=[gcc|icc|forte|SunStudio] Select compiler
--cpu=[x86|x86_64|sparc] Select CPU type --cpu=[x86|x86_64|sparc|itanium] Select CPU type
x86 => 32-bit binary x86 => x86 and 32-bit binary
x86_64 => 64 bit binary unless Mac OS X x86_64 => x86 and 64 bit binary
--warning-mode=[extra|pedantic|normal|no] Set warning mode level --warning-mode=[extra|pedantic|normal|no] Set warning mode level
--warnings Set warning mode to normal --warnings Set warning mode to normal
--32 Build a 32-bit binary even if CPU is 64-bit --32 Build a 32-bit binary even if CPU is 64-bit
...@@ -170,8 +186,9 @@ Usage: $0 [options] ...@@ -170,8 +186,9 @@ Usage: $0 [options]
--error-inject Enable error injection into MySQL Server and --error-inject Enable error injection into MySQL Server and
data nodes data nodes
--valgrind Build with valgrind --valgrind Build with valgrind
--fast Optimise for CPU architecture buildt on --fast Optimise for CPU architecture built on
--static-linking Statically link system libraries into binaries --static-linking Statically link system libraries into binaries
--use-tcmalloc Link with tcmalloc instead of standard malloc (Linux only)
--with-flags * Pass extra --with-xxx options to configure --with-flags * Pass extra --with-xxx options to configure
EOF EOF
if test "x$1" != "x" ; then if test "x$1" != "x" ; then
...@@ -186,13 +203,14 @@ extended_usage() ...@@ -186,13 +203,14 @@ extended_usage()
Extended help text for this script: Extended help text for this script:
----------------------------------- -----------------------------------
This script is intended to make it easier for customers using MySQL This script is intended to make it easier for customers using MySQL
Cluster Carrier Grade Edition to build the product from source on Cluster Carrier Grade Edition, customers using performance-optimised
these platforms/compilers: Linux/x86 (32-bit and 64-bit), MySQL versions and developers to build the product from source on
Solaris 10 and 11/x86/gcc, Solaris 9/Sparc/Forte, and MacOSX/x86/gcc. these platforms/compilers: Linux/x86 (32-bit and 64-bit) (either using
The script automatically detects CPU type and operating system; in gcc or icc), Linux Itanium, Solaris 8,9,10 and 11 x86 and SPARC using
most cases this also determines which compiler to use, the exception gcc or SunStudio and MacOSX/x86/gcc.
being Linux/x86 where you can choose between gcc and icc (gcc is the
default). The script automatically detects CPU type and operating system; The
default compiler is always gcc.
To build on other platforms you can use the --print-only option on a To build on other platforms you can use the --print-only option on a
supported platform and edit the output for a proper set of commands on supported platform and edit the output for a proper set of commands on
...@@ -213,7 +231,7 @@ extended_usage() ...@@ -213,7 +231,7 @@ extended_usage()
--package=cge --package=cge
storage engines: storage engines:
ARCHIVE, BLACKHOLE, CSV, EXAMPLE, FEDERATED, MYISAM, NDB ARCHIVE, BLACKHOLE, CSV, FEDERATED, MYISAM, NDB
(All storage engines except InnoDB) (All storage engines except InnoDB)
comment: MySQL Cluster Carrier Grade Edition GPL/Commercial version comment: MySQL Cluster Carrier Grade Edition GPL/Commercial version
built from source built from source
...@@ -221,7 +239,7 @@ extended_usage() ...@@ -221,7 +239,7 @@ extended_usage()
--package=extended --package=extended
storage engines: storage engines:
ARCHIVE, BLACKHOLE, CSV, EXAMPLE, FEDERATED, MYISAM, INNODB, NDB ARCHIVE, BLACKHOLE, CSV, FEDERATED, MYISAM, INNODB, NDB
(All storage engines) (All storage engines)
comment: MySQL Cluster Carrier Grade Extended Edition GPL/Commercial comment: MySQL Cluster Carrier Grade Extended Edition GPL/Commercial
version built from source version built from source
...@@ -229,7 +247,7 @@ extended_usage() ...@@ -229,7 +247,7 @@ extended_usage()
--package=pro --package=pro
storage engines: storage engines:
ARCHIVE, BLACKHOLE, CSV, EXAMPLE, FEDERATED, INNODB, MYISAM ARCHIVE, BLACKHOLE, CSV, FEDERATED, INNODB, MYISAM
(All storage engines except NDB) (All storage engines except NDB)
comment: MySQL Pro GPL/Commercial version built from comment: MySQL Pro GPL/Commercial version built from
source source
...@@ -291,11 +309,16 @@ extended_usage() ...@@ -291,11 +309,16 @@ 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
to avoid problems with dynamic linkers (cannot be overridden). to avoid problems with dynamic linkers (cannot be overridden).
--without-example-engine: Ensure that the example engine isn't built,
it cannot do any useful things, it's merely intended as documentation.
(cannot be overridden)
--with-csv-storage-engine: Ensure that the CSV storage engine is --with-csv-storage-engine: Ensure that the CSV storage engine is
included in all builds. Since CSV is required for log tables in included in all builds. Since CSV is required for log tables in
MySQL 5.1, this option cannot be overridden. MySQL 5.1, this option cannot be overridden.
...@@ -314,10 +337,6 @@ extended_usage() ...@@ -314,10 +337,6 @@ extended_usage()
In addition there are some configure options that are specific to In addition there are some configure options that are specific to
Linux operating systems: Linux operating systems:
--with-fast-mutexes
Include an alternative implementation of mutexes that is faster on
Linux systems
--enable-assembler --enable-assembler
Include assembler code optimisations for a number of mostly string Include assembler code optimisations for a number of mostly string
methods. Used for x86 processors only. methods. Used for x86 processors only.
...@@ -364,18 +383,25 @@ extended_usage() ...@@ -364,18 +383,25 @@ extended_usage()
--with-mysqld-libs=-lmtmalloc --with-mysqld-libs=-lmtmalloc
Used on Solaris to ensure that the proper malloc library is used. Used on Solaris to ensure that the proper malloc library is used.
Investigations have shown mtmalloc to be the best choice on Solaris,
also umem has good performance on Solaris but better debugging
capabilities.
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 thisscript. 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
by calling the script as follows:
CC="/usr/local/bin/gcc" CXX="/usr/local/bin/gcc" BUILD/build_mccge.sh
FreeBSD/x86/gcc FreeBSD/x86/gcc
--------------- ---------------
No flags are used. Instead, configure determines the proper flags to No flags are used. Instead, configure determines the proper flags to
...@@ -383,8 +409,7 @@ extended_usage() ...@@ -383,8 +409,7 @@ extended_usage()
Linux/x86+Itanium/gcc Linux/x86+Itanium/gcc
------------- -------------
No flags are used. Instead the configure script determines the For debug builds -O is used and otherwise -O3 is used.Discovery of a
proper flags to use for both normal and debug builds. Discovery of a
Nocona or Core 2 Duo CPU causes a 64-bit binary to be built; Nocona or Core 2 Duo CPU causes a 64-bit binary to be built;
otherwise, the binary is 32-bit. To build a 64-bit binary, -m64 is otherwise, the binary is 32-bit. To build a 64-bit binary, -m64 is
added to the C/C++ flags. (To build a 32-bit binary on a 64-bit CPU, added to the C/C++ flags. (To build a 32-bit binary on a 64-bit CPU,
...@@ -393,16 +418,20 @@ extended_usage() ...@@ -393,16 +418,20 @@ extended_usage()
Linux/x86+Itanium/icc Linux/x86+Itanium/icc
------------- -------------
Flags used: Flags used:
CC = icc -static-libgcc -static-libcxa -i-static CC = icc -static-libgcc -static-intel
C++ = icpc -static-libgcc -static-libcxa -i-static C++ = icpc -static-libgcc -static-intel
C/C++ flags = -mp -restrict C/C++ flags = -mp -restrict
On Itanium we also add -no-ftz and -no-prefetch to CC and C++ flags. On Itanium we also add -no-ftz and to CC and C++ flags.
Note that if the user of this script sets CC or CXX explicitly then
also -static-libgcc and -static-intel needs to be set in the CC and
CXX.
The non-debug versions also add the following: The non-debug versions also add the following:
C/C++ flags += -O3 unroll2 -ip C/C++ flags += -O3 unroll2 -ip
The fast version adds: The fast version adds (if --with-link-time-optimizer is used):
C/C++ flags += -ipo C/C++ flags += -ipo
On discovery of a Core 2 Duo architecture while using icc, -xT is also On discovery of a Core 2 Duo architecture while using icc, -xT is also
...@@ -411,30 +440,83 @@ extended_usage() ...@@ -411,30 +440,83 @@ extended_usage()
Solaris/x86/gcc Solaris/x86/gcc
--------------- ---------------
All builds on Solaris are 64-bit, so -m64 is always used in the All builds on Solaris are by default 64-bit, so -m64 is always used in
C/C++ flags. LDFLAGS is set to -m64 -static-libgcc -O/-O2. the C/C++ flags. LDFLAGS is set to -m64 -O/-O2/-O3. If for
some reason a 32-bit Solaris is used it is necessary to add the flag
--32 to the script invocation. Due to bugs in compiling with -O3 on
Solaris only -O2 is used by default, when --fast flag is used -O3 will
be used instead.
Sets -m64 (default) or -m32 (if specifically set) in LDFLAGS and
C/C++ flags.
Solaris/Sparc/Forte Solaris/Sparc/Forte
------------------- -------------------
Uses cc-5.0 as CC Uses cc as CC and CC as CXX
Sets ASFLAGS=LDFLAGS=xarch=v9, so that we compile Sparc v9 binaries Note that SunStudio uses different binaries for C and C++ compilers.
C flags = -Xa -strconst -xc99=none
Set -m64 (default) or -m32 (if specifically set) in ASFLAGS,
LDFLAGS and C/C++ flags.
Sets ASFLAGS=LDFLAGS=compiler flags=xarch=sparc, so that we compile
Sparc v9 binaries, also -mt is set in all those since we're always
building a multithreaded program.
C flags = -xstrconst This flag is set only on SPARC
C++ flags = -noex C++ flags = -noex
C/C++ flags = -mt -D_FORTEC -xarch=v9
For non-debug builds, the following flags are also used: Set the following C/C++ flags:
-fsimple=1
-ftrap=%none
-nofstore This flag is set only on x86
-xbuiltin=%all
-xlibmil
-xlibmopt
Set the C++ flag:
-noex
-features=no%except This flag is set only on x86
C/C++ flags = -xO3 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
LDFLAGS: -xipo
When not compiling with fast we always set -xtarget=generic
When compiling with fast on SPARC we also set:
C/C++ flags: -xbinopt=prepare
LDFLAGS: -xbinopt=prepare
When compiling with fast on x86 we also set:
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
-xO Debug builds
-xO2 Production build on SPARC
-xO3 Production build on x86
-xO4 Fast builds on SPARC/x86
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
the build will be 64 bit instead. Thus the flag --m64 is added only
when specifically given as an option.
EOF EOF
} }
with_usage() with_usage()
{ {
cat <<EOF cat <<EOF
...@@ -495,7 +577,7 @@ parse_package() ...@@ -495,7 +577,7 @@ parse_package()
package="pro" package="pro"
;; ;;
extended ) extended )
package="" package="extended"
;; ;;
cge ) cge )
package="cge" package="cge"
...@@ -537,11 +619,15 @@ parse_cpu_type() ...@@ -537,11 +619,15 @@ parse_cpu_type()
case "$cpu_type" in case "$cpu_type" in
x86 ) x86 )
cpu_type="x86" cpu_type="x86"
m32="yes" if test "x$m64" = "x" ; then
m64="no"
fi
;; ;;
x86_64 ) x86_64 )
cpu_type="x86" cpu_type="x86"
if test "x$m64" = "x" ; then
m64="yes" m64="yes"
fi
;; ;;
itanium ) itanium )
cpu_type="itanium" cpu_type="itanium"
...@@ -569,7 +655,7 @@ parse_compiler() ...@@ -569,7 +655,7 @@ parse_compiler()
icc ) icc )
compiler="icc" compiler="icc"
;; ;;
forte ) forte | SunStudio | sunstudio )
compiler="forte" compiler="forte"
;; ;;
*) *)
...@@ -590,6 +676,9 @@ parse_options() ...@@ -590,6 +676,9 @@ parse_options()
--datadir=*) --datadir=*)
datadir=`get_key_value "$1"` datadir=`get_key_value "$1"`
;; ;;
--with-link-time-optimizer)
with_link_time_optimizer="yes"
;;
--with-debug=full) --with-debug=full)
full_debug="=full" full_debug="=full"
with_debug_flag="yes" with_debug_flag="yes"
...@@ -601,6 +690,15 @@ parse_options() ...@@ -601,6 +690,15 @@ parse_options()
fast_flag="generic" fast_flag="generic"
fi fi
;; ;;
--use-comment)
without_comment="no"
;;
--with-fast-mutexes)
with_fast_mutexes="yes"
;;
--use-tcmalloc)
use_tcmalloc="yes"
;;
--with-debug) --with-debug)
with_debug_flag="yes" with_debug_flag="yes"
fast_flag="no" fast_flag="no"
...@@ -636,17 +734,19 @@ parse_options() ...@@ -636,17 +734,19 @@ parse_options()
warning_mode="normal" warning_mode="normal"
;; ;;
--32) --32)
if test "x$m64" != "x" ; then if test "x$explicit_size_set" != "x" ; then
echo "Cannot set both --32 and --64" echo "Cannot set both --32 and --64"
exit 1 exit 1
fi fi
m32="yes" explicit_size_set="yes"
m64="no"
;; ;;
--64) --64)
if test "x$m32" != "x" ; then if test "x$explicit_size_set" != "x" ; then
echo "Cannot set both --32 and --64" echo "Cannot set both --32 and --64"
exit 1 exit 1
fi fi
explicit_size_set="yes"
m64="yes" m64="yes"
;; ;;
--package=*) --package=*)
...@@ -750,13 +850,15 @@ set_cpu_base() ...@@ -750,13 +850,15 @@ set_cpu_base()
if test "x$cpu_type" = "x" ; then if test "x$cpu_type" = "x" ; then
if test "x$cpu_arg" = "x" ; then if test "x$cpu_arg" = "x" ; then
usage "CPU type not discovered, cannot proceed" usage "CPU type not discovered, cannot proceed"
return 1 exit 1
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 )
...@@ -775,19 +877,21 @@ set_cpu_base() ...@@ -775,19 +877,21 @@ set_cpu_base()
check_cpu_cflags="" check_cpu_cflags=""
fi fi
if test "x$os" = "xMacOSX" ; then if test "x$os" = "xMacOSX" ; then
if test "x$m64" = "x" ; then
m64="no" m64="no"
fi
elif test "x$os" = "xSolaris" ; then elif test "x$os" = "xSolaris" ; then
if test "x$m64" = "x" ; then
m64="yes" m64="yes"
elif test "x$m32" = "x" ; then fi
elif test "x$m64" = "x" ; then
if test "x$cpu_arg" = "xnocona" || test "x$cpu_arg" = "xcore2" || \ if test "x$cpu_arg" = "xnocona" || test "x$cpu_arg" = "xcore2" || \
test "x$cpu_arg" = "xathlon64" || test "x$cpu_arg" = "xopteron" ; then test "x$cpu_arg" = "xathlon64" || test "x$cpu_arg" = "xopteron" ; then
m64="yes" m64="yes"
elif test "x$m64" != "xyes" ; then
m64="no"
fi
else else
m64="no" m64="no"
fi fi
fi
echo "Discovered CPU of type $cpu_base_type ($cpu_arg) on $os" echo "Discovered CPU of type $cpu_base_type ($cpu_arg) on $os"
if test "x$m64" = "xyes" ; then if test "x$m64" = "xyes" ; then
echo "Will compile 64-bit binaries" echo "Will compile 64-bit binaries"
...@@ -806,18 +910,15 @@ init_configure_commands() ...@@ -806,18 +910,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"
commands="$commands env_flags="CC=\"$CC\" CFLAGS=\"$cflags\" CXX=\"$CXX\" CXXFLAGS=\"$cxxflags\""
CC=\"$CC\" CFLAGS=\"$cflags\" CXX=\"$CXX\" CXXFLAGS=\"$cxxflags\""
if test "x$LDFLAGS" != "x" ; then if test "x$LDFLAGS" != "x" ; then
commands="$commands env_flags="$env_flags LDFLAGS=\"$LDFLAGS\""
LDFLAGS=\"$LDFLAGS\""
fi fi
if test "x$ASFLAGS" != "x" ; then if test "x$ASFLAGS" != "x" ; then
commands="$commands env_flags="$env_flags ASFLAGS=\"$ASFLAGS\""
ASFLAGS=\"$ASFLAGS\""
fi fi
commands="$commands commands="$commands
$configure" $env_flags $configure"
} }
# #
...@@ -920,7 +1021,7 @@ set_libtoolize_version() ...@@ -920,7 +1021,7 @@ set_libtoolize_version()
# We do not use ccache when gcov is used. Also only when # We do not use ccache when gcov is used. Also only when
# gcc is used. # gcc is used.
# #
set_up_ccache() set_ccache_usage()
{ {
if test "x$compiler" = "xgcc" ; then if test "x$compiler" = "xgcc" ; then
if ccache -V > /dev/null 2>&1 && test "$USING_GCOV" != "1" if ccache -V > /dev/null 2>&1 && test "$USING_GCOV" != "1"
...@@ -994,7 +1095,7 @@ set_with_debug_flags() ...@@ -994,7 +1095,7 @@ set_with_debug_flags()
if test "x$with_debug_flag" = "xyes" ; then if test "x$with_debug_flag" = "xyes" ; then
if test "x$developer_flag" = "xyes" ; then if test "x$developer_flag" = "xyes" ; then
loc_debug_flags="-DUNIV_MUST_NOT_INLINE -DEXTRA_DEBUG -DFORCE_INIT_OF_VARS " loc_debug_flags="-DUNIV_MUST_NOT_INLINE -DEXTRA_DEBUG -DFORCE_INIT_OF_VARS "
loc_debug_flags="$loc_debug_cflags -DSAFEMALLOC -DPEDANTIC_SAFEMALLOC" loc_debug_flags="$loc_debug_flags -DSAFEMALLOC -DPEDANTIC_SAFEMALLOC"
compiler_flags="$compiler_flags $loc_debug_flags" compiler_flags="$compiler_flags $loc_debug_flags"
fi fi
fi fi
...@@ -1023,6 +1124,18 @@ set_debug_flag() ...@@ -1023,6 +1124,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
# #
...@@ -1048,9 +1161,12 @@ set_base_configs() ...@@ -1048,9 +1161,12 @@ set_base_configs()
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=all" 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"
} }
# #
...@@ -1060,18 +1176,30 @@ set_base_configs() ...@@ -1060,18 +1176,30 @@ set_base_configs()
# #
set_base_engines() set_base_engines()
{ {
engine_configs="$engine_configs --with-archive-storage-engine" engine_configs="--with-archive-storage-engine"
engine_configs="$engine_configs --with-blackhole-storage-engine" engine_configs="$engine_configs --with-blackhole-storage-engine"
engine_configs="$engine_configs --with-example-storage-engine" engine_configs="$engine_configs --without-example-storage-engine"
engine_configs="$engine_configs --with-federated-storage-engine" engine_configs="$engine_configs --with-federated-storage-engine"
engine_configs="$engine_configs --with-partition" engine_configs="$engine_configs --with-partition"
base_configs="$base_configs $engine_configs"
} }
set_pro_package() set_innodb_engine()
{ {
base_configs="$base_configs $engine_configs"
base_configs="$base_configs --with-innodb" base_configs="$base_configs --with-innodb"
base_configs="$base_configs --with-comment=\"MySQL Pro $version_text built from source\"" }
set_ndb_engine()
{
base_configs="$base_configs --with-ndbcluster"
base_configs="$base_configs --without-ndb-debug"
}
set_pro_package()
{
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
...@@ -1079,40 +1207,37 @@ set_pro_package() ...@@ -1079,40 +1207,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"
fi
base_configs="$base_configs --with-ndbcluster"
base_configs="$base_configs --without-ndb-debug"
base_configs="$base_configs $engine_configs"
base_configs="$base_configs --with-innodb"
base_configs="$base_configs --with-comment=\"MySQL Cluster Carrier Grade Extended Edition $version_text built from source\"" base_configs="$base_configs --with-comment=\"MySQL Cluster Carrier Grade Extended 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-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-ndbcluster" if test "x$without_comment" != "xyes" ; then
base_configs="$base_configs --without-ndb-debug"
base_configs="$base_configs $engine_configs"
base_configs="$base_configs --with-comment=\"MySQL Cluster Carrier Grade Edition $version_text built from source\"" 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()
{ {
if test "x$without_comment" != "xyes" ; then
base_configs="$base_configs --with-comment=\"MySQL Classic $version_text built from source\"" 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"
} }
# #
...@@ -1140,6 +1265,36 @@ set_gcc_special_options() ...@@ -1140,6 +1265,36 @@ set_gcc_special_options()
fi fi
} }
set_cc_and_cxx_for_gcc()
{
if test "x$CC" = "x" ; then
CC="gcc -static-libgcc -fno-exceptions"
fi
if test "x$CXX" = "x" ; then
CXX="gcc -static-libgcc -fno-exceptions"
fi
}
set_cc_and_cxx_for_icc()
{
if test "x$CC" = "x" ; then
CC="icc -static-intel -static-libgcc"
fi
if test "x$CXX" = "x" ; then
CXX="icpc -static-intel -static-libgcc"
fi
}
set_cc_and_cxx_for_forte()
{
if test "x$CC" = "x" ; then
CC="cc"
fi
if test "x$CXX" = "x" ; then
CXX="CC"
fi
}
# #
# If we discover a Core 2 Duo architecture and we have enabled the fast # If we discover a Core 2 Duo architecture and we have enabled the fast
# flag, we enable a compile especially optimised for Core 2 Duo. This # flag, we enable a compile especially optimised for Core 2 Duo. This
...@@ -1167,10 +1322,69 @@ set_bsd_configs() ...@@ -1167,10 +1322,69 @@ set_bsd_configs()
exit 1 exit 1
fi fi
base_configs="$base_configs --enable-assembler" base_configs="$base_configs --enable-assembler"
CC="gcc" if test "x$fast_flag" != "xno" ; then
CXX="gcc" compiler_flags="$compiler_flags -O3"
else
compiler_flags="$compiler_flags -O0"
fi
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
# #
...@@ -1178,31 +1392,46 @@ set_linux_configs() ...@@ -1178,31 +1392,46 @@ set_linux_configs()
{ {
if test "x$cpu_base_type" != "xx86" && \ if test "x$cpu_base_type" != "xx86" && \
test "x$cpu_base_type" != "xitanium" ; then test "x$cpu_base_type" != "xitanium" ; then
usage "Only x86 and Itanium CPUs supported for 32-bit Linux" usage "Only x86 and Itanium CPUs supported for Linux"
exit 1 exit 1
fi fi
base_configs="$base_configs --with-fast-mutexes" if test "x$use_tcmalloc" = "xyes" ; then
base_configs="$base_configs --with-mysqld-libs=-ltcmalloc_minimal"
fi
if test "x$cpu_base_type" = "xx86" ; then if test "x$cpu_base_type" = "xx86" ; then
base_configs="$base_configs --enable-assembler" base_configs="$base_configs --enable-assembler"
fi fi
if test "x$compiler" = "xgcc" ; then if test "x$compiler" = "xgcc" ; then
CC="gcc" set_cc_and_cxx_for_gcc
CXX="gcc" if test "x$fast_flag" != "xno" ; then
if test "x$fast_flag" = "xyes" ; then
compiler_flags="$compiler_flags -O3"
check_for_link_time_optimizer
else
compiler_flags="$compiler_flags -O2"
fi
else
compiler_flags="$compiler_flags -O0"
fi
check_64_bits
if test "x$m64" = "xyes" ; then if test "x$m64" = "xyes" ; then
compiler_flags="$compiler_flags -m64" compiler_flags="$compiler_flags -m64"
else
compiler_flags="$compiler_flags -m32"
fi 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"
CC="icc -static-intel" set_cc_and_cxx_for_icc
CXX="icpc -static-intel"
if test "x$cpu_base_type" = "xitanium" ; then if test "x$cpu_base_type" = "xitanium" ; then
compiler_flags="$compiler_flags -no-ftz" compiler_flags="$compiler_flags -no-ftz"
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
...@@ -1216,53 +1445,111 @@ set_linux_configs() ...@@ -1216,53 +1445,111 @@ set_linux_configs()
# #
set_solaris_configs() set_solaris_configs()
{ {
base_configs="$base_configs --with-mysqld-libs=-lmtmalloc" # Use mtmalloc as malloc, see Tim Cook blog
# 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"
case "`uname -a`" in case "`uname -a`" in
*5.10*|*5.11*) *5.8* | *5.9* )
;;
*5.10* | *5.11*)
base_configs="$base_configs --with-mysqld-libs=-lmtmalloc"
;; ;;
*) *)
die "Only versions 10 and 11 supported for Solaris" usage "Only versions 8,9, 10 and 11 supported for Solaris"
exit 1
esac esac
if test "x$cpu_base_type" != "xx86" && \ if test "x$cpu_base_type" != "xx86" && \
test "x$cpu_base_type" != "xsparc" ; then test "x$cpu_base_type" != "xsparc" ; then
usage "Only x86 and Sparc CPUs supported for Solaris" usage "Only x86 and Sparc CPUs supported for Solaris"
exit 1 exit 1
fi fi
if test "x$compiler" != "xgcc" && \
test "x$compiler" != "xforte" ; then
usage "Only gcc and Forte compilers supported for Solaris"
exit 1
fi
if test "x$m64" = "xyes" ; then
compiler_flags="$compiler_flags -m64"
LDFLAGS="-m64"
ASFLAGS="$ASFLAGS -m64"
else
compiler_flags="$compiler_flags -m32"
LDFLAGS="-m32"
ASFLAGS="$ASFLAGS -m32"
fi
if test "x$compiler" = "xgcc" ; then if test "x$compiler" = "xgcc" ; then
CC="gcc" set_cc_and_cxx_for_gcc
CXX="gcc"
if test "x$cpu_base_type" != "xx86" ; then if test "x$cpu_base_type" != "xx86" ; then
usage "Only gcc supported for Solaris 10/11 on SPARC" usage "gcc currently not supported for Solaris on SPARC"
exit 1
fi fi
compiler_flags="$compiler_flags -m64 -DMY_ATOMIC_MODE_RWLOCKS" if test "x$fast_flag" = "xyes" ; then
LDFLAGS="-m64 -static-libgcc" LDFLAGS="$LDFLAGS -O3"
if test "x$fast_flag" != "xno" ; then compiler_flags="$compiler_flags -O3"
check_for_link_time_optimizer
else
if test "x$fast_flag" = "xgeneric" ; then
LDFLAGS="$LDFLAGS -O2" LDFLAGS="$LDFLAGS -O2"
compiler_flags="$compiler_flags -O2" compiler_flags="$compiler_flags -O2"
else else
LDFLAGS="$LDFLAGS -O" LDFLAGS="$LDFLAGS -O0"
compiler_flags="$compiler_flags -O" compiler_flags="$compiler_flags -O0"
fi
fi
else
#Using Forte compiler (SunStudio)
set_cc_and_cxx_for_forte
compiler_flags="$compiler_flags -mt"
LDFLAGS="$LDFLAGS -mt"
compiler_flags="$compiler_flags -fsimple=1"
compiler_flags="$compiler_flags -ftrap=%none"
compiler_flags="$compiler_flags -xbuiltin=%all"
compiler_flags="$compiler_flags -xlibmil"
compiler_flags="$compiler_flags -xlibmopt"
if test "x$fast_flag" = "xyes" ; then
compiler_flags="$compiler_flags -xtarget=native"
compiler_flags="$compiler_flags -xunroll=3"
if test "x$with_link_time_optimizer" = "xyes" ; then
compiler_flags="$compiler_flags -xipo"
LDFLAGS="$LDFLAGS -xipo"
fi
else
compiler_flags="$compiler_flags -xtarget=generic"
fi fi
elif test "x$compiler" = "xforte" ; then
if test "x$cpu_base_type" = "xx86" ; then if test "x$cpu_base_type" = "xx86" ; then
usage "Only gcc supported for Solaris/x86" compiler_flags="$compiler_flags -nofstore"
base_cxx_flags="$base_cxx_flags -features=no%except"
if test "x$fast_flag" = "xyes" ; then
compiler_flags="$compiler_flags -xregs=frameptr"
compiler_flags="$compiler_flags -xO4"
else
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
if test "x$cpu_base_type" != "xsparc" ; then
usage "Forte compiler supported for Solaris 9/SPARC only"
fi fi
CC="cc-5.0" else
CXX=CC #Using SPARC cpu with SunStudio (Forte) compiler
ASFLAGS="xarch=v9" ASFLAGS="$ASFLAGS -xarch=sparc"
LDFLAGS="xarch=v9" LDFLAGS="$LDFLAGS -xarch=sparc"
base_cflags="$base_cflags -Xa -xstrconst -xc99=none"
base_cxxflags="$base_cxxflags -noex" base_cxxflags="$base_cxxflags -noex"
compiler_flags="$compiler_flags -mt -D_FORTEC -xarch=v9" base_cflags="$base_cflags -xstrconst"
if test "x$fast_flag" != "xno" ; then compiler_flags="$compiler_flags -xarch=sparc"
if test "x$fast_flag" = "xyes" ; then
compiler_flags="$compiler_flags -xbinopt=prepare"
LDFLAGS="$LDFLAGS -xbinopt=prepare"
compiler_flags="$compiler_flags -xO4"
elif test "x$fast_flag" = "xgeneric" ; then
compiler_flags="$compiler_flags -xO3" compiler_flags="$compiler_flags -xO3"
fi
else else
usage "Only gcc and Forte compilers supported for Solaris" compiler_flags="$compiler_flags -xO0"
exit 1 fi
fi
fi fi
} }
...@@ -1271,10 +1558,7 @@ set_solaris_configs() ...@@ -1271,10 +1558,7 @@ set_solaris_configs()
# #
set_macosx_configs() set_macosx_configs()
{ {
base_cxxflags="$base_cxxflags -fno-common" if test "x$cpu_base_type" != "xx86" || test "x$compiler" != "xgcc" ; then
if test "x$cpu_base_type" = "xx86" && test "x$compiler" = "xgcc" ; then
compiler_flags="$compiler_flags -arch i386"
else
usage "Only gcc/x86 supported for Mac OS X" usage "Only gcc/x86 supported for Mac OS X"
exit 1 exit 1
fi fi
...@@ -1282,14 +1566,21 @@ set_macosx_configs() ...@@ -1282,14 +1566,21 @@ set_macosx_configs()
# Optimize for space as long as it doesn't affect performance, use some # Optimize for space as long as it doesn't affect performance, use some
# optimisations also when not in fast mode. # optimisations also when not in fast mode.
# #
base_cxxflags="$base_cxxflags -felide-constructors"
compiler_flags="$compiler_flags -fno-common"
if test "x$m64" = "xyes" ; then
compiler_flags="$compiler_flags -m64"
compiler_flags="$compiler_flags -arch x86_64"
else
compiler_flags="$compiler_flags -m32"
compiler_flags="$compiler_flags -arch i386"
fi
if test "x$fast_flag" != "xno" ; then if test "x$fast_flag" != "xno" ; then
compiler_flags="$compiler_flags -Os" compiler_flags="$compiler_flags -Os"
base_cxxflags="$base_cxxflags -felide-constructors"
else else
compiler_flags="$compiler_flags -O" compiler_flags="$compiler_flags -O0"
fi fi
CC="gcc" set_cc_and_cxx_for_gcc
CXX="gcc"
} }
# #
...@@ -1370,7 +1661,7 @@ fi ...@@ -1370,7 +1661,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"
...@@ -1398,11 +1689,19 @@ base_cxxflags= ...@@ -1398,11 +1689,19 @@ base_cxxflags=
base_configs= base_configs=
debug_flags= debug_flags=
cxxflags= cxxflags=
m32=
m64= m64=
explicit_size_set=
datadir= datadir=
commands= commands=
use_autotools= use_autotools=
engine_configs=
ASFLAGS=
LDFLAGS=
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
...@@ -1419,7 +1718,14 @@ set -e ...@@ -1419,7 +1718,14 @@ set -e
# This call sets the cpu_arg and check_cpu_args parameters # This call sets the cpu_arg and check_cpu_args parameters
# #
path=`dirname $0` path=`dirname $0`
if test "x$compiler" = "xgcc" ; then
compiler=
fi
. "$path/check-cpu" . "$path/check-cpu"
if test "x$compiler" = "x" ; then
compiler="gcc"
fi
check_os
set_cpu_base set_cpu_base
if test "x$?" = "x1" ; then if test "x$?" = "x1" ; then
exit 1 exit 1
...@@ -1447,17 +1753,23 @@ set_icc_special_options ...@@ -1447,17 +1753,23 @@ set_icc_special_options
# including all storage engines except InnoDB, and to use GPL libraries. # including all storage engines except InnoDB, and to use GPL libraries.
# #
set_base_configs set_base_configs
set_base_engines
if test "x$gpl" = "xyes" ; then if test "x$gpl" = "xyes" ; then
version_text="GPL version" version_text="GPL version"
else else
version_text="Commercial version" version_text="Commercial version"
fi fi
if test "x$package" = "xpro" ; then if test "x$package" = "xpro" ; then
set_base_engines
set_innodb_engine
set_pro_package set_pro_package
elif test "x$package" = "xextended" ; then elif test "x$package" = "xextended" ; then
set_base_engines
set_ndb_engine
set_innodb_engine
set_cge_extended_package set_cge_extended_package
elif test "x$package" = "xcge" ; then elif test "x$package" = "xcge" ; then
set_base_engines
set_ndb_engine
set_cge_package set_cge_package
elif test "x$package" = "xclassic" ; then elif test "x$package" = "xclassic" ; then
set_classic_package set_classic_package
...@@ -1473,7 +1785,6 @@ set_error_inject_configs ...@@ -1473,7 +1785,6 @@ set_error_inject_configs
# operating systems, and processors. # operating systems, and processors.
# #
check_os
if test "x$os" = "xlinux" ; then if test "x$os" = "xlinux" ; then
set_linux_configs set_linux_configs
elif test "x$os" = "xSolaris" ; then elif test "x$os" = "xSolaris" ; then
...@@ -1485,13 +1796,13 @@ elif test "x$os" = "xbsd" ; then ...@@ -1485,13 +1796,13 @@ 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.
# #
set_make_version set_make_version
set_up_ccache set_ccache_usage
# #
# Set up commands variable from variables prepared for base # Set up commands variable from variables prepared for base
......
...@@ -16,12 +16,14 @@ check_cpu () { ...@@ -16,12 +16,14 @@ check_cpu () {
# on Linux (and others?) we can get detailed CPU information out of /proc # on Linux (and others?) we can get detailed CPU information out of /proc
cpuinfo="cat $CPUINFO" cpuinfo="cat $CPUINFO"
# detect CPU architecture
cpu_arch=`$cpuinfo | grep 'arch' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -1`
# detect CPU family # detect CPU family
cpu_family=`$cpuinfo | grep 'family' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -1` cpu_family=`$cpuinfo | grep 'family' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -1`
if test -z "$cpu_family" ; then if test -z "$cpu_family" ; then
cpu_family=`$cpuinfo | grep 'cpu' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -1` cpu_family=`$cpuinfo | grep 'cpu' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -1`
fi fi
# detect CPU vendor and model # detect CPU vendor and model
cpu_vendor=`$cpuinfo | grep 'vendor_id' | 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`
model_name=`$cpuinfo | grep 'model name' | cut -d ':' -f 2 | head -1` model_name=`$cpuinfo | grep 'model name' | cut -d ':' -f 2 | head -1`
...@@ -56,8 +58,8 @@ check_cpu () { ...@@ -56,8 +58,8 @@ check_cpu () {
fi fi
;; ;;
*) *)
cpu_family=`uname -m`; cpu_family=`uname -p`;
model_name=`uname -p`; model_name=`uname -m`;
;; ;;
esac esac
fi fi
...@@ -65,9 +67,10 @@ check_cpu () { ...@@ -65,9 +67,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" in low_cpu_arg=""
case "$cpu_vendor--$cpu_family--$model_name--$cpu_arch" in
# DEC Alpha # DEC Alpha
Alpha*EV6*) *Alpha*EV6*)
cpu_arg="ev6"; cpu_arg="ev6";
;; ;;
#Core 2 Duo #Core 2 Duo
...@@ -96,6 +99,13 @@ check_cpu () { ...@@ -96,6 +99,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"
;; ;;
...@@ -120,6 +130,12 @@ check_cpu () { ...@@ -120,6 +130,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"
;; ;;
...@@ -129,9 +145,30 @@ check_cpu () { ...@@ -129,9 +145,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"
...@@ -143,8 +180,11 @@ check_cpu () { ...@@ -143,8 +180,11 @@ check_cpu () {
*Itanium*) *Itanium*)
cpu_arg="itanium" cpu_arg="itanium"
;; ;;
*IA-64*)
cpu_arg="itanium"
;;
# Solaris Sparc # Solaris Sparc
*sparc*sun4u*) *sparc*sun4[uv]*)
cpu_arg="sparc" cpu_arg="sparc"
;; ;;
# Power PC # Power PC
...@@ -160,6 +200,10 @@ check_cpu () { ...@@ -160,6 +200,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
...@@ -198,7 +242,7 @@ check_cpu () { ...@@ -198,7 +242,7 @@ check_cpu () {
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
......
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