2004-11-03 11:39:38 +01:00
|
|
|
#!/bin/sh
|
|
|
|
|
2006-04-07 00:25:59 +02:00
|
|
|
########################################################################
|
|
|
|
|
|
|
|
get_key_value()
|
|
|
|
{
|
|
|
|
echo "$1" | sed 's/^--[a-zA-Z_-]*=//'
|
|
|
|
}
|
|
|
|
|
|
|
|
usage()
|
|
|
|
{
|
|
|
|
cat <<EOF
|
|
|
|
Usage: $0 [-h|-n] [configure-options]
|
|
|
|
-h, --help Show this help message.
|
|
|
|
-n, --just-print Don't actually run any commands; just print them.
|
|
|
|
-c, --just-configure Stop after running configure.
|
|
|
|
--with-debug=full Build with full debug.
|
|
|
|
--warning-mode=[old|pedantic]
|
|
|
|
Influences the debug flags. Old is default.
|
|
|
|
--prefix=path Build with prefix 'path'.
|
|
|
|
|
|
|
|
Note: this script is intended for internal use by MySQL developers.
|
|
|
|
EOF
|
|
|
|
}
|
|
|
|
|
|
|
|
parse_options()
|
|
|
|
{
|
|
|
|
while test $# -gt 0
|
|
|
|
do
|
|
|
|
case "$1" in
|
|
|
|
--prefix=*)
|
|
|
|
prefix=`get_key_value "$1"`;;
|
|
|
|
--with-debug=full)
|
|
|
|
full_debug="=full";;
|
|
|
|
--warning-mode=*)
|
|
|
|
warning_mode=`get_key_value "$1"`;;
|
2009-12-06 18:34:54 +01:00
|
|
|
--extra-flags=*)
|
|
|
|
EXTRA_FLAGS=`get_key_value "$1"`;;
|
|
|
|
--extra-cflags=*)
|
|
|
|
EXTRA_CFLAGS=`get_key_value "$1"`;;
|
|
|
|
--extra-cxxflags=*)
|
|
|
|
EXTRA_CXXFLAGS=`get_key_value "$1"`;;
|
|
|
|
--extra-configs=*)
|
|
|
|
EXTRA_CONFIGS=`get_key_value "$1"`;;
|
2006-04-07 00:25:59 +02:00
|
|
|
-c | --just-configure)
|
|
|
|
just_configure=1;;
|
|
|
|
-n | --just-print | --print)
|
|
|
|
just_print=1;;
|
|
|
|
-h | --help)
|
|
|
|
usage
|
|
|
|
exit 0;;
|
|
|
|
*)
|
|
|
|
echo "Unknown option '$1'"
|
|
|
|
exit 1;;
|
|
|
|
esac
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
########################################################################
|
|
|
|
|
2006-08-30 23:20:01 +02:00
|
|
|
if test ! -f sql/mysqld.cc
|
2001-01-31 02:43:16 +01:00
|
|
|
then
|
2000-12-18 22:24:19 +01:00
|
|
|
echo "You must run this script from the MySQL top-level directory"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2006-04-07 00:25:59 +02:00
|
|
|
prefix="/usr/local/mysql"
|
2003-10-08 20:50:05 +02:00
|
|
|
just_print=
|
2001-03-04 22:34:26 +01:00
|
|
|
just_configure=
|
2004-10-04 13:43:16 +02:00
|
|
|
full_debug=
|
2006-04-07 00:25:59 +02:00
|
|
|
warning_mode=
|
|
|
|
|
|
|
|
parse_options "$@"
|
|
|
|
|
2005-09-28 17:04:08 +02:00
|
|
|
if test -n "$MYSQL_BUILD_PREFIX"
|
2005-09-17 03:10:36 +02:00
|
|
|
then
|
2006-04-07 00:25:59 +02:00
|
|
|
prefix="$MYSQL_BUILD_PREFIX"
|
2005-09-17 03:10:36 +02:00
|
|
|
fi
|
|
|
|
|
2001-01-31 02:43:16 +01:00
|
|
|
set -e
|
|
|
|
|
2006-04-07 00:25:59 +02:00
|
|
|
#
|
|
|
|
# Check for the CPU and set up CPU specific flags. We may reset them
|
|
|
|
# later.
|
|
|
|
#
|
|
|
|
path=`dirname $0`
|
|
|
|
. "$path/check-cpu"
|
|
|
|
|
2001-01-31 02:43:16 +01:00
|
|
|
export AM_MAKEFLAGS
|
2009-05-09 06:01:53 +02:00
|
|
|
# Default to a parallel build, but only if AM_MAKEFLAGS is not set.
|
|
|
|
# (So buildbots can easily disable this behaviour if required.)
|
|
|
|
if test -z "$AM_MAKEFLAGS"
|
|
|
|
then
|
|
|
|
AM_MAKEFLAGS="-j 6"
|
|
|
|
fi
|
|
|
|
|
2000-12-18 22:24:19 +01:00
|
|
|
|
2006-05-17 13:59:37 +02:00
|
|
|
# SSL library to use.--with-ssl will select our bundled yaSSL
|
|
|
|
# implementation of SSL. To use openSSl you will nee too point out
|
|
|
|
# the location of openSSL headers and lbs on your system.
|
|
|
|
# Ex --with-ssl=/usr
|
|
|
|
SSL_LIBRARY=--with-ssl
|
2005-11-02 14:45:25 +01:00
|
|
|
|
2006-04-07 00:25:59 +02:00
|
|
|
if [ "x$warning_mode" != "xpedantic" ]; then
|
|
|
|
# Both C and C++ warnings
|
|
|
|
warnings="-Wimplicit -Wreturn-type -Wswitch -Wtrigraphs -Wcomment -W"
|
|
|
|
warnings="$warnings -Wchar-subscripts -Wformat -Wparentheses -Wsign-compare"
|
2007-01-25 13:12:02 +01:00
|
|
|
warnings="$warnings -Wwrite-strings -Wunused-function -Wunused-label -Wunused-value -Wunused-variable"
|
2005-11-02 14:45:25 +01:00
|
|
|
|
2006-12-14 23:51:37 +01:00
|
|
|
# For more warnings, uncomment the following line
|
2007-01-27 02:46:45 +01:00
|
|
|
# warnings="$global_warnings -Wshadow"
|
|
|
|
|
2006-04-07 00:25:59 +02:00
|
|
|
# C warnings
|
2007-01-22 17:42:52 +01:00
|
|
|
c_warnings="$warnings -Wunused-parameter"
|
2006-04-07 00:25:59 +02:00
|
|
|
# C++ warnings
|
2007-12-14 14:21:37 +01:00
|
|
|
cxx_warnings="$warnings"
|
|
|
|
# cxx_warnings="$cxx_warnings -Woverloaded-virtual -Wsign-promo"
|
|
|
|
cxx_warnings="$cxx_warnings -Wreorder"
|
|
|
|
cxx_warnings="$cxx_warnings -Wctor-dtor-privacy -Wnon-virtual-dtor"
|
2006-04-07 00:25:59 +02:00
|
|
|
# Added unless --with-debug=full
|
2008-11-05 16:40:23 +01:00
|
|
|
debug_extra_cflags="-O0 -g3 -gdwarf-2" #1 -Wuninitialized"
|
2006-04-07 00:25:59 +02:00
|
|
|
else
|
2007-08-30 19:19:05 +02:00
|
|
|
warnings="-W -Wall -ansi -pedantic -Wno-long-long -Wno-unused -D_POSIX_SOURCE"
|
2006-04-07 00:25:59 +02:00
|
|
|
c_warnings="$warnings"
|
|
|
|
cxx_warnings="$warnings -std=c++98"
|
|
|
|
# NOTE: warning mode should not influence optimize/debug mode.
|
|
|
|
# Please feel free to add a separate option if you don't feel it's an overkill.
|
2006-11-06 09:30:54 +01:00
|
|
|
debug_extra_cflags="-O0"
|
2006-04-07 00:25:59 +02:00
|
|
|
# Reset CPU flags (-mtune), they don't work in -pedantic mode
|
|
|
|
check_cpu_cflags=""
|
|
|
|
fi
|
2000-12-18 22:24:19 +01:00
|
|
|
|
2006-04-07 00:25:59 +02:00
|
|
|
# Set flags for various build configurations.
|
|
|
|
# Used in -valgrind builds
|
2009-05-06 14:03:24 +02:00
|
|
|
valgrind_flags="-USAFEMALLOC -UFORCE_INIT_OF_VARS -DHAVE_valgrind "
|
2006-04-07 00:25:59 +02:00
|
|
|
valgrind_flags="$valgrind_flags -DMYSQL_SERVER_SUFFIX=-valgrind-max"
|
|
|
|
#
|
|
|
|
# Used in -debug builds
|
|
|
|
debug_cflags="-DUNIV_MUST_NOT_INLINE -DEXTRA_DEBUG -DFORCE_INIT_OF_VARS "
|
2009-03-22 13:16:09 +01:00
|
|
|
debug_cflags="$debug_cflags -DSAFEMALLOC -DPEDANTIC_SAFEMALLOC"
|
2006-02-03 18:05:29 +01:00
|
|
|
error_inject="--with-error-inject "
|
2006-04-07 00:25:59 +02:00
|
|
|
#
|
|
|
|
# Base C++ flags for all builds
|
|
|
|
base_cxxflags="-felide-constructors -fno-exceptions -fno-rtti"
|
|
|
|
#
|
|
|
|
# Flags for optimizing builds.
|
|
|
|
# Be as fast as we can be without losing our ability to backtrace.
|
2001-04-13 21:09:33 +02:00
|
|
|
fast_cflags="-O3 -fno-omit-frame-pointer"
|
2004-10-04 13:43:16 +02:00
|
|
|
|
2006-04-07 00:25:59 +02:00
|
|
|
debug_configs="--with-debug$full_debug"
|
|
|
|
if [ -z "$full_debug" ]
|
|
|
|
then
|
|
|
|
debug_cflags="$debug_cflags $debug_extra_cflags"
|
|
|
|
fi
|
2000-12-18 22:24:19 +01:00
|
|
|
|
2009-10-29 01:04:56 +01:00
|
|
|
static_link="--with-mysqld-ldflags=-all-static "
|
|
|
|
static_link="$static_link --with-client-ldflags=-all-static"
|
|
|
|
# we need local-infile in all binaries for rpl000001
|
|
|
|
# if you need to disable local-infile in the client, write a build script
|
|
|
|
# and unset local_infile_configs
|
|
|
|
local_infile_configs="--enable-local-infile"
|
|
|
|
|
2006-04-07 00:25:59 +02:00
|
|
|
#
|
|
|
|
# Configuration options.
|
|
|
|
#
|
|
|
|
base_configs="--prefix=$prefix --enable-assembler "
|
|
|
|
base_configs="$base_configs --with-extra-charsets=complex "
|
2007-01-25 09:18:10 +01:00
|
|
|
base_configs="$base_configs --enable-thread-safe-client "
|
2006-04-07 00:25:59 +02:00
|
|
|
base_configs="$base_configs --with-big-tables"
|
2009-09-10 10:11:23 +02:00
|
|
|
base_configs="$base_configs --with-plugin-maria --with-maria-tmp-tables --without-plugin-innodb_plugin"
|
2009-10-29 01:04:56 +01:00
|
|
|
# Compile our client programs with static libraries to allow them to be moved
|
|
|
|
base_configs="$base_configs --with-mysqld-ldflags=-static --with-client-ldflags=-static"
|
2006-04-07 00:25:59 +02:00
|
|
|
|
2007-01-25 08:46:07 +01:00
|
|
|
if test -d "$path/../cmd-line-utils/readline"
|
|
|
|
then
|
|
|
|
base_configs="$base_configs --with-readline"
|
|
|
|
elif test -d "$path/../cmd-line-utils/libedit"
|
|
|
|
then
|
|
|
|
base_configs="$base_configs --with-libedit"
|
|
|
|
fi
|
|
|
|
|
2006-05-02 06:33:09 +02:00
|
|
|
max_no_embedded_configs="$SSL_LIBRARY --with-plugins=max"
|
2009-10-06 08:57:22 +02:00
|
|
|
max_no_qc_configs="$SSL_LIBRARY --with-plugins=max --without-query-cache"
|
2009-03-12 23:27:35 +01:00
|
|
|
max_no_ndb_configs="$SSL_LIBRARY --with-plugins=max-no-ndb --with-embedded-server --with-libevent"
|
2009-09-29 21:02:48 +02:00
|
|
|
max_configs="$SSL_LIBRARY --with-plugins=max --with-embedded-server --with-libevent"
|
2009-01-31 22:22:44 +01:00
|
|
|
# Disable NDB in maria max builds
|
|
|
|
max_configs=$max_no_ndb_configs
|
2006-04-07 00:25:59 +02:00
|
|
|
|
|
|
|
#
|
|
|
|
# CPU and platform specific compilation flags.
|
|
|
|
#
|
|
|
|
alpha_cflags="$check_cpu_cflags -Wa,-m$cpu_flag"
|
2008-02-07 19:51:50 +01:00
|
|
|
amd64_cflags="$check_cpu_cflags"
|
2006-04-07 00:25:59 +02:00
|
|
|
amd64_cxxflags="" # If dropping '--with-big-tables', add here "-DBIG_TABLES"
|
2008-02-07 19:51:50 +01:00
|
|
|
pentium_cflags="$check_cpu_cflags"
|
|
|
|
pentium64_cflags="$check_cpu_cflags -m64"
|
2006-04-07 00:25:59 +02:00
|
|
|
ppc_cflags="$check_cpu_cflags"
|
|
|
|
sparc_cflags=""
|
2000-12-18 22:24:19 +01:00
|
|
|
|
2001-01-31 02:43:16 +01:00
|
|
|
if gmake --version > /dev/null 2>&1
|
|
|
|
then
|
2000-12-18 22:24:19 +01:00
|
|
|
make=gmake
|
|
|
|
else
|
|
|
|
make=make
|
|
|
|
fi
|
2001-10-30 15:31:35 +01:00
|
|
|
|
2005-10-06 16:54:43 +02:00
|
|
|
if test -z "$CC" ; then
|
|
|
|
CC=gcc
|
|
|
|
fi
|
|
|
|
|
2003-05-23 18:20:57 +02:00
|
|
|
if test -z "$CXX" ; then
|
2010-01-04 09:27:50 +01:00
|
|
|
CXX=g++
|
2003-04-09 14:53:20 +02:00
|
|
|
fi
|
2003-05-23 18:20:57 +02:00
|
|
|
|
|
|
|
# If ccache (a compiler cache which reduces build time)
|
|
|
|
# (http://samba.org/ccache) is installed, use it.
|
|
|
|
# We use 'grep' and hope 'grep' will work as expected
|
|
|
|
# (returns 0 if finds lines)
|
2007-01-29 00:47:35 +01:00
|
|
|
if test "$USING_GCOV" != "1"
|
|
|
|
then
|
|
|
|
# Not using gcov; Safe to use ccache
|
|
|
|
CCACHE_GCOV_VERSION_ENABLED=1
|
|
|
|
fi
|
|
|
|
|
2007-01-07 18:21:42 +01:00
|
|
|
if ccache -V > /dev/null 2>&1 && test "$CCACHE_GCOV_VERSION_ENABLED" = "1"
|
2003-05-23 18:20:57 +02:00
|
|
|
then
|
2006-08-29 01:13:06 +02:00
|
|
|
echo "$CC" | grep "ccache" > /dev/null || CC="ccache $CC"
|
|
|
|
echo "$CXX" | grep "ccache" > /dev/null || CXX="ccache $CXX"
|
2003-05-23 18:20:57 +02:00
|
|
|
fi
|
2007-08-16 02:10:16 +02:00
|
|
|
|
|
|
|
# gcov
|
|
|
|
|
|
|
|
# The -fprofile-arcs and -ftest-coverage options cause GCC to instrument the
|
|
|
|
# code with profiling information used by gcov.
|
|
|
|
# The -DDISABLE_TAO_ASM is needed to avoid build failures in Yassl.
|
|
|
|
# The -DHAVE_gcov enables code to write out coverage info even when crashing.
|
|
|
|
|
|
|
|
gcov_compile_flags="-fprofile-arcs -ftest-coverage"
|
|
|
|
gcov_compile_flags="$gcov_compile_flags -DDISABLE_TAO_ASM"
|
|
|
|
gcov_compile_flags="$gcov_compile_flags -DMYSQL_SERVER_SUFFIX=-gcov -DHAVE_gcov"
|
|
|
|
|
|
|
|
# GCC4 needs -fprofile-arcs -ftest-coverage on the linker command line (as well
|
|
|
|
# as on the compiler command line), and this requires setting LDFLAGS for BDB.
|
|
|
|
|
|
|
|
gcov_link_flags="-fprofile-arcs -ftest-coverage"
|
|
|
|
|
2007-08-23 02:11:01 +02:00
|
|
|
gcov_configs="--disable-shared"
|
2007-08-16 02:10:16 +02:00
|
|
|
|
|
|
|
# gprof
|
|
|
|
|
|
|
|
gprof_compile_flags="-O2 -pg -g"
|
|
|
|
|
|
|
|
gprof_link_flags="--disable-shared $static_link"
|
|
|
|
|