2008-02-08 00:12:34 +01:00
|
|
|
#!/bin/sh
|
|
|
|
|
2011-02-20 17:51:43 +01:00
|
|
|
# Copyright (c) 2008, 2010, Oracle.
|
|
|
|
# Copyright (c) 2009-2011 Monty Program Ab
|
2010-12-29 00:47:05 +01:00
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU Library General Public
|
|
|
|
# License as published by the Free Software Foundation; version 2
|
|
|
|
# of the License.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
# Library General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU Library General Public
|
|
|
|
# License along with this library; if not, write to the Free
|
2011-06-30 17:46:53 +02:00
|
|
|
# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
|
|
|
|
# MA 02110-1301, USA
|
2010-12-29 00:47:05 +01:00
|
|
|
|
2008-02-08 00:12:34 +01:00
|
|
|
die()
|
|
|
|
{
|
|
|
|
echo "ERROR: $@"; exit 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
get_key_value()
|
|
|
|
{
|
|
|
|
echo "$1" | sed 's/^--[a-zA-Z_-]*=//'
|
|
|
|
}
|
|
|
|
|
|
|
|
developer_usage()
|
|
|
|
{
|
|
|
|
cat <<EOF
|
2011-02-20 17:51:43 +01:00
|
|
|
This script can be used by developers of MariaDB wanting to try out
|
|
|
|
early versions before binary versions are available, anyone needing
|
|
|
|
a version with a special patch included that needs to be built from
|
|
|
|
source code, or anyone else wanting to exercise full control over
|
|
|
|
the build process.
|
|
|
|
|
|
|
|
This help text is targeted towards those that want to debug and test
|
|
|
|
source code releases. If you have downloaded a source code release
|
|
|
|
and simply want to build a usable binary, you should read the
|
2008-02-08 00:12:34 +01:00
|
|
|
--sysadmin-help instead.
|
|
|
|
|
2011-02-20 17:51:43 +01:00
|
|
|
Three environment variables can be used to define the default behaviour:
|
2008-02-08 00:12:34 +01:00
|
|
|
|
|
|
|
MYSQL_DEVELOPER
|
|
|
|
Defining this variable is similar to setting the --developer flag
|
|
|
|
MYSQL_DEVELOPER_PACKAGE=package
|
|
|
|
Defining this variable is similar to setting the --package=*
|
|
|
|
variable
|
|
|
|
MYSQL_DEVELOPER_DEBUG
|
|
|
|
Defining this variable sets the --with-debug flag
|
|
|
|
|
|
|
|
Options used with this script always override any default behaviour.
|
|
|
|
|
|
|
|
More information for developers can be found in --help,
|
|
|
|
--sysadmin-help, and --extended-help.
|
|
|
|
|
|
|
|
The most common usage for developers is to set the three variables
|
|
|
|
mentioned previously and then simply to run the script without any
|
|
|
|
additional parameters, using them only when needing to change some
|
|
|
|
things like not requiring debug build. If some of these environment
|
|
|
|
variables have already been set, you can use the corresponding options
|
|
|
|
to unset them and reverse their effects.
|
|
|
|
EOF
|
|
|
|
}
|
|
|
|
|
|
|
|
sysadmin_usage()
|
|
|
|
{
|
|
|
|
cat <<EOF
|
|
|
|
|
|
|
|
It is assumed that you are building on a computer which is of the
|
2011-02-20 17:51:43 +01:00
|
|
|
same type as that on which you intend to run the program.
|
2008-02-08 00:12:34 +01:00
|
|
|
|
|
|
|
The simplest possible way to run this script is to allow it to use the
|
2010-09-16 08:53:58 +02:00
|
|
|
built-in defaults everywhere, invoking it simply as (from top-level
|
2011-02-20 17:51:43 +01:00
|
|
|
MariaDB source directory):
|
2008-02-08 00:12:34 +01:00
|
|
|
|
2010-09-16 08:53:58 +02:00
|
|
|
shell> BUILD/build_mccge.sh
|
2008-02-08 00:12:34 +01:00
|
|
|
|
|
|
|
This performs the following operations:
|
|
|
|
1) Detects the operating system. Currently, Linux, FreeBSD, Solaris
|
2008-12-19 12:34:02 +01:00
|
|
|
8/9/10/11, and Mac OS X are supported by this script.
|
2008-02-08 00:12:34 +01:00
|
|
|
2) Detect the type of CPU being used. Currently supported processors
|
|
|
|
are: x86 for all supported operating systems, Itanium for Linux
|
2009-02-06 14:20:06 +01:00
|
|
|
with GCC, and x86 + SPARC for Solaris using the Forte compiler and
|
|
|
|
finally x86 on Linux using the Intel compiler.
|
2008-02-08 00:12:34 +01:00
|
|
|
3) Invokes the GCC compiler.
|
2011-02-20 17:51:43 +01:00
|
|
|
4) Builds a set of of binaries ; for more information about these,
|
|
|
|
see --extended-help.
|
2008-12-19 12:34:02 +01:00
|
|
|
5) Default compiler is always gcc.
|
2008-02-08 00:12:34 +01:00
|
|
|
|
|
|
|
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
|
2011-02-20 17:51:43 +01:00
|
|
|
be run. If you have downloaded a launchpad tree then you should read
|
2008-02-08 00:12:34 +01:00
|
|
|
--developer-help.
|
|
|
|
|
2009-02-06 14:20:06 +01:00
|
|
|
If your building on a Solaris SPARC machine and you want to compile
|
|
|
|
using SunStudio you must set
|
2008-02-08 00:12:34 +01:00
|
|
|
--compiler=forte; if you want to build using the Intel compiler on
|
2010-12-01 13:38:47 +01:00
|
|
|
Linux, you need to set --compiler=icc. If you want to use the AMD
|
|
|
|
compiler Open64 set --compiler=open64.
|
2008-02-08 00:12:34 +01:00
|
|
|
|
2008-12-19 12:34:02 +01:00
|
|
|
A synonym for forte is SunStudio, so one can also use
|
|
|
|
--compiler=SunStudio.
|
|
|
|
|
2008-02-08 00:12:34 +01:00
|
|
|
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
|
|
|
|
when check-cpu is able to discover that a 64-bit CPU is being used. If
|
|
|
|
you want to ensure that a 32-bit binary is produced, use --32 instead.
|
|
|
|
|
|
|
|
If you need the binaries to be installed in a different location from
|
|
|
|
/usr/local/mysql, then you should set --prefix to point to where you
|
|
|
|
want the binaries installed.
|
|
|
|
|
|
|
|
Using a data directory other than the default (PREFIX/data) can be
|
2011-02-20 17:51:43 +01:00
|
|
|
done when starting the server, or by invoking this script with
|
2008-02-08 00:12:34 +01:00
|
|
|
the --datadir option.
|
|
|
|
|
|
|
|
If you want your binaries stripped of surplus debug or other
|
|
|
|
information, use the --strip option.
|
|
|
|
|
|
|
|
If you want debug information in the binary (for example, to be
|
2011-02-20 17:51:43 +01:00
|
|
|
able to send gdb core dumps to support), then you should add the
|
2008-02-08 00:12:34 +01:00
|
|
|
flag --with-debug; if you want a production build with only debugging
|
|
|
|
information in the binary then use --debug.
|
|
|
|
EOF
|
|
|
|
}
|
|
|
|
|
|
|
|
usage()
|
|
|
|
{
|
|
|
|
cat <<EOF
|
|
|
|
|
|
|
|
Usage: $0 [options]
|
|
|
|
--help Show this help message.
|
|
|
|
--sysadmin-help Show help for system administrators wishing
|
2011-02-20 17:51:43 +01:00
|
|
|
to build MariaDB
|
|
|
|
--developer-help Show help for developers trying to build MariaDB
|
2008-02-08 00:12:34 +01:00
|
|
|
--with-help Show extended help on --with-xxx options to
|
|
|
|
configure
|
|
|
|
--extended-help Show extended help message
|
|
|
|
--without-debug Build non-debug version
|
2010-09-16 08:53:58 +02:00
|
|
|
--use-comment Set the comment in the build
|
|
|
|
--with-fast-mutexes Use try/retry method of acquiring mutex
|
2010-12-01 13:38:47 +01:00
|
|
|
--without-fast-mutexes Don't use try/retry method of acquiring mutex
|
|
|
|
--without-perfschema Don't build with performance schema
|
|
|
|
--generate-feedback path Compile with feedback using the specified directory
|
|
|
|
to store the feedback files
|
|
|
|
--use-feedback path Compile using feedback information from the specified
|
|
|
|
directory
|
2008-02-08 00:12:34 +01:00
|
|
|
--with-debug Build debug version
|
2010-12-01 13:38:47 +01:00
|
|
|
--extra-debug-flag flag Add -Dflag to compiler flags
|
|
|
|
InnoDB supports the following debug flags,
|
|
|
|
UNIV_DEBUG, UNIV_SYNC_DEBUG, UNIV_MEM_DEBUG,
|
|
|
|
UNIV_DEBUG_THREAD_CREATION, UNIV_DEBUG_LOCK_VALIDATE,
|
|
|
|
UNIV_DEBUG_PRINT, UNIV_DEBUG_FILE_ACCESS,
|
|
|
|
UNIV_LIGHT_MEM_DEBUG, UNIV_LOG_DEBUG,
|
|
|
|
UNIV_IBUF_COUNT_DEBUG, UNIV_SEARCH_DEBUG,
|
|
|
|
UNIV_LOG_LSN_DEBUG, UNIV_ZIP_DEBUG, UNIV_AHI_DEBUG,
|
|
|
|
UNIV_DEBUG_VALGRIND, UNIV_SQL_DEBUG, UNIV_AIO_DEBUG,
|
|
|
|
UNIV_BTR_DEBUG, UNIV_LRU_DEBUG, UNIV_BUF_DEBUG,
|
|
|
|
UNIV_HASH_DEBUG, UNIV_LIST_DEBUG, UNIV_IBUF_DEBUG
|
2010-09-16 08:53:58 +02:00
|
|
|
--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.
|
2010-12-01 13:38:47 +01:00
|
|
|
--with-mso Special flag used by Open64 compiler (requres at
|
|
|
|
least version 4.2.3) that enables optimisations
|
|
|
|
for multi-core scalability.
|
2008-02-08 00:12:34 +01:00
|
|
|
--configure-only Stop after running configure.
|
|
|
|
--print-only Print commands that the script will execute,
|
|
|
|
but do not actually execute
|
|
|
|
--prefix=path Build with prefix 'path'
|
|
|
|
--datadir=path Build with data directory set to non-standard
|
|
|
|
'path'
|
|
|
|
--debug Build normal version, but add debug
|
|
|
|
information to binary
|
2011-02-20 17:51:43 +01:00
|
|
|
--developer Use extensions that most MariaDB developers use
|
2008-02-08 00:12:34 +01:00
|
|
|
--no-developer Do not use extensions that most developers of
|
2011-02-20 17:51:43 +01:00
|
|
|
MariaDB use
|
2010-12-01 13:38:47 +01:00
|
|
|
--compiler=[gcc|icc|forte|SunStudio|open64] Select compiler
|
2009-02-06 14:20:06 +01:00
|
|
|
--cpu=[x86|x86_64|sparc|itanium] Select CPU type
|
2008-12-19 12:34:02 +01:00
|
|
|
x86 => x86 and 32-bit binary
|
|
|
|
x86_64 => x86 and 64 bit binary
|
2008-02-08 00:12:34 +01:00
|
|
|
--warning-mode=[extra|pedantic|normal|no] Set warning mode level
|
|
|
|
--warnings Set warning mode to normal
|
|
|
|
--32 Build a 32-bit binary even if CPU is 64-bit
|
|
|
|
--64 Build a 64-bit binary even if not sure a
|
|
|
|
64-bit CPU is being used
|
2011-02-20 17:51:43 +01:00
|
|
|
--package=[pro|classic] Select package to build
|
2008-02-08 00:12:34 +01:00
|
|
|
--parallelism=number Define parallelism in make
|
|
|
|
--strip Strip binaries
|
2011-02-20 17:51:43 +01:00
|
|
|
--error-inject Enable error injection into MariaDB Server and
|
2008-02-08 00:12:34 +01:00
|
|
|
data nodes
|
|
|
|
--valgrind Build with valgrind
|
2008-12-19 11:46:28 +01:00
|
|
|
--fast Optimise for CPU architecture built on
|
2008-02-08 00:12:34 +01:00
|
|
|
--static-linking Statically link system libraries into binaries
|
2008-12-20 15:46:31 +01:00
|
|
|
--use-tcmalloc Link with tcmalloc instead of standard malloc (Linux only)
|
2008-02-08 00:12:34 +01:00
|
|
|
--with-flags * Pass extra --with-xxx options to configure
|
|
|
|
EOF
|
|
|
|
if test "x$1" != "x" ; then
|
|
|
|
echo "Failure Message: $1"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
extended_usage()
|
|
|
|
{
|
|
|
|
cat <<EOF
|
|
|
|
|
|
|
|
Extended help text for this script:
|
2011-02-20 17:51:43 +01:00
|
|
|
-----------------------------------
|
|
|
|
|
|
|
|
This script is intended to make it easier to build
|
|
|
|
performance-optimised MariaDB versions from source on these
|
|
|
|
platforms/compilers: Linux/x86 (32-bit and 64-bit) (either using gcc
|
|
|
|
or icc), Linux Itanium, Solaris 8,9,10 and 11 x86 and SPARC using
|
2008-12-19 12:34:02 +01:00
|
|
|
gcc or SunStudio and MacOSX/x86/gcc.
|
|
|
|
|
|
|
|
The script automatically detects CPU type and operating system; The
|
|
|
|
default compiler is always gcc.
|
2008-02-08 00:12:34 +01:00
|
|
|
|
|
|
|
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
|
2011-02-20 17:51:43 +01:00
|
|
|
the specific platform you are using.
|
2008-02-08 00:12:34 +01:00
|
|
|
|
|
|
|
Using the --package option, it is also possible to build a "classic"
|
2011-02-20 17:51:43 +01:00
|
|
|
version of MariaDB having only the MyISAM storage engine, a "Pro"
|
|
|
|
package including all storage engines and other features except MariaDB
|
|
|
|
Cluster, and an "extended" package including these features plus MariaDB
|
2008-02-08 00:12:34 +01:00
|
|
|
Cluster (this is the default if the --developer option is used).
|
|
|
|
|
2011-02-20 17:51:43 +01:00
|
|
|
Different MariaDB storage engines are included in the build, depending
|
2008-02-08 00:12:34 +01:00
|
|
|
on which --package option is used. The comment and version strong
|
|
|
|
suffix are also set according to the package selected.
|
|
|
|
|
|
|
|
--package=pro
|
|
|
|
storage engines:
|
2008-12-19 12:34:02 +01:00
|
|
|
ARCHIVE, BLACKHOLE, CSV, FEDERATED, INNODB, MYISAM
|
2008-02-08 00:12:34 +01:00
|
|
|
(All storage engines except NDB)
|
2011-02-20 17:51:43 +01:00
|
|
|
comment: Pro versions
|
2008-02-08 00:12:34 +01:00
|
|
|
version string suffix: [none]
|
|
|
|
|
|
|
|
--package=classic
|
|
|
|
storage engines: CSV, MYISAM
|
2011-02-20 17:51:43 +01:00
|
|
|
comment: Version without InnoDB and Maria
|
2008-02-08 00:12:34 +01:00
|
|
|
version string suffix: [none]
|
|
|
|
|
|
|
|
All packages except Classic include support for user-defined
|
2011-01-14 09:28:23 +01:00
|
|
|
partitioning. All packages include support for Performance
|
|
|
|
Schema.
|
2008-02-08 00:12:34 +01:00
|
|
|
|
|
|
|
If --with-debug is used, an additional "-debug" is appended to the
|
|
|
|
version string.
|
|
|
|
|
|
|
|
--with-debug[=full]
|
|
|
|
This option will ensure that the version is built with debug
|
|
|
|
information enabled; the optimisation level is decreased to -O.
|
|
|
|
|
|
|
|
--developer
|
|
|
|
This option changes a number of things to make the version built
|
|
|
|
more appropriate to the debugging and testing needs of developers.
|
|
|
|
It changes the default package to "extended". It also changes the
|
|
|
|
default warning mode from "none" to "normal", which allows an
|
|
|
|
extensive list of warnings to be generated.
|
|
|
|
|
|
|
|
--error-inject
|
|
|
|
This flag is used only when the --developer option is also used, and
|
|
|
|
enables error injection in both the MySQL Server and in MySQL
|
|
|
|
Cluster data nodes.
|
|
|
|
|
|
|
|
The following is a list of the default configure options used for all
|
|
|
|
packages:
|
|
|
|
|
|
|
|
--prefix: /usr/local/mysql (can be overridden)
|
|
|
|
|
|
|
|
--libexecdir: <prefix>/bin (can be overridden)
|
|
|
|
|
|
|
|
--localstatedir: <prefix>/data, unless --datadir is used, in which
|
|
|
|
case it defaults to <datadir>/data (can be overridden by setting
|
|
|
|
--localstatedir explicitly).
|
|
|
|
|
|
|
|
--enable-local-infile: Enable use of the LOAD DATA FROM LOCAL INFILE
|
|
|
|
command (cannot be overridden).
|
|
|
|
|
|
|
|
--enable-thread-safe-client: Enable the multi-threaded mysql client
|
|
|
|
library (cannot be overridden).
|
|
|
|
|
|
|
|
--with-big-tables: Enable use of tables with more than 4G rows (cannot
|
|
|
|
be overridden).
|
|
|
|
|
|
|
|
--with-extra-charsets=all: Enable use of all character sets supported
|
|
|
|
by MySQL (cannot be overridden).
|
|
|
|
|
|
|
|
--with-ssl: Enable use of yaSSL library included in the MySQL source
|
2010-09-16 08:53:58 +02:00
|
|
|
if possible (GCC and same CC and CXX).
|
2008-02-08 00:12:34 +01:00
|
|
|
(cannot be overridden).
|
|
|
|
|
|
|
|
--with-pic: Build all binaries using position independent assembler
|
|
|
|
to avoid problems with dynamic linkers (cannot be overridden).
|
|
|
|
|
2008-12-19 12:34:02 +01:00
|
|
|
--without-example-engine: Ensure that the example engine isn't built,
|
|
|
|
it cannot do any useful things, it's merely intended as documentation.
|
2009-02-06 14:20:06 +01:00
|
|
|
(cannot be overridden)
|
2008-12-19 12:34:02 +01:00
|
|
|
|
2008-02-08 00:12:34 +01:00
|
|
|
--with-csv-storage-engine: Ensure that the CSV storage engine is
|
|
|
|
included in all builds. Since CSV is required for log tables in
|
|
|
|
MySQL 5.1, this option cannot be overridden.
|
|
|
|
|
|
|
|
(Note that MyISAM support is always built into the MySQL Server; the
|
|
|
|
server *cannot* be built without MyISAM.)
|
|
|
|
|
|
|
|
--with-mysqld-ldflags=-static
|
|
|
|
--with-client-ldflags=-static
|
|
|
|
Ensures that binaries for, respectively, the MySQL server and client
|
|
|
|
are built with static libraries except for the system libraries,
|
|
|
|
which use dynamically loaded libraries provided by the operating
|
|
|
|
system. Building with --developer sets these to all-static instead,
|
|
|
|
to build everything statically.
|
|
|
|
|
|
|
|
In addition there are some configure options that are specific to
|
|
|
|
Linux operating systems:
|
|
|
|
|
|
|
|
--enable-assembler
|
|
|
|
Include assembler code optimisations for a number of mostly string
|
|
|
|
methods. Used for x86 processors only.
|
|
|
|
|
|
|
|
Neither of the preceding options can be disabled.
|
|
|
|
|
|
|
|
MySQL Cluster Carrier Grade edition also adds the following options
|
|
|
|
(also used by the extended package):
|
|
|
|
|
|
|
|
--with-ndbcluster
|
|
|
|
Include the NDB Cluster storage engine, its kernel, management
|
|
|
|
server, and client, as well as support for the NDB and MGM APIs.
|
|
|
|
|
|
|
|
--without-ndb-debug
|
|
|
|
Do not include specific NDB debug code, not even in debug versions
|
|
|
|
(cannot be overridden).
|
|
|
|
|
|
|
|
Package-specific options:
|
|
|
|
-------------------------
|
|
|
|
--with-innodb
|
2011-02-20 17:51:43 +01:00
|
|
|
Specifically included in the "pro" package.
|
2008-02-08 00:12:34 +01:00
|
|
|
|
|
|
|
--with-comment
|
|
|
|
Sets the comment for the MySQL version, by package, as described
|
|
|
|
above.
|
|
|
|
|
|
|
|
--with-server-suffix
|
|
|
|
Sets the server suffix on the MySQL version, by package, as
|
|
|
|
described above.
|
|
|
|
|
|
|
|
Other options used:
|
|
|
|
-------------------
|
|
|
|
--with-readline
|
2011-02-20 17:51:43 +01:00
|
|
|
Use the GPL readline library for command editing functions.
|
2008-02-08 00:12:34 +01:00
|
|
|
|
|
|
|
--with-libedit
|
2011-02-20 17:51:43 +01:00
|
|
|
Use the BSD licensed library for command editing functions.
|
2008-02-08 00:12:34 +01:00
|
|
|
|
|
|
|
--with-zlib-dir=bundled
|
|
|
|
Use the zlib package bundled with MySQL.
|
|
|
|
|
|
|
|
--with-mysqld-libs=-lmtmalloc
|
|
|
|
Used on Solaris to ensure that the proper malloc library is used.
|
2008-12-19 12:34:02 +01:00
|
|
|
Investigations have shown mtmalloc to be the best choice on Solaris,
|
|
|
|
also umem has good performance on Solaris but better debugging
|
|
|
|
capabilities.
|
2008-02-08 00:12:34 +01:00
|
|
|
|
|
|
|
Compiler options:
|
|
|
|
-----------------
|
|
|
|
|
2010-09-16 08:53:58 +02:00
|
|
|
This section describes the compiler options for each of the different
|
|
|
|
platforms supported by this script.
|
2008-02-08 00:12:34 +01:00
|
|
|
|
2010-09-16 08:53:58 +02:00
|
|
|
The --fast option adds -mtune=cpu_arg to the C/C++ flags (provides
|
2010-12-01 13:38:47 +01:00
|
|
|
support for Nocona, K8, and other processors), this option is valid
|
|
|
|
when gcc is the compiler.
|
2008-02-08 00:12:34 +01:00
|
|
|
|
2010-09-16 08:53:58 +02:00
|
|
|
Use of the --debug option adds -g to the C/C++ flags.
|
2008-02-08 00:12:34 +01:00
|
|
|
|
2010-09-16 08:53:58 +02:00
|
|
|
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
|
2008-12-19 11:46:28 +01:00
|
|
|
|
2010-12-01 13:38:47 +01:00
|
|
|
Feedback profiler on gcc
|
|
|
|
------------------------
|
|
|
|
Using gcc --generate-feedback=path causes the following flags to be added
|
|
|
|
to the compiler flags.
|
|
|
|
|
|
|
|
--fprofile-generate
|
|
|
|
--fprofile-dir=path
|
|
|
|
|
|
|
|
Using gcc with --use-feedback=path causes the following flags to be added
|
|
|
|
to the compiler flags. --fprofile-correction indicates MySQL is a multi-
|
|
|
|
threaded application and thus counters can be inconsistent with each other
|
|
|
|
and the compiler should take this into account.
|
|
|
|
|
|
|
|
--fprofile-use
|
|
|
|
--fprofile-dir=path
|
|
|
|
--fprofile-correction
|
|
|
|
|
|
|
|
Feedback compilation using Open64
|
|
|
|
---------------------------------
|
|
|
|
|
|
|
|
Using Open64 with --generate-feedback=path causes the following flags to
|
|
|
|
be added to the compiler flags.
|
|
|
|
|
|
|
|
-fb-create path/feedback
|
|
|
|
|
|
|
|
Using Open64 with --use-feedback=path causes the following flags to be
|
|
|
|
added to the compiler flags.
|
|
|
|
|
|
|
|
--fb-opt path/feedback
|
2008-02-08 00:12:34 +01:00
|
|
|
|
|
|
|
Linux/x86+Itanium/gcc
|
|
|
|
-------------
|
2008-12-19 11:46:28 +01:00
|
|
|
For debug builds -O is used and otherwise -O3 is used.Discovery of a
|
2008-02-08 00:12:34 +01:00
|
|
|
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
|
|
|
|
added to the C/C++ flags. (To build a 32-bit binary on a 64-bit CPU,
|
|
|
|
use the --32 option as described previously.)
|
|
|
|
|
2010-12-01 13:38:47 +01:00
|
|
|
When gcc 4.5 is used and the user set --with-link-time-optimizer then
|
|
|
|
also --flto is added to compiler flags and linker flags.
|
|
|
|
|
2008-02-08 00:12:34 +01:00
|
|
|
Linux/x86+Itanium/icc
|
|
|
|
-------------
|
|
|
|
Flags used:
|
2008-12-19 11:46:28 +01:00
|
|
|
CC = icc -static-libgcc -static-intel
|
|
|
|
C++ = icpc -static-libgcc -static-intel
|
2008-02-08 00:12:34 +01:00
|
|
|
C/C++ flags = -mp -restrict
|
|
|
|
|
2008-12-19 11:46:28 +01:00
|
|
|
On Itanium we also add -no-ftz and to CC and C++ flags.
|
2008-02-08 00:12:34 +01:00
|
|
|
|
2010-09-16 08:53:58 +02:00
|
|
|
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.
|
2008-02-08 00:12:34 +01:00
|
|
|
|
2010-09-16 08:53:58 +02:00
|
|
|
The non-debug versions also add the following:
|
|
|
|
C/C++ flags += -O3 unroll2 -ip
|
2008-02-08 00:12:34 +01:00
|
|
|
|
2010-09-16 08:53:58 +02:00
|
|
|
The fast version adds (if --with-link-time-optimizer is used):
|
|
|
|
C/C++ flags += -ipo
|
|
|
|
|
|
|
|
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.
|
2008-02-08 00:12:34 +01:00
|
|
|
|
2010-12-01 13:38:47 +01:00
|
|
|
Linux/x86/Open64
|
|
|
|
----------------
|
|
|
|
For normal builds use -O3, when fast flag is set one also adds
|
|
|
|
--march=auto to generate optimized builds for the CPU used. If
|
|
|
|
--with-link-time-optimizer is set also -ipa is set. There is also
|
|
|
|
a special flag --with-mso which can be set to get --mso set which
|
|
|
|
activates optimisation for multi-core scalability.
|
|
|
|
|
|
|
|
FreeBSD/x86/gcc
|
|
|
|
---------------
|
|
|
|
No flags are used. Instead, configure determines the proper flags to
|
|
|
|
use.
|
|
|
|
|
2008-02-08 00:12:34 +01:00
|
|
|
Solaris/x86/gcc
|
|
|
|
---------------
|
2008-12-19 11:46:28 +01:00
|
|
|
All builds on Solaris are by default 64-bit, so -m64 is always used in
|
2009-02-06 14:20:06 +01:00
|
|
|
the C/C++ flags. LDFLAGS is set to -m64 -O/-O2/-O3. If for
|
2008-12-19 11:46:28 +01:00
|
|
|
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.
|
2008-02-08 00:12:34 +01:00
|
|
|
|
2009-02-06 14:20:06 +01:00
|
|
|
Sets -m64 (default) or -m32 (if specifically set) in LDFLAGS and
|
|
|
|
C/C++ flags.
|
|
|
|
|
2008-02-08 00:12:34 +01:00
|
|
|
Solaris/Sparc/Forte
|
|
|
|
-------------------
|
2009-02-06 14:20:06 +01:00
|
|
|
Uses cc as CC and CC as CXX
|
2008-12-19 12:34:02 +01:00
|
|
|
Note that SunStudio uses different binaries for C and C++ compilers.
|
|
|
|
|
2008-12-19 11:46:28 +01:00
|
|
|
Set -m64 (default) or -m32 (if specifically set) in ASFLAGS,
|
|
|
|
LDFLAGS and C/C++ flags.
|
2009-02-06 14:20:06 +01:00
|
|
|
|
|
|
|
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.
|
|
|
|
|
2010-09-16 08:53:58 +02:00
|
|
|
C flags = -xstrconst This flag is set only on SPARC
|
2008-02-08 00:12:34 +01:00
|
|
|
C++ flags = -noex
|
|
|
|
|
2009-02-06 14:20:06 +01:00
|
|
|
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
|
2010-09-16 08:53:58 +02:00
|
|
|
-features=no%except This flag is set only on x86
|
2009-02-06 14:20:06 +01:00
|
|
|
|
2010-09-16 08:53:58 +02:00
|
|
|
When compiling with fast we set (-ipo only used if we have
|
|
|
|
set --with-link-time-optimizer):
|
2009-02-06 14:20:06 +01:00
|
|
|
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
|
2010-09-16 08:53:58 +02:00
|
|
|
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
|
2008-02-08 00:12:34 +01:00
|
|
|
|
2009-02-06 14:20:06 +01:00
|
|
|
The optimisation level is
|
|
|
|
-xO Debug builds
|
|
|
|
-xO2 Production build on SPARC
|
|
|
|
-xO3 Production build on x86
|
|
|
|
-xO4 Fast builds on SPARC/x86
|
2008-02-08 00:12:34 +01:00
|
|
|
|
|
|
|
MacOSX/x86/gcc
|
|
|
|
--------------
|
2010-09-16 08:53:58 +02:00
|
|
|
C/C++ flags include -fno-common -arch i386.
|
|
|
|
When 64-bits builds then i386 is replaced by x86_64.
|
2008-02-08 00:12:34 +01:00
|
|
|
|
2010-09-16 08:53:58 +02:00
|
|
|
Non-debug versions also add -Os -felide-constructors, where "-Os"
|
|
|
|
means the build is space-optimised as long as the space optimisations
|
|
|
|
do not negatively affect performance. Debug versions use -O.
|
2008-12-19 11:46:28 +01:00
|
|
|
|
2010-09-16 08:53:58 +02:00
|
|
|
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.
|
2008-02-08 00:12:34 +01:00
|
|
|
EOF
|
|
|
|
}
|
2010-09-16 08:53:58 +02:00
|
|
|
|
2008-02-08 00:12:34 +01:00
|
|
|
with_usage()
|
|
|
|
{
|
|
|
|
cat <<EOF
|
|
|
|
|
|
|
|
To obtain extended help on the --with-* options available, run this
|
|
|
|
script with --configure-only to create a configuration file. Then
|
|
|
|
issue the command ./configure --help to get an extensive list of
|
|
|
|
possible configure options.
|
|
|
|
|
|
|
|
The remainder of this text focuses on those options which are useful
|
|
|
|
in building binaries for MySQL Cluster Carrier Grade Edition.
|
|
|
|
|
|
|
|
--with-ndb-sci=/opt/DIS
|
|
|
|
Used to build a MySQL Cluster Carrier Grade Edition that can use the
|
|
|
|
SCI Transporter. The Dolphin SCI installation must be completed
|
|
|
|
first (see
|
|
|
|
http://dev.mysql.com/doc/refman/5.1/en/mysql-cluster-interconnects.html
|
|
|
|
for more information).
|
|
|
|
|
|
|
|
--with-ndb-test
|
|
|
|
Compile the MySQL Cluster test programs.
|
|
|
|
|
|
|
|
--with-ndb-port=PORT
|
|
|
|
Change the default port for the MySQL Cluster management server.
|
|
|
|
|
|
|
|
--with-ndb-port-base=PORT
|
|
|
|
Change the default port base for MySQL Cluster data nodes.
|
|
|
|
|
|
|
|
--without-query-cache
|
|
|
|
Build the MySQL Server without the query cache, which is often not
|
|
|
|
of value in MySQL Cluster applications.
|
|
|
|
|
|
|
|
--with-atomic-ops=rwlocks|smp|up
|
|
|
|
Implement atomic operations using pthread
|
|
|
|
rwlocks or atomic CPU instructions for
|
|
|
|
multi-processor (default) or single-processor
|
|
|
|
configurations.
|
|
|
|
|
|
|
|
--without-geometry Do not build geometry-related portions of the
|
|
|
|
MySQL Server. Seldom used in MySQL Cluster
|
|
|
|
applications.
|
|
|
|
|
|
|
|
--with-ndb-cc-flags=FLAGS
|
|
|
|
This option can be used to build MySQL Cluster with error injection
|
|
|
|
on the data nodes. It can be used to pass special options to
|
|
|
|
programs in the NDB kernel for special test builds.
|
|
|
|
The option for enabling data node error injection is -DERROR_INSERT.
|
|
|
|
EOF
|
|
|
|
}
|
|
|
|
|
|
|
|
parse_package()
|
|
|
|
{
|
|
|
|
case "$package" in
|
|
|
|
classic )
|
|
|
|
package="classic"
|
|
|
|
;;
|
|
|
|
pro )
|
|
|
|
package="pro"
|
|
|
|
;;
|
|
|
|
extended )
|
2009-09-10 11:15:39 +02:00
|
|
|
package="extended"
|
2008-02-08 00:12:34 +01:00
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "Unknown package '$package'"
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
|
|
|
parse_warning_mode()
|
|
|
|
{
|
|
|
|
case "$warning_mode" in
|
|
|
|
pedantic )
|
|
|
|
warning_mode="pedantic"
|
|
|
|
;;
|
|
|
|
extra_warnings | extra-warnings | extra )
|
|
|
|
warning_mode="extra"
|
|
|
|
;;
|
|
|
|
no )
|
|
|
|
warning_mode=
|
|
|
|
;;
|
|
|
|
normal )
|
|
|
|
warning_mode="normal"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "Unknown warning mode '$warning_mode'"
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# We currently only support x86, Itanium and UltraSparc processors.
|
|
|
|
#
|
|
|
|
parse_cpu_type()
|
|
|
|
{
|
|
|
|
case "$cpu_type" in
|
|
|
|
x86 )
|
|
|
|
cpu_type="x86"
|
2010-09-16 08:53:58 +02:00
|
|
|
if test "x$m64" = "x" ; then
|
2009-02-21 11:03:49 +01:00
|
|
|
m64="no"
|
|
|
|
fi
|
2008-02-08 00:12:34 +01:00
|
|
|
;;
|
|
|
|
x86_64 )
|
|
|
|
cpu_type="x86"
|
2010-09-16 08:53:58 +02:00
|
|
|
if test "x$m64" = "x" ; then
|
2009-02-21 11:03:49 +01:00
|
|
|
m64="yes"
|
|
|
|
fi
|
2008-02-08 00:12:34 +01:00
|
|
|
;;
|
|
|
|
itanium )
|
|
|
|
cpu_type="itanium"
|
|
|
|
;;
|
|
|
|
sparc )
|
|
|
|
cpu_type="sparc"
|
|
|
|
;;
|
|
|
|
* )
|
|
|
|
echo "Unknown CPU type $cpu_type"
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# We currently only support gcc, icc and Forte.
|
|
|
|
#
|
|
|
|
parse_compiler()
|
|
|
|
{
|
|
|
|
case "$compiler" in
|
|
|
|
gcc )
|
|
|
|
compiler="gcc"
|
|
|
|
;;
|
|
|
|
icc )
|
|
|
|
compiler="icc"
|
|
|
|
;;
|
2010-09-16 08:53:58 +02:00
|
|
|
forte | SunStudio | sunstudio )
|
2008-12-19 12:34:02 +01:00
|
|
|
compiler="forte"
|
|
|
|
;;
|
2010-12-01 13:38:47 +01:00
|
|
|
open64 | Open64 )
|
|
|
|
compiler="open64"
|
|
|
|
;;
|
2008-02-08 00:12:34 +01:00
|
|
|
*)
|
|
|
|
echo "Unknown compiler '$compiler'"
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
|
|
|
parse_options()
|
|
|
|
{
|
|
|
|
while test $# -gt 0
|
|
|
|
do
|
|
|
|
case "$1" in
|
|
|
|
--prefix=*)
|
|
|
|
prefix=`get_key_value "$1"`
|
|
|
|
;;
|
|
|
|
--datadir=*)
|
|
|
|
datadir=`get_key_value "$1"`
|
|
|
|
;;
|
2010-09-16 08:53:58 +02:00
|
|
|
--with-link-time-optimizer)
|
|
|
|
with_link_time_optimizer="yes"
|
|
|
|
;;
|
2008-02-08 00:12:34 +01:00
|
|
|
--without-debug)
|
|
|
|
with_debug_flag="no"
|
|
|
|
if test "x$fast_flag" != "xyes" ; then
|
|
|
|
fast_flag="generic"
|
|
|
|
fi
|
|
|
|
;;
|
2010-09-16 08:53:58 +02:00
|
|
|
--use-comment)
|
|
|
|
without_comment="no"
|
|
|
|
;;
|
|
|
|
--with-fast-mutexes)
|
|
|
|
with_fast_mutexes="yes"
|
|
|
|
;;
|
2010-12-01 13:38:47 +01:00
|
|
|
--without-fast-mutexes)
|
|
|
|
with_fast_mutexes="no"
|
|
|
|
;;
|
|
|
|
--without-perfschema)
|
|
|
|
with_perfschema="no"
|
|
|
|
;;
|
|
|
|
--with-mso)
|
|
|
|
with_mso="yes"
|
|
|
|
;;
|
2008-12-20 15:46:31 +01:00
|
|
|
--use-tcmalloc)
|
|
|
|
use_tcmalloc="yes"
|
|
|
|
;;
|
2008-02-08 00:12:34 +01:00
|
|
|
--with-debug)
|
|
|
|
with_debug_flag="yes"
|
|
|
|
fast_flag="no"
|
|
|
|
;;
|
2010-12-01 13:38:47 +01:00
|
|
|
--extra-debug-flag)
|
|
|
|
shift
|
|
|
|
extra_debug_flags="$extra_debug_flags -D$1"
|
|
|
|
;;
|
2008-02-08 00:12:34 +01:00
|
|
|
--debug)
|
|
|
|
compile_debug_flag="yes"
|
|
|
|
;;
|
|
|
|
--no-developer)
|
|
|
|
developer_flag="no"
|
|
|
|
;;
|
|
|
|
--developer)
|
|
|
|
developer_flag="yes"
|
|
|
|
;;
|
|
|
|
--compiler=*)
|
|
|
|
compiler=`get_key_value "$1"`
|
|
|
|
parse_compiler
|
|
|
|
;;
|
2010-12-01 13:38:47 +01:00
|
|
|
--generate-feedback)
|
|
|
|
shift
|
|
|
|
GENERATE_FEEDBACK_PATH="$1"
|
|
|
|
;;
|
|
|
|
--use-feedback)
|
|
|
|
shift
|
|
|
|
USE_FEEDBACK_PATH="$1"
|
|
|
|
;;
|
2008-02-08 00:12:34 +01:00
|
|
|
--cpu=*)
|
|
|
|
cpu_type=`get_key_value "$1"`
|
|
|
|
parse_cpu_type
|
|
|
|
;;
|
|
|
|
--warning-mode=*)
|
|
|
|
warning_mode=`get_key_value "$1"`
|
|
|
|
parse_warning_mode
|
|
|
|
;;
|
|
|
|
--warnings)
|
|
|
|
warning_mode="normal"
|
|
|
|
;;
|
|
|
|
--32)
|
2009-02-21 11:03:49 +01:00
|
|
|
if test "x$explicit_size_set" != "x" ; then
|
2008-02-08 00:12:34 +01:00
|
|
|
echo "Cannot set both --32 and --64"
|
|
|
|
exit 1
|
|
|
|
fi
|
2009-02-21 11:03:49 +01:00
|
|
|
explicit_size_set="yes"
|
2009-02-06 14:20:06 +01:00
|
|
|
m64="no"
|
2008-02-08 00:12:34 +01:00
|
|
|
;;
|
|
|
|
--64)
|
2009-02-21 11:03:49 +01:00
|
|
|
if test "x$explicit_size_set" != "x" ; then
|
2008-02-08 00:12:34 +01:00
|
|
|
echo "Cannot set both --32 and --64"
|
|
|
|
exit 1
|
|
|
|
fi
|
2009-02-21 11:03:49 +01:00
|
|
|
explicit_size_set="yes"
|
2008-02-08 00:12:34 +01:00
|
|
|
m64="yes"
|
|
|
|
;;
|
|
|
|
--package=*)
|
|
|
|
package=`get_key_value "$1"`
|
|
|
|
parse_package
|
|
|
|
;;
|
|
|
|
--parallelism=*)
|
|
|
|
parallelism=`get_key_value "$1"`
|
|
|
|
;;
|
|
|
|
--configure-only)
|
|
|
|
just_configure="yes"
|
|
|
|
;;
|
2011-02-20 17:51:43 +01:00
|
|
|
--print-only|--just-print)
|
2008-02-08 00:12:34 +01:00
|
|
|
just_print="yes"
|
|
|
|
;;
|
|
|
|
--static-linking)
|
|
|
|
static_linking_flag="yes"
|
|
|
|
;;
|
|
|
|
--strip)
|
|
|
|
strip_flag="yes"
|
|
|
|
;;
|
|
|
|
--error-inject)
|
|
|
|
error_inject_flag="yes"
|
|
|
|
;;
|
|
|
|
--valgrind)
|
|
|
|
valgrind="yes"
|
|
|
|
;;
|
|
|
|
--fast)
|
|
|
|
fast_flag="yes"
|
|
|
|
;;
|
|
|
|
--with-flags)
|
|
|
|
shift
|
|
|
|
break
|
|
|
|
;;
|
|
|
|
--with-help)
|
|
|
|
with_usage
|
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
--sysadmin-help)
|
|
|
|
sysadmin_usage
|
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
--developer-help)
|
|
|
|
developer_usage
|
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
--extended-help)
|
|
|
|
extended_usage
|
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
--help)
|
|
|
|
usage
|
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "Unknown option '$1'"
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
for flag in $@
|
|
|
|
do
|
|
|
|
with_flags="$with_flags $flag"
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# We currently only support Linux, FreeBSD/OpenBSD, Mac OS X and Solaris
|
|
|
|
#
|
|
|
|
check_os()
|
|
|
|
{
|
|
|
|
case "`uname -s`" in
|
|
|
|
Linux)
|
|
|
|
os="linux"
|
|
|
|
;;
|
|
|
|
FreeBSD|OpenBSD)
|
|
|
|
os="bsd"
|
|
|
|
;;
|
|
|
|
Darwin)
|
|
|
|
os="MacOSX"
|
|
|
|
;;
|
|
|
|
SunOS)
|
|
|
|
os="Solaris"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
os="Unknown"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
set_cpu_base()
|
|
|
|
{
|
|
|
|
if test "x$cpu_type" = "x" ; then
|
|
|
|
if test "x$cpu_arg" = "x" ; then
|
|
|
|
usage "CPU type not discovered, cannot proceed"
|
2009-02-06 14:20:06 +01:00
|
|
|
exit 1
|
2008-02-08 00:12:34 +01:00
|
|
|
fi
|
|
|
|
case "$cpu_arg" in
|
|
|
|
core2 | nocona | prescott | pentium* | i*86 )
|
2010-09-16 08:53:58 +02:00
|
|
|
# Intel CPU
|
2008-02-08 00:12:34 +01:00
|
|
|
cpu_base_type="x86"
|
|
|
|
;;
|
2010-09-16 08:53:58 +02:00
|
|
|
athlon* | opteron* | k6 | k8 )
|
|
|
|
# AMD CPU
|
2008-02-08 00:12:34 +01:00
|
|
|
cpu_base_type="x86"
|
|
|
|
;;
|
|
|
|
sparc )
|
|
|
|
cpu_base_type="sparc"
|
|
|
|
;;
|
|
|
|
itanium )
|
|
|
|
cpu_base_type="itanium"
|
|
|
|
;;
|
|
|
|
* )
|
|
|
|
usage "CPU type $cpu_arg not handled by this script"
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
else
|
|
|
|
cpu_base_type="$cpu_type"
|
|
|
|
check_cpu_cflags=""
|
|
|
|
fi
|
|
|
|
if test "x$os" = "xMacOSX" ; then
|
2009-02-06 14:20:06 +01:00
|
|
|
if test "x$m64" = "x" ; then
|
2008-12-19 11:46:28 +01:00
|
|
|
m64="no"
|
|
|
|
fi
|
2008-02-08 00:12:34 +01:00
|
|
|
elif test "x$os" = "xSolaris" ; then
|
2009-02-06 14:20:06 +01:00
|
|
|
if test "x$m64" = "x" ; then
|
2008-12-19 11:46:28 +01:00
|
|
|
m64="yes"
|
|
|
|
fi
|
2009-02-06 14:20:06 +01:00
|
|
|
elif test "x$m64" = "x" ; then
|
2008-02-08 00:12:34 +01:00
|
|
|
if test "x$cpu_arg" = "xnocona" || test "x$cpu_arg" = "xcore2" || \
|
|
|
|
test "x$cpu_arg" = "xathlon64" || test "x$cpu_arg" = "xopteron" ; then
|
|
|
|
m64="yes"
|
2009-02-06 14:20:06 +01:00
|
|
|
else
|
2008-02-08 00:12:34 +01:00
|
|
|
m64="no"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
echo "Discovered CPU of type $cpu_base_type ($cpu_arg) on $os"
|
|
|
|
if test "x$m64" = "xyes" ; then
|
|
|
|
echo "Will compile 64-bit binaries"
|
2008-12-19 11:46:28 +01:00
|
|
|
else
|
2009-02-06 14:20:06 +01:00
|
|
|
echo "Will compile 32-bit binaries"
|
2008-02-08 00:12:34 +01:00
|
|
|
fi
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# Add to the variable commands with the configure command
|
|
|
|
#
|
|
|
|
init_configure_commands()
|
|
|
|
{
|
2010-12-01 13:38:47 +01:00
|
|
|
path=`dirname $0`
|
|
|
|
cp $path/cmake_configure.sh $path/../configure
|
|
|
|
chmod +x $path/../configure
|
2008-02-08 00:12:34 +01:00
|
|
|
cflags="$c_warnings $base_cflags $compiler_flags"
|
|
|
|
cxxflags="$cxx_warnings $base_cxxflags $compiler_flags"
|
|
|
|
configure="./configure $base_configs $with_flags"
|
|
|
|
|
2010-09-16 08:53:58 +02:00
|
|
|
env_flags="CC=\"$CC\" CFLAGS=\"$cflags\" CXX=\"$CXX\" CXXFLAGS=\"$cxxflags\""
|
2008-02-08 00:12:34 +01:00
|
|
|
if test "x$LDFLAGS" != "x" ; then
|
2010-09-16 08:53:58 +02:00
|
|
|
env_flags="$env_flags LDFLAGS=\"$LDFLAGS\""
|
2008-02-08 00:12:34 +01:00
|
|
|
fi
|
|
|
|
if test "x$ASFLAGS" != "x" ; then
|
2010-09-16 08:53:58 +02:00
|
|
|
env_flags="$env_flags ASFLAGS=\"$ASFLAGS\""
|
2008-02-08 00:12:34 +01:00
|
|
|
fi
|
|
|
|
commands="$commands
|
2010-09-16 08:53:58 +02:00
|
|
|
$env_flags $configure"
|
2008-02-08 00:12:34 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# Initialise the variable commands with the commands needed to generate
|
|
|
|
# the configure script.
|
|
|
|
#
|
|
|
|
init_auto_commands()
|
|
|
|
{
|
|
|
|
set_libtoolize_version
|
|
|
|
commands="\
|
|
|
|
$make -k maintainer-clean || true
|
|
|
|
/bin/rm -rf */.deps/*.P configure config.cache
|
|
|
|
/bin/rm -rf storage/*/configure storage/*/config.cache autom4te.cache
|
|
|
|
/bin/rm -rf storage/*/autom4te.cache;"
|
|
|
|
#
|
|
|
|
# --add-missing instructs automake to install missing auxiliary files
|
|
|
|
# and --force to overwrite them if they already exist
|
|
|
|
#
|
|
|
|
commands="$commands
|
|
|
|
aclocal || die \"Can't execute aclocal\"
|
|
|
|
autoheader || die \"Can't execute autoheader\"
|
|
|
|
$LIBTOOLIZE --automake --copy --force || die \"Can't execute libtoolize\"
|
|
|
|
automake --add-missing --copy --force || die \"Can't execute automake\"
|
|
|
|
autoconf || die \"Can't execute autoconf\""
|
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# Add to the variable commands the make command and possibly also
|
|
|
|
# strip commands
|
|
|
|
#
|
|
|
|
add_make_commands()
|
|
|
|
{
|
|
|
|
AM_MAKEFLAGS="-j $parallelism"
|
|
|
|
commands="$commands
|
|
|
|
$make $AM_MAKEFLAGS"
|
|
|
|
|
|
|
|
if test "x$strip_flag" = "xyes" ; then
|
|
|
|
commands="$commands
|
|
|
|
mkdir -p tmp
|
|
|
|
nm --numeric-sort sql/mysqld > tmp/mysqld.sym
|
|
|
|
objdump -d sql/mysqld > tmp/mysqld.S
|
|
|
|
strip sql/mysqld
|
|
|
|
strip storage/ndb/src/kernel/ndbd
|
|
|
|
strip storage/ndb/src/mgmsrv/ndb_mgmd
|
|
|
|
strip storage/ndb/src/mgmclient/ndb_mgm"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# Set make version, but only gmake is supported :)
|
|
|
|
#
|
|
|
|
set_make_version()
|
|
|
|
{
|
|
|
|
if gmake --version > /dev/null 2>&1
|
|
|
|
then
|
|
|
|
make=gmake
|
|
|
|
else
|
|
|
|
make=make
|
|
|
|
fi
|
|
|
|
if test "x`$make --version | grep GNU`" = "x" ; then
|
|
|
|
die "Only gmake is supported"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# Find a libtoolize binary, both libtoolize and glibtoolize are
|
|
|
|
# ok, use first found.
|
|
|
|
#
|
|
|
|
set_libtoolize_version()
|
|
|
|
{
|
|
|
|
LIBTOOLIZE=not_found
|
|
|
|
save_ifs="$IFS"; IFS=':'
|
|
|
|
for dir in $PATH
|
|
|
|
do
|
|
|
|
if test -x $dir/libtoolize
|
|
|
|
then
|
|
|
|
LIBTOOLIZE=libtoolize
|
|
|
|
echo "Found libtoolize in $dir"
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
if test -x $dir/glibtoolize
|
|
|
|
then
|
|
|
|
LIBTOOLIZE=glibtoolize
|
|
|
|
echo "Found glibtoolize in $dir"
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
IFS="$save_ifs"
|
|
|
|
if test "x$LIBTOOLIZE" = "xnot_found" ; then
|
|
|
|
die "Found no libtoolize version, quitting here"
|
|
|
|
fi
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# If ccache (a compiler cache which reduces build time)
|
|
|
|
# (http://samba.org/ccache) is installed, use it.
|
|
|
|
# We use 'grep' and hope that 'grep' works as expected
|
|
|
|
# (returns 0 if finds lines)
|
|
|
|
# We do not use ccache when gcov is used. Also only when
|
|
|
|
# gcc is used.
|
|
|
|
#
|
2008-12-19 11:46:28 +01:00
|
|
|
set_ccache_usage()
|
2008-02-08 00:12:34 +01:00
|
|
|
{
|
|
|
|
if test "x$compiler" = "xgcc" ; then
|
|
|
|
if ccache -V > /dev/null 2>&1 && test "$USING_GCOV" != "1"
|
|
|
|
then
|
|
|
|
echo "$CC" | grep "ccache" > /dev/null || CC="ccache $CC"
|
|
|
|
echo "$CXX" | grep "ccache" > /dev/null || CXX="ccache $CXX"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# Set flags for various build configurations.
|
|
|
|
# Used in -valgrind builds
|
|
|
|
#
|
|
|
|
set_valgrind_flags()
|
|
|
|
{
|
|
|
|
if test "x$valgrind_flag" = "xyes" ; then
|
Bug#34043: Server loops excessively in _checkchunk() when safemalloc is enabled
Essentially, the problem is that safemalloc is excruciatingly
slow as it checks all allocated blocks for overrun at each
memory management primitive, yielding a almost exponential
slowdown for the memory management functions (malloc, realloc,
free). The overrun check basically consists of verifying some
bytes of a block for certain magic keys, which catches some
simple forms of overrun. Another minor problem is violation
of aliasing rules and that its own internal list of blocks
is prone to corruption.
Another issue with safemalloc is rather the maintenance cost
as the tool has a significant impact on the server code.
Given the magnitude of memory debuggers available nowadays,
especially those that are provided with the platform malloc
implementation, maintenance of a in-house and largely obsolete
memory debugger becomes a burden that is not worth the effort
due to its slowness and lack of support for detecting more
common forms of heap corruption.
Since there are third-party tools that can provide the same
functionality at a lower or comparable performance cost, the
solution is to simply remove safemalloc. Third-party tools
can provide the same functionality at a lower or comparable
performance cost.
The removal of safemalloc also allows a simplification of the
malloc wrappers, removing quite a bit of kludge: redefinition
of my_malloc, my_free and the removal of the unused second
argument of my_free. Since free() always check whether the
supplied pointer is null, redudant checks are also removed.
Also, this patch adds unit testing for my_malloc and moves
my_realloc implementation into the same file as the other
memory allocation primitives.
client/mysqldump.c:
Pass my_free directly as its signature is compatible with the
callback type -- which wasn't the case for free_table_ent.
2010-07-08 23:20:08 +02:00
|
|
|
loc_valgrind_flags="-UFORCE_INIT_OF_VARS -DHAVE_purify "
|
2008-02-08 00:12:34 +01:00
|
|
|
loc_valgrind_flags="$loc_valgrind_flags -DMYSQL_SERVER_SUFFIX=-valgrind-max"
|
|
|
|
compiler_flags="$compiler_flags $loc_valgrind_flags"
|
2010-05-20 13:43:06 +02:00
|
|
|
with_flags="$with_flags --with-valgrind"
|
2008-02-08 00:12:34 +01:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# Set up warnings; default is to use no warnings, but if warning_mode
|
|
|
|
# is used a lot of warning flags are set up. These flags are valid only
|
|
|
|
# for gcc, so for other compilers we ignore the warning_mode.
|
|
|
|
#
|
|
|
|
set_warning_flags()
|
|
|
|
{
|
|
|
|
if test "x$developer_flag" = "xyes" && test "x$warning_mode" = "x" ; then
|
|
|
|
warning_mode="normal"
|
|
|
|
fi
|
|
|
|
if test "x$compiler" = "xgcc" ; then
|
|
|
|
if test "x$warning_mode" = "normal" || test "x$warning_mode" = "extra" ; then
|
|
|
|
# Both C and C++ warnings
|
|
|
|
warnings="$warnings -Wimplicit -Wreturn-type -Wswitch -Wtrigraphs"
|
|
|
|
warnings="$warnings -Wcomment -W"
|
|
|
|
warnings="$warnings -Wchar-subscripts -Wformat -Wparentheses -Wsign-compare"
|
|
|
|
warnings="$warnings -Wwrite-strings -Wunused-function -Wunused-label"
|
2011-01-26 14:17:46 +01:00
|
|
|
warnings="$warnings -Wunused-value -Wunused-variable -Wno-uninitialized"
|
2008-02-08 00:12:34 +01:00
|
|
|
|
|
|
|
if test "x$warning_mode" = "extra" ; then
|
|
|
|
warnings="$warnings -Wshadow"
|
|
|
|
fi
|
|
|
|
# C warnings
|
|
|
|
c_warnings="$warnings -Wunused-parameter"
|
|
|
|
# C++ warnings
|
|
|
|
cxx_warnings="$warnings -Woverloaded-virtual -Wsign-promo -Wreorder"
|
|
|
|
cxx_warnings="$warnings -Wctor-dtor-privacy -Wnon-virtual-dtor"
|
2010-08-06 14:59:38 +02:00
|
|
|
compiler_flags="$compiler_flags -Wuninitialized"
|
2008-02-08 00:12:34 +01:00
|
|
|
elif test "x$warning_mode" = "xpedantic" ; then
|
|
|
|
warnings="-W -Wall -ansi -pedantic -Wno-long-long -D_POSIX_SOURCE"
|
|
|
|
c_warnings="$warnings"
|
|
|
|
cxx_warnings="$warnings -std=c++98"
|
|
|
|
# Reset CPU flags (-mtune), they don't work in -pedantic mode
|
|
|
|
check_cpu_cflags=""
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# Used in -debug builds
|
|
|
|
#
|
|
|
|
set_with_debug_flags()
|
|
|
|
{
|
|
|
|
if test "x$with_debug_flag" = "xyes" ; then
|
|
|
|
if test "x$developer_flag" = "xyes" ; then
|
2011-01-26 14:17:46 +01:00
|
|
|
loc_debug_flags="-DUNIV_MUST_NOT_INLINE -DEXTRA_DEBUG"
|
|
|
|
loc_debug_flags="$loc_debug_flags -Wuninitialized -DFORCE_INIT_OF_VARS"
|
2011-10-19 21:45:18 +02:00
|
|
|
loc_debug_flags="$loc_debug_flags -DSAFEMALLOC"
|
2008-02-08 00:12:34 +01:00
|
|
|
compiler_flags="$compiler_flags $loc_debug_flags"
|
|
|
|
fi
|
2010-12-01 13:38:47 +01:00
|
|
|
compiler_flags="$compiler_flags $extra_debug_flags"
|
2008-02-08 00:12:34 +01:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# Flag for optimizing builds for developers.
|
|
|
|
#
|
|
|
|
set_no_omit_frame_pointer_for_developers()
|
|
|
|
{
|
|
|
|
if test "x$fast_flag" != "xno" ; then
|
|
|
|
if test "x$developer_flag" = "xyes" && test "x$compiler" = "xgcc" ; then
|
|
|
|
# Be as fast as we can be without losing our ability to backtrace.
|
|
|
|
compiler_flags="$compiler_flags -fno-omit-frame-pointer"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# Add -g to all builds that requested debug information in build
|
|
|
|
#
|
|
|
|
set_debug_flag()
|
|
|
|
{
|
2010-12-01 13:38:47 +01:00
|
|
|
if test "x$compile_debug_flag" = "xyes" ; then
|
2008-02-08 00:12:34 +01:00
|
|
|
compiler_flags="$compiler_flags -g"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2010-09-16 08:53:58 +02:00
|
|
|
#
|
|
|
|
# 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
|
|
|
|
}
|
|
|
|
|
2008-02-08 00:12:34 +01:00
|
|
|
#
|
|
|
|
# Base options used by all packages
|
|
|
|
#
|
|
|
|
# SSL library to use. --with-ssl selects the bundled yaSSL
|
|
|
|
# implementation of SSL. To use openSSL, you must point out the location
|
|
|
|
# of the openSSL headers and libs on your system.
|
|
|
|
# For example: --with-ssl=/usr
|
|
|
|
#
|
|
|
|
set_base_configs()
|
|
|
|
{
|
|
|
|
base_configs="$base_configs --prefix=$prefix"
|
|
|
|
base_configs="$base_configs --libexecdir=$prefix/bin"
|
|
|
|
base_configs="$base_configs --with-zlib-dir=bundled"
|
|
|
|
if test "x$datadir" = "x" ; then
|
|
|
|
base_configs="$base_configs --localstatedir=$prefix/data"
|
|
|
|
else
|
|
|
|
base_configs="$base_configs --localstatedir=$datadir"
|
|
|
|
fi
|
|
|
|
if test "x$with_debug_flag" = "xyes" ; then
|
2010-08-06 14:59:38 +02:00
|
|
|
base_configs="$base_configs --with-debug"
|
2008-02-08 00:12:34 +01:00
|
|
|
fi
|
|
|
|
base_configs="$base_configs --enable-local-infile"
|
|
|
|
base_configs="$base_configs --enable-thread-safe-client"
|
|
|
|
base_configs="$base_configs --with-big-tables"
|
|
|
|
base_configs="$base_configs --with-extra-charsets=all"
|
2010-09-16 08:53:58 +02:00
|
|
|
if test "x$with_fast_mutexes" = "xyes" ; then
|
|
|
|
base_configs="$base_configs --with-fast-mutexes"
|
|
|
|
fi
|
2008-02-08 00:12:34 +01:00
|
|
|
base_configs="$base_configs --with-pic"
|
|
|
|
base_configs="$base_configs --with-csv-storage-engine"
|
2010-12-01 13:38:47 +01:00
|
|
|
if test "x$with_perfschema" != "xno" ; then
|
|
|
|
base_configs="$base_configs --with-perfschema"
|
|
|
|
fi
|
2011-02-20 17:51:43 +01:00
|
|
|
base_configs="$base_configs --with-libevent"
|
2008-02-08 00:12:34 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#
|
2011-02-20 17:51:43 +01:00
|
|
|
# Add all standard engines and partitioning
|
2008-02-08 00:12:34 +01:00
|
|
|
#
|
2011-02-20 17:51:43 +01:00
|
|
|
set_max_engines()
|
2008-02-08 00:12:34 +01:00
|
|
|
{
|
2011-02-20 17:51:43 +01:00
|
|
|
engine_configs="--with-plugins=max --with-plugin-maria --with-maria-tmp-tables"
|
|
|
|
engine_configs="$engine_configs --without-plugin-innodb_plugin"
|
2008-12-19 11:46:28 +01:00
|
|
|
base_configs="$base_configs $engine_configs"
|
2008-02-08 00:12:34 +01:00
|
|
|
}
|
|
|
|
|
2008-12-19 11:46:28 +01:00
|
|
|
set_ndb_engine()
|
|
|
|
{
|
|
|
|
base_configs="$base_configs --with-ndbcluster"
|
|
|
|
base_configs="$base_configs --without-ndb-debug"
|
|
|
|
}
|
|
|
|
|
|
|
|
set_pro_package()
|
|
|
|
{
|
2010-09-16 08:53:58 +02:00
|
|
|
if test "x$without_comment" != "xyes" ; then
|
2011-02-20 17:51:43 +01:00
|
|
|
base_configs="$base_configs --with-comment=\"Pro $version_text built from source\""
|
2010-09-16 08:53:58 +02:00
|
|
|
fi
|
2008-02-08 00:12:34 +01:00
|
|
|
if test "x$with_debug_flag" = "xyes" ; then
|
|
|
|
base_configs="$base_configs --with-server-suffix=\"-debug\""
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
set_classic_package()
|
|
|
|
{
|
2010-09-16 08:53:58 +02:00
|
|
|
if test "x$without_comment" != "xyes" ; then
|
2011-02-20 17:51:43 +01:00
|
|
|
base_configs="$base_configs --with-comment=\"Classic $version_text built from source\""
|
2010-09-16 08:53:58 +02:00
|
|
|
fi
|
2008-02-08 00:12:34 +01:00
|
|
|
if test "x$with_debug_flag" = "xyes" ; then
|
|
|
|
base_configs="$base_configs --with-server-suffix=\"-debug\""
|
|
|
|
fi
|
2010-09-16 08:53:58 +02:00
|
|
|
base_configs="$base_configs --without-example-storage-engine"
|
2008-02-08 00:12:34 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# Special handling of readline; use readline from the MySQL
|
|
|
|
# distribution if building a GPL version, otherwise use libedit.
|
|
|
|
#
|
|
|
|
set_readline_package()
|
|
|
|
{
|
|
|
|
if test -d "$path/../cmd-line-utils/readline" && test "x$gpl" = "xyes" ; then
|
|
|
|
base_configs="$base_configs --with-readline"
|
|
|
|
elif test -d "$path/../cmd-line-utils/libedit" ; then
|
|
|
|
base_configs="$base_configs --with-libedit"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# If fast flag set by user we also add architecture as discovered to
|
|
|
|
# compiler flags to make binary optimised for architecture at hand.
|
|
|
|
# We use this feature on gcc compilers.
|
|
|
|
#
|
|
|
|
set_gcc_special_options()
|
|
|
|
{
|
|
|
|
if test "x$fast_flag" = "xyes" && test "x$compiler" = "xgcc" ; then
|
|
|
|
compiler_flags="$compiler_flags $check_cpu_cflags"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2010-12-01 13:38:47 +01:00
|
|
|
#
|
|
|
|
# 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
|
|
|
|
# feature is currently available on Intel's icc compiler only.
|
|
|
|
#
|
|
|
|
set_icc_special_options()
|
|
|
|
{
|
|
|
|
if test "x$fast_flag" = "xyes" && test "x$cpu_arg" = "xcore2" && \
|
|
|
|
test "x$compiler" = "xicc" ; then
|
|
|
|
compiler_flags="$compiler_flags -xT"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2008-12-19 11:46:28 +01:00
|
|
|
set_cc_and_cxx_for_gcc()
|
|
|
|
{
|
|
|
|
if test "x$CC" = "x" ; then
|
2010-09-16 08:53:58 +02:00
|
|
|
CC="gcc -static-libgcc -fno-exceptions"
|
2008-12-19 11:46:28 +01:00
|
|
|
fi
|
|
|
|
if test "x$CXX" = "x" ; then
|
2010-09-16 08:53:58 +02:00
|
|
|
CXX="gcc -static-libgcc -fno-exceptions"
|
2008-12-19 11:46:28 +01:00
|
|
|
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
|
|
|
|
}
|
|
|
|
|
2010-12-01 13:38:47 +01:00
|
|
|
set_cc_and_cxx_for_open64()
|
2008-12-19 11:46:28 +01:00
|
|
|
{
|
|
|
|
if test "x$CC" = "x" ; then
|
2010-12-01 13:38:47 +01:00
|
|
|
CC="opencc -static-libgcc -fno-exceptions"
|
2008-12-19 11:46:28 +01:00
|
|
|
fi
|
|
|
|
if test "x$CXX" = "x" ; then
|
2010-12-01 13:38:47 +01:00
|
|
|
CXX="openCC -static-libgcc -fno-exceptions"
|
2008-12-19 11:46:28 +01:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2010-12-01 13:38:47 +01:00
|
|
|
set_cc_and_cxx_for_forte()
|
2008-02-08 00:12:34 +01:00
|
|
|
{
|
2010-12-01 13:38:47 +01:00
|
|
|
if test "x$CC" = "x" ; then
|
|
|
|
CC="cc"
|
|
|
|
fi
|
|
|
|
if test "x$CXX" = "x" ; then
|
|
|
|
CXX="CC"
|
2008-02-08 00:12:34 +01:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# FreeBSD Section
|
|
|
|
#
|
|
|
|
set_bsd_configs()
|
|
|
|
{
|
|
|
|
if test "x$cpu_base_type" != "xx86" ; then
|
|
|
|
usage "Only x86 CPUs supported for FreeBSD"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
if test "x$compiler" != "xgcc" ; then
|
|
|
|
usage "Only gcc supported for FreeBSD"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
base_configs="$base_configs --enable-assembler"
|
2008-12-19 11:46:28 +01:00
|
|
|
if test "x$fast_flag" != "xno" ; then
|
|
|
|
compiler_flags="$compiler_flags -O3"
|
|
|
|
else
|
2009-11-02 14:49:26 +01:00
|
|
|
compiler_flags="$compiler_flags -O0"
|
2008-12-19 11:46:28 +01:00
|
|
|
fi
|
|
|
|
set_cc_and_cxx_for_gcc
|
2008-02-08 00:12:34 +01:00
|
|
|
}
|
|
|
|
|
2010-09-16 08:53:58 +02:00
|
|
|
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
|
2008-02-08 00:12:34 +01:00
|
|
|
}
|
|
|
|
|
2010-09-16 08:53:58 +02:00
|
|
|
#
|
|
|
|
# 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
|
|
|
|
}
|
|
|
|
|
2010-12-01 13:38:47 +01:00
|
|
|
#
|
|
|
|
# Link time optimizer (interprocedural optimizations) for Open64
|
|
|
|
#
|
|
|
|
check_for_open64_link_time_optimizer()
|
|
|
|
{
|
|
|
|
if test "x$with_link_time_optimizer" = "xyes" ; then
|
|
|
|
compiler_flags="$compiler_flags -ipa"
|
|
|
|
LDFLAGS="$LDFLAGS -ipa"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# Link time optimizer (interprocedural optimizations) for icc
|
|
|
|
#
|
|
|
|
check_for_icc_link_time_optimizer()
|
|
|
|
{
|
|
|
|
if test "x$with_link_time_optimizer" = "xyes" ; then
|
|
|
|
compiler_flags="$compiler_flags -ipo"
|
|
|
|
LDFLAGS="$LDFLAGS -ipo"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# Link time optimizer (interprocedural optimizations) for forte
|
|
|
|
#
|
|
|
|
check_for_forte_link_time_optimizer()
|
|
|
|
{
|
|
|
|
if test "x$with_link_time_optimizer" = "xyes" ; then
|
|
|
|
compiler_flags="$compiler_flags -ipo"
|
|
|
|
LDFLAGS="$LDFLAGS -ipo"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2010-09-16 08:53:58 +02:00
|
|
|
#
|
|
|
|
# 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
|
|
|
|
#
|
2010-12-01 13:38:47 +01:00
|
|
|
check_for_gcc_link_time_optimizer()
|
2010-09-16 08:53:58 +02:00
|
|
|
{
|
|
|
|
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
|
|
|
|
}
|
2010-12-01 13:38:47 +01:00
|
|
|
|
|
|
|
set_feedback_for_gcc()
|
|
|
|
{
|
|
|
|
if test "x$GENERATE_FEEDBACK_PATH" != "x" ; then
|
|
|
|
compiler_flags="$compiler_flags -fprofile-generate"
|
|
|
|
compiler_flags="$compiler_flags -fprofile-dir=$GENERATE_FEEDBACK_PATH"
|
|
|
|
elif test "x$USE_FEEDBACK_PATH" != "x" ; then
|
|
|
|
compiler_flags="$compiler_flags -fprofile-use"
|
|
|
|
compiler_flags="$compiler_flags -fprofile-correction"
|
|
|
|
compiler_flags="$compiler_flags -fprofile-dir=$USE_FEEDBACK_PATH"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
set_feedback_for_open64()
|
|
|
|
{
|
|
|
|
if test "x$GENERATE_FEEDBACK_PATH" != "x" ; then
|
|
|
|
compiler_flags="$compiler_flags --fb-create=$GENERATE_FEEDBACK_PATH/feedback"
|
|
|
|
elif test "x$USE_FEEDBACK_PATH" != "x" ; then
|
|
|
|
compiler_flags="$compiler_flags --fb-opt=$USE_FEEDBACK_PATH/feedback"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2008-02-08 00:12:34 +01:00
|
|
|
#
|
|
|
|
# Linux Section
|
|
|
|
#
|
|
|
|
set_linux_configs()
|
|
|
|
{
|
2010-12-01 13:38:47 +01:00
|
|
|
# Default to use --with-fast-mutexes on Linux
|
|
|
|
if test "x$with_fast_mutexes" = "x" ; then
|
|
|
|
base_configs="$base_configs --with-fast-mutexes"
|
|
|
|
fi
|
2008-02-08 00:12:34 +01:00
|
|
|
if test "x$cpu_base_type" != "xx86" && \
|
|
|
|
test "x$cpu_base_type" != "xitanium" ; then
|
2008-12-19 11:46:28 +01:00
|
|
|
usage "Only x86 and Itanium CPUs supported for Linux"
|
2008-02-08 00:12:34 +01:00
|
|
|
exit 1
|
|
|
|
fi
|
2008-12-20 15:46:31 +01:00
|
|
|
if test "x$use_tcmalloc" = "xyes" ; then
|
|
|
|
base_configs="$base_configs --with-mysqld-libs=-ltcmalloc_minimal"
|
|
|
|
fi
|
2008-02-08 00:12:34 +01:00
|
|
|
if test "x$cpu_base_type" = "xx86" ; then
|
|
|
|
base_configs="$base_configs --enable-assembler"
|
|
|
|
fi
|
|
|
|
if test "x$compiler" = "xgcc" ; then
|
2008-12-19 11:46:28 +01:00
|
|
|
set_cc_and_cxx_for_gcc
|
|
|
|
if test "x$fast_flag" != "xno" ; then
|
2009-12-08 11:14:51 +01:00
|
|
|
if test "x$fast_flag" = "xyes" ; then
|
|
|
|
compiler_flags="$compiler_flags -O3"
|
2010-12-01 13:38:47 +01:00
|
|
|
check_for_gcc_link_time_optimizer
|
2009-12-08 11:14:51 +01:00
|
|
|
else
|
2010-12-01 13:38:47 +01:00
|
|
|
compiler_flags="$compiler_flags -O3"
|
2009-12-08 11:14:51 +01:00
|
|
|
fi
|
2008-12-19 11:46:28 +01:00
|
|
|
else
|
2009-11-02 14:49:26 +01:00
|
|
|
compiler_flags="$compiler_flags -O0"
|
2008-02-08 00:12:34 +01:00
|
|
|
fi
|
2010-12-01 13:38:47 +01:00
|
|
|
set_feedback_for_gcc
|
2008-02-08 00:12:34 +01:00
|
|
|
# configure will set proper compiler flags for gcc on Linux
|
|
|
|
elif test "x$compiler" = "xicc" ; then
|
|
|
|
compiler_flags="$compiler_flags -mp -restrict"
|
2008-12-19 11:46:28 +01:00
|
|
|
set_cc_and_cxx_for_icc
|
2008-02-08 00:12:34 +01:00
|
|
|
if test "x$cpu_base_type" = "xitanium" ; then
|
|
|
|
compiler_flags="$compiler_flags -no-ftz"
|
|
|
|
fi
|
|
|
|
if test "x$fast_flag" != "xno" ; then
|
|
|
|
compiler_flags="$compiler_flags -O3 -unroll2 -ip"
|
2010-12-01 13:38:47 +01:00
|
|
|
if test "x$fast_flag" = "xyes" ; then
|
|
|
|
check_for_icc_link_time_optimizer
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
elif test "x$compiler" = "xopen64" ; then
|
|
|
|
set_cc_and_cxx_for_open64
|
|
|
|
if test "x$fast_flag" != "xno" ; then
|
|
|
|
if test "x$fast_flag" = "xyes" ; then
|
|
|
|
compiler_flags="$compiler_flags -O3"
|
|
|
|
# Generate code specific for the machine you run on
|
|
|
|
compiler_flags="$compiler_flags -march=auto"
|
|
|
|
check_for_open64_link_time_optimizer
|
|
|
|
if test "x$with_mso" = "xyes" ; then
|
|
|
|
compiler_flags="$compiler_flags -mso"
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
compiler_flags="$compiler_flags -O3"
|
2008-02-08 00:12:34 +01:00
|
|
|
fi
|
|
|
|
fi
|
2010-12-01 13:38:47 +01:00
|
|
|
set_feedback_for_open64
|
2008-02-08 00:12:34 +01:00
|
|
|
else
|
2010-12-01 13:38:47 +01:00
|
|
|
usage "Only gcc,icc and Open64 compilers supported for Linux"
|
2008-02-08 00:12:34 +01:00
|
|
|
exit 1
|
|
|
|
fi
|
2010-12-01 13:38:47 +01:00
|
|
|
check_64_bits
|
|
|
|
if test "x$m64" = "xyes" ; then
|
|
|
|
compiler_flags="$compiler_flags -m64"
|
|
|
|
else
|
|
|
|
compiler_flags="$compiler_flags -m32"
|
|
|
|
fi
|
2008-02-08 00:12:34 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# Solaris Section
|
|
|
|
#
|
|
|
|
set_solaris_configs()
|
|
|
|
{
|
2008-12-19 11:46:28 +01:00
|
|
|
# Use mtmalloc as malloc, see Tim Cook blog
|
2010-09-16 08:53:58 +02:00
|
|
|
# For information on optimal compiler settings, see article at
|
|
|
|
# http://developers.sun.com/solaris/articles/mysql_perf_tune.html
|
|
|
|
# by Luojia Chen at Sun.
|
2008-12-19 11:46:28 +01:00
|
|
|
base_configs="$base_configs --with-named-curses=-lcurses"
|
2008-02-08 00:12:34 +01:00
|
|
|
case "`uname -a`" in
|
2010-09-16 08:53:58 +02:00
|
|
|
*5.8* | *5.9* )
|
|
|
|
;;
|
2008-12-19 11:46:28 +01:00
|
|
|
|
2010-09-16 08:53:58 +02:00
|
|
|
*5.10* | *5.11*)
|
|
|
|
base_configs="$base_configs --with-mysqld-libs=-lmtmalloc"
|
2008-02-08 00:12:34 +01:00
|
|
|
;;
|
|
|
|
*)
|
2009-02-06 14:20:06 +01:00
|
|
|
usage "Only versions 8,9, 10 and 11 supported for Solaris"
|
|
|
|
exit 1
|
2008-02-08 00:12:34 +01:00
|
|
|
esac
|
|
|
|
if test "x$cpu_base_type" != "xx86" && \
|
|
|
|
test "x$cpu_base_type" != "xsparc" ; then
|
|
|
|
usage "Only x86 and Sparc CPUs supported for Solaris"
|
|
|
|
exit 1
|
|
|
|
fi
|
2009-02-06 14:20:06 +01:00
|
|
|
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
|
2008-02-08 00:12:34 +01:00
|
|
|
if test "x$compiler" = "xgcc" ; then
|
2008-12-19 11:46:28 +01:00
|
|
|
set_cc_and_cxx_for_gcc
|
2008-02-08 00:12:34 +01:00
|
|
|
if test "x$cpu_base_type" != "xx86" ; then
|
2009-02-06 14:20:06 +01:00
|
|
|
usage "gcc currently not supported for Solaris on SPARC"
|
|
|
|
exit 1
|
2008-12-19 11:46:28 +01:00
|
|
|
fi
|
2009-02-06 14:20:06 +01:00
|
|
|
if test "x$fast_flag" = "xyes" ; then
|
|
|
|
LDFLAGS="$LDFLAGS -O3"
|
|
|
|
compiler_flags="$compiler_flags -O3"
|
2010-12-01 13:38:47 +01:00
|
|
|
check_for_gcc_link_time_optimizer
|
2008-02-08 00:12:34 +01:00
|
|
|
else
|
2009-02-06 14:20:06 +01:00
|
|
|
if test "x$fast_flag" = "xgeneric" ; then
|
|
|
|
LDFLAGS="$LDFLAGS -O2"
|
|
|
|
compiler_flags="$compiler_flags -O2"
|
|
|
|
else
|
2009-11-02 14:49:26 +01:00
|
|
|
LDFLAGS="$LDFLAGS -O0"
|
|
|
|
compiler_flags="$compiler_flags -O0"
|
2009-02-06 14:20:06 +01:00
|
|
|
fi
|
2008-02-08 00:12:34 +01:00
|
|
|
fi
|
2009-02-06 14:20:06 +01:00
|
|
|
else
|
|
|
|
#Using Forte compiler (SunStudio)
|
2008-12-19 11:46:28 +01:00
|
|
|
set_cc_and_cxx_for_forte
|
2009-02-06 14:20:06 +01:00
|
|
|
compiler_flags="$compiler_flags -mt"
|
2010-09-16 08:53:58 +02:00
|
|
|
LDFLAGS="$LDFLAGS -mt"
|
2009-02-06 14:20:06 +01:00
|
|
|
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"
|
2010-12-01 13:38:47 +01:00
|
|
|
check_for_forte_link_time_optimizer
|
2009-02-06 14:20:06 +01:00
|
|
|
else
|
|
|
|
compiler_flags="$compiler_flags -xtarget=generic"
|
|
|
|
fi
|
2008-02-08 00:12:34 +01:00
|
|
|
if test "x$cpu_base_type" = "xx86" ; then
|
2008-12-19 11:46:28 +01:00
|
|
|
compiler_flags="$compiler_flags -nofstore"
|
2010-09-16 08:53:58 +02:00
|
|
|
base_cxx_flags="$base_cxx_flags -features=no%except"
|
2009-02-06 14:20:06 +01:00
|
|
|
if test "x$fast_flag" = "xyes" ; then
|
|
|
|
compiler_flags="$compiler_flags -xregs=frameptr"
|
|
|
|
compiler_flags="$compiler_flags -xO4"
|
|
|
|
else
|
2010-09-16 08:53:58 +02:00
|
|
|
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
|
2008-12-19 11:46:28 +01:00
|
|
|
fi
|
2009-02-06 14:20:06 +01:00
|
|
|
else
|
|
|
|
#Using SPARC cpu with SunStudio (Forte) compiler
|
2009-03-11 22:17:48 +01:00
|
|
|
ASFLAGS="$ASFLAGS -xarch=sparc"
|
|
|
|
LDFLAGS="$LDFLAGS -xarch=sparc"
|
2010-09-16 08:53:58 +02:00
|
|
|
base_cxxflags="$base_cxxflags -noex"
|
|
|
|
base_cflags="$base_cflags -xstrconst"
|
2009-02-06 14:20:06 +01:00
|
|
|
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
|
2010-09-16 08:53:58 +02:00
|
|
|
compiler_flags="$compiler_flags -xO3"
|
2009-02-06 14:20:06 +01:00
|
|
|
else
|
2009-11-02 14:49:26 +01:00
|
|
|
compiler_flags="$compiler_flags -xO0"
|
2008-12-19 11:46:28 +01:00
|
|
|
fi
|
2008-02-08 00:12:34 +01:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# Mac OS X Section
|
|
|
|
#
|
|
|
|
set_macosx_configs()
|
|
|
|
{
|
2008-12-19 11:46:28 +01:00
|
|
|
if test "x$cpu_base_type" != "xx86" || test "x$compiler" != "xgcc" ; then
|
2008-02-08 00:12:34 +01:00
|
|
|
usage "Only gcc/x86 supported for Mac OS X"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
#
|
|
|
|
# Optimize for space as long as it doesn't affect performance, use some
|
|
|
|
# optimisations also when not in fast mode.
|
|
|
|
#
|
2008-12-19 11:46:28 +01:00
|
|
|
base_cxxflags="$base_cxxflags -felide-constructors"
|
2010-09-16 08:53:58 +02:00
|
|
|
compiler_flags="$compiler_flags -fno-common"
|
2008-12-19 11:46:28 +01:00
|
|
|
if test "x$m64" = "xyes" ; then
|
|
|
|
compiler_flags="$compiler_flags -m64"
|
|
|
|
compiler_flags="$compiler_flags -arch x86_64"
|
|
|
|
else
|
2009-02-06 14:20:06 +01:00
|
|
|
compiler_flags="$compiler_flags -m32"
|
2008-12-19 11:46:28 +01:00
|
|
|
compiler_flags="$compiler_flags -arch i386"
|
|
|
|
fi
|
2008-02-08 00:12:34 +01:00
|
|
|
if test "x$fast_flag" != "xno" ; then
|
|
|
|
compiler_flags="$compiler_flags -Os"
|
|
|
|
else
|
2009-11-02 14:49:26 +01:00
|
|
|
compiler_flags="$compiler_flags -O0"
|
2008-02-08 00:12:34 +01:00
|
|
|
fi
|
2008-12-19 11:46:28 +01:00
|
|
|
set_cc_and_cxx_for_gcc
|
2008-02-08 00:12:34 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# Use static linking for own modules and dynamic linking for system
|
|
|
|
# modules unless specifically requested to do everything statically.
|
|
|
|
# Should normally not be used; static_linking_flag kept in case someone
|
|
|
|
# really needs it. Available only if developer flag is also set.
|
|
|
|
#
|
|
|
|
set_static_link_configs()
|
|
|
|
{
|
|
|
|
if test "x$static_linking_flag" = "xyes" && test "x$developer_flag" = "xyes" ; then
|
|
|
|
loc_static_link="--with-mysqld-ldflags=\"-all-static\""
|
|
|
|
loc_static_link="$loc_static_link --with-client-ldflags=\"-all-static\""
|
|
|
|
else
|
|
|
|
loc_static_link="--with-mysqld-ldflags=\"-static\""
|
|
|
|
loc_static_link="$loc_static_link --with-client-ldflags=\"-static\""
|
|
|
|
fi
|
|
|
|
base_configs="$base_configs $loc_static_link"
|
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# Enable error injection in MySQL Server (for developer build only -
|
|
|
|
# extra check for developer flag required).
|
|
|
|
#
|
|
|
|
set_error_inject_configs()
|
|
|
|
{
|
|
|
|
if test "x$error_inject_flag" = "xyes" && test "x$developer_flag" = "xyes" ; then
|
|
|
|
base_configs="$base_configs --with-error-inject"
|
|
|
|
if test "x$package" = "xndb" || test "x$package" = "xextended" ; then
|
|
|
|
base_configs="$base_configs --with-ndb-ccflags='-DERROR_INSERT'"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
set_default_package()
|
|
|
|
{
|
|
|
|
if test "x$package" = "x" ; then
|
|
|
|
package="extended"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
set_defaults_based_on_environment()
|
|
|
|
{
|
|
|
|
if test ! -z "$MYSQL_DEVELOPER" ; then
|
|
|
|
developer_flag="yes"
|
|
|
|
fi
|
|
|
|
if test ! -z "$MYSQL_DEVELOPER_DEBUG" ; then
|
|
|
|
with_debug_flag="yes"
|
|
|
|
fast_flag="no"
|
|
|
|
fi
|
|
|
|
if test ! -z "$MYSQL_DEVELOPER_PACKAGE" ; then
|
|
|
|
package="$MYSQL_DEVELOPER_PACKAGE"
|
|
|
|
parse_package
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
########################################################################
|
|
|
|
|
|
|
|
if test ! -f sql/mysqld.cc ; then
|
|
|
|
die "You must run this script from the MySQL top-level directory"
|
|
|
|
fi
|
|
|
|
|
|
|
|
cpu_type=
|
|
|
|
package=
|
|
|
|
prefix="/usr/local/mysql"
|
2010-09-16 08:53:58 +02:00
|
|
|
parallelism="8"
|
2008-02-08 00:12:34 +01:00
|
|
|
fast_flag="generic"
|
|
|
|
compiler="gcc"
|
|
|
|
gpl="yes"
|
|
|
|
version_text=
|
|
|
|
developer_flag="no"
|
|
|
|
just_configure=
|
|
|
|
warning_mode=
|
|
|
|
with_flags=
|
|
|
|
error_inject_flag=
|
|
|
|
with_debug_flag=
|
|
|
|
compile_debug_flag=
|
|
|
|
strip_flag=
|
|
|
|
valgrind_flag=
|
|
|
|
static_linking_flag=
|
|
|
|
compiler_flags=
|
|
|
|
os=
|
|
|
|
cpu_base_type=
|
|
|
|
warnings=
|
|
|
|
c_warnings=
|
|
|
|
cflags=
|
|
|
|
base_cflags=
|
|
|
|
cxx_warnings=
|
|
|
|
base_cxxflags=
|
|
|
|
base_configs=
|
|
|
|
debug_flags=
|
|
|
|
cxxflags=
|
2010-12-01 13:38:47 +01:00
|
|
|
extra_debug_flags=
|
2008-02-08 00:12:34 +01:00
|
|
|
m64=
|
2009-02-21 11:03:49 +01:00
|
|
|
explicit_size_set=
|
2008-02-08 00:12:34 +01:00
|
|
|
datadir=
|
|
|
|
commands=
|
2008-12-19 11:46:28 +01:00
|
|
|
engine_configs=
|
|
|
|
ASFLAGS=
|
|
|
|
LDFLAGS=
|
2008-12-20 15:46:31 +01:00
|
|
|
use_tcmalloc=
|
2010-09-16 08:53:58 +02:00
|
|
|
without_comment="yes"
|
|
|
|
with_fast_mutexes=
|
2010-12-01 13:38:47 +01:00
|
|
|
with_perfschema="yes"
|
2010-09-16 08:53:58 +02:00
|
|
|
with_link_time_optimizer=
|
2010-12-01 13:38:47 +01:00
|
|
|
with_mso=
|
2010-09-16 08:53:58 +02:00
|
|
|
gcc_version="0"
|
2010-12-01 13:38:47 +01:00
|
|
|
generate_feedback_path=
|
|
|
|
use_feedback_path=
|
2008-02-08 00:12:34 +01:00
|
|
|
|
|
|
|
set_defaults_based_on_environment
|
|
|
|
|
|
|
|
parse_options "$@"
|
|
|
|
|
|
|
|
set_default_package
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
#
|
|
|
|
# Check for the CPU and set up CPU specific flags. We may reset them
|
|
|
|
# later.
|
|
|
|
# This call sets the cpu_arg and check_cpu_args parameters
|
|
|
|
#
|
|
|
|
path=`dirname $0`
|
2008-12-19 11:46:28 +01:00
|
|
|
if test "x$compiler" = "xgcc" ; then
|
|
|
|
compiler=
|
|
|
|
fi
|
2008-02-08 00:12:34 +01:00
|
|
|
. "$path/check-cpu"
|
2008-12-19 11:46:28 +01:00
|
|
|
if test "x$compiler" = "x" ; then
|
|
|
|
compiler="gcc"
|
|
|
|
fi
|
2009-02-06 14:20:06 +01:00
|
|
|
check_os
|
2008-02-08 00:12:34 +01:00
|
|
|
set_cpu_base
|
|
|
|
if test "x$?" = "x1" ; then
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
#
|
|
|
|
# Set up c_warnings and cxx_warnings; add to compiler_flags.
|
|
|
|
# Possibly reset check_cpu_flags.
|
|
|
|
#
|
|
|
|
set_warning_flags
|
|
|
|
|
|
|
|
#
|
|
|
|
# Add to compiler_flags.
|
|
|
|
#
|
|
|
|
set_valgrind_flags
|
|
|
|
set_with_debug_flags
|
|
|
|
set_no_omit_frame_pointer_for_developers
|
|
|
|
set_debug_flag
|
|
|
|
set_gcc_special_options
|
|
|
|
set_icc_special_options
|
|
|
|
|
|
|
|
#
|
|
|
|
# Definitions of various packages possible to compile. The default is to
|
2011-02-20 17:51:43 +01:00
|
|
|
# build a source variant including all storage engines except InnoDB.
|
2008-02-08 00:12:34 +01:00
|
|
|
#
|
|
|
|
set_base_configs
|
|
|
|
version_text="GPL version"
|
|
|
|
if test "x$package" = "xpro" ; then
|
2011-02-20 17:51:43 +01:00
|
|
|
set_max_engines
|
2008-02-08 00:12:34 +01:00
|
|
|
set_pro_package
|
|
|
|
elif test "x$package" = "xclassic" ; then
|
|
|
|
set_classic_package
|
|
|
|
else
|
|
|
|
die "No supported package was used, internal error"
|
|
|
|
fi
|
|
|
|
set_readline_package
|
|
|
|
set_static_link_configs
|
|
|
|
set_error_inject_configs
|
|
|
|
|
|
|
|
#
|
|
|
|
# This section handles flags for specific combinations of compilers,
|
|
|
|
# operating systems, and processors.
|
|
|
|
#
|
|
|
|
|
|
|
|
if test "x$os" = "xlinux" ; then
|
|
|
|
set_linux_configs
|
|
|
|
elif test "x$os" = "xSolaris" ; then
|
|
|
|
set_solaris_configs
|
|
|
|
elif test "x$os" = "xMacOSX" ; then
|
|
|
|
set_macosx_configs
|
|
|
|
elif test "x$os" = "xbsd" ; then
|
|
|
|
set_bsd_configs
|
|
|
|
else
|
|
|
|
die "Operating system not supported by this script"
|
|
|
|
fi
|
2010-09-16 08:53:58 +02:00
|
|
|
set_ssl
|
2008-02-08 00:12:34 +01:00
|
|
|
#
|
|
|
|
# Final step before setting up commands is to set up proper make and
|
|
|
|
# proper libtoolize versions, and to determine whether to use ccache.
|
|
|
|
#
|
|
|
|
set_make_version
|
2008-12-19 11:46:28 +01:00
|
|
|
set_ccache_usage
|
2008-02-08 00:12:34 +01:00
|
|
|
|
|
|
|
#
|
|
|
|
# Set up commands variable from variables prepared for base
|
|
|
|
# configurations, compiler flags, and warnings flags.
|
|
|
|
#
|
|
|
|
init_configure_commands
|
|
|
|
|
|
|
|
if test "x$just_configure" != "xyes" ; then
|
|
|
|
add_make_commands
|
|
|
|
fi
|
|
|
|
|
|
|
|
#
|
|
|
|
# The commands variable now contains the entire command to be run for
|
|
|
|
# the build; we either execute it, or merely print it out.
|
|
|
|
#
|
2010-12-01 13:38:47 +01:00
|
|
|
echo "Running command:"
|
|
|
|
echo "$commands"
|
|
|
|
if test "x$just_print" != "xyes" ; then
|
2008-02-08 00:12:34 +01:00
|
|
|
eval "set -x; $commands"
|
|
|
|
fi
|