SETUP.sh 4.5 KB
Newer Older
monty@mysql.com's avatar
monty@mysql.com committed
1 2
#!/bin/sh

3 4
if ! test -f sql/mysqld.cc
then
5 6 7 8
  echo "You must run this script from the MySQL top-level directory"
  exit 1
fi

9
prefix_configs="--prefix=/usr/local/mysql"
monty@narttu.mysql.fi's avatar
monty@narttu.mysql.fi committed
10
just_print=
11
just_configure=
12
full_debug=
13
if test -n "$MYSQL_BUILD_PREFIX"
14 15 16 17
then
  prefix_configs="--prefix=$MYSQL_BUILD_PREFIX"
fi

18 19 20
while test $# -gt 0
do
  case "$1" in
21 22
  --prefix=* ) prefix_configs="$1"; shift ;;
  --with-debug=full ) full_debug="=full"; shift ;;
23
  -c | --just-configure ) just_configure=1; shift ;;
monty@narttu.mysql.fi's avatar
monty@narttu.mysql.fi committed
24
  -n | --just-print | --print ) just_print=1; shift ;;
25
  -h | --help ) cat <<EOF; exit 0 ;;
26 27 28
Usage: $0 [-h|-n] [configure-options]
  -h, --help              Show this help message.
  -n, --just-print        Don't actually run any commands; just print them.
29
  -c, --just-configure    Stop after running configure.
30 31
  --with-debug=full       Build with full debug.
  --prefix=path           Build with prefix 'path'.
32 33 34

Note:  this script is intended for internal use by MySQL developers.
EOF
35 36 37 38
  * )
    echo "Unknown option '$1'"
    exit 1
    break ;;
39 40
  esac
done
41 42 43 44 45

set -e

export AM_MAKEFLAGS
AM_MAKEFLAGS="-j 4"
46

47 48 49
# SSL library to use. Should be changed to --with-yassl
SSL_LIBRARY=--with-openssl

50 51 52 53
# If you are not using codefusion add "-Wpointer-arith" to WARNINGS
# The following warning flag will give too many warnings:
# -Wshadow -Wunused  -Winline (The later isn't usable in C++ as
# __attribute()__ doesn't work with gnu C++)
54

monty@hundin.mysql.fi's avatar
monty@hundin.mysql.fi committed
55
global_warnings="-Wimplicit -Wreturn-type -Wswitch -Wtrigraphs -Wcomment -W -Wchar-subscripts -Wformat -Wparentheses -Wsign-compare -Wwrite-strings"
monty@hundin.mysql.fi's avatar
monty@hundin.mysql.fi committed
56
#debug_extra_warnings="-Wuninitialized"
57
c_warnings="$global_warnings -Wunused"
monty@hundin.mysql.fi's avatar
monty@hundin.mysql.fi committed
58
cxx_warnings="$global_warnings -Woverloaded-virtual -Wsign-promo -Wreorder -Wctor-dtor-privacy -Wnon-virtual-dtor"
59
base_max_configs="--with-innodb --with-berkeley-db --with-ndbcluster --with-archive-storage-engine --with-big-tables --with-blackhole-storage-engine --with-federated-storage-engine --with-csv-storage-engine --with-partition $SSL_LIBRARY"
patg@krsna.patg.net's avatar
patg@krsna.patg.net committed
60
base_max_no_ndb_configs="--with-innodb --with-berkeley-db --without-ndbcluster --with-archive-storage-engine --with-big-tables --with-blackhole-storage-engine --with-federated-storage-engine --with-csv-storage-engine --with-partition $SSL_LIBRARY"
61
max_leave_isam_configs="--with-innodb --with-berkeley-db --with-ndbcluster --with-archive-storage-engine --with-federated-storage-engine --with-blackhole-storage-engine --with-csv-storage-engine --with-embedded-server --with-big-tables --with-partition $SSL_LIBRARY"
62
max_configs="$base_max_configs --with-embedded-server"
63
max_no_ndb_configs="$base_max_no_ndb_configs --with-embedded-server"
64

65 66 67 68
path=`dirname $0`
. "$path/check-cpu"

alpha_cflags="$check_cpu_cflags -Wa,-m$cpu_flag"
69
amd64_cflags="$check_cpu_cflags"
70 71 72
pentium_cflags="$check_cpu_cflags"
pentium64_cflags="$check_cpu_cflags -m64"
ppc_cflags="$check_cpu_cflags"
73 74
sparc_cflags=""

75
# be as fast as we can be without losing our ability to backtrace
monty@donna.mysql.fi's avatar
monty@donna.mysql.fi committed
76
fast_cflags="-O3 -fno-omit-frame-pointer"
77 78 79
# this is one is for someone who thinks 1% speedup is worth not being
# able to backtrace
reckless_cflags="-O3 -fomit-frame-pointer "
80 81

debug_cflags="-DUNIV_MUST_NOT_INLINE -DEXTRA_DEBUG -DFORCE_INIT_OF_VARS -DSAFEMALLOC -DPEDANTIC_SAFEMALLOC -DSAFE_MUTEX"
82
debug_extra_cflags="-O1 -Wuninitialized"
83 84

base_cxxflags="-felide-constructors -fno-exceptions -fno-rtti"
85
amd64_cxxflags=""				# If dropping '--with-big-tables', add here  "-DBIG_TABLES"
86

87
base_configs="$prefix_configs --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client --with-readline --with-big-tables"
88
static_link="--with-mysqld-ldflags=-all-static --with-client-ldflags=-all-static"
89
amd64_configs=""
90
alpha_configs=""	# Not used yet
91 92
pentium_configs=""
sparc_configs=""
sasha@mysql.sashanet.com's avatar
sasha@mysql.sashanet.com committed
93 94 95 96
# 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"
97

98 99 100
debug_configs="--with-debug$full_debug"
if [ -z "$full_debug" ]
then
101
  debug_cflags="$debug_cflags $debug_extra_cflags"
102
fi
103

104 105
if gmake --version > /dev/null 2>&1
then
106 107 108 109
  make=gmake
else
  make=make
fi
monty@hundin.mysql.fi's avatar
monty@hundin.mysql.fi committed
110

111 112 113 114
if test -z "$CC" ; then
  CC=gcc
fi

115
if test -z "$CXX" ; then
116 117
  CXX=gcc
fi
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133

# If ccache (a compiler cache which reduces build time)
# (http://samba.org/ccache) is installed, use it.
# We use 'grep' and hope 'grep' will work as expected
# (returns 0 if finds lines)
if ccache -V > /dev/null 2>&1
then
  if ! (echo "$CC" | grep "ccache" > /dev/null)
  then
    CC="ccache $CC"
  fi
  if ! (echo "$CXX" | grep "ccache" > /dev/null)
  then
    CXX="ccache $CXX"
  fi
fi