From 8e45c0572bf6503b1fd126428aac203c90c949b7 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 21 Jun 2005 22:24:58 +0400 Subject: [PATCH 1/9] Fix bug #10886 - INSERT ... SELECT ... ON DUPLICATE KEY UPDATE produces bad results Temporary field wasn't restored to default values after ON DUPLICATE KEY UPDATE event, which results in wrong data being inserted in new record. sql/sql_insert.cc: Fix bug #10886 - INSERT ... SELECT ... ON DUPLICATE KEY UPDATE produces bad results mysql-test/t/insert_select.test: Test case for bug #10886 - INSERT ... SELECT ... ON DUPLICATE KEY UPDATE produces bad results mysql-test/r/insert_select.result: Test case for bug #10886 - INSERT ... SELECT ... ON DUPLICATE KEY UPDATE produces bad results --- mysql-test/r/insert_select.result | 9 +++++++++ mysql-test/t/insert_select.test | 9 +++++++++ sql/sql_insert.cc | 19 +++++++++++++++---- 3 files changed, 33 insertions(+), 4 deletions(-) diff --git a/mysql-test/r/insert_select.result b/mysql-test/r/insert_select.result index f843c6d0d18..082b7098a1a 100644 --- a/mysql-test/r/insert_select.result +++ b/mysql-test/r/insert_select.result @@ -625,3 +625,12 @@ select SQL_BUFFER_RESULT * from t1 WHERE (SEQ = 1); ID NO SEQ 1 1 1 drop table t1; +create table t1 (f1 int); +create table t2 (ff1 int unique, ff2 int default 1); +insert into t1 values (1),(1),(2); +insert into t2(ff1) select f1 from t1 on duplicate key update ff2=ff2+1; +select * from t2; +ff1 ff2 +1 2 +2 1 +drop table t1, t2; diff --git a/mysql-test/t/insert_select.test b/mysql-test/t/insert_select.test index ecc83e3883b..613c97dc4f1 100644 --- a/mysql-test/t/insert_select.test +++ b/mysql-test/t/insert_select.test @@ -166,3 +166,12 @@ INSERT INTO t1 (SEQ, NO) SELECT "1" AS SEQ, IF(MAX(NO) IS NULL, 0, MAX(NO)) + 1 select SQL_BUFFER_RESULT * from t1 WHERE (SEQ = 1); drop table t1; +# +# Bug#10886 - Have to restore default values after update ON DUPLICATE KEY +# +create table t1 (f1 int); +create table t2 (ff1 int unique, ff2 int default 1); +insert into t1 values (1),(1),(2); +insert into t2(ff1) select f1 from t1 on duplicate key update ff2=ff2+1; +select * from t2; +drop table t1, t2; diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 718e6b00ddc..1b3c58032f2 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -1625,11 +1625,22 @@ bool select_insert::send_data(List &values) store_values(values); error=thd->net.report_error || write_record(table,&info); thd->count_cuted_fields= CHECK_FIELD_IGNORE; - if (!error && table->next_number_field) // Clear for next record + + if (!error) { - table->next_number_field->reset(); - if (! last_insert_id && thd->insert_id_used) - last_insert_id=thd->insert_id(); + /* + Restore fields of the record since it is possible that they were + changed by ON DUPLICATE KEY UPDATE clause. + */ + if (info.handle_duplicates == DUP_UPDATE) + restore_record(table, default_values); + + if (table->next_number_field) // Clear for next record + { + table->next_number_field->reset(); + if (! last_insert_id && thd->insert_id_used) + last_insert_id=thd->insert_id(); + } } DBUG_RETURN(error); } From 40f0738b9c70be6c2c7419b7de0c35f895906ae1 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 22 Jun 2005 11:59:13 +0400 Subject: [PATCH 2/9] Adjust to the changed Query_arena constructor: main_mem_root is moved out of class Query_arena. sql/sp_head.cc: Adjust to the changed Query_arena constructor. main_mem_root is moved out of class Query_arena. sql/sp_head.h: main_mem_root is moved out of class Query_arena: add it to class sp_head. sql/sql_class.cc: main_mem_root is moved out of class Query_arena: remove constructors no longer relevant, remove dead code. sql/sql_class.h: main_mem_root is moved out of class Query_arena. sql/sql_prepare.cc: It's better to not use main_mem_root anywhere: logically, it's not a public member (can't fix sp_head::make_field and Item_subselect::exec to make it protected) sql/sql_select.cc: New Cursor constructor, which avoids unneeded memory allocation when initializign main_mem_root. sql/sql_select.h: main_mem_root is moved out of class Query_arena. --- sql/sp_head.cc | 4 +-- sql/sp_head.h | 1 + sql/sql_class.cc | 82 +++++++++++----------------------------------- sql/sql_class.h | 20 ++++------- sql/sql_prepare.cc | 2 +- sql/sql_select.cc | 11 ++++++- sql/sql_select.h | 3 +- 7 files changed, 42 insertions(+), 81 deletions(-) diff --git a/sql/sp_head.cc b/sql/sp_head.cc index fae657a8caf..2b1ab415aec 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -310,7 +310,8 @@ sp_head::operator delete(void *ptr, size_t size) sp_head::sp_head() - :Query_arena((bool)FALSE), m_returns_cs(NULL), m_has_return(FALSE), + :Query_arena(&main_mem_root, INITIALIZED_FOR_SP), + m_returns_cs(NULL), m_has_return(FALSE), m_simple_case(FALSE), m_multi_results(FALSE), m_in_handler(FALSE) { extern byte * @@ -319,7 +320,6 @@ sp_head::sp_head() *sp_lex_sp_key(const byte *ptr, uint *plen, my_bool first); DBUG_ENTER("sp_head::sp_head"); - state= INITIALIZED_FOR_SP; m_backpatch.empty(); m_lex.empty(); hash_init(&m_sptabs, system_charset_info, 0, 0, 0, sp_table_key, 0, 0); diff --git a/sql/sp_head.h b/sql/sp_head.h index d22515672f9..2c75a320f30 100644 --- a/sql/sp_head.h +++ b/sql/sp_head.h @@ -79,6 +79,7 @@ class sp_head :private Query_arena sp_head(const sp_head &); /* Prevent use of these */ void operator=(sp_head &); + MEM_ROOT main_mem_root; public: int m_type; // TYPE_ENUM_FUNCTION or TYPE_ENUM_PROCEDURE diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 8b3fb87e662..e5fdeb8cc69 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -420,8 +420,6 @@ THD::~THD() #ifndef DBUG_OFF dbug_sentry= THD_SENTRY_GONE; #endif - /* Reset stmt_backup.mem_root to not double-free memory from thd.mem_root */ - clear_alloc_root(&stmt_backup.main_mem_root); DBUG_VOID_RETURN; } @@ -1474,52 +1472,6 @@ void select_dumpvar::cleanup() } -/* - Create arena for already constructed THD. - - SYNOPSYS - Query_arena() - thd - thread for which arena is created - - DESCRIPTION - Create arena for already existing THD using its variables as parameters - for memory root initialization. -*/ -Query_arena::Query_arena(THD* thd) - :free_list(0), mem_root(&main_mem_root), - state(INITIALIZED) -{ - init_sql_alloc(&main_mem_root, - thd->variables.query_alloc_block_size, - thd->variables.query_prealloc_size); -} - - -/* - Create arena and optionally initialize memory root. - - SYNOPSYS - Query_arena() - init_mem_root - whenever we need to initialize memory root - - DESCRIPTION - Create arena and optionally initialize memory root with minimal - possible parameters. - - NOTE - We use this constructor when arena is part of THD, but reinitialize - its memory root in THD::init_for_queries() before execution of real - statements. -*/ -Query_arena::Query_arena(bool init_mem_root) - :free_list(0), mem_root(&main_mem_root), - state(CONVENTIONAL_EXECUTION) -{ - if (init_mem_root) - init_sql_alloc(&main_mem_root, ALLOC_ROOT_MIN_BLOCK_SIZE, 0); -} - - Query_arena::Type Query_arena::type() const { DBUG_ASSERT(0); /* Should never be called */ @@ -1532,7 +1484,7 @@ Query_arena::Type Query_arena::type() const */ Statement::Statement(THD *thd) - :Query_arena(thd), + :Query_arena(&main_mem_root, INITIALIZED), id(++thd->statement_id_counter), set_query_id(1), allow_sum_func(0), @@ -1542,16 +1494,19 @@ Statement::Statement(THD *thd) cursor(0) { name.str= NULL; + init_sql_alloc(&main_mem_root, + thd->variables.query_alloc_block_size, + thd->variables.query_prealloc_size); } /* - This constructor is called when statement is a subobject of THD: - Some variables are initialized in THD::init due to locking problems - This statement object will be used to + This constructor is called when Statement is a parent of THD and + for the backup statement. Some variables are initialized in + THD::init due to locking problems. */ Statement::Statement() - :Query_arena((bool)TRUE), + :Query_arena(&main_mem_root, CONVENTIONAL_EXECUTION), id(0), set_query_id(1), allow_sum_func(0), /* initialized later */ @@ -1560,6 +1515,12 @@ Statement::Statement() query_length(0), /* in alloc_query() */ cursor(0) { + /* + This is just to ensure that the destructor works correctly in + case of an error and the backup statement. The memory root will + be re-initialized in THD::init. + */ + init_sql_alloc(&main_mem_root, ALLOC_ROOT_MIN_BLOCK_SIZE, 0); } @@ -1631,16 +1592,6 @@ void Query_arena::restore_backup_item_arena(Query_arena *set, Query_arena *backu set_item_arena(backup); #ifndef DBUG_OFF backup_arena= 0; -#endif -#ifdef NOT_NEEDED_NOW - /* - Reset backup mem_root to avoid its freeing. - Since Query_arena's mem_root is freed only when it is part of Statement - we need this only if we use some Statement's arena as backup storage. - But we do this only with THD::stmt_backup and this Statement is specially - handled in this respect. So this code is not really needed now. - */ - clear_alloc_root(&backup->mem_root); #endif DBUG_VOID_RETURN; } @@ -1654,6 +1605,11 @@ void Query_arena::set_item_arena(Query_arena *set) Statement::~Statement() { + /* + We must free `main_mem_root', not `mem_root' (pointer), to work + correctly if this statement is used as a backup statement, + for which `mem_root' may point to some other statement. + */ free_root(&main_mem_root, MYF(0)); } diff --git a/sql/sql_class.h b/sql/sql_class.h index dd4b8310e51..fff789d3066 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -661,7 +661,6 @@ public: itself to the list on creation (see Item::Item() for details)) */ Item *free_list; - MEM_ROOT main_mem_root; MEM_ROOT *mem_root; // Pointer to current memroot #ifndef DBUG_OFF bool backup_arena; @@ -680,21 +679,14 @@ public: STATEMENT, PREPARED_STATEMENT, STORED_PROCEDURE }; + Query_arena(MEM_ROOT *mem_root_arg, enum enum_state state_arg) : + free_list(0), mem_root(mem_root_arg), state(state_arg) + {} /* This constructor is used only when Query_arena is created as backup storage for another instance of Query_arena. */ Query_arena() {}; - /* - Create arena for already constructed THD using its variables as - parameters for memory root initialization. - */ - Query_arena(THD *thd); - /* - Create arena and optionally init memory root with minimal values. - Particularly used if Query_arena is part of Statement. - */ - Query_arena(bool init_mem_root); virtual Type type() const; virtual ~Query_arena() {}; @@ -708,6 +700,7 @@ public: { return state == PREPARED || state == EXECUTED; } inline bool is_conventional() const { return state == CONVENTIONAL_EXECUTION; } + inline gptr alloc(unsigned int size) { return alloc_root(mem_root,size); } inline gptr calloc(unsigned int size) { @@ -757,7 +750,8 @@ class Statement: public Query_arena Statement(const Statement &rhs); /* not implemented: */ Statement &operator=(const Statement &rhs); /* non-copyable */ public: - /* FIXME: must be private */ + /* FIXME: these must be protected */ + MEM_ROOT main_mem_root; LEX main_lex; /* @@ -1388,7 +1382,7 @@ public: already changed to use this arena. */ if (!current_arena->is_conventional() && - mem_root != ¤t_arena->main_mem_root) + mem_root != current_arena->mem_root) { set_n_backup_item_arena(current_arena, backup); return current_arena; diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index 8ff77f5a404..73bbea79760 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -2002,7 +2002,7 @@ void mysql_stmt_execute(THD *thd, char *packet, uint packet_length) { DBUG_PRINT("info",("Using READ_ONLY cursor")); if (!cursor && - !(cursor= stmt->cursor= new (&stmt->main_mem_root) Cursor())) + !(cursor= stmt->cursor= new (stmt->mem_root) Cursor(thd))) DBUG_VOID_RETURN; /* If lex->result is set, mysql_execute_command will use it */ stmt->lex->result= &cursor->result; diff --git a/sql/sql_select.cc b/sql/sql_select.cc index fcd0c7b4786..8f638a0b094 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -1708,7 +1708,16 @@ JOIN::cleanup() /************************* Cursor ******************************************/ - + +Cursor::Cursor(THD *thd) + :Query_arena(&main_mem_root, INITIALIZED), + join(0), unit(0) +{ + /* We will overwrite it at open anyway. */ + init_sql_alloc(&main_mem_root, ALLOC_ROOT_MIN_BLOCK_SIZE, 0); +} + + void Cursor::init_from_thd(THD *thd) { diff --git a/sql/sql_select.h b/sql/sql_select.h index 5bec06fa36c..e5266944251 100644 --- a/sql/sql_select.h +++ b/sql/sql_select.h @@ -372,6 +372,7 @@ class JOIN :public Sql_alloc class Cursor: public Sql_alloc, public Query_arena { + MEM_ROOT main_mem_root; JOIN *join; SELECT_LEX_UNIT *unit; @@ -396,7 +397,7 @@ public: void close(); void set_unit(SELECT_LEX_UNIT *unit_arg) { unit= unit_arg; } - Cursor() :Query_arena(TRUE), join(0), unit(0) {} + Cursor(THD *thd); ~Cursor(); }; From 4d7bca88e9c50599610829702c7a9a20db9fda00 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 22 Jun 2005 12:02:31 +0300 Subject: [PATCH 3/9] InnoDB: Correct a function comment. innobase/include/rem0rec.h: rec_get_nth_field(): Correct the comment. innobase/include/rem0rec.ic: rec_get_nth_field(): Correct the comment. --- innobase/include/rem0rec.h | 2 +- innobase/include/rem0rec.ic | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/innobase/include/rem0rec.h b/innobase/include/rem0rec.h index c068f4cb73c..1d15b8d1c77 100644 --- a/innobase/include/rem0rec.h +++ b/innobase/include/rem0rec.h @@ -282,7 +282,7 @@ rec_get_nth_field_size( ulint n); /* in: index of the field */ /**************************************************************** The following function is used to get a pointer to the nth -data field in an old-style record. */ +data field in a record. */ UNIV_INLINE byte* rec_get_nth_field( diff --git a/innobase/include/rem0rec.ic b/innobase/include/rem0rec.ic index d60fb3b9eda..e2dceb6bae5 100644 --- a/innobase/include/rem0rec.ic +++ b/innobase/include/rem0rec.ic @@ -886,7 +886,7 @@ rec_offs_make_valid( /**************************************************************** The following function is used to get a pointer to the nth -data field in an old-style record. */ +data field in a record. */ UNIV_INLINE byte* rec_get_nth_field( From 80a621321becb37e0505128f58033796c7f38605 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 22 Jun 2005 14:08:28 +0500 Subject: [PATCH 4/9] WL#2286 - Compile MySQL w/YASSL support Fix GCC 4.0 link failure. Better CXX_VERSION guessing. config/ac-macros/misc.m4: Better CXX_VERSION guessing. configure.in: CXX_VERSION guessing moved to misc.m4. HAVE_EXPLICIT_TEMPLATE_INSTANTIATION moved to config.h. Use compiler AR with MIPSpro and Forte instead of instantiating templates explicitly. extra/yassl/src/crypto_wrapper.cpp: EXPLICIT_TEMPLATE_INSTANTIATION renamed to HAVE_EXPLICIT_TEMPLAE_INSTANTIATION. extra/yassl/src/template_instnt.cpp: EXPLICIT_TEMPLATE_INSTANTIATION renamed to HAVE_EXPLICIT_TEMPLAE_INSTANTIATION. extra/yassl/src/yassl_int.cpp: GCC 4.0 link fix. This file needs __cxa_pure_virtual. extra/yassl/taocrypt/include/runtime.hpp: Fix GCC 4.0 link failure. Instruct compiler to always emit __cxa_pure_virtual even if it seems to be never used. extra/yassl/taocrypt/include/types.hpp: Include config.h. extra/yassl/taocrypt/src/algebra.cpp: EXPLICIT_TEMPLATE_INSTANTIATION renamed to HAVE_EXPLICIT_TEMPLAE_INSTANTIATION. extra/yassl/taocrypt/src/dh.cpp: GCC 4.0 link fix. This file needs __cxa_pure_virtual. extra/yassl/taocrypt/src/dsa.cpp: GCC 4.0 link fix. This file needs __cxa_pure_virtual. extra/yassl/taocrypt/src/integer.cpp: EXPLICIT_TEMPLATE_INSTANTIATION renamed to HAVE_EXPLICIT_TEMPLAE_INSTANTIATION. extra/yassl/taocrypt/src/rsa.cpp: GCC 4.0 link fix. This file needs __cxa_pure_virtual. extra/yassl/taocrypt/src/template_instnt.cpp: EXPLICIT_TEMPLATE_INSTANTIATION renamed to HAVE_EXPLICIT_TEMPLAE_INSTANTIATION. sql/field.cc: EXPLICIT_TEMPLATE_INSTANTIATION renamed to HAVE_EXPLICIT_TEMPLAE_INSTANTIATION. sql/item.cc: EXPLICIT_TEMPLATE_INSTANTIATION renamed to HAVE_EXPLICIT_TEMPLAE_INSTANTIATION. sql/item_buff.cc: EXPLICIT_TEMPLATE_INSTANTIATION renamed to HAVE_EXPLICIT_TEMPLAE_INSTANTIATION. sql/mysqld.cc: EXPLICIT_TEMPLATE_INSTANTIATION renamed to HAVE_EXPLICIT_TEMPLAE_INSTANTIATION. sql/opt_range.cc: EXPLICIT_TEMPLATE_INSTANTIATION renamed to HAVE_EXPLICIT_TEMPLAE_INSTANTIATION. sql/set_var.cc: EXPLICIT_TEMPLATE_INSTANTIATION renamed to HAVE_EXPLICIT_TEMPLAE_INSTANTIATION. sql/slave.cc: EXPLICIT_TEMPLATE_INSTANTIATION renamed to HAVE_EXPLICIT_TEMPLAE_INSTANTIATION. sql/sql_acl.cc: EXPLICIT_TEMPLATE_INSTANTIATION renamed to HAVE_EXPLICIT_TEMPLAE_INSTANTIATION. sql/sql_class.cc: EXPLICIT_TEMPLATE_INSTANTIATION renamed to HAVE_EXPLICIT_TEMPLAE_INSTANTIATION. sql/sql_insert.cc: EXPLICIT_TEMPLATE_INSTANTIATION renamed to HAVE_EXPLICIT_TEMPLAE_INSTANTIATION. sql/sql_map.cc: EXPLICIT_TEMPLATE_INSTANTIATION renamed to HAVE_EXPLICIT_TEMPLAE_INSTANTIATION. sql/sql_select.cc: EXPLICIT_TEMPLATE_INSTANTIATION renamed to HAVE_EXPLICIT_TEMPLAE_INSTANTIATION. sql/sql_show.cc: EXPLICIT_TEMPLATE_INSTANTIATION renamed to HAVE_EXPLICIT_TEMPLAE_INSTANTIATION. sql/table.cc: EXPLICIT_TEMPLATE_INSTANTIATION renamed to HAVE_EXPLICIT_TEMPLAE_INSTANTIATION. --- config/ac-macros/misc.m4 | 27 ++++++++++++++++ configure.in | 33 +++++--------------- extra/yassl/src/crypto_wrapper.cpp | 4 +-- extra/yassl/src/template_instnt.cpp | 2 +- extra/yassl/src/yassl_int.cpp | 3 +- extra/yassl/taocrypt/include/runtime.hpp | 2 +- extra/yassl/taocrypt/include/types.hpp | 4 +++ extra/yassl/taocrypt/src/algebra.cpp | 2 +- extra/yassl/taocrypt/src/dh.cpp | 1 + extra/yassl/taocrypt/src/dsa.cpp | 1 + extra/yassl/taocrypt/src/integer.cpp | 2 +- extra/yassl/taocrypt/src/rsa.cpp | 1 + extra/yassl/taocrypt/src/template_instnt.cpp | 2 +- sql/field.cc | 2 +- sql/item.cc | 2 +- sql/item_buff.cc | 2 +- sql/mysqld.cc | 2 +- sql/opt_range.cc | 2 +- sql/set_var.cc | 2 +- sql/slave.cc | 2 +- sql/sql_acl.cc | 2 +- sql/sql_class.cc | 2 +- sql/sql_insert.cc | 4 +-- sql/sql_map.cc | 2 +- sql/sql_select.cc | 2 +- sql/sql_show.cc | 4 +-- sql/table.cc | 2 +- 27 files changed, 67 insertions(+), 49 deletions(-) diff --git a/config/ac-macros/misc.m4 b/config/ac-macros/misc.m4 index e2564c2b80a..e3413048cf7 100644 --- a/config/ac-macros/misc.m4 +++ b/config/ac-macros/misc.m4 @@ -710,3 +710,30 @@ fi ]) +AC_DEFUN([MYSQL_CHECK_CXX_VERSION], [ +case $SYSTEM_TYPE in + *netware*) + CXX_VERSION=`$CXX -version | grep -i version` + ;; + *) + CXX_VERSION=`$CXX --version | sed 1q` + if test $? -ne "0" -o -z "$CXX_VERSION" + then + CXX_VERSION=`$CXX -V 2>&1|sed 1q` # trying harder for Sun and SGI + fi + if test $? -ne "0" -o -z "$CXX_VERSION" + then + CXX_VERSION=`$CXX -v 2>&1|sed 1q` # even harder for Alpha + fi + if test $? -ne "0" -o -z "$CXX_VERSION" + then + CXX_VERSION="" + fi +esac +if test "$CXX_VERSION" +then + AC_MSG_CHECKING("C++ compiler version"); + AC_MSG_RESULT("$CXX $CXX_VERSION") +fi +AC_SUBST(CXX_VERSION) +]) diff --git a/configure.in b/configure.in index 90b9300cfd4..0e53e167ed2 100644 --- a/configure.in +++ b/configure.in @@ -195,25 +195,8 @@ then else CC_VERSION="" fi -case $SYSTEM_TYPE in - *netware*) -CXX_VERSION=`$CXX -version | grep -i version` - ;; - *) -CXX_VERSION=`$CXX --version | sed 1q` -CXX_VERSION=${CXX_VERSION:-`$CXX -V|sed 1q`} # trying harder for Sun and SGI -CXX_VERSION=${CXX_VERSION:-`$CXX -V 2>&1|sed 1q`} # even harder for Alpha - ;; -esac -if test $? -eq "0" -then - AC_MSG_CHECKING("C++ compiler version"); - AC_MSG_RESULT("$CXX $CXX_VERSION") -else -CXX_VERSION="" -fi -AC_SUBST(CXX_VERSION) AC_SUBST(CC_VERSION) +MYSQL_CHECK_CXX_VERSION # Fix for sgi gcc / sgiCC which tries to emulate gcc if test "$CC" = "sgicc" @@ -367,18 +350,18 @@ then # Disable exceptions as they seams to create problems with gcc and threads. # mysqld doesn't use run-time-type-checking, so we disable it. CXXFLAGS="$CXXFLAGS -fno-implicit-templates -fno-exceptions -fno-rtti" - CXXFLAGS="$CXXFLAGS -DEXPLICIT_TEMPLATE_INSTANTIATION" + AC_DEFINE([HAVE_EXPLICIT_TEMPLATE_INSTANTIATION], + [1], [Defined by configure. Explicit template instantiation.]) fi case $CXX_VERSION in MIPSpro*) - CXXFLAGS="$CXXFLAGS -no_prelink -DEXPLICIT_TEMPLATE_INSTANTIATION" + AR=$CXX + ARFLAGS="-ar -o" ;; - Compaq*) - CXXFLAGS="$CXXFLAGS -nopt -DEXPLICIT_TEMPLATE_INSTANTIATION" - ;; - Forte*) - CXXFLAGS="$CXXFLAGS -instance=explicit -DEXPLICIT_TEMPLATE_INSTANTIATION" + *Forte*) + AR=$CXX + ARFLAGS="-xar -o" esac # Avoid bug in fcntl on some versions of linux diff --git a/extra/yassl/src/crypto_wrapper.cpp b/extra/yassl/src/crypto_wrapper.cpp index 976518ace91..80cadd3d722 100644 --- a/extra/yassl/src/crypto_wrapper.cpp +++ b/extra/yassl/src/crypto_wrapper.cpp @@ -971,7 +971,7 @@ x509* PemToDer(const char* fname, CertType type) } // namespace -#ifdef EXPLICIT_TEMPLATE_INSTANTIATION +#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION namespace yaSSL { template void ysDelete(DiffieHellman::DHImpl*); template void ysDelete(Integer::IntegerImpl*); @@ -989,6 +989,6 @@ template void ysDelete(RMD::RMDImpl*); template void ysDelete(SHA::SHAImpl*); template void ysDelete(MD5::MD5Impl*); } -#endif // EXPLICIT_TEMPLATE_INSTANTIATION +#endif // HAVE_EXPLICIT_TEMPLATE_INSTANTIATION #endif // !USE_CRYPTOPP_LIB diff --git a/extra/yassl/src/template_instnt.cpp b/extra/yassl/src/template_instnt.cpp index 43f3d551b7a..5cf4f8c39f8 100644 --- a/extra/yassl/src/template_instnt.cpp +++ b/extra/yassl/src/template_instnt.cpp @@ -8,7 +8,7 @@ #include "ripemd.hpp" #include "openssl/ssl.h" -#ifdef EXPLICIT_TEMPLATE_INSTANTIATION +#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION #if !defined(USE_CRYPTOPP_LIB) namespace TaoCrypt { template class HMAC; diff --git a/extra/yassl/src/yassl_int.cpp b/extra/yassl/src/yassl_int.cpp index ab9188a5d61..e9c1ed53816 100644 --- a/extra/yassl/src/yassl_int.cpp +++ b/extra/yassl/src/yassl_int.cpp @@ -24,6 +24,7 @@ * draft along with type conversion functions. */ +#include "runtime.hpp" #include "yassl_int.hpp" #include "handshake.hpp" #include "timer.hpp" @@ -1975,7 +1976,7 @@ X509_NAME* X509::GetSubject() } // namespace -#ifdef EXPLICIT_TEMPLATE_INSTANTIATION +#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION namespace mySTL { template yaSSL::yassl_int_cpp_local1::SumData for_each::iterator, yaSSL::yassl_int_cpp_local1::SumData>(mySTL::list::iterator, mySTL::list::iterator, yaSSL::yassl_int_cpp_local1::SumData); template yaSSL::yassl_int_cpp_local1::SumBuffer for_each::iterator, yaSSL::yassl_int_cpp_local1::SumBuffer>(mySTL::list::iterator, mySTL::list::iterator, yaSSL::yassl_int_cpp_local1::SumBuffer); diff --git a/extra/yassl/taocrypt/include/runtime.hpp b/extra/yassl/taocrypt/include/runtime.hpp index 1b364049452..70768bb01d1 100644 --- a/extra/yassl/taocrypt/include/runtime.hpp +++ b/extra/yassl/taocrypt/include/runtime.hpp @@ -35,7 +35,7 @@ extern "C" { #include /* Disallow inline __cxa_pure_virtual() */ -static int __cxa_pure_virtual() __attribute__((noinline)); +static int __cxa_pure_virtual() __attribute__((noinline, used)); static int __cxa_pure_virtual() { // oops, pure virtual called! diff --git a/extra/yassl/taocrypt/include/types.hpp b/extra/yassl/taocrypt/include/types.hpp index d497d45e1da..18961cf4d6f 100644 --- a/extra/yassl/taocrypt/include/types.hpp +++ b/extra/yassl/taocrypt/include/types.hpp @@ -25,6 +25,10 @@ #ifndef TAO_CRYPT_TYPES_HPP #define TAO_CRYPT_TYPES_HPP +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + namespace TaoCrypt { // define this if running on a big-endian CPU diff --git a/extra/yassl/taocrypt/src/algebra.cpp b/extra/yassl/taocrypt/src/algebra.cpp index d274b262497..e0472f2fc76 100644 --- a/extra/yassl/taocrypt/src/algebra.cpp +++ b/extra/yassl/taocrypt/src/algebra.cpp @@ -319,7 +319,7 @@ void AbstractRing::SimultaneousExponentiate(Integer *results, } // namespace -#ifdef EXPLICIT_TEMPLATE_INSTANTIATION +#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION namespace mySTL { template TaoCrypt::WindowSlider* uninit_copy(TaoCrypt::WindowSlider*, TaoCrypt::WindowSlider*, TaoCrypt::WindowSlider*); template void destroy(TaoCrypt::WindowSlider*, TaoCrypt::WindowSlider*); diff --git a/extra/yassl/taocrypt/src/dh.cpp b/extra/yassl/taocrypt/src/dh.cpp index d5f93f6c0f6..ea1b5846f7d 100644 --- a/extra/yassl/taocrypt/src/dh.cpp +++ b/extra/yassl/taocrypt/src/dh.cpp @@ -23,6 +23,7 @@ /* dh.cpp implements Diffie-Hellman support */ +#include "runtime.hpp" #include "dh.hpp" #include "asn.hpp" diff --git a/extra/yassl/taocrypt/src/dsa.cpp b/extra/yassl/taocrypt/src/dsa.cpp index e0d0519c169..4574fe5ebd8 100644 --- a/extra/yassl/taocrypt/src/dsa.cpp +++ b/extra/yassl/taocrypt/src/dsa.cpp @@ -20,6 +20,7 @@ */ +#include "runtime.hpp" #include "dsa.hpp" #include "sha.hpp" #include "asn.hpp" diff --git a/extra/yassl/taocrypt/src/integer.cpp b/extra/yassl/taocrypt/src/integer.cpp index 5c5dd59fde0..0f06bb4e044 100644 --- a/extra/yassl/taocrypt/src/integer.cpp +++ b/extra/yassl/taocrypt/src/integer.cpp @@ -3956,7 +3956,7 @@ Integer CRT(const Integer &xp, const Integer &p, const Integer &xq, return p * (u * (xq-xp) % q) + xp; } -#ifdef EXPLICIT_TEMPLATE_INSTANTIATION +#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION #ifndef TAOCRYPT_NATIVE_DWORD_AVAILABLE template hword DivideThreeWordsByTwo(hword*, hword, hword, Word*); #endif diff --git a/extra/yassl/taocrypt/src/rsa.cpp b/extra/yassl/taocrypt/src/rsa.cpp index 4c7c45b8ffe..021fd992b5c 100644 --- a/extra/yassl/taocrypt/src/rsa.cpp +++ b/extra/yassl/taocrypt/src/rsa.cpp @@ -21,6 +21,7 @@ /* based on Wei Dai's rsa.cpp from CryptoPP */ +#include "runtime.hpp" #include "rsa.hpp" #include "asn.hpp" #include "modarith.hpp" diff --git a/extra/yassl/taocrypt/src/template_instnt.cpp b/extra/yassl/taocrypt/src/template_instnt.cpp index c643bd6d73a..28994282669 100644 --- a/extra/yassl/taocrypt/src/template_instnt.cpp +++ b/extra/yassl/taocrypt/src/template_instnt.cpp @@ -4,7 +4,7 @@ #include "vector.hpp" #include "hash.hpp" -#ifdef EXPLICIT_TEMPLATE_INSTANTIATION +#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION namespace TaoCrypt { #if defined(SSE2_INTRINSICS_AVAILABLE) template AlignedAllocator::pointer StdReallocate >(AlignedAllocator&, unsigned int*, AlignedAllocator::size_type, AlignedAllocator::size_type, bool); diff --git a/sql/field.cc b/sql/field.cc index 8324d4eb725..aeefe64ace3 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -38,7 +38,7 @@ Instansiate templates and static variables *****************************************************************************/ -#ifdef EXPLICIT_TEMPLATE_INSTANTIATION +#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION template class List; template class List_iterator; #endif diff --git a/sql/item.cc b/sql/item.cc index 8a7d00e2841..57dff21f3ee 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -5387,7 +5387,7 @@ void Item_result_field::cleanup() ** Instantiate templates *****************************************************************************/ -#ifdef EXPLICIT_TEMPLATE_INSTANTIATION +#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION template class List; template class List_iterator; template class List_iterator_fast; diff --git a/sql/item_buff.cc b/sql/item_buff.cc index 7e7bbe51657..1ed1d3d94a2 100644 --- a/sql/item_buff.cc +++ b/sql/item_buff.cc @@ -146,7 +146,7 @@ bool Cached_item_decimal::cmp() ** Instansiate templates *****************************************************************************/ -#ifdef EXPLICIT_TEMPLATE_INSTANTIATION +#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION template class List; template class List_iterator; #endif diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 9c44d218954..b194ec87cb0 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -7073,7 +7073,7 @@ static void create_pid_file() Instantiate templates *****************************************************************************/ -#ifdef EXPLICIT_TEMPLATE_INSTANTIATION +#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION /* Used templates */ template class I_List; template class I_List_iterator; diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 7d8bfe61692..0a8627b1fa0 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -8918,7 +8918,7 @@ void QUICK_GROUP_MIN_MAX_SELECT::dbug_dump(int indent, bool verbose) ** Instantiate templates *****************************************************************************/ -#ifdef EXPLICIT_TEMPLATE_INSTANTIATION +#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION template class List; template class List_iterator; #endif diff --git a/sql/set_var.cc b/sql/set_var.cc index a06c5b9b858..1c0de702e4e 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -3406,7 +3406,7 @@ bool process_key_caches(int (* func) (const char *name, KEY_CACHE *)) Used templates ****************************************************************************/ -#ifdef EXPLICIT_TEMPLATE_INSTANTIATION +#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION template class List; template class List_iterator_fast; template class I_List_iterator; diff --git a/sql/slave.cc b/sql/slave.cc index 3094276cfaf..c6c0de7160b 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -5002,7 +5002,7 @@ end: } -#ifdef EXPLICIT_TEMPLATE_INSTANTIATION +#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION template class I_List_iterator; template class I_List_iterator; #endif diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 14aaab03682..c1044d31c46 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -5325,7 +5325,7 @@ bool sp_grant_privileges(THD *thd, const char *sp_db, const char *sp_name, Instantiate used templates *****************************************************************************/ -#ifdef EXPLICIT_TEMPLATE_INSTANTIATION +#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION template class List_iterator; template class List_iterator; template class List; diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 8b3fb87e662..f751e0891be 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -49,7 +49,7 @@ char internal_table_name[2]= "*"; ** Instansiate templates *****************************************************************************/ -#ifdef EXPLICIT_TEMPLATE_INSTANTIATION +#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION /* Used templates */ template class List; template class List_iterator; diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index a963af4c6e3..b0c7ec12d26 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -2362,11 +2362,11 @@ void select_create::abort() Instansiate templates *****************************************************************************/ -#ifdef EXPLICIT_TEMPLATE_INSTANTIATION +#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION template class List_iterator_fast; #ifndef EMBEDDED_LIBRARY template class I_List; template class I_List_iterator; template class I_List; #endif /* EMBEDDED_LIBRARY */ -#endif /* EXPLICIT_TEMPLATE_INSTANTIATION */ +#endif /* HAVE_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/sql/sql_map.cc b/sql/sql_map.cc index 726bd48ab19..56b4b765355 100644 --- a/sql/sql_map.cc +++ b/sql/sql_map.cc @@ -138,7 +138,7 @@ void unmap_file(mapped_files *map) ** Instansiate templates *****************************************************************************/ -#ifdef EXPLICIT_TEMPLATE_INSTANTIATION +#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION /* Used templates */ template class I_List; template class I_List_iterator; diff --git a/sql/sql_select.cc b/sql/sql_select.cc index fcd0c7b4786..2b4a86df681 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -6277,7 +6277,7 @@ public: COND_CMP(Item *a,Item_func *b) :and_level(a),cmp_func(b) {} }; -#ifdef EXPLICIT_TEMPLATE_INSTANTIATION +#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION template class I_List; template class I_List_iterator; template class List; diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 9503bc9ec89..12025c82da6 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -1102,7 +1102,7 @@ public: char *query; }; -#ifdef EXPLICIT_TEMPLATE_INSTANTIATION +#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION template class I_List; #endif @@ -3879,7 +3879,7 @@ ST_SCHEMA_TABLE schema_tables[]= }; -#ifdef EXPLICIT_TEMPLATE_INSTANTIATION +#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION template class List_iterator_fast; template class List; #endif diff --git a/sql/table.cc b/sql/table.cc index 23238cdd792..6677453969b 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -2236,7 +2236,7 @@ const char *Field_iterator_view::name() ** Instansiate templates *****************************************************************************/ -#ifdef EXPLICIT_TEMPLATE_INSTANTIATION +#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION template class List; template class List_iterator; #endif From eb7e1d7257598343b5b2cc93b59dffd948f99366 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 22 Jun 2005 11:18:40 +0200 Subject: [PATCH 5/9] Made upgrade compatibility in 4.1 range to latest build version ndb/src/common/util/version.c: Maybe upgrade compatibility in 4.1 range to latest build version --- ndb/src/common/util/version.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ndb/src/common/util/version.c b/ndb/src/common/util/version.c index ed2e2565eea..7221dc48fa4 100644 --- a/ndb/src/common/util/version.c +++ b/ndb/src/common/util/version.c @@ -90,7 +90,7 @@ void ndbSetOwnVersion() {} #ifndef TEST_VERSION struct NdbUpGradeCompatible ndbCompatibleTable_full[] = { - { MAKE_VERSION(4,1,12), MAKE_VERSION(4,1,10), UG_Range }, + { MAKE_VERSION(4,1,NDB_VERSION_BUILD), MAKE_VERSION(4,1,10), UG_Range }, { MAKE_VERSION(4,1,10), MAKE_VERSION(4,1,9), UG_Exact }, { MAKE_VERSION(4,1,9), MAKE_VERSION(4,1,8), UG_Exact }, { MAKE_VERSION(3,5,2), MAKE_VERSION(3,5,1), UG_Exact }, From 369da8f53903634549b818a706f61e40dd31b7d4 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 22 Jun 2005 12:36:24 +0300 Subject: [PATCH 6/9] InnoDB: Replace for loops with memset() where possible. innobase/btr/btr0cur.c: Replace for loop with memset() innobase/buf/buf0buf.c: buf_print(): Remove for loop for initializing counts[]. Similar to index_ids[], the elements of this array will be initialized when they are allocated, i.e., counts[n_found++] = 1. innobase/os/os0file.c: Replace for loop with memset() innobase/page/page0page.c: Replace for loop with memset() innobase/trx/trx0rec.c: Replace for loop with memset() --- innobase/btr/btr0cur.c | 4 +--- innobase/buf/buf0buf.c | 4 ---- innobase/os/os0file.c | 5 +---- innobase/page/page0page.c | 4 +--- innobase/trx/trx0rec.c | 8 +++----- 5 files changed, 6 insertions(+), 19 deletions(-) diff --git a/innobase/btr/btr0cur.c b/innobase/btr/btr0cur.c index 98d90ecf18a..4ae27f007d6 100644 --- a/innobase/btr/btr0cur.c +++ b/innobase/btr/btr0cur.c @@ -2847,9 +2847,7 @@ btr_estimate_number_of_different_key_vals( n_diff = mem_alloc((n_cols + 1) * sizeof(ib_longlong)); - for (j = 0; j <= n_cols; j++) { - n_diff[j] = 0; - } + memset(n_diff, 0, (n_cols + 1) * sizeof(ib_longlong)); /* We sample some pages in the index to get an estimate */ diff --git a/innobase/buf/buf0buf.c b/innobase/buf/buf0buf.c index 78189617aab..fe4498e6f10 100644 --- a/innobase/buf/buf0buf.c +++ b/innobase/buf/buf0buf.c @@ -2101,10 +2101,6 @@ buf_print(void) n_found = 0; - for (i = 0 ; i < size; i++) { - counts[i] = 0; - } - for (i = 0; i < size; i++) { frame = buf_pool_get_nth_block(buf_pool, i)->frame; diff --git a/innobase/os/os0file.c b/innobase/os/os0file.c index 8102f24f25a..c68f5738798 100644 --- a/innobase/os/os0file.c +++ b/innobase/os/os0file.c @@ -1672,7 +1672,6 @@ os_file_set_size( ibool ret; byte* buf; byte* buf2; - ulint i; ut_a(size == (size & 0xFFFFFFFF)); @@ -1685,9 +1684,7 @@ os_file_set_size( buf = ut_align(buf2, UNIV_PAGE_SIZE); /* Write buffer full of zeros */ - for (i = 0; i < UNIV_PAGE_SIZE * 512; i++) { - buf[i] = '\0'; - } + memset(buf, 0, UNIV_PAGE_SIZE * 512); offset = 0; low = (ib_longlong)size + (((ib_longlong)size_high) << 32); diff --git a/innobase/page/page0page.c b/innobase/page/page0page.c index 9c957ac8554..1fe7f1d9356 100644 --- a/innobase/page/page0page.c +++ b/innobase/page/page0page.c @@ -1755,9 +1755,7 @@ page_validate( records in the page record heap do not overlap */ buf = mem_heap_alloc(heap, UNIV_PAGE_SIZE); - for (i = 0; i < UNIV_PAGE_SIZE; i++) { - buf[i] = 0; - } + memset(buf, 0, UNIV_PAGE_SIZE); /* Check first that the record heap and the directory do not overlap. */ diff --git a/innobase/trx/trx0rec.c b/innobase/trx/trx0rec.c index 3f3cfd3b000..3b7171e6038 100644 --- a/innobase/trx/trx0rec.c +++ b/innobase/trx/trx0rec.c @@ -941,13 +941,11 @@ trx_undo_erase_page_end( mtr_t* mtr) /* in: mtr */ { ulint first_free; - ulint i; - + first_free = mach_read_from_2(undo_page + TRX_UNDO_PAGE_HDR + TRX_UNDO_PAGE_FREE); - for (i = first_free; i < UNIV_PAGE_SIZE - FIL_PAGE_DATA_END; i++) { - undo_page[i] = 0xFF; - } + memset(undo_page + first_free, 0xff, + (UNIV_PAGE_SIZE - FIL_PAGE_DATA_END) - first_free); mlog_write_initial_log_record(undo_page, MLOG_UNDO_ERASE_END, mtr); } From b4268440a4cb67ecfa8155e4ee050cad07834c40 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 22 Jun 2005 12:51:00 +0300 Subject: [PATCH 7/9] InnoDB: Remove compilation warnings and errors on SGI IRIX. innobase/row/row0ins.c: Remove compilation warnings and errors on SGI IRIX. --- innobase/row/row0ins.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/innobase/row/row0ins.c b/innobase/row/row0ins.c index 776094d0de5..bce775c25d6 100644 --- a/innobase/row/row0ins.c +++ b/innobase/row/row0ins.c @@ -533,9 +533,11 @@ row_ins_cascade_calc_update_vec( ufield->new_val.data = mem_heap_alloc(heap, min_size); - pad_start = ufield->new_val.data + pad_start = + ((char*) ufield->new_val.data) + ufield->new_val.len; - pad_end = ufield->new_val.data + pad_end = + ((char*) ufield->new_val.data) + min_size; ufield->new_val.len = min_size; ut_memcpy(ufield->new_val.data, @@ -1578,7 +1580,6 @@ row_ins_scan_sec_index_for_duplicate( ulint err = DB_SUCCESS; ibool moved; mtr_t mtr; - trx_t* trx; mem_heap_t* heap = NULL; ulint offsets_[REC_OFFS_NORMAL_SIZE]; ulint* offsets = offsets_; @@ -1618,11 +1619,6 @@ row_ins_scan_sec_index_for_duplicate( goto next_rec; } - /* Try to place a lock on the index record */ - - trx = thr_get_trx(thr); - ut_ad(trx); - offsets = rec_get_offsets(rec, index, offsets, ULINT_UNDEFINED, &heap); From 5f3dbc8b1a395f2b8e40804d4a9daf6107bbc77b Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 22 Jun 2005 15:10:12 +0500 Subject: [PATCH 8/9] Better comment. configure.in: Post-review fix: better comment. --- configure.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.in b/configure.in index 0e53e167ed2..bed47ce279f 100644 --- a/configure.in +++ b/configure.in @@ -351,7 +351,7 @@ then # mysqld doesn't use run-time-type-checking, so we disable it. CXXFLAGS="$CXXFLAGS -fno-implicit-templates -fno-exceptions -fno-rtti" AC_DEFINE([HAVE_EXPLICIT_TEMPLATE_INSTANTIATION], - [1], [Defined by configure. Explicit template instantiation.]) + [1], [Defined by configure. Use explicit template instantiation.]) fi case $CXX_VERSION in From d608a83a4ee3507ac05e349bc0a2a4647a9af644 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 22 Jun 2005 16:29:21 +0500 Subject: [PATCH 9/9] Better AR guessing. configure.in: Move AR guessing to misc.m4. --- config/ac-macros/misc.m4 | 29 +++++++++++++++++++++++++++++ configure.in | 10 +--------- 2 files changed, 30 insertions(+), 9 deletions(-) diff --git a/config/ac-macros/misc.m4 b/config/ac-macros/misc.m4 index e3413048cf7..6f93f38f119 100644 --- a/config/ac-macros/misc.m4 +++ b/config/ac-macros/misc.m4 @@ -737,3 +737,32 @@ then fi AC_SUBST(CXX_VERSION) ]) + +AC_DEFUN([MYSQL_PROG_AR], [ +AC_REQUIRE([MYSQL_CHECK_CXX_VERSION]) +case $CXX_VERSION in + MIPSpro*) + AR=$CXX + ARFLAGS="-ar -o" + ;; + *Forte*) + AR=$CXX + ARFLAGS="-xar -o" + ;; + *) + if test -z "$AR" + then + AC_CHECK_PROG([AR], [ar], [ar]) + fi + if test -z "$AR" + then + AC_MSG_ERROR([You need ar to build the library]) + fi + if test -z "$ARFLAGS" + then + ARFLAGS="cru" + fi +esac +AC_SUBST(AR) +AC_SUBST(ARFLAGS) +]) diff --git a/configure.in b/configure.in index bed47ce279f..ae26a0c44df 100644 --- a/configure.in +++ b/configure.in @@ -354,15 +354,7 @@ then [1], [Defined by configure. Use explicit template instantiation.]) fi -case $CXX_VERSION in - MIPSpro*) - AR=$CXX - ARFLAGS="-ar -o" - ;; - *Forte*) - AR=$CXX - ARFLAGS="-xar -o" -esac +MYSQL_PROG_AR # Avoid bug in fcntl on some versions of linux AC_MSG_CHECKING("if we should use 'skip-locking' as default for $target_os")