| 1 |
#!/bin/sh |
| 2 |
|
| 3 |
# Copyright (c) 2004, 2005, 2007 MySQL AB |
| 4 |
# Use is subject to license terms |
| 5 |
# |
| 6 |
# This program is free software; you can redistribute it and/or modify |
| 7 |
# it under the terms of the GNU General Public License as published by |
| 8 |
# the Free Software Foundation; version 2 of the License. |
| 9 |
# |
| 10 |
# This program is distributed in the hope that it will be useful, |
| 11 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 |
# GNU General Public License for more details. |
| 14 |
# |
| 15 |
# You should have received a copy of the GNU General Public License |
| 16 |
# along with this program; if not, write to the Free Software |
| 17 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA |
| 18 |
|
| 19 |
if [ ! -f "sql/mysqld.cc" ]; then |
| 20 |
echo "You must run this script from the MySQL top-level directory." |
| 21 |
exit 1 |
| 22 |
fi |
| 23 |
|
| 24 |
# -fast Expand into a set of compiler options to result in |
| 25 |
# improved application run-time. Options include: +O3, |
| 26 |
# +Onolooptransform, +Olibcalls, +FPD, +Oentryschedule, |
| 27 |
# +Ofastaccess. |
| 28 |
# +O4 Perform level 3 as well as doing link time optimizations. |
| 29 |
# Also sends +Oprocelim and +Ofastaccess to the linker |
| 30 |
# (see ld(1)). |
| 31 |
|
| 32 |
release_flags="-fast +O3" |
| 33 |
|
| 34 |
# -z Do not bind anything to address zero. This option |
| 35 |
# allows runtime detection of null pointers. See the |
| 36 |
# note on pointers below. |
| 37 |
cflags="-g -z +O0" |
| 38 |
cxxflags="-g0 -z +O0" |
| 39 |
debug_configure_options="--with-debug" |
| 40 |
|
| 41 |
while [ "$#" != 0 ]; do |
| 42 |
case "$1" in |
| 43 |
--help) |
| 44 |
echo "Usage: $0 [options]" |
| 45 |
echo "Options:" |
| 46 |
echo "--help print this message" |
| 47 |
echo "--debug build debug binary [default] " |
| 48 |
echo "--release build optimised binary" |
| 49 |
echo "-32 build 32 bit binary [default]" |
| 50 |
echo "-64 build 64 bit binary" |
| 51 |
exit 0 |
| 52 |
;; |
| 53 |
--debug) |
| 54 |
echo "Building debug binary" |
| 55 |
;; |
| 56 |
--release) |
| 57 |
echo "Building release binary" |
| 58 |
cflags="$release_flags" |
| 59 |
cxxflags="$release_flags" |
| 60 |
debug_configure_options="" |
| 61 |
;; |
| 62 |
-32) |
| 63 |
echo "Building 32-bit binary" |
| 64 |
;; |
| 65 |
-64) |
| 66 |
echo "Building 64-bit binary" |
| 67 |
cflags="$cflags +DA2.0W +DD64" |
| 68 |
cxxflags="$cxxflags +DA2.0W +DD64" |
| 69 |
;; |
| 70 |
*) |
| 71 |
echo "$0: invalid option '$1'; use --help to show usage" |
| 72 |
exit 1 |
| 73 |
;; |
| 74 |
esac |
| 75 |
shift |
| 76 |
done |
| 77 |
|
| 78 |
|
| 79 |
set -x |
| 80 |
make maintainer-clean |
| 81 |
|
| 82 |
path=`dirname $0` |
| 83 |
. "$path/autorun.sh" |
| 84 |
|
| 85 |
CC=cc CXX=aCC CFLAGS="$cflags" CXXFLAGS="$cxxflags" \ |
| 86 |
./configure --prefix=/usr/local/mysql --disable-shared \ |
| 87 |
--with-extra-charsets=complex --enable-thread-safe-client \ |
| 88 |
--without-extra-tools $debug_configure_options \ |
| 89 |
--disable-dependency-tracking |
| 90 |
|
| 91 |
gmake |