3
########################################################################
7
echo "$1" | sed 's/^--[a-zA-Z_-]*=//'
13
Usage: $0 [-h|-n] [configure-options]
14
-h, --help Show this help message.
15
-n, --just-print Don't actually run any commands; just print them.
16
-c, --just-configure Stop after running configure.
17
--with-debug=full Build with full debug.
18
--warning-mode=[old|pedantic]
19
Influences the debug flags. Old is default.
20
--prefix=path Build with prefix 'path'.
22
Note: this script is intended for internal use by MySQL developers.
32
prefix=`get_key_value "$1"`;;
36
warning_mode=`get_key_value "$1"`;;
37
-c | --just-configure)
39
-n | --just-print | --print)
45
echo "Unknown option '$1'"
52
########################################################################
54
if test ! -f sql/mysqld.cc
56
echo "You must run this script from the MySQL top-level directory"
60
prefix="/usr/local/mysql"
68
if test -n "$MYSQL_BUILD_PREFIX"
70
prefix="$MYSQL_BUILD_PREFIX"
76
# Check for the CPU and set up CPU specific flags. We may reset them
85
if [ "x$warning_mode" != "xpedantic" ]; then
86
# Both C and C++ warnings
87
warnings="-Wimplicit -Wreturn-type -Wswitch -Wtrigraphs -Wcomment -W"
88
warnings="$warnings -Wchar-subscripts -Wformat -Wparentheses -Wsign-compare"
89
warnings="$warnings -Wwrite-strings -Wunused-function -Wunused-label -Wunused-value -Wunused-variable"
91
# For more warnings, uncomment the following line
92
# warnings="$global_warnings -Wshadow"
95
c_warnings="$warnings -Wunused-parameter"
97
cxx_warnings="$warnings"
98
# cxx_warnings="$cxx_warnings -Woverloaded-virtual -Wsign-promo"
99
cxx_warnings="$cxx_warnings -Wreorder"
100
cxx_warnings="$cxx_warnings -Wctor-dtor-privacy -Wnon-virtual-dtor"
101
# Added unless --with-debug=full
102
debug_extra_cflags="-O1 -Wuninitialized"
104
warnings="-W -Wall -ansi -pedantic -Wno-long-long -Wno-unused -D_POSIX_SOURCE"
105
c_warnings="$warnings"
106
cxx_warnings="$warnings -std=c++98"
107
# NOTE: warning mode should not influence optimize/debug mode.
108
# Please feel free to add a separate option if you don't feel it's an overkill.
109
debug_extra_cflags="-O0"
110
# Reset CPU flags (-mtune), they don't work in -pedantic mode
114
# Set flags for various build configurations.
115
# Used in -valgrind builds
116
valgrind_flags="-UFORCE_INIT_OF_VARS -DHAVE_purify "
117
valgrind_flags="$valgrind_flags -DMYSQL_SERVER_SUFFIX=-valgrind-max"
119
# Used in -debug builds
120
debug_cflags="-DUNIV_MUST_NOT_INLINE -DEXTRA_DEBUG -DFORCE_INIT_OF_VARS "
121
debug_cflags="$debug_cflags -DSAFE_MUTEX"
122
error_inject="--with-error-inject "
124
# Base C++ flags for all builds
125
base_cxxflags="-felide-constructors -fno-exceptions -fno-rtti"
127
# Flags for optimizing builds.
128
# Be as fast as we can be without losing our ability to backtrace.
129
fast_cflags="-O3 -fno-omit-frame-pointer"
131
debug_configs="--with-debug$full_debug"
132
if [ -z "$full_debug" ]
134
debug_cflags="$debug_cflags $debug_extra_cflags"
138
# Configuration options.
140
base_configs="--prefix=$prefix --enable-assembler "
141
base_configs="$base_configs --with-extra-charsets=complex "
142
base_configs="$base_configs --enable-thread-safe-client "
143
base_configs="$base_configs --with-big-tables"
145
if test -d "$path/../cmd-line-utils/readline"
147
base_configs="$base_configs --with-readline"
148
elif test -d "$path/../cmd-line-utils/libedit"
150
base_configs="$base_configs --with-libedit"
153
static_link="--with-mysqld-ldflags=-all-static "
154
static_link="$static_link --with-client-ldflags=-all-static"
155
# we need local-infile in all binaries for rpl000001
156
# if you need to disable local-infile in the client, write a build script
157
# and unset local_infile_configs
158
local_infile_configs="--enable-local-infile"
161
max_no_embedded_configs="--with-plugins=max"
162
max_configs="--with-plugins=max --with-libevent"
165
# CPU and platform specific compilation flags.
167
alpha_cflags="$check_cpu_cflags -Wa,-m$cpu_flag"
168
amd64_cflags="$check_cpu_cflags"
169
amd64_cxxflags="" # If dropping '--with-big-tables', add here "-DBIG_TABLES"
170
pentium_cflags="$check_cpu_cflags"
171
pentium64_cflags="$check_cpu_cflags -m64"
172
ppc_cflags="$check_cpu_cflags"
173
sparc_cflags="-mcpu=ultrasparc"
175
if gmake --version > /dev/null 2>&1
182
if test -z "$CC" ; then
186
if test -z "$CXX" ; then
190
# If ccache (a compiler cache which reduces build time)
191
# (http://samba.org/ccache) is installed, use it.
192
# We use 'grep' and hope 'grep' will work as expected
193
# (returns 0 if finds lines)
194
if test "$USING_GCOV" != "1"
196
# Not using gcov; Safe to use ccache
197
CCACHE_GCOV_VERSION_ENABLED=1
200
if ccache -V > /dev/null 2>&1 && test "$CCACHE_GCOV_VERSION_ENABLED" = "1"
202
echo "$CC" | grep "ccache" > /dev/null || CC="ccache $CC"
203
echo "$CXX" | grep "ccache" > /dev/null || CXX="ccache $CXX"
208
# The -fprofile-arcs and -ftest-coverage options cause GCC to instrument the
209
# code with profiling information used by gcov.
210
# The -DDISABLE_TAO_ASM is needed to avoid build failures in Yassl.
211
# The -DHAVE_gcov enables code to write out coverage info even when crashing.
213
gcov_compile_flags="-fprofile-arcs -ftest-coverage"
214
gcov_compile_flags="$gcov_compile_flags -DDISABLE_TAO_ASM"
215
gcov_compile_flags="$gcov_compile_flags -DMYSQL_SERVER_SUFFIX=-gcov -DHAVE_gcov"
217
# GCC4 needs -fprofile-arcs -ftest-coverage on the linker command line (as well
218
# as on the compiler command line), and this requires setting LDFLAGS for BDB.
220
gcov_link_flags="-fprofile-arcs -ftest-coverage"
222
gcov_configs="--disable-shared"
226
gprof_compile_flags="-O2 -pg -g"
228
gprof_link_flags="--disable-shared $static_link"