SETUP.sh 3.83 KB
Newer Older
unknown's avatar
unknown committed
1 2
#!/bin/sh

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

unknown's avatar
unknown committed
9
prefix_configs="--prefix=/usr/local/mysql"
unknown's avatar
unknown committed
10
just_print=
11
just_configure=
12
full_debug=
13 14 15
while test $# -gt 0
do
  case "$1" in
unknown's avatar
unknown committed
16 17
  --prefix=* ) prefix_configs="$1"; shift ;;
  --with-debug=full ) full_debug="=full"; shift ;;
18
  -c | --just-configure ) just_configure=1; shift ;;
unknown's avatar
unknown committed
19
  -n | --just-print | --print ) just_print=1; shift ;;
20
  -h | --help ) cat <<EOF; exit 0 ;;
21 22 23
Usage: $0 [-h|-n] [configure-options]
  -h, --help              Show this help message.
  -n, --just-print        Don't actually run any commands; just print them.
24
  -c, --just-configure    Stop after running configure.
unknown's avatar
unknown committed
25 26
  --with-debug=full       Build with full debug.
  --prefix=path           Build with prefix 'path'.
27 28 29

Note:  this script is intended for internal use by MySQL developers.
EOF
30 31 32 33
  * )
    echo "Unknown option '$1'"
    exit 1
    break ;;
34 35
  esac
done
36 37 38 39 40

set -e

export AM_MAKEFLAGS
AM_MAKEFLAGS="-j 4"
unknown's avatar
unknown committed
41 42 43 44 45

# 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++)
46
global_warnings="-Wimplicit -Wreturn-type -Wswitch -Wtrigraphs -Wcomment -W -Wchar-subscripts -Wformat -Wparentheses -Wsign-compare -Wwrite-strings -ansi"
unknown's avatar
unknown committed
47
#debug_extra_warnings="-Wuninitialized"
unknown's avatar
unknown committed
48
c_warnings="$global_warnings -Wunused"
unknown's avatar
unknown committed
49
cxx_warnings="$global_warnings -Woverloaded-virtual -Wsign-promo -Wreorder -Wctor-dtor-privacy -Wnon-virtual-dtor"
unknown's avatar
unknown committed
50

51 52
base_max_configs="--with-innodb --with-berkeley-db --with-ndbcluster --with-archive-storage-engine --with-raid --with-openssl --with-raid --with-vio"
max_leave_isam_configs="--with-innodb --with-berkeley-db --with-ndbcluster --with-archive-storage-engine --with-raid --with-openssl --with-raid --with-vio --with-embedded-server"
53 54 55
max_no_es_configs="$max_leave_isam_configs --without-isam"
max_configs="$max_no_es_configs --with-embedded-server"

56 57 58 59 60 61 62 63
path=`dirname $0`
. "$path/check-cpu"

alpha_cflags="$check_cpu_cflags -Wa,-m$cpu_flag"
amd64_cflags="$check_cpu_cflags -DBIG_TABLES"
pentium_cflags="$check_cpu_cflags"
pentium64_cflags="$check_cpu_cflags -m64"
ppc_cflags="$check_cpu_cflags"
unknown's avatar
unknown committed
64 65
sparc_cflags=""

unknown's avatar
unknown committed
66
# be as fast as we can be without losing our ability to backtrace
unknown's avatar
unknown committed
67
fast_cflags="-O3 -fno-omit-frame-pointer"
unknown's avatar
unknown committed
68 69 70
# this is one is for someone who thinks 1% speedup is worth not being
# able to backtrace
reckless_cflags="-O3 -fomit-frame-pointer "
71 72

debug_cflags="-DUNIV_MUST_NOT_INLINE -DEXTRA_DEBUG -DFORCE_INIT_OF_VARS -DSAFEMALLOC -DPEDANTIC_SAFEMALLOC -DSAFE_MUTEX"
73
debug_extra_cflags="-O1 -Wuninitialized"
unknown's avatar
unknown committed
74 75

base_cxxflags="-felide-constructors -fno-exceptions -fno-rtti"
76
amd64_cxxflags="-DBIG_TABLES"
unknown's avatar
unknown committed
77

unknown's avatar
unknown committed
78
base_configs="$prefix_configs --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client --with-readline"
unknown's avatar
unknown committed
79
static_link="--with-mysqld-ldflags=-all-static --with-client-ldflags=-all-static"
80
amd64_configs=""
81
alpha_configs=""	# Not used yet
unknown's avatar
unknown committed
82 83
pentium_configs=""
sparc_configs=""
unknown's avatar
unknown committed
84 85 86 87
# 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"
unknown's avatar
unknown committed
88

89 90 91
debug_configs="--with-debug$full_debug"
if [ -z "$full_debug" ]
then
92
  debug_cflags="$debug_cflags $debug_extra_cflags"
93
fi
unknown's avatar
unknown committed
94

95 96
if gmake --version > /dev/null 2>&1
then
unknown's avatar
unknown committed
97 98 99 100
  make=gmake
else
  make=make
fi
unknown's avatar
unknown committed
101

102
if test -z "$CXX" ; then
103 104
  CXX=gcc
fi
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120

# 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