2004-11-03 11:39:38 +01:00
|
|
|
#!/bin/sh
|
|
|
|
|
2011-05-25 12:39:11 +02:00
|
|
|
# Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
|
2010-12-28 19:57:23 +01:00
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU Library General Public
|
|
|
|
# License as published by the Free Software Foundation; version 2
|
|
|
|
# of the License.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
# Library General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU Library General Public
|
|
|
|
# License along with this library; if not, write to the Free
|
2013-03-19 15:53:48 +01:00
|
|
|
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
2019-05-11 20:29:06 +02:00
|
|
|
# MA 02110-1335 USA
|
2010-12-28 19:57:23 +01:00
|
|
|
|
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.
|
2016-01-03 11:48:55 +01:00
|
|
|
Combined with --just-print shows configure options.
|
2021-05-23 18:53:38 +02:00
|
|
|
--just-clean Clean up compilation files and update sub modules
|
2013-01-11 01:03:43 +01:00
|
|
|
--extra-configs=xxx Add this to configure options
|
|
|
|
--extra-flags=xxx Add this C and CXX flags
|
|
|
|
--extra-cflags=xxx Add this to C flags
|
|
|
|
--extra-cxxflags=xxx Add this to CXX flags
|
|
|
|
--verbose Print out full compile lines
|
2011-05-06 11:20:01 +02:00
|
|
|
--with-debug=full Build with full debug(no optimizations, keep call stack).
|
2010-07-24 15:31:48 +02:00
|
|
|
--warning-mode=[old|pedantic|maintainer]
|
2006-04-07 00:25:59 +02:00
|
|
|
Influences the debug flags. Old is default.
|
|
|
|
--prefix=path Build with prefix 'path'.
|
|
|
|
|
2017-01-03 14:47:17 +01:00
|
|
|
Note: this script is intended for internal use by MariaDB developers.
|
2006-04-07 00:25:59 +02:00
|
|
|
EOF
|
|
|
|
}
|
|
|
|
|
|
|
|
parse_options()
|
|
|
|
{
|
|
|
|
while test $# -gt 0
|
|
|
|
do
|
|
|
|
case "$1" in
|
|
|
|
--prefix=*)
|
|
|
|
prefix=`get_key_value "$1"`;;
|
2011-05-06 11:20:01 +02:00
|
|
|
--with-debug=full)
|
|
|
|
full_debug="=full";;
|
2006-04-07 00:25:59 +02:00
|
|
|
--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"`;;
|
2012-06-05 13:09:18 +02:00
|
|
|
--extra-makeflags=*)
|
|
|
|
EXTRA_MAKEFLAGS=`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;;
|
2021-05-23 18:53:38 +02:00
|
|
|
--just-clean)
|
|
|
|
just_clean=1;;
|
2013-01-11 01:03:43 +01:00
|
|
|
--verbose)
|
|
|
|
verbose_make=1;;
|
2006-04-07 00:25:59 +02:00
|
|
|
-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=
|
2021-05-23 18:53:38 +02:00
|
|
|
just_clean=
|
2001-03-04 22:34:26 +01:00
|
|
|
just_configure=
|
2006-04-07 00:25:59 +02:00
|
|
|
warning_mode=
|
2010-07-24 15:31:48 +02:00
|
|
|
maintainer_mode=
|
2011-05-06 11:20:01 +02:00
|
|
|
full_debug=
|
2013-01-11 01:03:43 +01:00
|
|
|
verbose_make=
|
2006-04-07 00:25:59 +02:00
|
|
|
|
|
|
|
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"
|
2010-01-07 13:02:18 +01:00
|
|
|
. "$path/util.sh"
|
2006-04-07 00:25:59 +02:00
|
|
|
|
2010-01-07 13:02:18 +01:00
|
|
|
get_make_parallel_flag
|
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
|
2016-12-30 10:23:45 +01:00
|
|
|
# implementation of SSL. --with-ssl=yes will first try system library
|
2022-08-08 00:07:39 +02:00
|
|
|
# then the bundled one --with-ssl=system will use the system library.
|
2023-09-20 02:10:45 +02:00
|
|
|
# We normally use bundled by default as this is guaranteed to work with Galera
|
|
|
|
# However as bundled gives problem on SuSE with tls_version1.test, system
|
|
|
|
# is used
|
2023-04-17 15:46:52 +02:00
|
|
|
SSL_LIBRARY=--with-ssl=system
|
2005-11-02 14:45:25 +01:00
|
|
|
|
2010-07-24 15:31:48 +02:00
|
|
|
if [ "x$warning_mode" = "xpedantic" ]; then
|
|
|
|
warnings="-W -Wall -ansi -pedantic -Wno-long-long -Wno-unused -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.
|
|
|
|
debug_extra_cflags="-O0"
|
|
|
|
# Reset CPU flags (-mtune), they don't work in -pedantic mode
|
|
|
|
check_cpu_cflags=""
|
|
|
|
elif [ "x$warning_mode" = "xmaintainer" ]; then
|
|
|
|
c_warnings="-Wall -Wextra"
|
|
|
|
cxx_warnings="$c_warnings -Wno-unused-parameter"
|
|
|
|
maintainer_mode="--enable-mysql-maintainer-mode"
|
|
|
|
debug_extra_cflags="-g3"
|
|
|
|
else
|
2006-04-07 00:25:59 +02:00
|
|
|
# Both C and C++ warnings
|
2023-06-08 14:50:50 +02:00
|
|
|
warnings="-Wall -Wextra -Wunused -Wwrite-strings -Wno-uninitialized -Wno-strict-aliasing -Wformat-security -Wvla"
|
2005-11-02 14:45:25 +01:00
|
|
|
|
2006-12-14 23:51:37 +01:00
|
|
|
# For more warnings, uncomment the following line
|
Bug#53445: Build with -Wall and fix warnings that it generates
Apart strict-aliasing warnings, fix the remaining warnings
generated by GCC 4.4.4 -Wall and -Wextra flags.
One major source of warnings was the in-house function my_bcmp
which (unconventionally) took pointers to unsigned characters
as the byte sequences to be compared. Since my_bcmp and bcmp
are deprecated functions whose only difference with memcmp is
the return value, every use of the function is replaced with
memcmp as the special return value wasn't actually being used
by any caller.
There were also various other warnings, mostly due to type
mismatches, missing return values, missing prototypes, dead
code (unreachable) and ignored return values.
BUILD/SETUP.sh:
Remove flags that are implied by -Wall and -Wextra.
Do not warn about unused parameters in C++.
BUILD/check-cpu:
Print only the compiler version instead of verbose banner.
Although the option is gcc specific, the check was only
being used for GCC specific checks anyway.
client/mysql.cc:
bcmp is no longer defined.
client/mysqltest.cc:
Pass a string to function expecting a format string.
Replace use of bcmp with memcmp.
cmd-line-utils/readline/Makefile.am:
Always define _GNU_SOURCE when compiling GNU readline.
Required to make certain prototypes visible.
cmd-line-utils/readline/input.c:
Condition for the code to be meaningful.
configure.in:
Remove check for bcmp.
extra/comp_err.c:
Use appropriate type.
extra/replace.c:
Replace use of bcmp with memcmp.
extra/yassl/src/crypto_wrapper.cpp:
Do not ignore the return value of fgets. Retrieve the file
position if fgets succeed -- if it fails, the function will
bail out and return a error.
extra/yassl/taocrypt/include/blowfish.hpp:
Use a single array instead of accessing positions of the sbox_
through a subscript to pbox_.
extra/yassl/taocrypt/include/runtime.hpp:
One definition of such functions is enough.
extra/yassl/taocrypt/src/aes.cpp:
Avoid potentially ambiguous conditions.
extra/yassl/taocrypt/src/algebra.cpp:
Rename arguments to avoid shadowing related warnings.
extra/yassl/taocrypt/src/blowfish.cpp:
Avoid potentially ambiguous conditions.
extra/yassl/taocrypt/src/integer.cpp:
Do not define type within a anonymous union.
Use a variable to return a value instead of
leaving the result in a register -- compiler
does not know the logic inside the asm.
extra/yassl/taocrypt/src/misc.cpp:
Define handler for pure virtual functions.
Remove unused code.
extra/yassl/taocrypt/src/twofish.cpp:
Avoid potentially ambiguous conditions.
extra/yassl/testsuite/test.hpp:
Function must have C language linkage.
include/m_string.h:
Remove check which relied on bcmp being defined -- they weren't
being used as bcmp is only visible when _BSD_SOURCE is defined.
include/my_bitmap.h:
Remove bogus helpers which were used only in a few files and
were causing warnings about dead code.
include/my_global.h:
Due to G++ bug, always silence false-positive uninitialized
variables warnings when compiling C++ code with G++.
Remove bogus helper.
libmysql/Makefile.shared:
Remove built-in implementation of bcmp.
mysql-test/lib/My/SafeProcess/safe_process.cc:
Cast pid to largest possible type for a process identifier.
mysys/mf_loadpath.c:
Leave space of the ending nul.
mysys/mf_pack.c:
Replace bcmp with memcmp.
mysys/my_bitmap.c:
Dead code removal.
mysys/my_gethwaddr.c:
Remove unused variable.
mysys/my_getopt.c:
Silence bogus uninitialized variable warning.
Do not cast away the constant qualifier.
mysys/safemalloc.c:
Cast to expected type.
mysys/thr_lock.c:
Silence bogus uninitialized variable warning.
sql/field.cc:
Replace bogus helper with a more appropriate logic which is
used throughout the code.
sql/item.cc:
Remove bogus logical condition which always evaluates to TRUE.
sql/item_create.cc:
Simplify code to avoid signedness related warnings.
sql/log_event.cc:
Replace use of bcmp with memcmp.
No need to use helpers for simple bit operations.
sql/log_event_old.cc:
Replace bmove_align with memcpy.
sql/mysqld.cc:
Move use declaration of variable to the ifdef block where it
is used. Remove now-unnecessary casts and arguments.
sql/set_var.cc:
Replace bogus helpers with simple and classic bit operations.
sql/slave.cc:
Cast to expected type and silence bogus warning.
sql/sql_class.h:
Don't use enum values as bit flags, the supposed type safety is
bogus as the combined bit flags are not a value in the enumeration.
sql/udf_example.c:
Only declare variable when necessary.
sql/unireg.h:
Replace use of bmove_align with memcpy.
storage/innobase/os/os0file.c:
Silence bogus warning.
storage/myisam/mi_open.c:
Remove bogus cast, DBUG_DUMP expects a pointer to unsigned
char.
storage/myisam/mi_page.c:
Remove bogus cast, DBUG_DUMP expects a pointer to unsigned
char.
strings/bcmp.c:
Remove built-in bcmp.
strings/ctype-ucs2.c:
Silence bogus warning.
tests/mysql_client_test.c:
Use a appropriate type as expected by simple_command().
2010-07-02 20:30:47 +02:00
|
|
|
# warnings="$warnings -Wshadow"
|
2007-01-27 02:46:45 +01:00
|
|
|
|
2006-04-07 00:25:59 +02:00
|
|
|
# C warnings
|
Bug#53445: Build with -Wall and fix warnings that it generates
Apart strict-aliasing warnings, fix the remaining warnings
generated by GCC 4.4.4 -Wall and -Wextra flags.
One major source of warnings was the in-house function my_bcmp
which (unconventionally) took pointers to unsigned characters
as the byte sequences to be compared. Since my_bcmp and bcmp
are deprecated functions whose only difference with memcmp is
the return value, every use of the function is replaced with
memcmp as the special return value wasn't actually being used
by any caller.
There were also various other warnings, mostly due to type
mismatches, missing return values, missing prototypes, dead
code (unreachable) and ignored return values.
BUILD/SETUP.sh:
Remove flags that are implied by -Wall and -Wextra.
Do not warn about unused parameters in C++.
BUILD/check-cpu:
Print only the compiler version instead of verbose banner.
Although the option is gcc specific, the check was only
being used for GCC specific checks anyway.
client/mysql.cc:
bcmp is no longer defined.
client/mysqltest.cc:
Pass a string to function expecting a format string.
Replace use of bcmp with memcmp.
cmd-line-utils/readline/Makefile.am:
Always define _GNU_SOURCE when compiling GNU readline.
Required to make certain prototypes visible.
cmd-line-utils/readline/input.c:
Condition for the code to be meaningful.
configure.in:
Remove check for bcmp.
extra/comp_err.c:
Use appropriate type.
extra/replace.c:
Replace use of bcmp with memcmp.
extra/yassl/src/crypto_wrapper.cpp:
Do not ignore the return value of fgets. Retrieve the file
position if fgets succeed -- if it fails, the function will
bail out and return a error.
extra/yassl/taocrypt/include/blowfish.hpp:
Use a single array instead of accessing positions of the sbox_
through a subscript to pbox_.
extra/yassl/taocrypt/include/runtime.hpp:
One definition of such functions is enough.
extra/yassl/taocrypt/src/aes.cpp:
Avoid potentially ambiguous conditions.
extra/yassl/taocrypt/src/algebra.cpp:
Rename arguments to avoid shadowing related warnings.
extra/yassl/taocrypt/src/blowfish.cpp:
Avoid potentially ambiguous conditions.
extra/yassl/taocrypt/src/integer.cpp:
Do not define type within a anonymous union.
Use a variable to return a value instead of
leaving the result in a register -- compiler
does not know the logic inside the asm.
extra/yassl/taocrypt/src/misc.cpp:
Define handler for pure virtual functions.
Remove unused code.
extra/yassl/taocrypt/src/twofish.cpp:
Avoid potentially ambiguous conditions.
extra/yassl/testsuite/test.hpp:
Function must have C language linkage.
include/m_string.h:
Remove check which relied on bcmp being defined -- they weren't
being used as bcmp is only visible when _BSD_SOURCE is defined.
include/my_bitmap.h:
Remove bogus helpers which were used only in a few files and
were causing warnings about dead code.
include/my_global.h:
Due to G++ bug, always silence false-positive uninitialized
variables warnings when compiling C++ code with G++.
Remove bogus helper.
libmysql/Makefile.shared:
Remove built-in implementation of bcmp.
mysql-test/lib/My/SafeProcess/safe_process.cc:
Cast pid to largest possible type for a process identifier.
mysys/mf_loadpath.c:
Leave space of the ending nul.
mysys/mf_pack.c:
Replace bcmp with memcmp.
mysys/my_bitmap.c:
Dead code removal.
mysys/my_gethwaddr.c:
Remove unused variable.
mysys/my_getopt.c:
Silence bogus uninitialized variable warning.
Do not cast away the constant qualifier.
mysys/safemalloc.c:
Cast to expected type.
mysys/thr_lock.c:
Silence bogus uninitialized variable warning.
sql/field.cc:
Replace bogus helper with a more appropriate logic which is
used throughout the code.
sql/item.cc:
Remove bogus logical condition which always evaluates to TRUE.
sql/item_create.cc:
Simplify code to avoid signedness related warnings.
sql/log_event.cc:
Replace use of bcmp with memcmp.
No need to use helpers for simple bit operations.
sql/log_event_old.cc:
Replace bmove_align with memcpy.
sql/mysqld.cc:
Move use declaration of variable to the ifdef block where it
is used. Remove now-unnecessary casts and arguments.
sql/set_var.cc:
Replace bogus helpers with simple and classic bit operations.
sql/slave.cc:
Cast to expected type and silence bogus warning.
sql/sql_class.h:
Don't use enum values as bit flags, the supposed type safety is
bogus as the combined bit flags are not a value in the enumeration.
sql/udf_example.c:
Only declare variable when necessary.
sql/unireg.h:
Replace use of bmove_align with memcpy.
storage/innobase/os/os0file.c:
Silence bogus warning.
storage/myisam/mi_open.c:
Remove bogus cast, DBUG_DUMP expects a pointer to unsigned
char.
storage/myisam/mi_page.c:
Remove bogus cast, DBUG_DUMP expects a pointer to unsigned
char.
strings/bcmp.c:
Remove built-in bcmp.
strings/ctype-ucs2.c:
Silence bogus warning.
tests/mysql_client_test.c:
Use a appropriate type as expected by simple_command().
2010-07-02 20:30:47 +02:00
|
|
|
c_warnings="$warnings"
|
2006-04-07 00:25:59 +02:00
|
|
|
# C++ warnings
|
2012-09-28 01:06:56 +02:00
|
|
|
cxx_warnings="$warnings -Wno-unused-parameter -Wno-invalid-offsetof"
|
2007-12-14 14:21:37 +01:00
|
|
|
# cxx_warnings="$cxx_warnings -Woverloaded-virtual -Wsign-promo"
|
2010-10-19 15:49:31 +02:00
|
|
|
cxx_warnings="$cxx_warnings -Wnon-virtual-dtor"
|
Bug#53445: Build with -Wall and fix warnings that it generates
Apart strict-aliasing warnings, fix the remaining warnings
generated by GCC 4.4.4 -Wall and -Wextra flags.
One major source of warnings was the in-house function my_bcmp
which (unconventionally) took pointers to unsigned characters
as the byte sequences to be compared. Since my_bcmp and bcmp
are deprecated functions whose only difference with memcmp is
the return value, every use of the function is replaced with
memcmp as the special return value wasn't actually being used
by any caller.
There were also various other warnings, mostly due to type
mismatches, missing return values, missing prototypes, dead
code (unreachable) and ignored return values.
BUILD/SETUP.sh:
Remove flags that are implied by -Wall and -Wextra.
Do not warn about unused parameters in C++.
BUILD/check-cpu:
Print only the compiler version instead of verbose banner.
Although the option is gcc specific, the check was only
being used for GCC specific checks anyway.
client/mysql.cc:
bcmp is no longer defined.
client/mysqltest.cc:
Pass a string to function expecting a format string.
Replace use of bcmp with memcmp.
cmd-line-utils/readline/Makefile.am:
Always define _GNU_SOURCE when compiling GNU readline.
Required to make certain prototypes visible.
cmd-line-utils/readline/input.c:
Condition for the code to be meaningful.
configure.in:
Remove check for bcmp.
extra/comp_err.c:
Use appropriate type.
extra/replace.c:
Replace use of bcmp with memcmp.
extra/yassl/src/crypto_wrapper.cpp:
Do not ignore the return value of fgets. Retrieve the file
position if fgets succeed -- if it fails, the function will
bail out and return a error.
extra/yassl/taocrypt/include/blowfish.hpp:
Use a single array instead of accessing positions of the sbox_
through a subscript to pbox_.
extra/yassl/taocrypt/include/runtime.hpp:
One definition of such functions is enough.
extra/yassl/taocrypt/src/aes.cpp:
Avoid potentially ambiguous conditions.
extra/yassl/taocrypt/src/algebra.cpp:
Rename arguments to avoid shadowing related warnings.
extra/yassl/taocrypt/src/blowfish.cpp:
Avoid potentially ambiguous conditions.
extra/yassl/taocrypt/src/integer.cpp:
Do not define type within a anonymous union.
Use a variable to return a value instead of
leaving the result in a register -- compiler
does not know the logic inside the asm.
extra/yassl/taocrypt/src/misc.cpp:
Define handler for pure virtual functions.
Remove unused code.
extra/yassl/taocrypt/src/twofish.cpp:
Avoid potentially ambiguous conditions.
extra/yassl/testsuite/test.hpp:
Function must have C language linkage.
include/m_string.h:
Remove check which relied on bcmp being defined -- they weren't
being used as bcmp is only visible when _BSD_SOURCE is defined.
include/my_bitmap.h:
Remove bogus helpers which were used only in a few files and
were causing warnings about dead code.
include/my_global.h:
Due to G++ bug, always silence false-positive uninitialized
variables warnings when compiling C++ code with G++.
Remove bogus helper.
libmysql/Makefile.shared:
Remove built-in implementation of bcmp.
mysql-test/lib/My/SafeProcess/safe_process.cc:
Cast pid to largest possible type for a process identifier.
mysys/mf_loadpath.c:
Leave space of the ending nul.
mysys/mf_pack.c:
Replace bcmp with memcmp.
mysys/my_bitmap.c:
Dead code removal.
mysys/my_gethwaddr.c:
Remove unused variable.
mysys/my_getopt.c:
Silence bogus uninitialized variable warning.
Do not cast away the constant qualifier.
mysys/safemalloc.c:
Cast to expected type.
mysys/thr_lock.c:
Silence bogus uninitialized variable warning.
sql/field.cc:
Replace bogus helper with a more appropriate logic which is
used throughout the code.
sql/item.cc:
Remove bogus logical condition which always evaluates to TRUE.
sql/item_create.cc:
Simplify code to avoid signedness related warnings.
sql/log_event.cc:
Replace use of bcmp with memcmp.
No need to use helpers for simple bit operations.
sql/log_event_old.cc:
Replace bmove_align with memcpy.
sql/mysqld.cc:
Move use declaration of variable to the ifdef block where it
is used. Remove now-unnecessary casts and arguments.
sql/set_var.cc:
Replace bogus helpers with simple and classic bit operations.
sql/slave.cc:
Cast to expected type and silence bogus warning.
sql/sql_class.h:
Don't use enum values as bit flags, the supposed type safety is
bogus as the combined bit flags are not a value in the enumeration.
sql/udf_example.c:
Only declare variable when necessary.
sql/unireg.h:
Replace use of bmove_align with memcpy.
storage/innobase/os/os0file.c:
Silence bogus warning.
storage/myisam/mi_open.c:
Remove bogus cast, DBUG_DUMP expects a pointer to unsigned
char.
storage/myisam/mi_page.c:
Remove bogus cast, DBUG_DUMP expects a pointer to unsigned
char.
strings/bcmp.c:
Remove built-in bcmp.
strings/ctype-ucs2.c:
Silence bogus warning.
tests/mysql_client_test.c:
Use a appropriate type as expected by simple_command().
2010-07-02 20:30:47 +02:00
|
|
|
debug_extra_cflags="-O0 -g3 -gdwarf-2"
|
2006-04-07 00:25:59 +02:00
|
|
|
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
|
2010-05-20 12:40:42 +02:00
|
|
|
# Override -DFORCE_INIT_OF_VARS from debug_cflags. It enables the macro
|
2015-02-10 11:05:49 +01:00
|
|
|
# UNINIT_VAR(), which is only useful for silencing spurious warnings
|
|
|
|
# of static analysis tools. We want UNINIT_VAR() to be a no-op in Valgrind.
|
2019-08-13 23:14:27 +02:00
|
|
|
# TRASH_FREE_MEMORY is enabled so that we can find wrong memory accesses
|
|
|
|
# even when running a test without valgrind
|
|
|
|
#
|
|
|
|
valgrind_flags="-DHAVE_valgrind -USAFEMALLOC -DTRASH_FREE_MEMORY"
|
2011-01-26 14:17:46 +01:00
|
|
|
valgrind_flags="$valgrind_flags -UFORCE_INIT_OF_VARS -Wno-uninitialized"
|
2006-04-07 00:25:59 +02:00
|
|
|
valgrind_flags="$valgrind_flags -DMYSQL_SERVER_SUFFIX=-valgrind-max"
|
2010-05-20 12:40:42 +02:00
|
|
|
valgrind_configs="--with-valgrind"
|
2006-04-07 00:25:59 +02:00
|
|
|
#
|
|
|
|
# Used in -debug builds
|
2013-03-25 23:03:13 +01:00
|
|
|
debug_cflags="-DEXTRA_DEBUG -DSAFE_MUTEX -DSAFEMALLOC"
|
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
|
2019-06-01 12:34:57 +02:00
|
|
|
base_cxxflags="-felide-constructors -fexceptions"
|
2006-04-07 00:25:59 +02:00
|
|
|
#
|
|
|
|
# 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
|
|
|
|
2010-08-06 14:59:38 +02:00
|
|
|
debug_configs="--with-debug"
|
2011-05-06 11:20:01 +02:00
|
|
|
if [ -z "$full_debug" ]
|
|
|
|
then
|
|
|
|
debug_cflags="$debug_cflags $debug_extra_cflags"
|
|
|
|
fi
|
|
|
|
|
2009-10-29 01:04:56 +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"
|
|
|
|
|
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 "
|
2010-07-24 15:31:48 +02:00
|
|
|
base_configs="$base_configs --with-big-tables $maintainer_mode"
|
2019-04-15 17:16:02 +02:00
|
|
|
base_configs="$base_configs --with-plugin-aria --with-aria-tmp-tables --with-plugin-s3=STATIC"
|
2023-04-17 15:46:52 +02:00
|
|
|
base_configs="$base_configs $SSL_LIBRARY"
|
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
|
|
|
|
|
2020-01-30 14:56:40 +01:00
|
|
|
max_plugins="--with-plugins=max"
|
2023-04-17 15:46:52 +02:00
|
|
|
max_no_embedded_configs="$max_plugins"
|
|
|
|
max_no_qc_configs="$max_plugins --without-query-cache"
|
|
|
|
max_configs="$max_plugins --with-embedded-server --with-libevent --with-plugin-rocksdb=dynamic --with-plugin-test_sql_discovery=DYNAMIC --with-plugin-file_key_management=DYNAMIC --with-plugin-hashicorp_key_management=DYNAMIC --with-plugin-auth_gssapi=DYNAMIC"
|
|
|
|
all_configs="$max_configs"
|
2006-04-07 00:25:59 +02:00
|
|
|
|
|
|
|
#
|
|
|
|
# CPU and platform specific compilation flags.
|
|
|
|
#
|
|
|
|
alpha_cflags="$check_cpu_cflags -Wa,-m$cpu_flag"
|
2014-08-06 14:39:15 +02:00
|
|
|
pentium_cflags="$check_cpu_cflags -m32"
|
2023-04-17 15:46:52 +02:00
|
|
|
amd64_cflags="$check_cpu_cflags -m64"
|
2006-04-07 00:25:59 +02:00
|
|
|
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
|
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
|
|
|
|
2011-03-01 14:19:25 +01:00
|
|
|
|
|
|
|
#
|
|
|
|
# Set -Wuninitialized to debug flags for gcc 4.4 and above
|
|
|
|
# because it is allowed there without -O
|
|
|
|
#
|
|
|
|
if test `$CC -v 2>&1 | tail -1 | sed 's/ .*$//'` = 'gcc' ; then
|
2011-03-01 15:21:27 +01:00
|
|
|
GCCVERSION=`$CC -v 2>&1 | tail -1 | \
|
|
|
|
sed 's/^[a-zA-Z][a-zA-Z]* [a-zA-Z][a-zA-Z]* //' | sed 's/ .*$//'`
|
2011-03-01 14:19:25 +01:00
|
|
|
GCCV1=`echo $GCCVERSION | sed 's/\..*$//'`
|
|
|
|
GCCV2=`echo $GCCVERSION | sed 's/[0-9][0-9]*\.//'|sed 's/\..*$//'`
|
|
|
|
if test '(' "$GCCV1" -gt '4' ')' -o \
|
|
|
|
'(' '(' "$GCCV1" -eq '4' ')' -a '(' "$GCCV2" -ge '4' ')' ')'
|
|
|
|
then
|
|
|
|
debug_cflags="$debug_cflags -DFORCE_INIT_OF_VARS -Wuninitialized"
|
|
|
|
fi
|
2019-08-13 23:14:27 +02:00
|
|
|
if (test '(' "$GCCV1" -gt '6' ')')
|
|
|
|
then
|
|
|
|
c_warnings="$c_warnings -Wimplicit-fallthrough=2"
|
|
|
|
cxx_warnings="$cxx_warnings -Wimplicit-fallthrough=2"
|
|
|
|
fi
|
2011-03-01 14:19:25 +01:00
|
|
|
fi
|
|
|
|
|
2024-04-19 12:10:58 +02:00
|
|
|
if test `$CC -v 2>&1 | head -1 | sed 's/ .*$//'` = 'clang' ; then
|
|
|
|
dbug_cflags="$dbug_cflags -Wframe-larger-than=16384 -fno-inline"
|
|
|
|
c_warnings="$c_warnings -Wframe-larger-than=16384"
|
|
|
|
cxx_warnings="$cxx_warnings -Wframe-larger-than=16384"
|
|
|
|
fi
|
|
|
|
|
2011-03-01 14:19:25 +01:00
|
|
|
|
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)
|
2015-12-23 12:46:32 +01:00
|
|
|
|
|
|
|
# As cmake doesn't like CC and CXX with a space, use symlinks from
|
|
|
|
# /usr/lib64/ccache if they exits.
|
|
|
|
|
2021-06-14 18:51:37 +02:00
|
|
|
if ccache -V > /dev/null 2>&1 && test "$CCACHE_DISABLE" != "1" && test "$CC" = "gcc"
|
2003-05-23 18:20:57 +02:00
|
|
|
then
|
2015-12-23 12:46:32 +01:00
|
|
|
if test -x /usr/lib64/ccache/gcc
|
|
|
|
then
|
|
|
|
CC=/usr/lib64/ccache/gcc
|
|
|
|
fi
|
|
|
|
if test -x /usr/lib64/ccache/g++
|
|
|
|
then
|
|
|
|
CXX=/usr/lib64/ccache/g++
|
|
|
|
fi
|
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"
|
|
|
|
|
2017-07-01 13:02:29 +02:00
|
|
|
#
|
|
|
|
# The following plugins doesn't work on 32 bit systems
|
2020-05-14 09:11:47 +02:00
|
|
|
disable_64_bit_plugins="--without-plugin-rocksdb"
|
2017-07-01 13:02:29 +02:00
|
|
|
|
|
|
|
|
2007-08-16 02:10:16 +02:00
|
|
|
# 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.
|
|
|
|
|
2016-12-06 13:05:09 +01:00
|
|
|
gcov_link_flags="-fprofile-arcs -ftest-coverage -lgcov"
|
2007-08-16 02:10:16 +02:00
|
|
|
|
2011-05-25 12:39:11 +02:00
|
|
|
gcov_configs="--with-gcov"
|
2007-08-16 02:10:16 +02:00
|
|
|
|
|
|
|
# gprof
|
|
|
|
|
2020-08-20 16:28:12 +02:00
|
|
|
gprof_compile_flags="-O2"
|
2007-08-16 02:10:16 +02:00
|
|
|
|
2020-08-20 16:28:12 +02:00
|
|
|
# Rest of the flags are set in CmakeFile.txt
|
2007-08-16 02:10:16 +02:00
|
|
|
gprof_link_flags="--disable-shared $static_link"
|
|
|
|
|
2020-08-20 16:28:12 +02:00
|
|
|
disable_gprof_plugins="--with-zlib-dir=bundled --without-plugin-oqgraph --without-plugin-mroonga --with-gprof"
|
2018-01-27 13:39:33 +01:00
|
|
|
|
|
|
|
disable_asan_plugins="--without-plugin-rocksdb"
|