mirror of
https://github.com/MariaDB/server.git
synced 2025-01-31 19:11:46 +01:00
Auto-merge from mysql-trunk.
This commit is contained in:
commit
1f8b769d95
2438 changed files with 594363 additions and 231591 deletions
10
.bzrignore
10
.bzrignore
|
@ -392,6 +392,7 @@ client/rpl_record_old.h
|
|||
client/rpl_tblmap.h
|
||||
client/rpl_tblmap.cc
|
||||
client/rpl_utility.h
|
||||
client/rpl_utility.cc
|
||||
client/select_test
|
||||
client/sql_string.cpp
|
||||
client/ssl_test
|
||||
|
@ -1143,6 +1144,7 @@ libmysqld/rpl_handler.cc
|
|||
libmysqld/rpl_injector.cc
|
||||
libmysqld/rpl_record.cc
|
||||
libmysqld/rpl_record_old.cc
|
||||
libmysqld/rpl_utility.cc
|
||||
libmysqld/scheduler.cc
|
||||
libmysqld/set_var.cc
|
||||
libmysqld/simple-test
|
||||
|
@ -3070,3 +3072,11 @@ libmysqld/rpl_handler.cc
|
|||
libmysqld/debug_sync.cc
|
||||
libmysqld/rpl_handler.cc
|
||||
dbug/tests
|
||||
libmysqld/mdl.cc
|
||||
client/transaction.h
|
||||
libmysqld/transaction.cc
|
||||
libmysqld/sys_vars.cc
|
||||
libmysqld/keycaches.cc
|
||||
client/dtoa.c
|
||||
libmysqld/sql_audit.cc
|
||||
configure.am
|
||||
|
|
243
BUILD-CMAKE
Normal file
243
BUILD-CMAKE
Normal file
|
@ -0,0 +1,243 @@
|
|||
How to Build MySQL server with CMake
|
||||
|
||||
WHAT YOU NEED
|
||||
---------------------------------------------------------------
|
||||
CMake version 2.6 or later installed on your system.
|
||||
|
||||
HOW TO INSTALL:
|
||||
|
||||
Linux distributions:
|
||||
shell> sudo apt-get install cmake
|
||||
|
||||
The above works on do Debian/Ubuntu based distributions.On others, command
|
||||
line needs to be modified to e.g "yum install" on Fedora or "zypper install"
|
||||
on OpenSUSE.
|
||||
|
||||
OpenSolaris:
|
||||
shell> pfexec pkgadd install SUNWcmake
|
||||
|
||||
Windows and Mac OSX:
|
||||
Download and install the latest distribution from
|
||||
http://www.cmake.org/cmake/resources/software.html.On Windows, download
|
||||
installer exe file and run it. On Mac, download the .dmg image and open it.
|
||||
|
||||
Other Unixes:
|
||||
Precompiled packages for other Unix flavors (HPUX, AIX) are available from
|
||||
http://www.cmake.org/cmake/resources/software.html
|
||||
|
||||
Alternatively, you can build from source, source package is also available on
|
||||
CMake download page.
|
||||
|
||||
|
||||
Compiler Tools
|
||||
--------------
|
||||
You will need a working compiler and make utility on your OS.
|
||||
On Windows, install Visual Studio (Express editions will work too).
|
||||
On Mac OSX, install Xcode tools.
|
||||
|
||||
|
||||
|
||||
BUILD
|
||||
---------------------------------------------------------------
|
||||
Ensure that compiler and cmake are in PATH.
|
||||
The following description assumes that current working directory
|
||||
is the source directory.
|
||||
|
||||
|
||||
- Generic build on Unix, using "Unix Makefiles" generator
|
||||
|
||||
shell>cmake .
|
||||
shell>make
|
||||
|
||||
Note: by default, cmake build is less verbose than automake build. Use
|
||||
"make VERBOSE=1" if you want to see add command lines for each compiled source.
|
||||
|
||||
- Windows, using "Visual Studio 9 2008" generator
|
||||
shell>cmake . -G "Visual Studio 9 2008"
|
||||
shell>devenv MySQL.sln /build /relwithdebinfo
|
||||
(alternatively, open MySQL.sln and build using the IDE)
|
||||
|
||||
- Windows, using "NMake Makefiles" generator
|
||||
shell>cmake . -G "NMake Makefiles"
|
||||
shell>nmake
|
||||
|
||||
- Mac OSX build with Xcode
|
||||
shell>cmake . -G Xcode
|
||||
shell>xcodebuild -configuration Relwithdebinfo
|
||||
(alternatively, open MySQL.xcodeproj and build using the IDE)
|
||||
|
||||
Command line build with CMake 2.8
|
||||
After creating project with cmake -G as above, issue
|
||||
cmake . --build
|
||||
this works with any CMake generator.
|
||||
|
||||
For Visual Studio and Xcode you might want to add an extra
|
||||
configuration parameter, to avoid building all configurations.
|
||||
|
||||
cmake . --build --config Relwithdebinfo
|
||||
|
||||
|
||||
Building "out-of-source"
|
||||
---------------------------------------------------------------
|
||||
Building out-of-source provides additional benefits. For example it allows to
|
||||
build both Release and Debug configurations using the single source tree.Or
|
||||
build the same source with different version of the same compiler or with
|
||||
different compilers. Also you will prevent polluting the source tree with the
|
||||
objects and binaries produced during the make.
|
||||
|
||||
Here is an example on how to do it (generic Unix), assuming the source tree is
|
||||
in directory named src and the current working directory is source root.
|
||||
|
||||
shell>mkdir ../build # build directory is called build
|
||||
shell>cd ../build
|
||||
shell>cmake ../src
|
||||
|
||||
Note: if a directory was used for in-source build, out-of-source will
|
||||
not work. To reenable out-of-source build, remove <source-root>/CMakeCache.txt
|
||||
file.
|
||||
|
||||
|
||||
CONFIGURATION PARAMETERS
|
||||
---------------------------------------------------------------
|
||||
The procedure above will build with default configuration.
|
||||
|
||||
Let's you want to change the configuration parameters and have archive
|
||||
storage engine compiled into the server instead of building it as pluggable
|
||||
module.
|
||||
|
||||
1)You can provide parameters on the command line, like
|
||||
|
||||
shell> cmake . -DWITH_ARCHIVE_STORAGE_ENGINE=1
|
||||
|
||||
This can be done during the initial configuration or any time later.
|
||||
|
||||
Note, that parameters are "sticky", that is they are remebered in the CMake
|
||||
cache (CMakeCache.txt file in the build directory)
|
||||
|
||||
2) Configuration using cmake-gui (Windows, OSX, or Linux with cmake-gui
|
||||
installed)
|
||||
|
||||
From the build directory, issue
|
||||
shell> cmake-gui .
|
||||
|
||||
- Check the WITH_INNOBASE_STORAGE_ENGINE checkbox
|
||||
- Click on "Configure" button
|
||||
- Click on "Generate" button
|
||||
- Close cmake-gui
|
||||
shell> make
|
||||
|
||||
3)Using ccmake (Unix)
|
||||
ccmake is curses-based GUI application that provides the same functionality
|
||||
as cmake-gui. It is less user-friendly compared to cmake-gui but works also
|
||||
on exotic Unixes like HPUX, AIX or Solaris.
|
||||
|
||||
Besides storage engines, probably the most important parameter from a
|
||||
developer's point of view is WITH_DEBUG (this allows to build server with
|
||||
dbug tracing library and with debug compile flags).
|
||||
|
||||
After changing the configuration, recompile using
|
||||
shell> make
|
||||
|
||||
|
||||
Listing configuration parameters
|
||||
---------------------------------------------------------------
|
||||
shell> cmake -L
|
||||
|
||||
Gives a brief overview of important configuration parameters (dump to stdout)
|
||||
|
||||
shell> cmake -LH
|
||||
|
||||
Does the same but also provides a short help text for each parameter.
|
||||
|
||||
shell> cmake -LAH
|
||||
|
||||
Dumps all config parameters (including advanced) to the stdout.
|
||||
|
||||
PACKAGING
|
||||
---------------------------------------------------------------
|
||||
-- Binary distribution --
|
||||
Packaging in form of tar.gz archives (or .zip on Windows) is also supported
|
||||
To create a tar.gz package,
|
||||
|
||||
1)If you're using "generic" Unix build with makefiles
|
||||
|
||||
shell> make package
|
||||
this will create a tar.gz file in the top level build directory.
|
||||
|
||||
2)On Windows, using "NMake Makefiles" generator
|
||||
|
||||
shell> nmake package
|
||||
|
||||
3)On Windows, using "Visual Studio" generator
|
||||
|
||||
shell> devenv mysql.sln /build relwithdebinfo /project package
|
||||
|
||||
Note On Windows, 7Zip or Winzip must be installed and 7z.exe rsp winzip.exe
|
||||
need to be in the PATH.
|
||||
|
||||
|
||||
Another way to build packages is calling cpack executable directly like
|
||||
shell> cpack -G TGZ --config CPackConfig.cmake
|
||||
(-G TGZ is for tar.gz generator, there is also -GZIP)
|
||||
|
||||
-- Source distribution --
|
||||
"make dist" target is provided.
|
||||
|
||||
ADDITIONAL MAKE TARGETS: "make install" AND "make test"
|
||||
----------------------------------------------------------------
|
||||
install target also provided for Makefile based generators. Installation
|
||||
directory can be controlled using configure-time parameter
|
||||
CMAKE_INSTALL_PREFIX (default is /usr/local. It is also possible to install to
|
||||
non-configured directory, using
|
||||
|
||||
shell> make install DESTDIR="/some/absolute/path"
|
||||
|
||||
"make test" runs unit tests (uses CTest for it)
|
||||
"make test-force" runs mysql-test-run.pl tests with --test-force parameter
|
||||
|
||||
FOR PROGRAMMERS: WRITING PLATFORM CHECKS
|
||||
--------------------------------------------------------------
|
||||
If you modify MySQL source and want to add a new platform check,please read
|
||||
http://www.vtk.org/Wiki/CMake_HowToDoPlatformChecks first. In MySQL, most of
|
||||
the platform tests are implemented in configure.cmake and the template header
|
||||
file is config.h.cmake
|
||||
|
||||
Bigger chunks of functionality, for example non-trivial macros are implemented
|
||||
in files <src-root>/cmake subdirectory.
|
||||
|
||||
For people with autotools background, it is important to remember CMake does
|
||||
not provide autoheader functionality. That is, when you add a check
|
||||
|
||||
CHECK_FUNCTION_EXISTS(foo HAVE_FOO)
|
||||
to config.cmake, then you will also need to add
|
||||
#cmakedefine HAVE_FOO 1
|
||||
to config.h.cmake
|
||||
|
||||
Troubleshooting platform checks
|
||||
--------------------------------
|
||||
If you suspect that a platform check returned wrong result, examine
|
||||
<build-root>/CMakeFiles/CMakeError.log and
|
||||
<build-root>/CMakeFiles/CMakeOutput.log
|
||||
These files they contain compiler command line, and exact error messages.
|
||||
|
||||
Troubleshooting CMake code
|
||||
----------------------------------
|
||||
While there are advanced flags for cmake like -debug-trycompile and --trace,
|
||||
a simple and efficient way to debug to add
|
||||
MESSAGE("interesting variable=${some_invariable}")
|
||||
to the interesting places in CMakeLists.txt
|
||||
|
||||
|
||||
Tips:
|
||||
- When using Makefile generator it is easy to examine which compiler flags are
|
||||
used to build. For example, compiler flags for mysqld are in
|
||||
<build-root>/sql/CMakeFiles/mysqld.dir/flags.make and the linker command line
|
||||
is in <build-root>/sql/CMakeFiles/mysqld.dir/link.txt
|
||||
|
||||
- CMake caches results of platform checks in CMakeCache.txt. It is a nice
|
||||
feature because tests do not rerun when reconfiguring (e.g when a new test was
|
||||
added).The downside of caching is that when a platform test was wrong and was
|
||||
later corrected, the cached result is still used. If you encounter this
|
||||
situation, which should be a rare occation, you need either to remove the
|
||||
offending entry from CMakeCache.txt (if test was for HAVE_FOO, remove lines
|
||||
containing HAVE_FOO from CMakeCache.txt) or just remove the cache file.
|
|
@ -20,6 +20,7 @@
|
|||
EXTRA_DIST = FINISH.sh \
|
||||
SETUP.sh \
|
||||
autorun.sh \
|
||||
choose_configure.sh \
|
||||
build_mccge.sh \
|
||||
check-cpu \
|
||||
cleanup \
|
||||
|
|
|
@ -20,6 +20,7 @@ do
|
|||
done
|
||||
IFS="$save_ifs"
|
||||
|
||||
rm -rf configure
|
||||
aclocal || die "Can't execute aclocal"
|
||||
autoheader || die "Can't execute autoheader"
|
||||
# --force means overwrite ltmain.sh script if it already exists
|
||||
|
@ -29,3 +30,9 @@ $LIBTOOLIZE --automake --force --copy || die "Can't execute libtoolize"
|
|||
# and --force to overwrite them if they already exist
|
||||
automake --add-missing --force --copy || die "Can't execute automake"
|
||||
autoconf || die "Can't execute autoconf"
|
||||
# Do not use autotools generated configure directly. Instead, use a script
|
||||
# that will either call CMake or original configure shell script at build
|
||||
# time (CMake is preferred if installed).
|
||||
mv configure configure.am
|
||||
cp BUILD/choose_configure.sh configure
|
||||
chmod a+x configure
|
||||
|
|
|
@ -1303,7 +1303,11 @@ set_linux_configs()
|
|||
compiler_flags="$compiler_flags -m32"
|
||||
fi
|
||||
if test "x$fast_flag" != "xno" ; then
|
||||
compiler_flags="$compiler_flags -O2"
|
||||
if test "x$fast_flag" = "xyes" ; then
|
||||
compiler_flags="$compiler_flags -O3"
|
||||
else
|
||||
compiler_flags="$compiler_flags -O2"
|
||||
fi
|
||||
else
|
||||
compiler_flags="$compiler_flags -O0"
|
||||
fi
|
||||
|
|
14
BUILD/choose_configure.sh
Normal file
14
BUILD/choose_configure.sh
Normal file
|
@ -0,0 +1,14 @@
|
|||
#!/bin/sh
|
||||
# Choose whether to use autoconf created configure
|
||||
# of perl script that calls cmake.
|
||||
|
||||
# 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_CMAKE=no
|
||||
if test "$HAVE_CMAKE" = "no"
|
||||
then
|
||||
sh ./configure.am "$@"
|
||||
else
|
||||
perl ./cmake/configure.pl "$@"
|
||||
fi
|
||||
|
|
@ -1,4 +1,20 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Copyright (C) 2009 Sun Microsystems, Inc
|
||||
#
|
||||
# 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 update the automake/autoconf helper scripts and
|
||||
# to run a plain "configure" without any special compile flags. Only features
|
||||
|
@ -61,6 +77,7 @@ fi
|
|||
# Remember that configure restricts the man pages to the configured features !
|
||||
./configure \
|
||||
--with-embedded-server \
|
||||
--with-perfschema \
|
||||
--with-ndbcluster
|
||||
$gmake
|
||||
|
||||
|
|
519
CMakeLists.txt
519
CMakeLists.txt
|
@ -1,4 +1,4 @@
|
|||
# Copyright (C) 2006 MySQL AB
|
||||
# Copyright (C) 2006-2008 MySQL AB, 2009 Sun Microsystems, Inc
|
||||
#
|
||||
# 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
|
||||
|
@ -13,308 +13,281 @@
|
|||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.6 FATAL_ERROR)
|
||||
IF(COMMAND cmake_policy)
|
||||
cmake_policy(SET CMP0005 NEW)
|
||||
ENDIF(COMMAND cmake_policy)
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
|
||||
# Avoid warnings in higher versions
|
||||
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 2.6)
|
||||
CMAKE_POLICY(VERSION 2.8)
|
||||
endif()
|
||||
|
||||
PROJECT(MySql)
|
||||
|
||||
# This reads user configuration, generated by configure.js.
|
||||
INCLUDE(win/configure.data)
|
||||
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake)
|
||||
|
||||
# Hardcode support for CSV storage engine
|
||||
SET(WITH_CSV_STORAGE_ENGINE TRUE)
|
||||
# First, decide about build type (debug or release)
|
||||
# If custom compiler flags are set or cmake is invoked with -DCMAKE_BUILD_TYPE,
|
||||
# respect user wishes and do not (re)define CMAKE_BUILD_TYPE. If WITH_DEBUG{_FULL}
|
||||
# is given, set CMAKE_BUILD_TYPE = Debug. Otherwise, use Relwithdebinfo.
|
||||
|
||||
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/include/mysql_version.h.in
|
||||
${CMAKE_SOURCE_DIR}/include/mysql_version.h @ONLY)
|
||||
|
||||
# Set standard options
|
||||
ADD_DEFINITIONS(-DHAVE_YASSL)
|
||||
ADD_DEFINITIONS(-DCMAKE_CONFIGD)
|
||||
ADD_DEFINITIONS(-DDEFAULT_MYSQL_HOME="c:/Program Files/MySQL/MySQL Server ${MYSQL_BASE_VERSION}/")
|
||||
ADD_DEFINITIONS(-DDEFAULT_BASEDIR="c:/Program Files/MySQL/")
|
||||
ADD_DEFINITIONS(-DMYSQL_DATADIR="c:/Program Files/MySQL/MySQL Server ${MYSQL_BASE_VERSION}/data")
|
||||
ADD_DEFINITIONS(-DDEFAULT_CHARSET_HOME="c:/Program Files/MySQL/MySQL Server ${MYSQL_BASE_VERSION}/")
|
||||
ADD_DEFINITIONS(-DPACKAGE=mysql)
|
||||
ADD_DEFINITIONS(-DSHAREDIR="share")
|
||||
IF(DEFINED CMAKE_BUILD_TYPE)
|
||||
SET(HAVE_CMAKE_BUILD_TYPE TRUE)
|
||||
ENDIF()
|
||||
SET(CUSTOM_C_FLAGS $ENV{CFLAGS})
|
||||
|
||||
# Set debug options
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DFORCE_INIT_OF_VARS")
|
||||
OPTION(WITH_DEBUG "Use dbug/safemutex" OFF)
|
||||
OPTION(WITH_DEBUG_FULL "Use dbug and safemalloc/safemutex. Slow" OFF)
|
||||
|
||||
# Do not use SAFEMALLOC for Windows builds, as Debug CRT has the same functionality
|
||||
# Neither SAFE_MUTEX works on Windows and it has been explicitely undefined in
|
||||
# my_pthread.h
|
||||
IF(NOT WIN32)
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
|
||||
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
|
||||
ENDIF(NOT WIN32)
|
||||
|
||||
SET(localstatedir "C:\\mysql\\data")
|
||||
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/support-files/my-huge.cnf.sh
|
||||
${CMAKE_SOURCE_DIR}/support-files/my-huge.ini @ONLY)
|
||||
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/support-files/my-innodb-heavy-4G.cnf.sh
|
||||
${CMAKE_SOURCE_DIR}/support-files/my-innodb-heavy-4G.ini @ONLY)
|
||||
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/support-files/my-large.cnf.sh
|
||||
${CMAKE_SOURCE_DIR}/support-files/my-large.ini @ONLY)
|
||||
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/support-files/my-medium.cnf.sh
|
||||
${CMAKE_SOURCE_DIR}/support-files/my-medium.ini @ONLY)
|
||||
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/support-files/my-small.cnf.sh
|
||||
${CMAKE_SOURCE_DIR}/support-files/my-small.ini @ONLY)
|
||||
# We choose to provide WITH_DEBUG as alias to standard CMAKE_BUILD_TYPE=Debug
|
||||
# which turns out to be not trivial, as this involves synchronization
|
||||
# between CMAKE_BUILD_TYPE and WITH_DEBUG. Besides, we have to deal with cases
|
||||
# where WITH_DEBUG is reset from ON to OFF and here we need to reset
|
||||
# CMAKE_BUILD_TYPE to either none or default RelWithDebInfo
|
||||
|
||||
IF(CYBOZU)
|
||||
ADD_DEFINITIONS(-DCYBOZU)
|
||||
ENDIF(CYBOZU)
|
||||
SET(BUILDTYPE_DOCSTRING
|
||||
"Choose the type of build, options are: None(CMAKE_CXX_FLAGS or
|
||||
CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel")
|
||||
|
||||
IF(WITH_DEBUG OR WITH_DEBUG_FULL)
|
||||
SET(CMAKE_BUILD_TYPE "Debug" CACHE STRING ${BUILDTYPE_DOCSTRING} FORCE)
|
||||
SET(OLD_WITH_DEBUG 1 CACHE INTERNAL "" FORCE)
|
||||
ELSEIF(NOT HAVE_CMAKE_BUILD_TYPE OR OLD_WITH_DEBUG)
|
||||
IF(CUSTOM_C_FLAGS)
|
||||
SET(CMAKE_BUILD_TYPE "" CACHE STRING ${BUILDTYPE_DOCSTRING} FORCE)
|
||||
ELSE(CMAKE_BUILD_TYPE MATCHES "Debug" OR NOT HAVE_CMAKE_BUILD_TYPE)
|
||||
SET(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
|
||||
${BUILDTYPE_DOCSTRING} FORCE)
|
||||
ENDIF()
|
||||
SET(OLD_WITH_DEBUG 0 CACHE INTERNAL "" FORCE)
|
||||
ENDIF()
|
||||
|
||||
IF(EXTRA_DEBUG)
|
||||
ADD_DEFINITIONS(-D EXTRA_DEBUG)
|
||||
ENDIF(EXTRA_DEBUG)
|
||||
IF(BUILD_CONFIG)
|
||||
SET(CMAKE_USER_MAKE_RULES_OVERRIDE
|
||||
${CMAKE_SOURCE_DIR}/cmake/build_configurations/${BUILD_CONFIG}.cmake)
|
||||
ENDIF()
|
||||
|
||||
IF(ENABLED_DEBUG_SYNC)
|
||||
ADD_DEFINITIONS(-D ENABLED_DEBUG_SYNC)
|
||||
ENDIF(ENABLED_DEBUG_SYNC)
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DENABLED_DEBUG_SYNC")
|
||||
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DENABLED_DEBUG_SYNC")
|
||||
PROJECT(MySQL)
|
||||
|
||||
# in some places we use DBUG_OFF
|
||||
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DDBUG_OFF")
|
||||
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -DDBUG_OFF")
|
||||
SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DDBUG_OFF")
|
||||
SET(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -DDBUG_OFF")
|
||||
# Include the platform-specific file. To allow exceptions, this code
|
||||
# looks for files in order of how specific they are. If there is, for
|
||||
# example, a generic Linux.cmake and a version-specific
|
||||
# Linux-2.6.28-11-generic, it will pick Linux-2.6.28-11-generic and
|
||||
# include it. It is then up to the file writer to include the generic
|
||||
# version if necessary.
|
||||
FOREACH(_base
|
||||
${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_VERSION}-${CMAKE_SYSTEM_PROCESSOR}
|
||||
${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_VERSION}
|
||||
${CMAKE_SYSTEM_NAME})
|
||||
SET(_file ${CMAKE_SOURCE_DIR}/cmake/os/${_base}.cmake)
|
||||
IF(EXISTS ${_file})
|
||||
INCLUDE(${_file})
|
||||
BREAK()
|
||||
ENDIF()
|
||||
ENDFOREACH()
|
||||
|
||||
#TODO: update the code and remove the disabled warnings
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4800 /wd4805")
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4800 /wd4805")
|
||||
|
||||
# Disable warnings in Visual Studio 8 and above
|
||||
IF(MSVC AND NOT CMAKE_GENERATOR MATCHES "Visual Studio 7")
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /wd4996")
|
||||
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /wd4996")
|
||||
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /wd4996")
|
||||
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /wd4996")
|
||||
SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /wd4996")
|
||||
SET(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} /wd4996")
|
||||
ENDIF(MSVC AND NOT CMAKE_GENERATOR MATCHES "Visual Studio 7")
|
||||
|
||||
IF(CMAKE_GENERATOR MATCHES "Visual Studio 7")
|
||||
# VS2003 has a bug that prevents linking mysqld with module definition file
|
||||
# (/DEF option for linker). Linker would incorrectly complain about multiply
|
||||
# defined symbols. Workaround is to disable dynamic plugins, so /DEF is not
|
||||
# used.
|
||||
MESSAGE("Warning: Building MySQL with Visual Studio 2003.NET is no more supported.")
|
||||
MESSAGE("Please use a newer version of Visual Studio.")
|
||||
SET(WITHOUT_DYNAMIC_PLUGINS TRUE)
|
||||
ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 7")
|
||||
# Following autotools tradition, add preprocessor definitions
|
||||
# specified in environment variable CPPFLAGS
|
||||
IF(DEFINED ENV{CPPFLAGS})
|
||||
ADD_DEFINITIONS($ENV{CPPFLAGS})
|
||||
ENDIF()
|
||||
|
||||
# Settings for Visual Studio 7 and above.
|
||||
IF(MSVC)
|
||||
# replace /MDd with /MTd
|
||||
STRING(REPLACE "/MD" "/MT" CMAKE_C_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELEASE})
|
||||
STRING(REPLACE "/MD" "/MT" CMAKE_C_FLAGS_RELWITHDEBINFO ${CMAKE_C_FLAGS_RELWITHDEBINFO})
|
||||
STRING(REPLACE "/MDd" "/MTd" CMAKE_C_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG})
|
||||
STRING(REPLACE "/MDd" "/MTd" CMAKE_C_FLAGS_DEBUG_INIT ${CMAKE_C_FLAGS_DEBUG_INIT})
|
||||
# Add macros
|
||||
INCLUDE(character_sets)
|
||||
INCLUDE(zlib)
|
||||
INCLUDE(ssl)
|
||||
INCLUDE(readline)
|
||||
INCLUDE(mysql_version)
|
||||
INCLUDE(libutils)
|
||||
INCLUDE(dtrace)
|
||||
INCLUDE(plugin)
|
||||
INCLUDE(install_macros)
|
||||
INCLUDE(install_layout)
|
||||
INCLUDE(mysql_add_executable)
|
||||
|
||||
STRING(REPLACE "/MD" "/MT" CMAKE_CXX_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE})
|
||||
STRING(REPLACE "/MD" "/MT" CMAKE_CXX_FLAGS_RELWITHDEBINFO ${CMAKE_CXX_FLAGS_RELWITHDEBINFO})
|
||||
STRING(REPLACE "/MDd" "/MTd" CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG})
|
||||
STRING(REPLACE "/MDd" "/MTd" CMAKE_CXX_FLAGS_DEBUG_INIT ${CMAKE_CXX_FLAGS_DEBUG_INIT})
|
||||
# Handle options
|
||||
OPTION(DISABLE_SHARED
|
||||
"Don't build shared libraries, compile code as position-dependent" OFF)
|
||||
IF(DISABLE_SHARED)
|
||||
SET(WITHOUT_DYNAMIC_PLUGINS 1)
|
||||
ENDIF()
|
||||
OPTION(ENABLED_PROFILING "Enable profiling" ON)
|
||||
OPTION(CYBOZU "" OFF)
|
||||
OPTION(BACKUP_TEST "" OFF)
|
||||
OPTION(WITHOUT_SERVER OFF)
|
||||
OPTION (WITH_UNIT_TESTS "Compile MySQL with unit tests" ON)
|
||||
MARK_AS_ADVANCED(CYBOZU BACKUP_TEST WITHOUT_SERVER DISABLE_SHARED)
|
||||
|
||||
# generate map files, set stack size (see bug#20815)
|
||||
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /MAP /MAPINFO:EXPORTS")
|
||||
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /STACK:1048576")
|
||||
|
||||
OPTION(ENABLE_DEBUG_SYNC "Enable debug sync (debug builds only)" ON)
|
||||
IF(ENABLE_DEBUG_SYNC)
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DENABLED_DEBUG_SYNC")
|
||||
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DENABLED_DEBUG_SYNC")
|
||||
ENDIF()
|
||||
|
||||
OPTION(WITH_ERROR_INJECT
|
||||
"Enable error injection in MySQL Server (debug builds only)" OFF)
|
||||
IF(WITH_ERROR_INJECT)
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DERROR_INJECT_SUPPORT")
|
||||
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DERROR_INJECT_SUPPORT")
|
||||
ENDIF()
|
||||
|
||||
# remove support for Exception handling
|
||||
STRING(REPLACE "/GX" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
|
||||
STRING(REPLACE "/EHsc" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
|
||||
STRING(REPLACE "/EHsc" "" CMAKE_CXX_FLAGS_INIT ${CMAKE_CXX_FLAGS_INIT})
|
||||
STRING(REPLACE "/EHsc" "" CMAKE_CXX_FLAGS_DEBUG_INIT ${CMAKE_CXX_FLAGS_DEBUG_INIT})
|
||||
|
||||
# Mark 32 bit executables large address aware so they can
|
||||
# use > 2GB address space
|
||||
IF(CMAKE_SIZEOF_VOID_P MATCHES 4)
|
||||
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /LARGEADDRESSAWARE")
|
||||
ENDIF(CMAKE_SIZEOF_VOID_P MATCHES 4)
|
||||
|
||||
# Disable automatic manifest generation.
|
||||
STRING(REPLACE "/MANIFEST" "/MANIFEST:NO" CMAKE_EXE_LINKER_FLAGS
|
||||
${CMAKE_EXE_LINKER_FLAGS})
|
||||
# Explicitly disable it since it is the default for newer versions of VS
|
||||
STRING(REGEX MATCH "MANIFEST:NO" tmp_manifest ${CMAKE_EXE_LINKER_FLAGS})
|
||||
IF(NOT tmp_manifest)
|
||||
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /MANIFEST:NO")
|
||||
ENDIF(NOT tmp_manifest)
|
||||
ENDIF(MSVC)
|
||||
OPTION(ENABLE_LOCAL_INFILE
|
||||
"If we should should enable LOAD DATA LOCAL by default" ${IF_WIN})
|
||||
MARK_AS_ADVANCED(ENABLE_LOCAL_INFILE)
|
||||
|
||||
OPTION(WITH_FAST_MUTEXES "Compile with fast mutexes" OFF)
|
||||
MARK_AS_ADVANCED(WITH_FAST_MUTEXES)
|
||||
|
||||
# Set DBUG_OFF and other optional release-only flags for non-debug project types
|
||||
FOREACH(BUILD_TYPE RELEASE RELWITHDEBINFO MINSIZEREL)
|
||||
FOREACH(LANG C CXX)
|
||||
SET(CMAKE_${LANG}_FLAGS_${BUILD_TYPE}
|
||||
"${CMAKE_${LANG}_FLAGS_${BUILD_TYPE}} -DDBUG_OFF")
|
||||
IF(WITH_FAST_MUTEXES)
|
||||
SET(CMAKE_${LANG}_FLAGS_${BUILD_TYPE}
|
||||
"${CMAKE_${LANG}_FLAGS_${BUILD_TYPE}} -DMY_PTHREAD_FASTMUTEX=1")
|
||||
ENDIF()
|
||||
ENDFOREACH()
|
||||
ENDFOREACH()
|
||||
|
||||
IF(NOT CMAKE_BUILD_TYPE
|
||||
AND NOT CMAKE_GENERATOR MATCHES "Visual Studio"
|
||||
AND NOT CMAKE_GENERATOR MATCHES "Xcode")
|
||||
# This is the case of no CMAKE_BUILD_TYPE choosen, typical for VS and Xcode
|
||||
# or if custom C flags are set. In VS and Xcode for non-Debug configurations
|
||||
# DBUG_OFF is already correctly set. Use DBUG_OFF for Makefile based projects
|
||||
# without build type too, unless user specifically requests DBUG.
|
||||
IF(NOT CMAKE_C_FLAGS MATCHES "-DDBUG_ON")
|
||||
ADD_DEFINITIONS(-DDBUG_OFF)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
# Add safemalloc and safemutex for debug condifurations, except on Windows
|
||||
# (C runtime library provides safemalloc functionality and safemutex has never
|
||||
# worked there)
|
||||
IF(WITH_DEBUG OR WITH_DEBUG_FULL AND NOT WIN32)
|
||||
FOREACH(LANG C CXX)
|
||||
IF(WITH_DEBUG_FULL)
|
||||
SET(CMAKE_${LANG}_FLAGS_DEBUG
|
||||
"${CMAKE_${LANG}_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
|
||||
ELSE()
|
||||
SET(CMAKE_${LANG}_FLAGS_DEBUG
|
||||
"${CMAKE_${LANG}_FLAGS_DEBUG} -DSAFE_MUTEX")
|
||||
ENDIF()
|
||||
ENDFOREACH()
|
||||
ENDIF()
|
||||
|
||||
|
||||
# Set commonly used variables
|
||||
IF(WIN32)
|
||||
ADD_DEFINITIONS("-D_WINDOWS -D__WIN__ -D_CRT_SECURE_NO_DEPRECATE")
|
||||
ADD_DEFINITIONS("-D_WIN32_WINNT=0x0501")
|
||||
ENDIF(WIN32)
|
||||
SET(DEFAULT_MYSQL_HOME "C:/Program Files/MySQL/MySQL Server ${MYSQL_BASE_VERSION}" )
|
||||
SET(SHAREDIR share)
|
||||
ELSE()
|
||||
SET(DEFAULT_MYSQL_HOME ${CMAKE_INSTALL_PREFIX})
|
||||
SET(SHAREDIR ${DEFAULT_MYSQL_HOME}/${INSTALL_MYSQLSHAREDIR})
|
||||
ENDIF()
|
||||
|
||||
# default to x86 platform. We'll check for X64 in a bit
|
||||
SET (PLATFORM X86)
|
||||
SET(DEFAULT_BASEDIR "${DEFAULT_MYSQL_HOME}")
|
||||
SET(MYSQL_DATADIR "${DEFAULT_MYSQL_HOME}/${INSTALL_MYSQLDATADIR}" CACHE PATH
|
||||
"default MySQL data directory")
|
||||
SET(DEFAULT_CHARSET_HOME "${DEFAULT_MYSQL_HOME}")
|
||||
SET(PLUGINDIR "${DEFAULT_MYSQL_HOME}/${INSTALL_PLUGINDIR}")
|
||||
IF(SYSCONFDIR)
|
||||
SET(DEFAULT_SYSCONFDIR "${SYSCONFDIR}")
|
||||
ENDIF()
|
||||
|
||||
# This definition is necessary to work around a bug with Intellisense described
|
||||
# here: http://tinyurl.com/2cb428. Syntax highlighting is important for proper
|
||||
# debugger functionality.
|
||||
IF(CMAKE_SIZEOF_VOID_P MATCHES 8)
|
||||
MESSAGE(STATUS "Detected 64-bit platform.")
|
||||
ADD_DEFINITIONS("-D_WIN64")
|
||||
SET (PLATFORM X64)
|
||||
ENDIF(CMAKE_SIZEOF_VOID_P MATCHES 8)
|
||||
|
||||
IF(EMBED_MANIFESTS)
|
||||
# Search for the tools (mt, makecat, signtool) necessary for embedding
|
||||
# manifests and signing executables with the MySQL AB authenticode cert.
|
||||
#
|
||||
# CMake will first search it's defaults (CMAKE_FRAMEWORK_PATH,
|
||||
# CMAKE_APPBUNDLE_PATH, CMAKE_PROGRAM_PATH and the system PATH) followed
|
||||
# by the listed paths which are the current possible defaults and should be
|
||||
# updated when necessary.
|
||||
#
|
||||
# The custom manifests are designed to be compatible with all mt versions.
|
||||
# The MySQL AB Authenticode certificate is available only internally.
|
||||
# Others should store a single signing certificate in a local cryptographic
|
||||
# service provider and alter the signtool command as necessary.
|
||||
FIND_PROGRAM(HAVE_MANIFEST_TOOL NAMES mt
|
||||
PATHS
|
||||
"$ENV{PROGRAMFILES}/Microsoft Visual Studio 8/VC/bin"
|
||||
"$ENV{PROGRAMFILES}/Microsoft Visual Studio 8/Common7/Tools/Bin"
|
||||
"$ENV{PROGRAMFILES}/Microsoft Visual Studio 8/SDK/v2.0/Bin")
|
||||
FIND_PROGRAM(HAVE_CATALOG_TOOL NAMES makecat
|
||||
PATHS
|
||||
"$ENV{PROGRAMFILES}/Microsoft Visual Studio 8/Common7/Tools/Bin")
|
||||
FIND_PROGRAM(HAVE_SIGN_TOOL NAMES signtool
|
||||
PATHS
|
||||
"$ENV{PROGRAMFILES}/Microsoft Visual Studio 8/Common7/Tools/Bin"
|
||||
"$ENV{PROGRAMFILES}/Microsoft Visual Studio 8/SDK/v2.0/Bin")
|
||||
# Run platform tests
|
||||
INCLUDE(configure.cmake)
|
||||
|
||||
IF(HAVE_MANIFEST_TOOL)
|
||||
MESSAGE(STATUS "Found Mainfest Tool.")
|
||||
ELSE(HAVE_MANIFEST_TOOL)
|
||||
MESSAGE(FATAL_ERROR "Manifest tool, mt.exe, can't be found.")
|
||||
ENDIF(HAVE_MANIFEST_TOOL)
|
||||
IF(HAVE_CATALOG_TOOL)
|
||||
MESSAGE(STATUS "Found Catalog Tool.")
|
||||
ELSE(HAVE_CATALOG_TOOL)
|
||||
MESSAGE(FATAL_ERROR "Catalog tool, makecat.exe, can't be found.")
|
||||
ENDIF(HAVE_CATALOG_TOOL)
|
||||
IF(HAVE_SIGN_TOOL)
|
||||
MESSAGE(STATUS "Found Sign Tool. Embedding custom manifests and signing executables.")
|
||||
ELSE(HAVE_SIGN_TOOL)
|
||||
MESSAGE(FATAL_ERROR "Sign tool, signtool.exe, can't be found.")
|
||||
ENDIF(HAVE_SIGN_TOOL)
|
||||
# Common defines and includes
|
||||
ADD_DEFINITIONS(-DHAVE_CONFIG_H)
|
||||
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/include)
|
||||
|
||||
# Set the processor architecture.
|
||||
IF(CMAKE_GENERATOR MATCHES "Visual Studio 8 2005 Win64")
|
||||
SET(PROCESSOR_ARCH "amd64")
|
||||
ELSE(CMAKE_GENERATOR MATCHES "Visual Studio 8 2005 Win64")
|
||||
SET(PROCESSOR_ARCH "X86")
|
||||
ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 8 2005 Win64")
|
||||
ENDIF(EMBED_MANIFESTS)
|
||||
# Add bundled or system zlib.
|
||||
MYSQL_CHECK_ZLIB_WITH_COMPRESS()
|
||||
# Optionally add bundled yassl/taocrypt or system openssl.
|
||||
MYSQL_CHECK_SSL()
|
||||
# Add readline or libedit.
|
||||
MYSQL_CHECK_READLINE()
|
||||
|
||||
# Figure out what engines to build and how (statically or dynamically),
|
||||
# add preprocessor defines for storage engines.
|
||||
IF(WITHOUT_DYNAMIC_PLUGINS)
|
||||
MESSAGE("Dynamic plugins are disabled.")
|
||||
ENDIF(WITHOUT_DYNAMIC_PLUGINS)
|
||||
IF(NOT WITHOUT_SERVER)
|
||||
SET (MYSQLD_STATIC_PLUGIN_LIBS "" CACHE INTERNAL "")
|
||||
# Add storage engines and plugins.
|
||||
CONFIGURE_PLUGINS()
|
||||
ENDIF()
|
||||
|
||||
FILE(GLOB STORAGE_SUBDIRS storage/*)
|
||||
FOREACH(SUBDIR ${STORAGE_SUBDIRS})
|
||||
FILE(RELATIVE_PATH DIRNAME ${PROJECT_SOURCE_DIR}/storage ${SUBDIR})
|
||||
IF (EXISTS ${SUBDIR}/CMakeLists.txt)
|
||||
# Check MYSQL_STORAGE_ENGINE macro is present
|
||||
FILE(STRINGS ${SUBDIR}/CMakeLists.txt HAVE_STORAGE_ENGINE REGEX MYSQL_STORAGE_ENGINE)
|
||||
IF(HAVE_STORAGE_ENGINE)
|
||||
# Extract name of engine from HAVE_STORAGE_ENGINE
|
||||
STRING(REGEX REPLACE ".*MYSQL_STORAGE_ENGINE\\((.*\)\\).*"
|
||||
"\\1" ENGINE_NAME ${HAVE_STORAGE_ENGINE})
|
||||
STRING(TOUPPER ${ENGINE_NAME} ENGINE)
|
||||
STRING(TOLOWER ${ENGINE_NAME} ENGINE_LOWER)
|
||||
|
||||
SET(ENGINE_BUILD_TYPE "DYNAMIC")
|
||||
# Read plug.in to find out if a plugin is mandatory and whether it supports
|
||||
# build as shared library (dynamic).
|
||||
IF(EXISTS ${SUBDIR}/plug.in)
|
||||
FILE(READ ${SUBDIR}/plug.in PLUGIN_FILE_CONTENT)
|
||||
STRING (REGEX MATCH "MYSQL_PLUGIN_DYNAMIC" MYSQL_PLUGIN_DYNAMIC ${PLUGIN_FILE_CONTENT})
|
||||
STRING (REGEX MATCH "MYSQL_PLUGIN_MANDATORY" MYSQL_PLUGIN_MANDATORY ${PLUGIN_FILE_CONTENT})
|
||||
STRING (REGEX MATCH "MYSQL_PLUGIN_STATIC" MYSQL_PLUGIN_STATIC ${PLUGIN_FILE_CONTENT})
|
||||
|
||||
IF(MYSQL_PLUGIN_MANDATORY)
|
||||
SET(WITH_${ENGINE}_STORAGE_ENGINE TRUE)
|
||||
ENDIF(MYSQL_PLUGIN_MANDATORY)
|
||||
|
||||
IF (WITH_${ENGINE}_STORAGE_ENGINE AND MYSQL_PLUGIN_STATIC)
|
||||
SET(ENGINE_BUILD_TYPE "STATIC")
|
||||
ELSEIF(NOT WITHOUT_${ENGINE}_STORAGE_ENGINE AND MYSQL_PLUGIN_DYNAMIC AND NOT WITHOUT_DYNAMIC_PLUGINS)
|
||||
SET(ENGINE_BUILD_TYPE "DYNAMIC")
|
||||
ELSE(WITH_${ENGINE}_STORAGE_ENGINE AND MYSQL_PLUGIN_STATIC)
|
||||
SET(ENGINE_BUILD_TYPE "NONE")
|
||||
ENDIF(WITH_${ENGINE}_STORAGE_ENGINE AND MYSQL_PLUGIN_STATIC)
|
||||
IF (ENGINE_BUILD_TYPE STREQUAL "STATIC")
|
||||
SET (mysql_plugin_defs "${mysql_plugin_defs},builtin_${ENGINE_LOWER}_plugin")
|
||||
SET (MYSQLD_STATIC_ENGINE_LIBS ${MYSQLD_STATIC_ENGINE_LIBS} ${ENGINE_LOWER})
|
||||
SET (STORAGE_ENGINE_DEFS "${STORAGE_ENGINE_DEFS} -DWITH_${ENGINE}_STORAGE_ENGINE")
|
||||
SET (WITH_${ENGINE}_STORAGE_ENGINE TRUE)
|
||||
SET (${ENGINE}_DIR ${DIRNAME})
|
||||
ENDIF (ENGINE_BUILD_TYPE STREQUAL "STATIC")
|
||||
ENDIF(EXISTS ${SUBDIR}/plug.in)
|
||||
|
||||
IF(NOT ENGINE_BUILD_TYPE STREQUAL "NONE")
|
||||
LIST(APPEND ${ENGINE_BUILD_TYPE}_ENGINE_DIRECTORIES ${SUBDIR})
|
||||
ENDIF(NOT ENGINE_BUILD_TYPE STREQUAL "NONE")
|
||||
|
||||
ENDIF(HAVE_STORAGE_ENGINE)
|
||||
ENDIF(EXISTS ${SUBDIR}/CMakeLists.txt)
|
||||
ENDFOREACH(SUBDIR ${STORAGE_SUBDIRS})
|
||||
|
||||
# Special handling for partition(not really pluggable)
|
||||
IF(NOT WITHOUT_PARTITION_STORAGE_ENGINE)
|
||||
SET (STORAGE_ENGINE_DEFS "${STORAGE_ENGINE_DEFS} -DWITH_PARTITION_STORAGE_ENGINE")
|
||||
SET (mysql_plugin_defs "${mysql_plugin_defs},builtin_partition_plugin")
|
||||
ENDIF(NOT WITHOUT_PARTITION_STORAGE_ENGINE)
|
||||
|
||||
ADD_DEFINITIONS(${STORAGE_ENGINE_DEFS})
|
||||
|
||||
# Now write out our mysql_plugin_defs struct
|
||||
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/sql/sql_builtin.cc.in
|
||||
${CMAKE_SOURCE_DIR}/sql/sql_builtin.cc @ONLY)
|
||||
|
||||
# Add subdirectories for storage engines
|
||||
SET (ENGINE_BUILD_TYPE "STATIC")
|
||||
FOREACH(DIR ${STATIC_ENGINE_DIRECTORIES})
|
||||
ADD_SUBDIRECTORY(${DIR})
|
||||
ENDFOREACH(DIR ${STATIC_ENGINE_DIRECTORIES})
|
||||
|
||||
SET (ENGINE_BUILD_TYPE "DYNAMIC")
|
||||
FOREACH(DIR ${DYNAMIC_ENGINE_DIRECTORIES})
|
||||
ADD_SUBDIRECTORY(${DIR})
|
||||
ENDFOREACH(DIR ${DYNAMIC_ENGINE_DIRECTORIES})
|
||||
|
||||
# Add subdirectories for semisync plugin
|
||||
IF(NOT WITHOUT_DYNAMIC_PLUGINS)
|
||||
ADD_SUBDIRECTORY(plugin/semisync)
|
||||
ENDIF(NOT WITHOUT_DYNAMIC_PLUGINS)
|
||||
|
||||
# FIXME "debug" only needed if build type is "Debug", but
|
||||
# CMAKE_BUILD_TYPE is not set during configure time.
|
||||
ADD_SUBDIRECTORY(vio)
|
||||
ADD_SUBDIRECTORY(include)
|
||||
ADD_SUBDIRECTORY(dbug)
|
||||
ADD_SUBDIRECTORY(strings)
|
||||
ADD_SUBDIRECTORY(vio)
|
||||
ADD_SUBDIRECTORY(regex)
|
||||
ADD_SUBDIRECTORY(mysys)
|
||||
ADD_SUBDIRECTORY(scripts)
|
||||
ADD_SUBDIRECTORY(zlib)
|
||||
ADD_SUBDIRECTORY(extra/yassl)
|
||||
ADD_SUBDIRECTORY(extra/yassl/taocrypt)
|
||||
ADD_SUBDIRECTORY(extra)
|
||||
ADD_SUBDIRECTORY(client)
|
||||
ADD_SUBDIRECTORY(sql)
|
||||
ADD_SUBDIRECTORY(libmysql)
|
||||
ADD_SUBDIRECTORY(libservices)
|
||||
ADD_SUBDIRECTORY(tests)
|
||||
IF(WITH_EMBEDDED_SERVER)
|
||||
ADD_SUBDIRECTORY(libmysqld)
|
||||
ADD_SUBDIRECTORY(libmysqld/examples)
|
||||
ENDIF(WITH_EMBEDDED_SERVER)
|
||||
ADD_SUBDIRECTORY(mysql-test/lib/My/SafeProcess)
|
||||
|
||||
|
||||
IF(WITH_UNIT_TESTS)
|
||||
ENABLE_TESTING()
|
||||
ENDIF()
|
||||
IF(WITH_UNIT_TESTS)
|
||||
ADD_SUBDIRECTORY(unittest/mytap)
|
||||
ADD_SUBDIRECTORY(unittest/mysys)
|
||||
ENDIF()
|
||||
|
||||
ADD_SUBDIRECTORY(extra)
|
||||
IF(NOT WITHOUT_SERVER)
|
||||
ADD_SUBDIRECTORY(tests)
|
||||
ADD_SUBDIRECTORY(client)
|
||||
ADD_SUBDIRECTORY(sql)
|
||||
ADD_SUBDIRECTORY(sql/share)
|
||||
ADD_SUBDIRECTORY(libservices)
|
||||
OPTION (WITH_EMBEDDED_SERVER "Compile MySQL with embedded server" OFF)
|
||||
IF(WITH_EMBEDDED_SERVER)
|
||||
ADD_SUBDIRECTORY(libmysqld)
|
||||
ADD_SUBDIRECTORY(libmysqld/examples)
|
||||
ENDIF(WITH_EMBEDDED_SERVER)
|
||||
|
||||
ADD_SUBDIRECTORY(mysql-test)
|
||||
ADD_SUBDIRECTORY(mysql-test/lib/My/SafeProcess)
|
||||
ADD_SUBDIRECTORY(support-files)
|
||||
ADD_SUBDIRECTORY(scripts)
|
||||
ADD_SUBDIRECTORY(sql-bench)
|
||||
IF(UNIX)
|
||||
ADD_SUBDIRECTORY(man)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
INCLUDE(cmake/abi_check.cmake)
|
||||
|
||||
CONFIGURE_FILE(config.h.cmake ${CMAKE_BINARY_DIR}/include/my_config.h)
|
||||
CONFIGURE_FILE(config.h.cmake ${CMAKE_BINARY_DIR}/include/config.h)
|
||||
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/include/mysql_version.h.in
|
||||
${CMAKE_BINARY_DIR}/include/mysql_version.h )
|
||||
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/sql/sql_builtin.cc.in
|
||||
${CMAKE_BINARY_DIR}/sql/sql_builtin.cc)
|
||||
|
||||
# Packaging
|
||||
IF(WIN32)
|
||||
SET(CPACK_GENERATOR "ZIP")
|
||||
ELSE()
|
||||
SET(CPACK_GENERATOR "TGZ")
|
||||
ENDIF()
|
||||
INCLUDE(CPack)
|
||||
INSTALL(FILES COPYING EXCEPTIONS-CLIENT LICENSE.mysql DESTINATION ${INSTALL_DOCREADMEDIR} OPTIONAL)
|
||||
INSTALL(FILES README DESTINATION ${INSTALL_DOCREADMEDIR})
|
||||
IF(UNIX)
|
||||
INSTALL(FILES Docs/INSTALL-BINARY DESTINATION
|
||||
${INSTALL_DOCREADMEDIR})
|
||||
ENDIF()
|
||||
# MYSQL_DOCS_LOCATON is used in "make dist", points to the documentation directory
|
||||
SET(MYSQL_DOCS_LOCATION "" CACHE PATH "Location from where documentation is copied")
|
||||
MARK_AS_ADVANCED(MYSQL_DOCS_LOCATION)
|
||||
INSTALL(DIRECTORY Docs/ DESTINATION ${INSTALL_DOCDIR}
|
||||
PATTERN "INSTALL-BINARY" EXCLUDE
|
||||
PATTERN "Makefile.*" EXCLUDE
|
||||
PATTERN "myisam.txt" EXCLUDE
|
||||
PATTERN "glibc*" EXCLUDE
|
||||
PATTERN "sp-imp-spec.txt" EXCLUDE
|
||||
PATTERN "linuxthreads.txt" EXCLUDE
|
||||
)
|
||||
|
|
28
Makefile.am
28
Makefile.am
|
@ -19,7 +19,8 @@ AUTOMAKE_OPTIONS = foreign
|
|||
|
||||
# These are built from source in the Docs directory
|
||||
EXTRA_DIST = INSTALL-SOURCE INSTALL-WIN-SOURCE \
|
||||
README COPYING EXCEPTIONS-CLIENT CMakeLists.txt
|
||||
README COPYING EXCEPTIONS-CLIENT \
|
||||
CMakeLists.txt configure.cmake config.h.cmake BUILD-CMAKE
|
||||
|
||||
SUBDIRS = . include @docs_dirs@ @zlib_dir@ \
|
||||
@readline_topdir@ sql-common scripts \
|
||||
|
@ -28,8 +29,8 @@ SUBDIRS = . include @docs_dirs@ @zlib_dir@ \
|
|||
@sql_server@ @man_dirs@ tests \
|
||||
netware @libmysqld_dirs@ \
|
||||
mysql-test support-files sql-bench \
|
||||
win
|
||||
|
||||
win \
|
||||
cmake
|
||||
DIST_SUBDIRS = . include Docs zlib \
|
||||
cmd-line-utils sql-common scripts \
|
||||
pstack libservices \
|
||||
|
@ -38,6 +39,7 @@ DIST_SUBDIRS = . include Docs zlib \
|
|||
netware libmysqld \
|
||||
mysql-test support-files sql-bench \
|
||||
win \
|
||||
cmake \
|
||||
BUILD
|
||||
DISTCLEANFILES = ac_available_languages_fragment
|
||||
|
||||
|
@ -58,6 +60,7 @@ dist-hook:
|
|||
--datadir=$(distdir)/win/data \
|
||||
--srcdir=$(top_srcdir)
|
||||
storage/myisam/myisamchk --silent --fast $(distdir)/win/data/mysql/*.MYI
|
||||
test ! -f configure.am || $(INSTALL_DATA) configure.am $(distdir)
|
||||
|
||||
all-local: @ABI_CHECK@
|
||||
|
||||
|
@ -129,14 +132,14 @@ smoke:
|
|||
test-full: test test-nr test-ps
|
||||
|
||||
test-force:
|
||||
$(MAKE) force=--force test
|
||||
$(MAKE) -k force=--force test
|
||||
|
||||
test-force-full:
|
||||
$(MAKE) force=--force test-full
|
||||
$(MAKE) -k force=--force test-full
|
||||
|
||||
#used by autopush.pl to run memory based tests
|
||||
test-force-mem:
|
||||
$(MAKE) force=--force mem=--mem test
|
||||
$(MAKE) -k force=--force mem=--mem test
|
||||
|
||||
EXP = --experimental=collections/default.experimental
|
||||
|
||||
|
@ -204,10 +207,6 @@ test-bt-debug:
|
|||
@PERL@ ./mysql-test-run.pl --comment=debug --force --timer \
|
||||
--skip-ndbcluster --skip-rpl --report-features $(EXP)
|
||||
|
||||
test-bt-debug-fast:
|
||||
|
||||
test-bt-debug-fast:
|
||||
|
||||
# Keep these for a while
|
||||
test-pl: test
|
||||
test-full-pl: test-full
|
||||
|
@ -265,11 +264,12 @@ test-full-qa:
|
|||
#
|
||||
|
||||
API_PREPROCESSOR_HEADER = $(top_srcdir)/include/mysql/plugin.h \
|
||||
$(top_srcdir)/include/mysql.h
|
||||
$(top_srcdir)/include/mysql.h \
|
||||
$(top_srcdir)/include/mysql/psi/psi_abi_v1.h \
|
||||
$(top_srcdir)/include/mysql/psi/psi_abi_v2.h
|
||||
|
||||
TEST_PREPROCESSOR_HEADER = $(top_srcdir)/include/mysql/plugin.h \
|
||||
$(top_srcdir)/sql/mysql_priv.h \
|
||||
$(top_srcdir)/include/mysql.h
|
||||
TEST_PREPROCESSOR_HEADER = $(API_PREPROCESSOR_HEADER) \
|
||||
$(top_srcdir)/sql/mysql_priv.h
|
||||
|
||||
#
|
||||
# Rules for checking that the abi/api has not changed.
|
||||
|
|
|
@ -12,67 +12,60 @@
|
|||
# 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
|
||||
INCLUDE("${PROJECT_SOURCE_DIR}/win/mysql_manifest.cmake")
|
||||
|
||||
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include
|
||||
${CMAKE_SOURCE_DIR}/zlib
|
||||
${CMAKE_SOURCE_DIR}/extra/yassl/include
|
||||
${CMAKE_SOURCE_DIR}/libmysql
|
||||
${CMAKE_SOURCE_DIR}/regex
|
||||
${CMAKE_SOURCE_DIR}/sql
|
||||
${CMAKE_SOURCE_DIR}/strings)
|
||||
INCLUDE_DIRECTORIES(
|
||||
${CMAKE_SOURCE_DIR}/include
|
||||
${ZLIB_INCLUDE_DIR}
|
||||
${SSL_INCLUDE_DIRS}
|
||||
${CMAKE_SOURCE_DIR}/libmysql
|
||||
${CMAKE_SOURCE_DIR}/regex
|
||||
${CMAKE_SOURCE_DIR}/sql
|
||||
${CMAKE_SOURCE_DIR}/strings
|
||||
${READLINE_INCLUDE_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
|
||||
ADD_EXECUTABLE(mysql completion_hash.cc mysql.cc readline.cc sql_string.cc ../mysys/my_conio.c)
|
||||
ADD_DEFINITIONS(${READLINE_DEFINES})
|
||||
ADD_DEFINITIONS(${SSL_DEFINES})
|
||||
MYSQL_ADD_EXECUTABLE(mysql completion_hash.cc mysql.cc readline.cc sql_string.cc)
|
||||
TARGET_LINK_LIBRARIES(mysql mysqlclient)
|
||||
IF(UNIX)
|
||||
TARGET_LINK_LIBRARIES(mysql ${READLINE_LIBRARY})
|
||||
ENDIF(UNIX)
|
||||
|
||||
ADD_EXECUTABLE(mysqltest mysqltest.cc)
|
||||
MYSQL_ADD_EXECUTABLE(mysqltest mysqltest.cc)
|
||||
SET_SOURCE_FILES_PROPERTIES(mysqltest.cc PROPERTIES COMPILE_FLAGS "-DTHREADS")
|
||||
TARGET_LINK_LIBRARIES(mysqltest mysqlclient mysys regex dbug)
|
||||
TARGET_LINK_LIBRARIES(mysqltest mysqlclient regex)
|
||||
|
||||
ADD_EXECUTABLE(mysqlcheck mysqlcheck.c)
|
||||
|
||||
MYSQL_ADD_EXECUTABLE(mysqlcheck mysqlcheck.c)
|
||||
TARGET_LINK_LIBRARIES(mysqlcheck mysqlclient)
|
||||
|
||||
ADD_EXECUTABLE(mysqldump mysqldump.c ../sql-common/my_user.c ../mysys/mf_getdate.c)
|
||||
MYSQL_ADD_EXECUTABLE(mysqldump mysqldump.c ../sql-common/my_user.c)
|
||||
TARGET_LINK_LIBRARIES(mysqldump mysqlclient)
|
||||
|
||||
ADD_EXECUTABLE(mysqlimport mysqlimport.c)
|
||||
MYSQL_ADD_EXECUTABLE(mysqlimport mysqlimport.c)
|
||||
TARGET_LINK_LIBRARIES(mysqlimport mysqlclient)
|
||||
|
||||
ADD_EXECUTABLE(mysql_upgrade mysql_upgrade.c ../mysys/my_getpagesize.c)
|
||||
MYSQL_ADD_EXECUTABLE(mysql_upgrade mysql_upgrade.c)
|
||||
TARGET_LINK_LIBRARIES(mysql_upgrade mysqlclient)
|
||||
ADD_DEPENDENCIES(mysql_upgrade GenFixPrivs)
|
||||
|
||||
ADD_EXECUTABLE(mysqlshow mysqlshow.c)
|
||||
MYSQL_ADD_EXECUTABLE(mysqlshow mysqlshow.c)
|
||||
TARGET_LINK_LIBRARIES(mysqlshow mysqlclient)
|
||||
|
||||
ADD_EXECUTABLE(mysqlbinlog mysqlbinlog.cc
|
||||
../mysys/mf_tempdir.c
|
||||
../mysys/my_new.cc
|
||||
../mysys/my_bit.c
|
||||
../mysys/my_bitmap.c
|
||||
../mysys/my_vle.c
|
||||
../mysys/base64.c)
|
||||
MYSQL_ADD_EXECUTABLE(mysqlbinlog mysqlbinlog.cc)
|
||||
TARGET_LINK_LIBRARIES(mysqlbinlog mysqlclient)
|
||||
|
||||
ADD_EXECUTABLE(mysqladmin mysqladmin.cc)
|
||||
MYSQL_ADD_EXECUTABLE(mysqladmin mysqladmin.cc)
|
||||
TARGET_LINK_LIBRARIES(mysqladmin mysqlclient)
|
||||
|
||||
ADD_EXECUTABLE(mysqlslap mysqlslap.c)
|
||||
MYSQL_ADD_EXECUTABLE(mysqlslap mysqlslap.c)
|
||||
SET_SOURCE_FILES_PROPERTIES(mysqlslap.c PROPERTIES COMPILE_FLAGS "-DTHREADS")
|
||||
TARGET_LINK_LIBRARIES(mysqlslap mysqlclient mysys zlib dbug)
|
||||
TARGET_LINK_LIBRARIES(mysqlslap mysqlclient)
|
||||
|
||||
ADD_EXECUTABLE(echo echo.c)
|
||||
|
||||
IF(EMBED_MANIFESTS)
|
||||
MYSQL_EMBED_MANIFEST("mysql" "asInvoker")
|
||||
MYSQL_EMBED_MANIFEST("mysqltest" "asInvoker")
|
||||
MYSQL_EMBED_MANIFEST("mysqlcheck" "asInvoker")
|
||||
MYSQL_EMBED_MANIFEST("mysqldump" "asInvoker")
|
||||
MYSQL_EMBED_MANIFEST("mysqlimport" "asInvoker")
|
||||
MYSQL_EMBED_MANIFEST("mysql_upgrade" "asInvoker")
|
||||
MYSQL_EMBED_MANIFEST("mysqlshow" "asInvoker")
|
||||
MYSQL_EMBED_MANIFEST("mysqlbinlog" "asInvoker")
|
||||
MYSQL_EMBED_MANIFEST("mysqladmin" "asInvoker")
|
||||
MYSQL_EMBED_MANIFEST("echo" "asInvoker")
|
||||
ENDIF(EMBED_MANIFESTS)
|
||||
SET_TARGET_PROPERTIES (mysqlcheck mysqldump mysqlimport mysql_upgrade mysqlshow mysqlslap
|
||||
PROPERTIES HAS_CXX TRUE)
|
||||
|
||||
|
|
|
@ -104,11 +104,13 @@ DEFS = -DMYSQL_CLIENT_NO_THREADS \
|
|||
-DMYSQL_DATADIR="\"$(localstatedir)\""
|
||||
|
||||
sql_src=log_event.h mysql_priv.h rpl_constants.h \
|
||||
rpl_utility.h rpl_tblmap.h rpl_tblmap.cc \
|
||||
rpl_tblmap.h rpl_tblmap.cc \
|
||||
log_event.cc my_decimal.h my_decimal.cc \
|
||||
log_event_old.h log_event_old.cc \
|
||||
rpl_record_old.h rpl_record_old.cc
|
||||
strings_src=decimal.c
|
||||
rpl_record_old.h rpl_record_old.cc \
|
||||
rpl_utility.h rpl_utility.cc \
|
||||
transaction.h
|
||||
strings_src=decimal.c dtoa.c
|
||||
|
||||
link_sources:
|
||||
for f in $(sql_src) ; do \
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2001-2006 MySQL AB
|
||||
/* Copyright (C) 2001-2006 MySQL AB, 2009 Sun Microsystems, Inc
|
||||
|
||||
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
|
||||
|
@ -31,19 +31,10 @@
|
|||
# endif
|
||||
#endif
|
||||
|
||||
/* Version numbers for deprecation messages */
|
||||
#define VER_CELOSIA "5.6"
|
||||
|
||||
#define WARN_DEPRECATED(Ver,Old,New) \
|
||||
do { \
|
||||
printf("Warning: The option '%s' is deprecated and will be removed " \
|
||||
"in a future release. Please use %s instead.\n", (Old), (New)); \
|
||||
} while(0);
|
||||
|
||||
enum options_client
|
||||
{
|
||||
OPT_CHARSETS_DIR=256, OPT_DEFAULT_CHARSET,
|
||||
OPT_PAGER, OPT_NOPAGER, OPT_TEE, OPT_NOTEE,
|
||||
OPT_PAGER, OPT_TEE,
|
||||
OPT_LOW_PRIORITY, OPT_AUTO_REPAIR, OPT_COMPRESS,
|
||||
OPT_DROP, OPT_LOCKS, OPT_KEYWORDS, OPT_DELAYED, OPT_OPTIMIZE,
|
||||
OPT_FTB, OPT_LTB, OPT_ENC, OPT_O_ENC, OPT_ESC, OPT_TABLES,
|
||||
|
@ -58,7 +49,7 @@ enum options_client
|
|||
OPT_SHARED_MEMORY_BASE_NAME, OPT_FRM, OPT_SKIP_OPTIMIZATION,
|
||||
OPT_COMPATIBLE, OPT_RECONNECT, OPT_DELIMITER, OPT_SECURE_AUTH,
|
||||
OPT_OPEN_FILES_LIMIT, OPT_SET_CHARSET, OPT_SERVER_ARG,
|
||||
OPT_POSITION, OPT_STOP_POSITION, OPT_START_DATETIME, OPT_STOP_DATETIME,
|
||||
OPT_STOP_POSITION, OPT_START_DATETIME, OPT_STOP_DATETIME,
|
||||
OPT_SIGINT_IGNORE, OPT_HEXBLOB, OPT_ORDER_BY_PRIMARY, OPT_COUNT,
|
||||
#ifdef HAVE_NDBCLUSTER_DB
|
||||
OPT_NDBCLUSTER, OPT_NDB_CONNECTSTRING,
|
||||
|
@ -71,6 +62,9 @@ enum options_client
|
|||
OPT_MYSQL_NUMBER_OF_QUERY,
|
||||
OPT_IGNORE_TABLE,OPT_INSERT_IGNORE,OPT_SHOW_WARNINGS,OPT_DROP_DATABASE,
|
||||
OPT_TZ_UTC, OPT_AUTO_CLOSE, OPT_CREATE_SLAP_SCHEMA,
|
||||
OPT_MYSQLDUMP_SLAVE_APPLY,
|
||||
OPT_MYSQLDUMP_SLAVE_DATA,
|
||||
OPT_MYSQLDUMP_INCLUDE_MASTER_HOST_PORT,
|
||||
OPT_SLAP_CSV, OPT_SLAP_CREATE_STRING,
|
||||
OPT_SLAP_AUTO_GENERATE_SQL_LOAD_TYPE, OPT_SLAP_AUTO_GENERATE_WRITE_NUM,
|
||||
OPT_SLAP_AUTO_GENERATE_ADD_AUTO,
|
||||
|
@ -87,10 +81,30 @@ enum options_client
|
|||
OPT_SLAP_DETACH,
|
||||
OPT_MYSQL_REPLACE_INTO, OPT_BASE64_OUTPUT_MODE, OPT_SERVER_ID,
|
||||
OPT_FIX_TABLE_NAMES, OPT_FIX_DB_NAMES, OPT_SSL_VERIFY_SERVER_CERT,
|
||||
OPT_AUTO_VERTICAL_OUTPUT,
|
||||
OPT_DEBUG_INFO, OPT_DEBUG_CHECK, OPT_COLUMN_TYPES, OPT_ERROR_LOG_FILE,
|
||||
OPT_WRITE_BINLOG, OPT_DUMP_DATE,
|
||||
OPT_INIT_COMMAND,
|
||||
OPT_FIRST_SLAVE,
|
||||
OPT_ALL,
|
||||
OPT_MAX_CLIENT_OPTION
|
||||
};
|
||||
|
||||
/**
|
||||
First mysql version supporting the information schema.
|
||||
*/
|
||||
#define FIRST_INFORMATION_SCHEMA_VERSION 50003
|
||||
|
||||
/**
|
||||
Name of the information schema database.
|
||||
*/
|
||||
#define INFORMATION_SCHEMA_DB_NAME "information_schema"
|
||||
|
||||
/**
|
||||
First mysql version supporting the performance schema.
|
||||
*/
|
||||
#define FIRST_PERFORMANCE_SCHEMA_VERSION 50599
|
||||
|
||||
/**
|
||||
Name of the performance schema database.
|
||||
*/
|
||||
#define PERFORMANCE_SCHEMA_DB_NAME "performance_schema"
|
||||
|
||||
|
|
138
client/mysql.cc
138
client/mysql.cc
|
@ -54,9 +54,6 @@ static char *server_version= NULL;
|
|||
/* Array of options to pass to libemysqld */
|
||||
#define MAX_SERVER_ARGS 64
|
||||
|
||||
/* Version numbers for deprecation messages */
|
||||
#define VER_CELOSIA "5.6"
|
||||
|
||||
void* sql_alloc(unsigned size); // Don't use mysqld alloc for these
|
||||
void sql_element_free(void *ptr);
|
||||
#include "sql_string.h"
|
||||
|
@ -103,7 +100,7 @@ extern "C" {
|
|||
#define vidattr(A) {} // Can't get this to work
|
||||
#endif
|
||||
|
||||
#ifdef FN_NO_CASE_SENCE
|
||||
#ifdef FN_NO_CASE_SENSE
|
||||
#define cmp_database(cs,A,B) my_strcasecmp((cs), (A), (B))
|
||||
#else
|
||||
#define cmp_database(cs,A,B) strcmp((A),(B))
|
||||
|
@ -146,6 +143,7 @@ static my_bool ignore_errors=0,wait_flag=0,quick=0,
|
|||
tty_password= 0, opt_nobeep=0, opt_reconnect=1,
|
||||
opt_secure_auth= 0,
|
||||
default_pager_set= 0, opt_sigint_ignore= 0,
|
||||
auto_vertical_output= 0,
|
||||
show_warnings= 0, executing_query= 0, interrupted_query= 0,
|
||||
ignore_spaces= 0;
|
||||
static my_bool debug_info_flag, debug_check_flag;
|
||||
|
@ -188,6 +186,7 @@ static MEM_ROOT hash_mem_root;
|
|||
static uint prompt_counter;
|
||||
static char delimiter[16]= DEFAULT_DELIMITER;
|
||||
static uint delimiter_length= 1;
|
||||
unsigned short terminal_width= 80;
|
||||
|
||||
#ifdef HAVE_SMEM
|
||||
static char *shared_memory_base_name=0;
|
||||
|
@ -241,6 +240,8 @@ static const char* construct_prompt();
|
|||
static char *get_arg(char *line, my_bool get_next_arg);
|
||||
static void init_username();
|
||||
static void add_int_to_prompt(int toadd);
|
||||
static int get_result_width(MYSQL_RES *res);
|
||||
static int get_field_disp_length(MYSQL_FIELD * field);
|
||||
|
||||
/* A structure which contains information on the commands this program
|
||||
can understand. */
|
||||
|
@ -456,7 +457,6 @@ static COMMANDS commands[] = {
|
|||
{ "FORCE", 0, 0, 0, ""},
|
||||
{ "FOREIGN", 0, 0, 0, ""},
|
||||
{ "FOUND", 0, 0, 0, ""},
|
||||
{ "FRAC_SECOND", 0, 0, 0, ""},
|
||||
{ "FROM", 0, 0, 0, ""},
|
||||
{ "FULL", 0, 0, 0, ""},
|
||||
{ "FULLTEXT", 0, 0, 0, ""},
|
||||
|
@ -701,7 +701,6 @@ static COMMANDS commands[] = {
|
|||
{ "SQL_NO_CACHE", 0, 0, 0, ""},
|
||||
{ "SQL_SMALL_RESULT", 0, 0, 0, ""},
|
||||
{ "SQL_THREAD", 0, 0, 0, ""},
|
||||
{ "SQL_TSI_FRAC_SECOND", 0, 0, 0, ""},
|
||||
{ "SQL_TSI_SECOND", 0, 0, 0, ""},
|
||||
{ "SQL_TSI_MINUTE", 0, 0, 0, ""},
|
||||
{ "SQL_TSI_HOUR", 0, 0, 0, ""},
|
||||
|
@ -1068,6 +1067,10 @@ static void mysql_end_timer(ulong start_time,char *buff);
|
|||
static void nice_time(double sec,char *buff,bool part_second);
|
||||
extern "C" sig_handler mysql_end(int sig);
|
||||
extern "C" sig_handler handle_sigint(int sig);
|
||||
#if defined(HAVE_TERMIOS_H) && defined(GWINSZ_IN_SYS_IOCTL)
|
||||
static sig_handler window_resize(int sig);
|
||||
#endif
|
||||
|
||||
|
||||
int main(int argc,char *argv[])
|
||||
{
|
||||
|
@ -1117,7 +1120,11 @@ int main(int argc,char *argv[])
|
|||
close(stdout_fileno_copy); /* Clean up dup(). */
|
||||
}
|
||||
|
||||
load_defaults("my",load_default_groups,&argc,&argv);
|
||||
if (load_defaults("my",load_default_groups,&argc,&argv))
|
||||
{
|
||||
my_end(0);
|
||||
exit(1);
|
||||
}
|
||||
defaults_argv=argv;
|
||||
if (get_options(argc, (char **) argv))
|
||||
{
|
||||
|
@ -1147,8 +1154,8 @@ int main(int argc,char *argv[])
|
|||
if (sql_connect(current_host,current_db,current_user,opt_password,
|
||||
opt_silent))
|
||||
{
|
||||
quick=1; // Avoid history
|
||||
status.exit_status=1;
|
||||
quick= 1; // Avoid history
|
||||
status.exit_status= 1;
|
||||
mysql_end(-1);
|
||||
}
|
||||
if (!status.batch)
|
||||
|
@ -1160,6 +1167,13 @@ int main(int argc,char *argv[])
|
|||
signal(SIGINT, handle_sigint); // Catch SIGINT to clean up
|
||||
signal(SIGQUIT, mysql_end); // Catch SIGQUIT to clean up
|
||||
|
||||
#if defined(HAVE_TERMIOS_H) && defined(GWINSZ_IN_SYS_IOCTL)
|
||||
/* Readline will call this if it installs a handler */
|
||||
signal(SIGWINCH, window_resize);
|
||||
/* call the SIGWINCH handler to get the default term width */
|
||||
window_resize(0);
|
||||
#endif
|
||||
|
||||
put_info("Welcome to the MySQL monitor. Commands end with ; or \\g.",
|
||||
INFO_INFO);
|
||||
sprintf((char*) glob_buffer.ptr(),
|
||||
|
@ -1332,6 +1346,16 @@ err:
|
|||
}
|
||||
|
||||
|
||||
#if defined(HAVE_TERMIOS_H) && defined(GWINSZ_IN_SYS_IOCTL)
|
||||
sig_handler window_resize(int sig)
|
||||
{
|
||||
struct winsize window_size;
|
||||
|
||||
if (ioctl(fileno(stdin), TIOCGWINSZ, &window_size) == 0)
|
||||
terminal_width= window_size.ws_col;
|
||||
}
|
||||
#endif
|
||||
|
||||
static struct my_option my_long_options[] =
|
||||
{
|
||||
{"help", '?', "Display this help and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0,
|
||||
|
@ -1349,6 +1373,9 @@ static struct my_option my_long_options[] =
|
|||
{"no-auto-rehash", 'A',
|
||||
"No automatic rehashing. One has to use 'rehash' to get table and field completion. This gives a quicker start of mysql and disables rehashing on reconnect.",
|
||||
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"auto-vertical-output", OPT_AUTO_VERTICAL_OUTPUT,
|
||||
"Automatically switch to vertical output mode if the result is wider than the terminal width.",
|
||||
(uchar**) &auto_vertical_output, (uchar**) &auto_vertical_output, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"batch", 'B',
|
||||
"Don't use history file. Disable interactive behavior. (Enables --silent.)", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"character-sets-dir", OPT_CHARSETS_DIR,
|
||||
|
@ -1396,13 +1423,6 @@ static struct my_option my_long_options[] =
|
|||
"Enable named commands. Named commands mean this program's internal commands; see mysql> help . When enabled, the named commands can be used from any line of the query, otherwise only from the first line, before an enter. Disable with --disable-named-commands. This option is disabled by default.",
|
||||
(uchar**) &named_cmds, (uchar**) &named_cmds, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
|
||||
0, 0},
|
||||
{"no-named-commands", 'g',
|
||||
"Named commands are disabled. Use \\* form only, or use named commands "
|
||||
"only in the beginning of a line ending with a semicolon (;). Since "
|
||||
"version 10.9, the client now starts with this option ENABLED by default. "
|
||||
"Disable with '-G'. Long format commands still work from the first line. "
|
||||
"WARNING: option deprecated; use --disable-named-commands instead.",
|
||||
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"ignore-spaces", 'i', "Ignore space after function names.",
|
||||
(uchar**) &ignore_spaces, (uchar**) &ignore_spaces, 0, GET_BOOL, NO_ARG, 0, 0,
|
||||
0, 0, 0, 0},
|
||||
|
@ -1434,9 +1454,6 @@ static struct my_option my_long_options[] =
|
|||
{"skip-column-names", 'N',
|
||||
"Don't write column names in results.",
|
||||
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"set-variable", 'O',
|
||||
"Change the value of a variable. Please note that this option is deprecated; you can set variables directly with --variable-name=value.",
|
||||
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"sigint-ignore", OPT_SIGINT_IGNORE, "Ignore SIGINT (CTRL-C).",
|
||||
(uchar**) &opt_sigint_ignore, (uchar**) &opt_sigint_ignore, 0, GET_BOOL,
|
||||
NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||
|
@ -1447,9 +1464,6 @@ static struct my_option my_long_options[] =
|
|||
{"pager", OPT_PAGER,
|
||||
"Pager to use to display results. If you don't supply an option, the default pager is taken from your ENV variable PAGER. Valid pagers are less, more, cat [> filename], etc. See interactive help (\\h) also. This option does not work in batch mode. Disable with --disable-pager. This option is disabled by default.",
|
||||
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"no-pager", OPT_NOPAGER,
|
||||
"Disable pager and print to stdout. See interactive help (\\h) also. WARNING: option deprecated; use --disable-pager instead.",
|
||||
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||
#endif
|
||||
{"password", 'p',
|
||||
"Password to use when connecting to server. If password is not given it's asked from the tty.",
|
||||
|
@ -1495,8 +1509,6 @@ static struct my_option my_long_options[] =
|
|||
{"tee", OPT_TEE,
|
||||
"Append everything into outfile. See interactive help (\\h) also. Does not work in batch mode. Disable with --disable-tee. This option is disabled by default.",
|
||||
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"no-tee", OPT_NOTEE, "Disable outfile. See interactive help (\\h) also. WARNING: Option deprecated; use --disable-tee instead.", 0, 0, 0, GET_NO_ARG,
|
||||
NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||
#ifndef DONT_ALLOW_USER_CHANGE
|
||||
{"user", 'u', "User for login if not current user.", (uchar**) ¤t_user,
|
||||
(uchar**) ¤t_user, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
|
@ -1635,11 +1647,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||
else
|
||||
init_tee(argument);
|
||||
break;
|
||||
case OPT_NOTEE:
|
||||
WARN_DEPRECATED(VER_CELOSIA, "--no-tee", "--disable-tee");
|
||||
if (opt_outfile)
|
||||
end_tee();
|
||||
break;
|
||||
case OPT_PAGER:
|
||||
if (argument == disabled_my_option)
|
||||
opt_nopager= 1;
|
||||
|
@ -1658,10 +1665,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||
opt_nopager= 1;
|
||||
}
|
||||
break;
|
||||
case OPT_NOPAGER:
|
||||
WARN_DEPRECATED(VER_CELOSIA, "--no-pager", "--disable-pager");
|
||||
opt_nopager= 1;
|
||||
break;
|
||||
case OPT_MYSQL_PROTOCOL:
|
||||
#ifndef EMBEDDED_LIBRARY
|
||||
opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib,
|
||||
|
@ -1705,18 +1708,12 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||
if (!(status.line_buff= batch_readline_command(status.line_buff, argument)))
|
||||
return 1;
|
||||
break;
|
||||
case 'g':
|
||||
WARN_DEPRECATED(VER_CELOSIA, "-g, --no-named-commands", "--skip-named-commands");
|
||||
break;
|
||||
case 'o':
|
||||
if (argument == disabled_my_option)
|
||||
one_database= 0;
|
||||
else
|
||||
one_database= skip_updates= 1;
|
||||
break;
|
||||
case 'O':
|
||||
WARN_DEPRECATED(VER_CELOSIA, "-O, --set-variable", "--variable-name=value");
|
||||
break;
|
||||
case 'p':
|
||||
if (argument == disabled_my_option)
|
||||
argument= (char*) ""; // Don't require password
|
||||
|
@ -3065,7 +3062,7 @@ com_go(String *buffer,char *line __attribute__((unused)))
|
|||
print_table_data_html(result);
|
||||
else if (opt_xml)
|
||||
print_table_data_xml(result);
|
||||
else if (vertical)
|
||||
else if (vertical || (auto_vertical_output && (terminal_width < get_result_width(result))))
|
||||
print_table_data_vertically(result);
|
||||
else if (opt_silent && verbose <= 2 && !output_tables)
|
||||
print_tab_data(result);
|
||||
|
@ -3396,6 +3393,65 @@ print_table_data(MYSQL_RES *result)
|
|||
my_afree((uchar*) num_flag);
|
||||
}
|
||||
|
||||
/**
|
||||
Return the length of a field after it would be rendered into text.
|
||||
|
||||
This doesn't know or care about multibyte characters. Assume we're
|
||||
using such a charset. We can't know that all of the upcoming rows
|
||||
for this column will have bytes that each render into some fraction
|
||||
of a character. It's at least possible that a row has bytes that
|
||||
all render into one character each, and so the maximum length is
|
||||
still the number of bytes. (Assumption 1: This can't be better
|
||||
because we can never know the number of characters that the DB is
|
||||
going to send -- only the number of bytes. 2: Chars <= Bytes.)
|
||||
|
||||
@param field Pointer to a field to be inspected
|
||||
|
||||
@returns number of character positions to be used, at most
|
||||
*/
|
||||
static int get_field_disp_length(MYSQL_FIELD *field)
|
||||
{
|
||||
uint length= column_names ? field->name_length : 0;
|
||||
|
||||
if (quick)
|
||||
length= max(length, field->length);
|
||||
else
|
||||
length= max(length, field->max_length);
|
||||
|
||||
if (length < 4 && !IS_NOT_NULL(field->flags))
|
||||
length= 4; /* Room for "NULL" */
|
||||
|
||||
return length;
|
||||
}
|
||||
|
||||
/**
|
||||
For a new result, return the max number of characters that any
|
||||
upcoming row may return.
|
||||
|
||||
@param result Pointer to the result to judge
|
||||
|
||||
@returns The max number of characters in any row of this result
|
||||
*/
|
||||
static int get_result_width(MYSQL_RES *result)
|
||||
{
|
||||
unsigned int len= 0;
|
||||
MYSQL_FIELD *field;
|
||||
MYSQL_FIELD_OFFSET offset;
|
||||
|
||||
#ifndef DBUG_OFF
|
||||
offset= mysql_field_tell(result);
|
||||
DBUG_ASSERT(offset == 0);
|
||||
#else
|
||||
offset= 0;
|
||||
#endif
|
||||
|
||||
while ((field= mysql_fetch_field(result)) != NULL)
|
||||
len+= get_field_disp_length(field) + 3; /* plus bar, space, & final space */
|
||||
|
||||
(void) mysql_field_seek(result, offset);
|
||||
|
||||
return len + 1; /* plus final bar. */
|
||||
}
|
||||
|
||||
static void
|
||||
tee_print_sized_data(const char *data, unsigned int data_length, unsigned int total_bytes_to_send, bool right_justified)
|
||||
|
@ -3575,7 +3631,7 @@ static void print_warnings()
|
|||
mysql_store_result_for_lazy(&result);
|
||||
|
||||
/* Bail out when no warnings */
|
||||
if (!(num_rows= mysql_num_rows(result)))
|
||||
if (!result || !(num_rows= mysql_num_rows(result)))
|
||||
goto end;
|
||||
|
||||
cur= mysql_fetch_row(result);
|
||||
|
|
|
@ -823,7 +823,8 @@ int main(int argc, char **argv)
|
|||
init_dynamic_string(&conn_args, "", 512, 256))
|
||||
die("Out of memory");
|
||||
|
||||
load_defaults("my", load_default_groups, &argc, &argv);
|
||||
if (load_defaults("my", load_default_groups, &argc, &argv))
|
||||
die(NULL);
|
||||
defaults_argv= argv; /* Must be freed by 'free_defaults' */
|
||||
|
||||
if (handle_options(&argc, &argv, my_long_options, get_one_option))
|
||||
|
|
|
@ -174,9 +174,6 @@ static struct my_option my_long_options[] =
|
|||
"Show difference between current and previous values when used with -i. Currently only works with extended-status.",
|
||||
(uchar**) &opt_relative, (uchar**) &opt_relative, 0, GET_BOOL, NO_ARG, 0, 0, 0,
|
||||
0, 0, 0},
|
||||
{"set-variable", 'O',
|
||||
"Change the value of a variable. Please note that this option is deprecated; you can set variables directly with --variable-name=value.",
|
||||
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
#ifdef HAVE_SMEM
|
||||
{"shared-memory-base-name", OPT_SHARED_MEMORY_BASE_NAME,
|
||||
"Base name of shared memory.", (uchar**) &shared_memory_base_name, (uchar**) &shared_memory_base_name,
|
||||
|
@ -282,9 +279,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||
charsets_dir = argument;
|
||||
#endif
|
||||
break;
|
||||
case 'O':
|
||||
WARN_DEPRECATED(VER_CELOSIA, "--set-variable", "--variable-name=value");
|
||||
break;
|
||||
case OPT_MYSQL_PROTOCOL:
|
||||
opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib,
|
||||
opt->name);
|
||||
|
@ -307,7 +301,8 @@ int main(int argc,char *argv[])
|
|||
|
||||
MY_INIT(argv[0]);
|
||||
mysql_init(&mysql);
|
||||
load_defaults("my",load_default_groups,&argc,&argv);
|
||||
if (load_defaults("my",load_default_groups,&argc,&argv))
|
||||
exit(1);
|
||||
save_argv = argv; /* Save for free_defaults */
|
||||
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
|
||||
{
|
||||
|
@ -328,8 +323,8 @@ int main(int argc,char *argv[])
|
|||
if (tty_password)
|
||||
opt_password = get_tty_password(NullS);
|
||||
|
||||
VOID(signal(SIGINT,endprog)); /* Here if abort */
|
||||
VOID(signal(SIGTERM,endprog)); /* Here if abort */
|
||||
(void) signal(SIGINT,endprog); /* Here if abort */
|
||||
(void) signal(SIGTERM,endprog); /* Here if abort */
|
||||
|
||||
if (opt_compress)
|
||||
mysql_options(&mysql,MYSQL_OPT_COMPRESS,NullS);
|
||||
|
@ -903,23 +898,38 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
|
|||
{
|
||||
char buff[128],crypted_pw[64];
|
||||
time_t start_time;
|
||||
char *typed_password= NULL, *verified= NULL;
|
||||
/* Do initialization the same way as we do in mysqld */
|
||||
start_time=time((time_t*) 0);
|
||||
randominit(&rand_st,(ulong) start_time,(ulong) start_time/2);
|
||||
|
||||
if (argc < 2)
|
||||
if (argc < 1)
|
||||
{
|
||||
my_printf_error(0, "Too few arguments to change password", error_flags);
|
||||
return 1;
|
||||
}
|
||||
if (argv[1][0])
|
||||
else if (argc == 1)
|
||||
{
|
||||
/* prompt for password */
|
||||
typed_password= get_tty_password("New password: ");
|
||||
verified= get_tty_password("Confirm new password: ");
|
||||
if (strcmp(typed_password, verified) != 0)
|
||||
{
|
||||
my_printf_error(0,"Passwords don't match",MYF(ME_BELL));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
typed_password= argv[1];
|
||||
|
||||
if (typed_password[0])
|
||||
{
|
||||
char *pw= argv[1];
|
||||
bool old= (find_type(argv[0], &command_typelib, 2) ==
|
||||
ADMIN_OLD_PASSWORD);
|
||||
#ifdef __WIN__
|
||||
uint pw_len= (uint) strlen(pw);
|
||||
if (pw_len > 1 && pw[0] == '\'' && pw[pw_len-1] == '\'')
|
||||
size_t pw_len= strlen(typed_password);
|
||||
if (pw_len > 1 && typed_password[0] == '\'' &&
|
||||
typed_password[pw_len-1] == '\'')
|
||||
printf("Warning: single quotes were not trimmed from the password by"
|
||||
" your command\nline client, as you might have expected.\n");
|
||||
#endif
|
||||
|
@ -957,9 +967,9 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
|
|||
}
|
||||
}
|
||||
if (old)
|
||||
make_scrambled_password_323(crypted_pw, pw);
|
||||
make_scrambled_password_323(crypted_pw, typed_password);
|
||||
else
|
||||
make_scrambled_password(crypted_pw, pw);
|
||||
make_scrambled_password(crypted_pw, typed_password);
|
||||
}
|
||||
else
|
||||
crypted_pw[0]=0; /* No password */
|
||||
|
@ -994,6 +1004,12 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
|
|||
return -1;
|
||||
}
|
||||
}
|
||||
/* free up memory from prompted password */
|
||||
if (typed_password != argv[1])
|
||||
{
|
||||
my_free(typed_password,MYF(MY_ALLOW_ZERO_PTR));
|
||||
my_free(verified,MYF(MY_ALLOW_ZERO_PTR));
|
||||
}
|
||||
argc--; argv++;
|
||||
break;
|
||||
}
|
||||
|
@ -1085,8 +1101,8 @@ static void usage(void)
|
|||
kill id,id,... Kill mysql threads");
|
||||
#if MYSQL_VERSION_ID >= 32200
|
||||
puts("\
|
||||
password new-password Change old password to new-password, MySQL 4.1 hashing.\n\
|
||||
old-password new-password Change old password to new-password in old format.\n");
|
||||
password [new-password] Change old password to new-password in current format\n\
|
||||
old-password [new-password] Change old password to new-password in old format");
|
||||
#endif
|
||||
puts("\
|
||||
ping Check if mysqld is alive\n\
|
||||
|
|
|
@ -41,7 +41,6 @@
|
|||
|
||||
#define CLIENT_CAPABILITIES (CLIENT_LONG_PASSWORD | CLIENT_LONG_FLAG | CLIENT_LOCAL_FILES)
|
||||
|
||||
|
||||
char server_version[SERVER_VERSION_LENGTH];
|
||||
ulong server_id = 0;
|
||||
|
||||
|
@ -443,6 +442,7 @@ Exit_status Load_log_processor::process_first_event(const char *bname,
|
|||
{
|
||||
error("Could not construct local filename %s%s.",
|
||||
target_dir_name,bname);
|
||||
my_free(fname, MYF(0));
|
||||
delete ce;
|
||||
DBUG_RETURN(ERROR_STOP);
|
||||
}
|
||||
|
@ -450,9 +450,15 @@ Exit_status Load_log_processor::process_first_event(const char *bname,
|
|||
rec.fname= fname;
|
||||
rec.event= ce;
|
||||
|
||||
/*
|
||||
fname is freed in process_event()
|
||||
after Execute_load_query_log_event or Execute_load_log_event
|
||||
will have been processed, otherwise in Load_log_processor::destroy()
|
||||
*/
|
||||
if (set_dynamic(&file_names, (uchar*)&rec, file_id))
|
||||
{
|
||||
error("Out of memory.");
|
||||
my_free(fname, MYF(0));
|
||||
delete ce;
|
||||
DBUG_RETURN(ERROR_STOP);
|
||||
}
|
||||
|
@ -832,7 +838,17 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
|
|||
print_event_info->common_header_len=
|
||||
glob_description_event->common_header_len;
|
||||
ev->print(result_file, print_event_info);
|
||||
ev->temp_buf= 0; // as the event ref is zeroed
|
||||
if (!remote_opt)
|
||||
{
|
||||
ev->free_temp_buf(); // free memory allocated in dump_local_log_entries
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
disassociate but not free dump_remote_log_entries time memory
|
||||
*/
|
||||
ev->temp_buf= 0;
|
||||
}
|
||||
/*
|
||||
We don't want this event to be deleted now, so let's hide it (I
|
||||
(Guilhem) should later see if this triggers a non-serious Valgrind
|
||||
|
@ -1061,11 +1077,6 @@ static struct my_option my_long_options[] =
|
|||
"built-in default (" STRINGIFY_ARG(MYSQL_PORT) ").",
|
||||
(uchar**) &port, (uchar**) &port, 0, GET_INT, REQUIRED_ARG,
|
||||
0, 0, 0, 0, 0, 0},
|
||||
{"position", OPT_POSITION, "Deprecated. Use --start-position instead.",
|
||||
(uchar**) &start_position, (uchar**) &start_position, 0, GET_ULL,
|
||||
REQUIRED_ARG, BIN_LOG_HEADER_SIZE, BIN_LOG_HEADER_SIZE,
|
||||
/* COM_BINLOG_DUMP accepts only 4 bytes for the position */
|
||||
(ulonglong)(~(uint32)0), 0, 0, 0},
|
||||
{"protocol", OPT_MYSQL_PROTOCOL,
|
||||
"The protocol to use for connection (tcp, socket, pipe, memory).",
|
||||
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
|
@ -1315,9 +1326,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||
case 'R':
|
||||
remote_opt= 1;
|
||||
break;
|
||||
case OPT_POSITION:
|
||||
WARN_DEPRECATED(VER_CELOSIA, "--position", "--start-position");
|
||||
break;
|
||||
case OPT_MYSQL_PROTOCOL:
|
||||
opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib,
|
||||
opt->name);
|
||||
|
@ -2018,7 +2026,8 @@ int main(int argc, char** argv)
|
|||
|
||||
my_init_time(); // for time functions
|
||||
|
||||
load_defaults("my", load_default_groups, &argc, &argv);
|
||||
if (load_defaults("my", load_default_groups, &argc, &argv))
|
||||
exit(1);
|
||||
defaults_argv= argv;
|
||||
parse_args(&argc, (char***)&argv);
|
||||
|
||||
|
@ -2126,4 +2135,4 @@ int main(int argc, char** argv)
|
|||
#include "my_decimal.cc"
|
||||
#include "log_event.cc"
|
||||
#include "log_event_old.cc"
|
||||
|
||||
#include "rpl_utility.cc"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2000 MySQL AB
|
||||
/* Copyright (C) 2000 MySQL AB, 2009 Sun Microsystems, Inc
|
||||
|
||||
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
|
||||
|
@ -128,7 +128,7 @@ static struct my_option my_long_options[] =
|
|||
"Faster than extended-check, but only finds 99.99 percent of all errors. Should be good enough for most cases.",
|
||||
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"write-binlog", OPT_WRITE_BINLOG,
|
||||
"Log ANALYZE, OPTIMIZE and REPAIR TABLE commands. Enabled by default; use --skip-write-binlog when commands should not be sent to replication slaves.",
|
||||
"Log ANALYZE, OPTIMIZE and REPAIR TABLE commands. Use --skip-write-binlog when commands should not be sent to replication slaves.",
|
||||
(uchar**) &opt_write_binlog, (uchar**) &opt_write_binlog, 0, GET_BOOL, NO_ARG,
|
||||
1, 0, 0, 0, 0, 0},
|
||||
{"optimize", 'o', "Optimize table.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0,
|
||||
|
@ -344,9 +344,8 @@ static int get_options(int *argc, char ***argv)
|
|||
exit(0);
|
||||
}
|
||||
|
||||
load_defaults("my", load_default_groups, argc, argv);
|
||||
|
||||
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
|
||||
if ((ho_error= load_defaults("my", load_default_groups, argc, argv)) ||
|
||||
(ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
|
||||
exit(ho_error);
|
||||
|
||||
if (!what_to_do)
|
||||
|
@ -644,8 +643,11 @@ static int process_one_db(char *database)
|
|||
|
||||
static int use_db(char *database)
|
||||
{
|
||||
if (mysql_get_server_version(sock) >= 50003 &&
|
||||
!my_strcasecmp(&my_charset_latin1, database, "information_schema"))
|
||||
if (mysql_get_server_version(sock) >= FIRST_INFORMATION_SCHEMA_VERSION &&
|
||||
!my_strcasecmp(&my_charset_latin1, database, INFORMATION_SCHEMA_DB_NAME))
|
||||
return 1;
|
||||
if (mysql_get_server_version(sock) >= FIRST_PERFORMANCE_SCHEMA_VERSION &&
|
||||
!my_strcasecmp(&my_charset_latin1, database, PERFORMANCE_SCHEMA_DB_NAME))
|
||||
return 1;
|
||||
if (mysql_select_db(sock, database))
|
||||
{
|
||||
|
|
|
@ -98,6 +98,8 @@ static my_bool verbose= 0, opt_no_create_info= 0, opt_no_data= 0,
|
|||
opt_complete_insert= 0, opt_drop_database= 0,
|
||||
opt_replace_into= 0,
|
||||
opt_dump_triggers= 0, opt_routines=0, opt_tz_utc=1,
|
||||
opt_slave_apply= 0,
|
||||
opt_include_master_host_port= 0,
|
||||
opt_events= 0,
|
||||
opt_alltspcs=0, opt_notspcs= 0;
|
||||
static my_bool insert_pat_inited= 0, debug_info_flag= 0, debug_check_flag= 0;
|
||||
|
@ -118,7 +120,10 @@ static my_bool server_supports_switching_charsets= TRUE;
|
|||
static ulong opt_compatible_mode= 0;
|
||||
#define MYSQL_OPT_MASTER_DATA_EFFECTIVE_SQL 1
|
||||
#define MYSQL_OPT_MASTER_DATA_COMMENTED_SQL 2
|
||||
#define MYSQL_OPT_SLAVE_DATA_EFFECTIVE_SQL 1
|
||||
#define MYSQL_OPT_SLAVE_DATA_COMMENTED_SQL 2
|
||||
static uint opt_mysql_port= 0, opt_master_data;
|
||||
static uint opt_slave_data;
|
||||
static uint my_end_arg;
|
||||
static char * opt_mysql_unix_port=0;
|
||||
static int first_error=0;
|
||||
|
@ -179,9 +184,6 @@ HASH ignore_table;
|
|||
|
||||
static struct my_option my_long_options[] =
|
||||
{
|
||||
{"all", OPT_ALL, "Deprecated. Use --create-options instead.",
|
||||
(uchar**) &create_options, (uchar**) &create_options, 0, GET_BOOL, NO_ARG, 1,
|
||||
0, 0, 0, 0, 0},
|
||||
{"all-databases", 'A',
|
||||
"Dump all the databases. This will be same as --databases with all databases selected.",
|
||||
(uchar**) &opt_alldbs, (uchar**) &opt_alldbs, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
|
||||
|
@ -206,6 +208,10 @@ static struct my_option my_long_options[] =
|
|||
{"allow-keywords", OPT_KEYWORDS,
|
||||
"Allow creation of column names that are keywords.", (uchar**) &opt_keywords,
|
||||
(uchar**) &opt_keywords, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"apply-slave-statements", OPT_MYSQLDUMP_SLAVE_APPLY,
|
||||
"Adds 'STOP SLAVE' prior to 'CHANGE MASTER' and 'START SLAVE' to bottom of dump.",
|
||||
(uchar**) &opt_slave_apply, (uchar**) &opt_slave_apply, 0, GET_BOOL, NO_ARG,
|
||||
0, 0, 0, 0, 0, 0},
|
||||
#ifdef __NETWARE__
|
||||
{"autoclose", OPT_AUTO_CLOSE, "Automatically close the screen on exit for Netware.",
|
||||
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||
|
@ -264,6 +270,19 @@ static struct my_option my_long_options[] =
|
|||
{"disable-keys", 'K',
|
||||
"'/*!40000 ALTER TABLE tb_name DISABLE KEYS */; and '/*!40000 ALTER TABLE tb_name ENABLE KEYS */; will be put in the output.", (uchar**) &opt_disable_keys,
|
||||
(uchar**) &opt_disable_keys, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
|
||||
{"dump-slave", OPT_MYSQLDUMP_SLAVE_DATA,
|
||||
"This causes the binary log position and filename of the master to be "
|
||||
"appended to the dumped data output. Setting the value to 1, will print"
|
||||
"it as a CHANGE MASTER command in the dumped data output; if equal"
|
||||
" to 2, that command will be prefixed with a comment symbol. "
|
||||
"This option will turn --lock-all-tables on, unless "
|
||||
"--single-transaction is specified too (in which case a "
|
||||
"global read lock is only taken a short time at the beginning of the dump "
|
||||
"- don't forget to read about --single-transaction below). In all cases "
|
||||
"any action on logs will happen at the exact moment of the dump."
|
||||
"Option automatically turns --lock-tables off.",
|
||||
(uchar**) &opt_slave_data, (uchar**) &opt_slave_data, 0,
|
||||
GET_UINT, OPT_ARG, 0, 0, MYSQL_OPT_SLAVE_DATA_COMMENTED_SQL, 0, 0, 0},
|
||||
{"events", 'E', "Dump events.",
|
||||
(uchar**) &opt_events, (uchar**) &opt_events, 0, GET_BOOL,
|
||||
NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||
|
@ -280,16 +299,13 @@ static struct my_option my_long_options[] =
|
|||
(uchar**) &enclosed, (uchar**) &enclosed, 0,
|
||||
GET_STR, REQUIRED_ARG, 0, 0, 0, 0 ,0, 0},
|
||||
{"fields-optionally-enclosed-by", OPT_O_ENC,
|
||||
"Fields in the output file are optionally enclosed by the given character.",
|
||||
(uchar**) &opt_enclosed, (uchar**) &opt_enclosed, 0,
|
||||
"Fields in the output file are optionally enclosed by the given character.",
|
||||
(uchar**) &opt_enclosed, (uchar**) &opt_enclosed, 0,
|
||||
GET_STR, REQUIRED_ARG, 0, 0, 0, 0 ,0, 0},
|
||||
{"fields-escaped-by", OPT_ESC,
|
||||
{"fields-escaped-by", OPT_ESC,
|
||||
"Fields in the output file are escaped by the given character.",
|
||||
(uchar**) &escaped, (uchar**) &escaped, 0,
|
||||
(uchar**) &escaped, (uchar**) &escaped, 0,
|
||||
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"first-slave", OPT_FIRST_SLAVE, "Deprecated, renamed to --lock-all-tables.",
|
||||
(uchar**) &opt_lock_all_tables, (uchar**) &opt_lock_all_tables, 0, GET_BOOL, NO_ARG,
|
||||
0, 0, 0, 0, 0, 0},
|
||||
{"flush-logs", 'F', "Flush logs file in server before starting dump. "
|
||||
"Note that if you dump many databases at once (using the option "
|
||||
"--databases= or --all-databases), the logs will be flushed for "
|
||||
|
@ -323,6 +339,12 @@ static struct my_option my_long_options[] =
|
|||
"be specified with both database and table names, e.g., "
|
||||
"--ignore-table=database.table.",
|
||||
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"include-master-host-port", OPT_MYSQLDUMP_INCLUDE_MASTER_HOST_PORT,
|
||||
"Adds 'MASTER_HOST=<host>, MASTER_PORT=<port>' to 'CHANGE MASTER TO..' in dump produced with --dump-slave.",
|
||||
(uchar**) &opt_include_master_host_port,
|
||||
(uchar**) &opt_include_master_host_port,
|
||||
0, GET_BOOL, NO_ARG,
|
||||
0, 0, 0, 0, 0, 0},
|
||||
{"insert-ignore", OPT_INSERT_IGNORE, "Insert rows with INSERT IGNORE.",
|
||||
(uchar**) &opt_ignore, (uchar**) &opt_ignore, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
|
||||
0, 0},
|
||||
|
@ -377,7 +399,7 @@ static struct my_option my_long_options[] =
|
|||
NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"no-data", 'd', "No row information.", (uchar**) &opt_no_data,
|
||||
(uchar**) &opt_no_data, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"no-set-names", 'N',"Suppress the SET NAMES statement",
|
||||
{"no-set-names", 'N', "Same as--skip-set-charset.",
|
||||
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"opt", OPT_OPTIMIZE,
|
||||
"Same as --add-drop-table, --add-locks, --create-options, --quick, --extended-insert, --lock-tables, --set-charset, and --disable-keys. Enabled by default, disable with --skip-opt.",
|
||||
|
@ -413,12 +435,9 @@ static struct my_option my_long_options[] =
|
|||
(uchar**) &opt_routines, (uchar**) &opt_routines, 0, GET_BOOL,
|
||||
NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"set-charset", OPT_SET_CHARSET,
|
||||
"Add 'SET NAMES default_character_set' to the output. Enabled by default; suppress with --skip-set-charset.",
|
||||
"Add 'SET NAMES default_character_set' to the output.",
|
||||
(uchar**) &opt_set_charset, (uchar**) &opt_set_charset, 0, GET_BOOL, NO_ARG, 1,
|
||||
0, 0, 0, 0, 0},
|
||||
{"set-variable", 'O',
|
||||
"Change the value of a variable. Please note that this option is deprecated; you can set variables directly with --variable-name=value.",
|
||||
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
#ifdef HAVE_SMEM
|
||||
{"shared-memory-base-name", OPT_SHARED_MEMORY_BASE_NAME,
|
||||
"Base name of shared memory.", (uchar**) &shared_memory_base_name, (uchar**) &shared_memory_base_name,
|
||||
|
@ -773,19 +792,14 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||
case '?':
|
||||
usage();
|
||||
exit(0);
|
||||
case 'O':
|
||||
WARN_DEPRECATED(VER_CELOSIA, "--set-variable", "--variable-name=value");
|
||||
break;
|
||||
case (int) OPT_ALL:
|
||||
WARN_DEPRECATED(VER_CELOSIA, "--all", "--create-options");
|
||||
break;
|
||||
case (int) OPT_FIRST_SLAVE:
|
||||
WARN_DEPRECATED(VER_CELOSIA, "--first-slave", "--lock-all-tables");
|
||||
break;
|
||||
case (int) OPT_MASTER_DATA:
|
||||
if (!argument) /* work like in old versions */
|
||||
opt_master_data= MYSQL_OPT_MASTER_DATA_EFFECTIVE_SQL;
|
||||
break;
|
||||
case (int) OPT_MYSQLDUMP_SLAVE_DATA:
|
||||
if (!argument) /* work like in old versions */
|
||||
opt_slave_data= MYSQL_OPT_SLAVE_DATA_EFFECTIVE_SQL;
|
||||
break;
|
||||
case (int) OPT_OPTIMIZE:
|
||||
extended_insert= opt_drop= opt_lock= quick= create_options=
|
||||
opt_disable_keys= lock_tables= opt_set_charset= 1;
|
||||
|
@ -880,7 +894,8 @@ static int get_options(int *argc, char ***argv)
|
|||
opt_net_buffer_length= *mysql_params->p_net_buffer_length;
|
||||
|
||||
md_result_file= stdout;
|
||||
load_defaults("my",load_default_groups,argc,argv);
|
||||
if (load_defaults("my",load_default_groups,argc,argv))
|
||||
return 1;
|
||||
defaults_argv= *argv;
|
||||
|
||||
if (my_hash_init(&ignore_table, charset_info, 16, 0, 0,
|
||||
|
@ -918,6 +933,14 @@ static int get_options(int *argc, char ***argv)
|
|||
return(EX_USAGE);
|
||||
}
|
||||
|
||||
/* We don't delete master logs if slave data option */
|
||||
if (opt_slave_data)
|
||||
{
|
||||
opt_lock_all_tables= !opt_single_transaction;
|
||||
opt_master_data= 0;
|
||||
opt_delete_master_logs= 0;
|
||||
}
|
||||
|
||||
/* Ensure consistency of the set of binlog & locking options */
|
||||
if (opt_delete_master_logs && !opt_master_data)
|
||||
opt_master_data= MYSQL_OPT_MASTER_DATA_COMMENTED_SQL;
|
||||
|
@ -928,7 +951,10 @@ static int get_options(int *argc, char ***argv)
|
|||
return(EX_USAGE);
|
||||
}
|
||||
if (opt_master_data)
|
||||
{
|
||||
opt_lock_all_tables= !opt_single_transaction;
|
||||
opt_slave_data= 0;
|
||||
}
|
||||
if (opt_single_transaction || opt_lock_all_tables)
|
||||
lock_tables= 0;
|
||||
if (enclosed && opt_enclosed)
|
||||
|
@ -1980,7 +2006,7 @@ static uint dump_events_for_db(char *db)
|
|||
mysql_free_result(event_list_res);
|
||||
|
||||
if (lock_tables)
|
||||
VOID(mysql_query_with_error_report(mysql, 0, "UNLOCK TABLES"));
|
||||
(void) mysql_query_with_error_report(mysql, 0, "UNLOCK TABLES");
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
|
@ -2183,7 +2209,7 @@ static uint dump_routines_for_db(char *db)
|
|||
DBUG_RETURN(1);
|
||||
|
||||
if (lock_tables)
|
||||
VOID(mysql_query_with_error_report(mysql, 0, "UNLOCK TABLES"));
|
||||
(void) mysql_query_with_error_report(mysql, 0, "UNLOCK TABLES");
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
|
@ -3815,8 +3841,12 @@ static int dump_all_databases()
|
|||
return 1;
|
||||
while ((row= mysql_fetch_row(tableres)))
|
||||
{
|
||||
if (mysql_get_server_version(mysql) >= 50003 &&
|
||||
!my_strcasecmp(&my_charset_latin1, row[0], "information_schema"))
|
||||
if (mysql_get_server_version(mysql) >= FIRST_INFORMATION_SCHEMA_VERSION &&
|
||||
!my_strcasecmp(&my_charset_latin1, row[0], INFORMATION_SCHEMA_DB_NAME))
|
||||
continue;
|
||||
|
||||
if (mysql_get_server_version(mysql) >= FIRST_PERFORMANCE_SCHEMA_VERSION &&
|
||||
!my_strcasecmp(&my_charset_latin1, row[0], PERFORMANCE_SCHEMA_DB_NAME))
|
||||
continue;
|
||||
|
||||
if (dump_all_tables_in_db(row[0]))
|
||||
|
@ -3833,8 +3863,12 @@ static int dump_all_databases()
|
|||
}
|
||||
while ((row= mysql_fetch_row(tableres)))
|
||||
{
|
||||
if (mysql_get_server_version(mysql) >= 50003 &&
|
||||
!my_strcasecmp(&my_charset_latin1, row[0], "information_schema"))
|
||||
if (mysql_get_server_version(mysql) >= FIRST_INFORMATION_SCHEMA_VERSION &&
|
||||
!my_strcasecmp(&my_charset_latin1, row[0], INFORMATION_SCHEMA_DB_NAME))
|
||||
continue;
|
||||
|
||||
if (mysql_get_server_version(mysql) >= FIRST_PERFORMANCE_SCHEMA_VERSION &&
|
||||
!my_strcasecmp(&my_charset_latin1, row[0], PERFORMANCE_SCHEMA_DB_NAME))
|
||||
continue;
|
||||
|
||||
if (dump_all_views_in_db(row[0]))
|
||||
|
@ -4065,7 +4099,7 @@ static int dump_all_tables_in_db(char *database)
|
|||
check_io(md_result_file);
|
||||
}
|
||||
if (lock_tables)
|
||||
VOID(mysql_query_with_error_report(mysql, 0, "UNLOCK TABLES"));
|
||||
(void) mysql_query_with_error_report(mysql, 0, "UNLOCK TABLES");
|
||||
if (flush_privileges && using_mysql_db == 0)
|
||||
{
|
||||
fprintf(md_result_file,"\n--\n-- Flush Grant Tables \n--\n");
|
||||
|
@ -4139,7 +4173,7 @@ static my_bool dump_all_views_in_db(char *database)
|
|||
check_io(md_result_file);
|
||||
}
|
||||
if (lock_tables)
|
||||
VOID(mysql_query_with_error_report(mysql, 0, "UNLOCK TABLES"));
|
||||
(void) mysql_query_with_error_report(mysql, 0, "UNLOCK TABLES");
|
||||
return 0;
|
||||
} /* dump_all_tables_in_db */
|
||||
|
||||
|
@ -4235,10 +4269,12 @@ static int dump_selected_tables(char *db, char **table_names, int tables)
|
|||
}
|
||||
end= pos;
|
||||
|
||||
/* Can't LOCK TABLES in INFORMATION_SCHEMA, so don't try. */
|
||||
/* Can't LOCK TABLES in I_S / P_S, so don't try. */
|
||||
if (lock_tables &&
|
||||
!(mysql_get_server_version(mysql) >= 50003 &&
|
||||
!my_strcasecmp(&my_charset_latin1, db, "information_schema")))
|
||||
!(mysql_get_server_version(mysql) >= FIRST_INFORMATION_SCHEMA_VERSION &&
|
||||
!my_strcasecmp(&my_charset_latin1, db, INFORMATION_SCHEMA_DB_NAME)) &&
|
||||
!(mysql_get_server_version(mysql) >= FIRST_PERFORMANCE_SCHEMA_VERSION &&
|
||||
!my_strcasecmp(&my_charset_latin1, db, PERFORMANCE_SCHEMA_DB_NAME)))
|
||||
{
|
||||
if (mysql_real_query(mysql, lock_tables_query.str,
|
||||
lock_tables_query.length-1))
|
||||
|
@ -4311,7 +4347,7 @@ static int dump_selected_tables(char *db, char **table_names, int tables)
|
|||
check_io(md_result_file);
|
||||
}
|
||||
if (lock_tables)
|
||||
VOID(mysql_query_with_error_report(mysql, 0, "UNLOCK TABLES"));
|
||||
(void) mysql_query_with_error_report(mysql, 0, "UNLOCK TABLES");
|
||||
DBUG_RETURN(0);
|
||||
} /* dump_selected_tables */
|
||||
|
||||
|
@ -4355,6 +4391,130 @@ static int do_show_master_status(MYSQL *mysql_con)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int do_stop_slave_sql(MYSQL *mysql_con)
|
||||
{
|
||||
MYSQL_RES *slave;
|
||||
/* We need to check if the slave sql is running in the first place */
|
||||
if (mysql_query_with_error_report(mysql_con, &slave, "SHOW SLAVE STATUS"))
|
||||
return(1);
|
||||
else
|
||||
{
|
||||
MYSQL_ROW row= mysql_fetch_row(slave);
|
||||
if (row && row[11])
|
||||
{
|
||||
/* if SLAVE SQL is not running, we don't stop it */
|
||||
if (!strcmp(row[11],"No"))
|
||||
{
|
||||
mysql_free_result(slave);
|
||||
/* Silently assume that they don't have the slave running */
|
||||
return(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
mysql_free_result(slave);
|
||||
|
||||
/* now, stop slave if running */
|
||||
if (mysql_query_with_error_report(mysql_con, 0, "STOP SLAVE SQL_THREAD"))
|
||||
return(1);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
static int add_stop_slave(void)
|
||||
{
|
||||
if (opt_comments)
|
||||
fprintf(md_result_file,
|
||||
"\n--\n-- stop slave statement to make a recovery dump)\n--\n\n");
|
||||
fprintf(md_result_file, "STOP SLAVE;\n");
|
||||
return(0);
|
||||
}
|
||||
|
||||
static int add_slave_statements(void)
|
||||
{
|
||||
if (opt_comments)
|
||||
fprintf(md_result_file,
|
||||
"\n--\n-- start slave statement to make a recovery dump)\n--\n\n");
|
||||
fprintf(md_result_file, "START SLAVE;\n");
|
||||
return(0);
|
||||
}
|
||||
|
||||
static int do_show_slave_status(MYSQL *mysql_con)
|
||||
{
|
||||
MYSQL_RES *slave;
|
||||
const char *comment_prefix=
|
||||
(opt_slave_data == MYSQL_OPT_SLAVE_DATA_COMMENTED_SQL) ? "-- " : "";
|
||||
if (mysql_query_with_error_report(mysql_con, &slave, "SHOW SLAVE STATUS"))
|
||||
{
|
||||
if (!ignore_errors)
|
||||
{
|
||||
/* SHOW SLAVE STATUS reports nothing and --force is not enabled */
|
||||
my_printf_error(0, "Error: Slave not set up", MYF(0));
|
||||
}
|
||||
mysql_free_result(slave);
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
MYSQL_ROW row= mysql_fetch_row(slave);
|
||||
if (row && row[9] && row[21])
|
||||
{
|
||||
/* SHOW MASTER STATUS reports file and position */
|
||||
if (opt_comments)
|
||||
fprintf(md_result_file,
|
||||
"\n--\n-- Position to start replication or point-in-time "
|
||||
"recovery from (the master of this slave)\n--\n\n");
|
||||
|
||||
fprintf(md_result_file, "%sCHANGE MASTER TO ", comment_prefix);
|
||||
|
||||
if (opt_include_master_host_port)
|
||||
{
|
||||
if (row[1])
|
||||
fprintf(md_result_file, "MASTER_HOST='%s', ", row[1]);
|
||||
if (row[3])
|
||||
fprintf(md_result_file, "MASTER_PORT='%s', ", row[3]);
|
||||
}
|
||||
fprintf(md_result_file,
|
||||
"MASTER_LOG_FILE='%s', MASTER_LOG_POS=%s;\n", row[9], row[21]);
|
||||
|
||||
check_io(md_result_file);
|
||||
}
|
||||
mysql_free_result(slave);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int do_start_slave_sql(MYSQL *mysql_con)
|
||||
{
|
||||
MYSQL_RES *slave;
|
||||
/* We need to check if the slave sql is stopped in the first place */
|
||||
if (mysql_query_with_error_report(mysql_con, &slave, "SHOW SLAVE STATUS"))
|
||||
return(1);
|
||||
else
|
||||
{
|
||||
MYSQL_ROW row= mysql_fetch_row(slave);
|
||||
if (row && row[11])
|
||||
{
|
||||
/* if SLAVE SQL is not running, we don't start it */
|
||||
if (!strcmp(row[11],"Yes"))
|
||||
{
|
||||
mysql_free_result(slave);
|
||||
/* Silently assume that they don't have the slave running */
|
||||
return(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
mysql_free_result(slave);
|
||||
|
||||
/* now, start slave if stopped */
|
||||
if (mysql_query_with_error_report(mysql_con, 0, "START SLAVE"))
|
||||
{
|
||||
my_printf_error(0, "Error: Unable to start slave", MYF(0));
|
||||
return 1;
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int do_flush_tables_read_lock(MYSQL *mysql_con)
|
||||
{
|
||||
|
@ -5017,6 +5177,9 @@ int main(int argc, char **argv)
|
|||
if (!path)
|
||||
write_header(md_result_file, *argv);
|
||||
|
||||
if (opt_slave_data && do_stop_slave_sql(mysql))
|
||||
goto err;
|
||||
|
||||
if ((opt_lock_all_tables || opt_master_data) &&
|
||||
do_flush_tables_read_lock(mysql))
|
||||
goto err;
|
||||
|
@ -5035,8 +5198,13 @@ int main(int argc, char **argv)
|
|||
goto err;
|
||||
flush_logs= 0; /* not anymore; that would not be sensible */
|
||||
}
|
||||
/* Add 'STOP SLAVE to beginning of dump */
|
||||
if (opt_slave_apply && add_stop_slave())
|
||||
goto err;
|
||||
if (opt_master_data && do_show_master_status(mysql))
|
||||
goto err;
|
||||
if (opt_slave_data && do_show_slave_status(mysql))
|
||||
goto err;
|
||||
if (opt_single_transaction && do_unlock_tables(mysql)) /* unlock but no commit! */
|
||||
goto err;
|
||||
|
||||
|
@ -5064,6 +5232,14 @@ int main(int argc, char **argv)
|
|||
dump_databases(argv);
|
||||
}
|
||||
|
||||
/* if --dump-slave , start the slave sql thread */
|
||||
if (opt_slave_data && do_start_slave_sql(mysql))
|
||||
goto err;
|
||||
|
||||
/* add 'START SLAVE' to end of dump */
|
||||
if (opt_slave_apply && add_slave_statements())
|
||||
goto err;
|
||||
|
||||
/* ensure dumped data flushed */
|
||||
if (md_result_file && fflush(md_result_file))
|
||||
{
|
||||
|
|
|
@ -597,7 +597,8 @@ int main(int argc, char **argv)
|
|||
char **argv_to_free;
|
||||
MY_INIT(argv[0]);
|
||||
|
||||
load_defaults("my",load_default_groups,&argc,&argv);
|
||||
if (load_defaults("my",load_default_groups,&argc,&argv))
|
||||
return 1;
|
||||
/* argv is changed in the program */
|
||||
argv_to_free= argv;
|
||||
if (get_options(&argc, &argv))
|
||||
|
@ -615,8 +616,8 @@ int main(int argc, char **argv)
|
|||
pthread_attr_setdetachstate(&attr,
|
||||
PTHREAD_CREATE_DETACHED);
|
||||
|
||||
VOID(pthread_mutex_init(&counter_mutex, NULL));
|
||||
VOID(pthread_cond_init(&count_threshhold, NULL));
|
||||
pthread_mutex_init(&counter_mutex, NULL);
|
||||
pthread_cond_init(&count_threshhold, NULL);
|
||||
|
||||
for (counter= 0; *argv != NULL; argv++) /* Loop through tables */
|
||||
{
|
||||
|
@ -655,8 +656,8 @@ int main(int argc, char **argv)
|
|||
pthread_cond_timedwait(&count_threshhold, &counter_mutex, &abstime);
|
||||
}
|
||||
pthread_mutex_unlock(&counter_mutex);
|
||||
VOID(pthread_mutex_destroy(&counter_mutex));
|
||||
VOID(pthread_cond_destroy(&count_threshhold));
|
||||
pthread_mutex_destroy(&counter_mutex);
|
||||
pthread_cond_destroy(&count_threshhold);
|
||||
pthread_attr_destroy(&attr);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -63,7 +63,9 @@ int main(int argc, char **argv)
|
|||
char *wild;
|
||||
MYSQL mysql;
|
||||
MY_INIT(argv[0]);
|
||||
load_defaults("my",load_default_groups,&argc,&argv);
|
||||
if (load_defaults("my",load_default_groups,&argc,&argv))
|
||||
exit(1);
|
||||
|
||||
get_options(&argc,&argv);
|
||||
|
||||
wild=0;
|
||||
|
|
|
@ -299,7 +299,11 @@ int main(int argc, char **argv)
|
|||
|
||||
MY_INIT(argv[0]);
|
||||
|
||||
load_defaults("my",load_default_groups,&argc,&argv);
|
||||
if (load_defaults("my",load_default_groups,&argc,&argv))
|
||||
{
|
||||
my_end(0);
|
||||
exit(1);
|
||||
}
|
||||
defaults_argv=argv;
|
||||
if (get_options(&argc,&argv))
|
||||
{
|
||||
|
@ -352,10 +356,10 @@ int main(int argc, char **argv)
|
|||
}
|
||||
}
|
||||
|
||||
VOID(pthread_mutex_init(&counter_mutex, NULL));
|
||||
VOID(pthread_cond_init(&count_threshhold, NULL));
|
||||
VOID(pthread_mutex_init(&sleeper_mutex, NULL));
|
||||
VOID(pthread_cond_init(&sleep_threshhold, NULL));
|
||||
pthread_mutex_init(&counter_mutex, NULL);
|
||||
pthread_cond_init(&count_threshhold, NULL);
|
||||
pthread_mutex_init(&sleeper_mutex, NULL);
|
||||
pthread_cond_init(&sleep_threshhold, NULL);
|
||||
|
||||
/* Main iterations loop */
|
||||
eptr= engine_options;
|
||||
|
@ -386,10 +390,10 @@ int main(int argc, char **argv)
|
|||
|
||||
} while (eptr ? (eptr= eptr->next) : 0);
|
||||
|
||||
VOID(pthread_mutex_destroy(&counter_mutex));
|
||||
VOID(pthread_cond_destroy(&count_threshhold));
|
||||
VOID(pthread_mutex_destroy(&sleeper_mutex));
|
||||
VOID(pthread_cond_destroy(&sleep_threshhold));
|
||||
pthread_mutex_destroy(&counter_mutex);
|
||||
pthread_cond_destroy(&count_threshhold);
|
||||
pthread_mutex_destroy(&sleeper_mutex);
|
||||
pthread_cond_destroy(&sleep_threshhold);
|
||||
|
||||
if (!opt_only_print)
|
||||
mysql_close(&mysql); /* Close & free connection */
|
||||
|
|
|
@ -73,23 +73,26 @@
|
|||
#define QUERY_SEND_FLAG 1
|
||||
#define QUERY_REAP_FLAG 2
|
||||
|
||||
#ifndef HAVE_SETENV
|
||||
static int setenv(const char *name, const char *value, int overwrite);
|
||||
#endif
|
||||
|
||||
enum {
|
||||
OPT_SKIP_SAFEMALLOC=OPT_MAX_CLIENT_OPTION,
|
||||
OPT_PS_PROTOCOL, OPT_SP_PROTOCOL, OPT_CURSOR_PROTOCOL, OPT_VIEW_PROTOCOL,
|
||||
OPT_MAX_CONNECT_RETRIES, OPT_MAX_CONNECTIONS,
|
||||
OPT_MARK_PROGRESS, OPT_LOG_DIR, OPT_TAIL_LINES
|
||||
OPT_MAX_CONNECT_RETRIES, OPT_MAX_CONNECTIONS, OPT_MARK_PROGRESS,
|
||||
OPT_LOG_DIR, OPT_TAIL_LINES, OPT_RESULT_FORMAT_VERSION,
|
||||
};
|
||||
|
||||
static int record= 0, opt_sleep= -1;
|
||||
static char *opt_db= 0, *opt_pass= 0;
|
||||
const char *opt_user= 0, *opt_host= 0, *unix_sock= 0, *opt_basedir= "./";
|
||||
#ifdef HAVE_SMEM
|
||||
static char *shared_memory_base_name=0;
|
||||
#endif
|
||||
const char *opt_logdir= "";
|
||||
const char *opt_include= 0, *opt_charsets_dir;
|
||||
static int opt_port= 0;
|
||||
static int opt_max_connect_retries;
|
||||
static int opt_result_format_version;
|
||||
static int opt_max_connections= DEFAULT_MAX_CONN;
|
||||
static my_bool opt_compress= 0, silent= 0, verbose= 0;
|
||||
static my_bool debug_info_flag= 0, debug_check_flag= 0;
|
||||
|
@ -218,7 +221,6 @@ typedef struct
|
|||
int alloced_len;
|
||||
int int_dirty; /* do not update string if int is updated until first read */
|
||||
int alloced;
|
||||
char *env_s;
|
||||
} VAR;
|
||||
|
||||
/*Perl/shell-like variable registers */
|
||||
|
@ -292,11 +294,12 @@ enum enum_commands {
|
|||
Q_SEND_QUIT, Q_CHANGE_USER, Q_MKDIR, Q_RMDIR,
|
||||
Q_LIST_FILES, Q_LIST_FILES_WRITE_FILE, Q_LIST_FILES_APPEND_FILE,
|
||||
Q_SEND_SHUTDOWN, Q_SHUTDOWN_SERVER,
|
||||
Q_RESULT_FORMAT_VERSION,
|
||||
Q_MOVE_FILE, Q_REMOVE_FILES_WILDCARD, Q_SEND_EVAL,
|
||||
|
||||
Q_UNKNOWN, /* Unknown command. */
|
||||
Q_COMMENT, /* Comments, ignored. */
|
||||
Q_COMMENT_WITH_COMMAND
|
||||
Q_COMMENT_WITH_COMMAND,
|
||||
Q_EMPTY_LINE
|
||||
};
|
||||
|
||||
|
||||
|
@ -387,6 +390,7 @@ const char *command_names[]=
|
|||
"list_files_append_file",
|
||||
"send_shutdown",
|
||||
"shutdown_server",
|
||||
"result_format",
|
||||
"move_file",
|
||||
"remove_files_wildcard",
|
||||
"send_eval",
|
||||
|
@ -704,12 +708,12 @@ pthread_handler_t send_one_query(void *arg)
|
|||
struct st_connection *cn= (struct st_connection*)arg;
|
||||
|
||||
mysql_thread_init();
|
||||
VOID(mysql_send_query(&cn->mysql, cn->cur_query, cn->cur_query_len));
|
||||
(void) mysql_send_query(&cn->mysql, cn->cur_query, cn->cur_query_len);
|
||||
|
||||
mysql_thread_end();
|
||||
pthread_mutex_lock(&cn->mutex);
|
||||
cn->query_done= 1;
|
||||
VOID(pthread_cond_signal(&cn->cond));
|
||||
pthread_cond_signal(&cn->cond);
|
||||
pthread_mutex_unlock(&cn->mutex);
|
||||
pthread_exit(0);
|
||||
return 0;
|
||||
|
@ -1934,13 +1938,20 @@ VAR *var_init(VAR *v, const char *name, int name_len, const char *val,
|
|||
+ name_len+1, MYF(MY_WME))))
|
||||
die("Out of memory");
|
||||
|
||||
tmp_var->name = (name) ? (char*) tmp_var + sizeof(*tmp_var) : 0;
|
||||
if (name != NULL)
|
||||
{
|
||||
tmp_var->name= reinterpret_cast<char*>(tmp_var) + sizeof(*tmp_var);
|
||||
memcpy(tmp_var->name, name, name_len);
|
||||
tmp_var->name[name_len]= 0;
|
||||
}
|
||||
else
|
||||
tmp_var->name= NULL;
|
||||
|
||||
tmp_var->alloced = (v == 0);
|
||||
|
||||
if (!(tmp_var->str_val = (char*)my_malloc(val_alloc_len+1, MYF(MY_WME))))
|
||||
die("Out of memory");
|
||||
|
||||
memcpy(tmp_var->name, name, name_len);
|
||||
if (val)
|
||||
{
|
||||
memcpy(tmp_var->str_val, val, val_len);
|
||||
|
@ -1951,7 +1962,6 @@ VAR *var_init(VAR *v, const char *name, int name_len, const char *val,
|
|||
tmp_var->alloced_len = val_alloc_len;
|
||||
tmp_var->int_val = (val) ? atoi(val) : 0;
|
||||
tmp_var->int_dirty = 0;
|
||||
tmp_var->env_s = 0;
|
||||
return tmp_var;
|
||||
}
|
||||
|
||||
|
@ -2079,20 +2089,15 @@ void var_set(const char *var_name, const char *var_name_end,
|
|||
|
||||
if (env_var)
|
||||
{
|
||||
char buf[1024], *old_env_s= v->env_s;
|
||||
if (v->int_dirty)
|
||||
{
|
||||
sprintf(v->str_val, "%d", v->int_val);
|
||||
v->int_dirty= 0;
|
||||
v->str_val_len= strlen(v->str_val);
|
||||
}
|
||||
my_snprintf(buf, sizeof(buf), "%.*s=%.*s",
|
||||
v->name_len, v->name,
|
||||
v->str_val_len, v->str_val);
|
||||
if (!(v->env_s= my_strdup(buf, MYF(MY_WME))))
|
||||
die("Out of memory");
|
||||
putenv(v->env_s);
|
||||
my_free(old_env_s, MYF(MY_ALLOW_ZERO_PTR));
|
||||
/* setenv() expects \0-terminated strings */
|
||||
DBUG_ASSERT(v->name[v->name_len] == 0);
|
||||
setenv(v->name, v->str_val, 1);
|
||||
}
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
@ -2207,6 +2212,59 @@ void var_query_set(VAR *var, const char *query, const char** query_end)
|
|||
}
|
||||
|
||||
|
||||
static void
|
||||
set_result_format_version(ulong new_version)
|
||||
{
|
||||
switch (new_version){
|
||||
case 1:
|
||||
/* The first format */
|
||||
break;
|
||||
case 2:
|
||||
/* New format that also writes comments and empty lines
|
||||
from test file to result */
|
||||
break;
|
||||
default:
|
||||
die("Version format %lu has not yet been implemented", new_version);
|
||||
break;
|
||||
}
|
||||
opt_result_format_version= new_version;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Set the result format version to use when generating
|
||||
the .result file
|
||||
*/
|
||||
|
||||
static void
|
||||
do_result_format_version(struct st_command *command)
|
||||
{
|
||||
long version;
|
||||
static DYNAMIC_STRING ds_version;
|
||||
const struct command_arg result_format_args[] = {
|
||||
{"version", ARG_STRING, TRUE, &ds_version, "Version to use"}
|
||||
};
|
||||
|
||||
DBUG_ENTER("do_result_format_version");
|
||||
|
||||
check_command_args(command, command->first_argument,
|
||||
result_format_args,
|
||||
sizeof(result_format_args)/sizeof(struct command_arg),
|
||||
',');
|
||||
|
||||
/* Convert version number to int */
|
||||
if (!str2int(ds_version.str, 10, (long) 0, (long) INT_MAX, &version))
|
||||
die("Invalid version number: '%s'", ds_version.str);
|
||||
|
||||
set_result_format_version(version);
|
||||
|
||||
dynstr_append(&ds_res, "result_format: ");
|
||||
dynstr_append_mem(&ds_res, ds_version.str, ds_version.length);
|
||||
dynstr_append(&ds_res, "\n");
|
||||
dynstr_free(&ds_version);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Set variable from the result of a field in a query
|
||||
|
||||
|
@ -4402,12 +4460,13 @@ typedef struct
|
|||
{
|
||||
const char *name;
|
||||
uint code;
|
||||
const char *text;
|
||||
} st_error;
|
||||
|
||||
static st_error global_error_names[] =
|
||||
{
|
||||
#include <mysqld_ername.h>
|
||||
{ 0, 0 }
|
||||
{ 0, 0, 0 }
|
||||
};
|
||||
|
||||
uint get_errcode_from_name(char *error_name, char *error_end)
|
||||
|
@ -5402,7 +5461,7 @@ my_bool end_of_query(int c)
|
|||
|
||||
int read_line(char *buf, int size)
|
||||
{
|
||||
char c, UNINIT_VAR(last_quote);
|
||||
char c, UNINIT_VAR(last_quote), last_char= 0;
|
||||
char *p= buf, *buf_end= buf + size - 1;
|
||||
int skip_char= 0;
|
||||
enum {R_NORMAL, R_Q, R_SLASH_IN_Q,
|
||||
|
@ -5500,14 +5559,24 @@ int read_line(char *buf, int size)
|
|||
}
|
||||
else if (my_isspace(charset_info, c))
|
||||
{
|
||||
/* Skip all space at begining of line */
|
||||
if (c == '\n')
|
||||
{
|
||||
if (last_char == '\n')
|
||||
{
|
||||
/* Two new lines in a row, return empty line */
|
||||
DBUG_PRINT("info", ("Found two new lines in a row"));
|
||||
*p++= c;
|
||||
*p= 0;
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
/* Query hasn't started yet */
|
||||
start_lineno= cur_file->lineno;
|
||||
DBUG_PRINT("info", ("Query hasn't started yet, start_lineno: %d",
|
||||
start_lineno));
|
||||
}
|
||||
|
||||
/* Skip all space at begining of line */
|
||||
skip_char= 1;
|
||||
}
|
||||
else if (end_of_query(c))
|
||||
|
@ -5548,6 +5617,8 @@ int read_line(char *buf, int size)
|
|||
|
||||
}
|
||||
|
||||
last_char= c;
|
||||
|
||||
if (!skip_char)
|
||||
{
|
||||
/* Could be a multibyte character */
|
||||
|
@ -5757,9 +5828,10 @@ int read_command(struct st_command** command_ptr)
|
|||
DBUG_RETURN(1);
|
||||
}
|
||||
|
||||
convert_to_format_v1(read_command_buf);
|
||||
if (opt_result_format_version == 1)
|
||||
convert_to_format_v1(read_command_buf);
|
||||
|
||||
DBUG_PRINT("info", ("query: %s", read_command_buf));
|
||||
DBUG_PRINT("info", ("query: '%s'", read_command_buf));
|
||||
if (*p == '#')
|
||||
{
|
||||
command->type= Q_COMMENT;
|
||||
|
@ -5769,6 +5841,10 @@ int read_command(struct st_command** command_ptr)
|
|||
command->type= Q_COMMENT_WITH_COMMAND;
|
||||
p+= 2; /* Skip past -- */
|
||||
}
|
||||
else if (*p == '\n')
|
||||
{
|
||||
command->type= Q_EMPTY_LINE;
|
||||
}
|
||||
|
||||
/* Skip leading spaces */
|
||||
while (*p && my_isspace(charset_info, *p))
|
||||
|
@ -5868,16 +5944,19 @@ static struct my_option my_long_options[] =
|
|||
{"result-file", 'R', "Read/store result from/in this file.",
|
||||
(uchar**) &result_file_name, (uchar**) &result_file_name, 0,
|
||||
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"result-format-version", OPT_RESULT_FORMAT_VERSION,
|
||||
"Version of the result file format to use",
|
||||
(uchar**) &opt_result_format_version,
|
||||
(uchar**) &opt_result_format_version, 0,
|
||||
GET_INT, REQUIRED_ARG, 1, 1, 2, 0, 0, 0},
|
||||
{"server-arg", 'A', "Send option value to embedded server as a parameter.",
|
||||
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"server-file", 'F', "Read embedded server arguments from file.",
|
||||
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
#ifdef HAVE_SMEM
|
||||
{"shared-memory-base-name", OPT_SHARED_MEMORY_BASE_NAME,
|
||||
"Base name of shared memory.", (uchar**) &shared_memory_base_name,
|
||||
(uchar**) &shared_memory_base_name, 0, GET_STR, REQUIRED_ARG, 0, 0, 0,
|
||||
0, 0, 0},
|
||||
#endif
|
||||
{"silent", 's', "Suppress all normal output. Synonym for --quiet.",
|
||||
(uchar**) &silent, (uchar**) &silent, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"skip-safemalloc", OPT_SKIP_SAFEMALLOC,
|
||||
|
@ -6077,6 +6156,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||
sf_malloc_quick=1;
|
||||
#endif
|
||||
break;
|
||||
case OPT_RESULT_FORMAT_VERSION:
|
||||
set_result_format_version(opt_result_format_version);
|
||||
break;
|
||||
case 'V':
|
||||
print_version();
|
||||
exit(0);
|
||||
|
@ -6090,7 +6172,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||
|
||||
int parse_args(int argc, char **argv)
|
||||
{
|
||||
load_defaults("my",load_default_groups,&argc,&argv);
|
||||
if (load_defaults("my",load_default_groups,&argc,&argv))
|
||||
exit(1);
|
||||
|
||||
default_argv= argv;
|
||||
|
||||
if ((handle_options(&argc, &argv, my_long_options, get_one_option)))
|
||||
|
@ -6204,6 +6288,8 @@ void init_win_path_patterns()
|
|||
"$MYSQL_TMP_DIR",
|
||||
"$MYSQLTEST_VARDIR",
|
||||
"$MASTER_MYSOCK",
|
||||
"$MYSQL_SHAREDIR",
|
||||
"$MYSQL_LIBDIR",
|
||||
"./test/" };
|
||||
int num_paths= sizeof(paths)/sizeof(char*);
|
||||
int i;
|
||||
|
@ -7156,7 +7242,7 @@ int util_query(MYSQL* org_mysql, const char* query){
|
|||
cur_con->util_mysql= mysql;
|
||||
}
|
||||
|
||||
return mysql_query(mysql, query);
|
||||
DBUG_RETURN(mysql_query(mysql, query));
|
||||
}
|
||||
|
||||
|
||||
|
@ -7805,6 +7891,7 @@ int main(int argc, char **argv)
|
|||
cur_file->file_name= my_strdup("<stdin>", MYF(MY_WME));
|
||||
cur_file->lineno= 1;
|
||||
}
|
||||
var_set_string("MYSQLTEST_FILE", cur_file->file_name);
|
||||
init_re();
|
||||
ps_protocol_enabled= ps_protocol;
|
||||
sp_protocol_enabled= sp_protocol;
|
||||
|
@ -7967,6 +8054,7 @@ int main(int argc, char **argv)
|
|||
case Q_MOVE_FILE: do_move_file(command); break;
|
||||
case Q_CHMOD_FILE: do_chmod_file(command); break;
|
||||
case Q_PERL: do_perl(command); break;
|
||||
case Q_RESULT_FORMAT_VERSION: do_result_format_version(command); break;
|
||||
case Q_DELIMITER:
|
||||
do_delimiter(command);
|
||||
break;
|
||||
|
@ -8091,9 +8179,38 @@ int main(int argc, char **argv)
|
|||
do_sync_with_master2(command, 0);
|
||||
break;
|
||||
}
|
||||
case Q_COMMENT: /* Ignore row */
|
||||
case Q_COMMENT:
|
||||
{
|
||||
command->last_argument= command->end;
|
||||
|
||||
/* Don't output comments in v1 */
|
||||
if (opt_result_format_version == 1)
|
||||
break;
|
||||
|
||||
/* Don't output comments if query logging is off */
|
||||
if (disable_query_log)
|
||||
break;
|
||||
|
||||
/* Write comment's with two starting #'s to result file */
|
||||
const char* p= command->query;
|
||||
if (p && *p == '#' && *(p+1) == '#')
|
||||
{
|
||||
dynstr_append_mem(&ds_res, command->query, command->query_len);
|
||||
dynstr_append(&ds_res, "\n");
|
||||
}
|
||||
break;
|
||||
}
|
||||
case Q_EMPTY_LINE:
|
||||
/* Don't output newline in v1 */
|
||||
if (opt_result_format_version == 1)
|
||||
break;
|
||||
|
||||
/* Don't output newline if query logging is off */
|
||||
if (disable_query_log)
|
||||
break;
|
||||
|
||||
dynstr_append(&ds_res, "\n");
|
||||
break;
|
||||
case Q_PING:
|
||||
handle_command_error(command, mysql_ping(&cur_con->mysql));
|
||||
break;
|
||||
|
@ -9110,7 +9227,7 @@ REPLACE *init_replace(char * *from, char * *to,uint count,
|
|||
free_sets(&sets);
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
VOID(make_new_set(&sets)); /* Set starting set */
|
||||
(void) make_new_set(&sets); /* Set starting set */
|
||||
make_sets_invisible(&sets); /* Hide previus sets */
|
||||
used_sets=-1;
|
||||
word_states=make_new_set(&sets); /* Start of new word */
|
||||
|
@ -9581,7 +9698,7 @@ int insert_pointer_name(reg1 POINTER_ARRAY *pa,char * name)
|
|||
pa->flag[pa->typelib.count]=0; /* Reset flag */
|
||||
pa->typelib.type_names[pa->typelib.count++]= (char*) pa->str+pa->length;
|
||||
pa->typelib.type_names[pa->typelib.count]= NullS; /* Put end-mark */
|
||||
VOID(strmov((char*) pa->str+pa->length,name));
|
||||
(void) strmov((char*) pa->str+pa->length,name);
|
||||
pa->length+=length;
|
||||
DBUG_RETURN(0);
|
||||
} /* insert_pointer_name */
|
||||
|
@ -9726,3 +9843,18 @@ void dynstr_append_sorted(DYNAMIC_STRING* ds, DYNAMIC_STRING *ds_input)
|
|||
delete_dynamic(&lines);
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
#ifndef HAVE_SETENV
|
||||
static int setenv(const char *name, const char *value, int overwrite)
|
||||
{
|
||||
size_t buflen= strlen(name) + strlen(value) + 2;
|
||||
char *envvar= (char *)malloc(buflen);
|
||||
if(!envvar)
|
||||
return ENOMEM;
|
||||
strcpy(envvar, name);
|
||||
strcat(envvar, "=");
|
||||
strcat(envvar, value);
|
||||
putenv(envvar);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -23,10 +23,7 @@
|
|||
#include <my_sys.h>
|
||||
#include <m_string.h>
|
||||
#include <m_ctype.h>
|
||||
#ifdef HAVE_FCONVERT
|
||||
#include <floatingpoint.h>
|
||||
#endif
|
||||
|
||||
#include <mysql_com.h>
|
||||
/*
|
||||
The following extern declarations are ok as these are interface functions
|
||||
required by the string function
|
||||
|
@ -116,82 +113,19 @@ bool String::set(ulonglong num, CHARSET_INFO *cs)
|
|||
|
||||
bool String::set(double num,uint decimals, CHARSET_INFO *cs)
|
||||
{
|
||||
char buff[331];
|
||||
char buff[FLOATING_POINT_BUFFER];
|
||||
uint dummy_errors;
|
||||
size_t len;
|
||||
|
||||
str_charset=cs;
|
||||
if (decimals >= NOT_FIXED_DEC)
|
||||
{
|
||||
uint32 len= my_sprintf(buff,(buff, "%.15g",num));// Enough for a DATETIME
|
||||
len= my_gcvt(num, MY_GCVT_ARG_DOUBLE, sizeof(buff) - 1, buff, NULL);
|
||||
return copy(buff, len, &my_charset_latin1, cs, &dummy_errors);
|
||||
}
|
||||
#ifdef HAVE_FCONVERT
|
||||
int decpt,sign;
|
||||
char *pos,*to;
|
||||
|
||||
VOID(fconvert(num,(int) decimals,&decpt,&sign,buff+1));
|
||||
if (!my_isdigit(&my_charset_latin1, buff[1]))
|
||||
{ // Nan or Inf
|
||||
pos=buff+1;
|
||||
if (sign)
|
||||
{
|
||||
buff[0]='-';
|
||||
pos=buff;
|
||||
}
|
||||
uint dummy_errors;
|
||||
return copy(pos,(uint32) strlen(pos), &my_charset_latin1, cs, &dummy_errors);
|
||||
}
|
||||
if (alloc((uint32) ((uint32) decpt+3+decimals)))
|
||||
return TRUE;
|
||||
to=Ptr;
|
||||
if (sign)
|
||||
*to++='-';
|
||||
|
||||
pos=buff+1;
|
||||
if (decpt < 0)
|
||||
{ /* value is < 0 */
|
||||
*to++='0';
|
||||
if (!decimals)
|
||||
goto end;
|
||||
*to++='.';
|
||||
if ((uint32) -decpt > decimals)
|
||||
decpt= - (int) decimals;
|
||||
decimals=(uint32) ((int) decimals+decpt);
|
||||
while (decpt++ < 0)
|
||||
*to++='0';
|
||||
}
|
||||
else if (decpt == 0)
|
||||
{
|
||||
*to++= '0';
|
||||
if (!decimals)
|
||||
goto end;
|
||||
*to++='.';
|
||||
}
|
||||
else
|
||||
{
|
||||
while (decpt-- > 0)
|
||||
*to++= *pos++;
|
||||
if (!decimals)
|
||||
goto end;
|
||||
*to++='.';
|
||||
}
|
||||
while (decimals--)
|
||||
*to++= *pos++;
|
||||
|
||||
end:
|
||||
*to=0;
|
||||
str_length=(uint32) (to-Ptr);
|
||||
return FALSE;
|
||||
#else
|
||||
#ifdef HAVE_SNPRINTF
|
||||
buff[sizeof(buff)-1]=0; // Safety
|
||||
snprintf(buff,sizeof(buff)-1, "%.*f",(int) decimals,num);
|
||||
#else
|
||||
sprintf(buff,"%.*f",(int) decimals,num);
|
||||
#endif
|
||||
return copy(buff,(uint32) strlen(buff), &my_charset_latin1, cs,
|
||||
len= my_fcvt(num, decimals, buff, NULL);
|
||||
return copy(buff, (uint32) len, &my_charset_latin1, cs,
|
||||
&dummy_errors);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -674,7 +608,8 @@ void String::qs_append(const char *str, uint32 len)
|
|||
void String::qs_append(double d)
|
||||
{
|
||||
char *buff = Ptr + str_length;
|
||||
str_length+= my_sprintf(buff, (buff, "%.15g", d));
|
||||
str_length+= my_gcvt(d, MY_GCVT_ARG_DOUBLE, FLOATING_POINT_BUFFER - 1, buff,
|
||||
NULL);
|
||||
}
|
||||
|
||||
void String::qs_append(double *d)
|
||||
|
|
|
@ -22,10 +22,6 @@
|
|||
#pragma interface /* gcc class implementation */
|
||||
#endif
|
||||
|
||||
#ifndef NOT_FIXED_DEC
|
||||
#define NOT_FIXED_DEC 31
|
||||
#endif
|
||||
|
||||
class String;
|
||||
int sortcmp(const String *a,const String *b, CHARSET_INFO *cs);
|
||||
String *copy_if_not_alloced(String *a,String *b,uint32 arg_length);
|
||||
|
|
39
cmake/Makefile.am
Normal file
39
cmake/Makefile.am
Normal file
|
@ -0,0 +1,39 @@
|
|||
EXTRA_DIST = \
|
||||
cmake_parse_arguments.cmake \
|
||||
cpack_source_ignore_files.cmake \
|
||||
package_name.cmake \
|
||||
configurable_file_content.in \
|
||||
check_minimal_version.cmake \
|
||||
create_initial_db.cmake.in \
|
||||
make_dist.cmake.in \
|
||||
dtrace.cmake \
|
||||
abi_check.cmake \
|
||||
bison.cmake \
|
||||
configure.pl \
|
||||
character_sets.cmake \
|
||||
libutils.cmake \
|
||||
readline.cmake \
|
||||
mysql_version.cmake \
|
||||
install_macros.cmake \
|
||||
ssl.cmake \
|
||||
plugin.cmake \
|
||||
zlib.cmake \
|
||||
stack_direction.c \
|
||||
do_abi_check.cmake \
|
||||
merge_archives_unix.cmake.in \
|
||||
dtrace_prelink.cmake \
|
||||
versioninfo.rc.in \
|
||||
mysql_add_executable.cmake \
|
||||
install_layout.cmake \
|
||||
build_configurations/mysql_release.cmake \
|
||||
os/Windows.cmake \
|
||||
os/WindowsCache.cmake \
|
||||
os/Linux.cmake \
|
||||
os/SunOS.cmake \
|
||||
os/Darwin.cmake \
|
||||
os/HP-UX.cmake \
|
||||
os/AIX.cmake \
|
||||
os/OS400.cmake \
|
||||
os/Cygwin.cmake
|
||||
|
||||
|
62
cmake/abi_check.cmake
Normal file
62
cmake/abi_check.cmake
Normal file
|
@ -0,0 +1,62 @@
|
|||
# Copyright (C) 2009 Sun Microsystems, Inc
|
||||
#
|
||||
# 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
|
||||
|
||||
#
|
||||
# Headers which need to be checked for abi/api compatibility.
|
||||
# API_PREPROCESSOR_HEADER will be used until mysql_priv.h stablizes
|
||||
# after which TEST_PREPROCESSOR_HEADER will be used.
|
||||
#
|
||||
# We use gcc specific preprocessing command and sed/diff, so it will
|
||||
# only be run on Unix and only if gcc is used.
|
||||
IF(CMAKE_COMPILER_IS_GNUCC AND CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||
IF(CMAKE_C_COMPILER MATCHES "ccache$")
|
||||
SET(COMPILER ${CMAKE_C_COMPILER_ARG1})
|
||||
STRING(REGEX REPLACE "^ " "" COMPILER ${COMPILER})
|
||||
ELSE()
|
||||
SET(COMPILER ${CMAKE_C_COMPILER})
|
||||
ENDIF()
|
||||
SET(API_PREPROCESSOR_HEADER
|
||||
${CMAKE_SOURCE_DIR}/include/mysql/plugin.h
|
||||
${CMAKE_SOURCE_DIR}/include/mysql.h
|
||||
${CMAKE_SOURCE_DIR}/include/mysql/psi/psi_abi_v1.h
|
||||
${CMAKE_SOURCE_DIR}/include/mysql/psi/psi_abi_v2.h
|
||||
)
|
||||
|
||||
SET(TEST_PREPROCESSOR_HEADER
|
||||
${CMAKE_SOURCE_DIR}/sql/mysql_priv.h
|
||||
)
|
||||
|
||||
|
||||
ADD_CUSTOM_TARGET(abi_check ALL
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
-DCOMPILER=${COMPILER}
|
||||
-DSOURCE_DIR=${CMAKE_SOURCE_DIR}
|
||||
-DBINARY_DIR=${CMAKE_BINARY_DIR}
|
||||
"-DABI_HEADERS=${API_PREPROCESSOR_HEADER}"
|
||||
-P ${CMAKE_SOURCE_DIR}/cmake/do_abi_check.cmake
|
||||
VERBATIM
|
||||
)
|
||||
|
||||
ADD_CUSTOM_TARGET(abi_check_all
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
-DCMAKE_C_COMPILER=${COMPILER}
|
||||
-DCMAKE_SOURCE_DIR=${CMAKE_SOURCE_DIR}
|
||||
-DCMAKE_BINARY_DIR=${CMAKE_BINARY_DIR}
|
||||
"-DABI_HEADERS=${TEST_PREPROCESSOR_HEADER}"
|
||||
-P ${CMAKE_SOURCE_DIR}/cmake/scripts/do_abi_check.cmake
|
||||
VERBATIM
|
||||
)
|
||||
ENDIF()
|
||||
|
80
cmake/bison.cmake
Normal file
80
cmake/bison.cmake
Normal file
|
@ -0,0 +1,80 @@
|
|||
# Copyright (C) 2009 Sun Microsystems, Inc
|
||||
#
|
||||
# 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
|
||||
|
||||
IF(CMAKE_SYSTEM_NAME MATCHES "SunOS")
|
||||
# On Solaris, /opt/csw often contains a newer bison
|
||||
IF(NOT BISON_EXECUTABLE AND EXISTS /opt/csw/bin/bison)
|
||||
SET(BISON_EXECUTABLE /opt/csw/bin/bison)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
FIND_PROGRAM(BISON_EXECUTABLE bison DOC "path to the bison executable")
|
||||
MARK_AS_ADVANCED(BISON_EXECUTABLE "")
|
||||
IF(NOT BISON_EXECUTABLE)
|
||||
MESSAGE("Warning: Bison executable not found in PATH")
|
||||
ELSEIF(BISON_EXECUTABLE AND NOT BISON_USABLE)
|
||||
# Check version as well
|
||||
EXEC_PROGRAM(${BISON_EXECUTABLE} ARGS --version OUTPUT_VARIABLE BISON_VERSION_STR)
|
||||
# Get first line in case it's multiline
|
||||
STRING(REGEX REPLACE "([^\n]+).*" "\\1" FIRST_LINE "${BISON_VERSION_STR}")
|
||||
# get version information
|
||||
STRING(REGEX REPLACE ".* ([0-9]+)\\.([0-9]+)" "\\1" BISON_VERSION_MAJOR "${FIRST_LINE}")
|
||||
STRING(REGEX REPLACE ".* ([0-9]+)\\.([0-9]+)" "\\2" BISON_VERSION_MINOR "${FIRST_LINE}")
|
||||
IF (BISON_VERSION_MAJOR LESS 2)
|
||||
MESSAGE("Warning: bison version is old. please update to version 2")
|
||||
ELSE()
|
||||
SET(BISON_USABLE 1 CACHE INTERNAL "Bison version 2 or higher")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
# Use bison to generate C++ and header file
|
||||
MACRO (RUN_BISON input_yy output_cc output_h)
|
||||
IF(BISON_TOO_OLD)
|
||||
IF(EXISTS ${output_cc} AND EXISTS ${output_h})
|
||||
SET(BISON_USABLE FALSE)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
IF(BISON_USABLE)
|
||||
ADD_CUSTOM_COMMAND(
|
||||
OUTPUT ${output_cc}
|
||||
${output_h}
|
||||
COMMAND ${BISON_EXECUTABLE} -y -p MYSQL
|
||||
--output=${output_cc}
|
||||
--defines=${output_h}
|
||||
${input_yy}
|
||||
DEPENDS ${input_yy}
|
||||
)
|
||||
ELSE()
|
||||
# Bison is missing or not usable, e.g too old
|
||||
IF(EXISTS ${output_cc} AND EXISTS ${output_h})
|
||||
IF(${input_yy} IS_NEWER_THAN ${output_cc} OR ${input_yy} IS_NEWER_THAN ${output_h})
|
||||
# Possibly timestamps are messed up in source distribution.
|
||||
MESSAGE("Warning: no usable bison found, ${input_yy} will not be rebuilt.")
|
||||
ENDIF()
|
||||
ELSE()
|
||||
# Output files are missing, bail out.
|
||||
SET(ERRMSG
|
||||
"Bison (GNU parser generator) is required to build MySQL."
|
||||
"Please install bison."
|
||||
)
|
||||
IF(WIN32)
|
||||
SET(ERRMSG ${ERRMSG}
|
||||
"You can download bison from http://gnuwin32.sourceforge.net/packages/bison.htm "
|
||||
"Choose 'Complete package, except sources' installation. We recommend to "
|
||||
"install bison into a directory without spaces, e.g C:\\GnuWin32.")
|
||||
ENDIF()
|
||||
MESSAGE(FATAL_ERROR ${ERRMSG})
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDMACRO()
|
187
cmake/build_configurations/mysql_release.cmake
Normal file
187
cmake/build_configurations/mysql_release.cmake
Normal file
|
@ -0,0 +1,187 @@
|
|||
# Copyright (C) 2010 Sun Microsystems, Inc
|
||||
#
|
||||
# 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 file includes build settings used for MySQL release
|
||||
|
||||
|
||||
SET(FEATURE_SET "community" CACHE STRING
|
||||
" Selection of features. Options are
|
||||
- xsmall :
|
||||
- small: embedded
|
||||
- classic: embedded + archive + federated + blackhole
|
||||
- large : embedded + archive + federated + blackhole + innodb
|
||||
- xlarge: embedded + archive + federated + blackhole + innodb + partition
|
||||
- community: all features (currently == xlarge)
|
||||
"
|
||||
)
|
||||
|
||||
SET(FEATURE_SET_xsmall 1)
|
||||
SET(FEATURE_SET_small 2)
|
||||
SET(FEATURE_SET_classic 3)
|
||||
SET(FEATURE_SET_large 5)
|
||||
SET(FEATURE_SET_xlarge 6)
|
||||
SET(FEATURE_SET_community 7)
|
||||
|
||||
IF(FEATURE_SET)
|
||||
STRING(TOLOWER ${FEATURE_SET} feature_set)
|
||||
SET(num ${FEATURE_SET_${feature_set}})
|
||||
IF(NOT num)
|
||||
MESSAGE(FATAL_ERROR "Invalid FEATURE_SET option '${feature_set}'.
|
||||
Should be xsmall, small, classic, large, or community
|
||||
")
|
||||
ENDIF()
|
||||
SET(WITH_PARTITION_STORAGE_ENGINE OFF)
|
||||
IF(num EQUAL FEATURE_SET_xsmall)
|
||||
SET(WITH_NONE ON)
|
||||
ENDIF()
|
||||
|
||||
IF(num GREATER FEATURE_SET_xsmall)
|
||||
SET(WITH_EMBEDDED_SERVER ON CACHE BOOL "")
|
||||
ENDIF()
|
||||
IF(num GREATER FEATURE_SET_small)
|
||||
SET(WITH_ARCHIVE_STORAGE_ENGINE ON)
|
||||
SET(WITH_BLACKHOLE_STORAGE_ENGINE ON)
|
||||
SET(WITH_FEDERATED_STORAGE_ENGINE ON)
|
||||
ENDIF()
|
||||
IF(num GREATER FEATURE_SET_classic)
|
||||
SET(WITH_INNOBASE_STORAGE_ENGINE ON)
|
||||
ENDIF()
|
||||
IF(num GREATER FEATURE_SET_large)
|
||||
SET(WITH_PARTITION_STORAGE_ENGINE ON)
|
||||
ENDIF()
|
||||
IF(num GREATER FEATURE_SET_xlarge)
|
||||
# OPTION(WITH_ALL ON)
|
||||
# better no set this, otherwise server would be linked
|
||||
# statically with experimental stuff like audit_null
|
||||
ENDIF()
|
||||
|
||||
# Update cache with current values, remove engines we do not care about
|
||||
# from build.
|
||||
FOREACH(eng ARCHIVE BLACKHOLE FEDERATED INNOBASE PARTITION EXAMPLE)
|
||||
IF(NOT WITH_${eng}_STORAGE_ENGINE)
|
||||
SET(WITHOUT_${eng}_STORAGE_ENGINE ON CACHE BOOL "")
|
||||
MARK_AS_ADVANCED(WITHOUT_${eng}_STORAGE_ENGINE)
|
||||
SET(WITH_${eng}_STORAGE_ENGINE OFF CACHE BOOL "")
|
||||
ELSE()
|
||||
SET(WITH_${eng}_STORAGE_ENGINE ON CACHE BOOL "")
|
||||
ENDIF()
|
||||
ENDFOREACH()
|
||||
ENDIF()
|
||||
|
||||
SET(WITHOUT_AUDIT_NULL ON CACHE BOOL "")
|
||||
SET(WITHOUT_DAEMON_EXAMPLE ON CACHE BOOL "")
|
||||
|
||||
OPTION(ENABLE_LOCAL_INFILE "" ON)
|
||||
SET(WITH_SSL bundled CACHE STRING "")
|
||||
SET(WITH_ZLIB bundled CACHE STRING "")
|
||||
|
||||
|
||||
IF(NOT COMPILATION_COMMENT)
|
||||
SET(COMPILATION_COMMENT "MySQL Community Server (GPL)")
|
||||
ENDIF()
|
||||
|
||||
IF(WIN32)
|
||||
# Sign executables with authenticode certificate
|
||||
SET(SIGNCODE 1 CACHE BOOL "")
|
||||
ENDIF()
|
||||
|
||||
IF(UNIX)
|
||||
SET(WITH_EXTRA_CHARSETS all CACHE STRING "")
|
||||
IF(EXISTS "${CMAKE_SOURCE_DIR}/COPYING")
|
||||
OPTION(WITH_READLINE "" ON)
|
||||
ELSE()
|
||||
OPTION(WITH_LIBEDIT "" ON)
|
||||
ENDIF()
|
||||
|
||||
OPTION(WITH_PIC "" ON) # Why?
|
||||
ENDIF()
|
||||
|
||||
|
||||
# Compiler options
|
||||
IF(UNIX)
|
||||
# Default GCC flags
|
||||
IF(CMAKE_COMPILER_IS_GNUCXX)
|
||||
SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-g -O3 -static-libgcc -fno-omit-frame-pointer")
|
||||
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g -O3 -static-libgcc -fno-omit-frame-pointer -felide-constructors -fno-exceptions -fno-rtti")
|
||||
ENDIF()
|
||||
|
||||
|
||||
# HPUX flags
|
||||
IF(CMAKE_SYSTEM_NAME MATCHES "HP-UX")
|
||||
IF(CMAKE_C_COMPILER_ID MATCHES "HP")
|
||||
IF(CMAKE_SYSTEM_PROCESSOR MATCHES "ia64")
|
||||
SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-g +O2 +DD64 +DSitanium2 -mt -AC99")
|
||||
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g +O2 +DD64 +DSitanium2 -mt -Aa")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
SET(WITH_SSL)
|
||||
ENDIF()
|
||||
|
||||
# Linux flags
|
||||
IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||
IF(CMAKE_C_COMPILER_ID MATCHES "Intel")
|
||||
SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-static-intel -g -O3 -unroll2 -ip -mp -restrict")
|
||||
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-static-intel -g -O3 -unroll2 -ip -mp -restrict")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
# OSX flags
|
||||
IF(APPLE)
|
||||
SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-Os ${CMAKE_C_FLAGS_RELWITHDEBINFO}")
|
||||
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-Os ${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
|
||||
ENDIF()
|
||||
|
||||
# Solaris flags
|
||||
IF(CMAKE_SYSTEM_NAME MATCHES "SunOS")
|
||||
IF(CMAKE_SYSTEM_VERSION VERSION_GREATER "5.9")
|
||||
# Link mysqld with mtmalloc on Solaris 10 and later
|
||||
SET(WITH_MYSQLD_LDFLAGS "-lmtmalloc" CACHE STRING "")
|
||||
ENDIF()
|
||||
IF(CMAKE_C_COMPILER_ID MATCHES "SunPro")
|
||||
IF(CMAKE_SYSTEM_PROCESSOR MATCHES "i386")
|
||||
IF(CMAKE_SIZEOF_VOIDP EQUAL 4)
|
||||
# Solaris x86
|
||||
SET(CMAKE_C_FLAGS_RELWITHDEBINFO
|
||||
"-g -xO2 -mt -fsimple=1 -ftrap=%none -nofstore -xbuiltin=%all -xlibmil -xlibmopt -xtarget=generic")
|
||||
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO
|
||||
"-g0 -xO2 -mt -fsimple=1 -ftrap=%none -nofstore -xbuiltin=%all -features=no%except -xlibmil -xlibmopt -xtarget=generic")
|
||||
ELSE()
|
||||
# Solaris x64
|
||||
SET(CMAKE_C_FLAGS_RELWITHDEBINFO
|
||||
"-g -xO3 -mt -fsimple=1 -ftrap=%none -nofstore -xbuiltin=%all -xlibmil -xlibmopt -xtarget=generic")
|
||||
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO
|
||||
"-g0 -xO3 -mt -fsimple=1 -ftrap=%none -nofstore -xbuiltin=%all -features=no%except -xlibmil -xlibmopt -xtarget=generic")
|
||||
ENDIF()
|
||||
ELSE()
|
||||
IF(CMAKE_SIZEOF_VOIDP EQUAL 4)
|
||||
# Solaris sparc 32 bit
|
||||
SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-g -xO3 -Xa -xstrconst -mt -xarch=sparc")
|
||||
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g0 -xO3 -noex -mt -xarch=sparc")
|
||||
ELSE()
|
||||
# Solaris sparc 64 bit
|
||||
SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-g -xO3 -Xa -xstrconst -mt")
|
||||
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g0 -xO3 -noex -mt")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF(CMAKE_CXX_FLAGS_RELWITHDEBINFO)
|
||||
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}"
|
||||
CACHE STRING "Compile flags")
|
||||
SET(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}"
|
||||
CACHE STRING "Compile flags")
|
||||
ENDIF()
|
||||
ENDIF()
|
27
cmake/cat.cmake
Normal file
27
cmake/cat.cmake
Normal file
|
@ -0,0 +1,27 @@
|
|||
# Copyright (C) 2009 Sun Microsystems, Inc
|
||||
#
|
||||
# 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
|
||||
|
||||
# Concatenate files
|
||||
#
|
||||
# Parameters :
|
||||
# IN - input files (list)
|
||||
# OUT - output file
|
||||
FILE(WRITE ${OUT} "")
|
||||
FOREACH(FILENAME ${IN})
|
||||
FILE(READ ${FILENAME} CONTENTS)
|
||||
FILE(APPEND ${OUT} "${CONTENTS}")
|
||||
ENDFOREACH()
|
||||
|
||||
|
59
cmake/character_sets.cmake
Normal file
59
cmake/character_sets.cmake
Normal file
|
@ -0,0 +1,59 @@
|
|||
# Copyright (C) 2009 Sun Microsystems, Inc
|
||||
#
|
||||
# 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
|
||||
|
||||
#Charsets and collations
|
||||
IF(NOT DEFAULT_CHARSET)
|
||||
SET(DEFAULT_CHARSET "latin1")
|
||||
ENDIF()
|
||||
|
||||
IF(NOT DEFAULT_COLLATIONS)
|
||||
SET(DEFAULT_COLLATION "latin1_swedish_ci")
|
||||
ENDIF()
|
||||
|
||||
SET(CHARSETS ${DEFAULT_CHARSET} latin1 utf8 utf8mb4)
|
||||
SET(CHARSETS_COMPLEX big5 cp1250 cp932 eucjpms euckr gb2312 gbk latin1 latin2 sjis tis620 ucs2 ujis utf8 utf8mb4 utf16 utf32)
|
||||
|
||||
SET(CHARSETS_AVAILABLE
|
||||
binary armscii8 ascii big5 cp1250 cp1251 cp1256 cp1257
|
||||
cp850 cp852 cp866 cp932 dec8 eucjpms euckr gb2312 gbk geostd8
|
||||
greek hebrew hp8 keybcs2 koi8r koi8u
|
||||
latin1 latin2 latin5 latin7 macce macroman
|
||||
sjis swe7 tis620 ucs2 ujis utf8 utf8mb4 utf16 utf32)
|
||||
|
||||
|
||||
SET (EXTRA_CHARSETS "all")
|
||||
SET(WITH_EXTRA_CHARSETS ${EXTRA_CHARSETS} CACHE
|
||||
STRING "Options are: none, complex, all")
|
||||
|
||||
|
||||
IF(WITH_EXTRA_CHARSETS MATCHES "complex")
|
||||
SET(CHARSETS ${CHARSETS} ${CHARSETS_COMPLEX})
|
||||
ELSEIF(WITH_EXTRA_CHARSETS MATCHES "all")
|
||||
SET(CHARSETS ${CHARSETS} ${CHARSETS_AVAILABLE})
|
||||
ENDIF()
|
||||
|
||||
SET(MYSQL_DEFAULT_CHARSET_NAME "${DEFAULT_CHARSET}")
|
||||
SET(MYSQL_DEFAULT_COLLATION_NAME "${DEFAULT_COLLATION}")
|
||||
|
||||
FOREACH(cs in ${CHARSETS})
|
||||
SET(HAVE_CHARSET_${cs} 1)
|
||||
ENDFOREACH()
|
||||
|
||||
SET(HAVE_UCA_COLLATIONS 1)
|
||||
|
||||
SET(HAVE_UTF8_GENERAL_CS 1)
|
||||
SET(USE_MB 1)
|
||||
SET(USE_MB_IDENT 1)
|
||||
|
19
cmake/check_minimal_version.cmake
Normal file
19
cmake/check_minimal_version.cmake
Normal file
|
@ -0,0 +1,19 @@
|
|||
# Copyright (C) 2009 Sun Microsystems, Inc
|
||||
#
|
||||
# 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 is a helper script is used to check for the minimal required version
|
||||
# It helps to decide whether to use autoconf based configure or cmake's
|
||||
# configure
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.6.0 FATAL_ERROR)
|
47
cmake/cmake_parse_arguments.cmake
Normal file
47
cmake/cmake_parse_arguments.cmake
Normal file
|
@ -0,0 +1,47 @@
|
|||
|
||||
# Copyright (C) 2007 MySQL AB, 2009 Sun Microsystems,Inc
|
||||
#
|
||||
# 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
|
||||
|
||||
# Handy macro to parse macro arguments
|
||||
MACRO(CMAKE_PARSE_ARGUMENTS prefix arg_names option_names)
|
||||
SET(DEFAULT_ARGS)
|
||||
FOREACH(arg_name ${arg_names})
|
||||
SET(${prefix}_${arg_name})
|
||||
ENDFOREACH(arg_name)
|
||||
FOREACH(option ${option_names})
|
||||
SET(${prefix}_${option} FALSE)
|
||||
ENDFOREACH(option)
|
||||
|
||||
SET(current_arg_name DEFAULT_ARGS)
|
||||
SET(current_arg_list)
|
||||
FOREACH(arg ${ARGN})
|
||||
SET(larg_names ${arg_names})
|
||||
LIST(FIND larg_names "${arg}" is_arg_name)
|
||||
IF (is_arg_name GREATER -1)
|
||||
SET(${prefix}_${current_arg_name} ${current_arg_list})
|
||||
SET(current_arg_name ${arg})
|
||||
SET(current_arg_list)
|
||||
ELSE (is_arg_name GREATER -1)
|
||||
SET(loption_names ${option_names})
|
||||
LIST(FIND loption_names "${arg}" is_option)
|
||||
IF (is_option GREATER -1)
|
||||
SET(${prefix}_${arg} TRUE)
|
||||
ELSE (is_option GREATER -1)
|
||||
SET(current_arg_list ${current_arg_list} ${arg})
|
||||
ENDIF (is_option GREATER -1)
|
||||
ENDIF (is_arg_name GREATER -1)
|
||||
ENDFOREACH(arg)
|
||||
SET(${prefix}_${current_arg_name} ${current_arg_list})
|
||||
ENDMACRO()
|
1
cmake/configurable_file_content.in
Normal file
1
cmake/configurable_file_content.in
Normal file
|
@ -0,0 +1 @@
|
|||
@CMAKE_CONFIGURABLE_FILE_CONTENT@
|
196
cmake/configure.pl
Normal file
196
cmake/configure.pl
Normal file
|
@ -0,0 +1,196 @@
|
|||
#!/usr/bin/perl
|
||||
use strict;
|
||||
use Cwd 'abs_path';
|
||||
use File::Basename;
|
||||
|
||||
my $cmakeargs = "";
|
||||
|
||||
# Find source root directory
|
||||
# Assume this script is in <srcroot>/cmake
|
||||
my $srcdir = dirname(dirname(abs_path($0)));
|
||||
my $cmake_install_prefix="";
|
||||
|
||||
# Sets installation directory, bindir, libdir, libexecdir etc
|
||||
# the equivalent CMake variables are given without prefix
|
||||
# e.g if --prefix is /usr and --bindir is /usr/bin
|
||||
# then cmake variable (INSTALL_BINDIR) must be just "bin"
|
||||
|
||||
sub set_installdir
|
||||
{
|
||||
my($path, $varname) = @_;
|
||||
my $prefix_length = length($cmake_install_prefix);
|
||||
if (($prefix_length > 0) && (index($path,$cmake_install_prefix) == 0))
|
||||
{
|
||||
# path is under the prefix, so remove the prefix and maybe following "/"
|
||||
$path = substr($path, $prefix_length);
|
||||
if(length($path) > 0)
|
||||
{
|
||||
my $char = substr($path, 0, 1);
|
||||
if($char eq "/")
|
||||
{
|
||||
$path= substr($path, 1);
|
||||
}
|
||||
}
|
||||
if(length($path) > 0)
|
||||
{
|
||||
$cmakeargs = $cmakeargs." -D".$varname."=".$path;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# CMake understands CC and CXX env.variables correctly, if they contain 1 or 2 tokens
|
||||
# e.g CXX=gcc and CXX="ccache gcc" are ok. However it could have a problem if there
|
||||
# (recognizing gcc) with more tokens ,e.g CXX="ccache gcc --pipe".
|
||||
# The problem is simply fixed by splitting compiler and flags, e.g
|
||||
# CXX="ccache gcc --pipe" => CXX=ccache gcc CXXFLAGS=--pipe
|
||||
|
||||
sub check_compiler
|
||||
{
|
||||
my ($varname, $flagsvarname) = @_;
|
||||
my @tokens = split(/ /,$ENV{$varname});
|
||||
if($#tokens >= 2)
|
||||
{
|
||||
$ENV{$varname} = $tokens[0]." ".$tokens[1];
|
||||
my $flags;
|
||||
|
||||
for(my $i=2; $i<=$#tokens; $i++)
|
||||
{
|
||||
$flags= $flags." ".$tokens[$i];
|
||||
}
|
||||
if(defined $ENV{$flagsvarname})
|
||||
{
|
||||
$flags = $flags." ".$ENV{$flagsvarname};
|
||||
}
|
||||
$ENV{$flagsvarname}=$flags;
|
||||
print("$varname=$ENV{$varname}\n");
|
||||
print("$flagsvarname=$ENV{$flagsvarname}\n");
|
||||
}
|
||||
}
|
||||
|
||||
check_compiler("CC", "CFLAGS");
|
||||
check_compiler("CXX", "CXXFLAGS");
|
||||
|
||||
foreach my $option (@ARGV)
|
||||
{
|
||||
if (substr ($option, 0, 2) eq "--")
|
||||
{
|
||||
$option = substr($option, 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
# This must be environment variable
|
||||
my @v = split('=', $option);
|
||||
my $name = shift(@v);
|
||||
if(@v)
|
||||
{
|
||||
$ENV{$name} = join('=', @v);
|
||||
}
|
||||
next;
|
||||
}
|
||||
if($option =~ /srcdir/)
|
||||
{
|
||||
$srcdir = substr($option,7);
|
||||
next;
|
||||
}
|
||||
if($option =~ /help/)
|
||||
{
|
||||
system("cmake ${srcdir} -LH");
|
||||
exit(0);
|
||||
}
|
||||
if($option =~ /with-plugins=/)
|
||||
{
|
||||
my @plugins= split(/,/, substr($option,13));
|
||||
foreach my $p (@plugins)
|
||||
{
|
||||
$p =~ s/-/_/g;
|
||||
$cmakeargs = $cmakeargs." -DWITH_".uc($p)."=1";
|
||||
}
|
||||
next;
|
||||
}
|
||||
if($option =~ /with-extra-charsets=/)
|
||||
{
|
||||
my $charsets= substr($option,20);
|
||||
$cmakeargs = $cmakeargs." -DWITH_EXTRA_CHARSETS=".$charsets;
|
||||
next;
|
||||
}
|
||||
if($option =~ /without-plugin=/)
|
||||
{
|
||||
$cmakeargs = $cmakeargs." -DWITHOUT_".uc(substr($option,15))."=1";
|
||||
next;
|
||||
}
|
||||
if($option =~ /with-zlib-dir=bundled/)
|
||||
{
|
||||
$cmakeargs = $cmakeargs." -DWITH_ZLIB=bundled";
|
||||
next;
|
||||
}
|
||||
if($option =~ /with-zlib-dir=/)
|
||||
{
|
||||
$cmakeargs = $cmakeargs." -DWITH_ZLIB=system";
|
||||
next;
|
||||
}
|
||||
if($option =~ /with-ssl=/)
|
||||
{
|
||||
$cmakeargs = $cmakeargs." -DWITH_SSL=yes";
|
||||
next;
|
||||
}
|
||||
if($option =~ /with-ssl/)
|
||||
{
|
||||
$cmakeargs = $cmakeargs." -DWITH_SSL=bundled";
|
||||
next;
|
||||
}
|
||||
if($option =~ /prefix=/)
|
||||
{
|
||||
$cmake_install_prefix= substr($option, 7);
|
||||
$cmakeargs = $cmakeargs." -DCMAKE_INSTALL_PREFIX=".$cmake_install_prefix;
|
||||
next;
|
||||
}
|
||||
if($option =~/bindir=/)
|
||||
{
|
||||
set_installdir(substr($option,7), "INSTALL_BINDIR");
|
||||
next;
|
||||
}
|
||||
if($option =~/libdir=/)
|
||||
{
|
||||
set_installdir(substr($option,7), "INSTALL_LIBDIR");
|
||||
next;
|
||||
}
|
||||
if($option =~/libexecdir=/)
|
||||
{
|
||||
set_installdir(substr($option,11), "INSTALL_SBINDIR");
|
||||
next;
|
||||
}
|
||||
if($option =~/includedir=/)
|
||||
{
|
||||
set_installdir(substr($option,11), "INSTALL_INCLUDEDIR");
|
||||
next;
|
||||
}
|
||||
if ($option =~ /extra-charsets=all/)
|
||||
{
|
||||
$cmakeargs = $cmakeargs." -DWITH_CHARSETS=all";
|
||||
next;
|
||||
}
|
||||
if ($option =~ /extra-charsets=complex/)
|
||||
{
|
||||
$cmakeargs = $cmakeargs." -DWITH_CHARSETS=complex";
|
||||
next;
|
||||
}
|
||||
if ($option =~ /localstatedir=/)
|
||||
{
|
||||
$cmakeargs = $cmakeargs." -DMYSQL_DATADIR=".substr($option,14);
|
||||
next;
|
||||
}
|
||||
if ($option =~ /with-debug=full/)
|
||||
{
|
||||
$cmakeargs = $cmakeargs." -DWITH_DEBUG_FULL=1";
|
||||
next;
|
||||
}
|
||||
|
||||
$option = uc($option);
|
||||
$option =~ s/-/_/g;
|
||||
$cmakeargs = $cmakeargs." -D".$option."=1";
|
||||
}
|
||||
|
||||
print("configure.pl : calling cmake $srcdir $cmakeargs\n");
|
||||
unlink("CMakeCache.txt");
|
||||
my $rc = system("cmake $srcdir $cmakeargs");
|
||||
exit($rc);
|
40
cmake/cpack_source_ignore_files.cmake
Normal file
40
cmake/cpack_source_ignore_files.cmake
Normal file
|
@ -0,0 +1,40 @@
|
|||
SET(CPACK_SOURCE_IGNORE_FILES
|
||||
\\\\.bzr/
|
||||
\\\\.bzr-mysql
|
||||
\\\\.bzrignore
|
||||
CMakeCache\\\\.txt
|
||||
cmake_dist\\\\.cmake
|
||||
CPackSourceConfig\\\\.cmake
|
||||
CPackConfig.cmake
|
||||
/cmake_install\\\\.cmake
|
||||
/CTestTestfile\\\\.cmake
|
||||
/CMakeFiles/
|
||||
/version_resources/
|
||||
/_CPack_Packages/
|
||||
$\\\\.gz
|
||||
$\\\\.zip
|
||||
/CMakeFiles/
|
||||
/version_resources/
|
||||
/_CPack_Packages/
|
||||
scripts/make_binary_distribution$
|
||||
scripts/msql2mysql$
|
||||
scripts/mysql_config$
|
||||
scripts/mysql_convert_table_format$
|
||||
scripts/mysql_find_rows$
|
||||
scripts/mysql_fix_extensions$
|
||||
scripts/mysql_install_db$
|
||||
scripts/mysql_secure_installation$
|
||||
scripts/mysql_setpermission$
|
||||
scripts/mysql_zap$
|
||||
scripts/mysqlaccess$
|
||||
scripts/mysqld_multi$
|
||||
scripts/mysqld_safe$
|
||||
scripts/mysqldumpslow$
|
||||
scripts/mysqlhotcopy$
|
||||
Makefile$
|
||||
include/config\\\\.h$
|
||||
include/my_config\\\\.h$
|
||||
/autom4te\\\\.cache/
|
||||
errmsg\\\\.sys$
|
||||
#
|
||||
)
|
81
cmake/create_initial_db.cmake.in
Normal file
81
cmake/create_initial_db.cmake.in
Normal file
|
@ -0,0 +1,81 @@
|
|||
# Copyright (C) 2009 Sun Microsystems, Inc
|
||||
#
|
||||
# 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 creates initial database for packaging on Windows
|
||||
SET(CMAKE_SOURCE_DIR "@CMAKE_SOURCE_DIR@")
|
||||
SET(CMAKE_CURRENT_BINARY_DIR "@CMAKE_CURRENT_BINARY_DIR@")
|
||||
SET(MYSQLD_EXECUTABLE "@MYSQLD_EXECUTABLE@")
|
||||
SET(CMAKE_CFG_INTDIR "@CMAKE_CFG_INTDIR@")
|
||||
SET(WIN32 "@WIN32@")
|
||||
# Force Visual Studio to output to stdout
|
||||
IF(ENV{VS_UNICODE_OUTPUT})
|
||||
SET ($ENV{VS_UNICODE_OUTPUT})
|
||||
ENDIF()
|
||||
IF(CMAKE_CFG_INTDIR AND CONFIG)
|
||||
#Resolve build configuration variables
|
||||
STRING(REPLACE "${CMAKE_CFG_INTDIR}" ${CONFIG} MYSQLD_EXECUTABLE
|
||||
"${MYSQLD_EXECUTABLE}")
|
||||
ENDIF()
|
||||
|
||||
# Create bootstrapper SQL script
|
||||
FILE(WRITE bootstrap.sql "use mysql;\n" )
|
||||
FOREACH(FILENAME mysql_system_tables.sql mysql_system_tables_data.sql
|
||||
fill_help_tables.sql)
|
||||
FILE(STRINGS ${CMAKE_SOURCE_DIR}/scripts/${FILENAME} CONTENTS)
|
||||
FOREACH(STR ${CONTENTS})
|
||||
IF(NOT STR MATCHES "@current_hostname")
|
||||
FILE(APPEND bootstrap.sql "${STR}\n")
|
||||
ENDIF()
|
||||
ENDFOREACH()
|
||||
ENDFOREACH()
|
||||
|
||||
|
||||
FILE(REMOVE_RECURSE mysql)
|
||||
MAKE_DIRECTORY(mysql)
|
||||
IF(WIN32)
|
||||
SET(CONSOLE --console)
|
||||
ENDIF()
|
||||
|
||||
SET(BOOTSTRAP_COMMAND
|
||||
${MYSQLD_EXECUTABLE}
|
||||
--no-defaults
|
||||
${CONSOLE}
|
||||
--bootstrap
|
||||
--lc-messages-dir=${CMAKE_CURRENT_BINARY_DIR}/share
|
||||
--basedir=.
|
||||
--datadir=.
|
||||
--loose-skip-innodb
|
||||
--loose-skip-ndbcluster
|
||||
--max_allowed_packet=8M
|
||||
--net_buffer_length=16K
|
||||
)
|
||||
|
||||
GET_FILENAME_COMPONENT(CWD . ABSOLUTE)
|
||||
EXECUTE_PROCESS(
|
||||
COMMAND "@CMAKE_COMMAND@" -E echo Executing ${BOOTSTRAP_COMMAND}
|
||||
)
|
||||
EXECUTE_PROCESS (
|
||||
COMMAND "@CMAKE_COMMAND@" -E echo input file bootstrap.sql, current directory ${CWD}
|
||||
)
|
||||
EXECUTE_PROCESS (
|
||||
COMMAND ${BOOTSTRAP_COMMAND} INPUT_FILE bootstrap.sql OUTPUT_VARIABLE OUT
|
||||
ERROR_VARIABLE ERR
|
||||
RESULT_VARIABLE RESULT
|
||||
)
|
||||
|
||||
IF(NOT RESULT EQUAL 0)
|
||||
MESSAGE(FATAL_ERROR "Could not create initial database \n ${OUT} \n ${ERR}")
|
||||
ENDIF()
|
||||
|
78
cmake/do_abi_check.cmake
Normal file
78
cmake/do_abi_check.cmake
Normal file
|
@ -0,0 +1,78 @@
|
|||
# Copyright (C) 2009 Sun Microsystems, Inc
|
||||
#
|
||||
# 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
|
||||
|
||||
#
|
||||
# Rules for checking that the abi/api has not changed.
|
||||
#
|
||||
# The following steps are followed in the do_abi_check rule below
|
||||
#
|
||||
# 1) Generate preprocessor output for the files that need to
|
||||
# be tested for abi/api changes. use -nostdinc to prevent
|
||||
# generation of preprocessor output for system headers. This
|
||||
# results in messages in stderr saying that these headers
|
||||
# were not found. Redirect the stderr output to /dev/null
|
||||
# to prevent seeing these messages.
|
||||
# 2) sed the output to
|
||||
# 2.1) remove blank lines and lines that begin with "# "
|
||||
# 2.2) When gcc -E is run on the Mac OS and solaris sparc platforms it
|
||||
# introduces a line of output that shows up as a difference between
|
||||
# the .pp and .out files. Remove these OS specific preprocessor text
|
||||
# inserted by the preprocessor.
|
||||
# 3) diff the generated file and the canons (.pp files already in
|
||||
# the repository).
|
||||
# 4) delete the .out file that is generated.
|
||||
#
|
||||
# If the diff fails, the generated file is not removed. This will
|
||||
# be useful for analysis of ABI differences (e.g. using a visual
|
||||
# diff tool).
|
||||
#
|
||||
# A ABI change that causes a build to fail will always be accompanied
|
||||
# by new canons (.out files). The .out files that are not removed will
|
||||
# be replaced as the new .pp files.
|
||||
#
|
||||
# e.g. If include/mysql/plugin.h has an ABI change then this rule would
|
||||
# leave a <build directory>/abi_check.out file.
|
||||
#
|
||||
# A developer with a justified API change will then do a
|
||||
# mv <build directory>/abi_check.out include/mysql/plugin.pp
|
||||
# to replace the old canons with the new ones.
|
||||
#
|
||||
|
||||
SET(abi_check_out ${BINARY_DIR}/abi_check.out)
|
||||
|
||||
FOREACH(file ${ABI_HEADERS})
|
||||
SET(tmpfile ${file}.pp.tmp)
|
||||
EXECUTE_PROCESS(
|
||||
COMMAND ${COMPILER}
|
||||
-E -nostdinc -dI -I${SOURCE_DIR}/include -I${BINARY_DIR}/include
|
||||
-I${SOURCE_DIR}/include/mysql -I${SOURCE_DIR}/sql ${file}
|
||||
ERROR_QUIET OUTPUT_FILE ${tmpfile})
|
||||
EXECUTE_PROCESS(
|
||||
COMMAND sed -e
|
||||
"/^# /d" -e "/^[ ]*$/d" -e "/^#pragma GCC set_debug_pwd/d" -e "/^#ident/d"
|
||||
RESULT_VARIABLE result OUTPUT_FILE ${abi_check_out} INPUT_FILE ${tmpfile})
|
||||
IF(NOT ${result} EQUAL 0)
|
||||
MESSAGE(FATAL_ERROR "sed returned error ${result}")
|
||||
ENDIF()
|
||||
FILE(REMOVE ${tmpfile})
|
||||
EXECUTE_PROCESS(COMMAND diff -w ${file}.pp ${abi_check_out} RESULT_VARIABLE
|
||||
result)
|
||||
IF(NOT ${result} EQUAL 0)
|
||||
MESSAGE(FATAL_ERROR
|
||||
"ABI check found difference between ${file}.pp and ${abi_check_out}")
|
||||
ENDIF()
|
||||
FILE(REMOVE ${abi_check_out})
|
||||
ENDFOREACH()
|
||||
|
176
cmake/dtrace.cmake
Normal file
176
cmake/dtrace.cmake
Normal file
|
@ -0,0 +1,176 @@
|
|||
# Copyright (C) 2009 Sun Microsystems, Inc
|
||||
#
|
||||
# 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 if OS supports DTrace
|
||||
MACRO(CHECK_DTRACE)
|
||||
FIND_PROGRAM(DTRACE dtrace)
|
||||
MARK_AS_ADVANCED(DTRACE)
|
||||
|
||||
# On FreeBSD, dtrace does not handle userland tracing yet
|
||||
IF(DTRACE AND NOT CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
|
||||
SET(ENABLE_DTRACE ON CACHE BOOL "Enable dtrace")
|
||||
ENDIF()
|
||||
SET(HAVE_DTRACE ${ENABLE_DTRACE})
|
||||
IF(CMAKE_SYSTEM_NAME MATCHES "SunOS")
|
||||
IF(CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
SET(DTRACE_FLAGS -32 CACHE INTERNAL "DTrace architecture flags")
|
||||
ELSE()
|
||||
SET(DTRACE_FLAGS -64 CACHE INTERNAL "DTrace architecture flags")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
|
||||
CHECK_DTRACE()
|
||||
|
||||
# Produce a header file with
|
||||
# DTrace macros
|
||||
MACRO (DTRACE_HEADER provider header header_no_dtrace)
|
||||
IF(ENABLE_DTRACE)
|
||||
ADD_CUSTOM_COMMAND(
|
||||
OUTPUT ${header} ${header_no_dtrace}
|
||||
COMMAND ${DTRACE} -h -s ${provider} -o ${header}
|
||||
COMMAND perl ${CMAKE_SOURCE_DIR}/scripts/dheadgen.pl -f ${provider} > ${header_no_dtrace}
|
||||
DEPENDS ${provider}
|
||||
)
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
|
||||
|
||||
# Create provider headers
|
||||
IF(ENABLE_DTRACE)
|
||||
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/include/probes_mysql.d.base
|
||||
${CMAKE_BINARY_DIR}/include/probes_mysql.d COPYONLY)
|
||||
DTRACE_HEADER(
|
||||
${CMAKE_BINARY_DIR}/include/probes_mysql.d
|
||||
${CMAKE_BINARY_DIR}/include/probes_mysql_dtrace.h
|
||||
${CMAKE_BINARY_DIR}/include/probes_mysql_nodtrace.h
|
||||
)
|
||||
IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||
# Systemtap object
|
||||
EXECUTE_PROCESS(
|
||||
COMMAND ${DTRACE} -G -s ${CMAKE_SOURCE_DIR}/include/probes_mysql.d.base
|
||||
-o ${CMAKE_BINARY_DIR}/probes_mysql.o
|
||||
)
|
||||
ENDIF()
|
||||
ADD_CUSTOM_TARGET(gen_dtrace_header
|
||||
DEPENDS
|
||||
${CMAKE_BINARY_DIR}/include/probes_mysql.d
|
||||
${CMAKE_BINARY_DIR}/include/probes_mysql_dtrace.h
|
||||
${CMAKE_BINARY_DIR}/include/probes_mysql_nodtrace.h
|
||||
)
|
||||
ENDIF()
|
||||
|
||||
IF(CMAKE_SYSTEM_NAME MATCHES "SunOS" AND CMAKE_COMPILER_IS_GNUCXX
|
||||
AND CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
IF(NOT DEFINED BUGGY_GCC_NO_DTRACE_MODULES)
|
||||
EXECUTE_PROCESS(
|
||||
COMMAND ${CMAKE_C_COMPILER} ${CMAKE_C_COMPILER_ARG1} --version
|
||||
OUTPUT_VARIABLE out)
|
||||
IF(out MATCHES "3.4.6")
|
||||
# This gcc causes crashes in dlopen() for dtraced shared libs,
|
||||
# while standard shipped with Solaris10 3.4.3 is ok
|
||||
SET(BUGGY_GCC_NO_DTRACE_MODULES 1 CACHE INTERNAL "")
|
||||
ELSE()
|
||||
SET(BUGGY_GCC_NO_DTRACE_MODULES 0 CACHE INTERNAL "")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
FUNCTION(DTRACE_INSTRUMENT target)
|
||||
IF(BUGGY_GCC_NO_DTRACE_MODULES)
|
||||
GET_TARGET_PROPERTY(target_type ${target} TYPE)
|
||||
IF(target_type MATCHES "MODULE_LIBRARY")
|
||||
RETURN()
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
IF(ENABLE_DTRACE)
|
||||
ADD_DEPENDENCIES(${target} gen_dtrace_header)
|
||||
|
||||
IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||
TARGET_LINK_LIBRARIES(${target} ${CMAKE_BINARY_DIR}/probes_mysql.o)
|
||||
ENDIF()
|
||||
|
||||
# On Solaris, invoke dtrace -G to generate object file and
|
||||
# link it together with target.
|
||||
IF(CMAKE_SYSTEM_NAME MATCHES "SunOS")
|
||||
SET(objdir ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${target}.dir)
|
||||
SET(outfile ${objdir}/${target}_dtrace.o)
|
||||
GET_TARGET_PROPERTY(target_type ${target} TYPE)
|
||||
ADD_CUSTOM_COMMAND(
|
||||
TARGET ${target} PRE_LINK
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
-DDTRACE=${DTRACE}
|
||||
-DOUTFILE=${outfile}
|
||||
-DDFILE=${CMAKE_BINARY_DIR}/include/probes_mysql.d
|
||||
-DDTRACE_FLAGS=${DTRACE_FLAGS}
|
||||
-DDIRS=.
|
||||
-DTYPE=${target_type}
|
||||
-P ${CMAKE_SOURCE_DIR}/cmake/dtrace_prelink.cmake
|
||||
WORKING_DIRECTORY ${objdir}
|
||||
)
|
||||
# Add full object path to linker flags
|
||||
GET_TARGET_PROPERTY(target_type ${target} TYPE)
|
||||
IF(NOT target_type MATCHES "STATIC")
|
||||
SET_TARGET_PROPERTIES(${target} PROPERTIES LINK_FLAGS "${outfile}")
|
||||
ELSE()
|
||||
# For static library flags, add the object to the library.
|
||||
# Note: DTrace probes in static libraries are unusable currently
|
||||
# (see explanation for DTRACE_INSTRUMENT_STATIC_LIBS below)
|
||||
# but maybe one day this will be fixed.
|
||||
GET_TARGET_PROPERTY(target_location ${target} LOCATION)
|
||||
ADD_CUSTOM_COMMAND(
|
||||
TARGET ${target} POST_BUILD
|
||||
COMMAND ${CMAKE_AR} r ${target_location} ${outfile}
|
||||
COMMAND ${CMAKE_RANLIB} ${target_location}
|
||||
)
|
||||
# Used in DTRACE_INSTRUMENT_WITH_STATIC_LIBS
|
||||
SET(TARGET_OBJECT_DIRECTORY_${target} ${objdir} CACHE INTERNAL "")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDFUNCTION()
|
||||
|
||||
|
||||
# Ugly workaround for Solaris' DTrace inability to use probes
|
||||
# from static libraries, discussed e.g in this thread
|
||||
# (http://opensolaris.org/jive/thread.jspa?messageID=432454)
|
||||
# We have to collect all object files that may be instrumented
|
||||
# and go into the mysqld (also those that come from in static libs)
|
||||
# run them again through dtrace -G to generate an ELF file that links
|
||||
# to mysqld.
|
||||
MACRO (DTRACE_INSTRUMENT_STATIC_LIBS target libs)
|
||||
IF(CMAKE_SYSTEM_NAME MATCHES "SunOS" AND ENABLE_DTRACE)
|
||||
FOREACH(lib ${libs})
|
||||
SET(dirs ${dirs} ${TARGET_OBJECT_DIRECTORY_${lib}})
|
||||
ENDFOREACH()
|
||||
SET (obj ${CMAKE_CURRENT_BINARY_DIR}/${target}_dtrace_all.o)
|
||||
ADD_CUSTOM_COMMAND(
|
||||
OUTPUT ${obj}
|
||||
DEPENDS ${libs}
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
-DDTRACE=${DTRACE}
|
||||
-DOUTFILE=${obj}
|
||||
-DDFILE=${CMAKE_BINARY_DIR}/include/probes_mysql.d
|
||||
-DDTRACE_FLAGS=${DTRACE_FLAGS}
|
||||
"-DDIRS=${dirs}"
|
||||
-DTYPE=MERGE
|
||||
-P ${CMAKE_SOURCE_DIR}/cmake/dtrace_prelink.cmake
|
||||
VERBATIM
|
||||
)
|
||||
ADD_CUSTOM_TARGET(${target}_dtrace_all DEPENDS ${obj})
|
||||
ADD_DEPENDENCIES(${target} ${target}_dtrace_all)
|
||||
TARGET_LINK_LIBRARIES(${target} ${obj})
|
||||
ENDIF()
|
||||
ENDMACRO()
|
83
cmake/dtrace_prelink.cmake
Normal file
83
cmake/dtrace_prelink.cmake
Normal file
|
@ -0,0 +1,83 @@
|
|||
# Copyright (C) 2009 Sun Microsystems, Inc
|
||||
#
|
||||
# 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
|
||||
|
||||
# Generates an ELF object file with dtrace entry points.
|
||||
# This object that must to be linked with together with
|
||||
# the target. This script needs to run on Solaris only
|
||||
|
||||
# Do not follow symlinks in GLOB_RECURSE
|
||||
CMAKE_POLICY(SET CMP0009 NEW)
|
||||
FILE(REMOVE ${OUTFILE})
|
||||
|
||||
MACRO(CONVERT_TO_RELATIVE_PATHS files rel_paths)
|
||||
GET_FILENAME_COMPONENT(abs_dir . ABSOLUTE)
|
||||
SET(${rel_paths})
|
||||
FOREACH(file ${files})
|
||||
FILE(RELATIVE_PATH rel ${abs_dir} ${file})
|
||||
LIST(APPEND ${rel_paths} ${rel})
|
||||
ENDFOREACH()
|
||||
ENDMACRO()
|
||||
|
||||
IF(TYPE STREQUAL "MERGE")
|
||||
# Rerun dtrace on objects that are already in static libraries.
|
||||
# Object paths are stored in text files named 'dtrace_objects'
|
||||
# in the input directores. We have to copy the objects into temp.
|
||||
# directory, as running dtrace -G on original files will change
|
||||
# timestamps and cause rebuilds or the libraries / excessive
|
||||
# relink
|
||||
FILE(REMOVE_RECURSE dtrace_objects_merge)
|
||||
MAKE_DIRECTORY(dtrace_objects_merge)
|
||||
|
||||
FOREACH(dir ${DIRS})
|
||||
FILE(STRINGS ${dir}/dtrace_objects OBJS)
|
||||
FOREACH(obj ${OBJS})
|
||||
IF(obj)
|
||||
EXECUTE_PROCESS(COMMAND cp ${obj} dtrace_objects_merge)
|
||||
ENDIF()
|
||||
ENDFOREACH()
|
||||
ENDFOREACH()
|
||||
FILE(GLOB_RECURSE OBJECTS dtrace_objects_merge/*.o)
|
||||
CONVERT_TO_RELATIVE_PATHS("${OBJECTS}" REL_OBJECTS)
|
||||
EXECUTE_PROCESS(
|
||||
COMMAND ${DTRACE} ${DTRACE_FLAGS} -o ${OUTFILE} -G -s ${DFILE} ${REL_OBJECTS}
|
||||
)
|
||||
RETURN()
|
||||
ENDIF()
|
||||
|
||||
FOREACH(dir ${DIRS})
|
||||
FILE(GLOB_RECURSE OBJECTS ${dir}/*.o)
|
||||
CONVERT_TO_RELATIVE_PATHS("${OBJECTS}" REL)
|
||||
LIST(APPEND REL_OBJECTS ${REL})
|
||||
ENDFOREACH()
|
||||
|
||||
FILE(WRITE dtrace_timestamp "")
|
||||
EXECUTE_PROCESS(
|
||||
COMMAND ${DTRACE} ${DTRACE_FLAGS} -o ${OUTFILE} -G -s ${DFILE} ${REL_OBJECTS}
|
||||
)
|
||||
|
||||
# Save objects that contain dtrace probes in a file.
|
||||
# This file is used when script is called with -DTYPE=MERGE
|
||||
# to dtrace from static libs.
|
||||
# To find objects with probes, look at the timestamp, it was updated
|
||||
# by dtrace -G run
|
||||
IF(TYPE MATCHES "STATIC")
|
||||
FILE(WRITE dtrace_objects "")
|
||||
FOREACH(obj ${REL_OBJECTS})
|
||||
IF(${obj} IS_NEWER_THAN dtrace_timestamp)
|
||||
GET_FILENAME_COMPONENT(obj_absolute_path ${obj} ABSOLUTE)
|
||||
FILE(APPEND dtrace_objects "${obj_absolute_path}\n" )
|
||||
ENDIF()
|
||||
ENDFOREACH()
|
||||
ENDIF()
|
128
cmake/install_layout.cmake
Executable file
128
cmake/install_layout.cmake
Executable file
|
@ -0,0 +1,128 @@
|
|||
# Copyright (C) 2010 Sun Microsystems, Inc
|
||||
#
|
||||
# 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
|
||||
|
||||
# The purpose of this file is to set the default installation layout.
|
||||
# Currently, there are 2 different installation layouts ,
|
||||
# one is used in tar.gz packages (Windows zip is about the same), another one
|
||||
# in RPMs.
|
||||
|
||||
# There are currently 2 layouts defines, named STANDALONE (tar.gz layout)
|
||||
# and UNIX (rpm layout). To force a directory layout when invoking cmake use
|
||||
# -DINSTALL_LAYOUT=[STANDALONE|UNIX].
|
||||
# This wil use a predefined layout. There is a possibility to further fine-tune
|
||||
# installation directories. Several variables are can be overwritten
|
||||
#
|
||||
# - INSTALL_BINDIR (directory with client executables and Unix shell scripts)
|
||||
# - INSTALL_SBINDIR (directory with mysqld)
|
||||
# - INSTALL_LIBDIR (directory with client end embedded libraries)
|
||||
# - INSTALL_PLUGINDIR (directory for plugins)
|
||||
# - INSTALL_INCLUDEDIR (directory for MySQL headers)
|
||||
# - INSTALL_DOCDIR (documentation)
|
||||
# - INSTALL_MANDIR (man pages)
|
||||
# - INSTALL_SCRIPTDIR (several scripts, rarely used)
|
||||
# - INSTALL_MYSQLSHAREDIR (MySQL character sets and localized error messages)
|
||||
# - INSTALL_SHAREDIR (location of aclocal/mysql.m4)
|
||||
# - INSTALL_SQLBENCHDIR (sql-bench)
|
||||
# - INSTALL_MYSQLTESTDIR (mysql-test)
|
||||
# - INSTALL_DOCREADMEDIR (readme and similar)
|
||||
# - INSTALL_SUPPORTFILESDIR (used only in standalone installer)
|
||||
|
||||
# Default installation layout on Unix is UNIX (kent wants it so)
|
||||
IF(NOT INSTALL_LAYOUT)
|
||||
IF(WIN32)
|
||||
SET(DEFAULT_INSTALL_LAYOUT "STANDALONE")
|
||||
ELSE()
|
||||
SET(DEFAULT_INSTALL_LAYOUT "UNIX")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
SET(INSTALL_LAYOUT "${DEFAULT_INSTALL_LAYOUT}"
|
||||
CACHE STRING "Installation directory layout. Options are: STANDALONE (as in zip or tar.gz installer) or UNIX")
|
||||
|
||||
IF(NOT INSTALL_LAYOUT MATCHES "STANDALONE")
|
||||
IF(NOT INSTALL_LAYOUT MATCHES "UNIX")
|
||||
SET(INSTALL_LAYOUT "${DEFAULT_INSTALL_LAYOUT}")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF(UNIX)
|
||||
IF(INSTALL_LAYOUT MATCHES "UNIX")
|
||||
SET(default_prefix "/usr")
|
||||
ELSE()
|
||||
SET(default_prefix "/usr/local/mysql")
|
||||
ENDIF()
|
||||
IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
||||
SET(CMAKE_INSTALL_PREFIX ${default_prefix}
|
||||
CACHE PATH "install prefix" FORCE)
|
||||
ENDIF()
|
||||
SET(SYSCONFDIR "${CMAKE_INSTALL_PREFIX}/etc"
|
||||
CACHE PATH "config directory (for my.cnf)")
|
||||
MARK_AS_ADVANCED(SYSCONFDIR)
|
||||
ENDIF()
|
||||
|
||||
|
||||
|
||||
# STANDALONE layout
|
||||
SET(INSTALL_BINDIR_STANDALONE "bin")
|
||||
SET(INSTALL_SBINDIR_STANDALONE "bin")
|
||||
SET(INSTALL_LIBDIR_STANDALONE "lib")
|
||||
SET(INSTALL_INCLUDEDIR_STANDALONE "include")
|
||||
SET(INSTALL_PLUGINDIR_STANDALONE "lib/plugin")
|
||||
SET(INSTALL_DOCDIR_STANDALONE "docs")
|
||||
SET(INSTALL_MANDIR_STANDALONE "man")
|
||||
SET(INSTALL_MYSQLSHAREDIR_STANDALONE "share")
|
||||
SET(INSTALL_SHAREDIR_STANDALONE "share")
|
||||
SET(INSTALL_SCRIPTDIR_STANDALONE "scripts")
|
||||
SET(INSTALL_MYSQLTESTDIR_STANDALONE "mysql-test")
|
||||
SET(INSTALL_SQLBENCHROOTDIR_STANDALONE ".")
|
||||
SET(INSTALL_DOCREADMEDIR_STANDALONE ".")
|
||||
SET(INSTALL_SUPPORTFILESDIR_STANDALONE "support-files")
|
||||
SET(INSTALL_MYSQLDATADIR_STANDALONE "data")
|
||||
|
||||
# UNIX layout
|
||||
SET(INSTALL_BINDIR_UNIX "bin")
|
||||
SET(INSTALL_SBINDIR_UNIX "sbin")
|
||||
SET(INSTALL_LIBDIR_UNIX "lib/mysql")
|
||||
SET(INSTALL_PLUGINDIR_UNIX "lib/mysql/plugin")
|
||||
SET(INSTALL_DOCDIR_UNIX "share/mysql/doc/MySQL-server-${MYSQL_NO_DASH_VERSION}")
|
||||
SET(INSTALL_MANDIR_UNIX "share/mysql/man")
|
||||
SET(INSTALL_INCLUDEDIR_UNIX "include/mysql")
|
||||
SET(INSTALL_MYSQLSHAREDIR_UNIX "share/mysql")
|
||||
SET(INSTALL_SHAREDIR_UNIX "share")
|
||||
SET(INSTALL_SCRIPTDIR_UNIX "bin")
|
||||
SET(INSTALL_MYSQLTESTDIR_UNIX "mysql-test")
|
||||
SET(INSTALL_SQLBENCHROOTDIR_UNIX "")
|
||||
SET(INSTALL_DOCREADMEDIR_UNIX "share/mysql/doc/MySQL-server-${MYSQL_NO_DASH_VERSION}")
|
||||
SET(INSTALL_SUPPORTFILESDIR_UNIX "")
|
||||
SET(INSTALL_MYSQLDATADIR_UNIX "var")
|
||||
|
||||
|
||||
# Clear cached variables if install layout was changed
|
||||
IF(OLD_INSTALL_LAYOUT)
|
||||
IF(NOT OLD_INSTALL_LAYOUT STREQUAL INSTALL_LAYOUR)
|
||||
SET(FORCE FORCE)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
SET(OLD_INSTALL_LAYOUT ${INSTALL_LAYOUT} CACHE INTERNAL "")
|
||||
|
||||
# Set INSTALL_FOODIR variables for chosen layout
|
||||
# (for example, INSTALL_BINDIR will be defined as
|
||||
# ${INSTALL_BINDIR_STANDALONE} by default if STANDALONE layout is chosen)
|
||||
FOREACH(var BIN SBIN LIB MYSQLSHARE SHARE PLUGIN INCLUDE SCRIPT DOC MAN
|
||||
MYSQLTEST SQLBENCHROOT DOCREADME SUPPORTFILES MYSQLDATA)
|
||||
SET(INSTALL_${var}DIR ${INSTALL_${var}DIR_${INSTALL_LAYOUT}}
|
||||
CACHE STRING "${var} installation directory" ${FORCE})
|
||||
MARK_AS_ADVANCED(INSTALL_${var}DIR)
|
||||
ENDFOREACH()
|
213
cmake/install_macros.cmake
Normal file
213
cmake/install_macros.cmake
Normal file
|
@ -0,0 +1,213 @@
|
|||
# Copyright (C) 2009 Sun Microsystems, Inc
|
||||
#
|
||||
# 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
|
||||
|
||||
GET_FILENAME_COMPONENT(MYSQL_CMAKE_SCRIPT_DIR ${CMAKE_CURRENT_LIST_FILE} PATH)
|
||||
INCLUDE(${MYSQL_CMAKE_SCRIPT_DIR}/cmake_parse_arguments.cmake)
|
||||
MACRO (INSTALL_DEBUG_SYMBOLS targets)
|
||||
IF(MSVC)
|
||||
FOREACH(target ${targets})
|
||||
GET_TARGET_PROPERTY(location ${target} LOCATION)
|
||||
GET_TARGET_PROPERTY(type ${target} TYPE)
|
||||
IF(NOT INSTALL_LOCATION)
|
||||
IF(type MATCHES "STATIC_LIBRARY" OR type MATCHES "MODULE_LIBRARY" OR type MATCHES "SHARED_LIBRARY")
|
||||
SET(INSTALL_LOCATION "lib")
|
||||
ELSEIF(type MATCHES "EXECUTABLE")
|
||||
SET(INSTALL_LOCATION "bin")
|
||||
ELSE()
|
||||
MESSAGE(FATAL_ERROR "cannot determine type of ${target}. Don't now where to install")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
STRING(REPLACE ".exe" ".pdb" pdb_location ${location})
|
||||
STRING(REPLACE ".dll" ".pdb" pdb_location ${pdb_location})
|
||||
STRING(REPLACE ".lib" ".pdb" pdb_location ${pdb_location})
|
||||
IF(CMAKE_GENERATOR MATCHES "Visual Studio")
|
||||
STRING(REPLACE "${CMAKE_CFG_INTDIR}" "\${CMAKE_INSTALL_CONFIG_NAME}" pdb_location ${pdb_location})
|
||||
ENDIF()
|
||||
INSTALL(FILES ${pdb_location} DESTINATION ${INSTALL_LOCATION})
|
||||
ENDFOREACH()
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
|
||||
# Install symbolic link to CMake target.
|
||||
# the link is created in the same directory as target
|
||||
# and extension will be the same as for target file.
|
||||
MACRO(INSTALL_SYMLINK linkbasename target destination)
|
||||
IF(UNIX)
|
||||
GET_TARGET_PROPERTY(location ${target} LOCATION)
|
||||
GET_FILENAME_COMPONENT(path ${location} PATH)
|
||||
GET_FILENAME_COMPONENT(name_we ${location} NAME_WE)
|
||||
GET_FILENAME_COMPONENT(ext ${location} EXT)
|
||||
SET(output ${path}/${linkbasename}${ext})
|
||||
ADD_CUSTOM_COMMAND(
|
||||
OUTPUT ${output}
|
||||
COMMAND ${CMAKE_COMMAND} ARGS -E remove -f ${output}
|
||||
COMMAND ${CMAKE_COMMAND} ARGS -E create_symlink
|
||||
${name_we}${ext}
|
||||
${linkbasename}${ext}
|
||||
WORKING_DIRECTORY ${path}
|
||||
DEPENDS ${target}
|
||||
)
|
||||
|
||||
ADD_CUSTOM_TARGET(symlink_${linkbasename}${ext}
|
||||
ALL
|
||||
DEPENDS ${output})
|
||||
SET_TARGET_PROPERTIES(symlink_${linkbasename}${ext} PROPERTIES CLEAN_DIRECT_OUTPUT 1)
|
||||
IF(CMAKE_GENERATOR MATCHES "Xcode")
|
||||
# For Xcode, replace project config with install config
|
||||
STRING(REPLACE "${CMAKE_CFG_INTDIR}"
|
||||
"\${CMAKE_INSTALL_CONFIG_NAME}" output ${output})
|
||||
ENDIF()
|
||||
INSTALL(FILES ${output} DESTINATION ${destination})
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
|
||||
IF(WIN32)
|
||||
OPTION(SIGNCODE "Sign executables and dlls with digital certificate" OFF)
|
||||
MARK_AS_ADVANCED(SIGNCODE)
|
||||
IF(SIGNCODE)
|
||||
SET(SIGNTOOL_PARAMETERS
|
||||
/a /t http://timestamp.verisign.com/scripts/timstamp.dll
|
||||
CACHE STRING "parameters for signtool (list)")
|
||||
FIND_PROGRAM(SIGNTOOL_EXECUTABLE signtool)
|
||||
IF(NOT SIGNTOOL_EXECUTABLE)
|
||||
MESSAGE(FATAL_ERROR
|
||||
"signtool is not found. Signing executables not possible")
|
||||
ENDIF()
|
||||
IF(NOT DEFINED SIGNCODE_ENABLED)
|
||||
FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/testsign.c "int main(){return 0;}")
|
||||
MAKE_DIRECTORY(${CMAKE_CURRENT_BINARY_DIR}/testsign)
|
||||
TRY_COMPILE(RESULT ${CMAKE_CURRENT_BINARY_DIR}/testsign ${CMAKE_CURRENT_BINARY_DIR}/testsign.c
|
||||
COPY_FILE ${CMAKE_CURRENT_BINARY_DIR}/testsign.exe
|
||||
)
|
||||
|
||||
EXECUTE_PROCESS(COMMAND
|
||||
${SIGNTOOL_EXECUTABLE} sign ${SIGNTOOL_PARAMETERS} ${CMAKE_CURRENT_BINARY_DIR}/testsign.exe
|
||||
RESULT_VARIABLE ERR ERROR_QUIET OUTPUT_QUIET
|
||||
)
|
||||
IF(ERR EQUAL 0)
|
||||
SET(SIGNCODE_ENABLED 1 CACHE INTERNAL "Can sign executables")
|
||||
ELSE()
|
||||
MESSAGE(STATUS "Disable authenticode signing for executables")
|
||||
SET(SIGNCODE_ENABLED 0 CACHE INTERNAL "Invalid or missing certificate")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
MARK_AS_ADVANCED(SIGNTOOL_EXECUTABLE SIGNTOOL_PARAMETERS)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
MACRO(SIGN_TARGET target)
|
||||
GET_TARGET_PROPERTY(target_type ${target} TYPE)
|
||||
IF(target_type AND NOT target_type MATCHES "STATIC")
|
||||
GET_TARGET_PROPERTY(target_location ${target} LOCATION)
|
||||
IF(CMAKE_GENERATOR MATCHES "Visual Studio")
|
||||
STRING(REPLACE "${CMAKE_CFG_INTDIR}" "\${CMAKE_INSTALL_CONFIG_NAME}"
|
||||
target_location ${target_location})
|
||||
ENDIF()
|
||||
INSTALL(CODE
|
||||
"EXECUTE_PROCESS(COMMAND
|
||||
${SIGNTOOL_EXECUTABLE} sign ${SIGNTOOL_PARAMETERS} ${target_location}
|
||||
RESULT_VARIABLE ERR)
|
||||
IF(NOT \${ERR} EQUAL 0)
|
||||
MESSAGE(FATAL_ERROR \"Error signing ${target_location}\")
|
||||
ENDIF()
|
||||
")
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
|
||||
|
||||
# Installs targets, also installs pdbs on Windows.
|
||||
#
|
||||
# More stuff can be added later, e.g signing
|
||||
# or pre-link custom targets (one example is creating
|
||||
# version resource for windows executables)
|
||||
|
||||
FUNCTION(MYSQL_INSTALL_TARGETS)
|
||||
CMAKE_PARSE_ARGUMENTS(ARG
|
||||
"DESTINATION"
|
||||
""
|
||||
${ARGN}
|
||||
)
|
||||
SET(TARGETS ${ARG_DEFAULT_ARGS})
|
||||
IF(NOT TARGETS)
|
||||
MESSAGE(FATAL_ERROR "Need target list for MYSQL_INSTALL_TARGETS")
|
||||
ENDIF()
|
||||
IF(NOT ARG_DESTINATION)
|
||||
MESSAGE(FATAL_ERROR "Need DESTINATION parameter for MYSQL_INSTALL_TARGETS")
|
||||
ENDIF()
|
||||
|
||||
# If signing is required, sign executables before installing
|
||||
FOREACH(target ${TARGETS})
|
||||
IF(SIGNCODE AND SIGNCODE_ENABLED)
|
||||
SIGN_TARGET(${target})
|
||||
ENDIF()
|
||||
ADD_VERSION_INFO(${target})
|
||||
ENDFOREACH()
|
||||
|
||||
INSTALL(TARGETS ${TARGETS} DESTINATION ${ARG_DESTINATION})
|
||||
SET(INSTALL_LOCATION ${ARG_DESTINATION} )
|
||||
INSTALL_DEBUG_SYMBOLS("${TARGETS}")
|
||||
SET(INSTALL_LOCATION)
|
||||
ENDFUNCTION()
|
||||
|
||||
# Optionally install mysqld/client/embedded from debug build run. outside of the current build dir
|
||||
# (unless multi-config generator is used like Visual Studio or Xcode).
|
||||
# For Makefile generators we default Debug build directory to ${buildroot}/../debug.
|
||||
GET_FILENAME_COMPONENT(BINARY_PARENTDIR ${CMAKE_BINARY_DIR} PATH)
|
||||
SET(DEBUGBUILDDIR "${BINARY_PARENTDIR}/debug" CACHE INTERNAL "Directory of debug build")
|
||||
|
||||
|
||||
FUNCTION(INSTALL_DEBUG_TARGET target)
|
||||
CMAKE_PARSE_ARGUMENTS(ARG
|
||||
"DESTINATION;RENAME"
|
||||
""
|
||||
${ARGN}
|
||||
)
|
||||
GET_TARGET_PROPERTY(target_type ${target} TYPE)
|
||||
IF(ARG_RENAME)
|
||||
SET(RENAME_PARAM RENAME ${ARG_RENAME}${CMAKE_${target_type}_SUFFIX})
|
||||
ELSE()
|
||||
SET(RENAME_PARAM)
|
||||
ENDIF()
|
||||
IF(NOT ARG_DESTINATION)
|
||||
MESSAGE(FATAL_ERROR "Need DESTINATION parameter for INSTALL_DEBUG_TARGET")
|
||||
ENDIF()
|
||||
GET_TARGET_PROPERTY(target_location ${target} LOCATION)
|
||||
IF(CMAKE_GENERATOR MATCHES "Makefiles")
|
||||
STRING(REPLACE "${CMAKE_BINARY_DIR}" "${DEBUGBUILDDIR}" debug_target_location "${target_location}")
|
||||
ELSE()
|
||||
STRING(REPLACE "${CMAKE_CFG_INTDIR}" "Debug" debug_target_location "${target_location}" )
|
||||
ENDIF()
|
||||
|
||||
INSTALL(FILES ${debug_target_location}
|
||||
DESTINATION ${ARG_DESTINATION}
|
||||
${RENAME_PARAM}
|
||||
CONFIGURATIONS Release RelWithDebInfo
|
||||
OPTIONAL)
|
||||
|
||||
IF(MSVC)
|
||||
GET_FILENAME_COMPONENT(ext ${debug_target_location} EXT)
|
||||
STRING(REPLACE "${ext}" ".pdb" debug_pdb_target_location "${debug_target_location}" )
|
||||
IF(RENAME_PARAM)
|
||||
STRING(REPLACE "${ext}" ".pdb" "${ARG_RENAME}" pdb_rename)
|
||||
SET(PDB_RENAME_PARAM RENAME ${pdb_rename})
|
||||
ENDIF()
|
||||
INSTALL(FILES ${debug_pdb_target_location}
|
||||
DESTINATION ${ARG_DESTINATION}
|
||||
${RPDB_RENAME_PARAM}
|
||||
CONFIGURATIONS Release RelWithDebInfo
|
||||
OPTIONAL)
|
||||
ENDIF()
|
||||
ENDFUNCTION()
|
||||
|
296
cmake/libutils.cmake
Normal file
296
cmake/libutils.cmake
Normal file
|
@ -0,0 +1,296 @@
|
|||
# Copyright (C) 2009 Sun Microsystems, Inc
|
||||
#
|
||||
# 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 file exports macros that emulate some functionality found in GNU libtool
|
||||
# on Unix systems. One such feature is convenience libraries. In this context,
|
||||
# convenience library is a static library that can be linked to shared library
|
||||
# On systems that force position-independent code, linking into shared library
|
||||
# normally requires compilation with a special flag (often -fPIC). To enable
|
||||
# linking static libraries to shared, we compile source files that come into
|
||||
# static library with the PIC flag (${CMAKE_SHARED_LIBRARY_C_FLAGS} in CMake)
|
||||
# Some systems, like Windows or OSX do not need special compilation (Windows
|
||||
# never uses PIC and OSX always uses it).
|
||||
#
|
||||
# The intention behind convenience libraries is simplify the build and to reduce
|
||||
# excessive recompiles.
|
||||
|
||||
# Except for convenience libraries, this file provides macros to merge static
|
||||
# libraries (we need it for mysqlclient) and to create shared library out of
|
||||
# convenience libraries(again, for mysqlclient)
|
||||
|
||||
# Following macros are exported
|
||||
# - ADD_CONVENIENCE_LIBRARY(target source1...sourceN)
|
||||
# This macro creates convenience library. The functionality is similar to
|
||||
# ADD_LIBRARY(target STATIC source1...sourceN), the difference is that resulting
|
||||
# library can always be linked to shared library
|
||||
#
|
||||
# - MERGE_LIBRARIES(target [STATIC|SHARED|MODULE] [linklib1 .... linklibN]
|
||||
# [EXPORTS exported_func1 .... exported_func_N]
|
||||
# [OUTPUT_NAME output_name]
|
||||
# This macro merges several static libraries into a single one or creates a shared
|
||||
# library from several convenience libraries
|
||||
|
||||
# Important global flags
|
||||
# - WITH_PIC : If set, it is assumed that everything is compiled as position
|
||||
# independent code (that is CFLAGS/CMAKE_C_FLAGS contain -fPIC or equivalent)
|
||||
# If defined, ADD_CONVENIENCE_LIBRARY does not add PIC flag to compile flags
|
||||
#
|
||||
# - DISABLE_SHARED: If set, it is assumed that shared libraries are not produced
|
||||
# during the build. ADD_CONVENIENCE_LIBRARY does not add anything to compile flags
|
||||
|
||||
|
||||
GET_FILENAME_COMPONENT(MYSQL_CMAKE_SCRIPT_DIR ${CMAKE_CURRENT_LIST_FILE} PATH)
|
||||
IF(WIN32 OR CYGWIN OR APPLE OR WITH_PIC OR DISABLE_SHARED OR NOT CMAKE_SHARED_LIBRARY_C_FLAGS)
|
||||
SET(_SKIP_PIC 1)
|
||||
ENDIF()
|
||||
|
||||
INCLUDE(${MYSQL_CMAKE_SCRIPT_DIR}/cmake_parse_arguments.cmake)
|
||||
# CREATE_EXPORT_FILE (VAR target api_functions)
|
||||
# Internal macro, used to create source file for shared libraries that
|
||||
# otherwise consists entirely of "convenience" libraries. On Windows,
|
||||
# also exports API functions as dllexport. On unix, creates a dummy file
|
||||
# that references all exports and this prevents linker from creating an
|
||||
# empty library(there are unportable alternatives, --whole-archive)
|
||||
MACRO(CREATE_EXPORT_FILE VAR TARGET API_FUNCTIONS)
|
||||
IF(WIN32)
|
||||
SET(DUMMY ${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_dummy.c)
|
||||
SET(EXPORTS ${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_exports.def)
|
||||
CONFIGURE_FILE_CONTENT("" ${DUMMY})
|
||||
SET(CONTENT "EXPORTS\n")
|
||||
FOREACH(FUNC ${API_FUNCTIONS})
|
||||
SET(CONTENT "${CONTENT} ${FUNC}\n")
|
||||
ENDFOREACH()
|
||||
CONFIGURE_FILE_CONTENT(${CONTENT} ${EXPORTS})
|
||||
SET(${VAR} ${DUMMY} ${EXPORTS})
|
||||
ELSE()
|
||||
SET(EXPORTS ${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_exports_file.cc)
|
||||
SET(CONTENT)
|
||||
FOREACH(FUNC ${API_FUNCTIONS})
|
||||
SET(CONTENT "${CONTENT} extern void* ${FUNC}\;\n")
|
||||
ENDFOREACH()
|
||||
SET(CONTENT "${CONTENT} void *${TARGET}_api_funcs[] = {\n")
|
||||
FOREACH(FUNC ${API_FUNCTIONS})
|
||||
SET(CONTENT "${CONTENT} &${FUNC},\n")
|
||||
ENDFOREACH()
|
||||
SET(CONTENT "${CONTENT} (void *)0\n}\;")
|
||||
CONFIGURE_FILE_CONTENT(${CONTENT} ${EXPORTS})
|
||||
SET(${VAR} ${EXPORTS})
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
|
||||
|
||||
# MYSQL_ADD_CONVENIENCE_LIBRARY(name source1...sourceN)
|
||||
# Create static library that can be linked to shared library.
|
||||
# On systems that force position-independent code, adds -fPIC or
|
||||
# equivalent flag to compile flags.
|
||||
MACRO(ADD_CONVENIENCE_LIBRARY)
|
||||
SET(TARGET ${ARGV0})
|
||||
SET(SOURCES ${ARGN})
|
||||
LIST(REMOVE_AT SOURCES 0)
|
||||
ADD_LIBRARY(${TARGET} STATIC ${SOURCES})
|
||||
IF(NOT _SKIP_PIC)
|
||||
SET_TARGET_PROPERTIES(${TARGET} PROPERTIES COMPILE_FLAGS
|
||||
"${CMAKE_SHARED_LIBRARY_C_FLAGS}")
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
|
||||
|
||||
# Write content to file, using CONFIGURE_FILE
|
||||
# The advantage compared to FILE(WRITE) is that timestamp
|
||||
# does not change if file already has the same content
|
||||
MACRO(CONFIGURE_FILE_CONTENT content file)
|
||||
SET(CMAKE_CONFIGURABLE_FILE_CONTENT
|
||||
"${content}\n")
|
||||
CONFIGURE_FILE(
|
||||
${MYSQL_CMAKE_SCRIPT_DIR}/configurable_file_content.in
|
||||
${file}
|
||||
@ONLY)
|
||||
ENDMACRO()
|
||||
|
||||
# Merge static libraries into a big static lib. The resulting library
|
||||
# should not not have dependencies on other static libraries.
|
||||
# We use it in MySQL to merge mysys,dbug,vio etc into mysqlclient
|
||||
|
||||
MACRO(MERGE_STATIC_LIBS TARGET OUTPUT_NAME LIBS_TO_MERGE)
|
||||
# To produce a library we need at least one source file.
|
||||
# It is created by ADD_CUSTOM_COMMAND below and will helps
|
||||
# also help to track dependencies.
|
||||
SET(SOURCE_FILE ${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_depends.c)
|
||||
ADD_LIBRARY(${TARGET} STATIC ${SOURCE_FILE})
|
||||
SET_TARGET_PROPERTIES(${TARGET} PROPERTIES OUTPUT_NAME ${OUTPUT_NAME})
|
||||
|
||||
SET(OSLIBS)
|
||||
FOREACH(LIB ${LIBS_TO_MERGE})
|
||||
GET_TARGET_PROPERTY(LIB_LOCATION ${LIB} LOCATION)
|
||||
GET_TARGET_PROPERTY(LIB_TYPE ${LIB} TYPE)
|
||||
IF(NOT LIB_LOCATION)
|
||||
# 3rd party library like libz.so. Make sure that everything
|
||||
# that links to our library links to this one as well.
|
||||
LIST(APPEND OSLIBS ${LIB})
|
||||
ELSE()
|
||||
# This is a target in current project
|
||||
# (can be a static or shared lib)
|
||||
IF(LIB_TYPE STREQUAL "STATIC_LIBRARY")
|
||||
SET(STATIC_LIBS ${STATIC_LIBS} ${LIB_LOCATION})
|
||||
ADD_DEPENDENCIES(${TARGET} ${LIB})
|
||||
# Extract dependend OS libraries
|
||||
GET_DEPENDEND_OS_LIBS(${LIB} LIB_OSLIBS)
|
||||
LIST(APPEND OSLIBS ${LIB_OSLIBS})
|
||||
ELSE()
|
||||
# This is a shared library our static lib depends on.
|
||||
LIST(APPEND OSLIBS ${LIB})
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDFOREACH()
|
||||
IF(OSLIBS)
|
||||
LIST(REMOVE_DUPLICATES OSLIBS)
|
||||
TARGET_LINK_LIBRARIES(${TARGET} ${OSLIBS})
|
||||
ENDIF()
|
||||
|
||||
# Make the generated dummy source file depended on all static input
|
||||
# libs. If input lib changes,the source file is touched
|
||||
# which causes the desired effect (relink).
|
||||
ADD_CUSTOM_COMMAND(
|
||||
OUTPUT ${SOURCE_FILE}
|
||||
COMMAND ${CMAKE_COMMAND} -E touch ${SOURCE_FILE}
|
||||
DEPENDS ${STATIC_LIBS})
|
||||
|
||||
IF(MSVC)
|
||||
# To merge libs, just pass them to lib.exe command line.
|
||||
SET(LINKER_EXTRA_FLAGS "")
|
||||
FOREACH(LIB ${STATIC_LIBS})
|
||||
SET(LINKER_EXTRA_FLAGS "${LINKER_EXTRA_FLAGS} ${LIB}")
|
||||
ENDFOREACH()
|
||||
SET_TARGET_PROPERTIES(${TARGET} PROPERTIES STATIC_LIBRARY_FLAGS
|
||||
"${LINKER_EXTRA_FLAGS}")
|
||||
ELSE()
|
||||
GET_TARGET_PROPERTY(TARGET_LOCATION ${TARGET} LOCATION)
|
||||
IF(APPLE)
|
||||
# Use OSX's libtool to merge archives (ihandles universal
|
||||
# binaries properly)
|
||||
ADD_CUSTOM_COMMAND(TARGET ${TARGET} POST_BUILD
|
||||
COMMAND rm ${TARGET_LOCATION}
|
||||
COMMAND /usr/bin/libtool -static -o ${TARGET_LOCATION}
|
||||
${STATIC_LIBS}
|
||||
)
|
||||
ELSE()
|
||||
# Generic Unix, Cygwin or MinGW. In post-build step, call
|
||||
# script, that extracts objects from archives with "ar x"
|
||||
# and repacks them with "ar r"
|
||||
SET(TARGET ${TARGET})
|
||||
CONFIGURE_FILE(
|
||||
${MYSQL_CMAKE_SCRIPT_DIR}/merge_archives_unix.cmake.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/merge_archives_${TARGET}.cmake
|
||||
@ONLY
|
||||
)
|
||||
ADD_CUSTOM_COMMAND(TARGET ${TARGET} POST_BUILD
|
||||
COMMAND rm ${TARGET_LOCATION}
|
||||
COMMAND ${CMAKE_COMMAND} -P
|
||||
${CMAKE_CURRENT_BINARY_DIR}/merge_archives_${TARGET}.cmake
|
||||
)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
|
||||
# Create libs from libs.
|
||||
# Merges static libraries, creates shared libraries out of convenience libraries.
|
||||
# MERGE_LIBRARIES(target [STATIC|SHARED|MODULE]
|
||||
# [linklib1 .... linklibN]
|
||||
# [EXPORTS exported_func1 .... exportedFuncN]
|
||||
# [OUTPUT_NAME output_name]
|
||||
#)
|
||||
MACRO(MERGE_LIBRARIES)
|
||||
CMAKE_PARSE_ARGUMENTS(ARG
|
||||
"EXPORTS;OUTPUT_NAME"
|
||||
"STATIC;SHARED;MODULE;NOINSTALL"
|
||||
${ARGN}
|
||||
)
|
||||
LIST(GET ARG_DEFAULT_ARGS 0 TARGET)
|
||||
SET(LIBS ${ARG_DEFAULT_ARGS})
|
||||
LIST(REMOVE_AT LIBS 0)
|
||||
IF(ARG_STATIC)
|
||||
IF (NOT ARG_OUTPUT_NAME)
|
||||
SET(ARG_OUTPUT_NAME ${TARGET})
|
||||
ENDIF()
|
||||
MERGE_STATIC_LIBS(${TARGET} ${ARG_OUTPUT_NAME} "${LIBS}")
|
||||
ELSEIF(ARG_SHARED OR ARG_MODULE)
|
||||
IF(ARG_SHARED)
|
||||
SET(LIBTYPE SHARED)
|
||||
ELSE()
|
||||
SET(LIBTYPE MODULE)
|
||||
ENDIF()
|
||||
# check for non-PIC libraries
|
||||
IF(NOT _SKIP_PIC)
|
||||
FOREACH(LIB ${LIBS})
|
||||
GET_TARGET_PROPERTY(${LIB} TYPE LIBTYPE)
|
||||
IF(LIBTYPE STREQUAL "STATIC_LIBRARY")
|
||||
GET_TARGET_PROPERTY(LIB COMPILE_FLAGS LIB_COMPILE_FLAGS)
|
||||
STRING(REPLACE "${CMAKE_SHARED_LIBRARY_C_FLAGS}"
|
||||
"<PIC_FLAG>" LIB_COMPILE_FLAGS ${LIB_COMPILE_FLAG})
|
||||
IF(NOT LIB_COMPILE_FLAGS MATCHES "<PIC_FLAG>")
|
||||
MESSAGE(FATAL_ERROR
|
||||
"Attempted to link non-PIC static library ${LIB} to shared library ${TARGET}\n"
|
||||
"Please use ADD_CONVENIENCE_LIBRARY, instead of ADD_LIBRARY for ${LIB}"
|
||||
)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDFOREACH()
|
||||
ENDIF()
|
||||
CREATE_EXPORT_FILE(SRC ${TARGET} "${ARG_EXPORTS}")
|
||||
ADD_LIBRARY(${TARGET} ${LIBTYPE} ${SRC})
|
||||
TARGET_LINK_LIBRARIES(${TARGET} ${LIBS})
|
||||
IF(ARG_OUTPUT_NAME)
|
||||
SET_TARGET_PROPERTIES(${TARGET} PROPERTIES OUTPUT_NAME "${ARG_OUTPUT_NAME}")
|
||||
ENDIF()
|
||||
ELSE()
|
||||
MESSAGE(FATAL_ERROR "Unknown library type")
|
||||
ENDIF()
|
||||
IF(NOT ARG_NOINSTALL)
|
||||
MYSQL_INSTALL_TARGETS(${TARGET} DESTINATION "${INSTALL_LIBDIR}")
|
||||
ENDIF()
|
||||
SET_TARGET_PROPERTIES(${TARGET} PROPERTIES LINK_INTERFACE_LIBRARIES "")
|
||||
ENDMACRO()
|
||||
|
||||
FUNCTION(GET_DEPENDEND_OS_LIBS target result)
|
||||
SET(deps ${${target}_LIB_DEPENDS})
|
||||
IF(deps)
|
||||
FOREACH(lib ${deps})
|
||||
# Filter out keywords for used for debug vs optimized builds
|
||||
IF(NOT lib MATCHES "general" AND NOT lib MATCHES "debug" AND NOT lib MATCHES "optimized")
|
||||
GET_TARGET_PROPERTY(lib_location ${lib} LOCATION)
|
||||
IF(NOT lib_location)
|
||||
SET(ret ${ret} ${lib})
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDFOREACH()
|
||||
ENDIF()
|
||||
SET(${result} ${ret} PARENT_SCOPE)
|
||||
ENDFUNCTION()
|
||||
|
||||
MACRO(RESTRICT_SYMBOL_EXPORTS target)
|
||||
IF(CMAKE_COMPILER_IS_GNUCXX AND UNIX)
|
||||
CHECK_C_COMPILER_FLAG("-fvisibility=hidden" HAVE_VISIBILITY_HIDDEN)
|
||||
IF(HAVE_VISIBILITY_HIDDEN)
|
||||
GET_TARGET_PROPERTY(COMPILE_FLAGS ${target} COMPILE_FLAGS)
|
||||
IF(NOT COMPILE_FLAGS)
|
||||
# Avoid COMPILE_FLAGS-NOTFOUND
|
||||
SET(COMPILE_FLAGS)
|
||||
ENDIF()
|
||||
SET_TARGET_PROPERTIES(${target} PROPERTIES
|
||||
COMPILE_FLAGS "${COMPILE_FLAGS} -fvisibility=hidden")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDMACRO()
|
184
cmake/make_dist.cmake.in
Normal file
184
cmake/make_dist.cmake.in
Normal file
|
@ -0,0 +1,184 @@
|
|||
# Copyright (C) 2009 Sun Microsystems, Inc
|
||||
#
|
||||
# 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 source distribution
|
||||
# If bzr is present, run bzr export, add output of BUILD/autorun.sh
|
||||
# if autotools are present, also pack bison output into it.
|
||||
# Otherwise, just run cpack with source configuration.
|
||||
|
||||
SET(CMAKE_SOURCE_DIR "@CMAKE_SOURCE_DIR@")
|
||||
SET(CMAKE_BINARY_DIR "@CMAKE_BINARY_DIR@")
|
||||
SET(CPACK_SOURCE_PACKAGE_FILE_NAME "@CPACK_SOURCE_PACKAGE_FILE_NAME@")
|
||||
SET(GLIBTOOLIZE_EXECUTABLE "@GLIBTOOLIZE_EXECUTABLE@")
|
||||
SET(LIBTOOLIZE_EXECUTABLE "@LIBTOOLIZE_EXECUTABLE@")
|
||||
SET(ACLOCAL_EXECUTABLE "@ACLOCAL_EXECUTABLE@")
|
||||
SET(AUTOCONF_EXECUTABLE "@AUTOCONF_EXECUTABLE@")
|
||||
SET(AUTOHEADER_EXECUTABLE "@AUTOHEADER_EXECUTABLE@")
|
||||
SET(AUTOMAKE_EXECUTABLE "@AUTOMAKE_EXECUTABLE@")
|
||||
SET(CMAKE_CPACK_COMMAND "@CMAKE_CPACK_COMMAND@")
|
||||
SET(CMAKE_COMMAND "@CMAKE_COMMAND@")
|
||||
SET(BZR_EXECUTABLE "@BZR_EXECUTABLE@")
|
||||
SET(GTAR_EXECUTABLE "@GTAR_EXECUTABLE@")
|
||||
SET(TAR_EXECUTABLE "@TAR_EXECUTABLE@")
|
||||
SET(CMAKE_GENERATOR "@CMAKE_GENERATOR@")
|
||||
SET(CMAKE_MAKE_PROGRAM "@CMAKE_MAKE_PROGRAM@")
|
||||
SET(CMAKE_SYSTEM_NAME "@CMAKE_SYSTEM_NAME@")
|
||||
|
||||
SET(MYSQL_DOCS_LOCATION "@MYSQL_DOCS_LOCATION@")
|
||||
|
||||
|
||||
SET(PACKAGE_DIR ${CMAKE_BINARY_DIR}/${CPACK_SOURCE_PACKAGE_FILE_NAME})
|
||||
|
||||
FILE(REMOVE_RECURSE ${PACKAGE_DIR})
|
||||
FILE(REMOVE ${PACKAGE_DIR}.tar.gz )
|
||||
|
||||
IF(BZR_EXECUTABLE)
|
||||
MESSAGE(STATUS "Running bzr export")
|
||||
EXECUTE_PROCESS(
|
||||
COMMAND "${BZR_EXECUTABLE}" export
|
||||
${PACKAGE_DIR}
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
RESULT_VARIABLE RESULT
|
||||
)
|
||||
|
||||
IF(NOT RESULT EQUAL 0)
|
||||
SET(BZR_EXECUTABLE)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF(NOT BZR_EXECUTABLE)
|
||||
MESSAGE(STATUS "bzr not found or source dir is not a repo, use CPack")
|
||||
|
||||
IF(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
|
||||
# In-source build is the worst option, we have to cleanup source tree.
|
||||
|
||||
# Save bison output first.
|
||||
CONFIGURE_FILE(${CMAKE_BINARY_DIR}/sql/sql_yacc.cc
|
||||
${CMAKE_BINARY_DIR}/sql_yacc.cc COPY_ONLY)
|
||||
CONFIGURE_FILE(${CMAKE_BINARY_DIR}/sql/sql_yacc.h
|
||||
${CMAKE_BINARY_DIR}/sql_yacc.h COPY_ONLY)
|
||||
|
||||
IF(CMAKE_GENERATOR MATCHES "Makefiles")
|
||||
# make clean
|
||||
EXECUTE_PROCESS(
|
||||
COMMAND ${CMAKE_MAKE_PROGRAM} clean
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||
)
|
||||
ENDIF()
|
||||
|
||||
# Restore bison output
|
||||
CONFIGURE_FILE(${CMAKE_BINARY_DIR}/sql_yacc.cc
|
||||
${CMAKE_BINARY_DIR}/sql/sql_yacc.cc COPY_ONLY)
|
||||
CONFIGURE_FILE(${CMAKE_BINARY_DIR}/sql_yacc.h
|
||||
${CMAKE_BINARY_DIR}/sql/sql_yacc.h COPY_ONLY)
|
||||
FILE(REMOVE ${CMAKE_BINARY_DIR}/sql_yacc.cc)
|
||||
FILE(REMOVE ${CMAKE_BINARY_DIR}/sql_yacc.h)
|
||||
ENDIF()
|
||||
|
||||
EXECUTE_PROCESS(
|
||||
COMMAND ${CMAKE_CPACK_COMMAND} -G TGZ --config ./CPackSourceConfig.cmake
|
||||
${CMAKE_BINARY_DIR}/CPackSourceConfig.cmake
|
||||
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||
)
|
||||
EXECUTE_PROCESS(
|
||||
COMMAND ${CMAKE_COMMAND} -E tar xzf
|
||||
${CPACK_SOURCE_PACKAGE_FILE_NAME}.tar.gz
|
||||
${PACK_SOURCE_PACKAGE_FILE_NAME}
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||
)
|
||||
ENDIF()
|
||||
|
||||
# Try to pack output of BUILD/autorun, if autotools are present
|
||||
IF(GLIBTOOLIZE_EXECUTABLE OR LIBTOOLIZE_EXECUTABLE)
|
||||
IF(ACLOCAL_EXECUTABLE AND AUTOMAKE_EXECUTABLE AND AUTOCONF_EXECUTABLE
|
||||
AND AUTOHEADER_EXECUTABLE)
|
||||
SET(HAVE_AUTOTOOLS 1)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF(HAVE_AUTOTOOLS)
|
||||
EXECUTE_PROCESS(COMMAND BUILD/autorun.sh
|
||||
WORKING_DIRECTORY ${PACKAGE_DIR})
|
||||
ELSE()
|
||||
MESSAGE( "Autotools not found, resulting source package can only be built"
|
||||
" with cmake")
|
||||
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/cmake/configure.pl
|
||||
${PACKAGE_DIR}/configure
|
||||
COPYONLY)
|
||||
IF(UNIX)
|
||||
EXECUTE_PROCESS(COMMAND chmod +x ${PACKAGE_DIR}/configure)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
# Copy bison output
|
||||
CONFIGURE_FILE(${CMAKE_BINARY_DIR}/sql/sql_yacc.h
|
||||
${PACKAGE_DIR}/sql/sql_yacc.h COPYONLY)
|
||||
CONFIGURE_FILE(${CMAKE_BINARY_DIR}/sql/sql_yacc.cc
|
||||
${PACKAGE_DIR}/sql/sql_yacc.cc COPYONLY)
|
||||
|
||||
# Add documentation, if user has specified where to find them
|
||||
IF(MYSQL_DOCS_LOCATION)
|
||||
MESSAGE("Copying documentation files from " ${MYSQL_DOCS_LOCATION})
|
||||
EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E copy_directory "${MYSQL_DOCS_LOCATION}" "${PACKAGE_DIR}")
|
||||
ENDIF()
|
||||
|
||||
# In case we used CPack, it could have copied some
|
||||
# extra files that are not usable on different machines.
|
||||
FILE(REMOVE ${PACKAGE_DIR}/CMakeCache.txt)
|
||||
FILE(REMOVE_RECURSE ${PACKAGE_DIR}/autom4te.cache)
|
||||
|
||||
# When packing source, prefer gnu tar to "cmake -P tar"
|
||||
# cmake does not preserve timestamps.gnuwin32 tar is broken, cygwin is ok
|
||||
|
||||
IF(CMAKE_SYSTEM_NAME MATCHES "Windows")
|
||||
IF (EXISTS C:/cygwin/bin/tar.exe)
|
||||
SET(TAR_EXECUTABLE C:/cygwin/bin/tar.exe)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF(GTAR_EXECUTABLE)
|
||||
SET(GNUTAR ${GTAR_EXECUTABLE})
|
||||
ELSEIF(TAR_EXECUTABLE)
|
||||
EXECUTE_PROCESS(
|
||||
COMMAND "${TAR_EXECUTABLE}" --version
|
||||
RESULT_VARIABLE RESULT OUTPUT_VARIABLE OUT ERROR_VARIABLE ERR
|
||||
)
|
||||
IF(RESULT EQUAL 0 AND OUT MATCHES "GNU")
|
||||
SET(GNUTAR ${TAR_EXECUTABLE})
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
SET($ENV{GZIP} "--best")
|
||||
|
||||
IF(GNUTAR)
|
||||
SET(PACK_COMMAND
|
||||
${GNUTAR} cfz
|
||||
${CPACK_SOURCE_PACKAGE_FILE_NAME}.tar.gz
|
||||
${CPACK_SOURCE_PACKAGE_FILE_NAME}
|
||||
)
|
||||
ELSE()
|
||||
SET(PACK_COMMAND ${CMAKE_COMMAND} -E tar cfz
|
||||
${CPACK_SOURCE_PACKAGE_FILE_NAME}.tar.gz
|
||||
${CPACK_SOURCE_PACKAGE_FILE_NAME}
|
||||
)
|
||||
ENDIF()
|
||||
|
||||
MESSAGE(STATUS "Creating source package")
|
||||
|
||||
EXECUTE_PROCESS(
|
||||
COMMAND ${PACK_COMMAND}
|
||||
)
|
||||
MESSAGE(STATUS "Source package ${PACKAGE_DIR}.tar.gz created")
|
62
cmake/merge_archives_unix.cmake.in
Normal file
62
cmake/merge_archives_unix.cmake.in
Normal file
|
@ -0,0 +1,62 @@
|
|||
# Copyright (C) 2009 Sun Microsystems, Inc
|
||||
#
|
||||
# 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 merges many static libraries into
|
||||
# one big library on Unix.
|
||||
SET(TARGET_LOCATION "@TARGET_LOCATION@")
|
||||
SET(TARGET "@TARGET@")
|
||||
SET(STATIC_LIBS "@STATIC_LIBS@")
|
||||
SET(CMAKE_CURRENT_BINARY_DIR "@CMAKE_CURRENT_BINARY_DIR@")
|
||||
SET(CMAKE_AR "@CMAKE_AR@")
|
||||
SET(CMAKE_RANLIB "@CMAKE_RANLIB@")
|
||||
|
||||
|
||||
SET(TEMP_DIR ${CMAKE_CURRENT_BINARY_DIR}/merge_archives_${TARGET})
|
||||
MAKE_DIRECTORY(${TEMP_DIR})
|
||||
# Extract each archive to its own subdirectory(avoid object filename clashes)
|
||||
FOREACH(LIB ${STATIC_LIBS})
|
||||
GET_FILENAME_COMPONENT(NAME_NO_EXT ${LIB} NAME_WE)
|
||||
SET(TEMP_SUBDIR ${TEMP_DIR}/${NAME_NO_EXT})
|
||||
MAKE_DIRECTORY(${TEMP_SUBDIR})
|
||||
EXECUTE_PROCESS(
|
||||
COMMAND ${CMAKE_AR} -x ${LIB}
|
||||
WORKING_DIRECTORY ${TEMP_SUBDIR}
|
||||
)
|
||||
|
||||
FILE(GLOB_RECURSE LIB_OBJECTS "${TEMP_SUBDIR}/*")
|
||||
SET(OBJECTS ${OBJECTS} ${LIB_OBJECTS})
|
||||
ENDFOREACH()
|
||||
|
||||
# Use relative paths, makes command line shorter.
|
||||
GET_FILENAME_COMPONENT(ABS_TEMP_DIR ${TEMP_DIR} ABSOLUTE)
|
||||
FOREACH(OBJ ${OBJECTS})
|
||||
FILE(RELATIVE_PATH OBJ ${ABS_TEMP_DIR} ${OBJ})
|
||||
FILE(TO_NATIVE_PATH ${OBJ} OBJ)
|
||||
SET(ALL_OBJECTS ${ALL_OBJECTS} ${OBJ})
|
||||
ENDFOREACH()
|
||||
|
||||
FILE(TO_NATIVE_PATH ${TARGET_LOCATION} ${TARGET_LOCATION})
|
||||
# Now pack the objects into library with ar.
|
||||
EXECUTE_PROCESS(
|
||||
COMMAND ${CMAKE_AR} -r ${TARGET_LOCATION} ${ALL_OBJECTS}
|
||||
WORKING_DIRECTORY ${TEMP_DIR}
|
||||
)
|
||||
EXECUTE_PROCESS(
|
||||
COMMAND ${CMAKE_RANLIB} ${TARGET_LOCATION}
|
||||
WORKING_DIRECTORY ${TEMP_DIR}
|
||||
)
|
||||
|
||||
# Cleanup
|
||||
FILE(REMOVE_RECURSE ${TEMP_DIR})
|
49
cmake/mysql_add_executable.cmake
Normal file
49
cmake/mysql_add_executable.cmake
Normal file
|
@ -0,0 +1,49 @@
|
|||
# Copyright (C) 2009 Sun Microsystems, Inc
|
||||
#
|
||||
# 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
|
||||
|
||||
# Add executable plus some additional MySQL specific stuff
|
||||
# Usage (same as for standard CMake's ADD_EXECUTABLE)
|
||||
#
|
||||
# MYSQL_ADD_EXECUTABLE(target source1...sourceN)
|
||||
#
|
||||
# MySQL specifics:
|
||||
# - instruct CPack to install executable under ${CMAKE_INSTALL_PREFIX}/bin directory
|
||||
# On Windows :
|
||||
# - add version resource
|
||||
# - instruct CPack to do autenticode signing if SIGNCODE is set
|
||||
|
||||
INCLUDE(cmake_parse_arguments)
|
||||
|
||||
FUNCTION (MYSQL_ADD_EXECUTABLE)
|
||||
# Pass-through arguments for ADD_EXECUTABLE
|
||||
CMAKE_PARSE_ARGUMENTS(ARG
|
||||
"WIN32;MACOSX_BUNDLE;EXCLUDE_FROM_ALL;DESTINATION"
|
||||
""
|
||||
${ARGN}
|
||||
)
|
||||
LIST(GET ARG_DEFAULT_ARGS 0 target)
|
||||
LIST(REMOVE_AT ARG_DEFAULT_ARGS 0)
|
||||
|
||||
SET(sources ${ARG_DEFAULT_ARGS})
|
||||
|
||||
ADD_EXECUTABLE(${target} ${ARG_WIN32} ${ARG_MACOSX_BUNDLE} ${ARG_EXCLUDE_FROM_ALL} ${sources})
|
||||
# tell CPack where to install
|
||||
IF(NOT ARG_EXCLUDE_FROM_ALL)
|
||||
IF(NOT ARG_DESTINATION)
|
||||
SET(ARG_DESTINATION ${INSTALL_BINDIR})
|
||||
ENDIF()
|
||||
MYSQL_INSTALL_TARGETS(${target} DESTINATION ${ARG_DESTINATION})
|
||||
ENDIF()
|
||||
ENDFUNCTION()
|
160
cmake/mysql_version.cmake
Normal file
160
cmake/mysql_version.cmake
Normal file
|
@ -0,0 +1,160 @@
|
|||
# Copyright (C) 2009 Sun Microsystems, Inc
|
||||
#
|
||||
# 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
|
||||
|
||||
# Read value for a variable from configure.in
|
||||
|
||||
MACRO(MYSQL_GET_CONFIG_VALUE keyword var)
|
||||
IF(NOT ${var})
|
||||
IF (EXISTS ${CMAKE_SOURCE_DIR}/configure.in)
|
||||
FILE (STRINGS ${CMAKE_SOURCE_DIR}/configure.in str REGEX "^[ ]*${keyword}=")
|
||||
IF(str)
|
||||
STRING(REPLACE "${keyword}=" "" str ${str})
|
||||
STRING(REGEX REPLACE "[ ].*" "" str ${str})
|
||||
SET(${var} ${str} CACHE INTERNAL "Config variable")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
|
||||
|
||||
# Read mysql version for configure script
|
||||
|
||||
MACRO(GET_MYSQL_VERSION)
|
||||
|
||||
IF(NOT VERSION_STRING)
|
||||
IF(EXISTS ${CMAKE_SOURCE_DIR}/configure.in)
|
||||
FILE(STRINGS ${CMAKE_SOURCE_DIR}/configure.in str REGEX "AM_INIT_AUTOMAKE")
|
||||
STRING(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+[-][^ \\)]+" VERSION_STRING "${str}")
|
||||
IF(NOT VERSION_STRING)
|
||||
STRING(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" VERSION_STRING "${str}")
|
||||
IF(NOT VERSION_STRING)
|
||||
FILE(STRINGS configure.in str REGEX "AC_INIT\\(")
|
||||
STRING(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+[-][a-zAZ0-9]+" VERSION_STRING "${str}")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
|
||||
IF(NOT VERSION_STRING)
|
||||
MESSAGE(FATAL_ERROR
|
||||
"VERSION_STRING cannot be parsed, please specify -DVERSION_STRING=major.minor.patch-extra"
|
||||
"when calling cmake")
|
||||
ENDIF()
|
||||
|
||||
SET(VERSION ${VERSION_STRING})
|
||||
|
||||
# Remove trailing (non-numeric) part of the version string
|
||||
STRING(REGEX REPLACE "[^\\.0-9].*" "" VERSION_STRING ${VERSION_STRING})
|
||||
|
||||
STRING(REGEX REPLACE "([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" MAJOR_VERSION "${VERSION_STRING}")
|
||||
STRING(REGEX REPLACE "[0-9]+\\.([0-9]+)\\.[0-9]+" "\\1" MINOR_VERSION "${VERSION_STRING}")
|
||||
STRING(REGEX REPLACE "[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" PATCH "${VERSION_STRING}")
|
||||
SET(MYSQL_BASE_VERSION "${MAJOR_VERSION}.${MINOR_VERSION}" CACHE INTERNAL "MySQL Base version")
|
||||
SET(MYSQL_NO_DASH_VERSION "${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH}")
|
||||
MATH(EXPR MYSQL_VERSION_ID "10000*${MAJOR_VERSION} + 100*${MINOR_VERSION} + ${PATCH}")
|
||||
MARK_AS_ADVANCED(VERSION MYSQL_VERSION_ID MYSQL_BASE_VERSION)
|
||||
SET(CPACK_PACKAGE_VERSION_MAJOR ${MAJOR_VERSION})
|
||||
SET(CPACK_PACKAGE_VERSION_MINOR ${MINOR_VERSION})
|
||||
SET(CPACK_PACKAGE_VERSION_PATCH ${PATCH})
|
||||
ENDMACRO()
|
||||
|
||||
# Get mysql version and other interesting variables
|
||||
GET_MYSQL_VERSION()
|
||||
|
||||
MYSQL_GET_CONFIG_VALUE("PROTOCOL_VERSION" PROTOCOL_VERSION)
|
||||
MYSQL_GET_CONFIG_VALUE("DOT_FRM_VERSION" DOT_FRM_VERSION)
|
||||
MYSQL_GET_CONFIG_VALUE("MYSQL_TCP_PORT_DEFAULT" MYSQL_TCP_PORT_DEFAULT)
|
||||
MYSQL_GET_CONFIG_VALUE("MYSQL_UNIX_ADDR_DEFAULT" MYSQL_UNIX_ADDR_DEFAULT)
|
||||
MYSQL_GET_CONFIG_VALUE("SHARED_LIB_MAJOR_VERSION" SHARED_LIB_MAJOR_VERSION)
|
||||
IF(NOT MYSQL_TCP_PORT_DEFAULT)
|
||||
SET(MYSQL_TCP_PORT_DEFAULT "3306")
|
||||
ENDIF()
|
||||
IF(NOT MYSQL_TCP_PORT)
|
||||
SET(MYSQL_TCP_PORT ${MYSQL_TCP_PORT_DEFAULT})
|
||||
SET(MYSQL_TCP_PORT_DEFAULT "0")
|
||||
ELSEIF(MYSQL_TCP_PORT EQUAL MYSQL_TCP_PORT_DEFAULT)
|
||||
SET(MYSQL_TCP_PORT_DEFAULT "0")
|
||||
ENDIF()
|
||||
|
||||
|
||||
IF(NOT MYSQL_UNIX_ADDR)
|
||||
SET(MYSQL_UNIX_ADDR "/tmp/mysql.sock")
|
||||
ENDIF()
|
||||
IF(NOT COMPILATION_COMMENT)
|
||||
SET(COMPILATION_COMMENT "Source distribution")
|
||||
ENDIF()
|
||||
|
||||
|
||||
INCLUDE(package_name)
|
||||
IF(NOT CPACK_PACKAGE_FILE_NAME)
|
||||
GET_PACKAGE_FILE_NAME(CPACK_PACKAGE_FILE_NAME)
|
||||
ENDIF()
|
||||
|
||||
IF(NOT CPACK_SOURCE_PACKAGE_FILE_NAME)
|
||||
SET(CPACK_SOURCE_PACKAGE_FILE_NAME "mysql-${VERSION}")
|
||||
ENDIF()
|
||||
SET(CPACK_PACKAGE_VENDOR "Sun Microsystems, Inc")
|
||||
SET(CPACK_SOURCE_GENERATOR "TGZ")
|
||||
INCLUDE(cpack_source_ignore_files)
|
||||
|
||||
# Defintions for windows version resources
|
||||
SET(PRODUCTNAME "MySQL Server")
|
||||
SET(COMPANYNAME ${CPACK_PACKAGE_VENDOR})
|
||||
|
||||
# Add version information to the exe and dll files
|
||||
# Refer to http://msdn.microsoft.com/en-us/library/aa381058(VS.85).aspx
|
||||
# for more info.
|
||||
IF(MSVC)
|
||||
GET_TARGET_PROPERTY(location gen_versioninfo LOCATION)
|
||||
IF(NOT location)
|
||||
GET_FILENAME_COMPONENT(MYSQL_CMAKE_SCRIPT_DIR ${CMAKE_CURRENT_LIST_FILE} PATH)
|
||||
SET(FILETYPE VFT_APP)
|
||||
CONFIGURE_FILE(${MYSQL_CMAKE_SCRIPT_DIR}/versioninfo.rc.in
|
||||
${CMAKE_BINARY_DIR}/versioninfo_exe.rc)
|
||||
|
||||
SET(FILETYPE VFT_DLL)
|
||||
CONFIGURE_FILE(${MYSQL_CMAKE_SCRIPT_DIR}/versioninfo.rc.in
|
||||
${CMAKE_BINARY_DIR}/versioninfo_dll.rc)
|
||||
|
||||
ADD_CUSTOM_COMMAND(
|
||||
OUTPUT ${CMAKE_BINARY_DIR}/versioninfo_exe.res
|
||||
${CMAKE_BINARY_DIR}/versioninfo_dll.res
|
||||
COMMAND ${CMAKE_RC_COMPILER} versioninfo_exe.rc
|
||||
COMMAND ${CMAKE_RC_COMPILER} versioninfo_dll.rc
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||
)
|
||||
ADD_CUSTOM_TARGET(gen_versioninfo
|
||||
DEPENDS
|
||||
${CMAKE_BINARY_DIR}/versioninfo_exe.res
|
||||
${CMAKE_BINARY_DIR}/versioninfo_dll.res
|
||||
)
|
||||
ENDIF()
|
||||
|
||||
FUNCTION(ADD_VERSION_INFO target)
|
||||
GET_TARGET_PROPERTY(target_type ${target} TYPE)
|
||||
ADD_DEPENDENCIES(${target} gen_versioninfo)
|
||||
IF(target_type MATCHES "SHARED" OR target_type MATCHES "MODULE")
|
||||
SET_PROPERTY(TARGET ${target} APPEND PROPERTY LINK_FLAGS
|
||||
"\"${CMAKE_BINARY_DIR}/versioninfo_dll.res\"")
|
||||
ELSEIF(target_type MATCHES "EXE")
|
||||
SET_PROPERTY(TARGET ${target} APPEND PROPERTY LINK_FLAGS
|
||||
"${target_link_flags} \"${CMAKE_BINARY_DIR}/versioninfo_exe.res\"")
|
||||
ENDIF()
|
||||
ENDFUNCTION()
|
||||
ELSE()
|
||||
FUNCTION(ADD_VERSION_INFO)
|
||||
ENDFUNCTION()
|
||||
ENDIF()
|
33
cmake/os/AIX.cmake
Normal file
33
cmake/os/AIX.cmake
Normal file
|
@ -0,0 +1,33 @@
|
|||
# Copyright (C) 2010 Sun Microsystems, Inc
|
||||
#
|
||||
# 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
|
||||
|
||||
|
||||
#Enable 64 bit file offsets
|
||||
SET(_LARGE_FILES 1)
|
||||
|
||||
# Fix xlC oddity - it complains about same inline function defined multiple times
|
||||
# in different compilation units
|
||||
INCLUDE(CheckCXXCompilerFlag)
|
||||
CHECK_CXX_COMPILER_FLAG("-qstaticinline" HAVE_QSTATICINLINE)
|
||||
IF(HAVE_QSTATICINLINE)
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -qstaticinline")
|
||||
ENDIF()
|
||||
|
||||
# The following is required to export all symbols
|
||||
# (also with leading underscore)
|
||||
STRING(REPLACE "-bexpall" "-bexpfull" CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS
|
||||
${CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS}")
|
||||
STRING(REPLACE "-bexpall" "-bexpfull" CMAKE_SHARED_LIBRARY_LINK_C_FLAGS
|
||||
"${CMAKE_SHARED_LIBRARY_LINK_C_FLAGS}")
|
17
cmake/os/Cygwin.cmake
Normal file
17
cmake/os/Cygwin.cmake
Normal file
|
@ -0,0 +1,17 @@
|
|||
# Copyright (C) 2010 Sun Microsystems, Inc
|
||||
#
|
||||
# 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
|
||||
|
||||
# Cygwin is not Windows
|
||||
SET(WIN32 0)
|
34
cmake/os/Darwin.cmake
Normal file
34
cmake/os/Darwin.cmake
Normal file
|
@ -0,0 +1,34 @@
|
|||
# Copyright (C) 2010 Sun Microsystems, Inc
|
||||
#
|
||||
# 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 file includes OSX specific options and quirks, related to system checks
|
||||
|
||||
# Workaround for CMake bug#9051
|
||||
# (CMake does not pass CMAKE_OSX_SYSROOT and CMAKE_OSX_DEPLOYMENT_TARGET when
|
||||
# running TRY_COMPILE)
|
||||
|
||||
IF(CMAKE_OSX_SYSROOT)
|
||||
SET(ENV{CMAKE_OSX_SYSROOT} ${CMAKE_OSX_SYSROOT})
|
||||
ENDIF()
|
||||
IF(CMAKE_OSX_SYSROOT)
|
||||
SET(ENV{MACOSX_DEPLOYMENT_TARGET} ${OSX_DEPLOYMENT_TARGET})
|
||||
ENDIF()
|
||||
|
||||
IF(CMAKE_OSX_DEPLOYMENT_TARGET)
|
||||
# Workaround linker problems on OSX 10.4
|
||||
IF(CMAKE_OSX_DEPLOYMENT_TARGET VERSION_LESS "10.5")
|
||||
ADD_DEFINITIONS(-fno-common)
|
||||
ENDIF()
|
||||
ENDIF()
|
20
cmake/os/FreeBSD.cmake
Normal file
20
cmake/os/FreeBSD.cmake
Normal file
|
@ -0,0 +1,20 @@
|
|||
|
||||
# Copyright (C) 2010 Sun Microsystems, Inc
|
||||
#
|
||||
# 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 file includes FreeBSD specific options and quirks, related to system checks
|
||||
#Legacy option, maybe not needed anymore , taken as is from autotools build
|
||||
ADD_DEFINITIONS(-DNET_RETRY_COUNT=1000000)
|
||||
|
47
cmake/os/HP-UX.cmake
Normal file
47
cmake/os/HP-UX.cmake
Normal file
|
@ -0,0 +1,47 @@
|
|||
# Copyright (C) 2010 Sun Microsystems, Inc
|
||||
#
|
||||
# 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
|
||||
|
||||
INCLUDE(CheckCXXSourceCompiles)
|
||||
# Enable 64 bit file offsets
|
||||
SET(_LARGEFILE64_SOURCE 1)
|
||||
SET(_FILE_OFFSET_BITS 64)
|
||||
# If Itanium make shared library suffix .so
|
||||
# OS understands both .sl and .so. CMake would
|
||||
# use .sl, however MySQL prefers .so
|
||||
IF(NOT CMAKE_SYSTEM_PROCESSOR MATCHES "9000")
|
||||
SET(CMAKE_SHARED_LIBRARY_SUFFIX ".so" CACHE INTERNAL "" FORCE)
|
||||
SET(CMAKE_SHARED_MODULE_SUFFIX ".so" CACHE INTERNAL "" FORCE)
|
||||
ENDIF()
|
||||
IF(CMAKE_SYSTEM MATCHES "11")
|
||||
ADD_DEFINITIONS(-DHPUX11)
|
||||
ENDIF()
|
||||
|
||||
IF(CMAKE_CXX_COMPILER_ID MATCHES "HP")
|
||||
# Enable standard C++ flags if required
|
||||
# HP seems a bit traditional and "new" features like ANSI for-scope
|
||||
# still require special flag to be set
|
||||
CHECK_CXX_SOURCE_COMPILES(
|
||||
"int main()
|
||||
{
|
||||
for(int i=0; i<1; i++);
|
||||
for(int i=0; i<1; i++);
|
||||
return 0;
|
||||
}
|
||||
" HAVE_ANSI_FOR_SCOPE)
|
||||
IF(NOT HAVE_ANSI_FOR_SCOPE)
|
||||
# Enable conformant behavior
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Aa")
|
||||
ENDIF()
|
||||
ENDIF()
|
47
cmake/os/Linux.cmake
Normal file
47
cmake/os/Linux.cmake
Normal file
|
@ -0,0 +1,47 @@
|
|||
|
||||
# Copyright (C) 2010 Sun Microsystems, Inc
|
||||
#
|
||||
# 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 file includes Linux specific options and quirks, related to system checks
|
||||
|
||||
INCLUDE(CheckSymbolExists)
|
||||
|
||||
# Something that needs to be set on legacy reasons
|
||||
SET(TARGET_OS_LINUX 1)
|
||||
SET(HAVE_NPTL 1)
|
||||
SET(_GNU_SOURCE 1)
|
||||
|
||||
# Fix CMake (< 2.8) flags. -rdynamic exports too many symbols.
|
||||
FOREACH(LANG C CXX)
|
||||
STRING(REPLACE "-rdynamic" ""
|
||||
CMAKE_SHARED_LIBRARY_LINK_${LANG}_FLAGS
|
||||
${CMAKE_SHARED_LIBRARY_LINK_${LANG}_FLAGS}
|
||||
)
|
||||
ENDFOREACH()
|
||||
|
||||
# Ensure we have clean build for shared libraries
|
||||
# without unresolved symbols
|
||||
SET(LINK_FLAG_NO_UNDEFINED "--Wl,--no-undefined")
|
||||
|
||||
# 64 bit file offset support flag
|
||||
SET(_FILE_OFFSET_BITS 64)
|
||||
|
||||
# Linux specific HUGETLB /large page support
|
||||
CHECK_SYMBOL_EXISTS(SHM_HUGETLB sys/shm.h HAVE_DECL_SHM_HUGETLB)
|
||||
IF(HAVE_DECL_SHM_HUGETLB)
|
||||
SET(HAVE_LARGE_PAGES 1)
|
||||
SET(HUGETLB_USE_PROC_MEMINFO 1)
|
||||
SET(HAVE_LARGE_PAGE_OPTION 1)
|
||||
ENDIF()
|
17
cmake/os/OS400.cmake
Normal file
17
cmake/os/OS400.cmake
Normal file
|
@ -0,0 +1,17 @@
|
|||
# Copyright (C) 2010 Sun Microsystems, Inc
|
||||
#
|
||||
# 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
|
||||
|
||||
GET_FILENAME_COMPONENT(_SCRIPT_DIR ${CMAKE_CURRENT_LIST_FILE} PATH)
|
||||
INCLUDE(${_SCRIPT_DIR}/AIX.cmake)
|
96
cmake/os/SunOS.cmake
Normal file
96
cmake/os/SunOS.cmake
Normal file
|
@ -0,0 +1,96 @@
|
|||
# Copyright (C) 2010 Sun Microsystems, Inc
|
||||
#
|
||||
# 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
|
||||
|
||||
INCLUDE(CheckSymbolExists)
|
||||
INCLUDE(CheckCSourceRuns)
|
||||
INCLUDE(CheckCSourceCompiles)
|
||||
|
||||
SET(TARGET_OS_SOLARIS 1)
|
||||
# Enable 64 bit file offsets
|
||||
SET(_FILE_OFFSET_BITS 64)
|
||||
|
||||
# Legacy option, without it my_pthread is having problems
|
||||
ADD_DEFINITIONS(-DHAVE_RWLOCK_T)
|
||||
|
||||
# On Solaris, use of intrinsics will screw the lib search logic
|
||||
# Force using -lm, so rint etc are found.
|
||||
SET(LIBM m)
|
||||
|
||||
# CMake defined -lthread as thread flag. This crashes in dlopen
|
||||
# when trying to load plugins workaround with -lpthread
|
||||
SET(CMAKE_THREADS_LIBS_INIT -lpthread CACHE INTERNAL "" FORCE)
|
||||
|
||||
# Solaris specific large page support
|
||||
CHECK_SYMBOL_EXISTS(MHA_MAPSIZE_VA sys/mman.h HAVE_DECL_MHA_MAPSIZE_VA)
|
||||
IF(HAVE_DECL_MHA_MAPSIZE_VA)
|
||||
SET(HAVE_SOLARIS_LARGE_PAGES 1)
|
||||
SET(HAVE_LARGE_PAGE_OPTION 1)
|
||||
ENDIF()
|
||||
|
||||
|
||||
# Solaris atomics
|
||||
CHECK_C_SOURCE_RUNS(
|
||||
"
|
||||
#include <atomic.h>
|
||||
int main()
|
||||
{
|
||||
int foo = -10; int bar = 10;
|
||||
int64_t foo64 = -10; int64_t bar64 = 10;
|
||||
if (atomic_add_int_nv((uint_t *)&foo, bar) || foo)
|
||||
return -1;
|
||||
bar = atomic_swap_uint((uint_t *)&foo, (uint_t)bar);
|
||||
if (bar || foo != 10)
|
||||
return -1;
|
||||
bar = atomic_cas_uint((uint_t *)&bar, (uint_t)foo, 15);
|
||||
if (bar)
|
||||
return -1;
|
||||
if (atomic_add_64_nv((volatile uint64_t *)&foo64, bar64) || foo64)
|
||||
return -1;
|
||||
bar64 = atomic_swap_64((volatile uint64_t *)&foo64, (uint64_t)bar64);
|
||||
if (bar64 || foo64 != 10)
|
||||
return -1;
|
||||
bar64 = atomic_cas_64((volatile uint64_t *)&bar64, (uint_t)foo64, 15);
|
||||
if (bar64)
|
||||
return -1;
|
||||
atomic_or_64((volatile uint64_t *)&bar64, 0);
|
||||
return 0;
|
||||
}
|
||||
" HAVE_SOLARIS_ATOMIC)
|
||||
|
||||
|
||||
# Check is special processor flag needs to be set on older GCC
|
||||
#that defaults to v8 sparc . Code here is taken from my_rdtsc.c
|
||||
IF(CMAKE_COMPILER_IS_GNUCC AND CMAKE_SIZEOF_VOID_P EQUAL 4
|
||||
AND CMAKE_SYSTEM_PROCESSOR MATCHES "sparc")
|
||||
SET(SOURCE
|
||||
"
|
||||
int main()
|
||||
{
|
||||
long high\;
|
||||
long low\;
|
||||
__asm __volatile__ (\"rd %%tick,%1\; srlx %1,32,%0\" : \"=r\" ( high), \"=r\" (low))\;
|
||||
return 0\;
|
||||
} ")
|
||||
CHECK_C_SOURCE_COMPILES(${SOURCE} HAVE_SPARC32_TICK)
|
||||
IF(NOT HAVE_SPARC32_TICK)
|
||||
SET(CMAKE_REQUIRED_FLAGS "-mcpu=v9")
|
||||
CHECK_C_SOURCE_COMPILES(${SOURCE} HAVE_SPARC32_TICK_WITH_V9)
|
||||
SET(CMAKE_REQUIRED_FLAGS)
|
||||
IF(HAVE_SPARC32_TICK_WITH_V9)
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mcpu=v9")
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mcpu=v9")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDIF()
|
196
cmake/os/Windows.cmake
Normal file
196
cmake/os/Windows.cmake
Normal file
|
@ -0,0 +1,196 @@
|
|||
# Copyright (C) 2010 Sun Microsystems, Inc
|
||||
#
|
||||
# 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 file includes Windows specific hacks, mostly around compiler flags
|
||||
|
||||
INCLUDE (CheckCSourceCompiles)
|
||||
INCLUDE (CheckCXXSourceCompiles)
|
||||
INCLUDE (CheckStructHasMember)
|
||||
INCLUDE (CheckLibraryExists)
|
||||
INCLUDE (CheckFunctionExists)
|
||||
INCLUDE (CheckCCompilerFlag)
|
||||
INCLUDE (CheckCSourceRuns)
|
||||
INCLUDE (CheckSymbolExists)
|
||||
INCLUDE (CheckTypeSize)
|
||||
|
||||
# Optionally read user configuration, generated by configure.js.
|
||||
# This is left for backward compatibility reasons only.
|
||||
INCLUDE(${CMAKE_BINARY_DIR}/win/configure.data OPTIONAL)
|
||||
|
||||
# avoid running system checks by using pre-cached check results
|
||||
# system checks are expensive on VS since every tiny program is to be compiled in
|
||||
# a VC solution.
|
||||
GET_FILENAME_COMPONENT(_SCRIPT_DIR ${CMAKE_CURRENT_LIST_FILE} PATH)
|
||||
INCLUDE(${_SCRIPT_DIR}/WindowsCache.cmake)
|
||||
|
||||
|
||||
# OS display name (version_compile_os etc).
|
||||
# Used by the test suite to ignore bugs on some platforms,
|
||||
IF(CMAKE_SIZEOF_VOID_P MATCHES 8)
|
||||
SET(SYSTEM_TYPE "Win64")
|
||||
ELSE()
|
||||
SET(SYSTEM_TYPE "Win32")
|
||||
ENDIF()
|
||||
|
||||
# Intel compiler is almost Visual C++
|
||||
# (same compile flags etc). Set MSVC flag
|
||||
IF(CMAKE_C_COMPILER MATCHES "icl")
|
||||
SET(MSVC TRUE)
|
||||
ENDIF()
|
||||
|
||||
ADD_DEFINITIONS("-D_WINDOWS -D__WIN__ -D_CRT_SECURE_NO_DEPRECATE")
|
||||
ADD_DEFINITIONS("-D_WIN32_WINNT=0x0501")
|
||||
# Speed up build process excluding unused header files
|
||||
ADD_DEFINITIONS("-DWIN32_LEAN_AND_MEAN")
|
||||
|
||||
# Adjust compiler and linker flags
|
||||
IF(MINGW AND CMAKE_SIZEOF_VOIDP EQUAL 4)
|
||||
# mininal architecture flags, i486 enables GCC atomics
|
||||
ADD_DEFINITIONS(-march=i486)
|
||||
ENDIF()
|
||||
|
||||
IF(MSVC)
|
||||
# Enable debug info also in Release build, and create PDB to be able to analyze
|
||||
# crashes
|
||||
FOREACH(lang C CXX)
|
||||
SET(CMAKE_${lang}_FLAGS_RELEASE "${CMAKE_${lang}_FLAGS_RELEASE} /Zi")
|
||||
ENDFOREACH()
|
||||
FOREACH(type EXE SHARED MODULE)
|
||||
SET(CMAKE_{type}_LINKER_FLAGS_RELEASE "${CMAKE_${type}_LINKER_FLAGS_RELEASE} /debug")
|
||||
ENDFOREACH()
|
||||
|
||||
# Force static runtime libraries
|
||||
FOREACH(flag
|
||||
CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_RELWITHDEBINFO
|
||||
CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_DEBUG_INIT
|
||||
CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_RELWITHDEBINFO
|
||||
CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_DEBUG_INIT)
|
||||
STRING(REPLACE "/MD" "/MT" "${flag}" "${${flag}}")
|
||||
ENDFOREACH()
|
||||
|
||||
# Remove support for exceptions
|
||||
FOREACH(flag CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_INIT)
|
||||
STRING(REPLACE "/EHsc" "" "${flag}" "${${flag}}")
|
||||
ENDFOREACH()
|
||||
|
||||
# Fix CMake's predefined huge stack size
|
||||
FOREACH(type EXE SHARED MODULE)
|
||||
STRING(REGEX REPLACE "/STACK:([^ ]+)" "" CMAKE_${type}_LINKER_FLAGS "${CMAKE_${type}_LINKER_FLAGS}")
|
||||
STRING(REGEX REPLACE "/INCREMENTAL:([^ ]+)" "" CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO}")
|
||||
ENDFOREACH()
|
||||
|
||||
ADD_DEFINITIONS(-DPTHREAD_STACK_MIN=1048576)
|
||||
# Mark 32 bit executables large address aware so they can
|
||||
# use > 2GB address space
|
||||
IF(CMAKE_SIZEOF_VOID_P MATCHES 4)
|
||||
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /LARGEADDRESSAWARE")
|
||||
ENDIF()
|
||||
|
||||
# Speed up multiprocessor build
|
||||
IF (MSVC_VERSION GREATER 1400)
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP")
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
|
||||
ENDIF()
|
||||
|
||||
#TODO: update the code and remove the disabled warnings
|
||||
ADD_DEFINITIONS(/wd4800 /wd4805)
|
||||
IF (MSVC_VERSION GREATER 1310)
|
||||
ADD_DEFINITIONS(/wd4996)
|
||||
ENDIF()
|
||||
|
||||
IF(CMAKE_SIZEOF_VOID_P MATCHES 8)
|
||||
# _WIN64 is defined by the compiler itself.
|
||||
# Yet, we define it here again to work around a bug with Intellisense
|
||||
# described here: http://tinyurl.com/2cb428.
|
||||
# Syntax highlighting is important for proper debugger functionality.
|
||||
ADD_DEFINITIONS("-D_WIN64")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
# Always link with socket library
|
||||
LINK_LIBRARIES(ws2_32)
|
||||
# ..also for tests
|
||||
SET(CMAKE_REQUIRED_LIBRARIES ws2_32)
|
||||
|
||||
# System checks
|
||||
SET(SIGNAL_WITH_VIO_CLOSE 1) # Something that runtime team needs
|
||||
|
||||
# IPv6 constants appeared in Vista SDK first. We need to define them in any case if they are
|
||||
# not in headers, to handle dual mode sockets correctly.
|
||||
CHECK_SYMBOL_EXISTS(IPPROTO_IPV6 "winsock2.h" HAVE_IPPROTO_IPV6)
|
||||
IF(NOT HAVE_IPPROTO_IPV6)
|
||||
SET(HAVE_IPPROTO_IPV6 41)
|
||||
ENDIF()
|
||||
CHECK_SYMBOL_EXISTS(IPV6_V6ONLY "winsock2.h;ws2ipdef.h" HAVE_IPV6_V6ONLY)
|
||||
IF(NOT HAVE_IPV6_V6ONLY)
|
||||
SET(IPV6_V6ONLY 27)
|
||||
ENDIF()
|
||||
|
||||
# Some standard functions exist there under different
|
||||
# names (e.g popen is _popen or strok_r is _strtok_s)
|
||||
# If a replacement function exists, HAVE_FUNCTION is
|
||||
# defined to 1. CMake variable <function_name> will also
|
||||
# be defined to the replacement name.
|
||||
# So for example, CHECK_FUNCTION_REPLACEMENT(popen _popen)
|
||||
# will define HAVE_POPEN to 1 and set variable named popen
|
||||
# to _popen. If the header template, one needs to have
|
||||
# cmakedefine popen @popen@ which will expand to
|
||||
# define popen _popen after CONFIGURE_FILE
|
||||
|
||||
MACRO(CHECK_FUNCTION_REPLACEMENT function replacement)
|
||||
STRING(TOUPPER ${function} function_upper)
|
||||
CHECK_FUNCTION_EXISTS(${function} HAVE_${function_upper})
|
||||
IF(NOT HAVE_${function_upper})
|
||||
CHECK_FUNCTION_EXISTS(${replacement} HAVE_${replacement})
|
||||
IF(HAVE_${replacement})
|
||||
SET(HAVE_${function_upper} 1 )
|
||||
SET(${function} ${replacement})
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
MACRO(CHECK_SYMBOL_REPLACEMENT symbol replacement header)
|
||||
STRING(TOUPPER ${symbol} symbol_upper)
|
||||
CHECK_SYMBOL_EXISTS(${symbol} ${header} HAVE_${symbol_upper})
|
||||
IF(NOT HAVE_${symbol_upper})
|
||||
CHECK_SYMBOL_EXISTS(${replacement} ${header} HAVE_${replacement})
|
||||
IF(HAVE_${replacement})
|
||||
SET(HAVE_${symbol_upper} 1)
|
||||
SET(${symbol} ${replacement})
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
|
||||
CHECK_SYMBOL_REPLACEMENT(S_IROTH _S_IREAD sys/stat.h)
|
||||
CHECK_SYMBOL_REPLACEMENT(S_IFIFO _S_IFIFO sys/stat.h)
|
||||
CHECK_SYMBOL_REPLACEMENT(SIGQUIT SIGTERM signal.h)
|
||||
CHECK_SYMBOL_REPLACEMENT(SIGPIPE SIGINT signal.h)
|
||||
CHECK_SYMBOL_REPLACEMENT(isnan _isnan float.h)
|
||||
CHECK_SYMBOL_REPLACEMENT(finite _finite float.h)
|
||||
CHECK_FUNCTION_REPLACEMENT(popen _popen)
|
||||
CHECK_FUNCTION_REPLACEMENT(pclose _pclose)
|
||||
CHECK_FUNCTION_REPLACEMENT(access _access)
|
||||
CHECK_FUNCTION_REPLACEMENT(strcasecmp _stricmp)
|
||||
CHECK_FUNCTION_REPLACEMENT(strncasecmp _strnicmp)
|
||||
CHECK_FUNCTION_REPLACEMENT(snprintf _snprintf)
|
||||
CHECK_FUNCTION_REPLACEMENT(strtok_r strtok_s)
|
||||
CHECK_FUNCTION_REPLACEMENT(strtoll _strtoi64)
|
||||
CHECK_FUNCTION_REPLACEMENT(strtoull _strtoui64)
|
||||
CHECK_FUNCTION_REPLACEMENT(vsnprintf _vsnprintf)
|
||||
CHECK_TYPE_SIZE(ssize_t SIZE_OF_SSIZE_T)
|
||||
IF(NOT HAVE_SIZE_OF_SSIZE_T)
|
||||
SET(ssize_t SSIZE_T)
|
||||
ENDIF()
|
||||
|
||||
SET(FN_NO_CASE_SENSE 1)
|
344
cmake/os/WindowsCache.cmake
Normal file
344
cmake/os/WindowsCache.cmake
Normal file
|
@ -0,0 +1,344 @@
|
|||
# Copyright (C) 2010 Sun Microsystems, Inc
|
||||
#
|
||||
# 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
|
||||
|
||||
# Avoid system checks on Windows by pre-caching results. Most of the system checks
|
||||
# are not relevant for Windows anyway and it takes lot more time to run them,
|
||||
# since CMake to creates a Visual Studio project for each tiny test.
|
||||
# Note that only we cache values on VC++ only, MinGW would give slightly
|
||||
# different results.
|
||||
|
||||
IF(MSVC)
|
||||
SET(HAVE_ACCESS 1 CACHE INTERNAL "")
|
||||
SET(HAVE_AIO_H CACHE INTERNAL "")
|
||||
SET(HAVE_AIO_READ CACHE INTERNAL "")
|
||||
SET(HAVE_ALARM CACHE INTERNAL "")
|
||||
SET(HAVE_ALLOCA_H CACHE INTERNAL "")
|
||||
SET(HAVE_ARPA_INET_H CACHE INTERNAL "")
|
||||
SET(HAVE_ASM_MSR_H CACHE INTERNAL "")
|
||||
SET(HAVE_BACKTRACE CACHE INTERNAL "")
|
||||
SET(HAVE_BACKTRACE_SYMBOLS CACHE INTERNAL "")
|
||||
SET(HAVE_BACKTRACE_SYMBOLS_FD CACHE INTERNAL "")
|
||||
SET(HAVE_BCMP CACHE INTERNAL "")
|
||||
SET(HAVE_BFILL CACHE INTERNAL "")
|
||||
SET(HAVE_BMOVE CACHE INTERNAL "")
|
||||
SET(HAVE_BSD_SIGNALS CACHE INTERNAL "")
|
||||
SET(HAVE_BSEARCH 1 CACHE INTERNAL "")
|
||||
SET(HAVE_BSS_START CACHE INTERNAL "")
|
||||
SET(HAVE_BZERO CACHE INTERNAL "")
|
||||
SET(HAVE_CHOWN CACHE INTERNAL "")
|
||||
SET(HAVE_CLOCK_GETTIME CACHE INTERNAL "")
|
||||
SET(HAVE_COMPRESS CACHE INTERNAL "")
|
||||
SET(HAVE_CRYPT CACHE INTERNAL "")
|
||||
SET(HAVE_CRYPT_H CACHE INTERNAL "")
|
||||
SET(HAVE_CUSERID CACHE INTERNAL "")
|
||||
SET(HAVE_CXX_NEW 1 CACHE INTERNAL "")
|
||||
SET(HAVE_DECL_MADVISE CACHE INTERNAL "")
|
||||
SET(HAVE_DIRECTIO CACHE INTERNAL "")
|
||||
SET(HAVE_DIRENT_H CACHE INTERNAL "")
|
||||
SET(HAVE_DLERROR CACHE INTERNAL "")
|
||||
SET(HAVE_DLFCN_H CACHE INTERNAL "")
|
||||
SET(HAVE_DLOPEN CACHE INTERNAL "")
|
||||
SET(HAVE_DOPRNT CACHE INTERNAL "")
|
||||
SET(HAVE_EXECINFO_H CACHE INTERNAL "")
|
||||
SET(HAVE_FCHMOD CACHE INTERNAL "")
|
||||
SET(HAVE_FCNTL CACHE INTERNAL "")
|
||||
SET(HAVE_FCNTL_H 1 CACHE INTERNAL "")
|
||||
SET(HAVE_FCNTL_NONBLOCK CACHE INTERNAL "")
|
||||
SET(HAVE_FCONVERT CACHE INTERNAL "")
|
||||
SET(HAVE_FDATASYNC CACHE INTERNAL "")
|
||||
SET(HAVE_FENV_H CACHE INTERNAL "")
|
||||
SET(HAVE_FESETROUND CACHE INTERNAL "")
|
||||
SET(HAVE_FGETLN CACHE INTERNAL "")
|
||||
SET(HAVE_FINITE CACHE INTERNAL "")
|
||||
SET(HAVE_FINITE_IN_MATH_H CACHE INTERNAL "")
|
||||
SET(HAVE_FLOATINGPOINT_H CACHE INTERNAL "")
|
||||
SET(HAVE_FLOAT_H 1 CACHE INTERNAL "")
|
||||
SET(HAVE_FLOCKFILE CACHE INTERNAL "")
|
||||
SET(HAVE_FNMATCH_H CACHE INTERNAL "")
|
||||
SET(HAVE_FPSETMASK CACHE INTERNAL "")
|
||||
SET(HAVE_FPU_CONTROL_H CACHE INTERNAL "")
|
||||
SET(HAVE_FSEEKO CACHE INTERNAL "")
|
||||
SET(HAVE_FSYNC CACHE INTERNAL "")
|
||||
SET(HAVE_FTIME 1 CACHE INTERNAL "")
|
||||
SET(HAVE_FTRUNCATE CACHE INTERNAL "")
|
||||
SET(HAVE_GETADDRINFO 1 CACHE INTERNAL "")
|
||||
SET(HAVE_GETCWD 1 CACHE INTERNAL "")
|
||||
SET(HAVE_GETHOSTBYADDR_R CACHE INTERNAL "")
|
||||
SET(HAVE_GETHOSTBYNAME_R CACHE INTERNAL "")
|
||||
SET(HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE CACHE INTERNAL "")
|
||||
SET(HAVE_GETHOSTBYNAME_R_RETURN_INT CACHE INTERNAL "")
|
||||
SET(HAVE_GETHRTIME CACHE INTERNAL "")
|
||||
SET(HAVE_GETLINE CACHE INTERNAL "")
|
||||
SET(HAVE_GETNAMEINFO CACHE INTERNAL "")
|
||||
SET(HAVE_GETPAGESIZE CACHE INTERNAL "")
|
||||
SET(HAVE_GETPASS CACHE INTERNAL "")
|
||||
SET(HAVE_GETPASSPHRASE CACHE INTERNAL "")
|
||||
SET(HAVE_GETPWNAM CACHE INTERNAL "")
|
||||
SET(HAVE_GETPWUID CACHE INTERNAL "")
|
||||
SET(HAVE_GETRLIMIT CACHE INTERNAL "")
|
||||
SET(HAVE_GETRUSAGE CACHE INTERNAL "")
|
||||
SET(HAVE_GETTIMEOFDAY CACHE INTERNAL "")
|
||||
SET(HAVE_GETWD CACHE INTERNAL "")
|
||||
SET(HAVE_GMTIME_R CACHE INTERNAL "")
|
||||
SET(HAVE_GRP_H CACHE INTERNAL "")
|
||||
SET(HAVE_IA64INTRIN_H CACHE INTERNAL "")
|
||||
SET(HAVE_IEEEFP_H CACHE INTERNAL "")
|
||||
SET(HAVE_INDEX CACHE INTERNAL "")
|
||||
SET(HAVE_INITGROUPS CACHE INTERNAL "")
|
||||
SET(HAVE_INTTYPES_H CACHE INTERNAL "")
|
||||
SET(HAVE_IPPROTO_IPV6 CACHE INTERNAL "")
|
||||
SET(HAVE_IPV6 TRUE CACHE INTERNAL "")
|
||||
SET(HAVE_IPV6_V6ONLY 1 CACHE INTERNAL "")
|
||||
SET(HAVE_ISINF CACHE INTERNAL "")
|
||||
SET(HAVE_ISNAN CACHE INTERNAL "")
|
||||
SET(HAVE_ISSETUGID CACHE INTERNAL "")
|
||||
SET(HAVE_LANGINFO_H CACHE INTERNAL "")
|
||||
SET(HAVE_LDIV 1 CACHE INTERNAL "")
|
||||
SET(HAVE_LIMITS_H 1 CACHE INTERNAL "")
|
||||
SET(HAVE_LOCALE_H 1 CACHE INTERNAL "")
|
||||
SET(HAVE_LOCALTIME_R CACHE INTERNAL "")
|
||||
SET(HAVE_LOG2 CACHE INTERNAL "")
|
||||
SET(HAVE_LONGJMP 1 CACHE INTERNAL "")
|
||||
SET(HAVE_LRAND48 CACHE INTERNAL "")
|
||||
SET(HAVE_LSTAT CACHE INTERNAL "")
|
||||
SET(HAVE_MADVISE CACHE INTERNAL "")
|
||||
SET(HAVE_MALLINFO CACHE INTERNAL "")
|
||||
SET(HAVE_MALLOC_H 1 CACHE INTERNAL "")
|
||||
SET(HAVE_MEMALIGN CACHE INTERNAL "")
|
||||
SET(HAVE_MEMCPY 1 CACHE INTERNAL "")
|
||||
SET(HAVE_MEMMOVE 1 CACHE INTERNAL "")
|
||||
SET(HAVE_MEMORY_H 1 CACHE INTERNAL "")
|
||||
SET(HAVE_MKSTEMP CACHE INTERNAL "")
|
||||
SET(HAVE_MLOCK CACHE INTERNAL "")
|
||||
SET(HAVE_MLOCKALL CACHE INTERNAL "")
|
||||
SET(HAVE_MMAP CACHE INTERNAL "")
|
||||
SET(HAVE_MMAP64 CACHE INTERNAL "")
|
||||
SET(HAVE_NETINET_IN6_H CACHE INTERNAL "")
|
||||
SET(HAVE_NETINET_IN_H CACHE INTERNAL "")
|
||||
SET(HAVE_NL_LANGINFO CACHE INTERNAL "")
|
||||
SET(HAVE_PASE_ENVIRONMENT CACHE INTERNAL "")
|
||||
SET(HAVE_PATHS_H CACHE INTERNAL "")
|
||||
SET(HAVE_PCLOSE CACHE INTERNAL "")
|
||||
SET(HAVE_PERROR 1 CACHE INTERNAL "")
|
||||
SET(HAVE_POLL_H CACHE INTERNAL "")
|
||||
SET(HAVE_POPEN CACHE INTERNAL "")
|
||||
SET(HAVE_POLL CACHE INTERNAL "")
|
||||
SET(HAVE_PORT_CREATE CACHE INTERNAL "")
|
||||
SET(HAVE_PORT_H CACHE INTERNAL "")
|
||||
SET(HAVE_POSIX_FALLOCATE CACHE INTERNAL "")
|
||||
SET(HAVE_POSIX_SIGNALS CACHE INTERNAL "")
|
||||
SET(HAVE_PREAD CACHE INTERNAL "")
|
||||
SET(HAVE_PRINTSTACK CACHE INTERNAL "")
|
||||
SET(HAVE_PTHREAD_ATTR_CREATE CACHE INTERNAL "")
|
||||
SET(HAVE_PTHREAD_ATTR_GETSTACKSIZE CACHE INTERNAL "")
|
||||
SET(HAVE_PTHREAD_ATTR_SETSCOPE CACHE INTERNAL "")
|
||||
SET(HAVE_PTHREAD_ATTR_SETSTACKSIZE CACHE INTERNAL "")
|
||||
SET(HAVE_PTHREAD_CONDATTR_CREATE CACHE INTERNAL "")
|
||||
SET(HAVE_PTHREAD_CONDATTR_SETCLOCK CACHE INTERNAL "")
|
||||
SET(HAVE_PTHREAD_INIT CACHE INTERNAL "")
|
||||
SET(HAVE_PTHREAD_KEY_DELETE CACHE INTERNAL "")
|
||||
SET(HAVE_PTHREAD_RWLOCK_RDLOCK CACHE INTERNAL "")
|
||||
SET(HAVE_PTHREAD_SIGMASK CACHE INTERNAL "")
|
||||
SET(HAVE_PTHREAD_THREADMASK CACHE INTERNAL "")
|
||||
SET(HAVE_PTHREAD_YIELD_NP CACHE INTERNAL "")
|
||||
SET(HAVE_PTHREAD_YIELD_ZERO_ARG CACHE INTERNAL "")
|
||||
SET(HAVE_PUTENV 1 CACHE INTERNAL "")
|
||||
SET(HAVE_PWD_H CACHE INTERNAL "")
|
||||
SET(HAVE_RDTSCLL CACHE INTERNAL "")
|
||||
SET(HAVE_READDIR_R CACHE INTERNAL "")
|
||||
SET(HAVE_READLINK CACHE INTERNAL "")
|
||||
SET(HAVE_READ_REAL_TIME CACHE INTERNAL "")
|
||||
SET(HAVE_REALPATH CACHE INTERNAL "")
|
||||
SET(HAVE_REGCOMP CACHE INTERNAL "")
|
||||
SET(HAVE_RENAME 1 CACHE INTERNAL "")
|
||||
SET(HAVE_RE_COMP CACHE INTERNAL "")
|
||||
SET(HAVE_RINT CACHE INTERNAL "")
|
||||
SET(HAVE_RWLOCK_INIT CACHE INTERNAL "")
|
||||
SET(HAVE_SCHED_H CACHE INTERNAL "")
|
||||
SET(HAVE_SCHED_YIELD CACHE INTERNAL "")
|
||||
SET(HAVE_SELECT 1 CACHE INTERNAL "")
|
||||
SET(HAVE_SELECT_H CACHE INTERNAL "")
|
||||
SET(HAVE_SEMAPHORE_H CACHE INTERNAL "")
|
||||
SET(HAVE_SETENV CACHE INTERNAL "")
|
||||
SET(HAVE_SETFD CACHE INTERNAL "")
|
||||
SET(HAVE_SETLOCALE 1 CACHE INTERNAL "")
|
||||
SET(HAVE_SHMAT CACHE INTERNAL "")
|
||||
SET(HAVE_SHMCTL CACHE INTERNAL "")
|
||||
SET(HAVE_SHMDT CACHE INTERNAL "")
|
||||
SET(HAVE_SHMGET CACHE INTERNAL "")
|
||||
SET(HAVE_SIGACTION CACHE INTERNAL "")
|
||||
SET(HAVE_SIGADDSET CACHE INTERNAL "")
|
||||
SET(HAVE_SIGEMPTYSET CACHE INTERNAL "")
|
||||
SET(HAVE_SIGHOLD CACHE INTERNAL "")
|
||||
SET(HAVE_SIGINT 1 CACHE INTERNAL "")
|
||||
SET(HAVE_SIGPIPE CACHE INTERNAL "")
|
||||
SET(HAVE_SIGQUIT CACHE INTERNAL "")
|
||||
SET(HAVE_SIGSET CACHE INTERNAL "")
|
||||
SET(HAVE_SIGTERM 1 CACHE INTERNAL "")
|
||||
SET(HAVE_SIGTHREADMASK CACHE INTERNAL "")
|
||||
SET(HAVE_SIGWAIT CACHE INTERNAL "")
|
||||
SET(HAVE_SIZEOF_BOOL FALSE CACHE INTERNAL "")
|
||||
SET(HAVE_SIZEOF_CHAR TRUE CACHE INTERNAL "")
|
||||
SET(SIZEOF_CHAR 1 CACHE INTERNAL "")
|
||||
SET(HAVE_SIZEOF_CHARP TRUE CACHE INTERNAL "")
|
||||
SET(SIZEOF_CHARP ${CMAKE_SIZEOF_VOID_P} CACHE INTERNAL "")
|
||||
SET(HAVE_SIZEOF_IN6_ADDR TRUE CACHE INTERNAL "")
|
||||
SET(HAVE_SIZEOF_INT TRUE CACHE INTERNAL "")
|
||||
SET(SIZEOF_INT 4 CACHE INTERNAL "")
|
||||
SET(HAVE_SIZEOF_INT16 FALSE CACHE INTERNAL "")
|
||||
SET(HAVE_SIZEOF_INT32 FALSE CACHE INTERNAL "")
|
||||
SET(HAVE_SIZEOF_INT64 FALSE CACHE INTERNAL "")
|
||||
SET(HAVE_SIZEOF_INT8 FALSE CACHE INTERNAL "")
|
||||
SET(HAVE_SIZEOF_LONG TRUE CACHE INTERNAL "")
|
||||
SET(SIZEOF_LONG 4 CACHE INTERNAL "")
|
||||
SET(HAVE_SIZEOF_LONG_LONG TRUE CACHE INTERNAL "")
|
||||
SET(SIZEOF_LONG_LONG 8 CACHE INTERNAL "")
|
||||
SET(HAVE_SIZEOF_MODE_T FALSE CACHE INTERNAL "")
|
||||
SET(HAVE_SIZEOF_OFF_T TRUE CACHE INTERNAL "")
|
||||
SET(SIZEOF_OFF_T 4 CACHE INTERNAL "")
|
||||
SET(HAVE_SIZEOF_SHORT TRUE CACHE INTERNAL "")
|
||||
SET(SIZEOF_SHORT 2 CACHE INTERNAL "")
|
||||
SET(HAVE_SIZEOF_SIGSET_T FALSE CACHE INTERNAL "")
|
||||
SET(HAVE_SIZEOF_SIZE_T TRUE CACHE INTERNAL "")
|
||||
SET(SIZEOF_SIZE_T ${CMAKE_SIZEOF_VOID_P} CACHE INTERNAL "")
|
||||
SET(HAVE_SIZEOF_SOCKADDR_IN6 TRUE CACHE INTERNAL "")
|
||||
SET(HAVE_SIZEOF_SOCKLEN_T FALSE CACHE INTERNAL "")
|
||||
SET(HAVE_SIZEOF_UCHAR FALSE CACHE INTERNAL "")
|
||||
SET(HAVE_SIZEOF_UINT FALSE CACHE INTERNAL "")
|
||||
SET(HAVE_SIZEOF_UINT16 FALSE CACHE INTERNAL "")
|
||||
SET(HAVE_SIZEOF_UINT32 FALSE CACHE INTERNAL "")
|
||||
SET(HAVE_SIZEOF_UINT64 FALSE CACHE INTERNAL "")
|
||||
SET(HAVE_SIZEOF_UINT8 FALSE CACHE INTERNAL "")
|
||||
SET(HAVE_SIZEOF_ULONG FALSE CACHE INTERNAL "")
|
||||
SET(HAVE_SIZEOF_U_INT32_T FALSE CACHE INTERNAL "")
|
||||
SET(HAVE_SIZE_OF_SSIZE_T FALSE CACHE INTERNAL "")
|
||||
SET(HAVE_SLEEP CACHE INTERNAL "")
|
||||
SET(HAVE_SNPRINTF CACHE INTERNAL "")
|
||||
SET(HAVE_SOCKADDR_STORAGE_SS_FAMILY 1 CACHE INTERNAL "")
|
||||
SET(HAVE_SOLARIS_STYLE_GETHOST CACHE INTERNAL "")
|
||||
SET(STACK_DIRECTION -1 CACHE INTERNAL "")
|
||||
SET(HAVE_STDARG_H 1 CACHE INTERNAL "")
|
||||
SET(HAVE_STDDEF_H 1 CACHE INTERNAL "")
|
||||
SET(HAVE_STDINT_H CACHE INTERNAL "")
|
||||
SET(HAVE_STDLIB_H 1 CACHE INTERNAL "")
|
||||
SET(HAVE_STPCPY CACHE INTERNAL "")
|
||||
SET(HAVE_STRCASECMP CACHE INTERNAL "")
|
||||
SET(HAVE_STRCOLL 1 CACHE INTERNAL "")
|
||||
SET(HAVE_STRDUP 1 CACHE INTERNAL "")
|
||||
SET(HAVE_STRERROR 1 CACHE INTERNAL "")
|
||||
SET(HAVE_STRINGS_H CACHE INTERNAL "")
|
||||
SET(HAVE_STRING_H 1 CACHE INTERNAL "")
|
||||
SET(HAVE_STRLCAT CACHE INTERNAL "")
|
||||
SET(HAVE_STRLCPY CACHE INTERNAL "")
|
||||
SET(HAVE_STRNCASECMP CACHE INTERNAL "")
|
||||
IF(MSVC_VERSION GREATER 1310)
|
||||
SET(HAVE_STRNLEN 1 CACHE INTERNAL "")
|
||||
ENDIF()
|
||||
SET(HAVE_STRPBRK 1 CACHE INTERNAL "")
|
||||
SET(HAVE_STRSEP CACHE INTERNAL "")
|
||||
SET(HAVE_STRSIGNAL CACHE INTERNAL "")
|
||||
SET(HAVE_STRSTR 1 CACHE INTERNAL "")
|
||||
SET(HAVE_STRTOK_R CACHE INTERNAL "")
|
||||
SET(HAVE_STRTOL 1 CACHE INTERNAL "")
|
||||
SET(HAVE_STRTOLL CACHE INTERNAL "")
|
||||
SET(HAVE_STRTOUL 1 CACHE INTERNAL "")
|
||||
SET(HAVE_STRTOULL CACHE INTERNAL "")
|
||||
SET(HAVE_SVR3_SIGNALS CACHE INTERNAL "")
|
||||
SET(HAVE_SYNCH_H CACHE INTERNAL "")
|
||||
SET(HAVE_SYSENT_H CACHE INTERNAL "")
|
||||
SET(HAVE_SYS_CDEFS_H CACHE INTERNAL "")
|
||||
SET(HAVE_SYS_DIR_H CACHE INTERNAL "")
|
||||
SET(HAVE_SYS_ERRLIST CACHE INTERNAL "")
|
||||
SET(HAVE_SYS_FILE_H CACHE INTERNAL "")
|
||||
SET(HAVE_SYS_FPU_H CACHE INTERNAL "")
|
||||
SET(HAVE_SYS_IOCTL CACHE INTERNAL "")
|
||||
SET(HAVE_SYS_IOCTL_H CACHE INTERNAL "")
|
||||
SET(HAVE_SYS_IPC_H CACHE INTERNAL "")
|
||||
SET(HAVE_SYS_MALLOC_H CACHE INTERNAL "")
|
||||
SET(HAVE_SYS_MMAN_H CACHE INTERNAL "")
|
||||
SET(HAVE_SYS_PARAM_H CACHE INTERNAL "")
|
||||
SET(HAVE_SYS_PRCTL_H CACHE INTERNAL "")
|
||||
SET(HAVE_SYS_PTEM_H CACHE INTERNAL "")
|
||||
SET(HAVE_SYS_PTE_H CACHE INTERNAL "")
|
||||
SET(HAVE_SYS_RESOURCE_H CACHE INTERNAL "")
|
||||
SET(HAVE_SYS_SELECT_H CACHE INTERNAL "")
|
||||
SET(HAVE_SYS_SHM_H CACHE INTERNAL "")
|
||||
SET(HAVE_SYS_SOCKET_H CACHE INTERNAL "")
|
||||
SET(HAVE_SYS_STAT_H 1 CACHE INTERNAL "")
|
||||
SET(HAVE_SYS_STREAM_H CACHE INTERNAL "")
|
||||
SET(HAVE_SYS_TERMCAP_H CACHE INTERNAL "")
|
||||
SET(HAVE_SYS_TIMEB_H 1 CACHE INTERNAL "")
|
||||
SET(HAVE_SYS_TIMES_H CACHE INTERNAL "")
|
||||
SET(HAVE_SYS_TIME_H CACHE INTERNAL "")
|
||||
SET(HAVE_SYS_TYPES_H 1 CACHE INTERNAL "")
|
||||
SET(HAVE_SYS_UN_H CACHE INTERNAL "")
|
||||
SET(HAVE_SYS_UTIME_H 1 CACHE INTERNAL "")
|
||||
SET(HAVE_SYS_VADVISE_H CACHE INTERNAL "")
|
||||
SET(HAVE_SYS_WAIT_H CACHE INTERNAL "")
|
||||
SET(HAVE_TCGETATTR CACHE INTERNAL "")
|
||||
SET(HAVE_TELL 1 CACHE INTERNAL "")
|
||||
SET(HAVE_TEMPNAM 1 CACHE INTERNAL "")
|
||||
SET(HAVE_TERMCAP_H CACHE INTERNAL "")
|
||||
SET(HAVE_TERMIOS_H CACHE INTERNAL "")
|
||||
SET(HAVE_TERMIO_H CACHE INTERNAL "")
|
||||
SET(HAVE_TERM_H CACHE INTERNAL "")
|
||||
SET(HAVE_THR_SETCONCURRENCY CACHE INTERNAL "")
|
||||
SET(HAVE_THR_YIELD CACHE INTERNAL "")
|
||||
SET(HAVE_TIME 1 CACHE INTERNAL "")
|
||||
SET(HAVE_TIMES CACHE INTERNAL "")
|
||||
SET(HAVE_TIMESPEC_TS_SEC CACHE INTERNAL "")
|
||||
SET(HAVE_TIME_H 1 CACHE INTERNAL "")
|
||||
SET(HAVE_TZNAME 1 CACHE INTERNAL "")
|
||||
SET(HAVE_UNISTD_H CACHE INTERNAL "")
|
||||
SET(HAVE_UTIME_H CACHE INTERNAL "")
|
||||
SET(HAVE_VALLOC CACHE INTERNAL "")
|
||||
SET(HAVE_VARARGS_H 1 CACHE INTERNAL "")
|
||||
SET(HAVE_VASPRINTF CACHE INTERNAL "")
|
||||
SET(HAVE_VPRINTF 1 CACHE INTERNAL "")
|
||||
IF(MSVC_VERSION GREATER 1310)
|
||||
SET(HAVE_VSNPRINTF 1 CACHE INTERNAL "")
|
||||
ENDIF()
|
||||
SET(HAVE_WEAK_SYMBOL CACHE INTERNAL "")
|
||||
SET(HAVE_WORDS_BIGENDIAN TRUE CACHE INTERNAL "")
|
||||
SET(WORDS_BIGENDIAN CACHE INTERNAL "")
|
||||
SET(HAVE__S_IFIFO 1 CACHE INTERNAL "")
|
||||
SET(HAVE__S_IREAD 1 CACHE INTERNAL "")
|
||||
SET(HAVE__finite 1 CACHE INTERNAL "")
|
||||
SET(HAVE__isnan 1 CACHE INTERNAL "")
|
||||
SET(HAVE__pclose 1 CACHE INTERNAL "")
|
||||
SET(HAVE__popen 1 CACHE INTERNAL "")
|
||||
SET(HAVE__snprintf 1 CACHE INTERNAL "")
|
||||
SET(HAVE__stricmp 1 CACHE INTERNAL "")
|
||||
SET(HAVE__strnicmp 1 CACHE INTERNAL "")
|
||||
SET(HAVE__strtoi64 1 CACHE INTERNAL "")
|
||||
SET(HAVE__strtoui64 1 CACHE INTERNAL "")
|
||||
IF(MSVC_VERSION GREATER 1310)
|
||||
SET(HAVE_strtok_s 1 CACHE INTERNAL "")
|
||||
ENDIF()
|
||||
SET(STDC_HEADERS CACHE 1 INTERNAL "")
|
||||
SET(STRUCT_DIRENT_HAS_D_INO CACHE INTERNAL "")
|
||||
SET(STRUCT_DIRENT_HAS_D_INO CACHE INTERNAL "")
|
||||
SET(STRUCT_DIRENT_HAS_D_NAMLEN CACHE INTERNAL "")
|
||||
SET(TIME_WITH_SYS_TIME CACHE INTERNAL "")
|
||||
SET(TIOCSTAT_IN_SYS_IOCTL CACHE INTERNAL "")
|
||||
SET(HAVE_S_IROTH CACHE INTERNAL "")
|
||||
SET(HAVE_S_IFIFO CACHE INTERNAL "")
|
||||
SET(QSORT_TYPE_IS_VOID 1 CACHE INTERNAL "")
|
||||
SET(SIGNAL_RETURN_TYPE_IS_VOID 1 CACHE INTERNAL "")
|
||||
SET(C_HAS_inline CACHE INTERNAL "")
|
||||
SET(C_HAS___inline 1 CACHE INTERNAL "")
|
||||
SET(FIONREAD_IN_SYS_IOCTL CACHE INTERNAL "")
|
||||
SET(GWINSZ_IN_SYS_IOCTL CACHE INTERNAL "")
|
||||
ENDIF()
|
125
cmake/package_name.cmake
Normal file
125
cmake/package_name.cmake
Normal file
|
@ -0,0 +1,125 @@
|
|||
# Copyright (C) 2010 Sun Microsystems, Inc
|
||||
#
|
||||
# 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
|
||||
|
||||
# Produce meaningful package name for the binary package
|
||||
# The logic is rather involved with special cases for different OSes
|
||||
MACRO(GET_PACKAGE_FILE_NAME Var)
|
||||
IF(NOT VERSION)
|
||||
MESSAGE(FATAL_ERROR
|
||||
"Variable VERSION needs to be set prior to calling GET_PACKAGE_FILE_NAME")
|
||||
ENDIF()
|
||||
IF(NOT SYSTEM_NAME_AND_PROCESSOR)
|
||||
SET(NEED_DASH_BETWEEN_PLATFORM_AND_MACHINE 1)
|
||||
SET(DEFAULT_PLATFORM ${CMAKE_SYSTEM_NAME})
|
||||
SET(DEFAULT_MACHINE ${CMAKE_SYSTEM_PROCESSOR})
|
||||
IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
SET(64BIT 1)
|
||||
ENDIF()
|
||||
|
||||
IF(CMAKE_SYSTEM_NAME MATCHES "Windows")
|
||||
SET(NEED_DASH_BETWEEN_PLATFORM_AND_MACHINE 0)
|
||||
SET(DEFAULT_PLATFORM "win")
|
||||
IF(64BIT)
|
||||
SET(DEFAULT_MACHINE "x64")
|
||||
ELSE()
|
||||
SET(DEFAULT_MACHINE "32")
|
||||
ENDIF()
|
||||
ELSEIF(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||
IF(NOT 64BIT AND CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
|
||||
SET(DEFAULT_MACHINE "i686")
|
||||
ENDIF()
|
||||
ELSEIF(CMAKE_SYSTEM_NAME MATCHES "SunOS")
|
||||
# SunOS 5.10=> solaris10
|
||||
STRING(REPLACE "5." "" VER "${CMAKE_SYSTEM_VERSION}")
|
||||
SET(DEFAULT_PLATFORM "solaris${VER}")
|
||||
IF(64BIT)
|
||||
IF(CMAKE_SYSTEM_PROCESSOR MATCHES "i386")
|
||||
SET(DEFAULT_MACHINE "x86_64")
|
||||
ELSE()
|
||||
SET(DEFAULT_MACHINE "${CMAKE_SYSTEM_PROCESSOR}-64bit")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ELSEIF(CMAKE_SYSTEM_NAME MATCHES "HP-UX")
|
||||
STRING(REPLACE "B." "" VER "${CMAKE_SYSTEM_VERSION}")
|
||||
SET(DEFAULT_PLATFORM "hpux${VER}")
|
||||
IF(64BIT)
|
||||
SET(DEFAULT_MACHINE "${CMAKE_SYSTEM_PROCESSOR}-64bit")
|
||||
ENDIF()
|
||||
ELSEIF(CMAKE_SYSTEM_NAME MATCHES "AIX")
|
||||
SET(DEFAULT_PLATFORM "${CMAKE_SYSTEM_NAME}5.${CMAKE_SYSTEM_VERSION}")
|
||||
IF(64BIT)
|
||||
SET(DEFAULT_MACHINE "${CMAKE_SYSTEM_PROCESSOR}-64bit")
|
||||
ENDIF()
|
||||
ELSEIF(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
|
||||
STRING(REGEX MATCH "[0-9]+\\.[0-9]+" VER "${CMAKE_SYSTEM_VERSION}")
|
||||
SET(DEFAULT_PLATFORM "${CMAKE_SYSTEM_NAME}${VER}")
|
||||
IF(CMAKE_SYSTEM_PROCESSOR MATCHES "amd64")
|
||||
SET(DEFAULT_MACHINE "x86_64")
|
||||
IF(NOT 64BIT)
|
||||
SET(DEFAULT_MACHINE "i386")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ELSEIF(CMAKE_SYSTEM_NAME MATCHES "Darwin")
|
||||
IF(CMAKE_OSX_DEPLOYMENT_TARGET)
|
||||
SET(DEFAULT_PLATFORM "osx${CMAKE_OSX_DEPLOYMENT_TARGET}")
|
||||
ELSE()
|
||||
SET(VER "${CMAKE_SYSTEM_VERSION}")
|
||||
STRING(REGEX REPLACE "([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" VER "${VER}")
|
||||
# Subtract 4 from Darwin version to get correct osx10.X
|
||||
MATH(EXPR VER "${VER} -4")
|
||||
SET(DEFAULT_PLATFORM "osx10.${VER}")
|
||||
ENDIF()
|
||||
LIST(LENGTH CMAKE_OSX_ARCHITECTURES LEN)
|
||||
IF(LEN GREATER 1)
|
||||
SET(DEFAULT_MACHINE "universal")
|
||||
ELSE()
|
||||
SET(DEFAULT_MACHINE "${CMAKE_OSX_ARCHITECTURES}")
|
||||
ENDIF()
|
||||
IF(DEFAULT_MACHINE MATCHES "i386")
|
||||
SET(DEFAULT_MACHINE "x86")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF(NOT PLATFORM)
|
||||
SET(PLATFORM ${DEFAULT_PLATFORM})
|
||||
ENDIF()
|
||||
IF(NOT MACHINE)
|
||||
SET(MACHINE ${DEFAULT_MACHINE})
|
||||
ENDIF()
|
||||
|
||||
IF(NEED_DASH_BETWEEN_PLATFORM_AND_MACHINE)
|
||||
SET(SYSTEM_NAME_AND_PROCESSOR "${PLATFORM}-${MACHINE}")
|
||||
ELSE()
|
||||
SET(SYSTEM_NAME_AND_PROCESSOR "${PLATFORM}${MACHINE}")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF(SHORT_PRODUCT_TAG)
|
||||
SET(PRODUCT_TAG "-${SHORT_PRODUCT_TAG}")
|
||||
ELSEIF(MYSQL_SERVER_SUFFIX)
|
||||
SET(PRODUCT_TAG "${MYSQL_SERVER_SUFFIX}") # Already has a leading dash
|
||||
ELSE()
|
||||
SET(PRODUCT_TAG)
|
||||
ENDIF()
|
||||
|
||||
SET(package_name "mysql${PRODUCT_TAG}-${VERSION}-${SYSTEM_NAME_AND_PROCESSOR}")
|
||||
|
||||
# Sometimes package suffix is added (something like "-icc-glibc23")
|
||||
IF(PACKAGE_SUFFIX)
|
||||
SET(package_name "${package_name}${PACKAGE_SUFFIX}")
|
||||
ENDIF()
|
||||
STRING(TOLOWER ${package_name} package_name)
|
||||
SET(${Var} ${package_name})
|
||||
ENDMACRO()
|
191
cmake/plugin.cmake
Normal file
191
cmake/plugin.cmake
Normal file
|
@ -0,0 +1,191 @@
|
|||
# Copyright (C) 2009 Sun Microsystems, Inc
|
||||
#
|
||||
# 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
|
||||
|
||||
|
||||
GET_FILENAME_COMPONENT(MYSQL_CMAKE_SCRIPT_DIR ${CMAKE_CURRENT_LIST_FILE} PATH)
|
||||
INCLUDE(${MYSQL_CMAKE_SCRIPT_DIR}/cmake_parse_arguments.cmake)
|
||||
|
||||
# MYSQL_ADD_PLUGIN(plugin_name source1...sourceN
|
||||
# [STORAGE_ENGINE]
|
||||
# [MANDATORY|DEFAULT]
|
||||
# [STATIC_ONLY|DYNAMIC_ONLY]
|
||||
# [MODULE_OUTPUT_NAME module_name]
|
||||
# [STATIC_OUTPUT_NAME static_name]
|
||||
# [RECOMPILE_FOR_EMBEDDED]
|
||||
# [LINK_LIBRARIES lib1...libN]
|
||||
# [DEPENDENCIES target1...targetN]
|
||||
|
||||
MACRO(MYSQL_ADD_PLUGIN)
|
||||
CMAKE_PARSE_ARGUMENTS(ARG
|
||||
"LINK_LIBRARIES;DEPENDENCIES;MODULE_OUTPUT_NAME;STATIC_OUTPUT_NAME"
|
||||
"STORAGE_ENGINE;STATIC_ONLY;MODULE_ONLY;MANDATORY;DEFAULT;DISABLED;RECOMPILE_FOR_EMBEDDED"
|
||||
${ARGN}
|
||||
)
|
||||
|
||||
# Add common include directories
|
||||
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include
|
||||
${CMAKE_SOURCE_DIR}/sql
|
||||
${CMAKE_SOURCE_DIR}/regex
|
||||
${SSL_INCLUDE_DIRS}
|
||||
${ZLIB_INCLUDE_DIR})
|
||||
|
||||
LIST(GET ARG_DEFAULT_ARGS 0 plugin)
|
||||
SET(SOURCES ${ARG_DEFAULT_ARGS})
|
||||
LIST(REMOVE_AT SOURCES 0)
|
||||
STRING(TOUPPER ${plugin} plugin)
|
||||
STRING(TOLOWER ${plugin} target)
|
||||
|
||||
# Figure out whether to build plugin
|
||||
IF(WITH_PLUGIN_${plugin})
|
||||
SET(WITH_${plugin} 1)
|
||||
ENDIF()
|
||||
|
||||
IF(WITH_MAX_NO_NDB)
|
||||
SET(WITH_MAX 1)
|
||||
SET(WITHOUT_NDBCLUSTER 1)
|
||||
ENDIF()
|
||||
|
||||
IF(WITH_${plugin}_STORAGE_ENGINE
|
||||
OR WITH_{$plugin}
|
||||
OR WITH_ALL
|
||||
OR WITH_MAX
|
||||
OR ARG_DEFAULT
|
||||
AND NOT WITHOUT_${plugin}_STORAGE_ENGINE
|
||||
AND NOT WITHOUT_${plugin}
|
||||
AND NOT ARG_MODULE_ONLY)
|
||||
|
||||
SET(WITH_${plugin} 1)
|
||||
ELSEIF(WITHOUT_${plugin}_STORAGE_ENGINE OR WITH_NONE OR ${plugin}_DISABLED)
|
||||
SET(WITHOUT_${plugin} 1)
|
||||
SET(WITH_${plugin}_STORAGE_ENGINE 0)
|
||||
SET(WITH_${plugin} 0)
|
||||
ENDIF()
|
||||
|
||||
|
||||
IF(ARG_MANDATORY)
|
||||
SET(WITH_${plugin} 1)
|
||||
ENDIF()
|
||||
|
||||
|
||||
IF(ARG_STORAGE_ENGINE)
|
||||
SET(with_var "WITH_${plugin}_STORAGE_ENGINE" )
|
||||
ELSE()
|
||||
SET(with_var "WITH_${plugin}")
|
||||
ENDIF()
|
||||
|
||||
IF(NOT ARG_DEPENDENCIES)
|
||||
SET(ARG_DEPENDENCIES)
|
||||
ENDIF()
|
||||
# Build either static library or module
|
||||
IF (WITH_${plugin} AND NOT ARG_MODULE_ONLY)
|
||||
ADD_LIBRARY(${target} STATIC ${SOURCES})
|
||||
SET_TARGET_PROPERTIES(${target} PROPERTIES COMPILE_DEFINITONS "MYSQL_SERVER")
|
||||
DTRACE_INSTRUMENT(${target})
|
||||
ADD_DEPENDENCIES(${target} GenError ${ARG_DEPENDENCIES})
|
||||
IF(WITH_EMBEDDED_SERVER)
|
||||
# Embedded library should contain PIC code and be linkable
|
||||
# to shared libraries (on systems that need PIC)
|
||||
IF(ARG_RECOMPILE_FOR_EMBEDDED OR NOT _SKIP_PIC)
|
||||
# Recompile some plugins for embedded
|
||||
ADD_CONVENIENCE_LIBRARY(${target}_embedded ${SOURCES})
|
||||
DTRACE_INSTRUMENT(${target}_embedded)
|
||||
IF(ARG_RECOMPILE_FOR_EMBEDDED)
|
||||
SET_TARGET_PROPERTIES(${target}_embedded
|
||||
PROPERTIES COMPILE_DEFINITIONS "MYSQL_SERVER;EMBEDDED_LIBRARY")
|
||||
ENDIF()
|
||||
ADD_DEPENDENCIES(${target}_embedded GenError)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF(ARG_STATIC_OUTPUT_NAME)
|
||||
SET_TARGET_PROPERTIES(${target} PROPERTIES
|
||||
OUTPUT_NAME ${ARG_STATIC_OUTPUT_NAME})
|
||||
ENDIF()
|
||||
|
||||
# Update mysqld dependencies
|
||||
SET (MYSQLD_STATIC_PLUGIN_LIBS ${MYSQLD_STATIC_PLUGIN_LIBS}
|
||||
${target} CACHE INTERNAL "" FORCE)
|
||||
|
||||
IF(ARG_MANDATORY)
|
||||
SET(${with_var} ON CACHE INTERNAL "Link ${plugin} statically to the server"
|
||||
FORCE)
|
||||
ELSE()
|
||||
SET(${with_var} ON CACHE BOOL "Link ${plugin} statically to the server"
|
||||
FORCE)
|
||||
ENDIF()
|
||||
|
||||
IF(ARG_MANDATORY)
|
||||
SET (mysql_mandatory_plugins
|
||||
"${mysql_mandatory_plugins} builtin_${target}_plugin,"
|
||||
PARENT_SCOPE)
|
||||
ELSE()
|
||||
SET (mysql_optional_plugins
|
||||
"${mysql_optional_plugins} builtin_${target}_plugin,"
|
||||
PARENT_SCOPE)
|
||||
ENDIF()
|
||||
ELSEIF(NOT WITHOUT_${plugin} AND NOT ARG_STATIC_ONLY AND NOT WITHOUT_DYNAMIC_PLUGINS)
|
||||
IF(NOT ARG_MODULE_OUTPUT_NAME)
|
||||
IF(ARG_STORAGE_ENGINE)
|
||||
SET(ARG_MODULE_OUTPUT_NAME "ha_${target}")
|
||||
ELSE()
|
||||
SET(ARG_MODULE_OUTPUT_NAME "${target}")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
ADD_LIBRARY(${target} MODULE ${SOURCES})
|
||||
DTRACE_INSTRUMENT(${target})
|
||||
SET_TARGET_PROPERTIES (${target} PROPERTIES PREFIX ""
|
||||
COMPILE_DEFINITIONS "MYSQL_DYNAMIC_PLUGIN")
|
||||
IF(ARG_LINK_LIBRARIES)
|
||||
TARGET_LINK_LIBRARIES (${target} ${ARG_LINK_LIBRARIES})
|
||||
ENDIF()
|
||||
TARGET_LINK_LIBRARIES (${target} mysqlservices)
|
||||
|
||||
# Plugin uses symbols defined in mysqld executable.
|
||||
# Some operating systems like Windows and OSX and are pretty strict about
|
||||
# unresolved symbols. Others are less strict and allow unresolved symbols
|
||||
# in shared libraries. On Linux for example, CMake does not even add
|
||||
# executable to the linker command line (it would result into link error).
|
||||
# Thus we skip TARGET_LINK_LIBRARIES on Linux, as it would only generate
|
||||
# an additional dependency.
|
||||
IF(NOT CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
TARGET_LINK_LIBRARIES (${target} mysqld ${ARG_LINK_LIBRARIES})
|
||||
ENDIF()
|
||||
ADD_DEPENDENCIES(${target} GenError ${ARG_DEPENDENCIES})
|
||||
|
||||
IF(NOT ARG_MODULE_ONLY)
|
||||
# set cached variable, e.g with checkbox in GUI
|
||||
SET(${with_var} OFF CACHE BOOL "Link ${plugin} statically to the server"
|
||||
FORCE)
|
||||
ENDIF()
|
||||
SET_TARGET_PROPERTIES(${target} PROPERTIES
|
||||
OUTPUT_NAME "${ARG_MODULE_OUTPUT_NAME}")
|
||||
# Install dynamic library
|
||||
MYSQL_INSTALL_TARGETS(${target} DESTINATION ${INSTALL_PLUGINDIR})
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
|
||||
|
||||
# Add all CMake projects under storage and plugin
|
||||
# subdirectories, configure sql_builtins.cc
|
||||
MACRO(CONFIGURE_PLUGINS)
|
||||
FILE(GLOB dirs_storage ${CMAKE_SOURCE_DIR}/storage/*)
|
||||
FILE(GLOB dirs_plugin ${CMAKE_SOURCE_DIR}/plugin/*)
|
||||
FOREACH(dir ${dirs_storage} ${dirs_plugin})
|
||||
IF (EXISTS ${dir}/CMakeLists.txt)
|
||||
ADD_SUBDIRECTORY(${dir})
|
||||
ENDIF()
|
||||
ENDFOREACH()
|
||||
ENDMACRO()
|
229
cmake/readline.cmake
Normal file
229
cmake/readline.cmake
Normal file
|
@ -0,0 +1,229 @@
|
|||
# Copyright (C) 2009 Sun Microsystems, Inc
|
||||
#
|
||||
# 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
|
||||
|
||||
MACRO (MYSQL_CHECK_MULTIBYTE)
|
||||
CHECK_INCLUDE_FILE(wctype.h HAVE_WCTYPE_H)
|
||||
CHECK_INCLUDE_FILE(wchar.h HAVE_WCHAR_H)
|
||||
IF(HAVE_WCHAR_H)
|
||||
SET(CMAKE_EXTRA_INCLUDE_FILES wchar.h)
|
||||
CHECK_TYPE_SIZE(mbstate_t SIZEOF_MBSTATE_T)
|
||||
SET(CMAKE_EXTRA_INCLUDE_FILES)
|
||||
IF(SIZEOF_MBSTATE_T)
|
||||
SET(HAVE_MBSTATE_T 1)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
CHECK_C_SOURCE_COMPILES("
|
||||
#include <langinfo.h>
|
||||
int main(int ac, char **av)
|
||||
{
|
||||
char *cs = nl_langinfo(CODESET);
|
||||
return 0;
|
||||
}"
|
||||
HAVE_LANGINFO_CODESET)
|
||||
|
||||
CHECK_FUNCTION_EXISTS(mbrlen HAVE_MBRLEN)
|
||||
CHECK_FUNCTION_EXISTS(mbscmp HAVE_MBSCMP)
|
||||
CHECK_FUNCTION_EXISTS(mbsrtowcs HAVE_MBSRTOWCS)
|
||||
CHECK_FUNCTION_EXISTS(wcrtomb HAVE_WCRTOMB)
|
||||
CHECK_FUNCTION_EXISTS(mbrtowc HAVE_MBRTOWC)
|
||||
CHECK_FUNCTION_EXISTS(wcscoll HAVE_WCSCOLL)
|
||||
CHECK_FUNCTION_EXISTS(wcsdup HAVE_WCSDUP)
|
||||
CHECK_FUNCTION_EXISTS(wcwidth HAVE_WCWIDTH)
|
||||
CHECK_FUNCTION_EXISTS(wctype HAVE_WCTYPE)
|
||||
CHECK_FUNCTION_EXISTS(iswlower HAVE_ISWLOWER)
|
||||
CHECK_FUNCTION_EXISTS(iswupper HAVE_ISWUPPER)
|
||||
CHECK_FUNCTION_EXISTS(towlower HAVE_TOWLOWER)
|
||||
CHECK_FUNCTION_EXISTS(towupper HAVE_TOWUPPER)
|
||||
CHECK_FUNCTION_EXISTS(iswctype HAVE_ISWCTYPE)
|
||||
|
||||
SET(CMAKE_EXTRA_INCLUDE_FILES wchar.h)
|
||||
CHECK_TYPE_SIZE(wchar_t SIZEOF_WCHAR_T)
|
||||
IF(SIZEOF_WCHAR_T)
|
||||
SET(HAVE_WCHAR_T 1)
|
||||
ENDIF()
|
||||
|
||||
SET(CMAKE_EXTRA_INCLUDE_FILES wctype.h)
|
||||
CHECK_TYPE_SIZE(wctype_t SIZEOF_WCTYPE_T)
|
||||
IF(SIZEOF_WCTYPE_T)
|
||||
SET(HAVE_WCTYPE_T 1)
|
||||
ENDIF()
|
||||
CHECK_TYPE_SIZE(wint_t SIZEOF_WINT_T)
|
||||
IF(SIZEOF_WINT_T)
|
||||
SET(HAVE_WINT_T 1)
|
||||
ENDIF()
|
||||
SET(CMAKE_EXTRA_INCLUDE_FILES)
|
||||
|
||||
ENDMACRO()
|
||||
|
||||
MACRO (FIND_CURSES)
|
||||
FIND_PACKAGE(Curses)
|
||||
MARK_AS_ADVANCED(CURSES_CURSES_H_PATH CURSES_FORM_LIBRARY CURSES_HAVE_CURSES_H)
|
||||
IF(NOT CURSES_FOUND)
|
||||
SET(ERRORMSG "Curses library not found. Please install appropriate package,
|
||||
remove CMakeCache.txt and rerun cmake.")
|
||||
IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||
SET(ERRORMSG ${ERRORMSG}
|
||||
"On Debian/Ubuntu, package name is libncurses5-dev, on Redhat and derivates "
|
||||
"it is ncurses-devel.")
|
||||
ENDIF()
|
||||
MESSAGE(FATAL_ERROR ${ERRORMSG})
|
||||
ENDIF()
|
||||
|
||||
IF(CURSES_HAVE_CURSES_H)
|
||||
SET(HAVE_CURSES_H 1 CACHE INTERNAL "")
|
||||
ELSEIF(CURSES_HAVE_NCURSES_H)
|
||||
SET(HAVE_NCURSES_H 1 CACHE INTERNAL "")
|
||||
ENDIF()
|
||||
IF(CMAKE_SYSTEM_NAME MATCHES "HP")
|
||||
# CMake uses full path to library /lib/libcurses.sl
|
||||
# On Itanium, it results into architecture mismatch+
|
||||
# the library is for PA-RISC
|
||||
SET(CURSES_LIBRARY "curses" CACHE INTERNAL "" FORCE)
|
||||
SET(CURSES_CURSES_LIBRARY "curses" CACHE INTERNAL "" FORCE)
|
||||
ENDIF()
|
||||
|
||||
IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||
# -Wl,--as-needed breaks linking with -lcurses, e.g on Fedora
|
||||
# Lower-level libcurses calls are exposed by libtinfo
|
||||
CHECK_LIBRARY_EXISTS(${CURSES_LIBRARY} tputs "" HAVE_TPUTS_IN_CURSES)
|
||||
IF(NOT HAVE_TPUTS_IN_CURSES)
|
||||
CHECK_LIBRARY_EXISTS(tinfo tputs "" HAVE_TPUTS_IN_TINFO)
|
||||
IF(HAVE_TPUTS_IN_TINFO)
|
||||
SET(CURSES_LIBRARY tinfo)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
|
||||
MACRO (MYSQL_USE_BUNDLED_READLINE)
|
||||
SET(USE_NEW_READLINE_INTERFACE 1)
|
||||
SET(HAVE_HIST_ENTRY)
|
||||
SET(USE_LIBEDIT_INTERFACE)
|
||||
SET(READLINE_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/cmd-line-utils)
|
||||
SET(READLINE_LIBRARY readline)
|
||||
FIND_CURSES()
|
||||
ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/cmd-line-utils/readline)
|
||||
ENDMACRO()
|
||||
|
||||
MACRO (MYSQL_USE_BUNDLED_LIBEDIT)
|
||||
SET(USE_LIBEDIT_INTERFACE 1)
|
||||
SET(HAVE_HIST_ENTRY 1)
|
||||
SET(READLINE_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/cmd-line-utils/libedit)
|
||||
SET(READLINE_LIBRARY edit)
|
||||
FIND_CURSES()
|
||||
ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/cmd-line-utils/libedit)
|
||||
ENDMACRO()
|
||||
|
||||
|
||||
MACRO (MYSQL_FIND_SYSTEM_READLINE name)
|
||||
|
||||
FIND_PATH(${name}_INCLUDE_DIR readline/readline.h )
|
||||
FIND_LIBRARY(${name}_LIBRARY NAMES ${name})
|
||||
MARK_AS_ADVANCED(${name}_INCLUDE_DIR ${name}_LIBRARY)
|
||||
|
||||
INCLUDE(CheckCXXSourceCompiles)
|
||||
SET(CMAKE_REQUIRES_LIBRARIES ${${name}_LIBRARY})
|
||||
|
||||
IF(${name}_LIBRARY AND ${name}_INCLUDE_DIR)
|
||||
SET(SYSTEM_READLINE_FOUND 1)
|
||||
SET(CMAKE_REQUIRED_LIBRARIES ${${name}_LIBRARY})
|
||||
CHECK_CXX_SOURCE_COMPILES("
|
||||
#include <stdio.h>
|
||||
#include <readline/readline.h>
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
HIST_ENTRY entry;
|
||||
return 0;
|
||||
}"
|
||||
${name}_HAVE_HIST_ENTRY)
|
||||
|
||||
CHECK_CXX_SOURCE_COMPILES("
|
||||
#include <stdio.h>
|
||||
#include <readline/readline.h>
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
char res= *(*rl_completion_entry_function)(0,0);
|
||||
completion_matches(0,0);
|
||||
}"
|
||||
${name}_USE_LIBEDIT_INTERFACE)
|
||||
|
||||
|
||||
CHECK_CXX_SOURCE_COMPILES("
|
||||
#include <stdio.h>
|
||||
#include <readline/readline.h>
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
rl_completion_func_t *func1= (rl_completion_func_t*)0;
|
||||
rl_compentry_func_t *func2= (rl_compentry_func_t*)0;
|
||||
}"
|
||||
${name}_USE_NEW_READLINE_INTERFACE)
|
||||
|
||||
IF(${name}_USE_LIBEDIT_INTERFACE OR ${name}_USE_NEW_READLINE_INTERFACE)
|
||||
SET(READLINE_LIBRARY ${${name}_LIBRARY})
|
||||
SET(READLINE_INCLUDE_DIR ${${name}_INCLUDE_DIR})
|
||||
SET(HAVE_HIST_ENTRY ${${name}_HAVE_HIST_ENTRY})
|
||||
SET(USE_LIBEDIT_INTERFACE ${${name}_USE_LIBEDIT_INTERFACE})
|
||||
SET(USE_NEW_READLINE_INTERFACE ${${name}_USE_NEW_READLINE_INTERFACE})
|
||||
SET(READLINE_FOUND 1)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
|
||||
|
||||
MACRO (MYSQL_CHECK_READLINE)
|
||||
IF (NOT WIN32)
|
||||
MYSQL_CHECK_MULTIBYTE()
|
||||
IF(NOT CYGWIN)
|
||||
SET(WITH_LIBEDIT ON CACHE BOOL "Use bundled libedit")
|
||||
SET(WITH_READLINE OFF CACHE BOOL "Use bundled readline")
|
||||
ELSE()
|
||||
# Bundled libedit does not compile on cygwin, only readline
|
||||
SET(WITH_READLINE OFF CACHE BOOL "Use bundled readline")
|
||||
ENDIF()
|
||||
|
||||
# Handle mutual exclusion of WITH_READLINE/WITH_LIBEDIT variables
|
||||
# We save current setting to recognize when user switched between
|
||||
# WITH_READLINE and WITH_LIBEDIT
|
||||
IF(WITH_READLINE)
|
||||
IF(NOT SAVE_READLINE_SETTING OR SAVE_READLINE_SETTING MATCHES
|
||||
"WITH_LIBEDIT")
|
||||
SET(WITH_LIBEDIT OFF CACHE BOOL "Use bundled libedit" FORCE)
|
||||
ENDIF()
|
||||
ELSEIF(WITH_LIBEDIT)
|
||||
IF(NOT SAVE_READLINE_SETTING OR SAVE_READLINE_SETTING MATCHES
|
||||
"WITH_READLINE")
|
||||
SET(WITH_READLINE OFF CACHE BOOL "Use bundled readline" FORCE)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF(WITH_READLINE)
|
||||
MYSQL_USE_BUNDLED_READLINE()
|
||||
SET(SAVE_READLINE_SETTING WITH_READLINE CACHE INTERNAL "" FORCE)
|
||||
ELSEIF(WITH_LIBEDIT)
|
||||
MYSQL_USE_BUNDLED_LIBEDIT()
|
||||
SET(SAVE_READLINE_SETTING WITH_LIBEDIT CACHE INTERNAL "" FORCE)
|
||||
ELSE()
|
||||
MYSQL_FIND_SYSTEM_READLINE(readline)
|
||||
IF(NOT READLINE_FOUND)
|
||||
MYSQL_FIND_SYSTEM_READLINE(edit)
|
||||
IF(NOT READLINE_FOUND)
|
||||
MESSAGE(FATAL_ERROR "Cannot find system readline or libedit libraries.Use WITH_READLINE or WITH_LIBEDIT")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDIF(NOT WIN32)
|
||||
ENDMACRO()
|
||||
|
90
cmake/ssl.cmake
Normal file
90
cmake/ssl.cmake
Normal file
|
@ -0,0 +1,90 @@
|
|||
# Copyright (C) 2009 Sun Microsystems, Inc
|
||||
#
|
||||
# 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
|
||||
|
||||
MACRO (CHANGE_SSL_SETTINGS string)
|
||||
SET(WITH_SSL ${string} CACHE STRING "Options are : no, bundled, yes (prefer os library if present otherwise use bundled), system (use os library)" FORCE)
|
||||
ENDMACRO()
|
||||
|
||||
MACRO (MYSQL_USE_BUNDLED_SSL)
|
||||
SET(INC_DIRS
|
||||
${CMAKE_SOURCE_DIR}/extra/yassl/include
|
||||
${CMAKE_SOURCE_DIR}/extra/yassl/taocrypt/include
|
||||
)
|
||||
SET(SSL_LIBRARIES yassl taocrypt)
|
||||
SET(SSL_INCLUDE_DIRS ${INC_DIRS})
|
||||
SET(SSL_INTERNAL_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/extra/yassl/taocrypt/mySTL)
|
||||
SET(SSL_DEFINES "-DHAVE_YASSL -DYASSL_PURE_C -DYASSL_PREFIX -DHAVE_OPENSSL")
|
||||
CHANGE_SSL_SETTINGS("bundled")
|
||||
#Remove -fno-implicit-templates
|
||||
#(yassl sources cannot be compiled with it)
|
||||
SET(SAVE_CXX_FLAGS ${CXX_FLAGS})
|
||||
IF(CMAKE_CXX_FLAGS)
|
||||
STRING(REPLACE "-fno-implicit-templates" "" CMAKE_CXX_FLAGS
|
||||
${CMAKE_CXX_FLAGS})
|
||||
ENDIF()
|
||||
ADD_SUBDIRECTORY(extra/yassl)
|
||||
ADD_SUBDIRECTORY(extra/yassl/taocrypt)
|
||||
SET(CXX_FLAGS ${SAVE_CXX_FLAGS})
|
||||
GET_TARGET_PROPERTY(src yassl SOURCES)
|
||||
FOREACH(file ${src})
|
||||
SET(SSL_SOURCES ${SSL_SOURCES} ${CMAKE_SOURCE_DIR}/extra/yassl/${file})
|
||||
ENDFOREACH()
|
||||
GET_TARGET_PROPERTY(src taocrypt SOURCES)
|
||||
FOREACH(file ${src})
|
||||
SET(SSL_SOURCES ${SSL_SOURCES} ${CMAKE_SOURCE_DIR}/extra/yassl/taocrypt/${file})
|
||||
ENDFOREACH()
|
||||
ENDMACRO()
|
||||
|
||||
# MYSQL_CHECK_SSL
|
||||
#
|
||||
# Provides the following configure options:
|
||||
# WITH_SSL=[yes|no|bundled]
|
||||
MACRO (MYSQL_CHECK_SSL)
|
||||
IF(NOT WITH_SSL)
|
||||
IF(WIN32)
|
||||
CHANGE_SSL_SETTINGS("bundled")
|
||||
ELSE()
|
||||
CHANGE_SSL_SETTINGS("no")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF(WITH_SSL STREQUAL "bundled")
|
||||
MYSQL_USE_BUNDLED_SSL()
|
||||
ELSEIF(WITH_SSL STREQUAL "system" OR WITH_SSL STREQUAL "yes")
|
||||
# Check for system library
|
||||
SET(OPENSSL_FIND_QUIETLY TRUE)
|
||||
INCLUDE(FindOpenSSL)
|
||||
FIND_LIBRARY(CRYPTO_LIBRARY crypto)
|
||||
MARK_AS_ADVANCED(CRYPTO_LIBRARY)
|
||||
INCLUDE(CheckSymbolExists)
|
||||
CHECK_SYMBOL_EXISTS(SHA512_DIGEST_LENGTH "openssl/sha.h"
|
||||
HAVE_SHA512_DIGEST_LENGTH)
|
||||
IF(OPENSSL_FOUND AND CRYPTO_LIBRARY AND HAVE_SHA512_DIGEST_LENGTH)
|
||||
SET(SSL_SOURCES "")
|
||||
SET(SSL_LIBRARIES ${OPENSSL_LIBRARIES} ${CRYPTO_LIBRARY})
|
||||
SET(SSL_INCLUDE_DIRS ${OPENSSL_INCLUDE_DIR})
|
||||
SET(SSL_INTERNAL_INCLUDE_DIRS "")
|
||||
SET(SSL_DEFINES "-DHAVE_OPENSSL")
|
||||
CHANGE_SSL_SETTINGS("system")
|
||||
ELSE()
|
||||
IF(WITH_SSL STREQUAL "system")
|
||||
MESSAGE(SEND_ERROR "Cannot find appropriate system libraries for SSL. Use WITH_SSL=bundled to enable SSL support")
|
||||
ENDIF()
|
||||
MYSQL_USE_BUNDLED_SSL()
|
||||
ENDIF()
|
||||
ELSEIF(NOT WITH_SSL STREQUAL "no")
|
||||
MESSAGE(SEND_ERROR "Wrong option for WITH_SSL. Valid values are : yes, no, bundled")
|
||||
ENDIF()
|
||||
ENDMACRO()
|
31
cmake/stack_direction.c
Normal file
31
cmake/stack_direction.c
Normal file
|
@ -0,0 +1,31 @@
|
|||
/* Copyright (C) 2009 Sun Microsystems, Inc
|
||||
|
||||
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 stack direction (0-down, 1-up) */
|
||||
int f(int *a)
|
||||
{
|
||||
int b;
|
||||
return(&b > a)?1:0;
|
||||
}
|
||||
/*
|
||||
Prevent compiler optimizations by calling function
|
||||
through pointer.
|
||||
*/
|
||||
volatile int (*ptr_f)(int *) = f;
|
||||
int main()
|
||||
{
|
||||
int a;
|
||||
return ptr_f(&a);
|
||||
}
|
23
cmake/versioninfo.rc.in
Normal file
23
cmake/versioninfo.rc.in
Normal file
|
@ -0,0 +1,23 @@
|
|||
#include <windows.h>
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION @MAJOR_VERSION@,@MINOR_VERSION@,@PATCH@,0
|
||||
PRODUCTVERSION @MAJOR_VERSION@,@MINOR_VERSION@,@PATCH@,0
|
||||
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
|
||||
FILEFLAGS 0
|
||||
FILEOS VOS__WINDOWS32
|
||||
FILETYPE @FILETYPE@
|
||||
FILESUBTYPE VFT2_UNKNOWN
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904E4"
|
||||
BEGIN
|
||||
VALUE "FileVersion", "@MAJOR_VERSION@.@MINOR_VERSION@.@PATCH@.0\0"
|
||||
VALUE "ProductVersion", "@MAJOR_VERSION@.@MINOR_VERSION@.@PATCH@.0\0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x409, 1252
|
||||
END
|
||||
END
|
73
cmake/zlib.cmake
Normal file
73
cmake/zlib.cmake
Normal file
|
@ -0,0 +1,73 @@
|
|||
# Copyright (C) 2009 Sun Microsystems, Inc
|
||||
#
|
||||
# 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
|
||||
|
||||
MACRO (MYSQL_USE_BUNDLED_ZLIB)
|
||||
SET(ZLIB_LIBRARY zlib)
|
||||
SET(ZLIB_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/zlib)
|
||||
SET(ZLIB_FOUND TRUE)
|
||||
SET(WITH_ZLIB "bundled" CACHE STRING "Use bundled zlib")
|
||||
ADD_SUBDIRECTORY(zlib)
|
||||
GET_TARGET_PROPERTY(src zlib SOURCES)
|
||||
FOREACH(file ${src})
|
||||
SET(ZLIB_SOURCES ${ZLIB_SOURCES} ${CMAKE_SOURCE_DIR}/zlib/${file})
|
||||
ENDFOREACH()
|
||||
ENDMACRO()
|
||||
|
||||
# MYSQL_CHECK_ZLIB_WITH_COMPRESS
|
||||
#
|
||||
# Provides the following configure options:
|
||||
# WITH_ZLIB_BUNDLED
|
||||
# If this is set,we use bindled zlib
|
||||
# If this is not set,search for system zlib.
|
||||
# if system zlib is not found, use bundled copy
|
||||
# ZLIB_LIBRARIES, ZLIB_INCLUDE_DIR and ZLIB_SOURCES
|
||||
# are set after this macro has run
|
||||
|
||||
MACRO (MYSQL_CHECK_ZLIB_WITH_COMPRESS)
|
||||
|
||||
IF(CMAKE_SYSTEM_NAME STREQUAL "OS400" OR
|
||||
CMAKE_SYSTEM_NAME STREQUAL "AIX" OR
|
||||
CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||
# Use bundled zlib on some platforms by default (system one is too
|
||||
# old or not existent)
|
||||
IF (NOT WITH_ZLIB)
|
||||
SET(WITH_ZLIB "bundled" CACHE STRING "By default use bundled zlib on this platform")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF(WITH_ZLIB STREQUAL "bundled")
|
||||
MYSQL_USE_BUNDLED_ZLIB()
|
||||
ELSE()
|
||||
SET(ZLIB_FIND_QUIETLY TRUE)
|
||||
INCLUDE(FindZLIB)
|
||||
IF(ZLIB_FOUND)
|
||||
INCLUDE(CheckFunctionExists)
|
||||
SET(CMAKE_REQUIRED_LIBRARIES z)
|
||||
CHECK_FUNCTION_EXISTS(crc32 HAVE_CRC32)
|
||||
SET(CMAKE_REQUIRED_LIBRARIES)
|
||||
IF(HAVE_CRC32)
|
||||
SET(ZLIB_LIBRARY z CACHE INTERNAL "System zlib library")
|
||||
SET(WITH_ZLIB "system" CACHE STRING "Which zlib to use (possible values are 'bundled' or 'system')")
|
||||
SET(ZLIB_SOURCES "")
|
||||
ELSE()
|
||||
SET(ZLIB_FOUND FALSE CACHE INTERNAL "Zlib found but not usable")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
IF(NOT ZLIB_FOUND)
|
||||
MYSQL_USE_BUNDLED_ZLIB()
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
SET(HAVE_COMPRESS 1)
|
||||
ENDMACRO()
|
167
cmd-line-utils/libedit/CMakeLists.txt
Normal file
167
cmd-line-utils/libedit/CMakeLists.txt
Normal file
|
@ -0,0 +1,167 @@
|
|||
# Copyright (C) 2009 Sun Microsystems, Inc
|
||||
#
|
||||
# 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
|
||||
|
||||
INCLUDE_DIRECTORIES(BEFORE ${CMAKE_CURRENT_SOURCE_DIR} )
|
||||
INCLUDE(CheckIncludeFile)
|
||||
include(CheckFunctionExists)
|
||||
CHECK_INCLUDE_FILES(term.h HAVE_TERM_H)
|
||||
|
||||
SET(CMAKE_REQUIRED_LIBRARIES ${CURSES_LIBRARY})
|
||||
CHECK_CXX_SOURCE_COMPILES("
|
||||
#include <term.h>
|
||||
int main()
|
||||
{
|
||||
tgoto(0,0,0);
|
||||
return 0;
|
||||
}" HAVE_DECL_TGOTO)
|
||||
SET(CMAKE_REQUIRED_LIBRARIES)
|
||||
|
||||
|
||||
|
||||
IF(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
|
||||
#On Solaris, default awk is next to unusable while the xpg4 one is ok.
|
||||
IF(EXISTS /usr/xpg4/bin/awk)
|
||||
SET(AWK_EXECUTABLE /usr/xpg4/bin/awk)
|
||||
ENDIF()
|
||||
ELSEIF(CMAKE_SYSTEM_NAME STREQUAL "OS400")
|
||||
#Workaround for cases, where /usr/bin/gawk is not executable
|
||||
IF(EXISTS /QOpenSys/usr/bin/awk)
|
||||
SET(AWK_EXECUTABLE /QOpenSys/usr/bin/awk)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF(NOT AWK_EXECUTABLE)
|
||||
FIND_PROGRAM(AWK_EXECUTABLE NAMES gawk awk DOC "path to the awk executable")
|
||||
ENDIF()
|
||||
|
||||
MARK_AS_ADVANCED(AWK_EXECUTABLE)
|
||||
SET(AWK ${AWK_EXECUTABLE})
|
||||
CONFIGURE_FILE(makelist.sh ${CMAKE_CURRENT_BINARY_DIR}/makelist @ONLY)
|
||||
|
||||
include(CheckIncludeFile)
|
||||
|
||||
CHECK_INCLUDE_FILE(vis.h HAVE_VIS_H)
|
||||
IF(HAVE_VIS_H)
|
||||
CHECK_FUNCTION_EXISTS(strvis HAVE_STRVIS)
|
||||
IF(NOT HAVE_STRVIS)
|
||||
SET(HAVE_VIS_H FALSE CACHE INTERNAL "" FORCE)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
CHECK_FUNCTION_EXISTS(strvis HAVE_STRVIS)
|
||||
IF(NOT HAVE_STRVIS)
|
||||
SET(LIBEDIT_EXTRA_SOURCES ${LIBEDIT_EXTRA_SOURCES} np/vis.c)
|
||||
ENDIF()
|
||||
|
||||
CHECK_FUNCTION_EXISTS(strunvis HAVE_STRUNVIS)
|
||||
IF(NOT HAVE_STRUNVIS)
|
||||
SET(LIBEDIT_EXTRA_SOURCES ${LIBEDIT_EXTRA_SOURCES} np/unvis.c)
|
||||
ENDIF()
|
||||
|
||||
CHECK_FUNCTION_EXISTS(strlcpy HAVE_STRLCPY)
|
||||
IF(NOT HAVE_STRLCPY)
|
||||
SET(LIBEDIT_EXTRA_SOURCES ${LIBEDIT_EXTRA_SOURCES} np/strlcpy.c)
|
||||
ENDIF()
|
||||
|
||||
CHECK_FUNCTION_EXISTS(strlcat HAVE_STRLCAT)
|
||||
IF(NOT HAVE_STRLCAT)
|
||||
SET(LIBEDIT_EXTRA_SOURCES ${LIBEDIT_EXTRA_SOURCES} np/strlcat.c)
|
||||
ENDIF()
|
||||
|
||||
CHECK_FUNCTION_EXISTS(fgetln HAVE_FGETLN)
|
||||
IF(NOT HAVE_FGETLN)
|
||||
SET(LIBEDIT_EXTRA_SOURCES ${LIBEDIT_EXTRA_SOURCES} np/fgetln.c)
|
||||
ENDIF()
|
||||
|
||||
# Generate headers
|
||||
FOREACH(SRCBASENAME vi emacs common)
|
||||
SET(SRC ${CMAKE_CURRENT_SOURCE_DIR}/${SRCBASENAME}.c)
|
||||
SET(HDR ${CMAKE_CURRENT_BINARY_DIR}/${SRCBASENAME}.h)
|
||||
|
||||
ADD_CUSTOM_COMMAND(
|
||||
OUTPUT ${HDR}
|
||||
COMMAND sh ./makelist -h ${SRC} > ${HDR}
|
||||
DEPENDS ${SRC})
|
||||
|
||||
SET(AHDR ${AHDR} ${HDR})
|
||||
SET(ASRC ${ASRC} ${SRC})
|
||||
ENDFOREACH()
|
||||
|
||||
# Generate source files
|
||||
ADD_CUSTOM_COMMAND(
|
||||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/help.c
|
||||
COMMAND sh ./makelist -bc ${ASRC} > help.c
|
||||
DEPENDS ${ASRC}
|
||||
)
|
||||
|
||||
ADD_CUSTOM_COMMAND(
|
||||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/help.h
|
||||
COMMAND sh ./makelist -bh ${ASRC} > help.h
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
DEPENDS ${ASRC}
|
||||
)
|
||||
|
||||
ADD_CUSTOM_COMMAND(
|
||||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/fcns.h
|
||||
COMMAND sh ./makelist -fh ${AHDR} > fcns.h
|
||||
VERBATIM
|
||||
DEPENDS ${AHDR}
|
||||
)
|
||||
|
||||
ADD_CUSTOM_COMMAND(
|
||||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/fcns.c
|
||||
COMMAND sh ./makelist -fc ${AHDR} > fcns.c
|
||||
VERBATIM
|
||||
DEPENDS ${AHDR}
|
||||
)
|
||||
|
||||
|
||||
INCLUDE_DIRECTORIES(
|
||||
${CMAKE_SOURCE_DIR}/include
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${CURSES_INCLUDE_PATH}
|
||||
)
|
||||
|
||||
SET(LIBEDIT_SOURCES
|
||||
chared.c
|
||||
el.c
|
||||
history.c
|
||||
map.c
|
||||
prompt.c
|
||||
readline.c
|
||||
search.c
|
||||
tokenizer.c
|
||||
vi.c
|
||||
common.c
|
||||
emacs.c
|
||||
hist.c
|
||||
key.c
|
||||
parse.c
|
||||
read.c
|
||||
refresh.c
|
||||
sig.c
|
||||
term.c
|
||||
tty.c
|
||||
filecomplete.c
|
||||
${CMAKE_CURRENT_BINARY_DIR}/help.c
|
||||
${CMAKE_CURRENT_BINARY_DIR}/help.h
|
||||
${CMAKE_CURRENT_BINARY_DIR}/fcns.c
|
||||
${CMAKE_CURRENT_BINARY_DIR}/fcns.h
|
||||
${AHDR}
|
||||
${LIBEDIT_EXTRA_SOURCES}
|
||||
)
|
||||
ADD_LIBRARY(edit ${LIBEDIT_SOURCES})
|
||||
TARGET_LINK_LIBRARIES(edit ${CURSES_LIBRARY})
|
||||
|
|
@ -23,7 +23,7 @@ noinst_HEADERS = chared.h el.h el_term.h histedit.h key.h parse.h refresh.h sig.
|
|||
sys.h config.h hist.h map.h prompt.h read.h \
|
||||
search.h tty.h filecomplete.h np/vis.h
|
||||
|
||||
EXTRA_DIST = makelist.sh
|
||||
EXTRA_DIST = makelist.sh CMakeLists.txt
|
||||
|
||||
CLEANFILES = makelist common.h emacs.h vi.h fcns.h help.h fcns.c help.c
|
||||
|
||||
|
|
60
cmd-line-utils/readline/CMakeLists.txt
Normal file
60
cmd-line-utils/readline/CMakeLists.txt
Normal file
|
@ -0,0 +1,60 @@
|
|||
# Copyright (C) 2007 MySQL 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include
|
||||
${CMAKE_SOURCE_DIR}/cmd-line-utils)
|
||||
|
||||
ADD_DEFINITIONS(-DHAVE_CONFIG_H -DNO_KILL_INTR -DMYSQL_CLIENT_NO_THREADS)
|
||||
|
||||
INCLUDE_DIRECTORIES(${CURSES_INCLUDE_PATH})
|
||||
|
||||
ADD_LIBRARY(readline
|
||||
readline.c
|
||||
funmap.c
|
||||
keymaps.c
|
||||
vi_mode.c
|
||||
parens.c
|
||||
rltty.c
|
||||
complete.c
|
||||
bind.c
|
||||
isearch.c
|
||||
display.c
|
||||
signals.c
|
||||
util.c
|
||||
kill.c
|
||||
undo.c
|
||||
macro.c
|
||||
input.c
|
||||
callback.c
|
||||
terminal.c
|
||||
xmalloc.c
|
||||
history.c
|
||||
histsearch.c
|
||||
histexpand.c
|
||||
histfile.c
|
||||
nls.c
|
||||
search.c
|
||||
shell.c
|
||||
tilde.c
|
||||
misc.c
|
||||
text.c
|
||||
mbutil.c
|
||||
compat.c
|
||||
savestring.c
|
||||
)
|
||||
|
||||
# Declare dependency
|
||||
# so every executable that links with readline links with curses as well
|
||||
TARGET_LINK_LIBRARIES(readline ${CURSES_LIBRARY})
|
|
@ -29,7 +29,7 @@ noinst_HEADERS = readline.h chardefs.h keymaps.h \
|
|||
tilde.h rlconf.h rltty.h ansi_stdlib.h \
|
||||
tcap.h rlstdc.h
|
||||
|
||||
EXTRA_DIST= emacs_keymap.c vi_keymap.c
|
||||
EXTRA_DIST= emacs_keymap.c vi_keymap.c CMakeLists.txt
|
||||
|
||||
DEFS = -DMYSQL_CLIENT_NO_THREADS -DHAVE_CONFIG_H -DNO_KILL_INTR
|
||||
|
||||
|
|
658
config.h.cmake
Normal file
658
config.h.cmake
Normal file
|
@ -0,0 +1,658 @@
|
|||
/* Copyright (C) 2009 Sun Microsystems, Inc
|
||||
|
||||
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 */
|
||||
|
||||
#ifndef MY_CONFIG_H
|
||||
#define MY_CONFIG_H
|
||||
#cmakedefine DOT_FRM_VERSION @DOT_FRM_VERSION@
|
||||
/* Headers we may want to use. */
|
||||
#cmakedefine STDC_HEADERS 1
|
||||
#cmakedefine _GNU_SOURCE 1
|
||||
#cmakedefine HAVE_ALLOCA_H 1
|
||||
#cmakedefine HAVE_AIO_H 1
|
||||
#cmakedefine HAVE_ARPA_INET_H 1
|
||||
#cmakedefine HAVE_BSEARCH 1
|
||||
#cmakedefine HAVE_CRYPT_H 1
|
||||
#cmakedefine HAVE_CURSES_H 1
|
||||
#cmakedefine HAVE_CXXABI_H 1
|
||||
#cmakedefine HAVE_NCURSES_H 1
|
||||
#cmakedefine HAVE_DIRENT_H 1
|
||||
#cmakedefine HAVE_DLFCN_H 1
|
||||
#cmakedefine HAVE_EXECINFO_H 1
|
||||
#cmakedefine HAVE_FCNTL_H 1
|
||||
#cmakedefine HAVE_FENV_H 1
|
||||
#cmakedefine HAVE_FLOAT_H 1
|
||||
#cmakedefine HAVE_FLOATINGPOINT_H 1
|
||||
#cmakedefine HAVE_FNMATCH_H 1
|
||||
#cmakedefine HAVE_FPU_CONTROL_H 1
|
||||
#cmakedefine HAVE_GRP_H 1
|
||||
#cmakedefine HAVE_EXPLICIT_TEMPLATE_INSTANTIATION 1
|
||||
#cmakedefine HAVE_IEEEFP_H 1
|
||||
#cmakedefine HAVE_INTTYPES_H 1
|
||||
#cmakedefine HAVE_LIMITS_H 1
|
||||
#cmakedefine HAVE_LOCALE_H 1
|
||||
#cmakedefine HAVE_MALLOC_H 1
|
||||
#cmakedefine HAVE_MEMORY_H 1
|
||||
#cmakedefine HAVE_NETINET_IN_H 1
|
||||
#cmakedefine HAVE_PATHS_H 1
|
||||
#cmakedefine HAVE_POLL_H 1
|
||||
#cmakedefine HAVE_PORT_H 1
|
||||
#cmakedefine HAVE_PWD_H 1
|
||||
#cmakedefine HAVE_SCHED_H 1
|
||||
#cmakedefine HAVE_SELECT_H 1
|
||||
#cmakedefine HAVE_SOLARIS_LARGE_PAGES 1
|
||||
#cmakedefine HAVE_STDDEF_H 1
|
||||
#cmakedefine HAVE_STDLIB_H 1
|
||||
#cmakedefine HAVE_STDARG_H 1
|
||||
#cmakedefine HAVE_STRINGS_H 1
|
||||
#cmakedefine HAVE_STRING_H 1
|
||||
#cmakedefine HAVE_STDINT_H 1
|
||||
#cmakedefine HAVE_SEMAPHORE_H 1
|
||||
#cmakedefine HAVE_SYNCH_H 1
|
||||
#cmakedefine HAVE_SYSENT_H 1
|
||||
#cmakedefine HAVE_SYS_DIR_H 1
|
||||
#cmakedefine HAVE_SYS_CDEFS_H 1
|
||||
#cmakedefine HAVE_SYS_FILE_H 1
|
||||
#cmakedefine HAVE_SYS_FPU_H 1
|
||||
#cmakedefine HAVE_SYS_IOCTL_H 1
|
||||
#cmakedefine HAVE_SYS_IPC_H 1
|
||||
#cmakedefine HAVE_SYS_MALLOC_H 1
|
||||
#cmakedefine HAVE_SYS_MMAN_H 1
|
||||
#cmakedefine HAVE_SYS_PTE_H 1
|
||||
#cmakedefine HAVE_SYS_PTEM_H 1
|
||||
#cmakedefine HAVE_SYS_PRCTL_H 1
|
||||
#cmakedefine HAVE_SYS_RESOURCE_H 1
|
||||
#cmakedefine HAVE_SYS_SELECT_H 1
|
||||
#cmakedefine HAVE_SYS_SHM_H 1
|
||||
#cmakedefine HAVE_SYS_SOCKET_H 1
|
||||
#cmakedefine HAVE_SYS_STAT_H 1
|
||||
#cmakedefine HAVE_SYS_STREAM_H 1
|
||||
#cmakedefine HAVE_SYS_TERMCAP_H 1
|
||||
#cmakedefine HAVE_SYS_TIMEB_H 1
|
||||
#cmakedefine HAVE_SYS_TYPES_H 1
|
||||
#cmakedefine HAVE_SYS_UN_H 1
|
||||
#cmakedefine HAVE_SYS_VADVISE_H 1
|
||||
#cmakedefine HAVE_TERM_H 1
|
||||
#cmakedefine HAVE_TERMIOS_H 1
|
||||
#cmakedefine HAVE_TERMIO_H 1
|
||||
#cmakedefine HAVE_TERMCAP_H 1
|
||||
#cmakedefine HAVE_UNISTD_H 1
|
||||
#cmakedefine HAVE_UTIME_H 1
|
||||
#cmakedefine HAVE_VARARGS_H 1
|
||||
#cmakedefine HAVE_VIS_H 1
|
||||
#cmakedefine HAVE_SYS_UTIME_H 1
|
||||
#cmakedefine HAVE_SYS_WAIT_H 1
|
||||
#cmakedefine HAVE_SYS_PARAM_H 1
|
||||
|
||||
/* Libraries */
|
||||
#cmakedefine HAVE_LIBPTHREAD 1
|
||||
#cmakedefine HAVE_LIBM 1
|
||||
#cmakedefine HAVE_LIBDL 1
|
||||
#cmakedefine HAVE_LIBRT 1
|
||||
#cmakedefine HAVE_LIBSOCKET 1
|
||||
#cmakedefine HAVE_LIBNSL 1
|
||||
#cmakedefine HAVE_LIBCRYPT 1
|
||||
#cmakedefine HAVE_LIBMTMALLOC 1
|
||||
#cmakedefine HAVE_LIBWRAP 1
|
||||
/* Does "struct timespec" have a "sec" and "nsec" field? */
|
||||
#cmakedefine HAVE_TIMESPEC_TS_SEC 1
|
||||
|
||||
/* Readline */
|
||||
#cmakedefine HAVE_HIST_ENTRY 1
|
||||
#cmakedefine USE_LIBEDIT_INTERFACE 1
|
||||
#cmakedefine USE_NEW_READLINE_INTERFACE 1
|
||||
|
||||
#cmakedefine FIONREAD_IN_SYS_IOCTL 1
|
||||
#cmakedefine GWINSZ_IN_SYS_IOCTL 1
|
||||
#cmakedefine TIOCSTAT_IN_SYS_IOCTL 1
|
||||
|
||||
/* Functions we may want to use. */
|
||||
#cmakedefine HAVE_AIOWAIT 1
|
||||
#cmakedefine HAVE_ALARM 1
|
||||
#cmakedefine HAVE_ALLOCA 1
|
||||
#cmakedefine HAVE_BCMP 1
|
||||
#cmakedefine HAVE_BFILL 1
|
||||
#cmakedefine HAVE_BMOVE 1
|
||||
#cmakedefine HAVE_BZERO 1
|
||||
#cmakedefine HAVE_INDEX 1
|
||||
#cmakedefine HAVE_CLOCK_GETTIME 1
|
||||
#cmakedefine HAVE_CRYPT 1
|
||||
#cmakedefine HAVE_CUSERID 1
|
||||
#cmakedefine HAVE_DIRECTIO 1
|
||||
#cmakedefine HAVE_DLERROR 1
|
||||
#cmakedefine HAVE_DLOPEN 1
|
||||
#cmakedefine HAVE_DOPRNT 1
|
||||
#cmakedefine HAVE_FCHMOD 1
|
||||
#cmakedefine HAVE_FCNTL 1
|
||||
#cmakedefine HAVE_FCONVERT 1
|
||||
#cmakedefine HAVE_FDATASYNC 1
|
||||
#cmakedefine HAVE_FESETROUND 1
|
||||
#cmakedefine HAVE_FINITE 1
|
||||
#cmakedefine HAVE_FP_EXCEPT 1
|
||||
#cmakedefine HAVE_FPSETMASK 1
|
||||
#cmakedefine HAVE_FSEEKO 1
|
||||
#cmakedefine HAVE_FSYNC 1
|
||||
#cmakedefine HAVE_GETADDRINFO 1
|
||||
#cmakedefine HAVE_GETCWD 1
|
||||
#cmakedefine HAVE_GETHOSTBYADDR_R 1
|
||||
#cmakedefine HAVE_GETHOSTBYNAME_R 1
|
||||
#cmakedefine HAVE_GETHRTIME 1
|
||||
#cmakedefine HAVE_GETLINE 1
|
||||
#cmakedefine HAVE_GETNAMEINFO 1
|
||||
#cmakedefine HAVE_GETPAGESIZE 1
|
||||
#cmakedefine HAVE_GETPASS 1
|
||||
#cmakedefine HAVE_GETPASSPHRASE 1
|
||||
#cmakedefine HAVE_GETPWNAM 1
|
||||
#cmakedefine HAVE_GETPWUID 1
|
||||
#cmakedefine HAVE_GETRLIMIT 1
|
||||
#cmakedefine HAVE_GETRUSAGE 1
|
||||
#cmakedefine HAVE_GETTIMEOFDAY 1
|
||||
#cmakedefine HAVE_GETWD 1
|
||||
#cmakedefine HAVE_GMTIME_R 1
|
||||
#cmakedefine gmtime_r @gmtime_r@
|
||||
#cmakedefine HAVE_INITGROUPS 1
|
||||
#cmakedefine HAVE_ISSETUGID 1
|
||||
#cmakedefine HAVE_ISNAN 1
|
||||
#cmakedefine HAVE_ISINF 1
|
||||
#cmakedefine HAVE_LARGE_PAGE_OPTION 1
|
||||
#cmakedefine HAVE_LDIV 1
|
||||
#cmakedefine HAVE_LRAND48 1
|
||||
#cmakedefine HAVE_LOCALTIME_R 1
|
||||
#cmakedefine HAVE_LOG2 1
|
||||
#cmakedefine HAVE_LONGJMP 1
|
||||
#cmakedefine HAVE_LSTAT 1
|
||||
#cmakedefine HAVE_NPTL 1
|
||||
#cmakedefine HAVE_NL_LANGINFO 1
|
||||
#cmakedefine HAVE_MADVISE 1
|
||||
#cmakedefine HAVE_DECL_MADVISE 1
|
||||
#cmakedefine HAVE_DECL_TGOTO 1
|
||||
#cmakedefine HAVE_DECL_MHA_MAPSIZE_VA
|
||||
#cmakedefine HAVE_MALLINFO 1
|
||||
#cmakedefine HAVE_MEMCPY 1
|
||||
#cmakedefine HAVE_MEMMOVE 1
|
||||
#cmakedefine HAVE_MKSTEMP 1
|
||||
#cmakedefine HAVE_MLOCKALL 1
|
||||
#cmakedefine HAVE_MMAP 1
|
||||
#cmakedefine HAVE_MMAP64 1
|
||||
#cmakedefine HAVE_PERROR 1
|
||||
#cmakedefine HAVE_POLL 1
|
||||
#cmakedefine HAVE_PORT_CREATE 1
|
||||
#cmakedefine HAVE_POSIX_FALLOCATE 1
|
||||
#cmakedefine HAVE_PREAD 1
|
||||
#cmakedefine HAVE_PAUSE_INSTRUCTION 1
|
||||
#cmakedefine HAVE_FAKE_PAUSE_INSTRUCTION 1
|
||||
#cmakedefine HAVE_PTHREAD_ATTR_CREATE 1
|
||||
#cmakedefine HAVE_PTHREAD_ATTR_GETSTACKSIZE 1
|
||||
#cmakedefine HAVE_PTHREAD_ATTR_SETPRIO 1
|
||||
#cmakedefine HAVE_PTHREAD_ATTR_SETSCHEDPARAM 1
|
||||
#cmakedefine HAVE_PTHREAD_ATTR_SETSCOPE 1
|
||||
#cmakedefine HAVE_PTHREAD_ATTR_SETSTACKSIZE 1
|
||||
#cmakedefine HAVE_PTHREAD_CONDATTR_CREATE 1
|
||||
#cmakedefine HAVE_PTHREAD_CONDATTR_SETCLOCK 1
|
||||
#cmakedefine HAVE_PTHREAD_INIT 1
|
||||
#cmakedefine HAVE_PTHREAD_KEY_DELETE 1
|
||||
#cmakedefine HAVE_PTHREAD_KEY_DELETE 1
|
||||
#cmakedefine HAVE_PTHREAD_KILL 1
|
||||
#cmakedefine HAVE_PTHREAD_RWLOCK_RDLOCK 1
|
||||
#cmakedefine HAVE_PTHREAD_RWLOCKATTR_SETKIND_NP 1
|
||||
#cmakedefine HAVE_PTHREAD_SETPRIO_NP 1
|
||||
#cmakedefine HAVE_PTHREAD_SETSCHEDPARAM 1
|
||||
#cmakedefine HAVE_PTHREAD_SIGMASK 1
|
||||
#cmakedefine HAVE_PTHREAD_THREADMASK 1
|
||||
#cmakedefine HAVE_PTHREAD_YIELD_NP 1
|
||||
#cmakedefine HAVE_PTHREAD_YIELD_ZERO_ARG 1
|
||||
#cmakedefine HAVE_PUTENV 1
|
||||
#cmakedefine HAVE_RE_COMP 1
|
||||
#cmakedefine HAVE_REGCOMP 1
|
||||
#cmakedefine HAVE_READDIR_R 1
|
||||
#cmakedefine HAVE_READLINK 1
|
||||
#cmakedefine HAVE_REALPATH 1
|
||||
#cmakedefine HAVE_RENAME 1
|
||||
#cmakedefine HAVE_RINT 1
|
||||
#cmakedefine HAVE_RWLOCK_INIT 1
|
||||
#cmakedefine HAVE_SCHED_YIELD 1
|
||||
#cmakedefine HAVE_SELECT 1
|
||||
#cmakedefine HAVE_SETFD 1
|
||||
#cmakedefine HAVE_SETENV 1
|
||||
#cmakedefine HAVE_SETLOCALE 1
|
||||
#cmakedefine HAVE_SIGADDSET 1
|
||||
#cmakedefine HAVE_SIGEMPTYSET 1
|
||||
#cmakedefine HAVE_SIGHOLD 1
|
||||
#cmakedefine HAVE_SIGSET 1
|
||||
#cmakedefine HAVE_SIGSET_T 1
|
||||
#cmakedefine HAVE_SIGACTION 1
|
||||
#cmakedefine HAVE_SIGTHREADMASK 1
|
||||
#cmakedefine HAVE_SIGWAIT 1
|
||||
#cmakedefine HAVE_SLEEP 1
|
||||
#cmakedefine HAVE_SNPRINTF 1
|
||||
#cmakedefine HAVE_STPCPY 1
|
||||
#cmakedefine HAVE_STRERROR 1
|
||||
#cmakedefine HAVE_STRCOLL 1
|
||||
#cmakedefine HAVE_STRSIGNAL 1
|
||||
#cmakedefine HAVE_STRLCPY 1
|
||||
#cmakedefine HAVE_STRLCAT 1
|
||||
#cmakedefine HAVE_FGETLN 1
|
||||
#cmakedefine HAVE_STRNLEN 1
|
||||
#cmakedefine HAVE_STRPBRK 1
|
||||
#cmakedefine HAVE_STRSEP 1
|
||||
#cmakedefine HAVE_STRSTR 1
|
||||
#cmakedefine HAVE_STRTOK_R 1
|
||||
#cmakedefine HAVE_STRTOL 1
|
||||
#cmakedefine HAVE_STRTOLL 1
|
||||
#cmakedefine HAVE_STRTOUL 1
|
||||
#cmakedefine HAVE_STRTOULL 1
|
||||
#cmakedefine HAVE_SHMAT 1
|
||||
#cmakedefine HAVE_SHMCTL 1
|
||||
#cmakedefine HAVE_SHMDT 1
|
||||
#cmakedefine HAVE_SHMGET 1
|
||||
#cmakedefine HAVE_TELL 1
|
||||
#cmakedefine HAVE_TEMPNAM 1
|
||||
#cmakedefine HAVE_THR_SETCONCURRENCY 1
|
||||
#cmakedefine HAVE_THR_YIELD 1
|
||||
#cmakedefine HAVE_VALLOC 1
|
||||
#define HAVE_VIO_READ_BUFF 1
|
||||
#cmakedefine HAVE_VASPRINTF 1
|
||||
#cmakedefine HAVE_VPRINTF 1
|
||||
#cmakedefine HAVE_VSNPRINTF 1
|
||||
#cmakedefine HAVE_FTRUNCATE 1
|
||||
#cmakedefine HAVE_TZNAME 1
|
||||
#cmakedefine HAVE_AIO_READ 1
|
||||
/* Symbols we may use */
|
||||
#cmakedefine HAVE_SYS_ERRLIST 1
|
||||
/* used by stacktrace functions */
|
||||
#cmakedefine HAVE_BSS_START 1
|
||||
#cmakedefine HAVE_BACKTRACE 1
|
||||
#cmakedefine HAVE_BACKTRACE_SYMBOLS 1
|
||||
#cmakedefine HAVE_BACKTRACE_SYMBOLS_FD 1
|
||||
#cmakedefine HAVE_PRINTSTACK 1
|
||||
#cmakedefine HAVE_STRUCT_SOCKADDR_IN6 1
|
||||
#cmakedefine HAVE_STRUCT_IN6_ADDR 1
|
||||
#cmakedefine HAVE_NETINET_IN6_H 1
|
||||
#cmakedefine HAVE_IPV6 1
|
||||
#cmakedefine ss_family @ss_family@
|
||||
#cmakedefine HAVE_TIMESPEC_TS_SEC 1
|
||||
#cmakedefine STRUCT_DIRENT_HAS_D_INO 1
|
||||
#cmakedefine STRUCT_DIRENT_HAS_D_NAMLEN 1
|
||||
#cmakedefine SPRINTF_RETURNS_INT 1
|
||||
|
||||
#define USE_MB 1
|
||||
#define USE_MB_IDENT 1
|
||||
|
||||
|
||||
|
||||
/* Types we may use */
|
||||
#cmakedefine SIZEOF_CHAR @SIZEOF_CHAR@
|
||||
#if SIZEOF_CHAR
|
||||
# define HAVE_CHAR 1
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
/*
|
||||
Special handling required for OSX to support universal binaries that
|
||||
mix 32 and 64 bit architectures.
|
||||
*/
|
||||
#if(__LP64__)
|
||||
#define SIZEOF_LONG 8
|
||||
#else
|
||||
#define SIZEOF_LONG 4
|
||||
#endif
|
||||
#define SIZEOF_CHARP SIZEOF_LONG
|
||||
#define SIZEOF_SIZE_T SIZEOF_LONG
|
||||
#else
|
||||
#cmakedefine SIZEOF_LONG @SIZEOF_LONG@
|
||||
#cmakedefine SIZEOF_CHARP @SIZEOF_CHARP@
|
||||
#cmakedefine SIZEOF_SIZE_T @SIZEOF_CHARP@
|
||||
#endif
|
||||
|
||||
#if SIZEOF_LONG
|
||||
# define HAVE_LONG 1
|
||||
#endif
|
||||
|
||||
|
||||
#if SIZEOF_CHARP
|
||||
#define HAVE_CHARP 1
|
||||
#define SIZEOF_VOIDP SIZEOF_CHARP
|
||||
#endif
|
||||
|
||||
#cmakedefine SIZEOF_SHORT @SIZEOF_SHORT@
|
||||
#if SIZEOF_SHORT
|
||||
# define HAVE_SHORT 1
|
||||
#endif
|
||||
|
||||
#cmakedefine SIZEOF_INT @SIZEOF_INT@
|
||||
#if SIZEOF_INT
|
||||
# define HAVE_INT 1
|
||||
#endif
|
||||
|
||||
|
||||
#cmakedefine SIZEOF_LONG_LONG @SIZEOF_LONG_LONG@
|
||||
#if SIZEOF_LONG_LONG
|
||||
# define HAVE_LONG_LONG 1
|
||||
#endif
|
||||
|
||||
#cmakedefine SIZEOF_OFF_T @SIZEOF_OFF_T@
|
||||
#if SIZEOF_OFF_T
|
||||
#define HAVE_OFF_T 1
|
||||
#endif
|
||||
|
||||
#cmakedefine SIZEOF_SIGSET_T @SIZEOF_SIGSET_T@
|
||||
#if SIZEOF_SIGSET_T
|
||||
#define HAVE_SIGSET_T 1
|
||||
#endif
|
||||
|
||||
#if SIZEOF_SIZE_T
|
||||
#define HAVE_SIZE_T 1
|
||||
#endif
|
||||
|
||||
#cmakedefine SIZEOF_UCHAR @SIZEOF_UCHAR@
|
||||
#if SIZEOF_UCHAR
|
||||
#define HAVE_UCHAR 1
|
||||
#endif
|
||||
|
||||
#cmakedefine SIZEOF_UINT @SIZEOF_UINT@
|
||||
#if SIZEOF_UINT
|
||||
#define HAVE_UINT 1
|
||||
#endif
|
||||
|
||||
#cmakedefine SIZEOF_ULONG @SIZEOF_ULONG@
|
||||
#if SIZEOF_ULONG
|
||||
#define HAVE_ULONG 1
|
||||
#endif
|
||||
|
||||
#cmakedefine SIZEOF_INT8 @SIZEOF_INT8@
|
||||
#if SIZEOF_INT8
|
||||
#define HAVE_INT8 1
|
||||
#endif
|
||||
#cmakedefine SIZEOF_UINT8 @SIZEOF_UINT8@
|
||||
#if SIZEOF_UINT8
|
||||
#define HAVE_UINT8 1
|
||||
#endif
|
||||
|
||||
#cmakedefine SIZEOF_INT16 @SIZEOF_INT16@
|
||||
#if SIZEOF_INT16
|
||||
# define HAVE_INT16 1
|
||||
#endif
|
||||
#cmakedefine SIZEOF_UINT16 @SIZEOF_UINT16@
|
||||
#if SIZEOF_UINT16
|
||||
#define HAVE_UINT16 1
|
||||
#endif
|
||||
|
||||
#cmakedefine SIZEOF_INT32 @SIZEOF_INT32@
|
||||
#if SIZEOF_INT32
|
||||
#define HAVE_INT32 1
|
||||
#endif
|
||||
#cmakedefine SIZEOF_UINT32 @SIZEOF_UINT32@
|
||||
#if SIZEOF_UINT32
|
||||
#define HAVE_UINT32 1
|
||||
#endif
|
||||
#cmakedefine SIZEOF_U_INT32_T @SIZEOF_U_INT32_T@
|
||||
#if SIZEOF_U_INT32_T
|
||||
#define HAVE_U_INT32_T 1
|
||||
#endif
|
||||
|
||||
#cmakedefine SIZEOF_INT64 @SIZEOF_INT64@
|
||||
#if SIZEOF_INT64
|
||||
#define HAVE_INT64 1
|
||||
#endif
|
||||
#cmakedefine SIZEOF_UINT64 @SIZEOF_UINT64@
|
||||
#if SIZEOF_UINT64
|
||||
#define HAVE_UINT64 1
|
||||
#endif
|
||||
|
||||
#cmakedefine SOCKET_SIZE_TYPE @SOCKET_SIZE_TYPE@
|
||||
|
||||
#cmakedefine SIZEOF_BOOL @SIZEOF_BOOL@
|
||||
#if SIZEOF_BOOL
|
||||
#define HAVE_BOOL 1
|
||||
#endif
|
||||
#cmakedefine HAVE_MBSTATE_T
|
||||
|
||||
#define MAX_INDEXES 64
|
||||
|
||||
#cmakedefine QSORT_TYPE_IS_VOID 1
|
||||
#define RETQSORTTYPE void
|
||||
|
||||
#cmakedefine SIGNAL_RETURN_TYPE_IS_VOID 1
|
||||
#define RETSIGTYPE void
|
||||
#if SIGNAL_RETURN_TYPE_IS_VOID
|
||||
#define VOID_SIGHANDLER 1
|
||||
#endif
|
||||
#define STRUCT_RLIMIT struct rlimit
|
||||
|
||||
#ifdef __APPLE__
|
||||
#if __BIG_ENDIAN
|
||||
#define WORDS_BIGENDIAN 1
|
||||
#endif
|
||||
#else
|
||||
#cmakedefine WORDS_BIGENDIAN 1
|
||||
#endif
|
||||
|
||||
/* Define to `__inline__' or `__inline' if that's what the C compiler calls
|
||||
it, or to nothing if 'inline' is not supported under any name. */
|
||||
#cmakedefine C_HAS_inline 1
|
||||
#if !(C_HAS_inline)
|
||||
#ifndef __cplusplus
|
||||
# define inline @C_INLINE@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#cmakedefine TARGET_OS_LINUX 1
|
||||
#cmakedefine TARGET_OS_SOLARIS 1
|
||||
|
||||
#cmakedefine HAVE_WCTYPE_H 1
|
||||
#cmakedefine HAVE_WCHAR_H 1
|
||||
#cmakedefine HAVE_LANGINFO_H 1
|
||||
#cmakedefine HAVE_MBRLEN
|
||||
#cmakedefine HAVE_MBSCMP
|
||||
#cmakedefine HAVE_MBSRTOWCS
|
||||
#cmakedefine HAVE_WCRTOMB
|
||||
#cmakedefine HAVE_MBRTOWC
|
||||
#cmakedefine HAVE_WCSCOLL
|
||||
#cmakedefine HAVE_WCSDUP
|
||||
#cmakedefine HAVE_WCWIDTH
|
||||
#cmakedefine HAVE_WCTYPE
|
||||
#cmakedefine HAVE_ISWLOWER 1
|
||||
#cmakedefine HAVE_ISWUPPER 1
|
||||
#cmakedefine HAVE_TOWLOWER 1
|
||||
#cmakedefine HAVE_TOWUPPER 1
|
||||
#cmakedefine HAVE_ISWCTYPE 1
|
||||
#cmakedefine HAVE_WCHAR_T 1
|
||||
#cmakedefine HAVE_WCTYPE_T 1
|
||||
#cmakedefine HAVE_WINT_T 1
|
||||
|
||||
|
||||
#cmakedefine HAVE_STRCASECMP 1
|
||||
#cmakedefine HAVE_STRNCASECMP 1
|
||||
#cmakedefine HAVE_STRDUP 1
|
||||
#cmakedefine HAVE_LANGINFO_CODESET
|
||||
#cmakedefine HAVE_TCGETATTR 1
|
||||
#cmakedefine HAVE_FLOCKFILE 1
|
||||
|
||||
#cmakedefine HAVE_WEAK_SYMBOL 1
|
||||
#cmakedefine HAVE_ABI_CXA_DEMANGLE 1
|
||||
|
||||
|
||||
#cmakedefine HAVE_POSIX_SIGNALS 1
|
||||
#cmakedefine HAVE_BSD_SIGNALS 1
|
||||
#cmakedefine HAVE_SVR3_SIGNALS 1
|
||||
#cmakedefine HAVE_V7_SIGNALS 1
|
||||
|
||||
|
||||
#cmakedefine HAVE_SOLARIS_STYLE_GETHOST 1
|
||||
#cmakedefine HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE 1
|
||||
#cmakedefine HAVE_GETHOSTBYNAME_R_RETURN_INT 1
|
||||
|
||||
#cmakedefine MY_ATOMIC_MODE_DUMMY 1
|
||||
#cmakedefine MY_ATOMIC_MODE_RWLOCKS 1
|
||||
#cmakedefine HAVE_GCC_ATOMIC_BUILTINS 1
|
||||
#cmakedefine HAVE_SOLARIS_ATOMIC 1
|
||||
#cmakedefine HAVE_DECL_SHM_HUGETLB 1
|
||||
#cmakedefine HAVE_LARGE_PAGES 1
|
||||
#cmakedefine HUGETLB_USE_PROC_MEMINFO 1
|
||||
#cmakedefine NO_FCNTL_NONBLOCK 1
|
||||
#cmakedefine NO_ALARM 1
|
||||
|
||||
#cmakedefine _LARGE_FILES 1
|
||||
#cmakedefine _LARGEFILE_SOURCE 1
|
||||
#cmakedefine _LARGEFILE64_SOURCE 1
|
||||
#cmakedefine _FILE_OFFSET_BITS @_FILE_OFFSET_BITS@
|
||||
|
||||
#cmakedefine TIME_WITH_SYS_TIME 1
|
||||
|
||||
#cmakedefine STACK_DIRECTION @STACK_DIRECTION@
|
||||
|
||||
#define THREAD 1
|
||||
#define THREAD_SAFE_CLIENT 1
|
||||
|
||||
#define SYSTEM_TYPE "@SYSTEM_TYPE@"
|
||||
#define MACHINE_TYPE "@CMAKE_SYSTEM_PROCESSOR@"
|
||||
#cmakedefine HAVE_DTRACE 1
|
||||
|
||||
#cmakedefine SIGNAL_WITH_VIO_CLOSE 1
|
||||
|
||||
/* Windows stuff, mostly functions, that have Posix analogs but named differently */
|
||||
#cmakedefine S_IROTH @S_IROTH@
|
||||
#cmakedefine S_IFIFO @S_IFIFO@
|
||||
#cmakedefine IPPROTO_IPV6 @IPPROTO_IPV6@
|
||||
#cmakedefine IPV6_V6ONLY @IPV6_V6ONLY@
|
||||
#cmakedefine sigset_t @sigset_t@
|
||||
#cmakedefine mode_t @mode_t@
|
||||
#cmakedefine SIGQUIT @SIGQUIT@
|
||||
#cmakedefine SIGPIPE @SIGPIPE@
|
||||
#cmakedefine isnan @isnan@
|
||||
#cmakedefine finite @finite@
|
||||
#cmakedefine popen @popen@
|
||||
#cmakedefine pclose @pclose@
|
||||
#cmakedefine ssize_t @ssize_t@
|
||||
#cmakedefine strcasecmp @strcasecmp@
|
||||
#cmakedefine strncasecmp @strncasecmp@
|
||||
#cmakedefine snprintf @snprintf@
|
||||
#cmakedefine strtok_r @strtok_r@
|
||||
#cmakedefine strtoll @strtoll@
|
||||
#cmakedefine strtoull @strtoull@
|
||||
#cmakedefine vsnprintf @vsnprintf@
|
||||
#if (_MSC_VER > 1310)
|
||||
#define HAVE_SETENV
|
||||
#define setenv(a,b,c) _putenv_s(a,b)
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
MySQL features
|
||||
*/
|
||||
#cmakedefine ENABLED_LOCAL_INFILE 1
|
||||
#cmakedefine ENABLED_PROFILING 1
|
||||
#cmakedefine EXTRA_DEBUG 1
|
||||
#cmakedefine BACKUP_TEST 1
|
||||
#cmakedefine CYBOZU 1
|
||||
|
||||
/* Character sets and collations */
|
||||
#cmakedefine MYSQL_DEFAULT_CHARSET_NAME "latin1"
|
||||
#cmakedefine MYSQL_DEFAULT_COLLATION_NAME "latin1_swedish_ci"
|
||||
|
||||
#cmakedefine USE_MB 1
|
||||
#cmakedefine USE_MB_IDENT 1
|
||||
#cmakedefine USE_STRCOLL 1
|
||||
|
||||
/* This should mean case insensitive file system */
|
||||
#cmakedefine FN_NO_CASE_SENSE 1
|
||||
|
||||
#cmakedefine HAVE_CHARSET_armscii8 1
|
||||
#cmakedefine HAVE_CHARSET_ascii
|
||||
#cmakedefine HAVE_CHARSET_big5 1
|
||||
#cmakedefine HAVE_CHARSET_cp1250 1
|
||||
#cmakedefine HAVE_CHARSET_cp1251 1
|
||||
#cmakedefine HAVE_CHARSET_cp1256 1
|
||||
#cmakedefine HAVE_CHARSET_cp1257 1
|
||||
#cmakedefine HAVE_CHARSET_cp850 1
|
||||
#cmakedefine HAVE_CHARSET_cp852 1
|
||||
#cmakedefine HAVE_CHARSET_cp866 1
|
||||
#cmakedefine HAVE_CHARSET_cp932 1
|
||||
#cmakedefine HAVE_CHARSET_dec8 1
|
||||
#cmakedefine HAVE_CHARSET_eucjpms 1
|
||||
#cmakedefine HAVE_CHARSET_euckr 1
|
||||
#cmakedefine HAVE_CHARSET_gb2312 1
|
||||
#cmakedefine HAVE_CHARSET_gbk 1
|
||||
#cmakedefine HAVE_CHARSET_geostd8 1
|
||||
#cmakedefine HAVE_CHARSET_greek 1
|
||||
#cmakedefine HAVE_CHARSET_hebrew 1
|
||||
#cmakedefine HAVE_CHARSET_hp8 1
|
||||
#cmakedefine HAVE_CHARSET_keybcs2 1
|
||||
#cmakedefine HAVE_CHARSET_koi8r 1
|
||||
#cmakedefine HAVE_CHARSET_koi8u 1
|
||||
#cmakedefine HAVE_CHARSET_latin1 1
|
||||
#cmakedefine HAVE_CHARSET_latin2 1
|
||||
#cmakedefine HAVE_CHARSET_latin5 1
|
||||
#cmakedefine HAVE_CHARSET_latin7 1
|
||||
#cmakedefine HAVE_CHARSET_macce 1
|
||||
#cmakedefine HAVE_CHARSET_macroman 1
|
||||
#cmakedefine HAVE_CHARSET_sjis 1
|
||||
#cmakedefine HAVE_CHARSET_swe7 1
|
||||
#cmakedefine HAVE_CHARSET_tis620 1
|
||||
#cmakedefine HAVE_CHARSET_ucs2 1
|
||||
#cmakedefine HAVE_CHARSET_ujis 1
|
||||
#cmakedefine HAVE_CHARSET_utf8mb4 1
|
||||
#cmakedefine HAVE_CHARSET_utf8mb3 1
|
||||
#cmakedefine HAVE_CHARSET_utf8 1
|
||||
#cmakedefine HAVE_CHARSET_utf16 1
|
||||
#cmakedefine HAVE_CHARSET_utf32 1
|
||||
#cmakedefine HAVE_UCA_COLLATIONS 1
|
||||
#cmakedefine HAVE_COMPRESS 1
|
||||
|
||||
|
||||
/*
|
||||
Stuff that always need to be defined (compile breaks without it)
|
||||
*/
|
||||
#define HAVE_SPATIAL 1
|
||||
#define HAVE_RTREE_KEYS 1
|
||||
#define HAVE_QUERY_CACHE 1
|
||||
#define BIG_TABLES 1
|
||||
|
||||
/*
|
||||
Important storage engines (those that really need define
|
||||
WITH_<ENGINE>_STORAGE_ENGINE for the whole server)
|
||||
*/
|
||||
#cmakedefine WITH_MYISAM_STORAGE_ENGINE 1
|
||||
#cmakedefine WITH_MYISAMMRG_STORAGE_ENGINE 1
|
||||
#cmakedefine WITH_HEAP_STORAGE_ENGINE 1
|
||||
#cmakedefine WITH_CSV_STORAGE_ENGINE 1
|
||||
#cmakedefine WITH_PARTITION_STORAGE_ENGINE 1
|
||||
#cmakedefine WITH_PERFSCHEMA_STORAGE_ENGINE 1
|
||||
#cmakedefine WITH_NDBCLUSTER_STORAGE_ENGINE 1
|
||||
#if (WITH_NDBCLUSTER_STORAGE_ENGINE) && !defined(EMBEDDED_LIBRARY)
|
||||
#define HAVE_NDB_BINLOG 1
|
||||
#endif
|
||||
|
||||
#cmakedefine DEFAULT_MYSQL_HOME "@DEFAULT_MYSQL_HOME@"
|
||||
#cmakedefine SHAREDIR "@SHAREDIR@"
|
||||
#cmakedefine DEFAULT_BASEDIR "@DEFAULT_BASEDIR@"
|
||||
#cmakedefine MYSQL_DATADIR "@MYSQL_DATADIR@"
|
||||
#cmakedefine DEFAULT_CHARSET_HOME "@DEFAULT_CHARSET_HOME@"
|
||||
#cmakedefine PLUGINDIR "@PLUGINDIR@"
|
||||
#cmakedefine DEFAULT_SYSCONFDIR "@DEFAULT_SYSCONFDIR@"
|
||||
|
||||
#define PACKAGE "mysql"
|
||||
#define PACKAGE_BUGREPORT ""
|
||||
#define PACKAGE_NAME "MySQL Server"
|
||||
#define PACKAGE_STRING "MySQL Server @VERSION@"
|
||||
#define PACKAGE_TARNAME "mysql"
|
||||
#define PACKAGE_VERSION "@VERSION@"
|
||||
#define VERSION "@VERSION@"
|
||||
#define PROTOCOL_VERSION 10
|
||||
|
||||
|
||||
#endif
|
|
@ -13,11 +13,11 @@ define(CHARSETS_AVAILABLE1,armscii8 ascii big5 cp1250 cp1251 cp1256 cp1257)
|
|||
define(CHARSETS_AVAILABLE2,cp850 cp852 cp866 cp932 dec8 eucjpms euckr gb2312 gbk geostd8)
|
||||
define(CHARSETS_AVAILABLE3,greek hebrew hp8 keybcs2 koi8r koi8u)
|
||||
define(CHARSETS_AVAILABLE4,latin1 latin2 latin5 latin7 macce macroman)
|
||||
define(CHARSETS_AVAILABLE5,sjis swe7 tis620 ucs2 ujis utf8)
|
||||
define(CHARSETS_AVAILABLE5,sjis swe7 tis620 ucs2 ujis utf8mb4 utf8 utf16 utf32)
|
||||
|
||||
DEFAULT_CHARSET=latin1
|
||||
CHARSETS_AVAILABLE="CHARSETS_AVAILABLE0 CHARSETS_AVAILABLE1 CHARSETS_AVAILABLE2 CHARSETS_AVAILABLE3 CHARSETS_AVAILABLE4 CHARSETS_AVAILABLE5"
|
||||
CHARSETS_COMPLEX="big5 cp1250 cp932 eucjpms euckr gb2312 gbk latin1 latin2 sjis tis620 ucs2 ujis utf8"
|
||||
CHARSETS_COMPLEX="big5 cp1250 cp932 eucjpms euckr gb2312 gbk latin1 latin2 sjis tis620 ucs2 ujis utf8mb4 utf8 utf16 utf32"
|
||||
|
||||
AC_DIVERT_POP
|
||||
|
||||
|
@ -50,7 +50,7 @@ AC_ARG_WITH(extra-charsets,
|
|||
|
||||
AC_MSG_CHECKING("character sets")
|
||||
|
||||
CHARSETS="$default_charset latin1 utf8"
|
||||
CHARSETS="$default_charset latin1 utf8mb4 utf8"
|
||||
|
||||
if test "$extra_charsets" = no; then
|
||||
CHARSETS="$CHARSETS"
|
||||
|
@ -195,8 +195,23 @@ do
|
|||
AC_DEFINE([USE_MB], [1], [Use multi-byte character routines])
|
||||
AC_DEFINE(USE_MB_IDENT, 1)
|
||||
;;
|
||||
utf8mb4)
|
||||
AC_DEFINE(HAVE_CHARSET_utf8mb4, 1, [Define to enable utf8mb4])
|
||||
AC_DEFINE([USE_MB], 1, [Use multi-byte character routines])
|
||||
AC_DEFINE(USE_MB_IDENT, 1)
|
||||
;;
|
||||
utf8)
|
||||
AC_DEFINE(HAVE_CHARSET_utf8, 1, [Define to enable ut8])
|
||||
AC_DEFINE(HAVE_CHARSET_utf8, 1, [Define to enable utf8])
|
||||
AC_DEFINE([USE_MB], 1, [Use multi-byte character routines])
|
||||
AC_DEFINE(USE_MB_IDENT, 1)
|
||||
;;
|
||||
utf16)
|
||||
AC_DEFINE(HAVE_CHARSET_utf16, 1, [Define to enable utf16])
|
||||
AC_DEFINE([USE_MB], 1, [Use multi-byte character routines])
|
||||
AC_DEFINE(USE_MB_IDENT, 1)
|
||||
;;
|
||||
utf32)
|
||||
AC_DEFINE(HAVE_CHARSET_utf32, 1, [Define to enable utf32])
|
||||
AC_DEFINE([USE_MB], 1, [Use multi-byte character routines])
|
||||
AC_DEFINE(USE_MB_IDENT, 1)
|
||||
;;
|
||||
|
@ -381,6 +396,48 @@ case $default_charset in
|
|||
fi
|
||||
default_charset_collations="$UTFC"
|
||||
;;
|
||||
utf8mb4)
|
||||
default_charset_default_collation="utf8mb4_general_ci"
|
||||
define(UTFC1, utf8mb4_general_ci utf8mb4_bin)
|
||||
define(UTFC2, utf8mb4_czech_ci utf8mb4_danish_ci)
|
||||
define(UTFC3, utf8mb4_esperanto_ci utf8mb4_estonian_ci utf8mb4_hungarian_ci)
|
||||
define(UTFC4, utf8mb4_icelandic_ci utf8mb4_latvian_ci utf8mb4_lithuanian_ci)
|
||||
define(UTFC5, utf8mb4_persian_ci utf8mb4_polish_ci utf8mb4_romanian_ci)
|
||||
define(UTFC6, utf8mb4_sinhala_ci utf8mb4_slovak_ci utf8mb4_slovenian_ci)
|
||||
define(UTFC7, utf8mb4_spanish2_ci utf8mb4_spanish_ci)
|
||||
define(UTFC8, utf8mb4_swedish_ci utf8mb4_turkish_ci)
|
||||
define(UTFC9, utf8mb4_unicode_ci)
|
||||
UTFC="UTFC1 UTFC2 UTFC3 UTFC4 UTFC5 UTFC6 UTFC7 UTFC8 UTFC9"
|
||||
default_charset_collations="$UTFC"
|
||||
;;
|
||||
utf16)
|
||||
default_charset_default_collation="utf16_general_ci"
|
||||
define(UTFC1, utf16_general_ci utf16_bin)
|
||||
define(UTFC2, utf16_czech_ci utf16_danish_ci)
|
||||
define(UTFC3, utf16_esperanto_ci utf16_estonian_ci utf16_hungarian_ci)
|
||||
define(UTFC4, utf16_icelandic_ci utf16_latvian_ci utf16_lithuanian_ci)
|
||||
define(UTFC5, utf16_persian_ci utf16_polish_ci utf16_romanian_ci)
|
||||
define(UTFC6, utf16_sinhala_ci utf16_slovak_ci utf16_slovenian_ci)
|
||||
define(UTFC7, utf16_spanish2_ci utf16_spanish_ci)
|
||||
define(UTFC8, utf16_swedish_ci utf16_turkish_ci)
|
||||
define(UTFC9, utf16_unicode_ci)
|
||||
UTFC="UTFC1 UTFC2 UTFC3 UTFC4 UTFC5 UTFC6 UTFC7 UTFC8 UTFC9"
|
||||
default_charset_collations="$UTFC"
|
||||
;;
|
||||
utf32)
|
||||
default_charset_default_collation="utf32_general_ci"
|
||||
define(UTFC1, utf32_general_ci utf32_bin)
|
||||
define(UTFC2, utf32_czech_ci utf32_danish_ci)
|
||||
define(UTFC3, utf32_esperanto_ci utf32_estonian_ci utf32_hungarian_ci)
|
||||
define(UTFC4, utf32_icelandic_ci utf32_latvian_ci utf32_lithuanian_ci)
|
||||
define(UTFC5, utf32_persian_ci utf32_polish_ci utf32_romanian_ci)
|
||||
define(UTFC6, utf32_sinhala_ci utf32_slovak_ci utf32_slovenian_ci)
|
||||
define(UTFC7, utf32_spanish2_ci utf32_spanish_ci)
|
||||
define(UTFC8, utf32_swedish_ci utf32_turkish_ci)
|
||||
define(UTFC9, utf32_unicode_ci)
|
||||
UTFC="UTFC1 UTFC2 UTFC3 UTFC4 UTFC5 UTFC6 UTFC7 UTFC8 UTFC9"
|
||||
default_charset_collations="$UTFC"
|
||||
;;
|
||||
*)
|
||||
AC_MSG_ERROR([Charset $cs not available. (Available are: $CHARSETS_AVAILABLE).
|
||||
See the Installation chapter in the Reference Manual.])
|
||||
|
|
|
@ -460,7 +460,11 @@ dnl Although this is "pretty", it breaks libmysqld build
|
|||
])
|
||||
])
|
||||
])
|
||||
mysql_plugin_defs="$mysql_plugin_defs, [builtin_]$2[_plugin]"
|
||||
m4_ifdef([$9],[
|
||||
mysql_mandatory_plugins="$mysql_mandatory_plugins [builtin_]$2[_plugin],"
|
||||
],[
|
||||
mysql_optional_plugins="$mysql_optional_plugins [builtin_]$2[_plugin],"
|
||||
])
|
||||
[with_plugin_]$2=yes
|
||||
AC_MSG_RESULT([yes])
|
||||
m4_ifdef([$11],[
|
||||
|
|
1007
configure.cmake
Normal file
1007
configure.cmake
Normal file
File diff suppressed because it is too large
Load diff
333
configure.in
333
configure.in
|
@ -1,18 +1,33 @@
|
|||
dnl -*- ksh -*-
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
|
||||
# Copyright (C) 2008-2009 Sun Microsystems, Inc
|
||||
#
|
||||
# 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
|
||||
|
||||
# Minimum Autoconf version required.
|
||||
AC_PREREQ(2.59)
|
||||
|
||||
dnl Various people throughout the community may parse configure.in to
|
||||
dnl get the MySQL version from the source branch. If the formatting
|
||||
dnl of this line is going to be changed, please announce the change to
|
||||
dnl internals@lists.mysql.com in advance of pushing the change.
|
||||
dnl
|
||||
dnl Remember to also update version.c in ndb.
|
||||
dnl When changing major version number please also check switch statement
|
||||
dnl in client/mysqlbinlog.cc:check_master_version().
|
||||
AC_INIT([MySQL Server], [5.5.3-m2], [], [mysql])
|
||||
# Various people throughout the community may parse configure.in to
|
||||
# get the MySQL version from the source branch. If the formatting
|
||||
# of this line is going to be changed, please announce the change to
|
||||
# internals@lists.mysql.com in advance of pushing the change.
|
||||
#
|
||||
# Remember to also update version.c in ndb.
|
||||
# When changing major version number please also check switch statement
|
||||
# in client/mysqlbinlog.cc:check_master_version().
|
||||
AC_INIT([MySQL Server], [5.5.3-m3], [], [mysql])
|
||||
AC_CONFIG_SRCDIR([sql/mysqld.cc])
|
||||
AC_CANONICAL_SYSTEM
|
||||
# USTAR format gives us the possibility to store longer path names in
|
||||
|
@ -373,6 +388,21 @@ case "$target_os" in
|
|||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
# The following is required for portable results of floating point calculations
|
||||
# on PowerPC. The same must also be done for IA-64, but this options is missing
|
||||
# in the IA-64 gcc backend.
|
||||
|
||||
if test "$GCC" = "yes"
|
||||
then
|
||||
case "$host_cpu" in
|
||||
*ppc* | *powerpc*)
|
||||
CFLAGS="$CFLAGS -mno-fused-madd"
|
||||
CXXFLAGS="$CXXFLAGS -mno-fused-madd"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
AC_SUBST(CC)
|
||||
AC_SUBST(CFLAGS)
|
||||
AC_SUBST(CXX)
|
||||
|
@ -814,7 +844,7 @@ AC_HEADER_DIRENT
|
|||
AC_HEADER_STDC
|
||||
AC_HEADER_SYS_WAIT
|
||||
AC_CHECK_HEADERS(fcntl.h fenv.h float.h floatingpoint.h ieeefp.h limits.h \
|
||||
memory.h pwd.h select.h \
|
||||
memory.h pwd.h select.h poll.h \
|
||||
stdlib.h stddef.h \
|
||||
strings.h string.h synch.h sys/mman.h sys/socket.h netinet/in.h arpa/inet.h \
|
||||
sys/timeb.h sys/types.h sys/un.h sys/vadvise.h sys/wait.h term.h \
|
||||
|
@ -878,8 +908,108 @@ AC_CHECK_DECLS(MHA_MAPSIZE_VA,
|
|||
#include <sys/mman.h>
|
||||
]
|
||||
)
|
||||
fi
|
||||
|
||||
dnl Use of ALARMs to wakeup on timeout on sockets
|
||||
dnl
|
||||
dnl This feature makes use of a mutex and is a scalability hog we
|
||||
dnl try to avoid using. However we need support for SO_SNDTIMEO and
|
||||
dnl SO_RCVTIMEO socket options for this to work. So we will check
|
||||
dnl if this feature is supported by a simple AC_RUN_IFELSE macro. However
|
||||
dnl on some OS's there is support for setting those variables but
|
||||
dnl they are silently ignored. For those OS's we will not attempt
|
||||
dnl o use SO_SNDTIMEO and SO_RCVTIMEO even if it is said to work.
|
||||
dnl See Bug#29093 for the problem with SO_SND/RCVTIMEO on HP/UX.
|
||||
dnl To use alarm is simple, simply avoid setting anything.
|
||||
|
||||
|
||||
AC_CACHE_CHECK([whether SO_SNDTIMEO and SO_RCVTIMEO work],
|
||||
[mysql_cv_socket_timeout],
|
||||
[AC_RUN_IFELSE(
|
||||
[AC_LANG_PROGRAM([[
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/time.h>
|
||||
]],[[
|
||||
int fd = socket(AF_INET, SOCK_STREAM, 0);
|
||||
struct timeval tv;
|
||||
int ret= 0;
|
||||
tv.tv_sec= 2;
|
||||
tv.tv_usec= 0;
|
||||
ret|= setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, &tv, sizeof(tv));
|
||||
ret|= setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv));
|
||||
return !!ret;
|
||||
]])],
|
||||
[mysql_cv_socket_timeout=yes],
|
||||
[mysql_cv_socket_timeout=no],
|
||||
[mysql_cv_socket_timeout=no
|
||||
AC_MSG_WARN([Socket timeout options disabled due to cross-compiling])])
|
||||
])
|
||||
|
||||
use_alarm=yes
|
||||
|
||||
if test "$mysql_cv_socket_timeout" = yes; then
|
||||
case $SYSTEM_TYPE in
|
||||
dnl We trust the result from the following systems
|
||||
*solaris*) use_alarm=no ;;
|
||||
*freebsd*) use_alarm=no ;;
|
||||
*darwin*) use_alarm=no ;;
|
||||
*)
|
||||
dnl We trust the result from Linux also
|
||||
if test "$TARGET_LINUX" = "true"; then
|
||||
use_alarm=no
|
||||
fi
|
||||
dnl We trust no one else for the moment
|
||||
dnl (Windows is hardcoded to not use alarms)
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
AC_ARG_WITH(alarm,
|
||||
AS_HELP_STRING([--with-alarm], [Use alarm to implement socket timeout.]),
|
||||
[use_alarm=$withval], [])
|
||||
|
||||
AC_MSG_CHECKING(whether to use alarms to implement socket timeout)
|
||||
if test "$use_alarm" = no ; then
|
||||
AC_DEFINE([NO_ALARM], [1], [No need to use alarm for socket timeout])
|
||||
AC_DEFINE([SIGNAL_WITH_VIO_CLOSE], [1], [Need to use vio close for kill connection])
|
||||
fi
|
||||
AC_MSG_RESULT($use_alarm)
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Check for IPv6 support
|
||||
#--------------------------------------------------------------------
|
||||
|
||||
AC_CHECK_HEADERS(netinet/in6.h)
|
||||
|
||||
AC_CHECK_TYPES([struct sockaddr_in6, struct in6_addr],
|
||||
[have_in6_types=yes],
|
||||
[have_in6_types=no],
|
||||
[[
|
||||
#ifdef WIN32
|
||||
#include <winsock2.h>
|
||||
#else
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_NETINET_IN6_H
|
||||
#include <netinet/in6.h>
|
||||
#endif
|
||||
]])
|
||||
|
||||
AC_MSG_CHECKING([for IPv6 support])
|
||||
|
||||
AC_ARG_ENABLE(ipv6,
|
||||
AS_HELP_STRING([--disable-ipv6], [Disable support for IPv6 networking]),
|
||||
[disable_ipv6=yes], [disable_ipv6=no])
|
||||
|
||||
if test x"$disable_ipv6" = xyes -o x"$have_in6_types" = xno; then
|
||||
AC_MSG_RESULT([no])
|
||||
else
|
||||
AC_DEFINE([HAVE_IPV6], [1], [Define if IPv6 networking support is present])
|
||||
AC_MSG_RESULT([yes])
|
||||
fi
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
|
@ -980,12 +1110,6 @@ AC_CHECK_TYPES([int8, uint8, int16, uint16, int32, uint32, int64, uint64,
|
|||
uchar, uint, ulong],[],[], [
|
||||
#include <sys/types.h>
|
||||
])
|
||||
AC_CHECK_TYPES([in_addr_t], [], [], [
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
])
|
||||
AC_CHECK_TYPES([fp_except], [], [], [
|
||||
#include <sys/types.h>
|
||||
#include <ieeefp.h>
|
||||
|
@ -1769,64 +1893,93 @@ then
|
|||
fi
|
||||
|
||||
AC_ARG_WITH([atomic-ops],
|
||||
AC_HELP_STRING([--with-atomic-ops=rwlocks|smp|up],
|
||||
[Implement atomic operations using pthread rwlocks or atomic CPU
|
||||
instructions for multi-processor (default) or uniprocessor
|
||||
configuration]), , [with_atomic_ops=smp])
|
||||
AS_HELP_STRING([--with-atomic-ops=rwlocks|smp|up],
|
||||
[Implement atomic operations using pthread rwlocks or atomic CPU
|
||||
instructions for multi-processor or uniprocessor
|
||||
configuration. By default gcc built-in sync functions are used,
|
||||
if available and 'smp' configuration otherwise.]))
|
||||
case "$with_atomic_ops" in
|
||||
"up") AC_DEFINE([MY_ATOMIC_MODE_DUMMY], [1],
|
||||
[Assume single-CPU mode, no concurrency]) ;;
|
||||
"rwlocks") AC_DEFINE([MY_ATOMIC_MODE_RWLOCKS], [1],
|
||||
[Use pthread rwlocks for atomic ops]) ;;
|
||||
"smp") ;;
|
||||
"")
|
||||
;;
|
||||
*) AC_MSG_ERROR(["$with_atomic_ops" is not a valid value for --with-atomic-ops]) ;;
|
||||
esac
|
||||
|
||||
AC_CACHE_CHECK([whether the compiler provides atomic builtins],
|
||||
[mysql_cv_gcc_atomic_builtins], [AC_TRY_RUN([
|
||||
int main()
|
||||
{
|
||||
int foo= -10; int bar= 10;
|
||||
if (!__sync_fetch_and_add(&foo, bar) || foo)
|
||||
return -1;
|
||||
bar= __sync_lock_test_and_set(&foo, bar);
|
||||
if (bar || foo != 10)
|
||||
return -1;
|
||||
bar= __sync_val_compare_and_swap(&bar, foo, 15);
|
||||
if (bar)
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
], [mysql_cv_gcc_atomic_builtins=yes],
|
||||
[mysql_cv_gcc_atomic_builtins],
|
||||
[AC_RUN_IFELSE(
|
||||
[AC_LANG_PROGRAM(
|
||||
[
|
||||
],
|
||||
[[
|
||||
int foo= -10; int bar= 10;
|
||||
long long int foo64= -10; long long int bar64= 10;
|
||||
if (!__sync_fetch_and_add(&foo, bar) || foo)
|
||||
return -1;
|
||||
bar= __sync_lock_test_and_set(&foo, bar);
|
||||
if (bar || foo != 10)
|
||||
return -1;
|
||||
bar= __sync_val_compare_and_swap(&bar, foo, 15);
|
||||
if (bar)
|
||||
return -1;
|
||||
if (!__sync_fetch_and_add(&foo64, bar64) || foo64)
|
||||
return -1;
|
||||
bar64= __sync_lock_test_and_set(&foo64, bar64);
|
||||
if (bar64 || foo64 != 10)
|
||||
return -1;
|
||||
bar64= __sync_val_compare_and_swap(&bar64, foo, 15);
|
||||
if (bar64)
|
||||
return -1;
|
||||
return 0;
|
||||
]]
|
||||
)],
|
||||
[mysql_cv_gcc_atomic_builtins=yes],
|
||||
[mysql_cv_gcc_atomic_builtins=no],
|
||||
[mysql_cv_gcc_atomic_builtins=no])])
|
||||
|
||||
[mysql_cv_gcc_atomic_builtins=no]
|
||||
)])
|
||||
if test "x$mysql_cv_gcc_atomic_builtins" = xyes; then
|
||||
AC_DEFINE(HAVE_GCC_ATOMIC_BUILTINS, 1,
|
||||
[Define to 1 if compiler provides atomic builtins.])
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK([whether the OS provides atomic_* functions like Solaris],
|
||||
[mysql_cv_solaris_atomic], [AC_TRY_RUN([
|
||||
#include <atomic.h>
|
||||
int
|
||||
main()
|
||||
{
|
||||
int foo = -10; int bar = 10;
|
||||
if (atomic_add_int_nv((uint_t *)&foo, bar) || foo)
|
||||
return -1;
|
||||
bar = atomic_swap_uint((uint_t *)&foo, (uint_t)bar);
|
||||
if (bar || foo != 10)
|
||||
return -1;
|
||||
bar = atomic_cas_uint((uint_t *)&bar, (uint_t)foo, 15);
|
||||
if (bar)
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
], [mysql_cv_solaris_atomic=yes],
|
||||
[mysql_cv_solaris_atomic],
|
||||
[AC_RUN_IFELSE(
|
||||
[AC_LANG_PROGRAM(
|
||||
[[
|
||||
#include <atomic.h>
|
||||
]],
|
||||
[[
|
||||
int foo = -10; int bar = 10;
|
||||
int64_t foo64 = -10; int64_t bar64 = 10;
|
||||
if (atomic_add_int_nv((uint_t *)&foo, bar) || foo)
|
||||
return -1;
|
||||
bar = atomic_swap_uint((uint_t *)&foo, (uint_t)bar);
|
||||
if (bar || foo != 10)
|
||||
return -1;
|
||||
bar = atomic_cas_uint((uint_t *)&bar, (uint_t)foo, 15);
|
||||
if (bar)
|
||||
return -1;
|
||||
if (atomic_add_64_nv((volatile uint64_t *)&foo64, bar64) || foo64)
|
||||
return -1;
|
||||
bar64 = atomic_swap_64((volatile uint64_t *)&foo64, (uint64_t)bar64);
|
||||
if (bar64 || foo64 != 10)
|
||||
return -1;
|
||||
bar64 = atomic_cas_64((volatile uint64_t *)&bar64, (uint_t)foo64, 15);
|
||||
if (bar64)
|
||||
return -1;
|
||||
atomic_or_64((volatile uint64_t *)&bar64, 0);
|
||||
return 0;
|
||||
]]
|
||||
)],
|
||||
[mysql_cv_solaris_atomic=yes],
|
||||
[mysql_cv_solaris_atomic=no],
|
||||
[mysql_cv_solaris_atomic=no])])
|
||||
|
||||
[mysql_cv_solaris_atomic=no]
|
||||
)])
|
||||
if test "x$mysql_cv_solaris_atomic" = xyes; then
|
||||
AC_DEFINE(HAVE_SOLARIS_ATOMIC, 1,
|
||||
[Define to 1 if OS provides atomic_* functions like Solaris.])
|
||||
|
@ -2111,19 +2264,18 @@ AC_FUNC_VPRINTF
|
|||
|
||||
AC_CHECK_FUNCS(alarm bcmp bfill bmove bsearch bzero \
|
||||
chsize cuserid fchmod fcntl \
|
||||
fconvert fdatasync fesetround finite fpresetsticky fpsetmask fsync ftruncate \
|
||||
fdatasync fesetround finite fpresetsticky fpsetmask fsync ftruncate \
|
||||
getcwd gethostbyaddr_r gethostbyname_r getpass getpassphrase getpwnam \
|
||||
getpwuid getrlimit getrusage getwd index initgroups isnan \
|
||||
localtime_r gethrtime gmtime_r \
|
||||
locking longjmp lrand48 madvise mallinfo memcpy memmove \
|
||||
mkstemp mlockall perror poll pread pthread_attr_create mmap mmap64 getpagesize \
|
||||
pthread_attr_getstacksize pthread_attr_setprio pthread_attr_setschedparam \
|
||||
pthread_attr_setstacksize pthread_condattr_create pthread_getsequence_np \
|
||||
pthread_key_delete pthread_rwlock_rdlock pthread_setprio \
|
||||
pthread_setprio_np pthread_setschedparam pthread_sigmask readlink \
|
||||
realpath rename rint rwlock_init setupterm \
|
||||
pthread_attr_getstacksize pthread_attr_setstacksize pthread_condattr_create \
|
||||
pthread_getsequence_np pthread_key_delete pthread_rwlock_rdlock \
|
||||
pthread_rwlockattr_setkind_np pthread_sigmask \
|
||||
readlink realpath rename rint rwlock_init setupterm \
|
||||
shmget shmat shmdt shmctl sigaction sigemptyset sigaddset \
|
||||
sighold sigset sigthreadmask port_create sleep \
|
||||
sighold sigset sigthreadmask port_create sleep thr_yield \
|
||||
snprintf socket stpcpy strcasecmp strerror strsignal strnlen strpbrk strstr \
|
||||
strtol strtoll strtoul strtoull tell tempnam thr_setconcurrency vidattr \
|
||||
posix_fallocate backtrace backtrace_symbols backtrace_symbols_fd printstack)
|
||||
|
@ -2892,8 +3044,8 @@ AC_SUBST(server_scripts)
|
|||
|
||||
AC_SUBST(mysql_plugin_dirs)
|
||||
AC_SUBST(mysql_plugin_libs)
|
||||
AC_SUBST(mysql_plugin_defs)
|
||||
|
||||
AC_SUBST(mysql_optional_plugins)
|
||||
AC_SUBST(mysql_mandatory_plugins)
|
||||
|
||||
# Now that sql_client_dirs and sql_server_dirs are stable, determine the union.
|
||||
# We support client-only builds by "--without-server", but not vice versa,
|
||||
|
@ -2925,7 +3077,54 @@ case $SYSTEM_TYPE in
|
|||
esac
|
||||
AC_SUBST(MAKE_BINARY_DISTRIBUTION_OPTIONS)
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Support for WL#2373 (Use cycle counter for timing)
|
||||
#--------------------------------------------------------------------
|
||||
|
||||
AC_CHECK_HEADERS(time.h)
|
||||
AC_CHECK_HEADERS(sys/time.h)
|
||||
AC_CHECK_HEADERS(sys/times.h)
|
||||
AC_CHECK_HEADERS(asm/msr.h)
|
||||
#msr.h has rdtscll()
|
||||
|
||||
AC_CHECK_HEADERS(ia64intrin.h)
|
||||
|
||||
AC_CHECK_FUNCS(times)
|
||||
AC_CHECK_FUNCS(gettimeofday)
|
||||
AC_CHECK_FUNCS(read_real_time)
|
||||
# This should work on AIX.
|
||||
|
||||
AC_CHECK_FUNCS(ftime)
|
||||
# This is still a normal call for milliseconds.
|
||||
|
||||
AC_CHECK_FUNCS(time)
|
||||
# We can use time() on Macintosh if there is no ftime().
|
||||
|
||||
AC_CHECK_FUNCS(rdtscll)
|
||||
# I doubt that we'll ever reach the check for this.
|
||||
|
||||
# When compiling with Sun Studio C / C++ we need to include
|
||||
# my_timer_cycles.il, an "inline templates" separate file,
|
||||
# on the command line. It has assembly code, "rd %tick" for
|
||||
# SPARC or "rdtsc" for x86.
|
||||
RDTSC_SPARC_ASSEMBLY=""
|
||||
case $CC_VERSION in
|
||||
*Sun*C*)
|
||||
RDTSC_SPARC_ASSEMBLY="my_timer_cycles.il"
|
||||
;;
|
||||
esac
|
||||
case $CXX_VERSION in
|
||||
*Sun*C++*)
|
||||
RDTSC_SPARC_ASSEMBLY="my_timer_cycles.il"
|
||||
;;
|
||||
esac
|
||||
|
||||
AC_SUBST([RDTSC_SPARC_ASSEMBLY])
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Output results
|
||||
#--------------------------------------------------------------------
|
||||
|
||||
if test -d "$srcdir/pstack" ; then
|
||||
AC_CONFIG_FILES(pstack/Makefile pstack/aout/Makefile)
|
||||
fi
|
||||
|
@ -2948,7 +3147,9 @@ AC_CONFIG_FILES(Makefile extra/Makefile mysys/Makefile dnl
|
|||
libmysqld/Makefile libmysqld/examples/Makefile dnl
|
||||
mysql-test/Makefile mysql-test/lib/My/SafeProcess/Makefile dnl
|
||||
netware/Makefile sql-bench/Makefile dnl
|
||||
include/mysql_version.h plugin/Makefile win/Makefile)
|
||||
include/mysql_version.h plugin/Makefile win/Makefile
|
||||
cmake/Makefile
|
||||
)
|
||||
|
||||
AC_CONFIG_COMMANDS([default], , test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h)
|
||||
|
||||
|
|
|
@ -13,11 +13,10 @@
|
|||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/dbug)
|
||||
|
||||
SET(DBUG_SOURCES dbug.c factorial.c sanity.c)
|
||||
|
||||
IF(NOT SOURCE_SUBLIBS)
|
||||
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
|
||||
ADD_LIBRARY(dbug ${DBUG_SOURCES})
|
||||
ENDIF(NOT SOURCE_SUBLIBS)
|
||||
INCLUDE_DIRECTORIES(
|
||||
${CMAKE_SOURCE_DIR}/dbug
|
||||
${CMAKE_SOURCE_DIR}/include
|
||||
)
|
||||
SET(DBUG_SOURCES dbug.c sanity.c)
|
||||
ADD_CONVENIENCE_LIBRARY(dbug ${DBUG_SOURCES})
|
||||
TARGET_LINK_LIBRARIES(dbug mysys)
|
||||
|
|
|
@ -1355,14 +1355,18 @@ void _db_doprnt_(const char *format,...)
|
|||
}
|
||||
|
||||
/*
|
||||
* This function is intended as a
|
||||
* vfprintf clone with consistent, platform independent output for
|
||||
* problematic formats like %p, %zd and %lld.
|
||||
* However: full functionality for my_vsnprintf has not been backported yet,
|
||||
* so code using "%g" or "%f" will have undefined behaviour.
|
||||
*/
|
||||
static void DbugVfprintf(FILE *stream, const char* format, va_list args)
|
||||
{
|
||||
char cvtbuf[1024];
|
||||
size_t len;
|
||||
len = my_vsnprintf(cvtbuf, sizeof(cvtbuf), format, args);
|
||||
// Do not use my_vsnprintf, it does not support "%g".
|
||||
len = vsnprintf(cvtbuf, sizeof(cvtbuf), format, args);
|
||||
(void) fprintf(stream, "%s\n", cvtbuf);
|
||||
}
|
||||
|
||||
|
|
|
@ -12,42 +12,69 @@
|
|||
# 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
|
||||
INCLUDE("${PROJECT_SOURCE_DIR}/win/mysql_manifest.cmake")
|
||||
|
||||
|
||||
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
|
||||
INCLUDE_DIRECTORIES(
|
||||
${CMAKE_SOURCE_DIR}/include
|
||||
${ZLIB_INCLUDE_DIR}
|
||||
# Following is for perror, in case NDB is compiled in.
|
||||
${CMAKE_SOURCE_DIR}/storage/ndb/include
|
||||
${CMAKE_SOURCE_DIR}/storage/ndb/include/util
|
||||
${CMAKE_SOURCE_DIR}/storage/ndb/include/ndbapi
|
||||
${CMAKE_SOURCE_DIR}/storage/ndb/include/portlib
|
||||
${CMAKE_SOURCE_DIR}/storage/ndb/include/mgmapi)
|
||||
|
||||
ADD_EXECUTABLE(comp_err comp_err.c)
|
||||
TARGET_LINK_LIBRARIES(comp_err dbug mysys strings zlib)
|
||||
|
||||
GET_TARGET_PROPERTY(COMP_ERR_EXE comp_err LOCATION)
|
||||
IF(NOT CMAKE_CROSSCOMPILING)
|
||||
ADD_EXECUTABLE(comp_err comp_err.c)
|
||||
TARGET_LINK_LIBRARIES(comp_err mysys)
|
||||
ENDIF()
|
||||
|
||||
ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_SOURCE_DIR}/include/mysqld_error.h
|
||||
COMMAND ${COMP_ERR_EXE}
|
||||
ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_BINARY_DIR}/include/mysqld_error.h
|
||||
${PROJECT_BINARY_DIR}/sql/share/english/errmsg.sys
|
||||
COMMAND comp_err
|
||||
--charset=${PROJECT_SOURCE_DIR}/sql/share/charsets
|
||||
--out-dir=${PROJECT_SOURCE_DIR}/sql/share/
|
||||
--header_file=${PROJECT_SOURCE_DIR}/include/mysqld_error.h
|
||||
--name_file=${PROJECT_SOURCE_DIR}/include/mysqld_ername.h
|
||||
--state_file=${PROJECT_SOURCE_DIR}/include/sql_state.h
|
||||
--out-dir=${PROJECT_BINARY_DIR}/sql/share/
|
||||
--header_file=${PROJECT_BINARY_DIR}/include/mysqld_error.h
|
||||
--name_file=${PROJECT_BINARY_DIR}/include/mysqld_ername.h
|
||||
--state_file=${PROJECT_BINARY_DIR}/include/sql_state.h
|
||||
--in_file=${PROJECT_SOURCE_DIR}/sql/share/errmsg-utf8.txt
|
||||
DEPENDS comp_err ${PROJECT_SOURCE_DIR}/sql/share/errmsg-utf8.txt)
|
||||
DEPENDS ${PROJECT_SOURCE_DIR}/sql/share/errmsg-utf8.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/comp_err.c)
|
||||
|
||||
ADD_CUSTOM_TARGET(GenError
|
||||
ALL
|
||||
DEPENDS ${PROJECT_SOURCE_DIR}/include/mysqld_error.h)
|
||||
DEPENDS
|
||||
${PROJECT_BINARY_DIR}/include/mysqld_error.h
|
||||
${PROJECT_BINARY_DIR}/sql/share/english/errmsg.sys
|
||||
${PROJECT_SOURCE_DIR}/sql/share/errmsg-utf8.txt)
|
||||
|
||||
ADD_EXECUTABLE(my_print_defaults my_print_defaults.c)
|
||||
TARGET_LINK_LIBRARIES(my_print_defaults strings mysys dbug taocrypt)
|
||||
MYSQL_ADD_EXECUTABLE(my_print_defaults my_print_defaults.c)
|
||||
TARGET_LINK_LIBRARIES(my_print_defaults mysys)
|
||||
|
||||
ADD_EXECUTABLE(perror perror.c)
|
||||
TARGET_LINK_LIBRARIES(perror strings mysys dbug)
|
||||
MYSQL_ADD_EXECUTABLE(perror perror.c)
|
||||
ADD_DEPENDENCIES(perror GenError)
|
||||
TARGET_LINK_LIBRARIES(perror mysys)
|
||||
|
||||
ADD_EXECUTABLE(resolveip resolveip.c)
|
||||
TARGET_LINK_LIBRARIES(resolveip strings mysys dbug)
|
||||
MYSQL_ADD_EXECUTABLE(resolveip resolveip.c)
|
||||
TARGET_LINK_LIBRARIES(resolveip mysys)
|
||||
IF(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
|
||||
INCLUDE(CheckFunctionExists)
|
||||
INCLUDE(CheckLibraryExists)
|
||||
MY_SEARCH_LIBS(inet_aton "nsl;socket;resolv" SOLARIS_NSL)
|
||||
TARGET_LINK_LIBRARIES(resolveip ${SOLARIS_NSL})
|
||||
ENDIF()
|
||||
|
||||
ADD_EXECUTABLE(replace replace.c)
|
||||
TARGET_LINK_LIBRARIES(replace strings mysys dbug)
|
||||
|
||||
IF(EMBED_MANIFESTS)
|
||||
MYSQL_EMBED_MANIFEST("myTest" "asInvoker")
|
||||
ENDIF(EMBED_MANIFESTS)
|
||||
MYSQL_ADD_EXECUTABLE(replace replace.c)
|
||||
TARGET_LINK_LIBRARIES(replace mysys)
|
||||
IF(UNIX)
|
||||
MYSQL_ADD_EXECUTABLE(innochecksum innochecksum.c)
|
||||
|
||||
MYSQL_ADD_EXECUTABLE(resolve_stack_dump resolve_stack_dump.c)
|
||||
TARGET_LINK_LIBRARIES(resolve_stack_dump mysys)
|
||||
|
||||
MYSQL_ADD_EXECUTABLE(mysql_waitpid mysql_waitpid.c)
|
||||
TARGET_LINK_LIBRARIES(mysql_waitpid mysys)
|
||||
ENDIF()
|
||||
|
||||
|
|
|
@ -199,11 +199,34 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
|
||||
|
||||
static void print_escaped_string(FILE *f, const char *str)
|
||||
{
|
||||
const char *tmp = str;
|
||||
|
||||
while (tmp[0] != 0)
|
||||
{
|
||||
switch (tmp[0])
|
||||
{
|
||||
case '\\': fprintf(f, "\\\\"); break;
|
||||
case '\'': fprintf(f, "\\\'"); break;
|
||||
case '\"': fprintf(f, "\\\""); break;
|
||||
case '\n': fprintf(f, "\\n"); break;
|
||||
case '\r': fprintf(f, "\\r"); break;
|
||||
default: fprintf(f, "%c", tmp[0]);
|
||||
}
|
||||
tmp++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int create_header_files(struct errors *error_head)
|
||||
{
|
||||
uint er_last;
|
||||
FILE *er_definef, *sql_statef, *er_namef;
|
||||
struct errors *tmp_error;
|
||||
struct message *er_msg;
|
||||
const char *er_text;
|
||||
|
||||
DBUG_ENTER("create_header_files");
|
||||
LINT_INIT(er_last);
|
||||
|
||||
|
@ -245,9 +268,12 @@ static int create_header_files(struct errors *error_head)
|
|||
"{ %-40s,\"%s\", \"%s\" },\n", tmp_error->er_name,
|
||||
tmp_error->sql_code1, tmp_error->sql_code2);
|
||||
/*generating er_name file */
|
||||
fprintf(er_namef, "{ \"%s\", %d },\n", tmp_error->er_name,
|
||||
tmp_error->d_code);
|
||||
|
||||
er_msg= find_message(tmp_error, default_language, 0);
|
||||
er_text = (er_msg ? er_msg->text : "");
|
||||
fprintf(er_namef, "{ \"%s\", %d, \"", tmp_error->er_name,
|
||||
tmp_error->d_code);
|
||||
print_escaped_string(er_namef, er_text);
|
||||
fprintf(er_namef, "\" },\n");
|
||||
}
|
||||
/* finishing off with mysqld_error.h */
|
||||
fprintf(er_definef, "#define ER_ERROR_LAST %d\n", er_last);
|
||||
|
@ -1041,11 +1067,11 @@ static char *parse_text_line(char *pos)
|
|||
switch (*++pos) {
|
||||
case '\\':
|
||||
case '"':
|
||||
VOID(memmove (pos - 1, pos, len - (row - pos)));
|
||||
(void) memmove (pos - 1, pos, len - (row - pos));
|
||||
break;
|
||||
case 'n':
|
||||
pos[-1]= '\n';
|
||||
VOID(memmove (pos, pos + 1, len - (row - pos)));
|
||||
(void) memmove (pos, pos + 1, len - (row - pos));
|
||||
break;
|
||||
default:
|
||||
if (*pos >= '0' && *pos < '8')
|
||||
|
@ -1055,10 +1081,10 @@ static char *parse_text_line(char *pos)
|
|||
nr= nr * 8 + (*(pos++) - '0');
|
||||
pos -= i;
|
||||
pos[-1]= nr;
|
||||
VOID(memmove (pos, pos + i, len - (row - pos)));
|
||||
(void) memmove (pos, pos + i, len - (row - pos));
|
||||
}
|
||||
else if (*pos)
|
||||
VOID(memmove (pos - 1, pos, len - (row - pos))); /* Remove '\' */
|
||||
(void) memmove (pos - 1, pos, len - (row - pos)); /* Remove '\' */
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -189,6 +189,7 @@ int main(int argc, char **argv)
|
|||
config_file);
|
||||
}
|
||||
error= 2;
|
||||
exit(error);
|
||||
}
|
||||
|
||||
for (argument= arguments+1 ; *argument ; argument++)
|
||||
|
@ -197,5 +198,5 @@ int main(int argc, char **argv)
|
|||
my_free((char*) load_default_groups,MYF(0));
|
||||
free_defaults(arguments);
|
||||
|
||||
exit(error);
|
||||
exit(0);
|
||||
}
|
||||
|
|
|
@ -184,6 +184,45 @@ static const char *get_ha_error_msg(int code)
|
|||
return NullS;
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const char *name;
|
||||
uint code;
|
||||
const char *text;
|
||||
} st_error;
|
||||
|
||||
static st_error global_error_names[] =
|
||||
{
|
||||
#include <mysqld_ername.h>
|
||||
{ 0, 0, 0 }
|
||||
};
|
||||
|
||||
/**
|
||||
Lookup an error by code in the global_error_names array.
|
||||
@param code the code to lookup
|
||||
@param [out] name_ptr the error name, when found
|
||||
@param [out] msg_ptr the error text, when found
|
||||
@return 1 when found, otherwise 0
|
||||
*/
|
||||
int get_ER_error_msg(uint code, const char **name_ptr, const char **msg_ptr)
|
||||
{
|
||||
st_error *tmp_error;
|
||||
|
||||
tmp_error= & global_error_names[0];
|
||||
|
||||
while (tmp_error->name != NULL)
|
||||
{
|
||||
if (tmp_error->code == code)
|
||||
{
|
||||
*name_ptr= tmp_error->name;
|
||||
*msg_ptr= tmp_error->text;
|
||||
return 1;
|
||||
}
|
||||
tmp_error++;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if defined(__WIN__)
|
||||
static my_bool print_win_error_msg(DWORD error, my_bool verbose)
|
||||
|
@ -211,6 +250,7 @@ int main(int argc,char *argv[])
|
|||
{
|
||||
int error,code,found;
|
||||
const char *msg;
|
||||
const char *name;
|
||||
char *unknown_error = 0;
|
||||
#if defined(__WIN__)
|
||||
my_bool skip_win_message= 0;
|
||||
|
@ -316,6 +356,14 @@ int main(int argc,char *argv[])
|
|||
else
|
||||
puts(msg);
|
||||
}
|
||||
if (get_ER_error_msg(code, & name, & msg))
|
||||
{
|
||||
found= 1;
|
||||
if (verbose)
|
||||
printf("MySQL error code %3d (%s): %s\n", code, name, msg);
|
||||
else
|
||||
puts(msg);
|
||||
}
|
||||
if (!found)
|
||||
{
|
||||
#if defined(__WIN__)
|
||||
|
|
|
@ -311,7 +311,7 @@ static int insert_pointer_name(reg1 POINTER_ARRAY *pa,char * name)
|
|||
pa->flag[pa->typelib.count]=0; /* Reset flag */
|
||||
pa->typelib.type_names[pa->typelib.count++]= (char*) (pa->str+pa->length);
|
||||
pa->typelib.type_names[pa->typelib.count]= NullS; /* Put end-mark */
|
||||
VOID(strmov((char*) pa->str + pa->length, name));
|
||||
(void) strmov((char*) pa->str + pa->length, name);
|
||||
pa->length+=length;
|
||||
DBUG_RETURN(0);
|
||||
} /* insert_pointer_name */
|
||||
|
@ -433,7 +433,7 @@ static REPLACE *init_replace(char * *from, char * *to,uint count,
|
|||
free_sets(&sets);
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
VOID(make_new_set(&sets)); /* Set starting set */
|
||||
(void) make_new_set(&sets); /* Set starting set */
|
||||
make_sets_invisible(&sets); /* Hide previus sets */
|
||||
used_sets=-1;
|
||||
word_states=make_new_set(&sets); /* Start of new word */
|
||||
|
|
|
@ -13,16 +13,23 @@
|
|||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/extra/yassl/include
|
||||
${CMAKE_SOURCE_DIR}/extra/yassl/taocrypt/include
|
||||
${CMAKE_SOURCE_DIR}/extra/yassl/taocrypt/mySTL)
|
||||
|
||||
ADD_DEFINITIONS("-D_LIB -DYASSL_PREFIX")
|
||||
INCLUDE_DIRECTORIES(
|
||||
${CMAKE_SOURCE_DIR}/include
|
||||
${CMAKE_SOURCE_DIR}/extra/yassl/include
|
||||
${CMAKE_SOURCE_DIR}/extra/yassl/taocrypt/include
|
||||
${CMAKE_SOURCE_DIR}/extra/yassl/taocrypt/mySTL)
|
||||
|
||||
ADD_DEFINITIONS(${SSL_DEFINES})
|
||||
IF(CMAKE_COMPILER_IS_GNUXX)
|
||||
#Remove -fno-implicit-templates
|
||||
#(yassl sources cannot be compiled with it)
|
||||
STRING(REPLACE "-fno-implicit-templates" "" CMAKE_CXX_FLAGS
|
||||
${CMAKE_CXX_FLAGS})
|
||||
ENDIF()
|
||||
SET(YASSL_SOURCES src/buffer.cpp src/cert_wrapper.cpp src/crypto_wrapper.cpp src/handshake.cpp src/lock.cpp
|
||||
src/log.cpp src/socket_wrapper.cpp src/ssl.cpp src/timer.cpp src/yassl_error.cpp
|
||||
src/yassl_imp.cpp src/yassl_int.cpp)
|
||||
IF(NOT SOURCE_SUBLIBS)
|
||||
ADD_LIBRARY(yassl ${YASSL_SOURCES})
|
||||
ADD_DEPENDENCIES(yassl GenError)
|
||||
ENDIF(NOT SOURCE_SUBLIBS)
|
||||
ADD_CONVENIENCE_LIBRARY(yassl ${YASSL_SOURCES})
|
||||
RESTRICT_SYMBOL_EXPORTS(yassl)
|
||||
|
||||
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/extra/yassl/taocrypt/mySTL
|
||||
${CMAKE_SOURCE_DIR}/extra/yassl/taocrypt/include)
|
||||
|
||||
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
|
||||
ADD_DEFINITIONS(${SSL_DEFINES})
|
||||
SET(TAOCRYPT_SOURCES src/aes.cpp src/aestables.cpp src/algebra.cpp src/arc4.cpp src/asn.cpp src/coding.cpp
|
||||
src/des.cpp src/dh.cpp src/dsa.cpp src/file.cpp src/hash.cpp src/integer.cpp src/md2.cpp
|
||||
src/md4.cpp src/md5.cpp src/misc.cpp src/random.cpp src/ripemd.cpp src/rsa.cpp src/sha.cpp
|
||||
|
@ -24,6 +26,6 @@ SET(TAOCRYPT_SOURCES src/aes.cpp src/aestables.cpp src/algebra.cpp src/arc4.cpp
|
|||
include/error.hpp include/file.hpp include/hash.hpp include/hmac.hpp include/integer.hpp
|
||||
include/md2.hpp include/md5.hpp include/misc.hpp include/modarith.hpp include/modes.hpp
|
||||
include/random.hpp include/ripemd.hpp include/rsa.hpp include/sha.hpp)
|
||||
IF(NOT SOURCE_SUBLIBS)
|
||||
ADD_LIBRARY(taocrypt ${TAOCRYPT_SOURCES})
|
||||
ENDIF(NOT SOURCE_SUBLIBS)
|
||||
ADD_CONVENIENCE_LIBRARY(taocrypt ${TAOCRYPT_SOURCES})
|
||||
RESTRICT_SYMBOL_EXPORTS(taocrypt)
|
||||
|
||||
|
|
63
include/CMakeLists.txt
Normal file
63
include/CMakeLists.txt
Normal file
|
@ -0,0 +1,63 @@
|
|||
# Copyright (C) 2009 Sun Microsystems, Inc
|
||||
#
|
||||
# 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
|
||||
|
||||
SET(HEADERS_GEN_CONFIGURE
|
||||
${CMAKE_CURRENT_BINARY_DIR}/mysql_version.h
|
||||
${CMAKE_CURRENT_BINARY_DIR}/my_config.h
|
||||
${CMAKE_CURRENT_BINARY_DIR}/mysqld_ername.h
|
||||
${CMAKE_CURRENT_BINARY_DIR}/mysqld_error.h
|
||||
${CMAKE_CURRENT_BINARY_DIR}/sql_state.h
|
||||
)
|
||||
SET(HEADERS_ABI
|
||||
mysql.h
|
||||
mysql_com.h
|
||||
mysql_time.h
|
||||
my_list.h
|
||||
my_alloc.h
|
||||
typelib.h
|
||||
mysql/plugin.h
|
||||
mysql/plugin_audit.h
|
||||
mysql/plugin_ftparser.h
|
||||
)
|
||||
|
||||
SET(HEADERS
|
||||
${HEADERS_ABI}
|
||||
my_dbug.h
|
||||
m_string.h
|
||||
my_sys.h
|
||||
my_xml.h
|
||||
mysql_embed.h
|
||||
my_pthread.h
|
||||
my_no_pthread.h
|
||||
decimal.h
|
||||
errmsg.h
|
||||
my_global.h
|
||||
my_net.h
|
||||
my_getopt.h
|
||||
sslopt-longopts.h
|
||||
my_dir.h
|
||||
sslopt-vars.h
|
||||
sslopt-case.h
|
||||
sql_common.h
|
||||
keycache.h
|
||||
m_ctype.h
|
||||
my_attribute.h
|
||||
${HEADERS_GEN_CONFIGURE}
|
||||
)
|
||||
|
||||
INSTALL(FILES ${HEADERS} DESTINATION ${INSTALL_INCLUDEDIR})
|
||||
INSTALL(DIRECTORY mysql/ DESTINATION ${INSTALL_INCLUDEDIR} FILES_MATCHING PATTERN "*.h")
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
# Copyright (C) 2000-2006 MySQL AB
|
||||
# Copyright (C) 2000-2006 MySQL AB, 2009 Sun Microsystems, Inc
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Library General Public
|
||||
|
@ -19,18 +19,21 @@ BUILT_SOURCES = $(HEADERS_GEN_MAKE) link_sources probes_mysql_nodtrace.h
|
|||
HEADERS_GEN_CONFIGURE = mysql_version.h
|
||||
HEADERS_GEN_MAKE = my_config.h
|
||||
HEADERS_ABI = mysql.h mysql_com.h mysql_time.h \
|
||||
my_list.h my_alloc.h typelib.h mysql/plugin.h
|
||||
my_list.h my_alloc.h typelib.h mysql/plugin.h \
|
||||
mysql/plugin_audit.h mysql/plugin_ftparser.h
|
||||
pkginclude_HEADERS = $(HEADERS_ABI) my_dbug.h m_string.h my_sys.h \
|
||||
my_xml.h mysql_embed.h mysql/services.h \
|
||||
mysql/service_my_snprintf.h mysql/service_thd_alloc.h \
|
||||
my_pthread.h my_no_pthread.h \
|
||||
mysql/psi/psi.h mysql/psi/mysql_thread.h \
|
||||
mysql/psi/mysql_file.h \
|
||||
decimal.h errmsg.h my_global.h my_net.h \
|
||||
my_getopt.h sslopt-longopts.h my_dir.h \
|
||||
sslopt-vars.h sslopt-case.h sql_common.h keycache.h \
|
||||
m_ctype.h my_attribute.h $(HEADERS_GEN_CONFIGURE) \
|
||||
$(HEADERS_GEN_MAKE) probes_mysql.h probes_mysql_nodtrace.h
|
||||
|
||||
noinst_HEADERS = config-win.h config-netware.h my_bit.h \
|
||||
noinst_HEADERS = config-win.h config-netware.h lf.h my_bit.h \
|
||||
heap.h my_bitmap.h my_uctype.h \
|
||||
myisam.h myisampack.h myisammrg.h ft_global.h\
|
||||
mysys_err.h my_base.h help_start.h help_end.h \
|
||||
|
@ -38,12 +41,16 @@ noinst_HEADERS = config-win.h config-netware.h my_bit.h \
|
|||
my_aes.h my_tree.h my_trie.h hash.h thr_alarm.h \
|
||||
thr_lock.h t_ctype.h violite.h my_md5.h base64.h \
|
||||
my_handler.h my_time.h service_versions.h \
|
||||
my_rdtsc.h mysql/psi/psi_abi_v1.h mysql/psi/psi_abi_v2.h \
|
||||
my_vle.h my_user.h my_atomic.h atomic/nolock.h \
|
||||
atomic/rwlock.h atomic/x86-gcc.h atomic/x86-msvc.h \
|
||||
atomic/solaris.h \
|
||||
atomic/gcc_builtins.h my_libwrap.h my_stacktrace.h
|
||||
atomic/rwlock.h atomic/x86-gcc.h atomic/generic-msvc.h \
|
||||
atomic/gcc_builtins.h my_libwrap.h my_stacktrace.h \
|
||||
atomic/solaris.h
|
||||
|
||||
EXTRA_DIST = mysql.h.pp mysql/plugin.h.pp probes_mysql.d.base
|
||||
EXTRA_DIST = mysql.h.pp mysql/plugin.h.pp probes_mysql.d.base \
|
||||
CMakeLists.txt \
|
||||
mysql/psi/psi_abi_v1.h.pp \
|
||||
mysql/psi/psi_abi_v2.h.pp
|
||||
|
||||
# Remove built files and the symlinked directories
|
||||
CLEANFILES = $(BUILT_SOURCES) readline openssl probes_mysql.d probes_mysql_nodtrace.h
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
#define make_atomic_add_body(S) \
|
||||
v= __sync_fetch_and_add(a, v);
|
||||
#define make_atomic_swap_body(S) \
|
||||
#define make_atomic_fas_body(S) \
|
||||
v= __sync_lock_test_and_set(a, v);
|
||||
#define make_atomic_cas_body(S) \
|
||||
int ## S sav; \
|
||||
|
@ -28,7 +28,10 @@
|
|||
#ifdef MY_ATOMIC_MODE_DUMMY
|
||||
#define make_atomic_load_body(S) ret= *a
|
||||
#define make_atomic_store_body(S) *a= v
|
||||
#define MY_ATOMIC_MODE "gcc-builtins-up"
|
||||
|
||||
#else
|
||||
#define MY_ATOMIC_MODE "gcc-builtins-smp"
|
||||
#define make_atomic_load_body(S) \
|
||||
ret= __sync_fetch_and_or(a, 0);
|
||||
#define make_atomic_store_body(S) \
|
||||
|
|
134
include/atomic/generic-msvc.h
Normal file
134
include/atomic/generic-msvc.h
Normal file
|
@ -0,0 +1,134 @@
|
|||
/* Copyright (C) 2006-2008 MySQL AB, 2008-2009 Sun Microsystems, Inc.
|
||||
|
||||
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 */
|
||||
|
||||
#ifndef _atomic_h_cleanup_
|
||||
#define _atomic_h_cleanup_ "atomic/generic-msvc.h"
|
||||
|
||||
/*
|
||||
We don't implement anything specific for MY_ATOMIC_MODE_DUMMY, always use
|
||||
intrinsics.
|
||||
8 and 16-bit atomics are not implemented, but it can be done if necessary.
|
||||
*/
|
||||
#undef MY_ATOMIC_HAS_8_16
|
||||
|
||||
#include <windows.h>
|
||||
/*
|
||||
x86 compilers (both VS2003 or VS2005) never use instrinsics, but generate
|
||||
function calls to kernel32 instead, even in the optimized build.
|
||||
We force intrinsics as described in MSDN documentation for
|
||||
_InterlockedCompareExchange.
|
||||
*/
|
||||
#ifdef _M_IX86
|
||||
|
||||
#if (_MSC_VER >= 1500)
|
||||
#include <intrin.h>
|
||||
#else
|
||||
C_MODE_START
|
||||
/*Visual Studio 2003 and earlier do not have prototypes for atomic intrinsics*/
|
||||
LONG _InterlockedCompareExchange (LONG volatile *Target, LONG Value, LONG Comp);
|
||||
LONGLONG _InterlockedCompareExchange64 (LONGLONG volatile *Target,
|
||||
LONGLONG Value, LONGLONG Comp);
|
||||
C_MODE_END
|
||||
|
||||
#pragma intrinsic(_InterlockedCompareExchange)
|
||||
#pragma intrinsic(_InterlockedCompareExchange64)
|
||||
#endif
|
||||
|
||||
#define InterlockedCompareExchange _InterlockedCompareExchange
|
||||
#define InterlockedCompareExchange64 _InterlockedCompareExchange64
|
||||
/*
|
||||
No need to do something special for InterlockedCompareExchangePointer
|
||||
as it is a #define to InterlockedCompareExchange. The same applies to
|
||||
InterlockedExchangePointer.
|
||||
*/
|
||||
#endif /*_M_IX86*/
|
||||
|
||||
#define MY_ATOMIC_MODE "msvc-intrinsics"
|
||||
/* Implement using CAS on WIN32 */
|
||||
#define IL_COMP_EXCHG32(X,Y,Z) \
|
||||
InterlockedCompareExchange((volatile LONG *)(X),(Y),(Z))
|
||||
#define IL_COMP_EXCHG64(X,Y,Z) \
|
||||
InterlockedCompareExchange64((volatile LONGLONG *)(X), \
|
||||
(LONGLONG)(Y),(LONGLONG)(Z))
|
||||
#define IL_COMP_EXCHGptr InterlockedCompareExchangePointer
|
||||
|
||||
#define make_atomic_cas_body(S) \
|
||||
int ## S initial_cmp= *cmp; \
|
||||
int ## S initial_a= IL_COMP_EXCHG ## S (a, set, initial_cmp); \
|
||||
if (!(ret= (initial_a == initial_cmp))) *cmp= initial_a;
|
||||
|
||||
#ifndef _M_IX86
|
||||
/* Use full set of optimised functions on WIN64 */
|
||||
#define IL_EXCHG_ADD32(X,Y) \
|
||||
InterlockedExchangeAdd((volatile LONG *)(X),(Y))
|
||||
#define IL_EXCHG_ADD64(X,Y) \
|
||||
InterlockedExchangeAdd64((volatile LONGLONG *)(X),(LONGLONG)(Y))
|
||||
#define IL_EXCHG32(X,Y) \
|
||||
InterlockedExchange((volatile LONG *)(X),(Y))
|
||||
#define IL_EXCHG64(X,Y) \
|
||||
InterlockedExchange64((volatile LONGLONG *)(X),(LONGLONG)(Y))
|
||||
#define IL_EXCHGptr InterlockedExchangePointer
|
||||
|
||||
#define make_atomic_add_body(S) \
|
||||
v= IL_EXCHG_ADD ## S (a, v)
|
||||
#define make_atomic_swap_body(S) \
|
||||
v= IL_EXCHG ## S (a, v)
|
||||
#define make_atomic_load_body(S) \
|
||||
ret= 0; /* avoid compiler warning */ \
|
||||
ret= IL_COMP_EXCHG ## S (a, ret, ret);
|
||||
#endif
|
||||
/*
|
||||
my_yield_processor (equivalent of x86 PAUSE instruction) should be used
|
||||
to improve performance on hyperthreaded CPUs. Intel recommends to use it in
|
||||
spin loops also on non-HT machines to reduce power consumption (see e.g
|
||||
http://softwarecommunity.intel.com/articles/eng/2004.htm)
|
||||
|
||||
Running benchmarks for spinlocks implemented with InterlockedCompareExchange
|
||||
and YieldProcessor shows that much better performance is achieved by calling
|
||||
YieldProcessor in a loop - that is, yielding longer. On Intel boxes setting
|
||||
loop count in the range 200-300 brought best results.
|
||||
*/
|
||||
#ifndef YIELD_LOOPS
|
||||
#define YIELD_LOOPS 200
|
||||
#endif
|
||||
|
||||
static __inline int my_yield_processor()
|
||||
{
|
||||
int i;
|
||||
for(i=0; i<YIELD_LOOPS; i++)
|
||||
{
|
||||
#if (_MSC_VER <= 1310)
|
||||
/* On older compilers YieldProcessor is not available, use inline assembly*/
|
||||
__asm { rep nop }
|
||||
#else
|
||||
YieldProcessor();
|
||||
#endif
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
#define LF_BACKOFF my_yield_processor()
|
||||
#else /* cleanup */
|
||||
|
||||
#undef IL_EXCHG_ADD32
|
||||
#undef IL_EXCHG_ADD64
|
||||
#undef IL_COMP_EXCHG32
|
||||
#undef IL_COMP_EXCHG64
|
||||
#undef IL_COMP_EXCHGptr
|
||||
#undef IL_EXCHG32
|
||||
#undef IL_EXCHG64
|
||||
#undef IL_EXCHGptr
|
||||
|
||||
#endif
|
|
@ -16,43 +16,46 @@
|
|||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
#if defined(__i386__) || defined(_M_IX86) || defined(HAVE_GCC_ATOMIC_BUILTINS)
|
||||
#if defined(__i386__) || defined(_MSC_VER) || defined(__x86_64__) \
|
||||
|| defined(HAVE_GCC_ATOMIC_BUILTINS) \
|
||||
|| defined(HAVE_SOLARIS_ATOMIC)
|
||||
|
||||
#ifdef MY_ATOMIC_MODE_DUMMY
|
||||
# define LOCK ""
|
||||
#else
|
||||
# define LOCK "lock"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_GCC_ATOMIC_BUILTINS
|
||||
#include "gcc_builtins.h"
|
||||
#elif __GNUC__
|
||||
#include "x86-gcc.h"
|
||||
#elif defined(_MSC_VER)
|
||||
#include "x86-msvc.h"
|
||||
#endif
|
||||
|
||||
#elif defined(HAVE_SOLARIS_ATOMIC)
|
||||
|
||||
#include "solaris.h"
|
||||
|
||||
#endif /* __i386__ || _M_IX86 || HAVE_GCC_ATOMIC_BUILTINS */
|
||||
|
||||
#if defined(make_atomic_cas_body) || defined(MY_ATOMICS_MADE)
|
||||
# ifdef MY_ATOMIC_MODE_DUMMY
|
||||
# define LOCK_prefix ""
|
||||
# else
|
||||
# define LOCK_prefix "lock"
|
||||
# endif
|
||||
/*
|
||||
* We have atomics that require no locking
|
||||
*/
|
||||
#define MY_ATOMIC_NOLOCK
|
||||
|
||||
#ifdef __SUNPRO_C
|
||||
/*
|
||||
* Sun Studio 12 (and likely earlier) does not accept a typedef struct {}
|
||||
*/
|
||||
typedef char my_atomic_rwlock_t;
|
||||
#else
|
||||
typedef struct { } my_atomic_rwlock_t;
|
||||
We choose implementation as follows:
|
||||
------------------------------------
|
||||
On Windows using Visual C++ the native implementation should be
|
||||
preferrable. When using gcc we prefer the native x86 implementation,
|
||||
we prefer the Solaris implementation before the gcc because of
|
||||
stability preference, we choose gcc implementation if nothing else
|
||||
works on gcc. If neither Visual C++ or gcc we still choose the
|
||||
Solaris implementation on Solaris (mainly for SunStudio compiles.
|
||||
*/
|
||||
# if defined(_MSV_VER)
|
||||
# include "generic-msvc.h"
|
||||
# elif __GNUC__
|
||||
# if defined(__i386__) || defined(__x86_64__)
|
||||
# include "x86-gcc.h"
|
||||
# elif defined(HAVE_SOLARIS_ATOMIC)
|
||||
# include "solaris.h"
|
||||
# elif defined(HAVE_GCC_ATOMIC_BUILTINS)
|
||||
# include "gcc_builtins.h"
|
||||
# endif
|
||||
# elif defined(HAVE_SOLARIS_ATOMIC)
|
||||
# include "solaris.h"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(make_atomic_cas_body)
|
||||
/*
|
||||
Type not used so minimal size (emptry struct has different size between C
|
||||
and C++, zero-length array is gcc-specific).
|
||||
*/
|
||||
typedef char my_atomic_rwlock_t __attribute__ ((unused));
|
||||
#define my_atomic_rwlock_destroy(name)
|
||||
#define my_atomic_rwlock_init(name)
|
||||
#define my_atomic_rwlock_rdlock(name)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef ATOMIC_RWLOCK_INCLUDED
|
||||
#define ATOMIC_RWLOCK_INCLUDED
|
||||
|
||||
/* Copyright (C) 2006 MySQL AB
|
||||
/* Copyright (C) 2006 MySQL AB, 2009 Sun Microsystems, Inc.
|
||||
|
||||
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
|
||||
|
@ -16,7 +16,7 @@
|
|||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
typedef struct {pthread_rwlock_t rw;} my_atomic_rwlock_t;
|
||||
#define MY_ATOMIC_MODE_RWLOCKS 1
|
||||
|
||||
#ifdef MY_ATOMIC_MODE_DUMMY
|
||||
/*
|
||||
|
@ -26,6 +26,9 @@ typedef struct {pthread_rwlock_t rw;} my_atomic_rwlock_t;
|
|||
implementations (another way is to run a UP build on an SMP box).
|
||||
*/
|
||||
#warning MY_ATOMIC_MODE_DUMMY and MY_ATOMIC_MODE_RWLOCKS are incompatible
|
||||
|
||||
typedef char my_atomic_rwlock_t;
|
||||
|
||||
#define my_atomic_rwlock_destroy(name)
|
||||
#define my_atomic_rwlock_init(name)
|
||||
#define my_atomic_rwlock_rdlock(name)
|
||||
|
@ -33,18 +36,63 @@ typedef struct {pthread_rwlock_t rw;} my_atomic_rwlock_t;
|
|||
#define my_atomic_rwlock_rdunlock(name)
|
||||
#define my_atomic_rwlock_wrunlock(name)
|
||||
#define MY_ATOMIC_MODE "dummy (non-atomic)"
|
||||
#else
|
||||
#define my_atomic_rwlock_destroy(name) pthread_rwlock_destroy(& (name)->rw)
|
||||
#define my_atomic_rwlock_init(name) pthread_rwlock_init(& (name)->rw, 0)
|
||||
#define my_atomic_rwlock_rdlock(name) pthread_rwlock_rdlock(& (name)->rw)
|
||||
#define my_atomic_rwlock_wrlock(name) pthread_rwlock_wrlock(& (name)->rw)
|
||||
#define my_atomic_rwlock_rdunlock(name) pthread_rwlock_unlock(& (name)->rw)
|
||||
#define my_atomic_rwlock_wrunlock(name) pthread_rwlock_unlock(& (name)->rw)
|
||||
#define MY_ATOMIC_MODE "rwlocks"
|
||||
#else /* not MY_ATOMIC_MODE_DUMMY */
|
||||
|
||||
typedef struct {pthread_mutex_t rw;} my_atomic_rwlock_t;
|
||||
|
||||
#ifndef SAFE_MUTEX
|
||||
|
||||
/*
|
||||
we're using read-write lock macros but map them to mutex locks, and they're
|
||||
faster. Still, having semantically rich API we can change the
|
||||
underlying implementation, if necessary.
|
||||
*/
|
||||
#define my_atomic_rwlock_destroy(name) pthread_mutex_destroy(& (name)->rw)
|
||||
#define my_atomic_rwlock_init(name) pthread_mutex_init(& (name)->rw, 0)
|
||||
#define my_atomic_rwlock_rdlock(name) pthread_mutex_lock(& (name)->rw)
|
||||
#define my_atomic_rwlock_wrlock(name) pthread_mutex_lock(& (name)->rw)
|
||||
#define my_atomic_rwlock_rdunlock(name) pthread_mutex_unlock(& (name)->rw)
|
||||
#define my_atomic_rwlock_wrunlock(name) pthread_mutex_unlock(& (name)->rw)
|
||||
|
||||
#else /* SAFE_MUTEX */
|
||||
|
||||
/*
|
||||
SAFE_MUTEX pollutes the compiling name space with macros
|
||||
that alter pthread_mutex_t, pthread_mutex_init, etc.
|
||||
Atomic operations should never use the safe mutex wrappers.
|
||||
Unfortunately, there is no way to have both:
|
||||
- safe mutex macros expanding pthread_mutex_lock to safe_mutex_lock
|
||||
- my_atomic macros expanding to unmodified pthread_mutex_lock
|
||||
inlined in the same compilation unit.
|
||||
So, in case of SAFE_MUTEX, a function call is required.
|
||||
Given that SAFE_MUTEX is a debugging facility,
|
||||
this extra function call is not a performance concern for
|
||||
production builds.
|
||||
*/
|
||||
C_MODE_START
|
||||
extern void plain_pthread_mutex_init(safe_mutex_t *);
|
||||
extern void plain_pthread_mutex_destroy(safe_mutex_t *);
|
||||
extern void plain_pthread_mutex_lock(safe_mutex_t *);
|
||||
extern void plain_pthread_mutex_unlock(safe_mutex_t *);
|
||||
C_MODE_END
|
||||
|
||||
#define my_atomic_rwlock_destroy(name) plain_pthread_mutex_destroy(&(name)->rw)
|
||||
#define my_atomic_rwlock_init(name) plain_pthread_mutex_init(&(name)->rw)
|
||||
#define my_atomic_rwlock_rdlock(name) plain_pthread_mutex_lock(&(name)->rw)
|
||||
#define my_atomic_rwlock_wrlock(name) plain_pthread_mutex_lock(&(name)->rw)
|
||||
#define my_atomic_rwlock_rdunlock(name) plain_pthread_mutex_unlock(&(name)->rw)
|
||||
#define my_atomic_rwlock_wrunlock(name) plain_pthread_mutex_unlock(&(name)->rw)
|
||||
|
||||
#endif /* SAFE_MUTEX */
|
||||
|
||||
#define MY_ATOMIC_MODE "mutex"
|
||||
#ifndef MY_ATOMIC_MODE_RWLOCKS
|
||||
#define MY_ATOMIC_MODE_RWLOCKS 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define make_atomic_add_body(S) int ## S sav; sav= *a; *a+= v; v=sav;
|
||||
#define make_atomic_swap_body(S) int ## S sav; sav= *a; *a= v; v=sav;
|
||||
#define make_atomic_fas_body(S) int ## S sav; sav= *a; *a= v; v=sav;
|
||||
#define make_atomic_cas_body(S) if ((ret= (*a == *cmp))) *a= set; else *cmp=*a;
|
||||
#define make_atomic_load_body(S) ret= *a;
|
||||
#define make_atomic_store_body(S) *a= v;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2008 MySQL AB
|
||||
/* Copyright (C) 2008 MySQL AB, 2009 Sun Microsystems, Inc
|
||||
|
||||
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
|
||||
|
@ -13,198 +13,54 @@
|
|||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
#ifndef _atomic_h_cleanup_
|
||||
#define _atomic_h_cleanup_ "atomic/solaris.h"
|
||||
|
||||
#include <atomic.h>
|
||||
|
||||
#define MY_ATOMIC_MODE "solaris-atomic"
|
||||
|
||||
/*
|
||||
* This is defined to indicate we fully define the my_atomic_* (inline)
|
||||
* functions here, so there is no need to "make" them in my_atomic.h
|
||||
* using make_atomic_* and make_atomic_*_body.
|
||||
*/
|
||||
#define MY_ATOMICS_MADE
|
||||
#define uintptr_t void *
|
||||
#define atomic_or_ptr_nv(X,Y) (void *)atomic_or_ulong_nv((volatile ulong_t *)X, Y)
|
||||
|
||||
STATIC_INLINE int
|
||||
my_atomic_cas8(int8 volatile *a, int8 *cmp, int8 set)
|
||||
{
|
||||
int ret;
|
||||
int8 sav;
|
||||
sav = (int8) atomic_cas_8((volatile uint8_t *)a, (uint8_t)*cmp,
|
||||
(uint8_t)set);
|
||||
if (! (ret = (sav == *cmp)))
|
||||
*cmp = sav;
|
||||
return ret;
|
||||
}
|
||||
#define make_atomic_cas_body(S) \
|
||||
uint ## S ## _t sav; \
|
||||
sav = atomic_cas_ ## S( \
|
||||
(volatile uint ## S ## _t *)a, \
|
||||
(uint ## S ## _t)*cmp, \
|
||||
(uint ## S ## _t)set); \
|
||||
if (! (ret= (sav == *cmp))) \
|
||||
*cmp= sav;
|
||||
|
||||
STATIC_INLINE int
|
||||
my_atomic_cas16(int16 volatile *a, int16 *cmp, int16 set)
|
||||
{
|
||||
int ret;
|
||||
int16 sav;
|
||||
sav = (int16) atomic_cas_16((volatile uint16_t *)a, (uint16_t)*cmp,
|
||||
(uint16_t)set);
|
||||
if (! (ret = (sav == *cmp)))
|
||||
*cmp = sav;
|
||||
return ret;
|
||||
}
|
||||
|
||||
STATIC_INLINE int
|
||||
my_atomic_cas32(int32 volatile *a, int32 *cmp, int32 set)
|
||||
{
|
||||
int ret;
|
||||
int32 sav;
|
||||
sav = (int32) atomic_cas_32((volatile uint32_t *)a, (uint32_t)*cmp,
|
||||
(uint32_t)set);
|
||||
if (! (ret = (sav == *cmp)))
|
||||
*cmp = sav;
|
||||
return ret;
|
||||
}
|
||||
|
||||
STATIC_INLINE int
|
||||
my_atomic_casptr(void * volatile *a, void **cmp, void *set)
|
||||
{
|
||||
int ret;
|
||||
void *sav;
|
||||
sav = atomic_cas_ptr(a, *cmp, set);
|
||||
if (! (ret = (sav == *cmp)))
|
||||
*cmp = sav;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
STATIC_INLINE int8
|
||||
my_atomic_add8(int8 volatile *a, int8 v)
|
||||
{
|
||||
int8 nv;
|
||||
nv = atomic_add_8_nv((volatile uint8_t *)a, v);
|
||||
return (nv - v);
|
||||
}
|
||||
|
||||
STATIC_INLINE int16
|
||||
my_atomic_add16(int16 volatile *a, int16 v)
|
||||
{
|
||||
int16 nv;
|
||||
nv = atomic_add_16_nv((volatile uint16_t *)a, v);
|
||||
return (nv - v);
|
||||
}
|
||||
|
||||
STATIC_INLINE int32
|
||||
my_atomic_add32(int32 volatile *a, int32 v)
|
||||
{
|
||||
int32 nv;
|
||||
nv = atomic_add_32_nv((volatile uint32_t *)a, v);
|
||||
return (nv - v);
|
||||
}
|
||||
#define make_atomic_add_body(S) \
|
||||
int ## S nv; /* new value */ \
|
||||
nv= atomic_add_ ## S ## _nv((volatile uint ## S ## _t *)a, v); \
|
||||
v= nv - v
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
#ifdef MY_ATOMIC_MODE_DUMMY
|
||||
|
||||
STATIC_INLINE int8
|
||||
my_atomic_load8(int8 volatile *a) { return (*a); }
|
||||
|
||||
STATIC_INLINE int16
|
||||
my_atomic_load16(int16 volatile *a) { return (*a); }
|
||||
|
||||
STATIC_INLINE int32
|
||||
my_atomic_load32(int32 volatile *a) { return (*a); }
|
||||
|
||||
STATIC_INLINE void *
|
||||
my_atomic_loadptr(void * volatile *a) { return (*a); }
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
STATIC_INLINE void
|
||||
my_atomic_store8(int8 volatile *a, int8 v) { *a = v; }
|
||||
|
||||
STATIC_INLINE void
|
||||
my_atomic_store16(int16 volatile *a, int16 v) { *a = v; }
|
||||
|
||||
STATIC_INLINE void
|
||||
my_atomic_store32(int32 volatile *a, int32 v) { *a = v; }
|
||||
|
||||
STATIC_INLINE void
|
||||
my_atomic_storeptr(void * volatile *a, void *v) { *a = v; }
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
#define make_atomic_load_body(S) ret= *a
|
||||
#define make_atomic_store_body(S) *a= v
|
||||
|
||||
#else /* MY_ATOMIC_MODE_DUMMY */
|
||||
|
||||
STATIC_INLINE int8
|
||||
my_atomic_load8(int8 volatile *a)
|
||||
{
|
||||
return ((int8) atomic_or_8_nv((volatile uint8_t *)a, 0));
|
||||
}
|
||||
#define make_atomic_load_body(S) \
|
||||
ret= atomic_or_ ## S ## _nv((volatile uint ## S ## _t *)a, 0)
|
||||
|
||||
STATIC_INLINE int16
|
||||
my_atomic_load16(int16 volatile *a)
|
||||
{
|
||||
return ((int16) atomic_or_16_nv((volatile uint16_t *)a, 0));
|
||||
}
|
||||
|
||||
STATIC_INLINE int32
|
||||
my_atomic_load32(int32 volatile *a)
|
||||
{
|
||||
return ((int32) atomic_or_32_nv((volatile uint32_t *)a, 0));
|
||||
}
|
||||
|
||||
STATIC_INLINE void *
|
||||
my_atomic_loadptr(void * volatile *a)
|
||||
{
|
||||
return ((void *) atomic_or_ulong_nv((volatile ulong_t *)a, 0));
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
STATIC_INLINE void
|
||||
my_atomic_store8(int8 volatile *a, int8 v)
|
||||
{
|
||||
(void) atomic_swap_8((volatile uint8_t *)a, (uint8_t)v);
|
||||
}
|
||||
|
||||
STATIC_INLINE void
|
||||
my_atomic_store16(int16 volatile *a, int16 v)
|
||||
{
|
||||
(void) atomic_swap_16((volatile uint16_t *)a, (uint16_t)v);
|
||||
}
|
||||
|
||||
STATIC_INLINE void
|
||||
my_atomic_store32(int32 volatile *a, int32 v)
|
||||
{
|
||||
(void) atomic_swap_32((volatile uint32_t *)a, (uint32_t)v);
|
||||
}
|
||||
|
||||
STATIC_INLINE void
|
||||
my_atomic_storeptr(void * volatile *a, void *v)
|
||||
{
|
||||
(void) atomic_swap_ptr(a, v);
|
||||
}
|
||||
#define make_atomic_store_body(S) \
|
||||
(void) atomic_swap_ ## S((volatile uint ## S ## _t *)a, (uint ## S ## _t)v)
|
||||
|
||||
#endif
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
#define make_atomic_fas_body(S) \
|
||||
v= atomic_swap_ ## S((volatile uint ## S ## _t *)a, (uint ## S ## _t)v)
|
||||
|
||||
STATIC_INLINE int8
|
||||
my_atomic_swap8(int8 volatile *a, int8 v)
|
||||
{
|
||||
return ((int8) atomic_swap_8((volatile uint8_t *)a, (uint8_t)v));
|
||||
}
|
||||
#else /* cleanup */
|
||||
|
||||
STATIC_INLINE int16
|
||||
my_atomic_swap16(int16 volatile *a, int16 v)
|
||||
{
|
||||
return ((int16) atomic_swap_16((volatile uint16_t *)a, (uint16_t)v));
|
||||
}
|
||||
#undef uintptr_t
|
||||
#undef atomic_or_ptr_nv
|
||||
|
||||
STATIC_INLINE int32
|
||||
my_atomic_swap32(int32 volatile *a, int32 v)
|
||||
{
|
||||
return ((int32) atomic_swap_32((volatile uint32_t *)a, (uint32_t)v));
|
||||
}
|
||||
#endif
|
||||
|
||||
STATIC_INLINE void *
|
||||
my_atomic_swapptr(void * volatile *a, void *v)
|
||||
{
|
||||
return (atomic_swap_ptr(a, v));
|
||||
}
|
||||
|
|
|
@ -22,10 +22,24 @@
|
|||
architectures support double-word (128-bit) cas.
|
||||
*/
|
||||
|
||||
#ifdef MY_ATOMIC_NO_XADD
|
||||
#define MY_ATOMIC_MODE "gcc-x86" LOCK "-no-xadd"
|
||||
/*
|
||||
No special support of 8 and 16 bit operations are implemented here
|
||||
currently.
|
||||
*/
|
||||
#undef MY_ATOMIC_HAS_8_AND_16
|
||||
|
||||
#ifdef __x86_64__
|
||||
# ifdef MY_ATOMIC_NO_XADD
|
||||
# define MY_ATOMIC_MODE "gcc-amd64" LOCK_prefix "-no-xadd"
|
||||
# else
|
||||
# define MY_ATOMIC_MODE "gcc-amd64" LOCK_prefix
|
||||
# endif
|
||||
#else
|
||||
#define MY_ATOMIC_MODE "gcc-x86" LOCK
|
||||
# ifdef MY_ATOMIC_NO_XADD
|
||||
# define MY_ATOMIC_MODE "gcc-x86" LOCK_prefix "-no-xadd"
|
||||
# else
|
||||
# define MY_ATOMIC_MODE "gcc-x86" LOCK_prefix
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* fix -ansi errors while maintaining readability */
|
||||
|
@ -34,29 +48,79 @@
|
|||
#endif
|
||||
|
||||
#ifndef MY_ATOMIC_NO_XADD
|
||||
#define make_atomic_add_body(S) \
|
||||
asm volatile (LOCK "; xadd %0, %1;" : "+r" (v) , "+m" (*a))
|
||||
#define make_atomic_add_body(S) make_atomic_add_body ## S
|
||||
#define make_atomic_cas_body(S) make_atomic_cas_body ## S
|
||||
#endif
|
||||
#define make_atomic_swap_body(S) \
|
||||
asm volatile ("; xchg %0, %1;" : "+q" (v) , "+m" (*a))
|
||||
#define make_atomic_cas_body(S) \
|
||||
asm volatile (LOCK "; cmpxchg %3, %0; setz %2;" \
|
||||
|
||||
#define make_atomic_add_body32 \
|
||||
asm volatile (LOCK_prefix "; xadd %0, %1;" : "+r" (v) , "+m" (*a))
|
||||
|
||||
#define make_atomic_cas_body32 \
|
||||
asm volatile (LOCK_prefix "; cmpxchg %3, %0; setz %2;" \
|
||||
: "+m" (*a), "+a" (*cmp), "=q" (ret): "r" (set))
|
||||
|
||||
#ifdef __x86_64__
|
||||
#define make_atomic_add_body64 make_atomic_add_body32
|
||||
#define make_atomic_cas_body64 make_atomic_cas_body32
|
||||
|
||||
#define make_atomic_fas_body(S) \
|
||||
asm volatile ("xchg %0, %1;" : "+r" (v) , "+m" (*a))
|
||||
|
||||
/*
|
||||
Actually 32-bit reads/writes are always atomic on x86
|
||||
But we add LOCK_prefix here anyway to force memory barriers
|
||||
*/
|
||||
#define make_atomic_load_body(S) \
|
||||
ret=0; \
|
||||
asm volatile (LOCK_prefix "; cmpxchg %2, %0" \
|
||||
: "+m" (*a), "+a" (ret): "r" (ret))
|
||||
#define make_atomic_store_body(S) \
|
||||
asm volatile ("; xchg %0, %1;" : "+m" (*a), "+r" (v))
|
||||
|
||||
#else
|
||||
/*
|
||||
Use default implementations of 64-bit operations since we solved
|
||||
the 64-bit problem on 32-bit platforms for CAS, no need to solve it
|
||||
once more for ADD, LOAD, STORE and FAS as well.
|
||||
Since we already added add32 support, we need to define add64
|
||||
here, but we haven't defined fas, load and store at all, so
|
||||
we can fallback on default implementations.
|
||||
*/
|
||||
#define make_atomic_add_body64 \
|
||||
int64 tmp=*a; \
|
||||
while (!my_atomic_cas64(a, &tmp, tmp+v)) ; \
|
||||
v=tmp;
|
||||
|
||||
/*
|
||||
On some platforms (e.g. Mac OS X and Solaris) the ebx register
|
||||
is held as a pointer to the global offset table. Thus we're not
|
||||
allowed to use the b-register on those platforms when compiling
|
||||
PIC code, to avoid this we push ebx and pop ebx and add a movl
|
||||
instruction to avoid having ebx in the interface of the assembler
|
||||
instruction.
|
||||
|
||||
cmpxchg8b works on both 32-bit platforms and 64-bit platforms but
|
||||
the code here is only used on 32-bit platforms, on 64-bit
|
||||
platforms the much simpler make_atomic_cas_body32 will work
|
||||
fine.
|
||||
*/
|
||||
#define make_atomic_cas_body64 \
|
||||
int32 ebx=(set & 0xFFFFFFFF), ecx=(set >> 32); \
|
||||
asm volatile ("push %%ebx; movl %3, %%ebx;" \
|
||||
LOCK_prefix "; cmpxchg8b %0; setz %2; pop %%ebx"\
|
||||
: "+m" (*a), "+A" (*cmp), "=c" (ret) \
|
||||
:"m" (ebx), "c" (ecx))
|
||||
#endif
|
||||
|
||||
/*
|
||||
The implementation of make_atomic_cas_body32 is adaptable to
|
||||
the OS word size, so on 64-bit platforms it will automatically
|
||||
adapt to 64-bits and so it will work also on 64-bit platforms
|
||||
*/
|
||||
#define make_atomic_cas_bodyptr make_atomic_cas_body32
|
||||
|
||||
#ifdef MY_ATOMIC_MODE_DUMMY
|
||||
#define make_atomic_load_body(S) ret=*a
|
||||
#define make_atomic_store_body(S) *a=v
|
||||
#else
|
||||
/*
|
||||
Actually 32-bit reads/writes are always atomic on x86
|
||||
But we add LOCK here anyway to force memory barriers
|
||||
*/
|
||||
#define make_atomic_load_body(S) \
|
||||
ret=0; \
|
||||
asm volatile (LOCK "; cmpxchg %2, %0" \
|
||||
: "+m" (*a), "+a" (ret): "r" (ret))
|
||||
#define make_atomic_store_body(S) \
|
||||
asm volatile ("; xchg %0, %1;" : "+m" (*a) : "r" (v))
|
||||
#endif
|
||||
|
||||
#endif /* ATOMIC_X86_GCC_INCLUDED */
|
||||
|
|
|
@ -1,96 +0,0 @@
|
|||
/* Copyright (C) 2006 MySQL 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 */
|
||||
|
||||
/*
|
||||
XXX 64-bit atomic operations can be implemented using
|
||||
cmpxchg8b, if necessary
|
||||
*/
|
||||
|
||||
// Would it be better to use intrinsics ?
|
||||
// (InterlockedCompareExchange, InterlockedCompareExchange16
|
||||
// InterlockedExchangeAdd, InterlockedExchange)
|
||||
|
||||
#ifndef _atomic_h_cleanup_
|
||||
#define _atomic_h_cleanup_ "atomic/x86-msvc.h"
|
||||
|
||||
#define MY_ATOMIC_MODE "msvc-x86" LOCK
|
||||
|
||||
#define make_atomic_add_body(S) \
|
||||
_asm { \
|
||||
_asm mov reg_ ## S, v \
|
||||
_asm LOCK xadd *a, reg_ ## S \
|
||||
_asm movzx v, reg_ ## S \
|
||||
}
|
||||
#define make_atomic_cas_body(S) \
|
||||
_asm { \
|
||||
_asm mov areg_ ## S, *cmp \
|
||||
_asm mov reg2_ ## S, set \
|
||||
_asm LOCK cmpxchg *a, reg2_ ## S \
|
||||
_asm mov *cmp, areg_ ## S \
|
||||
_asm setz al \
|
||||
_asm movzx ret, al \
|
||||
}
|
||||
#define make_atomic_swap_body(S) \
|
||||
_asm { \
|
||||
_asm mov reg_ ## S, v \
|
||||
_asm xchg *a, reg_ ## S \
|
||||
_asm mov v, reg_ ## S \
|
||||
}
|
||||
|
||||
#ifdef MY_ATOMIC_MODE_DUMMY
|
||||
#define make_atomic_load_body(S) ret=*a
|
||||
#define make_atomic_store_body(S) *a=v
|
||||
#else
|
||||
/*
|
||||
Actually 32-bit reads/writes are always atomic on x86
|
||||
But we add LOCK here anyway to force memory barriers
|
||||
*/
|
||||
#define make_atomic_load_body(S) \
|
||||
_asm { \
|
||||
_asm mov areg_ ## S, 0 \
|
||||
_asm mov reg2_ ## S, areg_ ## S \
|
||||
_asm LOCK cmpxchg *a, reg2_ ## S \
|
||||
_asm mov ret, areg_ ## S \
|
||||
}
|
||||
#define make_atomic_store_body(S) \
|
||||
_asm { \
|
||||
_asm mov reg_ ## S, v \
|
||||
_asm xchg *a, reg_ ## S \
|
||||
}
|
||||
#endif
|
||||
|
||||
#define reg_8 al
|
||||
#define reg_16 ax
|
||||
#define reg_32 eax
|
||||
#define areg_8 al
|
||||
#define areg_16 ax
|
||||
#define areg_32 eax
|
||||
#define reg2_8 bl
|
||||
#define reg2_16 bx
|
||||
#define reg2_32 ebx
|
||||
|
||||
#else /* cleanup */
|
||||
|
||||
#undef reg_8
|
||||
#undef reg_16
|
||||
#undef reg_32
|
||||
#undef areg_8
|
||||
#undef areg_16
|
||||
#undef areg_32
|
||||
#undef reg2_8
|
||||
#undef reg2_16
|
||||
#undef reg2_32
|
||||
#endif
|
||||
|
|
@ -73,7 +73,6 @@ extern "C" {
|
|||
#undef HAVE_FINITE
|
||||
#undef HAVE_GETPWNAM
|
||||
#undef HAVE_GETPWUID
|
||||
#undef HAVE_PTHREAD_SETSCHEDPARAM
|
||||
#undef HAVE_READLINK
|
||||
#undef HAVE_STPCPY
|
||||
/* changes end */
|
||||
|
@ -101,7 +100,7 @@ extern "C" {
|
|||
#define USE_OLD_FUNCTIONS 1
|
||||
|
||||
/* no case sensitivity */
|
||||
#define FN_NO_CASE_SENCE 1
|
||||
#define FN_NO_CASE_SENSE 1
|
||||
|
||||
/* the thread alarm is not used */
|
||||
#define DONT_USE_THR_ALARM 1
|
||||
|
|
|
@ -20,6 +20,13 @@
|
|||
|
||||
#define BIG_TABLES
|
||||
|
||||
/*
|
||||
Minimal version of Windows we should be able to run on.
|
||||
Currently Windows XP.
|
||||
*/
|
||||
#define _WIN32_WINNT 0x0501
|
||||
|
||||
|
||||
#if defined(_MSC_VER) && _MSC_VER >= 1400
|
||||
/* Avoid endless warnings about sprintf() etc. being unsafe. */
|
||||
#define _CRT_SECURE_NO_DEPRECATE 1
|
||||
|
@ -27,6 +34,7 @@
|
|||
|
||||
#include <sys/locking.h>
|
||||
#include <winsock2.h>
|
||||
#include <Ws2tcpip.h>
|
||||
#include <fcntl.h>
|
||||
#include <io.h>
|
||||
#include <malloc.h>
|
||||
|
@ -88,6 +96,12 @@
|
|||
|
||||
#define S_IROTH S_IREAD /* for my_lib */
|
||||
|
||||
/* Winsock2 constant (Vista SDK and later)*/
|
||||
#define IPPROTO_IPV6 41
|
||||
#ifndef IPV6_V6ONLY
|
||||
#define IPV6_V6ONLY 27
|
||||
#endif
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#define FILE_BINARY O_BINARY /* my_fopen in binary mode */
|
||||
#define O_TEMPORARY 0
|
||||
|
@ -145,12 +159,23 @@ typedef __int64 os_off_t;
|
|||
#ifdef _WIN64
|
||||
typedef UINT_PTR rf_SetTimer;
|
||||
#else
|
||||
#ifndef HAVE_SIZE_T
|
||||
typedef unsigned int size_t;
|
||||
#endif
|
||||
typedef uint rf_SetTimer;
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_SIZE_T
|
||||
#ifndef _SIZE_T_DEFINED
|
||||
typedef SIZE_T size_t;
|
||||
#define _SIZE_T_DEFINED
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_SSIZE_T
|
||||
#ifndef _SSIZE_T_DEFINED
|
||||
typedef SSIZE_T ssize_t;
|
||||
#define _SSIZE_T_DEFINED
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define Socket_defined
|
||||
#define my_socket SOCKET
|
||||
#define SIGPIPE SIGINT
|
||||
|
@ -293,10 +318,11 @@ inline ulonglong double2ulonglong(double d)
|
|||
#define strcasecmp stricmp
|
||||
#define strncasecmp strnicmp
|
||||
|
||||
#ifdef NOT_USED
|
||||
#define HAVE_SNPRINTF /* Gave link error */
|
||||
#define _snprintf snprintf
|
||||
#endif
|
||||
#define HAVE_SNPRINTF 1
|
||||
#define snprintf _snprintf
|
||||
|
||||
#define HAVE_SETENV 1
|
||||
#define setenv(VAR,VAL,X) _putenv_s(VAR,VAL)
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define HAVE_LDIV /* The optimizer breaks in zortech for ldiv */
|
||||
|
@ -335,7 +361,7 @@ inline ulonglong double2ulonglong(double d)
|
|||
#define FN_ROOTDIR "\\"
|
||||
#define FN_DEVCHAR ':'
|
||||
#define FN_NETWORK_DRIVES /* Uses \\ to indicate network drives */
|
||||
#define FN_NO_CASE_SENCE /* Files are not case-sensitive */
|
||||
#define FN_NO_CASE_SENSE /* Files are not case-sensitive */
|
||||
#define OS_FILE_LIMIT UINT_MAX /* No limit*/
|
||||
|
||||
#define DO_NOT_REMOVE_THREAD_WRAPPERS
|
||||
|
@ -406,6 +432,9 @@ inline ulonglong double2ulonglong(double d)
|
|||
#define HAVE_CHARSET_ucs2 1
|
||||
#define HAVE_CHARSET_ujis 1
|
||||
#define HAVE_CHARSET_utf8 1
|
||||
#define HAVE_CHARSET_utf8mb4 1
|
||||
#define HAVE_CHARSET_utf16 1
|
||||
#define HAVE_CHARSET_utf32 1
|
||||
|
||||
#define HAVE_UCA_COLLATIONS 1
|
||||
#define HAVE_BOOL 1
|
||||
|
|
|
@ -28,6 +28,8 @@ extern "C" {
|
|||
#define HA_FT_MAXBYTELEN 254
|
||||
#define HA_FT_MAXCHARLEN (HA_FT_MAXBYTELEN/3)
|
||||
|
||||
#define DEFAULT_FTB_SYNTAX "+ -><()~*:\"\"&|"
|
||||
|
||||
typedef struct st_ft_info FT_INFO;
|
||||
struct _ft_vft
|
||||
{
|
||||
|
@ -51,7 +53,7 @@ extern const char *ft_precompiled_stopwords[];
|
|||
extern ulong ft_min_word_len;
|
||||
extern ulong ft_max_word_len;
|
||||
extern ulong ft_query_expansion_limit;
|
||||
extern char ft_boolean_syntax[15];
|
||||
extern const char *ft_boolean_syntax;
|
||||
extern struct st_mysql_ftparser ft_default_parser;
|
||||
|
||||
int ft_init_stopwords(void);
|
||||
|
|
|
@ -30,6 +30,7 @@ extern "C" {
|
|||
/* flags for hash_init */
|
||||
#define HASH_UNIQUE 1 /* hash_insert fails on duplicate key */
|
||||
|
||||
typedef uint my_hash_value_type;
|
||||
typedef uchar *(*my_hash_get_key)(const uchar *,size_t*,my_bool);
|
||||
typedef void (*my_hash_free_key)(void *);
|
||||
|
||||
|
@ -60,8 +61,18 @@ void my_hash_free(HASH *tree);
|
|||
void my_hash_reset(HASH *hash);
|
||||
uchar *my_hash_element(HASH *hash, ulong idx);
|
||||
uchar *my_hash_search(const HASH *info, const uchar *key, size_t length);
|
||||
uchar *my_hash_search_using_hash_value(const HASH *info,
|
||||
my_hash_value_type hash_value,
|
||||
const uchar *key, size_t length);
|
||||
my_hash_value_type my_calc_hash(const HASH *info,
|
||||
const uchar *key, size_t length);
|
||||
uchar *my_hash_first(const HASH *info, const uchar *key, size_t length,
|
||||
HASH_SEARCH_STATE *state);
|
||||
uchar *my_hash_first_from_hash_value(const HASH *info,
|
||||
my_hash_value_type hash_value,
|
||||
const uchar *key,
|
||||
size_t length,
|
||||
HASH_SEARCH_STATE *state);
|
||||
uchar *my_hash_next(const HASH *info, const uchar *key, size_t length,
|
||||
HASH_SEARCH_STATE *state);
|
||||
my_bool my_hash_insert(HASH *info, const uchar *data);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2000,2004 MySQL AB
|
||||
/* Copyright (C) 2000-2004 MySQL AB, 2009 Sun Microsystems, Inc
|
||||
|
||||
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
|
||||
|
@ -148,7 +148,7 @@ typedef struct st_heap_share
|
|||
char * name; /* Name of "memory-file" */
|
||||
#ifdef THREAD
|
||||
THR_LOCK lock;
|
||||
pthread_mutex_t intern_lock; /* Locking for use with _locking */
|
||||
mysql_mutex_t intern_lock; /* Locking for use with _locking */
|
||||
#endif
|
||||
my_bool delete_on_close;
|
||||
LIST open_list;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2003 MySQL AB
|
||||
/* Copyright (C) 2003 MySQL AB, 2009 Sun Microsystems, Inc
|
||||
|
||||
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
|
||||
|
@ -67,10 +67,10 @@ typedef struct st_key_cache
|
|||
HASH_LINK *free_hash_list; /* list of free hash links */
|
||||
BLOCK_LINK *free_block_list; /* list of free blocks */
|
||||
BLOCK_LINK *block_root; /* memory for block links */
|
||||
uchar HUGE_PTR *block_mem; /* memory for block buffers */
|
||||
uchar *block_mem; /* memory for block buffers */
|
||||
BLOCK_LINK *used_last; /* ptr to the last block of the LRU chain */
|
||||
BLOCK_LINK *used_ins; /* ptr to the insertion block in LRU chain */
|
||||
pthread_mutex_t cache_lock; /* to lock access to the cache structure */
|
||||
mysql_mutex_t cache_lock; /* to lock access to the cache structure */
|
||||
KEYCACHE_WQUEUE resize_queue; /* threads waiting during resize operation */
|
||||
/*
|
||||
Waiting for a zero resize count. Using a queue for symmetry though
|
||||
|
@ -87,10 +87,10 @@ typedef struct st_key_cache
|
|||
initializing the key cache.
|
||||
*/
|
||||
|
||||
ulonglong param_buff_size; /* size the memory allocated for the cache */
|
||||
ulong param_block_size; /* size of the blocks in the key cache */
|
||||
ulong param_division_limit; /* min. percentage of warm blocks */
|
||||
ulong param_age_threshold; /* determines when hot block is downgraded */
|
||||
ulonglong param_buff_size; /* size the memory allocated for the cache */
|
||||
ulonglong param_block_size; /* size of the blocks in the key cache */
|
||||
ulonglong param_division_limit; /* min. percentage of warm blocks */
|
||||
ulonglong param_age_threshold; /* determines when hot block is downgraded */
|
||||
|
||||
/* Statistics variables. These are reset in reset_key_cache_counters(). */
|
||||
ulong global_blocks_changed; /* number of currently dirty blocks */
|
||||
|
|
268
include/lf.h
Normal file
268
include/lf.h
Normal file
|
@ -0,0 +1,268 @@
|
|||
/* Copyright (C) 2007-2008 MySQL AB, 2008-2009 Sun Microsystems, Inc.
|
||||
|
||||
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 */
|
||||
|
||||
#ifndef _lf_h
|
||||
#define _lf_h
|
||||
|
||||
#include <my_atomic.h>
|
||||
|
||||
C_MODE_START
|
||||
|
||||
/*
|
||||
Helpers to define both func() and _func(), where
|
||||
func() is a _func() protected by my_atomic_rwlock_wrlock()
|
||||
*/
|
||||
|
||||
#define lock_wrap(f, t, proto_args, args, lock) \
|
||||
t _ ## f proto_args; \
|
||||
static inline t f proto_args \
|
||||
{ \
|
||||
t ret; \
|
||||
my_atomic_rwlock_wrlock(lock); \
|
||||
ret= _ ## f args; \
|
||||
my_atomic_rwlock_wrunlock(lock); \
|
||||
return ret; \
|
||||
}
|
||||
|
||||
#define lock_wrap_void(f, proto_args, args, lock) \
|
||||
void _ ## f proto_args; \
|
||||
static inline void f proto_args \
|
||||
{ \
|
||||
my_atomic_rwlock_wrlock(lock); \
|
||||
_ ## f args; \
|
||||
my_atomic_rwlock_wrunlock(lock); \
|
||||
}
|
||||
|
||||
#define nolock_wrap(f, t, proto_args, args) \
|
||||
t _ ## f proto_args; \
|
||||
static inline t f proto_args \
|
||||
{ \
|
||||
return _ ## f args; \
|
||||
}
|
||||
|
||||
#define nolock_wrap_void(f, proto_args, args) \
|
||||
void _ ## f proto_args; \
|
||||
static inline void f proto_args \
|
||||
{ \
|
||||
_ ## f args; \
|
||||
}
|
||||
|
||||
/*
|
||||
wait-free dynamic array, see lf_dynarray.c
|
||||
|
||||
4 levels of 256 elements each mean 4311810304 elements in an array - it
|
||||
should be enough for a while
|
||||
*/
|
||||
#define LF_DYNARRAY_LEVEL_LENGTH 256
|
||||
#define LF_DYNARRAY_LEVELS 4
|
||||
|
||||
typedef struct {
|
||||
void * volatile level[LF_DYNARRAY_LEVELS];
|
||||
uint size_of_element;
|
||||
my_atomic_rwlock_t lock;
|
||||
} LF_DYNARRAY;
|
||||
|
||||
typedef int (*lf_dynarray_func)(void *, void *);
|
||||
|
||||
void lf_dynarray_init(LF_DYNARRAY *array, uint element_size);
|
||||
void lf_dynarray_destroy(LF_DYNARRAY *array);
|
||||
|
||||
nolock_wrap(lf_dynarray_value, void *,
|
||||
(LF_DYNARRAY *array, uint idx),
|
||||
(array, idx))
|
||||
lock_wrap(lf_dynarray_lvalue, void *,
|
||||
(LF_DYNARRAY *array, uint idx),
|
||||
(array, idx),
|
||||
&array->lock)
|
||||
nolock_wrap(lf_dynarray_iterate, int,
|
||||
(LF_DYNARRAY *array, lf_dynarray_func func, void *arg),
|
||||
(array, func, arg))
|
||||
|
||||
/*
|
||||
pin manager for memory allocator, lf_alloc-pin.c
|
||||
*/
|
||||
|
||||
#define LF_PINBOX_PINS 4
|
||||
#define LF_PURGATORY_SIZE 10
|
||||
|
||||
typedef void lf_pinbox_free_func(void *, void *, void*);
|
||||
|
||||
typedef struct {
|
||||
LF_DYNARRAY pinarray;
|
||||
lf_pinbox_free_func *free_func;
|
||||
void *free_func_arg;
|
||||
uint free_ptr_offset;
|
||||
uint32 volatile pinstack_top_ver; /* this is a versioned pointer */
|
||||
uint32 volatile pins_in_array; /* number of elements in array */
|
||||
} LF_PINBOX;
|
||||
|
||||
typedef struct {
|
||||
void * volatile pin[LF_PINBOX_PINS];
|
||||
LF_PINBOX *pinbox;
|
||||
void **stack_ends_here;
|
||||
void *purgatory;
|
||||
uint32 purgatory_count;
|
||||
uint32 volatile link;
|
||||
/* we want sizeof(LF_PINS) to be 64 to avoid false sharing */
|
||||
#if SIZEOF_INT*2+SIZEOF_CHARP*(LF_PINBOX_PINS+3) != 64
|
||||
char pad[64-sizeof(uint32)*2-sizeof(void*)*(LF_PINBOX_PINS+3)];
|
||||
#endif
|
||||
} LF_PINS;
|
||||
|
||||
/*
|
||||
shortcut macros to do an atomic_wrlock on a structure that uses pins
|
||||
(e.g. lf_hash).
|
||||
*/
|
||||
#define lf_rwlock_by_pins(PINS) \
|
||||
my_atomic_rwlock_wrlock(&(PINS)->pinbox->pinarray.lock)
|
||||
#define lf_rwunlock_by_pins(PINS) \
|
||||
my_atomic_rwlock_wrunlock(&(PINS)->pinbox->pinarray.lock)
|
||||
|
||||
/*
|
||||
compile-time assert, to require "no less than N" pins
|
||||
it's enough if it'll fail on at least one compiler, so
|
||||
we'll enable it on GCC only, which supports zero-length arrays.
|
||||
*/
|
||||
#if defined(__GNUC__) && defined(MY_LF_EXTRA_DEBUG)
|
||||
#define LF_REQUIRE_PINS(N) \
|
||||
static const char require_pins[LF_PINBOX_PINS-N] \
|
||||
__attribute__ ((unused)); \
|
||||
static const int LF_NUM_PINS_IN_THIS_FILE= N;
|
||||
#define _lf_pin(PINS, PIN, ADDR) \
|
||||
( \
|
||||
assert(PIN < LF_NUM_PINS_IN_THIS_FILE), \
|
||||
my_atomic_storeptr(&(PINS)->pin[PIN], (ADDR)) \
|
||||
)
|
||||
#else
|
||||
#define LF_REQUIRE_PINS(N)
|
||||
#define _lf_pin(PINS, PIN, ADDR) my_atomic_storeptr(&(PINS)->pin[PIN], (ADDR))
|
||||
#endif
|
||||
|
||||
#define _lf_unpin(PINS, PIN) _lf_pin(PINS, PIN, NULL)
|
||||
#define lf_pin(PINS, PIN, ADDR) \
|
||||
do { \
|
||||
lf_rwlock_by_pins(PINS); \
|
||||
_lf_pin(PINS, PIN, ADDR); \
|
||||
lf_rwunlock_by_pins(PINS); \
|
||||
} while (0)
|
||||
#define lf_unpin(PINS, PIN) lf_pin(PINS, PIN, NULL)
|
||||
#define _lf_assert_pin(PINS, PIN) assert((PINS)->pin[PIN] != 0)
|
||||
#define _lf_assert_unpin(PINS, PIN) assert((PINS)->pin[PIN] == 0)
|
||||
|
||||
void lf_pinbox_init(LF_PINBOX *pinbox, uint free_ptr_offset,
|
||||
lf_pinbox_free_func *free_func, void * free_func_arg);
|
||||
void lf_pinbox_destroy(LF_PINBOX *pinbox);
|
||||
|
||||
lock_wrap(lf_pinbox_get_pins, LF_PINS *,
|
||||
(LF_PINBOX *pinbox),
|
||||
(pinbox),
|
||||
&pinbox->pinarray.lock)
|
||||
lock_wrap_void(lf_pinbox_put_pins,
|
||||
(LF_PINS *pins),
|
||||
(pins),
|
||||
&pins->pinbox->pinarray.lock)
|
||||
lock_wrap_void(lf_pinbox_free,
|
||||
(LF_PINS *pins, void *addr),
|
||||
(pins, addr),
|
||||
&pins->pinbox->pinarray.lock)
|
||||
|
||||
/*
|
||||
memory allocator, lf_alloc-pin.c
|
||||
*/
|
||||
|
||||
typedef struct st_lf_allocator {
|
||||
LF_PINBOX pinbox;
|
||||
uchar * volatile top;
|
||||
uint element_size;
|
||||
uint32 volatile mallocs;
|
||||
void (*constructor)(uchar *); /* called, when an object is malloc()'ed */
|
||||
void (*destructor)(uchar *); /* called, when an object is free()'d */
|
||||
} LF_ALLOCATOR;
|
||||
|
||||
void lf_alloc_init(LF_ALLOCATOR *allocator, uint size, uint free_ptr_offset);
|
||||
void lf_alloc_destroy(LF_ALLOCATOR *allocator);
|
||||
uint lf_alloc_pool_count(LF_ALLOCATOR *allocator);
|
||||
/*
|
||||
shortcut macros to access underlying pinbox functions from an LF_ALLOCATOR
|
||||
see _lf_pinbox_get_pins() and _lf_pinbox_put_pins()
|
||||
*/
|
||||
#define _lf_alloc_free(PINS, PTR) _lf_pinbox_free((PINS), (PTR))
|
||||
#define lf_alloc_free(PINS, PTR) lf_pinbox_free((PINS), (PTR))
|
||||
#define _lf_alloc_get_pins(A) _lf_pinbox_get_pins(&(A)->pinbox)
|
||||
#define lf_alloc_get_pins(A) lf_pinbox_get_pins(&(A)->pinbox)
|
||||
#define _lf_alloc_put_pins(PINS) _lf_pinbox_put_pins(PINS)
|
||||
#define lf_alloc_put_pins(PINS) lf_pinbox_put_pins(PINS)
|
||||
#define lf_alloc_direct_free(ALLOC, ADDR) my_free((uchar*)(ADDR), MYF(0))
|
||||
|
||||
lock_wrap(lf_alloc_new, void *,
|
||||
(LF_PINS *pins),
|
||||
(pins),
|
||||
&pins->pinbox->pinarray.lock)
|
||||
|
||||
C_MODE_END
|
||||
|
||||
/*
|
||||
extendible hash, lf_hash.c
|
||||
*/
|
||||
#include <hash.h>
|
||||
|
||||
C_MODE_START
|
||||
|
||||
#define LF_HASH_UNIQUE 1
|
||||
|
||||
/* lf_hash overhead per element (that is, sizeof(LF_SLIST) */
|
||||
extern const int LF_HASH_OVERHEAD;
|
||||
|
||||
typedef struct {
|
||||
LF_DYNARRAY array; /* hash itself */
|
||||
LF_ALLOCATOR alloc; /* allocator for elements */
|
||||
my_hash_get_key get_key; /* see HASH */
|
||||
CHARSET_INFO *charset; /* see HASH */
|
||||
uint key_offset, key_length; /* see HASH */
|
||||
uint element_size; /* size of memcpy'ed area on insert */
|
||||
uint flags; /* LF_HASH_UNIQUE, etc */
|
||||
int32 volatile size; /* size of array */
|
||||
int32 volatile count; /* number of elements in the hash */
|
||||
} LF_HASH;
|
||||
|
||||
void lf_hash_init(LF_HASH *hash, uint element_size, uint flags,
|
||||
uint key_offset, uint key_length, my_hash_get_key get_key,
|
||||
CHARSET_INFO *charset);
|
||||
void lf_hash_destroy(LF_HASH *hash);
|
||||
int lf_hash_insert(LF_HASH *hash, LF_PINS *pins, const void *data);
|
||||
void *lf_hash_search(LF_HASH *hash, LF_PINS *pins, const void *key, uint keylen);
|
||||
int lf_hash_delete(LF_HASH *hash, LF_PINS *pins, const void *key, uint keylen);
|
||||
/*
|
||||
shortcut macros to access underlying pinbox functions from an LF_HASH
|
||||
see _lf_pinbox_get_pins() and _lf_pinbox_put_pins()
|
||||
*/
|
||||
#define _lf_hash_get_pins(HASH) _lf_alloc_get_pins(&(HASH)->alloc)
|
||||
#define lf_hash_get_pins(HASH) lf_alloc_get_pins(&(HASH)->alloc)
|
||||
#define _lf_hash_put_pins(PINS) _lf_pinbox_put_pins(PINS)
|
||||
#define lf_hash_put_pins(PINS) lf_pinbox_put_pins(PINS)
|
||||
#define lf_hash_search_unpin(PINS) lf_unpin((PINS), 2)
|
||||
/*
|
||||
cleanup
|
||||
*/
|
||||
|
||||
#undef lock_wrap_void
|
||||
#undef lock_wrap
|
||||
#undef nolock_wrap_void
|
||||
#undef nolock_wrap
|
||||
|
||||
C_MODE_END
|
||||
|
||||
#endif
|
||||
|
|
@ -38,11 +38,29 @@ extern "C" {
|
|||
|
||||
#define my_wc_t ulong
|
||||
|
||||
#define MY_CS_REPLACEMENT_CHARACTER 0xFFFD
|
||||
|
||||
/*
|
||||
On i386 we store Unicode->CS conversion tables for
|
||||
some character sets using Big-endian order,
|
||||
to copy two bytes at onces.
|
||||
This gives some performance improvement.
|
||||
*/
|
||||
#ifdef __i386__
|
||||
#define MB2(x) (((x) >> 8) + (((x) & 0xFF) << 8))
|
||||
#define MY_PUT_MB2(s, code) { *((uint16*)(s))= (code); }
|
||||
#else
|
||||
#define MB2(x) (x)
|
||||
#define MY_PUT_MB2(s, code) { (s)[0]= code >> 8; (s)[1]= code & 0xFF; }
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
typedef struct unicase_info_st
|
||||
{
|
||||
uint16 toupper;
|
||||
uint16 tolower;
|
||||
uint16 sort;
|
||||
uint32 toupper;
|
||||
uint32 tolower;
|
||||
uint32 sort;
|
||||
} MY_UNICASE_INFO;
|
||||
|
||||
|
||||
|
@ -81,13 +99,14 @@ extern MY_UNI_CTYPE my_uni_ctype[256];
|
|||
#define MY_CS_BINSORT 16 /* if binary sort order */
|
||||
#define MY_CS_PRIMARY 32 /* if primary collation */
|
||||
#define MY_CS_STRNXFRM 64 /* if strnxfrm is used for sort */
|
||||
#define MY_CS_UNICODE 128 /* is a charset is full unicode */
|
||||
#define MY_CS_UNICODE 128 /* is a charset is BMP Unicode */
|
||||
#define MY_CS_READY 256 /* if a charset is initialized */
|
||||
#define MY_CS_AVAILABLE 512 /* If either compiled-in or loaded*/
|
||||
#define MY_CS_CSSORT 1024 /* if case sensitive sort order */
|
||||
#define MY_CS_HIDDEN 2048 /* don't display in SHOW */
|
||||
#define MY_CS_PUREASCII 4096 /* if a charset is pure ascii */
|
||||
#define MY_CS_NONASCII 8192 /* if not ASCII-compatible */
|
||||
#define MY_CS_UNICODE_SUPPLEMENT 16384 /* Non-BMP Unicode characters */
|
||||
#define MY_CHARSET_UNDEFINED 0
|
||||
|
||||
/* Character repertoire flags */
|
||||
|
@ -95,7 +114,6 @@ extern MY_UNI_CTYPE my_uni_ctype[256];
|
|||
#define MY_REPERTOIRE_EXTENDED 2 /* Extended characters: U+0080..U+FFFF */
|
||||
#define MY_REPERTOIRE_UNICODE30 3 /* ASCII | EXTENDED: U+0000..U+FFFF */
|
||||
|
||||
|
||||
typedef struct my_uni_idx_st
|
||||
{
|
||||
uint16 from;
|
||||
|
@ -287,10 +305,14 @@ typedef struct charset_info_st
|
|||
|
||||
|
||||
extern MYSQL_PLUGIN_IMPORT CHARSET_INFO my_charset_bin;
|
||||
extern MYSQL_PLUGIN_IMPORT CHARSET_INFO my_charset_latin1;
|
||||
extern MYSQL_PLUGIN_IMPORT CHARSET_INFO my_charset_filename;
|
||||
|
||||
extern CHARSET_INFO my_charset_big5_chinese_ci;
|
||||
extern CHARSET_INFO my_charset_big5_bin;
|
||||
extern CHARSET_INFO my_charset_cp932_japanese_ci;
|
||||
extern CHARSET_INFO my_charset_cp932_bin;
|
||||
extern CHARSET_INFO my_charset_cp1250_czech_ci;
|
||||
extern CHARSET_INFO my_charset_eucjpms_japanese_ci;
|
||||
extern CHARSET_INFO my_charset_eucjpms_bin;
|
||||
extern CHARSET_INFO my_charset_euckr_korean_ci;
|
||||
|
@ -299,7 +321,6 @@ extern CHARSET_INFO my_charset_gb2312_chinese_ci;
|
|||
extern CHARSET_INFO my_charset_gb2312_bin;
|
||||
extern CHARSET_INFO my_charset_gbk_chinese_ci;
|
||||
extern CHARSET_INFO my_charset_gbk_bin;
|
||||
extern MYSQL_PLUGIN_IMPORT CHARSET_INFO my_charset_latin1;
|
||||
extern CHARSET_INFO my_charset_latin1_german2_ci;
|
||||
extern CHARSET_INFO my_charset_latin1_bin;
|
||||
extern CHARSET_INFO my_charset_latin2_czech_ci;
|
||||
|
@ -312,11 +333,22 @@ extern CHARSET_INFO my_charset_ucs2_bin;
|
|||
extern CHARSET_INFO my_charset_ucs2_unicode_ci;
|
||||
extern CHARSET_INFO my_charset_ujis_japanese_ci;
|
||||
extern CHARSET_INFO my_charset_ujis_bin;
|
||||
extern CHARSET_INFO my_charset_utf16_bin;
|
||||
extern CHARSET_INFO my_charset_utf16_general_ci;
|
||||
extern CHARSET_INFO my_charset_utf16_unicode_ci;
|
||||
extern CHARSET_INFO my_charset_utf32_bin;
|
||||
extern CHARSET_INFO my_charset_utf32_general_ci;
|
||||
extern CHARSET_INFO my_charset_utf32_unicode_ci;
|
||||
|
||||
extern CHARSET_INFO my_charset_utf8_general_ci;
|
||||
extern CHARSET_INFO my_charset_utf8_unicode_ci;
|
||||
extern CHARSET_INFO my_charset_utf8_bin;
|
||||
extern CHARSET_INFO my_charset_cp1250_czech_ci;
|
||||
extern MYSQL_PLUGIN_IMPORT CHARSET_INFO my_charset_filename;
|
||||
extern CHARSET_INFO my_charset_utf8mb4_bin;
|
||||
extern CHARSET_INFO my_charset_utf8mb4_general_ci;
|
||||
extern CHARSET_INFO my_charset_utf8mb4_unicode_ci;
|
||||
#define MY_UTF8MB3 "utf8"
|
||||
#define MY_UTF8MB4 "utf8mb4"
|
||||
|
||||
|
||||
/* declarations for simple charsets */
|
||||
extern size_t my_strnxfrm_simple(CHARSET_INFO *, uchar *, size_t,
|
||||
|
@ -413,6 +445,19 @@ my_bool my_like_range_ucs2(CHARSET_INFO *cs,
|
|||
char *min_str, char *max_str,
|
||||
size_t *min_length, size_t *max_length);
|
||||
|
||||
my_bool my_like_range_utf16(CHARSET_INFO *cs,
|
||||
const char *ptr, size_t ptr_length,
|
||||
pbool escape, pbool w_one, pbool w_many,
|
||||
size_t res_length,
|
||||
char *min_str, char *max_str,
|
||||
size_t *min_length, size_t *max_length);
|
||||
|
||||
my_bool my_like_range_utf32(CHARSET_INFO *cs,
|
||||
const char *ptr, size_t ptr_length,
|
||||
pbool escape, pbool w_one, pbool w_many,
|
||||
size_t res_length,
|
||||
char *min_str, char *max_str,
|
||||
size_t *min_length, size_t *max_length);
|
||||
|
||||
int my_wildcmp_8bit(CHARSET_INFO *,
|
||||
const char *str,const char *str_end,
|
||||
|
@ -439,6 +484,14 @@ extern size_t my_caseup_mb(CHARSET_INFO *, char *src, size_t srclen,
|
|||
char *dst, size_t dstlen);
|
||||
extern size_t my_casedn_mb(CHARSET_INFO *, char *src, size_t srclen,
|
||||
char *dst, size_t dstlen);
|
||||
extern size_t my_caseup_mb_varlen(CHARSET_INFO *, char *src, size_t srclen,
|
||||
char *dst, size_t dstlen);
|
||||
extern size_t my_casedn_mb_varlen(CHARSET_INFO *, char *src, size_t srclen,
|
||||
char *dst, size_t dstlen);
|
||||
extern size_t my_caseup_ujis(CHARSET_INFO *, char *src, size_t srclen,
|
||||
char *dst, size_t dstlen);
|
||||
extern size_t my_casedn_ujis(CHARSET_INFO *, char *src, size_t srclen,
|
||||
char *dst, size_t dstlen);
|
||||
extern int my_strcasecmp_mb(CHARSET_INFO * cs,const char *, const char *);
|
||||
|
||||
int my_wildcmp_mb(CHARSET_INFO *,
|
||||
|
@ -455,6 +508,31 @@ uint my_instr_mb(struct charset_info_st *,
|
|||
const char *s, size_t s_length,
|
||||
my_match_t *match, uint nmatch);
|
||||
|
||||
int my_strnncoll_mb_bin(CHARSET_INFO * cs,
|
||||
const uchar *s, size_t slen,
|
||||
const uchar *t, size_t tlen,
|
||||
my_bool t_is_prefix);
|
||||
|
||||
int my_strnncollsp_mb_bin(CHARSET_INFO *cs,
|
||||
const uchar *a, size_t a_length,
|
||||
const uchar *b, size_t b_length,
|
||||
my_bool diff_if_only_endspace_difference);
|
||||
|
||||
int my_wildcmp_mb_bin(CHARSET_INFO *cs,
|
||||
const char *str,const char *str_end,
|
||||
const char *wildstr,const char *wildend,
|
||||
int escape, int w_one, int w_many);
|
||||
|
||||
int my_strcasecmp_mb_bin(CHARSET_INFO * cs __attribute__((unused)),
|
||||
const char *s, const char *t);
|
||||
|
||||
void my_hash_sort_mb_bin(CHARSET_INFO *cs __attribute__((unused)),
|
||||
const uchar *key, size_t len,ulong *nr1, ulong *nr2);
|
||||
|
||||
size_t my_strnxfrm_unicode(CHARSET_INFO *,
|
||||
uchar *dst, size_t dstlen,
|
||||
const uchar *src, size_t srclen);
|
||||
|
||||
int my_wildcmp_unicode(CHARSET_INFO *cs,
|
||||
const char *str, const char *str_end,
|
||||
const char *wildstr, const char *wildend,
|
||||
|
|
|
@ -92,9 +92,6 @@ extern char *stpcpy(char *, const char *); /* For AIX with gcc 2.95.3 */
|
|||
extern char NEAR _dig_vec_upper[];
|
||||
extern char NEAR _dig_vec_lower[];
|
||||
|
||||
/* Defined in strtod.c */
|
||||
extern const double log_10[309];
|
||||
|
||||
#ifndef strmov
|
||||
#define strmov_overlapp(A,B) strmov(A,B)
|
||||
#define strmake_overlapp(A,B,C) strmake(A,B,C)
|
||||
|
@ -196,8 +193,42 @@ extern char *strstr(const char *, const char *);
|
|||
extern int is_prefix(const char *, const char *);
|
||||
|
||||
/* Conversion routines */
|
||||
typedef enum {
|
||||
MY_GCVT_ARG_FLOAT,
|
||||
MY_GCVT_ARG_DOUBLE
|
||||
} my_gcvt_arg_type;
|
||||
|
||||
double my_strtod(const char *str, char **end, int *error);
|
||||
double my_atof(const char *nptr);
|
||||
size_t my_fcvt(double x, int precision, char *to, my_bool *error);
|
||||
size_t my_gcvt(double x, my_gcvt_arg_type type, int width, char *to,
|
||||
my_bool *error);
|
||||
|
||||
#define NOT_FIXED_DEC 31
|
||||
|
||||
/*
|
||||
The longest string my_fcvt can return is 311 + "precision" bytes.
|
||||
Here we assume that we never cal my_fcvt() with precision >= NOT_FIXED_DEC
|
||||
(+ 1 byte for the terminating '\0').
|
||||
*/
|
||||
#define FLOATING_POINT_BUFFER (311 + NOT_FIXED_DEC)
|
||||
|
||||
/*
|
||||
We want to use the 'e' format in some cases even if we have enough space
|
||||
for the 'f' one just to mimic sprintf("%.15g") behavior for large integers,
|
||||
and to improve it for numbers < 10^(-4).
|
||||
That is, for |x| < 1 we require |x| >= 10^(-15), and for |x| > 1 we require
|
||||
it to be integer and be <= 10^DBL_DIG for the 'f' format to be used.
|
||||
We don't lose precision, but make cases like "1e200" or "0.00001" look nicer.
|
||||
*/
|
||||
#define MAX_DECPT_FOR_F_FORMAT DBL_DIG
|
||||
|
||||
/*
|
||||
The maximum possible field width for my_gcvt() conversion.
|
||||
(DBL_DIG + 2) significant digits + sign + "." + ("e-NNN" or
|
||||
MAX_DECPT_FOR_F_FORMAT zeros for cases when |x|<1 and the 'f' format is used).
|
||||
*/
|
||||
#define MY_GCVT_MAX_FIELD_WIDTH (DBL_DIG + 4 + max(5, MAX_DECPT_FOR_F_FORMAT)) \
|
||||
|
||||
extern char *llstr(longlong value,char *buff);
|
||||
extern char *ullstr(longlong value,char *buff);
|
||||
|
@ -212,7 +243,7 @@ extern char *str2int(const char *src,int radix,long lower,long upper,
|
|||
long *val);
|
||||
longlong my_strtoll10(const char *nptr, char **endptr, int *error);
|
||||
#if SIZEOF_LONG == SIZEOF_LONG_LONG
|
||||
#define longlong2str(A,B,C) int2str((A),(B),(C),1)
|
||||
#define ll2str(A,B,C,D) int2str((A),(B),(C),(D))
|
||||
#define longlong10_to_str(A,B,C) int10_to_str((A),(B),(C))
|
||||
#undef strtoll
|
||||
#define strtoll(A,B,C) strtol((A),(B),(C))
|
||||
|
@ -225,7 +256,7 @@ longlong my_strtoll10(const char *nptr, char **endptr, int *error);
|
|||
#endif
|
||||
#else
|
||||
#ifdef HAVE_LONG_LONG
|
||||
extern char *longlong2str(longlong val,char *dst,int radix);
|
||||
extern char *ll2str(longlong val,char *dst,int radix, int upcase);
|
||||
extern char *longlong10_to_str(longlong val,char *dst,int radix);
|
||||
#if (!defined(HAVE_STRTOULL) || defined(NO_STRTOLL_PROTO))
|
||||
extern longlong strtoll(const char *str, char **ptr, int base);
|
||||
|
@ -233,6 +264,7 @@ extern ulonglong strtoull(const char *str, char **ptr, int base);
|
|||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#define longlong2str(A,B,C) ll2str((A),(B),(C),1)
|
||||
|
||||
/* my_vsnprintf.c */
|
||||
|
||||
|
@ -257,4 +289,80 @@ typedef struct st_mysql_lex_string LEX_STRING;
|
|||
#define USTRING_WITH_LEN(X) ((uchar*) X), ((size_t) (sizeof(X) - 1))
|
||||
#define C_STRING_WITH_LEN(X) ((char *) (X)), ((size_t) (sizeof(X) - 1))
|
||||
|
||||
struct st_mysql_const_lex_string
|
||||
{
|
||||
const char *str;
|
||||
size_t length;
|
||||
};
|
||||
typedef struct st_mysql_const_lex_string LEX_CSTRING;
|
||||
|
||||
/* SPACE_INT is a word that contains only spaces */
|
||||
#if SIZEOF_INT == 4
|
||||
#define SPACE_INT 0x20202020
|
||||
#elif SIZEOF_INT == 8
|
||||
#define SPACE_INT 0x2020202020202020
|
||||
#else
|
||||
#error define the appropriate constant for a word full of spaces
|
||||
#endif
|
||||
|
||||
/**
|
||||
Skip trailing space.
|
||||
|
||||
On most systems reading memory in larger chunks (ideally equal to the size of
|
||||
the chinks that the machine physically reads from memory) causes fewer memory
|
||||
access loops and hence increased performance.
|
||||
This is why the 'int' type is used : it's closest to that (according to how
|
||||
it's defined in C).
|
||||
So when we determine the amount of whitespace at the end of a string we do
|
||||
the following :
|
||||
1. We divide the string into 3 zones :
|
||||
a) from the start of the string (__start) to the first multiple
|
||||
of sizeof(int) (__start_words)
|
||||
b) from the end of the string (__end) to the last multiple of sizeof(int)
|
||||
(__end_words)
|
||||
c) a zone that is aligned to sizeof(int) and can be safely accessed
|
||||
through an int *
|
||||
2. We start comparing backwards from (c) char-by-char. If all we find is
|
||||
space then we continue
|
||||
3. If there are elements in zone (b) we compare them as unsigned ints to a
|
||||
int mask (SPACE_INT) consisting of all spaces
|
||||
4. Finally we compare the remaining part (a) of the string char by char.
|
||||
This covers for the last non-space unsigned int from 3. (if any)
|
||||
|
||||
This algorithm works well for relatively larger strings, but it will slow
|
||||
the things down for smaller strings (because of the additional calculations
|
||||
and checks compared to the naive method). Thus the barrier of length 20
|
||||
is added.
|
||||
|
||||
@param ptr pointer to the input string
|
||||
@param len the length of the string
|
||||
@return the last non-space character
|
||||
*/
|
||||
|
||||
static inline const uchar *skip_trailing_space(const uchar *ptr,size_t len)
|
||||
{
|
||||
const uchar *end= ptr + len;
|
||||
|
||||
if (len > 20)
|
||||
{
|
||||
const uchar *end_words= (const uchar *)(intptr)
|
||||
(((ulonglong)(intptr)end) / SIZEOF_INT * SIZEOF_INT);
|
||||
const uchar *start_words= (const uchar *)(intptr)
|
||||
((((ulonglong)(intptr)ptr) + SIZEOF_INT - 1) / SIZEOF_INT * SIZEOF_INT);
|
||||
|
||||
DBUG_ASSERT(((ulonglong)(intptr)ptr) >= SIZEOF_INT);
|
||||
if (end_words > ptr)
|
||||
{
|
||||
while (end > end_words && end[-1] == 0x20)
|
||||
end--;
|
||||
if (end[-1] == 0x20 && start_words < end_words)
|
||||
while (end > start_words && ((unsigned *)end)[-1] == SPACE_INT)
|
||||
end -= SIZEOF_INT;
|
||||
}
|
||||
}
|
||||
while (end > ptr && end[-1] == 0x20)
|
||||
end--;
|
||||
return (end);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -33,15 +33,15 @@ extern ulong my_time_to_wait_for_lock;
|
|||
#define ALARM_INIT my_have_got_alarm=0 ; \
|
||||
alarm_old=(uint) alarm(MY_HOW_OFTEN_TO_ALARM); \
|
||||
alarm_signal=signal(SIGALRM,my_set_alarm_variable);
|
||||
#define ALARM_END VOID(signal(SIGALRM,alarm_signal)); \
|
||||
VOID(alarm(alarm_old));
|
||||
#define ALARM_END (void) signal(SIGALRM,alarm_signal); \
|
||||
(void) alarm(alarm_old);
|
||||
#define ALARM_TEST my_have_got_alarm
|
||||
#ifdef DONT_REMEMBER_SIGNAL
|
||||
#define ALARM_REINIT VOID(alarm(MY_HOW_OFTEN_TO_ALARM)); \
|
||||
VOID(signal(SIGALRM,my_set_alarm_variable));\
|
||||
#define ALARM_REINIT (void) alarm(MY_HOW_OFTEN_TO_ALARM); \
|
||||
(void) signal(SIGALRM,my_set_alarm_variable);\
|
||||
my_have_got_alarm=0;
|
||||
#else
|
||||
#define ALARM_REINIT VOID(alarm((uint) MY_HOW_OFTEN_TO_ALARM)); \
|
||||
#define ALARM_REINIT (void) alarm((uint) MY_HOW_OFTEN_TO_ALARM); \
|
||||
my_have_got_alarm=0;
|
||||
#endif /* DONT_REMEMBER_SIGNAL */
|
||||
#else
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue