Commit dcfe068d authored by Olivier Bertrand's avatar Olivier Bertrand

- Adding json udf's. Making the second version of json tables.

added:
  storage/connect/jsonudf.cpp
modified:
  storage/connect/CMakeLists.txt
  storage/connect/json.cpp
  storage/connect/json.h
  storage/connect/tabjson.cpp
  storage/connect/tabjson.h

- Fix utf8 issues with PROXY tables
modified:
  storage/connect/ha_connect.cc
  storage/connect/tabutil.cpp
  storage/connect/tabutil.h
parent 3c097fd6
# Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
#
# 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
# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
# MA 02110-1301, USA
cflags="$c_warnings $extra_flags $EXTRA_FLAGS $EXTRA_CFLAGS"
cxxflags="$cxx_warnings $base_cxxflags $extra_flags $EXTRA_FLAGS $EXTRA_CXXFLAGS"
extra_configs="$extra_configs $local_infile_configs $EXTRA_CONFIGS"
configure="./configure $base_configs $extra_configs"
if test "$just_print" = "1" -a "$just_configure" = "1"
then
just_print=""
configure="$configure --print"
fi
if test "$AM_EXTRA_MAKEFLAGS" = "VERBOSE=1" -o "$verbose_make" = "1"
then
configure="$configure --verbose"
fi
commands="\
/bin/rm -rf configure;
/bin/rm -rf CMakeCache.txt CMakeFiles/
path=`dirname $0`
. \"$path/autorun.sh\""
if [ -z "$just_clean" ]
then
commands="$commands
CC=\"$CC\" CFLAGS=\"$cflags\" CXX=\"$CXX\" CXXFLAGS=\"$cxxflags\" CXXLDFLAGS=\"$CXXLDFLAGS\" $configure"
fi
if [ -z "$just_configure" -a -z "$just_clean" ]
then
commands="$commands
$make $AM_MAKEFLAGS $AM_EXTRA_MAKEFLAGS"
if [ "x$strip" = "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"
fi
fi
if test -z "$just_print"
then
eval "set -x; $commands"
else
echo "$commands"
fi
#!/bin/sh
# Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
#
# 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
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301, USA
########################################################################
get_key_value()
{
echo "$1" | sed 's/^--[a-zA-Z_-]*=//'
}
usage()
{
cat <<EOF
Usage: $0 [-h|-n] [configure-options]
-h, --help Show this help message.
-n, --just-print Don't actually run any commands; just print them.
-c, --just-configure Stop after running configure.
--extra-configs=xxx Add this to configure options
--extra-flags=xxx Add this C and CXX flags
--extra-cflags=xxx Add this to C flags
--extra-cxxflags=xxx Add this to CXX flags
--verbose Print out full compile lines
--with-debug=full Build with full debug(no optimizations, keep call stack).
--warning-mode=[old|pedantic|maintainer]
Influences the debug flags. Old is default.
--prefix=path Build with prefix 'path'.
Note: this script is intended for internal use by MySQL developers.
EOF
}
parse_options()
{
while test $# -gt 0
do
case "$1" in
--prefix=*)
prefix=`get_key_value "$1"`;;
--with-debug=full)
full_debug="=full";;
--warning-mode=*)
warning_mode=`get_key_value "$1"`;;
--extra-flags=*)
EXTRA_FLAGS=`get_key_value "$1"`;;
--extra-cflags=*)
EXTRA_CFLAGS=`get_key_value "$1"`;;
--extra-cxxflags=*)
EXTRA_CXXFLAGS=`get_key_value "$1"`;;
--extra-configs=*)
EXTRA_CONFIGS=`get_key_value "$1"`;;
--extra-makeflags=*)
EXTRA_MAKEFLAGS=`get_key_value "$1"`;;
-c | --just-configure)
just_configure=1;;
-n | --just-print | --print)
just_print=1;;
--verbose)
verbose_make=1;;
-h | --help)
usage
exit 0;;
*)
echo "Unknown option '$1'"
exit 1;;
esac
shift
done
}
########################################################################
if test ! -f sql/mysqld.cc
then
echo "You must run this script from the MySQL top-level directory"
exit 1
fi
prefix="/usr/local/mysql"
just_print=
just_configure=
warning_mode=
maintainer_mode=
full_debug=
verbose_make=
parse_options "$@"
if test -n "$MYSQL_BUILD_PREFIX"
then
prefix="$MYSQL_BUILD_PREFIX"
fi
set -e
#
# Check for the CPU and set up CPU specific flags. We may reset them
# later.
#
path=`dirname $0`
. "$path/check-cpu"
. "$path/util.sh"
get_make_parallel_flag
# SSL library to use.--with-ssl will select our bundled yaSSL
# implementation of SSL. To use OpenSSL you will need to specify
# the location of OpenSSL headers and libs on your system.
# Ex --with-ssl=/usr
SSL_LIBRARY=--with-ssl
if [ "x$warning_mode" = "xpedantic" ]; then
warnings="-W -Wall -ansi -pedantic -Wno-long-long -Wno-unused -D_POSIX_SOURCE"
c_warnings="$warnings"
cxx_warnings="$warnings -std=c++98"
# NOTE: warning mode should not influence optimize/debug mode.
# Please feel free to add a separate option if you don't feel it's an overkill.
debug_extra_cflags="-O0"
# Reset CPU flags (-mtune), they don't work in -pedantic mode
check_cpu_cflags=""
elif [ "x$warning_mode" = "xmaintainer" ]; then
c_warnings="-Wall -Wextra"
cxx_warnings="$c_warnings -Wno-unused-parameter"
maintainer_mode="--enable-mysql-maintainer-mode"
debug_extra_cflags="-g3"
else
# Both C and C++ warnings
warnings="-Wall -Wextra -Wunused -Wwrite-strings -Wno-uninitialized"
# For more warnings, uncomment the following line
# warnings="$warnings -Wshadow"
# C warnings
c_warnings="$warnings"
# C++ warnings
cxx_warnings="$warnings -Wno-unused-parameter -Wno-invalid-offsetof"
# cxx_warnings="$cxx_warnings -Woverloaded-virtual -Wsign-promo"
cxx_warnings="$cxx_warnings -Wnon-virtual-dtor"
debug_extra_cflags="-O0 -g3 -gdwarf-2"
fi
# Set flags for various build configurations.
# Used in -valgrind builds
# Override -DFORCE_INIT_OF_VARS from debug_cflags. It enables the macro
# LINT_INIT(), which is only useful for silencing spurious warnings
# of static analysis tools. We want LINT_INIT() to be a no-op in Valgrind.
valgrind_flags="-DHAVE_valgrind -USAFEMALLOC"
valgrind_flags="$valgrind_flags -UFORCE_INIT_OF_VARS -Wno-uninitialized"
valgrind_flags="$valgrind_flags -DMYSQL_SERVER_SUFFIX=-valgrind-max"
valgrind_configs="--with-valgrind"
#
# Used in -debug builds
debug_cflags="-DEXTRA_DEBUG -DSAFE_MUTEX -DSAFEMALLOC"
error_inject="--with-error-inject "
#
# Base C++ flags for all builds
base_cxxflags="-felide-constructors -fno-exceptions -fno-rtti"
#
# Flags for optimizing builds.
# Be as fast as we can be without losing our ability to backtrace.
fast_cflags="-O3 -fno-omit-frame-pointer"
debug_configs="--with-debug"
if [ -z "$full_debug" ]
then
debug_cflags="$debug_cflags $debug_extra_cflags"
fi
# we need local-infile in all binaries for rpl000001
# if you need to disable local-infile in the client, write a build script
# and unset local_infile_configs
local_infile_configs="--enable-local-infile"
#
# Configuration options.
#
base_configs="--prefix=$prefix --enable-assembler "
base_configs="$base_configs --with-extra-charsets=complex "
base_configs="$base_configs --enable-thread-safe-client "
base_configs="$base_configs --with-big-tables $maintainer_mode"
base_configs="$base_configs --with-plugin-aria --with-aria-tmp-tables"
if test -d "$path/../cmd-line-utils/readline"
then
base_configs="$base_configs --with-readline"
elif test -d "$path/../cmd-line-utils/libedit"
then
base_configs="$base_configs --with-libedit"
fi
max_no_embedded_configs="$SSL_LIBRARY --with-plugins=max"
max_no_qc_configs="$SSL_LIBRARY --with-plugins=max --without-query-cache"
max_no_ndb_configs="$SSL_LIBRARY --with-plugins=max-no-ndb --with-embedded-server --with-libevent"
max_configs="$SSL_LIBRARY --with-plugins=max --with-embedded-server --with-libevent"
all_configs="$SSL_LIBRARY --with-plugins=max --with-plugin-ndbcluster --with-embedded-server --with-innodb_plugin --with-libevent"
#
# CPU and platform specific compilation flags.
#
alpha_cflags="$check_cpu_cflags -Wa,-m$cpu_flag"
amd64_cflags="$check_cpu_cflags"
amd64_cxxflags="" # If dropping '--with-big-tables', add here "-DBIG_TABLES"
pentium_cflags="$check_cpu_cflags"
pentium64_cflags="$check_cpu_cflags -m64"
ppc_cflags="$check_cpu_cflags"
sparc_cflags=""
if gmake --version > /dev/null 2>&1
then
make=gmake
else
make=make
fi
if test -z "$CC" ; then
CC=gcc
fi
if test -z "$CXX" ; then
CXX=g++
fi
#
# Set -Wuninitialized to debug flags for gcc 4.4 and above
# because it is allowed there without -O
#
if test `$CC -v 2>&1 | tail -1 | sed 's/ .*$//'` = 'gcc' ; then
GCCVERSION=`$CC -v 2>&1 | tail -1 | \
sed 's/^[a-zA-Z][a-zA-Z]* [a-zA-Z][a-zA-Z]* //' | sed 's/ .*$//'`
GCCV1=`echo $GCCVERSION | sed 's/\..*$//'`
GCCV2=`echo $GCCVERSION | sed 's/[0-9][0-9]*\.//'|sed 's/\..*$//'`
if test '(' "$GCCV1" -gt '4' ')' -o \
'(' '(' "$GCCV1" -eq '4' ')' -a '(' "$GCCV2" -ge '4' ')' ')'
then
debug_cflags="$debug_cflags -DFORCE_INIT_OF_VARS -Wuninitialized"
fi
fi
# If ccache (a compiler cache which reduces build time)
# (http://samba.org/ccache) is installed, use it.
# We use 'grep' and hope 'grep' will work as expected
# (returns 0 if finds lines)
if test "$USING_GCOV" != "1"
then
# Not using gcov; Safe to use ccache
CCACHE_GCOV_VERSION_ENABLED=1
fi
if ccache -V > /dev/null 2>&1 && test "$CCACHE_GCOV_VERSION_ENABLED" = "1"
then
echo "$CC" | grep "ccache" > /dev/null || CC="ccache $CC"
echo "$CXX" | grep "ccache" > /dev/null || CXX="ccache $CXX"
fi
# gcov
# The -fprofile-arcs and -ftest-coverage options cause GCC to instrument the
# code with profiling information used by gcov.
# The -DDISABLE_TAO_ASM is needed to avoid build failures in Yassl.
# The -DHAVE_gcov enables code to write out coverage info even when crashing.
gcov_compile_flags="-fprofile-arcs -ftest-coverage"
gcov_compile_flags="$gcov_compile_flags -DDISABLE_TAO_ASM"
gcov_compile_flags="$gcov_compile_flags -DMYSQL_SERVER_SUFFIX=-gcov -DHAVE_gcov"
# GCC4 needs -fprofile-arcs -ftest-coverage on the linker command line (as well
# as on the compiler command line), and this requires setting LDFLAGS for BDB.
gcov_link_flags="-fprofile-arcs -ftest-coverage"
gcov_configs="--with-gcov"
# gprof
gprof_compile_flags="-O2 -pg -g"
gprof_link_flags="--disable-shared $static_link"
#!/bin/sh
# Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
#
# 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
# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
# MA 02110-1301, USA
# Create MySQL cmake configure wrapper
die() { echo "$@"; exit 1; }
# Use a configure script that will call CMake.
path=`dirname $0`
cp $path/cmake_configure.sh $path/../configure
chmod +x $path/../configure
#!/bin/sh
# Copyright (c) 2008, 2010, Oracle.
# Copyright (c) 2009-2011 Monty Program Ab
#
# 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
# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
# MA 02110-1301, USA
die()
{
echo "ERROR: $@"; exit 1;
}
get_key_value()
{
echo "$1" | sed 's/^--[a-zA-Z_-]*=//'
}
developer_usage()
{
cat <<EOF
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
--sysadmin-help instead.
Three environment variables can be used to define the default behaviour:
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
same type as that on which you intend to run the program.
The simplest possible way to run this script is to allow it to use the
built-in defaults everywhere, invoking it simply as (from top-level
MariaDB source directory):
shell> BUILD/build_mccge.sh
This performs the following operations:
1) Detects the operating system. Currently, Linux, FreeBSD, Solaris
8/9/10/11, and Mac OS X are supported by this script.
2) Detect the type of CPU being used. Currently supported processors
are: x86 for all supported operating systems, Itanium for Linux
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.
4) Builds a set of of binaries ; for 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
which you are building, and thus autoconf and automake do not need to
be run. If you have downloaded a launchpad tree then you should read
--developer-help.
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
Linux, you need to set --compiler=icc. If you want to use the AMD
compiler Open64 set --compiler=open64.
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
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
done when starting the server, or by invoking this script with
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
able to send gdb core dumps to support), then you should add the
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
to build MariaDB
--developer-help Show help for developers trying to build MariaDB
--with-help Show extended help on --with-xxx options to
configure
--extended-help Show extended help message
--without-debug Build non-debug version
--use-comment Set the comment in the build
--with-fast-mutexes Use try/retry method of acquiring mutex
--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
--with-debug Build debug version
--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
--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.
--with-mso Special flag used by Open64 compiler (requres at
least version 4.2.3) that enables optimisations
for multi-core scalability.
--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
--developer Use extensions that most MariaDB developers use
--no-developer Do not use extensions that most developers of
MariaDB use
--compiler=[gcc|icc|forte|SunStudio|open64] Select compiler
--cpu=[x86|x86_64|sparc|itanium] Select CPU type
x86 => x86 and 32-bit binary
x86_64 => x86 and 64 bit binary
--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
--package=[pro|classic] Select package to build
--parallelism=number Define parallelism in make
--strip Strip binaries
--error-inject Enable error injection into MariaDB Server and
data nodes
--valgrind Build with valgrind
--fast Optimise for CPU architecture built on
--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
EOF
if test "x$1" != "x" ; then
echo "Failure Message: $1"
fi
}
extended_usage()
{
cat <<EOF
Extended help text for this script:
-----------------------------------
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
gcc or SunStudio and MacOSX/x86/gcc.
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
supported platform and edit the output for a proper set of commands on
the specific platform you are using.
Using the --package option, it is also possible to build a "classic"
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
Cluster (this is the default if the --developer option is used).
Different MariaDB storage engines are included in the build, depending
on which --package option is used. The comment and version strong
suffix are also set according to the package selected.
--package=pro
storage engines:
ARCHIVE, BLACKHOLE, CSV, FEDERATED, INNODB, MYISAM
(All storage engines except NDB)
comment: Pro versions
version string suffix: [none]
--package=classic
storage engines: CSV, MYISAM
comment: Version without InnoDB and Maria
version string suffix: [none]
All packages except Classic include support for user-defined
partitioning. All packages include support for Performance
Schema.
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
if possible (GCC and same CC and CXX).
(cannot be overridden).
--with-pic: Build all binaries using position independent assembler
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
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
Specifically included in the "pro" package.
--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
Use the GPL readline library for command editing functions.
--with-libedit
Use the BSD licensed library for command editing functions.
--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.
Investigations have shown mtmalloc to be the best choice on Solaris,
also umem has good performance on Solaris but better debugging
capabilities.
Compiler options:
-----------------
This section describes the compiler options for each of the different
platforms supported by this script.
The --fast option adds -mtune=cpu_arg to the C/C++ flags (provides
support for Nocona, K8, and other processors), this option is valid
when gcc is the compiler.
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
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
Linux/x86+Itanium/gcc
-------------
For debug builds -O is used and otherwise -O3 is used.Discovery of a
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.)
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.
Linux/x86+Itanium/icc
-------------
Flags used:
CC = icc -static-libgcc -static-intel
C++ = icpc -static-libgcc -static-intel
C/C++ flags = -mp -restrict
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:
C/C++ flags += -O3 unroll2 -ip
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.
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.
Solaris/x86/gcc
---------------
All builds on Solaris are by default 64-bit, so -m64 is always used in
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
-------------------
Uses cc as CC and CC as CXX
Note that SunStudio uses different binaries for C and C++ compilers.
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
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
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
--------------
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"
means the build is space-optimised as long as the space optimisations
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
}
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 )
package="extended"
;;
*)
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"
if test "x$m64" = "x" ; then
m64="no"
fi
;;
x86_64 )
cpu_type="x86"
if test "x$m64" = "x" ; then
m64="yes"
fi
;;
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"
;;
forte | SunStudio | sunstudio )
compiler="forte"
;;
open64 | Open64 )
compiler="open64"
;;
*)
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"`
;;
--with-link-time-optimizer)
with_link_time_optimizer="yes"
;;
--without-debug)
with_debug_flag="no"
if test "x$fast_flag" != "xyes" ; then
fast_flag="generic"
fi
;;
--use-comment)
without_comment="no"
;;
--with-fast-mutexes)
with_fast_mutexes="yes"
;;
--without-fast-mutexes)
with_fast_mutexes="no"
;;
--without-perfschema)
with_perfschema="no"
;;
--with-mso)
with_mso="yes"
;;
--use-tcmalloc)
use_tcmalloc="yes"
;;
--with-debug)
with_debug_flag="yes"
fast_flag="no"
;;
--extra-debug-flag)
shift
extra_debug_flags="$extra_debug_flags -D$1"
;;
--debug)
compile_debug_flag="yes"
;;
--no-developer)
developer_flag="no"
;;
--developer)
developer_flag="yes"
;;
--compiler=*)
compiler=`get_key_value "$1"`
parse_compiler
;;
--generate-feedback)
shift
GENERATE_FEEDBACK_PATH="$1"
;;
--use-feedback)
shift
USE_FEEDBACK_PATH="$1"
;;
--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)
if test "x$explicit_size_set" != "x" ; then
echo "Cannot set both --32 and --64"
exit 1
fi
explicit_size_set="yes"
m64="no"
;;
--64)
if test "x$explicit_size_set" != "x" ; then
echo "Cannot set both --32 and --64"
exit 1
fi
explicit_size_set="yes"
m64="yes"
;;
--package=*)
package=`get_key_value "$1"`
parse_package
;;
--parallelism=*)
parallelism=`get_key_value "$1"`
;;
--configure-only)
just_configure="yes"
;;
--print-only|--just-print)
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"
exit 1
fi
case "$cpu_arg" in
core2 | nocona | prescott | pentium* | i*86 )
# Intel CPU
cpu_base_type="x86"
;;
athlon* | opteron* | k6 | k8 )
# AMD CPU
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
if test "x$m64" = "x" ; then
m64="no"
fi
elif test "x$os" = "xSolaris" ; then
if test "x$m64" = "x" ; then
m64="yes"
fi
elif test "x$m64" = "x" ; then
if test "x$cpu_arg" = "xnocona" || test "x$cpu_arg" = "xcore2" || \
test "x$cpu_arg" = "xathlon64" || test "x$cpu_arg" = "xopteron" ; then
m64="yes"
else
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"
else
echo "Will compile 32-bit binaries"
fi
return 0
}
#
# Add to the variable commands with the configure command
#
init_configure_commands()
{
path=`dirname $0`
cp $path/cmake_configure.sh $path/../configure
chmod +x $path/../configure
cflags="$c_warnings $base_cflags $compiler_flags"
cxxflags="$cxx_warnings $base_cxxflags $compiler_flags"
configure="./configure $base_configs $with_flags"
env_flags="CC=\"$CC\" CFLAGS=\"$cflags\" CXX=\"$CXX\" CXXFLAGS=\"$cxxflags\""
if test "x$LDFLAGS" != "x" ; then
env_flags="$env_flags LDFLAGS=\"$LDFLAGS\""
fi
if test "x$ASFLAGS" != "x" ; then
env_flags="$env_flags ASFLAGS=\"$ASFLAGS\""
fi
commands="$commands
$env_flags $configure"
}
#
# 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.
#
set_ccache_usage()
{
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
loc_valgrind_flags="-UFORCE_INIT_OF_VARS -DHAVE_purify "
loc_valgrind_flags="$loc_valgrind_flags -DMYSQL_SERVER_SUFFIX=-valgrind-max"
compiler_flags="$compiler_flags $loc_valgrind_flags"
with_flags="$with_flags --with-valgrind"
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"
warnings="$warnings -Wunused-value -Wunused-variable -Wno-uninitialized"
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"
compiler_flags="$compiler_flags -Wuninitialized"
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
loc_debug_flags="-DUNIV_MUST_NOT_INLINE -DEXTRA_DEBUG"
loc_debug_flags="$loc_debug_flags -Wuninitialized -DFORCE_INIT_OF_VARS"
loc_debug_flags="$loc_debug_flags -DSAFEMALLOC"
compiler_flags="$compiler_flags $loc_debug_flags"
fi
compiler_flags="$compiler_flags $extra_debug_flags"
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()
{
if test "x$compile_debug_flag" = "xyes" ; then
compiler_flags="$compiler_flags -g"
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
#
# 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
base_configs="$base_configs --with-debug"
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"
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-csv-storage-engine"
if test "x$with_perfschema" != "xno" ; then
base_configs="$base_configs --with-perfschema"
fi
base_configs="$base_configs --with-libevent"
}
#
# Add all standard engines and partitioning
#
set_max_engines()
{
engine_configs="--with-plugins=max --with-plugin-maria --with-maria-tmp-tables"
engine_configs="$engine_configs --without-plugin-innodb_plugin"
base_configs="$base_configs $engine_configs"
}
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=\"Pro $version_text built from source\""
fi
if test "x$with_debug_flag" = "xyes" ; then
base_configs="$base_configs --with-server-suffix=\"-debug\""
fi
}
set_classic_package()
{
if test "x$without_comment" != "xyes" ; then
base_configs="$base_configs --with-comment=\"Classic $version_text built from source\""
fi
if test "x$with_debug_flag" = "xyes" ; then
base_configs="$base_configs --with-server-suffix=\"-debug\""
fi
base_configs="$base_configs --without-example-storage-engine"
}
#
# 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
}
#
# 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
}
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_open64()
{
if test "x$CC" = "x" ; then
CC="opencc -static-libgcc -fno-exceptions"
fi
if test "x$CXX" = "x" ; then
CXX="openCC -static-libgcc -fno-exceptions"
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
}
#
# 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"
if test "x$fast_flag" != "xno" ; then
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 (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
}
#
# 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_gcc_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
}
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
}
#
# Linux Section
#
set_linux_configs()
{
# Default to use --with-fast-mutexes on Linux
if test "x$with_fast_mutexes" = "x" ; then
base_configs="$base_configs --with-fast-mutexes"
fi
if test "x$cpu_base_type" != "xx86" && \
test "x$cpu_base_type" != "xitanium" ; then
usage "Only x86 and Itanium CPUs supported for Linux"
exit 1
fi
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
base_configs="$base_configs --enable-assembler"
fi
if test "x$compiler" = "xgcc" ; then
set_cc_and_cxx_for_gcc
if test "x$fast_flag" != "xno" ; then
if test "x$fast_flag" = "xyes" ; then
compiler_flags="$compiler_flags -O3"
check_for_gcc_link_time_optimizer
else
compiler_flags="$compiler_flags -O3"
fi
else
compiler_flags="$compiler_flags -O0"
fi
set_feedback_for_gcc
# configure will set proper compiler flags for gcc on Linux
elif test "x$compiler" = "xicc" ; then
compiler_flags="$compiler_flags -mp -restrict"
set_cc_and_cxx_for_icc
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"
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"
fi
fi
set_feedback_for_open64
else
usage "Only gcc,icc and Open64 compilers supported for Linux"
exit 1
fi
check_64_bits
if test "x$m64" = "xyes" ; then
compiler_flags="$compiler_flags -m64"
else
compiler_flags="$compiler_flags -m32"
fi
}
#
# Solaris Section
#
set_solaris_configs()
{
# 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
*5.8* | *5.9* )
;;
*5.10* | *5.11*)
base_configs="$base_configs --with-mysqld-libs=-lmtmalloc"
;;
*)
usage "Only versions 8,9, 10 and 11 supported for Solaris"
exit 1
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
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
set_cc_and_cxx_for_gcc
if test "x$cpu_base_type" != "xx86" ; then
usage "gcc currently not supported for Solaris on SPARC"
exit 1
fi
if test "x$fast_flag" = "xyes" ; then
LDFLAGS="$LDFLAGS -O3"
compiler_flags="$compiler_flags -O3"
check_for_gcc_link_time_optimizer
else
if test "x$fast_flag" = "xgeneric" ; then
LDFLAGS="$LDFLAGS -O2"
compiler_flags="$compiler_flags -O2"
else
LDFLAGS="$LDFLAGS -O0"
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"
check_for_forte_link_time_optimizer
else
compiler_flags="$compiler_flags -xtarget=generic"
fi
if test "x$cpu_base_type" = "xx86" ; then
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
else
#Using SPARC cpu with SunStudio (Forte) compiler
ASFLAGS="$ASFLAGS -xarch=sparc"
LDFLAGS="$LDFLAGS -xarch=sparc"
base_cxxflags="$base_cxxflags -noex"
base_cflags="$base_cflags -xstrconst"
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"
else
compiler_flags="$compiler_flags -xO0"
fi
fi
fi
}
#
# Mac OS X Section
#
set_macosx_configs()
{
if test "x$cpu_base_type" != "xx86" || test "x$compiler" != "xgcc" ; then
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.
#
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
compiler_flags="$compiler_flags -Os"
else
compiler_flags="$compiler_flags -O0"
fi
set_cc_and_cxx_for_gcc
}
#
# 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"
parallelism="8"
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=
extra_debug_flags=
m64=
explicit_size_set=
datadir=
commands=
engine_configs=
ASFLAGS=
LDFLAGS=
use_tcmalloc=
without_comment="yes"
with_fast_mutexes=
with_perfschema="yes"
with_link_time_optimizer=
with_mso=
gcc_version="0"
generate_feedback_path=
use_feedback_path=
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`
if test "x$compiler" = "xgcc" ; then
compiler=
fi
. "$path/check-cpu"
if test "x$compiler" = "x" ; then
compiler="gcc"
fi
check_os
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
# build a source variant including all storage engines except InnoDB.
#
set_base_configs
version_text="GPL version"
if test "x$package" = "xpro" ; then
set_max_engines
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
set_ssl
#
# 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
set_ccache_usage
#
# 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.
#
echo "Running command:"
echo "$commands"
if test "x$just_print" != "xyes" ; then
eval "set -x; $commands"
fi
#!/bin/sh
# Copyright (c) 2005, 2010, Oracle and/or its affiliates.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
# Check cpu of current machine and find the
# best compiler optimization flags for gcc
# Will return result in:
# cpu_arg : Type of CPU
# low_cpu_arg : Type of CPU used up until GCC v3.3
# check_cpu_args : Arguments for GCC compiler settings
#
check_compiler_cpu_flags () {
# different compiler versions have different option names
# for CPU specific command line options
if test -z "$CC" ; then
cc="gcc";
else
cc=$CC
fi
# 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
cc_comp=`expr $cc_major '*' 100 '+' $cc_minor`
fi
case "$cc_ver--$cc_verno" in
*GCC*)
# different gcc backends (and versions) have different CPU flags
case `gcc -dumpmachine` in
i?86-* | x86_64-*)
if test "$cc_comp" -lt 304 ; then
check_cpu_cflags="-mcpu=${low_cpu_arg}"
elif test "$cc_comp" -ge 402 ; then
check_cpu_cflags="-mtune=native"
else
check_cpu_cflags="-mtune=${cpu_arg}"
fi
;;
ppc-*)
check_cpu_cflags="-mcpu=${cpu_arg} -mtune=${cpu_arg}"
;;
*)
check_cpu_cflags=""
return
;;
esac
;;
2.95.*)
# GCC 2.95 doesn't expose its name in --version output
check_cpu_cflags="-m${cpu_arg}"
;;
*)
check_cpu_cflags=""
return
;;
esac
# now we check whether the compiler really understands the cpu type
touch __test.c
while [ "$cpu_arg" ] ; do
printf "testing $cpu_arg ... " >&2
# compile check
eval "$cc -c $check_cpu_cflags __test.c" 2>/dev/null
if test "x$?" = "x0" ; then
echo ok >&2
break;
fi
echo failed >&2
check_cpu_cflags=""
break;
done
rm __test.*
return 0
}
check_cpu () {
CPUINFO=/proc/cpuinfo
if test -n "$TEST_CPUINFO" ; then
CPUINFO=$TEST_CPUINFO
fi
if test -r "$CPUINFO" -a "$CPUINFO" != " " ; then
# on Linux (and others?) we can get detailed CPU information out of /proc
cpuinfo="cat $CPUINFO"
# detect CPU architecture
cpu_arch=`$cpuinfo | grep 'arch' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -1`
# detect CPU family
cpu_family=`$cpuinfo | grep 'family' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -1`
if test -z "$cpu_family" ; then
cpu_family=`$cpuinfo | grep 'cpu' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -1`
fi
# detect CPU vendor and model
cpu_vendor=`$cpuinfo | grep 'vendor_id' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -1`
model_name=`$cpuinfo | grep 'model name' | cut -d ':' -f 2 | head -1`
if test -z "$model_name" ; then
model_name=`$cpuinfo | grep 'cpu model' | cut -d ':' -f 2 | head -1`
fi
# fallback: get CPU model from uname output
if test -z "$model_name" ; then
model_name=`uname -m`
fi
# parse CPU flags
for flag in `$cpuinfo | grep '^flags' | sed -e 's/^flags.*: //' -e 's/[^a-zA-Z0-9_ ]/_/g'`; do
eval cpu_flag_$flag=yes
done
else
# Fallback when there is no /proc/cpuinfo
CPUINFO=" "
case "`uname -s`" in
FreeBSD|OpenBSD)
cpu_family=`uname -m`;
model_name=`sysctl -n hw.model`
;;
Darwin)
cpu_family=`sysctl -n machdep.cpu.vendor`
model_name=`sysctl -n machdep.cpu.brand_string`
if [ -z "$cpu_family" -o -z "$model_name" ]
then
cpu_family=`uname -p`
model_name=`machine`
fi
;;
*)
cpu_family=`uname -p`;
model_name=`uname -m`;
;;
esac
fi
# detect CPU shortname as used by gcc options
# this list is not complete, feel free to add further entries
cpu_arg=""
low_cpu_arg=""
case "$cpu_vendor--$cpu_family--$model_name--$spu_arch" in
# DEC Alpha
*Alpha*EV6*)
cpu_arg="ev6";
;;
#Core 2 Duo
*Intel*Core\(TM\)2*)
cpu_arg="nocona"
core2="yes"
;;
# Intel ia32
*Intel*Core*|*X[eE][oO][nN]*)
# a Xeon is just another pentium4 ...
# ... unless it has the "lm" (long-mode) flag set,
# in that case it's a Xeon with EM64T support
# If SSE3 support exists it is a Core2 Duo or newer
# So is Intel Core.
if [ -z "$cpu_flag_lm" ]; then
cpu_arg="pentium4"
else
cpu_arg="nocona"
fi
if test -z "$cpu_flag_ssse3" ; then
core2="no"
else
core2="yes"
fi
;;
*Pentium*4*Mobile*)
cpu_arg="pentium4m"
;;
*Pentium\(R\)*\ M*)
cpu_arg="pentium-m"
low_cpu_arg="pentium3"
;;
*Pentium\(R\)*\ D*)
cpu_arg="prescott"
;;
*Pentium*4*)
cpu_arg="pentium4"
;;
*Pentium*III*Mobile*)
cpu_arg="pentium3m"
;;
*Pentium*III*)
cpu_arg="pentium3"
;;
*Pentium*M*pro*)
cpu_arg="pentium-m"
;;
*Celeron\(R\)*\ M*)
cpu_arg="pentium-m"
;;
*Celeron*Coppermine*)
cpu_arg="pentium3"
;;
*Celeron\(R\)*)
cpu_arg="pentium4"
;;
*Celeron*)
cpu_arg="pentium2"
;;
*Atom*)
cpu_arg="prescott"
;;
*GenuineIntel*)
cpu_arg="pentium"
;;
*Turion*)
cpu_arg="athlon64"
;;
*Athlon*64*)
cpu_arg="athlon64"
;;
*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*)
cpu_arg="opteron"
;;
*Phenom*)
cpu_arg="k8"
;;
*AuthenticAMD*)
cpu_arg="k6"
;;
*VIA\ *)
cpu_arg="i686"
;;
# MacOSX / Intel
*i386*i486*)
cpu_arg="pentium-m"
;;
*i386*)
cpu_arg="i386"
;;
# Intel ia64
*Itanium*)
cpu_arg="itanium"
;;
*IA-64*)
cpu_arg="itanium"
;;
# Solaris Sparc
*sparc*sun4[uv]*)
cpu_arg="sparc"
;;
# Power PC
*ppc*)
cpu_arg="powerpc"
;;
*powerpc*)
cpu_arg="powerpc"
;;
# unknown
*)
cpu_arg=""
;;
esac
if test "x$low_cpu_arg" = "x" ; then
low_cpu_arg="$cpu_arg"
fi
if test -z "$cpu_arg" ; then
if test "$CPUINFO" != " " ; then
# fallback to uname if necessary
TEST_CPUINFO=" "
check_cpu_cflags=""
check_cpu
return
fi
echo "BUILD/check-cpu: Oops, could not find out what kind of cpu this machine is using." >&2
check_cpu_cflags=""
return
fi
if test "x$compiler" = "x" ; then
check_compiler_cpu_flags
fi
if test "x$core2" = "xyes" ; then
cpu_arg="core2"
fi
return 0
}
check_cpu
#! /bin/sh
# Copyright (C) 2003 MySQL AB
# Use is subject to license terms
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
path=`dirname $0`
. "$path/SETUP.sh"
just_clean=1;
. "$path/FINISH.sh"
#!/bin/sh
# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
#
# 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
# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
# MA 02110-1301, USA
# Ensure cmake and perl are there
cmake -P cmake/check_minimal_version.cmake >/dev/null 2>&1 || HAVE_CMAKE=no
perl --version >/dev/null 2>&1 || HAVE_PERL=no
scriptdir=`dirname $0`
if test "$HAVE_CMAKE" = "no"
then
echo "CMake is required to build MySQL."
exit 1
elif test "$HAVE_PERL" = "no"
then
echo "Perl is required to build MySQL using the configure to CMake translator."
exit 1
else
perl $scriptdir/cmake/configure.pl "$@"
fi
#! /bin/sh
# Copyright (C) 2000, 2002 MySQL AB
# Use is subject to license terms
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
path=`dirname $0`
. "$path/SETUP.sh"
extra_flags="$alpha_cflags $fast_cflags"
extra_configs="$alpha_configs $static_link"
. "$path/FINISH.sh"
#! /bin/sh
/bin/rm -f */.deps/*.P */*.o
make -k maintainer-clean
/bin/rm -f */.deps/*.P */*.o
/bin/rm -f */.deps/*.P config.cache storage/innobase/config.cache mysql-*.tar.gz
path=`dirname $0`
. "$path/autorun.sh"
CFLAGS=-O1 CC=gcc CXX=g++ CXXFLAGS="-O1 -felide-constructors -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local/mysql --with-debug --with-extra-charsets=complex --without-extra-tools
make
#! /bin/sh
path=`dirname $0`
. "$path/SETUP.sh"
extra_flags="$amd64_cflags $debug_cflags"
extra_configs="$amd64_configs $debug_configs $all_configs"
. "$path/FINISH.sh"
#! /bin/sh
# Copyright (c) 2005, 2006 MySQL AB
# Use is subject to license terms
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
path=`dirname $0`
. "$path/SETUP.sh"
extra_flags="$amd64_cflags $debug_cflags"
extra_configs="$amd64_configs $debug_configs $max_configs"
. "$path/FINISH.sh"
#! /bin/sh
# Copyright (C) 2005, 2006 MySQL AB
# Use is subject to license terms
# 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
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301, USA
path=`dirname $0`
. "$path/SETUP.sh"
extra_flags="$amd64_cflags $debug_cflags"
extra_configs="$amd64_configs $debug_configs $max_no_ndb_configs"
. "$path/FINISH.sh"
#! /bin/sh
# Copyright (C) 2007 MySQL AB
# Use is subject to license terms
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
path=`dirname $0`
. "$path/SETUP.sh"
# Need to disable ccache, or we loose the gcov-needed compiler output files.
CCACHE_DISABLE=1
export CCACHE_DISABLE
export LDFLAGS="$gcov_link_flags"
extra_flags="$amd64_cflags $debug_cflags $max_cflags $gcov_compile_flags"
c_warnings="$c_warnings $debug_extra_warnings"
cxx_warnings="$cxx_warnings $debug_extra_warnings"
extra_configs="$amd64_configs $debug_configs $gcov_configs $max_configs"
. "$path/FINISH.sh"
#! /bin/sh
# Copyright (C) 2007 MySQL AB
# Use is subject to license terms
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
path=`dirname $0`
. "$path/SETUP.sh"
extra_flags="$amd64_cflags $gprof_compile_flags"
extra_configs="$amd64_configs $debug_configs $gprof_link_flags"
. "$path/FINISH.sh"
#! /bin/sh
path=`dirname $0`
. "$path/SETUP.sh"
extra_flags="$amd64_cflags -pg -g"
extra_configs="$amd64_configs $max_no_ndb_configs --disable-shared $static_link"
. "$path/FINISH.sh"
#! /bin/sh
# Copyright (c) 2005, 2006 MySQL AB
# Use is subject to license terms
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
path=`dirname $0`
. "$path/SETUP.sh"
extra_flags="$amd64_cflags $fast_cflags -g"
extra_configs="$amd64_configs $max_configs"
. "$path/FINISH.sh"
#! /bin/sh
# Copyright (C) 2007 MySQL AB
# Use is subject to license terms
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
path=`dirname $0`
. "$path/SETUP.sh"
extra_flags="$amd64_cflags $fast_cflags -g"
extra_configs="$amd64_configs $max_configs --with-ndb-sci=/opt/DIS"
. "$path/FINISH.sh"
#! /bin/sh
# Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
#
# 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
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301, USA
path=`dirname $0`
. "$path/SETUP.sh"
extra_flags="$amd64_cflags $debug_cflags $valgrind_flags"
extra_configs="$amd64_configs $debug_configs $valgrind_configs $max_configs"
. "$path/FINISH.sh"
#!/bin/bash
#
# MariaDB SQL server.
# Copyright (C) 2010 Kristian Nielsen and Monty Program AB
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# This script's purpose is to build the binary tarball packages for MariaDB
# (currently only on Linux systems).
#
# Thus BUILD/compile-bintar from the appropriate source tarball will reproduce
# such a release, provided the build environment (gcc version etc.) matches
# (use scripts/make_binary_distribution after running this script to actually
# create the binary tarball package).
#
# Note that packages are built from source tarballs not bzr checkouts.
# Therefore, this script assumes autotools have already been run.
#
# We link libc dynamically, otherwise we get lots of problems loading
# .so files at runtime (either system stuff like NSS, or server
# plugins).
#
# We link libgcc statically to avoid reduce nasty library version dependencies.
test -f Makefile && make distclean
path=`dirname $0`
. $path/util.sh
SYSTEM_TYPE="$(uname -o)"
MACHINE_TYPE="$(uname -m)"
# We cannot have a slash '/' in tarfile name.
SYSTEM_TYPE="$(echo ${SYSTEM_TYPE} | sed -e 's/GNU\///')"
# Get correct options for architecture into CPUOPT.
get_cpuopt
# Get correct -j option into AM_MAKEFLAGS
get_make_parallel_flag
# Use gcc rather than g++ to avoid linking libstdc++.so (which we don't need).
FLAGS="-O2 -fno-omit-frame-pointer -g -pipe -Wall $CPUOPT"
# Don't press on in case of error.
set -e
CC="gcc -static-libgcc" CXX="g++ -static-libgcc" CFLAGS="$FLAGS" CXXFLAGS="$FLAGS" \
./configure \
--prefix=/usr/local/mysql \
--exec-prefix=/usr/local/mysql \
--libexecdir=/usr/local/mysql/bin \
--localstatedir=/usr/local/mysql/data \
\
--with-comment="(MariaDB - http://mariadb.com/)" \
--with-system-type="${SYSTEM_TYPE}" \
--with-machine-type="${MACHINE_TYPE}" \
\
--enable-shared --enable-static \
--with-client-ldflags=-static --with-mysqld-ldflags=-static \
--enable-thread-safe-client --enable-local-infile --with-big-tables \
--without-docs --with-extra-charsets=all \
--with-libwrap --with-ssl --with-readline --with-libevent --with-zlib-dir=bundled \
--with-partition --with-embedded-server \
--with-plugins=max-no-ndb \
--without-plugin-innodb_plugin
make $AM_MAKEFLAGS
#! /bin/sh
# Copyright (c) 2005, 2006 MySQL AB
# Use is subject to license terms
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
path=`dirname $0`
. "$path/SETUP.sh"
c_warnings=""
cxx_warnings=""
fast_cflags="-O3"
base_cxxflags="-fno-handle-exceptions"
# FIXME do we need to link static, not to depend on CodeWarrior libs?
if [ x$MODE = x ] ; then
echo "You need to give an argument, 'standard', 'max', 'debug' or 'debug-max'"
echo "Like: MODE=standard BUILD/compile-darwin-codewarrior"
exit 1
else
case $MODE in
standard|pro-gpl)
# FIXME pro/pro-gpl different libedit/readline
extra_flags="$ppc_cflags $fast_cflags"
;;
pro)
# FIXME pro/pro-gpl different libedit/readline
extra_flags="$ppc_cflags $fast_cflags"
extra_configs="--with-libedit"
;;
max)
extra_flags="$ppc_cflags $fast_cflags"
extra_configs="$max_configs"
;;
debug)
extra_flags="$ppc_cflags $debug_cflags"
extra_configs="$debug_configs"
;;
debug-max)
extra_flags="$ppc_cflags $debug_cflags"
extra_configs="$debug_configs $max_configs"
;;
*)
echo "You need to give an argument, 'standard', 'max', 'debug' or 'debug-max'"
echo "Like: MODE=standard BUILD/compile-darwin-codewarrior"
exit 1
;;
esac
fi
extra_configs="$extra_configs --with-darwin-mwcc"
. "$path/FINISH.sh"
#!/bin/sh
# Copyright (c) 2004-2008 MySQL AB, 2008, 2009 Sun Microsystems, Inc.
# Use is subject to license terms.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
# This script's purpose is to update the automake/autoconf helper scripts and
# to run a plain "configure" without any special compile flags. Only features
# that affect the content of the source distribution are enabled. The resulting
# tree can then be picked up by "make dist" to create the "pristine source
# package" that is used as the basis for all other binary builds.
#
test -f Makefile && make maintainer-clean
path=`dirname $0`
. $path/autorun.sh
gmake=
for x in gmake gnumake make; do
if $x --version 2>/dev/null | grep GNU > /dev/null; then
gmake=$x
break;
fi
done
if [ -z "$gmake" ]; then
# Our build may not depend on GNU make, but I wouldn't count on it
echo "Please install GNU make, and ensure it is in your path as gnumake, gmake, or make" >&2
exit 2
fi
# Default to gcc for CC and CXX
if test -z "$CXX" ; then
export CXX
CXX=g++
# Set some required compile options
if test -z "$CXXFLAGS" ; then
export CXXFLAGS
CXXFLAGS="-felide-constructors -fno-exceptions -fno-rtti"
fi
fi
if test -z "$CC" ; then
export CC
CC=gcc
fi
# Use ccache, if available
if ccache -V > /dev/null 2>&1
then
if echo "$CC" | grep -v ccache > /dev/null
then
export CC
CC="ccache $CC"
fi
if echo "$CXX" | grep -v ccache > /dev/null
then
export CXX
CXX="ccache $CXX"
fi
fi
# Make sure to enable all features that affect "make dist"
# Remember that configure restricts the man pages to the configured features !
./configure \
--with-embedded-server \
--with-perfschema \
--with-plugins=max-no-ndb
$gmake -j4
#!/bin/sh
# Copyright (c) 2004, 2005, 2007 MySQL AB
# Use is subject to license terms
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
if [ ! -f "sql/mysqld.cc" ]; then
echo "You must run this script from the MySQL top-level directory."
exit 1
fi
# -fast Expand into a set of compiler options to result in
# improved application run-time. Options include: +O3,
# +Onolooptransform, +Olibcalls, +FPD, +Oentryschedule,
# +Ofastaccess.
# +O4 Perform level 3 as well as doing link time optimizations.
# Also sends +Oprocelim and +Ofastaccess to the linker
# (see ld(1)).
release_flags="-fast +O3"
# -z Do not bind anything to address zero. This option
# allows runtime detection of null pointers. See the
# note on pointers below.
cflags="-g -z +O0"
cxxflags="-g0 -z +O0"
debug_configure_options="--with-debug"
while [ "$#" != 0 ]; do
case "$1" in
--help)
echo "Usage: $0 [options]"
echo "Options:"
echo "--help print this message"
echo "--debug build debug binary [default] "
echo "--release build optimised binary"
echo "-32 build 32 bit binary [default]"
echo "-64 build 64 bit binary"
exit 0
;;
--debug)
echo "Building debug binary"
;;
--release)
echo "Building release binary"
cflags="$release_flags"
cxxflags="$release_flags"
debug_configure_options=""
;;
-32)
echo "Building 32-bit binary"
;;
-64)
echo "Building 64-bit binary"
cflags="$cflags +DA2.0W +DD64"
cxxflags="$cxxflags +DA2.0W +DD64"
;;
*)
echo "$0: invalid option '$1'; use --help to show usage"
exit 1
;;
esac
shift
done
set -x
make maintainer-clean
path=`dirname $0`
. "$path/autorun.sh"
CC=cc CXX=aCC CFLAGS="$cflags" CXXFLAGS="$cxxflags" \
./configure --prefix=/usr/local/mysql --disable-shared \
--with-extra-charsets=complex --enable-thread-safe-client \
--without-extra-tools $debug_configure_options \
--disable-dependency-tracking
gmake
#! /bin/sh
# Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
gmake -k maintainer-clean || true
/bin/rm -f */.deps/*.P config.cache storage/innobase/config.cache
path=`dirname $0`
. "$path/autorun.sh"
CC=ecc CFLAGS="-w1 -DEXTRA_DEBUG -DSAFE_MUTEX -O2" CXX=ecc CXXFLAGS="-w1 -DEXTRA_DEBUG -DSAFE_MUTEX -O2" ./configure --prefix=/usr/local/mysql --with-extra-charsets=complex --enable-thread-safe-client --with-mysqld-ldflags=-all-static --with-client-ldflags=-all-static --with-debug --with-innodb --with-embedded-server --with-archive-storage-engine
gmake
#!/bin/sh
#
# Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St,
# Fifth Floor, Boston, MA 02110-1301 USA
#
# we assume this script is in storage/innobase/
MYSQL_ROOT="$(dirname ${0})/../.."
cd ${MYSQL_ROOT}
cmake -DWITH_INNOBASE_STORAGE_ENGINE:BOOL=ON
make -j$(nproc)
#!/bin/sh
# Copyright (c) 2004, 2005, 2007 MySQL AB
# Use is subject to license terms
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
if [ ! -f "sql/mysqld.cc" ]; then
echo "You must run this script from the MySQL top-level directory."
exit 1
fi
cflags="-64 -mips4"
config_args=
if [ "$#" != 0 ]; then
case "$1" in
--help)
echo "Usage: $0 [options]"
echo "Options:"
echo "--help print this message"
echo "-32 build 32-bit binary"
echo "-64 build 64-bit binary [default]"
exit 0
;;
-64)
echo "Building 64-bit binary"
;;
-32)
echo "Building 32-bit binary"
cflags=""
;;
*)
config_args="$config_args $1"; shift
;;
esac
else
echo "Building 64-bit binary"
fi
set -x
make maintainer-clean
path=`dirname $0`
. "$path/autorun.sh"
# C options:
# -apo - auto-parallize for multiprocessors (implies -mp)
# -mp - generate multiprocessor code
# These two common optimization options apparently use 'sproc' model of
# threading, which is not compatible with PTHREADS: don't add them unless you
# know what you're doing.
#
# -c99 - enable C features standardized in C99, such as long long,
# strtoll, stroull etc.
# This option is vital to compile MySQL.
# -woff - turn off some warnings
# -64 - generate 64 bit object (implies -mips4)
# -mips4 - produce code for MIPS R10000, MIPS R12000 and further 64 bit
# processors
# -OPT:Olimit=0 - no limits exists to size of function for compiler to optimize
# it
nowarn="-woff 1064,1188,1460,1552,1681,1682,3303"
cflags="$cflags $nowarn -O3 -c99 -OPT:Olimit=0"
# C++ only options:
# -LANG:exceptions=OFF - don't generate exception handling code
# MySQL doesn't use exceptions.
# -LANG:std=OFF - don't link standard C++ library, such as
# <iostream>, <complex>, etc.
# -LANG:libc_in_namespace_std=OFF - libstdc functions can be
# declared in namespace 'std', when included
# into C++ code. Switch this feature off.
# This option is vital to compile MySQL
cxxflags="$cflags -LANG:exceptions=OFF -LANG:std=OFF"
cxxflags="$cxxflags -LANG:libc_in_namespace_std=OFF"
CC=cc CXX=CC CFLAGS="$cflags" CXXFLAGS="$cxxflags" \
./configure --prefix=/usr/local/mysql --disable-shared \
--with-extra-charsets=complex --enable-thread-safe-client \
--without-extra-tools --disable-dependency-tracking \
$config_args
make
#! /bin/sh
# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
path=`dirname $0`
. "$path/SETUP.sh"
extra_configs="$max_configs --with-ndb-test --with-ndb-ccflags='-DERROR_INSERT'"
extra_flags="$fast_cflags $max_cflags -g"
. "$path/FINISH.sh"
#! /bin/sh
# Copyright (c) 2000-2002, 2007 MySQL AB
# Use is subject to license terms
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
path=`dirname $0`
. "$path/SETUP.sh"
extra_flags="$pentium_cflags $fast_cflags"
extra_configs="$pentium_configs"
strip=yes
. "$path/FINISH.sh"
#! /bin/sh
# Copyright (C) 2005 MySQL AB
# Use is subject to license terms
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
path=`dirname $0`
. "$path/SETUP.sh"
extra_flags="$pentium_cflags $fast_cflags -g"
extra_configs="$pentium_configs --with-charset=utf8 --with-collation=utf8_general_cs"
. "$path/FINISH.sh"
#! /bin/sh
# Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
path=`dirname $0`
. "$path/SETUP.sh"
extra_flags="$pentium_cflags $debug_cflags"
extra_configs="$pentium_configs $debug_configs"
. "$path/FINISH.sh"
#! /bin/sh
path=`dirname $0`
set -- "$@" --with-debug=full
. "$path/SETUP.sh"
extra_flags="$pentium_cflags $debug_cflags"
extra_configs="$pentium_configs $debug_configs $all_configs $error_inject --with-experimental-collations"
. "$path/FINISH.sh"
#! /bin/sh
# Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
path=`dirname $0`
. "$path/SETUP.sh"
extra_flags="$pentium_cflags $debug_cflags"
extra_configs="$pentium_configs $debug_configs $max_configs $error_inject --with-experimental-collations"
. "$path/FINISH.sh"
#! /bin/sh
# Copyright (c) 2004-2006 MySQL AB
# Use is subject to license terms
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
path=`dirname $0`
. "$path/SETUP.sh"
extra_flags="$pentium_cflags $debug_cflags"
extra_configs="$pentium_configs $debug_configs $max_no_embedded_configs"
. "$path/FINISH.sh"
#! /bin/sh
# Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
path=`dirname $0`
. "$path/SETUP.sh"
extra_flags="$pentium_cflags $debug_cflags"
extra_configs="$pentium_configs $debug_configs $max_no_ndb_configs"
. "$path/FINISH.sh"
#! /bin/sh
# Builds server without query cache support
path=`dirname $0`
. "$path/SETUP.sh"
extra_flags="$pentium_cflags $debug_cflags"
extra_configs="$pentium_configs $debug_configs $max_no_qc_configs"
. "$path/FINISH.sh"
#! /bin/sh
# Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
path=`dirname $0`
. "$path/SETUP.sh"
extra_flags="$pentium_cflags $debug_cflags"
extra_configs="$pentium_configs $debug_configs"
extra_configs="$extra_configs --with-debug --with-ssl=/usr"
. "$path/FINISH.sh"
#! /bin/sh
# Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
path=`dirname $0`
. "$path/SETUP.sh"
extra_flags="$pentium_cflags $debug_cflags"
extra_configs="$pentium_configs $debug_configs"
extra_configs="$extra_configs --with-debug --with-ssl"
. "$path/FINISH.sh"
#! /bin/sh
# Copyright (C) 2000, 2007 MySQL AB
# Use is subject to license terms
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
# Need to disable ccache, or we loose the gcov-needed compiler output files.
USING_GCOV=1
CCACHE_GCOV_VERSION_ENABLED=0
if ccache -V > /dev/null 2>&1
then
CCACHE_VER=`ccache -V | head -1 | sed s/"ccache version "//`
if test "$CCACHE_VER" == "2.4-gcov"
then
CCACHE_GCOV_VERSION_ENABLED=1
else
CCACHE_DISABLE=1
export CCACHE_DISABLE
fi
fi
export CCACHE_GCOV_VERSION_ENABLED
path=`dirname $0`
. "$path/SETUP.sh"
export LDFLAGS="$gcov_link_flags"
extra_flags="$pentium_cflags $debug_cflags $max_cflags $gcov_compile_flags"
c_warnings="$c_warnings $debug_extra_warnings"
cxx_warnings="$cxx_warnings $debug_extra_warnings"
extra_configs="$pentium_configs $debug_configs $gcov_configs $max_configs"
. "$path/FINISH.sh"
#! /bin/sh
# Copyright (C) 2001, 2007 MySQL AB
# Use is subject to license terms
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
path=`dirname $0`
. "$path/SETUP.sh"
extra_flags="$pentium_cflags $gprof_compile_flags"
extra_configs="$pentium_configs $debug_configs $gprof_link_flags"
. "$path/FINISH.sh"
#! /bin/sh
# Copyright (C) 2005 MySQL AB
# Use is subject to license terms
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
path=`dirname $0`
. "$path/SETUP.sh"
# Note that we can't use ccache with icc as the generated .deps file will
# then contain wrong information
CC=icc
CXX=icpc
CXXLD="$CXX -static-libcxa"
export CC CXX CXXLD
c_warnings=""
cxx_warnings=""
extra_flags="$fast_cflags -unroll2 -ip -mp -restrict"
# Use -no-ipo if you get this error
# IPO link: can not find "-lstdc++_shared"
# icpc: error: problem during multi-file optimization compilation (code 1)
extra_flags="$extra_flags -no-ipo"
base_cxxflags="-fno-exceptions -fno-rtti"
extra_configs="$pentium_configs $static_link"
. "$path/FINISH.sh"
#! /bin/sh
# Copyright (c) 2005, 2010, Oracle and/or its affiliates.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
path=`dirname $0`
. "$path/SETUP.sh"
# Note that we can't use ccache with icc as the generated .deps file will
# then contain wrong information
CC=icc
CXX=icpc
export CC CXX
extra_flags="$pentium_cflags $debug_cflags $valgrind_flags"
# Disable following warnings as these are generated by header files:
# 161 unrecognized pragma
# 444 destructor for base class xxx is not virtual
# 279 controlling expression is constant
# 810 conversion from ulonglong to ulong with cast
# 981 operands are evaluated in unspecified order
# 1292 warning for unknown 'attribute' options
# 1469 "xxx" clobber ignored
# 1572 floating-point equality and inequality comparisons are unreliable
# In C++
# 869 parameter "xxx" was never referenced
# (Problem with virtual functions)
# 874 support for placement delete is disabled
c_warnings="-Wall -Wcheck -wd161,444,279,810,981,1292,1469,1572"
cxx_warnings="$c_warnings -wd869,874"
base_cxxflags="-fno-exceptions -fno-rtti"
extra_configs="$pentium_configs $debug_configs $valgrind_configs"
. "$path/FINISH.sh"
#! /bin/sh
# Copyright (C) 2005 MySQL AB
# Use is subject to license terms
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
path=`dirname $0`
. "$path/SETUP.sh"
# Note that we can't use ccache with icc as the generated .deps file will
# then contain wrong information
CC=icc
CXX=icpc
CXXLD="$CXX -static-libcxa"
export CC CXX CXXLD
c_warnings=""
cxx_warnings=""
extra_flags="$fast_cflags -unroll2 -ip -mp -restrict"
# Use -no-ipo if you get this error
# IPO link: can not find "-lstdc++_shared"
# icpc: error: problem during multi-file optimization compilation (code 1)
extra_flags="$extra_flags -no-ipo"
base_cxxflags="-fno-exceptions -fno-rtti"
extra_configs="$pentium_configs $static_link --with-yassl"
. "$path/FINISH.sh"
#! /bin/sh
# Copyright (c) 2001-2006 MySQL AB
# Use is subject to license terms
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
path=`dirname $0`
. "$path/SETUP.sh"
extra_flags="$pentium_cflags $fast_cflags -g"
extra_configs="$pentium_configs $max_configs"
. "$path/FINISH.sh"
#! /bin/sh
# Copyright (C) 2000 MySQL AB
# Use is subject to license terms
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
path=`dirname $0`
. "$path/SETUP.sh"
extra_flags="$pentium_cflags $fast_cflags"
extra_configs="$pentium_configs --without-server"
make=no
strip=yes
. "$path/FINISH.sh"
#! /bin/sh
AM_MAKEFLAGS="-j 2"
gmake -k maintainer-clean || true
/bin/rm -f */.deps/*.P config.cache
path=`dirname $0`
. "$path/autorun.sh"
export PATH=/usr/local/pgcc/bin:$PATH
CFLAGS="-Wimplicit -Wreturn-type -Wid-clash-51 -Wswitch -Wtrigraphs -Wcomment -W -Wchar-subscripts -Wformat -Wimplicit-function-dec -Wimplicit-int -Wparentheses -Wsign-compare -Wwrite-strings -Wunused -O6 -mpentiumpro -fomit-frame-pointer -mstack-align-double" CXX=g++ CXXFLAGS="-Wimplicit -Wreturn-type -Wid-clash-51 -Wswitch -Wtrigraphs -Wcomment -W -Wchar-subscripts -Wformat -Wimplicit-function-dec -Wimplicit-int -Wparentheses -Wsign-compare -Wwrite-strings -Woverloaded-virtual -Wextern-inline -Wsign-promo -Wreorder -Wctor-dtor-privacy -Wnon-virtual-dtor -felide-constructors -fno-exceptions -fno-rtti -O6 -fomit-frame-pointer -mpentiumpro -mstack-align-double" ./configure --prefix=/usr/local/mysql --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client --with-mysqld-ldflags=-all-static --with-client-ldflags=-all-static
gmake -j 4
mkdir -p tmp
nm --numeric-sort sql/mysqld > tmp/mysqld.sym
objdump -d sql/mysqld > tmp/mysqld.S
strip sql/mysqld
#! /bin/sh
# Copyright (c) 2002, 2010, Oracle and/or its affiliates.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
path=`dirname $0`
. "$path/SETUP.sh"
extra_flags="$pentium_cflags $debug_cflags $valgrind_flags"
extra_configs="$pentium_configs $debug_configs $valgrind_configs $max_configs"
. "$path/FINISH.sh"
#! /bin/sh
# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
#
# 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
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301, USA
path=`dirname $0`
. "$path/SETUP.sh"
extra_flags="$pentium_cflags $debug_cflags $valgrind_flags"
extra_configs="$pentium_configs $debug_configs $valgrind_configs $max_no_ndb_configs"
. "$path/FINISH.sh"
#! /bin/sh
path=`dirname $0`
. "$path/SETUP.sh"
extra_flags="$pentium64_cflags $fast_cflags"
# On CentOS/Fedora Core 10 amd64, there is system libz.so but not
# libz.a, so need to use bundled zlib when building static
# binary. Hence we use --with-zlib-dir=bundled
extra_configs="$pentium_configs $static_link --with-zlib-dir=bundled"
CC="$CC --pipe"
strip=yes
. "$path/FINISH.sh"
#! /bin/sh
# Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
path=`dirname $0`
. "$path/SETUP.sh"
extra_flags="$pentium64_cflags $debug_cflags"
extra_configs="$pentium_configs $debug_configs $static_link"
extra_configs="$extra_configs "
CC="$CC --pipe"
. "$path/FINISH.sh"
#! /bin/sh
path=`dirname $0`
set -- "$@" --with-debug=full
. "$path/SETUP.sh"
extra_flags="$pentium64_cflags $debug_cflags"
extra_configs="$pentium_configs $debug_configs $all_configs"
extra_configs="$extra_configs "
CC="$CC --pipe"
. "$path/FINISH.sh"
#! /bin/sh
# Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
path=`dirname $0`
. "$path/SETUP.sh"
extra_flags="$pentium64_cflags $debug_cflags"
extra_configs="$pentium_configs $debug_configs $max_configs"
extra_configs="$extra_configs "
CC="$CC --pipe"
. "$path/FINISH.sh"
#! /bin/sh
# Copyright (C) 2007 MySQL AB
# Use is subject to license terms
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
path=`dirname $0`
. "$path/SETUP.sh"
# Need to disable ccache, or we loose the gcov-needed compiler output files.
CCACHE_DISABLE=1
export CCACHE_DISABLE
export LDFLAGS="$gcov_link_flags"
extra_flags="$pentium64_cflags $max_cflags $gcov_compile_flags"
c_warnings="$c_warnings $debug_extra_warnings"
cxx_warnings="$cxx_warnings $debug_extra_warnings"
extra_configs="$pentium_configs $debug_configs $gcov_configs $max_configs --with-zlib-dir=bundled"
. "$path/FINISH.sh"
#! /bin/sh
# Copyright (C) 2007 MySQL AB
# Use is subject to license terms
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
path=`dirname $0`
. "$path/SETUP.sh"
extra_flags="$pentium64_cflags $gprof_compile_flags"
extra_configs="$pentium_configs $max_configs $gprof_link_flags --with-zlib-dir=bundled"
. "$path/FINISH.sh"
#! /bin/sh
# Copyright (C) 2007 MySQL AB
# Use is subject to license terms
#
# 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
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301, USA
path=`dirname $0`
. "$path/SETUP.sh"
extra_flags="$pentium64_cflags $fast_cflags"
# On CentOS/Fedora Core 10 amd64, there is system libz.so but not
# libz.a, so need to use bundled zlib when building static
# binary. Hence we use --with-zlib-dir=bundled
extra_configs="$pentium_configs $max_configs $static_link --with-zlib-dir=bundled"
CC="$CC --pipe"
strip=yes
. "$path/FINISH.sh"
#! /bin/sh
# Copyright (C) 2007 MySQL AB
# Use is subject to license terms
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
path=`dirname $0`
. "$path/SETUP.sh"
extra_flags="$pentium64_cflags $fast_cflags -g"
extra_configs="$pentium_configs $max_configs --with-ndb-sci=/opt/DIS"
. "$path/FINISH.sh"
#! /bin/sh
# Copyright (c) 2005, 2010, Oracle and/or its affiliates.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
path=`dirname $0`
. "$path/SETUP.sh"
extra_flags="$pentium64_cflags $debug_cflags $valgrind_flags"
extra_configs="$pentium_configs $debug_configs $valgrind_configs $max_configs"
. "$path/FINISH.sh"
#! /bin/sh
# Copyright (C) 2004 MySQL AB
# Use is subject to license terms
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
path=`dirname $0`
. "$path/SETUP.sh"
extra_flags="$ppc_cflags $fast_cflags"
extra_configs="$static_link"
strip=yes
. "$path/FINISH.sh"
#! /bin/sh
# Copyright (c) 2004, 2006 MySQL AB
# Use is subject to license terms
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
path=`dirname $0`
. "$path/SETUP.sh"
extra_flags="$ppc_cflags $debug_cflags"
extra_configs="$debug_configs "
extra_configs="$extra_configs"
. "$path/FINISH.sh"
#! /bin/sh
# Copyright (c) 2004-2006 MySQL AB
# Use is subject to license terms
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
path=`dirname $0`
. "$path/SETUP.sh"
extra_flags="$ppc_cflags $debug_cflags"
extra_configs="$debug_configs $max_configs"
. "$path/FINISH.sh"
#! /bin/sh
# Copyright (c) 2005, 2006 MySQL AB
# Use is subject to license terms
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
path=`dirname $0`
. "$path/SETUP.sh"
extra_flags="$ppc_cflags $debug_cflags"
extra_configs="$debug_configs $max_no_ndb_configs"
. "$path/FINISH.sh"
#! /bin/sh
# Copyright (c) 2004-2006 MySQL AB
# Use is subject to license terms
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
path=`dirname $0`
. "$path/SETUP.sh"
extra_flags="$ppc_cflags $fast_cflags -g"
extra_configs="$extra_configs $max_configs"
. "$path/FINISH.sh"
#!/bin/sh
# used for sol10-64 builder in buildbot, don't use it elsewhere
export LDFLAGS='-m64 -lmtmalloc -R/usr/sfw/lib/64'
export CFLAGS='-mtune=i386 -D__sun -m64 -mtune=athlon64'
export CXXFLAGS='-mtune=i386 -D__sun -m64 -mtune=athlon64'
cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DWITH_EXTRA_CHARSETS=complex -DWITH_READLINE=ON -DWITH_SSL=bundled -DWITH_MAX=ON -DWITH_EMBEDDED_SERVER=ON
gmake -j6 VERBOSE=1
#!/bin/sh
# Copyright (C) 2007 MySQL AB
# Use is subject to license terms
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
path=`dirname $0`
. "$path/SETUP.sh"
extra_flags="$amd64_cflags -D__sun -m64 -mtune=athlon64 $debug_cflags"
extra_configs="$amd64_configs $debug_configs $max_configs --with-libevent"
LDFLAGS="-m64 -lmtmalloc -R/usr/sfw/lib/64"
export LDFLAGS
. "$path/FINISH.sh"
#!/bin/sh
path=`dirname $0`
. "$path/SETUP.sh"
# Take only #define options - the others are gcc specific.
# (real fix is for SETUP.sh not to put gcc specific options in $debug_cflags)
DEFS=""
for F in $debug_cflags ; do
expr "$F" : "^-D" && DEFS="$DEFS $F"
done
debug_cflags="-O0 -g $DEFS"
extra_flags="-m64 -mt -D_FORTEC_ -xlibmopt -fns=no $debug_cflags"
extra_configs="$max_configs --with-libevent $debug_configs"
warnings=""
c_warnings=""
cxx_warnings=""
base_cxxflags="-noex"
CC=cc
CFLAGS="-xstrconst"
CXX=CC
LDFLAGS="-lmtmalloc"
. "$path/FINISH.sh"
#!/bin/sh
# Copyright (c) 2007 MySQL AB, 2008 Sun Microsystems, Inc.
# Use is subject to license terms.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# See file compile-solaris-amd64 for basic pre-requisites.
# This build uses the Sun Studio compilers (cc, CC), available from:
# http://developers.sun.com/sunstudio/downloads/index.jsp
# Note that you may want to apply current patches, as the downloaded version
# is typically out of date. Download the PKG version if you intend to patch!
# After installing, add /opt/SUNWspro/bin to your $PATH
gmake -k clean || true
/bin/rm -f */.deps/*.P config.cache
path=`dirname $0`
. "$path/SETUP.sh"
extra_flags="-m64 -fast -mt -D_FORTEC_ -xbuiltin=%all -xlibmil -xlibmopt -fns=no -xprefetch=auto -xprefetch_level=3"
extra_configs="$max_configs --with-libevent"
warnings=""
c_warnings=""
cxx_warnings=""
base_cxxflags="-noex"
CC=cc
CFLAGS="-xstrconst"
CXX=CC
LDFLAGS="-lmtmalloc"
. "$path/FINISH.sh"
#!/bin/sh
# See file compile-solaris-amd64 for basic pre-requisites.
# This build uses the Sun Studio compilers (cc, CC), available from:
# http://developers.sun.com/sunstudio/downloads/index.jsp
# Note that you may want to apply current patches, as the downloaded version
# is typically out of date. Download the PKG version if you intend to patch!
# After installing, add /opt/SUNWspro/bin to your $PATH
gmake -k clean || true
/bin/rm -f */.deps/*.P config.cache
. "$path/SETUP.sh"
extra_flags="-g -m64 -mt -D_FORTEC_ -xbuiltin=%all -xlibmil -xlibmopt -fns=no -xprefetch=auto -xprefetch_level=3"
extra_configs="$max_configs --with-libevent"
warnings=""
c_warnings=""
cxx_warnings=""
base_cxxflags="-noex"
CC=cc
CFLAGS="-xstrconst"
CXX=CC
LDFLAGS="-lmtmalloc"
. "$path/FINISH.sh"
#! /bin/sh
# Copyright (c) 2000-2002, 2005-2007 MySQL AB, 2008 Sun Microsystems, Inc.
# Use is subject to license terms.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
make -k clean || true
/bin/rm -f */.deps/*.P config.cache
# gcc is often in /usr/ccs/bin or /usr/local/bin
PATH=$PATH:/usr/ccs/bin:/usr/local/bin
path=`dirname $0`
. "$path/autorun.sh"
CFLAGS="-g -Wimplicit -Wreturn-type -Wswitch -Wtrigraphs -Wcomment -W -Wchar-subscripts -Wformat -Wparentheses -Wsign-compare -Wwrite-strings -Wunused -O3 -fno-omit-frame-pointer -mcpu=v8 -Wa,-xarch=v8plusa $EXTRA_FLAGS $EXTRA_CFLAGS" CXX=g++ CXXFLAGS="-Wimplicit -Wreturn-type -Wswitch -Wtrigraphs -Wcomment -W -Wchar-subscripts -Wformat -Wparentheses -Wsign-compare -Wwrite-strings -Woverloaded-virtual -Wsign-promo -Wreorder -Wctor-dtor-privacy -Wnon-virtual-dtor -felide-constructors -fno-exceptions -fno-rtti -O3 -fno-omit-frame-pointer -mcpu=v8 -Wa,-xarch=v8plusa -g $EXTRA_FLAGS $EXTRA_CXXFLAGS" LIBS="-lmtmalloc" ./configure --prefix=/usr/local/mysql --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client
make -j 4
#!/bin/sh
make -k clean || true
/bin/rm -f */.deps/*.P config.cache
path=`dirname $0`
. "$path/autorun.sh"
CFLAGS="-g -Wimplicit -Wreturn-type -Wswitch -Wtrigraphs -Wcomment -W -Wchar-subscripts -Wformat -Wparentheses -Wsign-compare -Wwrite-strings -Wunused -O3 -fno-omit-frame-pointer" CXX=g++ CXXFLAGS="-g -Wimplicit -Wreturn-type -Wswitch -Wtrigraphs -Wcomment -W -Wchar-subscripts -Wformat -Wparentheses -Wsign-compare -Wwrite-strings -Woverloaded-virtual -Wsign-promo -Wreorder -Wctor-dtor-privacy -Wnon-virtual-dtor -felide-constructors -fno-exceptions -fno-rtti -O3 -fno-omit-frame-pointer" ./configure --prefix=/usr/local/mysql --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client --with-debug
make -j 4
#! /bin/sh
# Copyright (c) 2001, 2002, 2005, 2007 MySQL AB, 2008 Sun Microsystems, Inc.
# Use is subject to license terms.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# Copyright (c) 2001, 2002, 2005, 2007 MySQL AB, 2008 Sun Microsystems, Inc.
# Use is subject to license terms.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# Assume Forte is installed in /opt/SUNWSpro and ld is installed in
# /usr/ccs/bin
PATH=/opt/SUNWspro/bin:/usr/ccs/bin:/usr/sfw/bin:/opt/csw/bin:$PATH
prefix="/usr/local/mysql"
if test -n "$MYSQL_BUILD_PREFIX"
then
prefix="$MYSQL_BUILD_PREFIX"
fi
make -k maintainer-clean || true
/bin/rm -f */.deps/*.P config.cache
path=`dirname $0`
. "$path/autorun.sh"
# For "optimal" code for this computer add -fast to EXTRA
# To compile 32/64 bit, uncomment/comment EXTRA_64_BIT
EXTRA_64_BIT="-m64"
EXTRA="-fast" # Remove comment to target current machine
#
# The following should not need to be touched
#
STD="-mt -D_FORTEC_ $EXTRA $EXTRA_64_BIT"
CC=cc-5.0 CFLAGS="-Xa -xstrconst $STD" \
CXX=CC CXXFLAGS="-noex $STD" LIBS="-lmtmalloc" \
./configure --prefix=/usr/local/mysql --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client --prefix=$PREFIX
make -j 4
if [ $? = 0 ]
then
make test
fi
#! /bin/sh
mode=""
cxxfilt=""
# For g++ 3.X, the PurifyPlus tools needs a program named "cxxfilt",
# "c++file" or similar. It is part of libtool. If not found, you can
# specify the path to it.
while test $# -gt 0
do
case "$1" in
--debug) EXTRA_CONFIG_FLAGS=--with-debug ;;
--purify) mode=purify ;;
--purecov*) mode=purecov ;;
--quantify) mode=quantify ;;
--cxxfilt) shift ; cxxfilt=$1 ;;
-h | --help )
echo "Usage: $0 [ options ]"
echo "Where the 'options' are"
echo " --help | -h Display this help"
echo " --debug Compile with DBUG enabled"
echo " --purify Only prepare for Purify"
echo " --purecov Only prepare for PureCover"
echo " --quantify Only prepare for Quantify"
echo " --cxxfilt <cxxfilt> Path to cxxfilt/c++filt program"
echo " This program is needed for gcc 3.X"
exit 0 ;;
*) echo "No such option '$1'" ; exit 1 ;;
esac
shift
done
make -k maintainer-clean || true
/bin/rm -f */.deps/*.P config.cache
path=`dirname $0`
. "$path/autorun.sh"
CFLAGS="-g -Wimplicit -Wreturn-type -Wswitch -Wtrigraphs -Wcomment -W -Wchar-subscripts -Wformat -Wimplicit-int -Wparentheses -Wsign-compare -Wwrite-strings -Wunused -DHAVE_valgrind -DEXTRA_DEBUG -O2" CXX=g++ CXXLD=g++ CXXFLAGS="-g -Wimplicit -Wreturn-type -Wswitch -Wtrigraphs -Wcomment -W -Wchar-subscripts -Wformat -Wparentheses -Wsign-compare -Wwrite-strings -Woverloaded-virtual -Wsign-promo -Wreorder -Wctor-dtor-privacy -Wnon-virtual-dtor -felide-constructors -fno-exceptions -fno-rtti -DHAVE_valgrind -DEXTRA_DEBUG -O2" ./configure --prefix=/usr/local/mysql --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client --with-embedded-server --with-innodb $EXTRA_CONFIG_FLAGS
make -j 4
# ----------------------------------------------------------------------
#set -x
purifying_binaries ()
{
while test $1
do
dir=$1
shift
target=$1
shift
binary=$1
shift
opts=""
if [ -n "$cxxfilt" ] ; then
opts="$opts -demangle-program=$cxxfilt"
fi
opts="$opts -best-effort"
back=`pwd`
cd $dir
# Because of libtool magic, the target and binary
# created might not be the same. To trigger rebuild,
# we need to move them both.
mv $binary $binary-old
if [ -f $target ] ; then
mv $target $target-old
fi
if [ -n "$mode" -a $mode = purify ] ; then
make CCLD="purify $opts gcc" CXXLD="purify $opts g++" $target
mv $binary $binary-purify
fi
if [ -n "$mode" -a $mode = quantify ] ; then
make CCLD="quantify $opts gcc" CXXLD="quantify $opts g++" $target
mv $binary $binary-quantify
fi
if [ -n "$mode" -a $mode = purecov ] ; then
make CCLD="purecov $opts gcc" CXXLD="purecov $opts g++" $target
mv $binary $binary-purecov
fi
mv $binary-old $binary
if [ -f $target-old ] ; then
mv $target-old $target
fi
cd $back
done
}
purifying_binaries \
sql mysqld mysqld \
client mysqltest .libs/mysqltest \
tests mysql_client_test mysql_client_test \
libmysqld/examples mysqltest_embedded mysqltest_embedded \
libmysqld/examples mysql_client_test_embedded mysql_client_test_embedded
# ----------------------------------------------------------------------
#!/bin/sh
path=`dirname $0`
. "$path/SETUP.sh"
extra_flags="-D__sun -m32"
extra_configs="$max_configs --with-libevent"
LDFLAGS="-lmtmalloc -R/usr/sfw/lib"
export LDFLAGS
. "$path/FINISH.sh"
#!/bin/sh
path=`dirname $0`
. "$path/SETUP.sh"
extra_flags="-D__sun -m32 $debug_cflags"
extra_configs="$max_configs --with-libevent $debug_configs"
LDFLAGS="-lmtmalloc -R/usr/sfw/lib"
export LDFLAGS
. "$path/FINISH.sh"
#!/bin/sh
path=`dirname $0`
. "$path/SETUP.sh"
# Take only #define options - the others are gcc specific.
# (real fix is for SETUP.sh not to put gcc specific options in $debug_cflags)
DEFS=""
for F in $debug_cflags ; do
expr "$F" : "^-D" && DEFS="$DEFS $F"
done
debug_cflags="-O0 -g $DEFS"
extra_flags="-m32 -mt -D_FORTEC_ -xbuiltin=%all -xlibmil -xlibmopt -fns=no -xprefetch=auto -xprefetch_level=3 $debug_cflags"
extra_configs="$max_configs --with-libevent $debug_configs"
warnings=""
c_warnings=""
cxx_warnings=""
base_cxxflags="-noex"
CC=cc
CFLAGS="-xstrconst"
CXX=CC
LDFLAGS="-lmtmalloc"
. "$path/FINISH.sh"
#!/bin/sh
path=`dirname $0`
. "$path/SETUP.sh"
extra_flags="-m32 -mt -D_FORTEC_ -xbuiltin=%all -xlibmil -xlibmopt -fns=no -xprefetch=auto -xprefetch_level=3"
extra_configs="$max_configs --with-libevent"
warnings=""
c_warnings=""
cxx_warnings=""
base_cxxflags="-noex"
CC=cc
CFLAGS="-xstrconst"
CXX=CC
LDFLAGS="-lmtmalloc"
. "$path/FINISH.sh"
# MariaDB SQL server.
# Copyright (C) 2010 Kristian Nielsen and Monty Program AB
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Setting cpu options.
get_cpuopt () {
case "$(uname -o)" in
*Linux*)
case "$(gcc -dumpmachine)" in
x86_64-*)
# gcc barfs on -march=... on x64
CPUOPT="-m64 -mtune=generic"
;;
*)
# we'd use i586 to not trip up mobile/lowpower devices
CPUOPT="-m32 -march=i586 -mtune=generic"
;;
esac
;;
*Solaris*)
# ToDo: handle 32-bit build? For now default to 64-bit.
CPUOPT="-D__sun -m64 -mtune=athlon64"
;;
esac
return 0
}
# Default to a parallel build, but only if AM_MAKEFLAGS is not set.
# (So buildbots can easily disable this behaviour if required.)
get_make_parallel_flag () {
if test -z "$AM_MAKEFLAGS"
then
AM_MAKEFLAGS="-j 6"
fi
return 0
}
......@@ -21,9 +21,9 @@ ha_connect.cc connect.cc user_connect.cc mycat.cc
fmdlex.c osutil.c plugutil.c rcmsg.c rcmsg.h
array.cpp blkfil.cpp colblk.cpp csort.cpp
filamap.cpp filamdbf.cpp filamfix.cpp filamtxt.cpp filamvct.cpp filamzip.cpp
filter.cpp json.cpp maputil.cpp myutil.cpp plgdbutl.cpp reldef.cpp tabcol.cpp
tabdos.cpp tabfix.cpp tabfmt.cpp tabjson.cpp table.cpp tabmul.cpp taboccur.cpp
tabpivot.cpp tabsys.cpp tabtbl.cpp tabutil.cpp tabvct.cpp tabvir.cpp
filter.cpp json.cpp jasonudf.cpp maputil.cpp myutil.cpp plgdbutl.cpp reldef.cpp
tabcol.cpp tabdos.cpp tabfix.cpp tabfmt.cpp tabjson.cpp table.cpp tabmul.cpp
taboccur.cpp tabpivot.cpp tabsys.cpp tabtbl.cpp tabutil.cpp tabvct.cpp tabvir.cpp
tabxcl.cpp valblk.cpp value.cpp xindex.cpp xobject.cpp
array.h blkfil.h block.h catalog.h checklvl.h colblk.h connect.h csort.h
......
......@@ -2866,7 +2866,7 @@ const COND *ha_connect::cond_push(const COND *cond)
} else if (x && cond)
tdbp->SetCondFil(filp); // Wrong filter
} else
} else if (tty != TYPE_AM_JSN && tty != TYPE_AM_JSON)
tdbp->SetFilter(CondFilter(g, (Item *)cond));
fin:
......@@ -5370,9 +5370,10 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd,
for (crp= qrp->Colresp; crp; crp= crp->Next)
switch (crp->Fld) {
case FLD_NAME:
if (ttp == TAB_CSV && topt->data_charset &&
if (ttp == TAB_PRX ||
(ttp == TAB_CSV && topt->data_charset &&
(!stricmp(topt->data_charset, "UTF8") ||
!stricmp(topt->data_charset, "UTF-8")))
!stricmp(topt->data_charset, "UTF-8"))))
cnm= crp->Kdata->GetCharValue(i);
else
cnm= encode(g, crp->Kdata->GetCharValue(i));
......
......@@ -505,8 +505,11 @@ PSZ Serialize(PGLOBAL g, PJSON jsp, FILE *fs, int pretty)
err = (b && jp->WriteChr('\t'));
err |= SerializeObject(jp, (PJOB)jsp);
break;
case TYPE_JVAL:
err = SerializeValue(jp, (PJVAL)jsp);
break;
default:
strcpy(g->Message, "json tree is not an Array or an Object");
strcpy(g->Message, "Invalid json tree");
} // endswitch Type
if (fs) {
......@@ -1056,3 +1059,27 @@ PSZ JVALUE::GetString(void)
return (Value) ? Value->GetCharString(buf) : NULL;
} // end of GetString
/***********************************************************************/
/* Set the Value's value as the given integer. */
/***********************************************************************/
void JVALUE::SetInteger(PGLOBAL g, int n)
{
Value = AllocateValue(g, &n, TYPE_INT);
} // end of AddInteger
/***********************************************************************/
/* Set the Value's value as the given DOUBLE. */
/***********************************************************************/
void JVALUE::SetFloat(PGLOBAL g, double f)
{
Value = AllocateValue(g, &f, TYPE_DOUBLE, 6);
} // end of AddFloat
/***********************************************************************/
/* Set the Value's value as the given string. */
/***********************************************************************/
void JVALUE::SetString(PGLOBAL g, PSZ s)
{
Value = AllocateValue(g, s, TYPE_STRING);
} // end of AddFloat
......@@ -157,6 +157,9 @@ class JSON : public BLOCK {
virtual void SetValue(PGLOBAL g, PJVAL jvp, PSZ key) {X}
virtual void SetValue(PVAL valp) {X}
virtual void SetValue(PJSON jsp) {X}
virtual void SetString(PGLOBAL g, PSZ s) {X}
virtual void SetInteger(PGLOBAL g, int n) {X}
virtual void SetFloat(PGLOBAL g, double f) {X}
virtual bool DeleteValue(int i) {X return true;}
protected:
......@@ -243,6 +246,9 @@ class JVALUE : public JSON {
virtual PSZ GetString(void);
virtual void SetValue(PVAL valp) {Value = valp;}
virtual void SetValue(PJSON jsp) {Jsp = jsp;}
virtual void SetString(PGLOBAL g, PSZ s);
virtual void SetInteger(PGLOBAL g, int n);
virtual void SetFloat(PGLOBAL g, double f);
protected:
PJSON Jsp; // To the json value
......
/************* jsonudf C++ Program Source Code File (.CPP) *************/
/* PROGRAM NAME: jsonudf Version 1.0 */
/* (C) Copyright to the author Olivier BERTRAND 2015 */
/* This program are the JSON User Defined Functions . */
/***********************************************************************/
/***********************************************************************/
/* Include relevant sections of the MariaDB header file. */
/***********************************************************************/
#include <my_global.h>
#include <mysql.h>
#include "global.h"
#include "plgdbsem.h"
#include "json.h"
extern "C" {
DllExport my_bool Json_Value_init(UDF_INIT*, UDF_ARGS*, char*);
DllExport char *Json_Value(UDF_INIT*, UDF_ARGS*, char*,
unsigned long*, char *, char *);
DllExport void Json_Value_deinit(UDF_INIT*);
DllExport my_bool Json_Array_init(UDF_INIT*, UDF_ARGS*, char*);
DllExport char *Json_Array(UDF_INIT*, UDF_ARGS*, char*,
unsigned long*, char *, char *);
DllExport void Json_Array_deinit(UDF_INIT*);
DllExport my_bool Json_Object_init(UDF_INIT*, UDF_ARGS*, char*);
DllExport char *Json_Object(UDF_INIT*, UDF_ARGS*, char*,
unsigned long*, char *, char *);
DllExport void Json_Object_deinit(UDF_INIT*);
DllExport my_bool Json_Array_Grp_init(UDF_INIT*, UDF_ARGS*, char*);
DllExport void Json_Array_Grp_add(UDF_INIT *, UDF_ARGS *, char *, char *);
DllExport char *Json_Array_Grp(UDF_INIT*, UDF_ARGS*, char*,
unsigned long*, char *, char *);
DllExport void Json_Array_Grp_clear(UDF_INIT *, char *, char *);
DllExport void Json_Array_Grp_deinit(UDF_INIT*);
DllExport my_bool Json_Object_Grp_init(UDF_INIT*, UDF_ARGS*, char*);
DllExport void Json_Object_Grp_add(UDF_INIT *, UDF_ARGS *, char *, char *);
DllExport char *Json_Object_Grp(UDF_INIT*, UDF_ARGS*, char*,
unsigned long*, char *, char *);
DllExport void Json_Object_Grp_clear(UDF_INIT *, char *, char *);
DllExport void Json_Object_Grp_deinit(UDF_INIT*);
} // extern "C"
/***********************************************************************/
/* Allocate and initialise the memory area. */
/***********************************************************************/
my_bool JsonInit(UDF_INIT *initid, char *message, unsigned long len)
{
PGLOBAL g = PlugInit(NULL, len);
if (!g) {
strcpy(message, "Allocation error");
return true;
} else if (g->Sarea_Size == 0) {
strcpy(message, g->Message);
PlugExit(g);
return true;
} else
initid->ptr = (char*)g;
initid->maybe_null = false;
initid->max_length = len - 512;
return false;
} // end of Json_Object_init
/***********************************************************************/
/* Returns true if the argument is a JSON string. */
/***********************************************************************/
static my_bool IsJson(UDF_ARGS *args, int i)
{
return (args->arg_type[i] == STRING_RESULT &&
!strnicmp(args->attributes[i], "Json_", 5));
} // end of IsJson
/***********************************************************************/
/* Make a zero terminated string from the passed argument. */
/***********************************************************************/
static PSZ MakePSZ(PGLOBAL g, UDF_ARGS *args, int i)
{
if (args->args[i]) {
int n = args->lengths[i];
PSZ s = (PSZ)PlugSubAlloc(g, NULL, n + 1);
memcpy(s, args->args[i], n);
s[n] = 0;
return s;
} else
return NULL;
} // end of MakePSZ
/***********************************************************************/
/* Make a valid key from the passed argument. */
/***********************************************************************/
static PSZ MakeKey(PGLOBAL g, UDF_ARGS *args, int i)
{
int n = args->attribute_lengths[i];
bool b; // true if attribute is zero terminated
PSZ p, s = args->attributes[i];
if (s && *s && (n || *s == '\'')) {
if ((b = (!n || !s[n])))
n = strlen(s);
if (n > 5 && IsJson(args, i)) {
s += 5;
n -= 5;
} else if (*s == '\'' && s[n-1] == '\'') {
s++;
n -= 2;
b = false;
} // endif *s
if (n < 1)
return "Key";
if (!b) {
p = (PSZ)PlugSubAlloc(g, NULL, n + 1);
memcpy(p, s, n);
p[n] = 0;
s = p;
} // endif b
} // endif s
return s;
} // end of MakeKey
/***********************************************************************/
/* Make a JSON value from the passed argument. */
/***********************************************************************/
static PJVAL MakeValue(PGLOBAL g, UDF_ARGS *args, int i)
{
char *str;
PJVAL jvp = new(g) JVALUE;
switch (args->arg_type[i]) {
case STRING_RESULT:
if ((str = MakePSZ(g, args, i))) {
if (IsJson(args, i))
jvp->SetValue(ParseJson(g, str, strlen(str), 0));
else
jvp->SetString(g, str);
} // endif str
break;
case INT_RESULT:
jvp->SetInteger(g, *(int*)args->args[i]);
break;
case REAL_RESULT:
jvp->SetFloat(g, *(double*)args->args[i]);
break;
case DECIMAL_RESULT:
jvp->SetFloat(g, atof(MakePSZ(g, args, i)));
break;
case TIME_RESULT:
case ROW_RESULT:
case IMPOSSIBLE_RESULT:
default:
break;
} // endswitch arg_type
return jvp;
} // end of MakeValue
/***********************************************************************/
/* Make a Json value containing the parameter. */
/***********************************************************************/
my_bool Json_Value_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
{
if (args->arg_count > 1) {
strcpy(message, "Json_Value cannot accept more than 1 argument");
return true;
} // endif arg_count
return JsonInit(initid, message, 1024);
} // end of Json_Value_init
char *Json_Value(UDF_INIT *initid, UDF_ARGS *args, char *result,
unsigned long *res_length, char *is_null, char *error)
{
char *str;
PJVAL jvp;
PGLOBAL g = (PGLOBAL)initid->ptr;
PlugSubSet(g, g->Sarea, g->Sarea_Size);
jvp = MakeValue(g, args, 0);
if (!(str = Serialize(g, jvp, NULL, 0)))
str = strcpy(result, g->Message);
*res_length = strlen(str);
return str;
} // end of Json_Value
void Json_Value_deinit(UDF_INIT* initid)
{
PlugExit((PGLOBAL)initid->ptr);
} // end of Json_Value_deinit
/***********************************************************************/
/* Make a Json array containing all the parameters. */
/***********************************************************************/
my_bool Json_Array_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
{
return JsonInit(initid, message, 8192);
} // end of Json_Array_init
char *Json_Array(UDF_INIT *initid, UDF_ARGS *args, char *result,
unsigned long *res_length, char *is_null, char *error)
{
char *str;
uint i;
PJAR arp;
PGLOBAL g = (PGLOBAL)initid->ptr;
PlugSubSet(g, g->Sarea, g->Sarea_Size);
arp = new(g) JARRAY;
for (i = 0; i < args->arg_count; i++)
arp->AddValue(g, MakeValue(g, args, i));
arp->InitArray(g);
if (!(str = Serialize(g, arp, NULL, 0)))
str = strcpy(result, g->Message);
*res_length = strlen(str);
return str;
} // end of Json_Array
void Json_Array_deinit(UDF_INIT* initid)
{
PlugExit((PGLOBAL)initid->ptr);
} // end of Json_Array_deinit
/***********************************************************************/
/* Make a Json Oject containing all the parameters. */
/***********************************************************************/
my_bool Json_Object_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
{
return JsonInit(initid, message, 8192);
} // end of Json_Object_init
char *Json_Object(UDF_INIT *initid, UDF_ARGS *args, char *result,
unsigned long *res_length, char *is_null, char *error)
{
char *str;
uint i;
PJOB objp;
PGLOBAL g = (PGLOBAL)initid->ptr;
PlugSubSet(g, g->Sarea, g->Sarea_Size);
objp = new(g) JOBJECT;
for (i = 0; i < args->arg_count; i++)
objp->SetValue(g, MakeValue(g, args, i), MakeKey(g, args, i));
if (!(str = Serialize(g, objp, NULL, 0)))
str = strcpy(result, g->Message);
*res_length = strlen(str);
return str;
} // end of Json_Object
void Json_Object_deinit(UDF_INIT* initid)
{
PlugExit((PGLOBAL)initid->ptr);
} // end of Json_Object_deinit
/***********************************************************************/
/* Make a Json array from values comming from rows. */
/***********************************************************************/
my_bool Json_Array_Grp_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
{
if (args->arg_count != 1) {
strcpy(message, "Json_Array_Grp can only accept 1 argument");
return true;
} else if (JsonInit(initid, message, 16384))
return true;
PGLOBAL g = (PGLOBAL)initid->ptr;
PlugSubSet(g, g->Sarea, g->Sarea_Size);
g->Activityp = (PACTIVITY)new(g) JARRAY;
return false;
} // end of Json_Array_Grp_init
void Json_Array_Grp_add(UDF_INIT *initid, UDF_ARGS *args,
char *is_null, char *error)
{
PGLOBAL g = (PGLOBAL)initid->ptr;
PJAR arp = (PJAR)g->Activityp;
arp->AddValue(g, MakeValue(g, args, 0));
} // end of Json_Array_Grp_add
char *Json_Array_Grp(UDF_INIT *initid, UDF_ARGS *args, char *result,
unsigned long *res_length, char *is_null, char *error)
{
char *str;
PGLOBAL g = (PGLOBAL)initid->ptr;
PJAR arp = (PJAR)g->Activityp;
arp->InitArray(g);
if (!(str = Serialize(g, arp, NULL, 0)))
str = strcpy(result, g->Message);
*res_length = strlen(str);
return str;
} // end of Json_Array_Grp
void Json_Array_Grp_clear(UDF_INIT *initid, char *is_null, char *error)
{
PGLOBAL g = (PGLOBAL)initid->ptr;
PlugSubSet(g, g->Sarea, g->Sarea_Size);
g->Activityp = (PACTIVITY)new(g) JARRAY;
} // end of Json_Array_Grp_clear
void Json_Array_Grp_deinit(UDF_INIT* initid)
{
PlugExit((PGLOBAL)initid->ptr);
} // end of Json_Array_Grp_deinit
/***********************************************************************/
/* Make a Json object from values comming from rows. */
/***********************************************************************/
my_bool Json_Object_Grp_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
{
if (args->arg_count != 2) {
strcpy(message, "Json_Array_Grp can only accept 2 argument");
return true;
} else if (JsonInit(initid, message, 16384))
return true;
PGLOBAL g = (PGLOBAL)initid->ptr;
PlugSubSet(g, g->Sarea, g->Sarea_Size);
g->Activityp = (PACTIVITY)new(g) JOBJECT;
return false;
} // end of Json_Object_Grp_init
void Json_Object_Grp_add(UDF_INIT *initid, UDF_ARGS *args,
char *is_null, char *error)
{
PGLOBAL g = (PGLOBAL)initid->ptr;
PJOB objp = (PJOB)g->Activityp;
objp->SetValue(g, MakeValue(g, args, 0), MakePSZ(g, args, 1));
} // end of Json_Object_Grp_add
char *Json_Object_Grp(UDF_INIT *initid, UDF_ARGS *args, char *result,
unsigned long *res_length, char *is_null, char *error)
{
char *str;
PGLOBAL g = (PGLOBAL)initid->ptr;
PJOB objp = (PJOB)g->Activityp;
if (!(str = Serialize(g, objp, NULL, 0)))
str = strcpy(result, g->Message);
*res_length = strlen(str);
return str;
} // end of Json_Object_Grp
void Json_Object_Grp_clear(UDF_INIT *initid, char *is_null, char *error)
{
PGLOBAL g = (PGLOBAL)initid->ptr;
PlugSubSet(g, g->Sarea, g->Sarea_Size);
g->Activityp = (PACTIVITY)new(g) JOBJECT;
} // end of Json_Object_Grp_clear
void Json_Object_Grp_deinit(UDF_INIT* initid)
{
PlugExit((PGLOBAL)initid->ptr);
} // end of Json_Object_Grp_deinit
......@@ -387,7 +387,7 @@ bool JSONCOL::CheckExpand(PGLOBAL g, int i, PSZ nm, bool b)
if ((Tjp->Xcol && nm && !strcmp(nm, Tjp->Xcol) &&
(Tjp->Xval < 0 || Tjp->Xval == i)) || Xpd) {
Xpd = true; // Expandable object
Nodes[i].Op = OP_XX;
Nodes[i].Op = OP_EXP;
} else if (b) {
strcpy(g->Message, "Cannot expand more than one branch");
return true;
......@@ -426,7 +426,7 @@ bool JSONCOL::SetArrayOptions(PGLOBAL g, char *p, int i, PSZ nm)
// Default specifications
if (CheckExpand(g, i, nm, false))
return true;
else if (jnp->Op != OP_XX)
else if (jnp->Op != OP_EXP)
if (!Value->IsTypeNum()) {
jnp->CncVal = AllocateValue(g, (void*)", ", TYPE_STRING);
jnp->Op = OP_CNC;
......@@ -448,13 +448,13 @@ bool JSONCOL::SetArrayOptions(PGLOBAL g, char *p, int i, PSZ nm)
case '*': jnp->Op = OP_MULT; break;
case '>': jnp->Op = OP_MAX; break;
case '<': jnp->Op = OP_MIN; break;
case '#': jnp->Op = OP_NUM; break;
case '!': jnp->Op = OP_SEP; break; // Average
case '#': jnp->Op = OP_NUM; break;
case 'x':
case 'X': // Expand this array
if (!Tjp->Xcol && nm) {
Xpd = true;
jnp->Op = OP_XX;
jnp->Op = OP_EXP;
Tjp->Xval = i;
Tjp->Xcol = nm;
} else if (CheckExpand(g, i, nm, true))
......@@ -557,6 +557,9 @@ bool JSONCOL::ParseJpath(PGLOBAL g)
if (SetArrayOptions(g, p, i, Nodes[i-1].Key))
return true;
} else if (*p == '*') {
// Return JSON
Nodes[i].Op = OP_XX;
} else {
Nodes[i].Key = p;
Nodes[i].Op = OP_EXIST;
......@@ -569,6 +572,20 @@ bool JSONCOL::ParseJpath(PGLOBAL g)
return false;
} // end of ParseJpath
/***********************************************************************/
/* MakeJson: Serialize the json item and set value to it. */
/***********************************************************************/
PVAL JSONCOL::MakeJson(PGLOBAL g, PJSON jsp)
{
if (Value->IsTypeNum()) {
strcpy(g->Message, "Cannot make Json for a numeric column");
Value->Reset();
} else
Value->SetValue_psz(Serialize(g, jsp, NULL, 0));
return Value;
} // end of MakeJson
/***********************************************************************/
/* SetValue: Set a value from a JVALUE contains. */
/***********************************************************************/
......@@ -622,16 +639,16 @@ void JSONCOL::ReadColumn(PGLOBAL g)
PVAL JSONCOL::GetColumnValue(PGLOBAL g, PJSON row, int i)
{
int n = Nod - 1;
int nextsame = 0;
bool expd = false;
PJAR arp;
PJVAL val = NULL;
//for (; i < Nod-1 && row; i++) {
for (; i < Nod && row; i++) {
if (Nodes[i].Op == OP_NUM) {
Value->SetValue(row->GetType() == TYPE_JAR ? row->size() : 1);
return(Value);
} else if (Nodes[i].Op == OP_XX) {
return MakeJson(g, row);
} else switch (row->GetType()) {
case TYPE_JOB:
if (!Nodes[i].Key) {
......@@ -652,7 +669,7 @@ PVAL JSONCOL::GetColumnValue(PGLOBAL g, PJSON row, int i)
if (Nodes[i].Op != OP_NULL) {
if (Nodes[i].Rank) {
val = arp->GetValue(Nodes[i].Rank - 1);
} else if (Nodes[i].Op == OP_XX) {
} else if (Nodes[i].Op == OP_EXP) {
return ExpandArray(g, arp, i);
} else
return CalculateArray(g, arp, i);
......@@ -694,7 +711,11 @@ PVAL JSONCOL::ExpandArray(PGLOBAL g, PJAR arp, int n)
JVALUE jval;
ars = MY_MIN(Tjp->Limit, arp->size());
jvp = arp->GetValue(Nodes[n].Nx);
if (!(jvp = arp->GetValue(Nodes[n].Nx))) {
strcpy(g->Message, "Logical error expanding array");
longjmp(g->jumper[g->jump_level], 666);
} // endif jvp
if (n < Nod - 1 && jvp->GetJson()) {
jval.SetValue(GetColumnValue(g, jvp->GetJson(), n + 1));
......@@ -720,63 +741,68 @@ PVAL JSONCOL::ExpandArray(PGLOBAL g, PJAR arp, int n)
/***********************************************************************/
PVAL JSONCOL::CalculateArray(PGLOBAL g, PJAR arp, int n)
{
int i, ars;
int i, ars, nv = 0, nextsame = Tjp->NextSame;
bool err;
OPVAL op = Nodes[n].Op;
PVAL val[2], vp = Nodes[n].Valp;
PJVAL jvp;
PJVAL jvrp, jvp;
JVALUE jval;
vp->Reset();
ars = MY_MIN(Tjp->Limit, arp->size());
for (i = 0; i < ars; i++) {
jvp = arp->GetValue(i);
jvrp = arp->GetValue(i);
if (n < Nod - 1 && jvp->GetJson()) {
jval.SetValue(GetColumnValue(g, jvp->GetJson(), n + 1));
jvp = &jval;
} // endif n
if (!i) {
SetJsonValue(g, vp, jvp, n);
continue;
} else
SetJsonValue(g, MulVal, jvp, n);
if (!MulVal->IsZero()) {
switch (op) {
case OP_CNC:
if (Nodes[n].CncVal) {
val[0] = Nodes[n].CncVal;
do {
if (n < Nod - 1 && jvrp->GetJson()) {
Tjp->NextSame = nextsame;
jval.SetValue(GetColumnValue(g, jvrp->GetJson(), n + 1));
jvp = &jval;
} else
jvp = jvrp;
if (!nv++) {
SetJsonValue(g, vp, jvp, n);
continue;
} else
SetJsonValue(g, MulVal, jvp, n);
if (!MulVal->IsZero()) {
switch (op) {
case OP_CNC:
if (Nodes[n].CncVal) {
val[0] = Nodes[n].CncVal;
err = vp->Compute(g, val, 1, op);
} // endif CncVal
val[0] = MulVal;
err = vp->Compute(g, val, 1, op);
} // endif CncVal
val[0] = MulVal;
err = vp->Compute(g, val, 1, op);
break;
case OP_NUM:
case OP_SEP:
val[0] = Nodes[n].Valp;
val[1] = MulVal;
err = vp->Compute(g, val, 2, OP_ADD);
break;
default:
val[0] = Nodes[n].Valp;
val[1] = MulVal;
err = vp->Compute(g, val, 2, op);
} // endswitch Op
if (err)
vp->Reset();
break;
// case OP_NUM:
case OP_SEP:
val[0] = Nodes[n].Valp;
val[1] = MulVal;
err = vp->Compute(g, val, 2, OP_ADD);
break;
default:
val[0] = Nodes[n].Valp;
val[1] = MulVal;
err = vp->Compute(g, val, 2, op);
} // endswitch Op
if (err)
vp->Reset();
} // endif Zero
} // endif Zero
} while (Tjp->NextSame > nextsame);
} // endfor i
if (op == OP_SEP) {
// Calculate average
MulVal->SetValue(ars);
MulVal->SetValue(nv);
val[0] = vp;
val[1] = MulVal;
......@@ -785,6 +811,7 @@ PVAL JSONCOL::CalculateArray(PGLOBAL g, PJAR arp, int n)
} // endif Op
Tjp->NextSame = nextsame;
return vp;
} // end of CalculateArray
......@@ -838,12 +865,13 @@ PJSON JSONCOL::GetRow(PGLOBAL g)
} else {
// Construct missing objects
for (i++; row && i < Nod; i++) {
if (!Nodes[i].Key) {
if (Nodes[i].Op == OP_XX)
break;
else if (!Nodes[i].Key)
// Construct intermediate array
nwr = new(g) JARRAY;
} else {
else
nwr = new(g) JOBJECT;
} // endif Nodes
if (row->GetType() == TYPE_JOB) {
((PJOB)row)->SetValue(g, new(g) JVALUE(nwr), Nodes[i-1].Key);
......@@ -883,10 +911,11 @@ void JSONCOL::WriteColumn(PGLOBAL g)
if (Value->IsNull() && Tjp->Mode == MODE_INSERT)
return;
char *s;
PJOB objp = NULL;
PJAR arp = NULL;
PJVAL jvp = NULL;
PJSON row = GetRow(g);
PJSON jsp, row = GetRow(g);
JTYP type = row->GetType();
switch (row->GetType()) {
......@@ -898,6 +927,24 @@ void JSONCOL::WriteColumn(PGLOBAL g)
if (row) switch (Buf_Type) {
case TYPE_STRING:
if (Nodes[Nod-1].Op == OP_XX) {
s = Value->GetCharValue();
jsp = ParseJson(g, s, (int)strlen(s), 0);
if (arp) {
arp->AddValue(g, new(g) JVALUE(jsp));
arp->InitArray(g);
} else if (objp) {
if (Nod > 1 && Nodes[Nod-2].Key)
objp->SetValue(g, new(g) JVALUE(jsp), Nodes[Nod-2].Key);
} else if (jvp)
jvp->SetValue(jsp);
break;
} // endif Op
// Passthru
case TYPE_DATE:
case TYPE_INT:
case TYPE_DOUBLE:
......@@ -1319,9 +1366,10 @@ int TDBJSON::WriteDB(PGLOBAL g)
return RC_FX;
} else { // if (Jmode == MODE_VALUE)
if (Mode == MODE_INSERT)
if (Mode == MODE_INSERT) {
Doc->AddValue(g, (PJVAL)Row);
else if (Doc->SetValue(g, (PJVAL)Row, Fpos))
Row = new(g) JVALUE;
} else if (Doc->SetValue(g, (PJVAL)Row, Fpos))
return RC_FX;
} // endif Jmode
......
......@@ -15,9 +15,6 @@ enum JMODE {MODE_OBJECT, MODE_ARRAY, MODE_VALUE};
typedef class JSONDEF *PJDEF;
typedef class TDBJSON *PJTDB;
typedef class JSONCOL *PJCOL;
typedef class JARLST *PJARS;
class TDBJSN;
/***********************************************************************/
/* The JSON tree node. Can be an Object or an Array. */
......@@ -133,9 +130,10 @@ class JSONCOL : public DOSCOL {
protected:
bool CheckExpand(PGLOBAL g, int i, PSZ nm, bool b);
bool SetArrayOptions(PGLOBAL g, char *p, int i, PSZ nm);
PVAL GetColumnValue(PGLOBAL g, PJSON row, int i);
PVAL ExpandArray(PGLOBAL g, PJAR arp, int n);
PVAL CalculateArray(PGLOBAL g, PJAR arp, int n);
PVAL GetColumnValue(PGLOBAL g, PJSON row, int i);
PVAL ExpandArray(PGLOBAL g, PJAR arp, int n);
PVAL CalculateArray(PGLOBAL g, PJAR arp, int n);
PVAL MakeJson(PGLOBAL g, PJSON jsp);
void SetJsonValue(PGLOBAL g, PVAL vp, PJVAL val, int n);
PJSON GetRow(PGLOBAL g);
......
......@@ -670,6 +670,22 @@ PRXCOL::PRXCOL(PRXCOL *col1, PTDB tdbp) : COLBLK(col1, tdbp)
Colnum = col1->Colnum;
} // end of PRXCOL copy constructor
/***********************************************************************/
/* Convert an UTF-8 name to latin characters. */
/***********************************************************************/
char *PRXCOL::Decode(PGLOBAL g, const char *cnm)
{
char *buf= (char*)PlugSubAlloc(g, NULL, strlen(cnm) + 1);
uint dummy_errors;
uint32 len= copy_and_convert(buf, strlen(cnm) + 1,
&my_charset_latin1,
cnm, strlen(cnm),
&my_charset_utf8_general_ci,
&dummy_errors);
buf[len]= '\0';
return buf;
} // end of Decode
/***********************************************************************/
/* PRXCOL initialization routine. */
/* Look for the matching column in the object table. */
......@@ -685,6 +701,9 @@ bool PRXCOL::Init(PGLOBAL g, PTDBASE tp)
if (Colp) {
MODE mode = To_Tdb->GetMode();
// Needed for MYSQL subtables
((XCOLBLK*)Colp)->Name = Decode(g, Colp->GetName());
// May not have been done elsewhere
Colp->InitValue(g);
To_Val = Colp->GetValue();
......
......@@ -118,6 +118,8 @@ class DllExport PRXCOL : public COLBLK {
virtual bool Init(PGLOBAL g, PTDBASE tp);
protected:
char *PRXCOL::Decode(PGLOBAL g, const char *cnm);
// Default constructor not to be used
PRXCOL(void) {}
......@@ -145,4 +147,8 @@ class TDBTBC : public TDBCAT {
PSZ Tab; // Table name
}; // end of class TDBMCL
class XCOLBLK : public COLBLK {
friend class PRXCOL;
}; // end of class XCOLBLK
#endif // TABUTIL
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