Commit 46db8aac authored by Michael Widenius's avatar Michael Widenius

Apply patch by Antony Dovgal:

- Move SAFE_MUTEX to be stored in config.h by configure.in (not as a flag used with compiler command line)
- Generate my_config.h in configure

BUILD/SETUP.sh:
  Remove -DSAFE_MUTEX as the following --with-debug flag will automaticly add it
BUILD/compile-ia64-debug-max:
  Remove -DSAFE_MUTEX as the following --with-debug flag will automaticly add it
configure.in:
  Move SAFE_MUTEX and SAFE_MALLOC to [my_] config.h
  Generate my_config.h as part of configure process
dbug/dbug.c:
  Include my_global.h before we undef SAFE_MUTEX
include/Makefile.am:
  Update comment. For now, lets generate my_config.h if someone deletes it after configure
mysys/my_wincond.c:
  Include my_global.h before we undef SAFE_MUTEX
mysys/my_winthread.c:
  Include my_global.h before we undef SAFE_MUTEX
parent 806ec1b0
...@@ -124,7 +124,7 @@ valgrind_flags="$valgrind_flags -DMYSQL_SERVER_SUFFIX=-valgrind-max" ...@@ -124,7 +124,7 @@ valgrind_flags="$valgrind_flags -DMYSQL_SERVER_SUFFIX=-valgrind-max"
# #
# Used in -debug builds # Used in -debug builds
debug_cflags="-DUNIV_MUST_NOT_INLINE -DEXTRA_DEBUG -DFORCE_INIT_OF_VARS " debug_cflags="-DUNIV_MUST_NOT_INLINE -DEXTRA_DEBUG -DFORCE_INIT_OF_VARS "
debug_cflags="$debug_cflags -DSAFEMALLOC -DPEDANTIC_SAFEMALLOC -DSAFE_MUTEX" debug_cflags="$debug_cflags -DSAFEMALLOC -DPEDANTIC_SAFEMALLOC"
error_inject="--with-error-inject " error_inject="--with-error-inject "
# #
# Base C++ flags for all builds # Base C++ flags for all builds
......
...@@ -4,5 +4,5 @@ gmake -k maintainer-clean || true ...@@ -4,5 +4,5 @@ gmake -k maintainer-clean || true
path=`dirname $0` path=`dirname $0`
. "$path/autorun.sh" . "$path/autorun.sh"
CC=ecc CFLAGS="-w1 -DEXTRA_DEBUG -DSAFEMALLOC -DSAFE_MUTEX -O2" CXX=ecc CXXFLAGS="-w1 -DEXTRA_DEBUG -DSAFEMALLOC -DSAFE_MUTEX -O2" ./configure --prefix=/usr/local/mysql --with-extra-charsets=complex --enable-thread-safe-client --with-mysqld-ldflags=-all-static --with-client-ldflags=-all-static --with-debug --with-innodb --with-embedded-server --with-archive-storage-engine CC=ecc CFLAGS="-w1 -DEXTRA_DEBUG -DSAFEMALLOC -O2" CXX=ecc CXXFLAGS="-w1 -DEXTRA_DEBUG -DSAFEMALLOC -O2" ./configure --prefix=/usr/local/mysql --with-extra-charsets=complex --enable-thread-safe-client --with-mysqld-ldflags=-all-static --with-client-ldflags=-all-static --with-debug --with-innodb --with-embedded-server --with-archive-storage-engine
gmake gmake
...@@ -1677,14 +1677,17 @@ if test "$with_debug" = "yes" ...@@ -1677,14 +1677,17 @@ if test "$with_debug" = "yes"
then then
# Medium debug. # Medium debug.
AC_DEFINE([DBUG_ON], [1], [Use libdbug]) AC_DEFINE([DBUG_ON], [1], [Use libdbug])
CFLAGS="$DEBUG_CFLAGS $DEBUG_OPTIMIZE_CC -DSAFE_MUTEX $CFLAGS" AC_DEFINE([SAFE_MUTEX], [1], [Use safe mutexes])
CXXFLAGS="$DEBUG_CXXFLAGS $DEBUG_OPTIMIZE_CXX -DSAFE_MUTEX $CXXFLAGS" CFLAGS="$DEBUG_CFLAGS $DEBUG_OPTIMIZE_CC $CFLAGS"
CXXFLAGS="$DEBUG_CXXFLAGS $DEBUG_OPTIMIZE_CXX $CXXFLAGS"
elif test "$with_debug" = "full" elif test "$with_debug" = "full"
then then
# Full debug. Very slow in some cases # Full debug. Very slow in some cases
AC_DEFINE([DBUG_ON], [1], [Use libdbug]) AC_DEFINE([DBUG_ON], [1], [Use libdbug])
CFLAGS="$DEBUG_CFLAGS -DSAFE_MUTEX -DSAFEMALLOC $CFLAGS" AC_DEFINE([SAFE_MUTEX], [1], [Use safe mutexes])
CXXFLAGS="$DEBUG_CXXFLAGS -DSAFE_MUTEX -DSAFEMALLOC $CXXFLAGS" AC_DEFINE([SAFEMALLOC], [1], [Use safe malloc])
CFLAGS="$DEBUG_CFLAGS $CFLAGS"
CXXFLAGS="$DEBUG_CXXFLAGS $CXXFLAGS"
else else
# Optimized version. No debug # Optimized version. No debug
AC_DEFINE([DBUG_OFF], [1], [Don't use libdbug]) AC_DEFINE([DBUG_OFF], [1], [Don't use libdbug])
...@@ -2812,6 +2815,7 @@ AC_CONFIG_FILES(Makefile extra/Makefile mysys/Makefile dnl ...@@ -2812,6 +2815,7 @@ AC_CONFIG_FILES(Makefile extra/Makefile mysys/Makefile dnl
include/mysql_version.h plugin/Makefile win/Makefile) include/mysql_version.h plugin/Makefile win/Makefile)
AC_CONFIG_COMMANDS([default], , test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h) AC_CONFIG_COMMANDS([default], , test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h)
AC_CONFIG_COMMANDS([my_config.h], cp include/config.h include/my_config.h)
# Ensure that table handlers gets all modifications to CFLAGS/CXXFLAGS # Ensure that table handlers gets all modifications to CFLAGS/CXXFLAGS
AC_CONFIG_COMMANDS_POST(ac_configure_args="$ac_configure_args CFLAGS='$CFLAGS' CXXFLAGS='$CXXFLAGS'") AC_CONFIG_COMMANDS_POST(ac_configure_args="$ac_configure_args CFLAGS='$CFLAGS' CXXFLAGS='$CXXFLAGS'")
......
...@@ -84,8 +84,8 @@ ...@@ -84,8 +84,8 @@
in pthread_mutex_lock in pthread_mutex_lock
*/ */
#undef SAFE_MUTEX
#include <my_global.h> #include <my_global.h>
#undef SAFE_MUTEX
#include <m_string.h> #include <m_string.h>
#include <errno.h> #include <errno.h>
......
...@@ -59,6 +59,8 @@ link_sources: ...@@ -59,6 +59,8 @@ link_sources:
# We want both "my_config.h" and "config.h" that are identical, as # We want both "my_config.h" and "config.h" that are identical, as
# MySQL sources assumes the name "my_config.h", and 3rd party sources # MySQL sources assumes the name "my_config.h", and 3rd party sources
# assumes the name "config.h". # assumes the name "config.h".
# Normally this is generated by configure; This rule is left here in case
# someone deletes my_config.h and expect it to be generated by make
my_config.h: config.h my_config.h: config.h
$(CP) config.h my_config.h $(CP) config.h my_config.h
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
** The following is a simple implementation of posix conditions ** The following is a simple implementation of posix conditions
*****************************************************************************/ *****************************************************************************/
#include <my_global.h>
#undef SAFE_MUTEX /* Avoid safe_mutex redefinitions */ #undef SAFE_MUTEX /* Avoid safe_mutex redefinitions */
#include "mysys_priv.h" #include "mysys_priv.h"
#if defined(THREAD) && defined(__WIN__) #if defined(THREAD) && defined(__WIN__)
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
*****************************************************************************/ *****************************************************************************/
/* SAFE_MUTEX will not work until the thread structure is up to date */ /* SAFE_MUTEX will not work until the thread structure is up to date */
#include <my_global.h>
#undef SAFE_MUTEX #undef SAFE_MUTEX
#include "mysys_priv.h" #include "mysys_priv.h"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment