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"`;;
|
|
|
|
-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
|
|
|
|
AM_MAKEFLAGS="-j 4"
|
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"
|
|
|
|
warnings="$warnings -Wwrite-strings"
|
|
|
|
# C warnings
|
|
|
|
c_warnings="$warnings -Wunused"
|
|
|
|
# C++ warnings
|
|
|
|
cxx_warnings="$warnings -Woverloaded-virtual -Wsign-promo -Wreorder"
|
|
|
|
cxx_warnings="$warnings -Wctor-dtor-privacy -Wnon-virtual-dtor"
|
|
|
|
# Added unless --with-debug=full
|
|
|
|
debug_extra_cflags="-O1 -Wuninitialized"
|
|
|
|
else
|
|
|
|
warnings="-W -Wall -ansi -pedantic -Wno-long-long -D_POSIX_SOURCE"
|
|
|
|
c_warnings="$warnings"
|
|
|
|
cxx_warnings="$warnings -std=c++98"
|
|
|
|
# NOTE: warning mode should not influence optimize/debug mode.
|
|
|
|
# Please feel free to add a separate option if you don't feel it's an overkill.
|
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
|
|
|
|
valgrind_flags="-USAFEMALLOC -UFORCE_INIT_OF_VARS -DHAVE_purify "
|
|
|
|
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 "
|
|
|
|
debug_cflags="$debug_cflags -DSAFEMALLOC -DPEDANTIC_SAFEMALLOC -DSAFE_MUTEX"
|
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
|
|
|
|
2006-04-07 00:25:59 +02:00
|
|
|
#
|
|
|
|
# Configuration options.
|
|
|
|
#
|
|
|
|
base_configs="--prefix=$prefix --enable-assembler "
|
|
|
|
base_configs="$base_configs --with-extra-charsets=complex "
|
|
|
|
base_configs="$base_configs --enable-thread-safe-client --with-readline "
|
|
|
|
base_configs="$base_configs --with-big-tables"
|
|
|
|
|
|
|
|
static_link="--with-mysqld-ldflags=-all-static "
|
|
|
|
static_link="$static_link --with-client-ldflags=-all-static"
|
2002-03-02 20:45:44 +01:00
|
|
|
# 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"
|
2000-12-18 22:24:19 +01:00
|
|
|
|
2006-04-07 00:25:59 +02:00
|
|
|
|
2006-05-02 06:33:09 +02:00
|
|
|
max_no_embedded_configs="$SSL_LIBRARY --with-plugins=max"
|
|
|
|
max_no_ndb_configs="$SSL_LIBRARY --with-plugins=max-no-ndb --with-embedded-server"
|
|
|
|
max_configs="$SSL_LIBRARY --with-plugins=max --with-embedded-server"
|
2006-04-07 00:25:59 +02:00
|
|
|
|
|
|
|
#
|
|
|
|
# CPU and platform specific compilation flags.
|
|
|
|
#
|
|
|
|
alpha_cflags="$check_cpu_cflags -Wa,-m$cpu_flag"
|
|
|
|
amd64_cflags="$check_cpu_cflags"
|
|
|
|
amd64_cxxflags="" # If dropping '--with-big-tables', add here "-DBIG_TABLES"
|
|
|
|
pentium64_cflags="$check_cpu_cflags -m64"
|
|
|
|
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
|
2003-04-09 14:53:20 +02:00
|
|
|
CXX=gcc
|
|
|
|
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)
|
2006-10-16 18:57:33 +02: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
|