From cba5abe650ae4d1dce5bd85a4e77beae2730bce8 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 5 May 2005 16:21:17 +0200 Subject: [PATCH] gcc 2.92 compatibility config/ac-macros/misc.m4: better USE_MYSYS_NEW detection configure.in: better USE_MYSYS_NEW detection extra/yassl/src/Makefile.am: better USE_MYSYS_NEW detection extra/yassl/taocrypt/include/runtime.hpp: better USE_MYSYS_NEW detection --- config/ac-macros/misc.m4 | 17 +++++++++++++ configure.in | 27 +------------------- extra/yassl/src/Makefile.am | 1 - extra/yassl/src/yassl_imp.cpp | 2 ++ extra/yassl/src/yassl_int.cpp | 4 ++- extra/yassl/taocrypt/include/runtime.hpp | 7 ++++-- extra/yassl/taocrypt/src/Makefile.am | 1 - extra/yassl/taocrypt/src/integer.cpp | 17 ++++++------- extra/yassl/taocrypt/src/rsa.cpp | 32 +++++++++++++----------- 9 files changed, 53 insertions(+), 55 deletions(-) diff --git a/config/ac-macros/misc.m4 b/config/ac-macros/misc.m4 index d75dedafa2a..8c961ef84e0 100644 --- a/config/ac-macros/misc.m4 +++ b/config/ac-macros/misc.m4 @@ -693,3 +693,20 @@ dnl --------------------------------------------------------------------------- dnl END OF MYSQL_CHECK_BIG_TABLES SECTION dnl --------------------------------------------------------------------------- +dnl MYSQL_NEEDS_MYSYS_NEW +AC_DEFUN([MYSQL_NEEDS_MYSYS_NEW], +[AC_CACHE_CHECK([needs mysys_new helpers], mysql_use_mysys_new, +[ +AC_LANG_PUSH(C++) +AC_TRY_LINK([], [ +class A { public: int b; }; A *a=new A; a->b=10; delete a; +], mysql_use_mysys_new=no, mysql_use_mysys_new=yes) +AC_LANG_POP(C++) +]) +if test "$mysql_use_mysys_new" = "yes" +then + AC_DEFINE([USE_MYSYS_NEW], [1], [Needs to use mysys_new helpers]) +fi +]) + + diff --git a/configure.in b/configure.in index 8b0a0ddeb56..dfed8dda43e 100644 --- a/configure.in +++ b/configure.in @@ -336,32 +336,6 @@ AC_SUBST(LD) AC_SUBST(INSTALL_SCRIPT) export CC CXX CFLAGS LD LDFLAGS AR -if test "$GXX" = "yes" -then - # mysqld requires -fno-implicit-templates. - # 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" - - CXX_VERNO=`echo $CXX_VERSION | sed -e 's/[[^0-9. ]]//g; s/^ *//g; s/ .*//g'` - case "$CXX_VERNO" in - 3.*) - USE_MYSYS_NEW="-DUSE_MYSYS_NEW" # yassl needs it - if echo $CXX | grep gcc > /dev/null 2>&1 - then - # If you are using 'gcc' 3.0 (not g++) to compile C++ programs on Linux, - # we will gets some problems when linking static programs. - # The following code is used to fix this problem. - CXXFLAGS="$CXXFLAGS $USE_MYSYS_NEW" - AC_MSG_WARN([Using MYSYS_NEW for static linking with gcc]) - fi - ;; - *) - USE_MYSYS_NEW="" - ;; - esac - AC_SUBST(USE_MYSYS_NEW) -fi # Avoid bug in fcntl on some versions of linux AC_MSG_CHECKING("if we should use 'skip-locking' as default for $target_os") @@ -1730,6 +1704,7 @@ AC_TYPE_OFF_T AC_STRUCT_ST_RDEV AC_HEADER_TIME AC_STRUCT_TM +MYSQL_NEEDS_MYSYS_NEW # AC_CHECK_SIZEOF return 0 when it does not find the size of a # type. We want a error instead. AC_CHECK_SIZEOF(char, 1) diff --git a/extra/yassl/src/Makefile.am b/extra/yassl/src/Makefile.am index 9dd8a09b00b..3dbd7bac03a 100644 --- a/extra/yassl/src/Makefile.am +++ b/extra/yassl/src/Makefile.am @@ -5,4 +5,3 @@ libyassl_a_SOURCES = buffer.cpp cert_wrapper.cpp crypto_wrapper.cpp \ handshake.cpp lock.cpp log.cpp socket_wrapper.cpp ssl.cpp \ timer.cpp yassl_imp.cpp yassl_error.cpp yassl_int.cpp EXTRA_DIST = ../include/*.hpp ../include/openssl/*.h -AM_CXXFLAGS=@USE_MYSYS_NEW@ diff --git a/extra/yassl/src/yassl_imp.cpp b/extra/yassl/src/yassl_imp.cpp index ba2fbd8cc07..c1485cce986 100644 --- a/extra/yassl/src/yassl_imp.cpp +++ b/extra/yassl/src/yassl_imp.cpp @@ -2092,6 +2092,7 @@ void InitClientKeyFactory(ClientKeyFactory& ckf) } // namespace #ifdef __GNUC__ +namespace mySTL { template class mySTL::list; template yaSSL::del_ptr_zero mySTL::for_each(mySTL::list::iterator, mySTL::list::iterator, yaSSL::del_ptr_zero); template mySTL::pair* mySTL::uninit_copy*, mySTL::pair*>(mySTL::pair*, mySTL::pair*, mySTL::pair*); @@ -2112,5 +2113,6 @@ template yaSSL::del_ptr_zero mySTL::for_each::i template yaSSL::del_ptr_zero mySTL::for_each::iterator, yaSSL::del_ptr_zero>(mySTL::list::iterator, mySTL::list::iterator, yaSSL::del_ptr_zero); template yaSSL::del_ptr_zero mySTL::for_each::iterator, yaSSL::del_ptr_zero>(mySTL::list::iterator, mySTL::list::iterator, yaSSL::del_ptr_zero); template yaSSL::del_ptr_zero mySTL::for_each::iterator, yaSSL::del_ptr_zero>(mySTL::list::iterator, mySTL::list::iterator, yaSSL::del_ptr_zero); +} #endif diff --git a/extra/yassl/src/yassl_int.cpp b/extra/yassl/src/yassl_int.cpp index 5f918b0a356..4cc2b85fccc 100644 --- a/extra/yassl/src/yassl_int.cpp +++ b/extra/yassl/src/yassl_int.cpp @@ -1951,7 +1951,7 @@ char* X509_NAME::GetName() X509::X509(const char* i, size_t iSz, const char* s, size_t sSz) : issuer_(i, iSz), subject_(s, sSz) {} - + X509_NAME* X509::GetIssuer() { @@ -1967,7 +1967,9 @@ X509_NAME* X509::GetSubject() } // namespace #ifdef __GNUC__ +namespace mySTL { template yaSSL::yassl_int_cpp_local1::SumData mySTL::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 mySTL::for_each::iterator, yaSSL::yassl_int_cpp_local1::SumBuffer>(mySTL::list::iterator, mySTL::list::iterator, yaSSL::yassl_int_cpp_local1::SumBuffer); template mySTL::list::iterator mySTL::find_if::iterator, yaSSL::yassl_int_cpp_local2::sess_match>(mySTL::list::iterator, mySTL::list::iterator, yaSSL::yassl_int_cpp_local2::sess_match); +} #endif diff --git a/extra/yassl/taocrypt/include/runtime.hpp b/extra/yassl/taocrypt/include/runtime.hpp index 5b9e13df644..e2c04af44f4 100644 --- a/extra/yassl/taocrypt/include/runtime.hpp +++ b/extra/yassl/taocrypt/include/runtime.hpp @@ -25,10 +25,11 @@ -#if !defined(yaSSL_NEW_HPP) && defined(USE_MYSYS_NEW) +#if !defined(yaSSL_NEW_HPP) && defined(__GNUC__) #define yaSSL_NEW_HPP +#if __GNUC__ > 2 #include @@ -66,4 +67,6 @@ static int __cxa_pure_virtual() } // extern "C" -#endif // yaSSL_NEW_HPP +#endif // __GNUC__ > 2 +#endif // yaSSL_NEW_HPP && __GNUC__ + diff --git a/extra/yassl/taocrypt/src/Makefile.am b/extra/yassl/taocrypt/src/Makefile.am index 4bf901b76ea..b00e6081c23 100644 --- a/extra/yassl/taocrypt/src/Makefile.am +++ b/extra/yassl/taocrypt/src/Makefile.am @@ -5,4 +5,3 @@ libtaocrypt_a_SOURCES = aes.cpp aestables.cpp algebra.cpp arc4.cpp asn.cpp \ coding.cpp dh.cpp des.cpp dsa.cpp file.cpp hash.cpp integer.cpp \ md2.cpp md5.cpp misc.cpp random.cpp ripemd.cpp rsa.cpp sha.cpp EXTRA_DIST = ../include/*.hpp -AM_CXXFLAGS=@USE_MYSYS_NEW@ diff --git a/extra/yassl/taocrypt/src/integer.cpp b/extra/yassl/taocrypt/src/integer.cpp index 20a968d78e3..c95170722ae 100644 --- a/extra/yassl/taocrypt/src/integer.cpp +++ b/extra/yassl/taocrypt/src/integer.cpp @@ -4168,16 +4168,13 @@ Integer CRT(const Integer &xp, const Integer &p, const Integer &xq, return p * (u * (xq-xp) % q) + xp; } - +#ifdef __GNUC__ +template Integer StringToInteger(char const*); +template Integer StringToInteger(wchar_t const*); +template class EuclideanDomainOf; +template class AbstractEuclideanDomain; +template unsigned int DivideThreeWordsByTwo(unsigned int*, unsigned int, unsigned int, DWord*); +#endif } // namespace -#ifdef __GNUC__ -template TaoCrypt::Integer TaoCrypt::StringToInteger(char const*); -template TaoCrypt::Integer TaoCrypt::StringToInteger(wchar_t const*); -template class TaoCrypt::EuclideanDomainOf; -template class TaoCrypt::AbstractEuclideanDomain; -template unsigned int TaoCrypt::DivideThreeWordsByTwo(unsigned int*, unsigned int, unsigned int, TaoCrypt::DWord*); -#endif - - diff --git a/extra/yassl/taocrypt/src/rsa.cpp b/extra/yassl/taocrypt/src/rsa.cpp index da8cd697a7c..ecb2288f1c2 100644 --- a/extra/yassl/taocrypt/src/rsa.cpp +++ b/extra/yassl/taocrypt/src/rsa.cpp @@ -211,24 +211,28 @@ word32 SSL_Decrypt(const RSA_PublicKey& key, const byte* sig, byte* plain) lengths.PaddedBlockBitLength(), plain); } +#ifdef __GNUC__ +template AllocatorWithCleanup::pointer StdReallocate >(AllocatorWithCleanup&, unsigned char*, AllocatorWithCleanup::size_type, AllocatorWithCleanup::size_type, bool); +template AllocatorWithCleanup::pointer StdReallocate >(AllocatorWithCleanup&, unsigned int*, AllocatorWithCleanup::size_type, AllocatorWithCleanup::size_type, bool); +template class AbstractGroup; +template class AbstractRing; +template class RSA_Decryptor; +template class RSA_Encryptor; +template class RSA_Encryptor; +#endif } // namespace #ifdef __GNUC__ -template TaoCrypt::AllocatorWithCleanup::pointer TaoCrypt::StdReallocate >(TaoCrypt::AllocatorWithCleanup&, unsigned char*, TaoCrypt::AllocatorWithCleanup::size_type, TaoCrypt::AllocatorWithCleanup::size_type, bool); -template TaoCrypt::AllocatorWithCleanup::pointer TaoCrypt::StdReallocate >(TaoCrypt::AllocatorWithCleanup&, unsigned int*, TaoCrypt::AllocatorWithCleanup::size_type, TaoCrypt::AllocatorWithCleanup::size_type, bool); -template TaoCrypt::Integer* mySTL::uninit_copy(TaoCrypt::Integer*, TaoCrypt::Integer*, TaoCrypt::Integer*); -template TaoCrypt::Integer* mySTL::uninit_fill_n(TaoCrypt::Integer*, unsigned int, TaoCrypt::Integer const&); -template TaoCrypt::WindowSlider* mySTL::uninit_copy(TaoCrypt::WindowSlider*, TaoCrypt::WindowSlider*, TaoCrypt::WindowSlider*); -template class TaoCrypt::AbstractGroup; -template class TaoCrypt::AbstractRing; -template class TaoCrypt::RSA_Decryptor; -template class TaoCrypt::RSA_Encryptor; -template class TaoCrypt::RSA_Encryptor; -template mySTL::vector* mySTL::uninit_fill_n*, unsigned int, mySTL::vector >(mySTL::vector*, unsigned int, mySTL::vector const&); -template void mySTL::destroy(TaoCrypt::Integer*, TaoCrypt::Integer*); -template void mySTL::destroy(TaoCrypt::WindowSlider*, TaoCrypt::WindowSlider*); -template void mySTL::destroy*>(mySTL::vector*, mySTL::vector*); +namespace mySTL { +template TaoCrypt::Integer* uninit_copy(TaoCrypt::Integer*, TaoCrypt::Integer*, TaoCrypt::Integer*); +template TaoCrypt::Integer* uninit_fill_n(TaoCrypt::Integer*, unsigned int, TaoCrypt::Integer const&); +template TaoCrypt::WindowSlider* uninit_copy(TaoCrypt::WindowSlider*, TaoCrypt::WindowSlider*, TaoCrypt::WindowSlider*); +template vector* uninit_fill_n*, unsigned int, vector >(vector*, unsigned int, vector const&); +template void destroy(TaoCrypt::Integer*, TaoCrypt::Integer*); +template void destroy(TaoCrypt::WindowSlider*, TaoCrypt::WindowSlider*); +template void destroy*>(vector*, vector*); +} #endif