diff --git a/configure.ac b/configure.ac index c37eda0ea7..9a51c83af7 100644 --- a/configure.ac +++ b/configure.ac @@ -202,7 +202,7 @@ AC_DEFUN([BIND10_CXX_TRY_FLAG], [ bind10_save_CXXFLAGS="$CXXFLAGS" CXXFLAGS="$CXXFLAGS $1" - AC_COMPILE_IFELSE([ ], [bind10_cxx_flag=yes], [bind10_cxx_flag=no]) + AC_LINK_IFELSE([ ], [bind10_cxx_flag=yes], [bind10_cxx_flag=no]) CXXFLAGS="$bind10_save_CXXFLAGS" if test "x$bind10_cxx_flag" = "xyes"; then @@ -367,13 +367,31 @@ CPPFLAGS_SAVES="$CPPFLAGS" LIBS_SAVES="$LIBS" CPPFLAGS="$BOOST_INCLUDES $CPPFLAGS $MULTITHREADING_FLAG" need_libboost_thread=0 +need_sunpro_workaround=0 AC_TRY_LINK([ #include ],[ boost::mutex m; ], [ AC_MSG_RESULT(yes (without libboost_thread)) ], - [ LIBS=" $LIBS -lboost_thread" + + # there is one specific problem with SunStudio 5.10 + # where including boost/thread causes a compilation failure + # There is a workaround in boost but it checks the version not being 5.10 + # This will probably be fixed in the future, in which case this + # is only a temporary workaround + [ AC_TRY_LINK([ +#if defined(__SUNPRO_CC) && __SUNPRO_CC == 0x5100 +#undef __SUNPRO_CC +#define __SUNPRO_CC 0x5090 +#endif +#include +],[ +boost::mutex m; +], + [ AC_MSG_RESULT(yes (with SUNOS workaround)) + need_sunpro_workaround=1 ], + [ LIBS=" $LIBS -lboost_thread" AC_TRY_LINK([ #include ],[ @@ -385,10 +403,13 @@ boost::mutex m; AC_MSG_ERROR([boost::mutex cannot be linked in this build environment. Perhaps you are using an older version of Boost that requires libboost_thread for the mutex support, which does not appear to be available. You may want to check the availability of the library or to upgrade Boost.]) - ])]) + ])])]) CPPFLAGS="$CPPFLAGS_SAVES" LIBS="$LIBS_SAVES" AM_CONDITIONAL(NEED_LIBBOOST_THREAD, test $need_libboost_thread = 1) +if test $need_sunpro_workaround = 1; then + AC_DEFINE([NEED_SUNPRO_WORKAROUND], [], [Need boost sunstudio workaround]) +fi # # Check availability of gtest, which will be used for unit tests. diff --git a/src/lib/nsas/address_entry.cc b/src/lib/nsas/address_entry.cc index 3449f9f8ef..04b17479c6 100644 --- a/src/lib/nsas/address_entry.cc +++ b/src/lib/nsas/address_entry.cc @@ -35,6 +35,8 @@ #define __STDC_LIMIT_MACROS #include +#include + #include "address_entry.h" namespace isc { diff --git a/src/lib/nsas/hash_key.h b/src/lib/nsas/hash_key.h index 1b84659472..a8e5d1d709 100644 --- a/src/lib/nsas/hash_key.h +++ b/src/lib/nsas/hash_key.h @@ -21,7 +21,6 @@ #include #include -#include namespace isc { namespace nsas { diff --git a/src/lib/nsas/hash_table.h b/src/lib/nsas/hash_table.h index d72665ce24..f415140f9a 100644 --- a/src/lib/nsas/hash_table.h +++ b/src/lib/nsas/hash_table.h @@ -17,6 +17,18 @@ #ifndef __HASH_TABLE_H #define __HASH_TABLE_H +// Workaround for a problem with boost and sunstudio 5.10 +// There is a version check in there that appears wrong, +// which makes including boost/thread.hpp fail +// This will probably be fixed in a future version of boost, +// in which case this part can be removed then +#ifdef NEED_SUNPRO_WORKAROUND +#if defined(__SUNPRO_CC) && __SUNPRO_CC == 0x5100 +#undef __SUNPRO_CC +#define __SUNPRO_CC 0x5090 +#endif +#endif // NEED_SUNPRO_WORKAROUND + #include #include #include @@ -24,8 +36,6 @@ #include #include -#include - #include "hash.h" #include "hash_key.h" diff --git a/src/lib/nsas/lru_list.h b/src/lib/nsas/lru_list.h index ad67927bdd..53875bfab9 100644 --- a/src/lib/nsas/lru_list.h +++ b/src/lib/nsas/lru_list.h @@ -20,13 +20,23 @@ #include #include +// Workaround for a problem with boost and sunstudio 5.10 +// There is a version check in there that appears wrong, +// which makes including boost/thread.hpp fail +// This will probably be fixed in a future version of boost, +// in which case this part can be removed then +#ifdef NEED_SUNPRO_WORKAROUND +#if defined(__SUNPRO_CC) && __SUNPRO_CC == 0x5100 +#undef __SUNPRO_CC +#define __SUNPRO_CC 0x5090 +#endif +#endif // NEED_SUNPRO_WORKAROUND + #include #include #include #include -#include - namespace isc { namespace nsas { diff --git a/src/lib/nsas/nameserver_address.cc b/src/lib/nsas/nameserver_address.cc index 5bb02c0e85..9f5f1fad09 100644 --- a/src/lib/nsas/nameserver_address.cc +++ b/src/lib/nsas/nameserver_address.cc @@ -14,6 +14,8 @@ // $id$ +#include + #include "nameserver_address.h" #include "nameserver_entry.h" diff --git a/src/lib/nsas/nameserver_address_store.cc b/src/lib/nsas/nameserver_address_store.cc index d3c42746cd..b7482f5d63 100644 --- a/src/lib/nsas/nameserver_address_store.cc +++ b/src/lib/nsas/nameserver_address_store.cc @@ -14,6 +14,21 @@ // $Id$ +#include + +// Workaround for a problem with boost and sunstudio 5.10 +// There is a version check in there that appears wrong, +// which makes including boost/thread.hpp fail +// This will probably be fixed in a future version of boost, +// in which case this part can be removed then +#ifdef NEED_SUNPRO_WORKAROUND +#if defined(__SUNPRO_CC) && __SUNPRO_CC == 0x5100 +#undef __SUNPRO_CC +#define __SUNPRO_CC 0x5090 +#endif +#endif // NEED_SUNPRO_WORKAROUND + + #include #include #include diff --git a/src/lib/nsas/nameserver_entry.cc b/src/lib/nsas/nameserver_entry.cc index f2ea3b4f0b..528962315d 100644 --- a/src/lib/nsas/nameserver_entry.cc +++ b/src/lib/nsas/nameserver_entry.cc @@ -14,6 +14,8 @@ // $Id$ +#include + #include #include #include diff --git a/src/lib/nsas/nameserver_entry.h b/src/lib/nsas/nameserver_entry.h index 223aca859e..f3ee1cacf3 100644 --- a/src/lib/nsas/nameserver_entry.h +++ b/src/lib/nsas/nameserver_entry.h @@ -17,6 +17,18 @@ #ifndef __NAMESERVER_ENTRY_H #define __NAMESERVER_ENTRY_H +// Workaround for a problem with boost and sunstudio 5.10 +// There is a version check in there that appears wrong, +// which makes including boost/thread.hpp fail +// This will probably be fixed in a future version of boost, +// in which case this part can be removed then +#ifdef NEED_SUNPRO_WORKAROUND +#if defined(__SUNPRO_CC) && __SUNPRO_CC == 0x5100 +#undef __SUNPRO_CC +#define __SUNPRO_CC 0x5090 +#endif +#endif // NEED_SUNPRO_WORKAROUND + #include #include #include diff --git a/src/lib/nsas/tests/address_entry_unittest.cc b/src/lib/nsas/tests/address_entry_unittest.cc index 7947dbcf75..62ae383e28 100644 --- a/src/lib/nsas/tests/address_entry_unittest.cc +++ b/src/lib/nsas/tests/address_entry_unittest.cc @@ -13,6 +13,7 @@ // PERFORMANCE OF THIS SOFTWARE. // $Id$ +#include #include #include diff --git a/src/lib/nsas/tests/fetchable_unittest.cc b/src/lib/nsas/tests/fetchable_unittest.cc index 88b55869a6..90bfa7b6ef 100644 --- a/src/lib/nsas/tests/fetchable_unittest.cc +++ b/src/lib/nsas/tests/fetchable_unittest.cc @@ -13,6 +13,7 @@ // PERFORMANCE OF THIS SOFTWARE. // $id$ +#include #include "../fetchable.h" diff --git a/src/lib/nsas/tests/hash_deleter_unittest.cc b/src/lib/nsas/tests/hash_deleter_unittest.cc index 0d5d1f512c..7f7373c222 100644 --- a/src/lib/nsas/tests/hash_deleter_unittest.cc +++ b/src/lib/nsas/tests/hash_deleter_unittest.cc @@ -13,6 +13,7 @@ // PERFORMANCE OF THIS SOFTWARE. // $Id$ +#include #include #include diff --git a/src/lib/nsas/tests/hash_key_unittest.cc b/src/lib/nsas/tests/hash_key_unittest.cc index 80013e3e55..884db42b0a 100644 --- a/src/lib/nsas/tests/hash_key_unittest.cc +++ b/src/lib/nsas/tests/hash_key_unittest.cc @@ -13,6 +13,7 @@ // PERFORMANCE OF THIS SOFTWARE. // $Id$ +#include #include #include diff --git a/src/lib/nsas/tests/hash_table_unittest.cc b/src/lib/nsas/tests/hash_table_unittest.cc index caec2dcef8..c92adc4463 100644 --- a/src/lib/nsas/tests/hash_table_unittest.cc +++ b/src/lib/nsas/tests/hash_table_unittest.cc @@ -13,6 +13,7 @@ // PERFORMANCE OF THIS SOFTWARE. // $Id$ +#include #include #include diff --git a/src/lib/nsas/tests/hash_unittest.cc b/src/lib/nsas/tests/hash_unittest.cc index fc914faba1..a2d3adedc9 100644 --- a/src/lib/nsas/tests/hash_unittest.cc +++ b/src/lib/nsas/tests/hash_unittest.cc @@ -13,6 +13,7 @@ // PERFORMANCE OF THIS SOFTWARE. // $Id$ +#include #include #include diff --git a/src/lib/nsas/tests/lru_list_unittest.cc b/src/lib/nsas/tests/lru_list_unittest.cc index 1efae54814..0a062a2499 100644 --- a/src/lib/nsas/tests/lru_list_unittest.cc +++ b/src/lib/nsas/tests/lru_list_unittest.cc @@ -13,6 +13,7 @@ // PERFORMANCE OF THIS SOFTWARE. // $Id$ +#include #include #include diff --git a/src/lib/nsas/tests/nameserver_address_store_unittest.cc b/src/lib/nsas/tests/nameserver_address_store_unittest.cc index ee2c7e6cec..fde55d2d4c 100644 --- a/src/lib/nsas/tests/nameserver_address_store_unittest.cc +++ b/src/lib/nsas/tests/nameserver_address_store_unittest.cc @@ -13,6 +13,7 @@ // PERFORMANCE OF THIS SOFTWARE. // $Id$ +#include /// \brief Test Deleter Objects /// diff --git a/src/lib/nsas/tests/nameserver_address_unittest.cc b/src/lib/nsas/tests/nameserver_address_unittest.cc index bec668194a..516d785f5f 100644 --- a/src/lib/nsas/tests/nameserver_address_unittest.cc +++ b/src/lib/nsas/tests/nameserver_address_unittest.cc @@ -13,6 +13,7 @@ // PERFORMANCE OF THIS SOFTWARE. // $Id$ +#include #include diff --git a/src/lib/nsas/tests/nameserver_entry_unittest.cc b/src/lib/nsas/tests/nameserver_entry_unittest.cc index d2eec18cc1..6e1213e534 100644 --- a/src/lib/nsas/tests/nameserver_entry_unittest.cc +++ b/src/lib/nsas/tests/nameserver_entry_unittest.cc @@ -13,6 +13,7 @@ // PERFORMANCE OF THIS SOFTWARE. // $Id$ +#include #include #include diff --git a/src/lib/nsas/tests/nsas_entry_compare_unittest.cc b/src/lib/nsas/tests/nsas_entry_compare_unittest.cc index 837d0c54dd..e95411f8db 100644 --- a/src/lib/nsas/tests/nsas_entry_compare_unittest.cc +++ b/src/lib/nsas/tests/nsas_entry_compare_unittest.cc @@ -13,6 +13,7 @@ // PERFORMANCE OF THIS SOFTWARE. // $Id$ +#include #include #include @@ -37,16 +38,18 @@ class NsasEntryCompareTest : public ::testing::Test { // Test of the comparison TEST_F(NsasEntryCompareTest, Compare) { + std::string name1("test1"); + std::string name2("test2"); // Construct a couple of different objects - TestEntry entry1("test1", RRClass(42)); - TestEntry entry2("test1", RRClass(24)); - TestEntry entry3("test2", RRClass(42)); + TestEntry entry1(name1, RRClass(42)); + TestEntry entry2(name1, RRClass(24)); + TestEntry entry3(name2, RRClass(42)); // Create corresponding hash key objects - HashKey key1(entry1.getName(), entry1.getClass()); - HashKey key2(entry2.getName(), entry2.getClass()); - HashKey key3(entry3.getName(), entry3.getClass()); + HashKey key1(name1, entry1.getClass()); + HashKey key2(name1, entry2.getClass()); + HashKey key3(name2, entry3.getClass()); // Perform the comparison NsasEntryCompare compare; diff --git a/src/lib/nsas/tests/random_number_generator_unittest.cc b/src/lib/nsas/tests/random_number_generator_unittest.cc index aec4feac2e..6bb5773c27 100644 --- a/src/lib/nsas/tests/random_number_generator_unittest.cc +++ b/src/lib/nsas/tests/random_number_generator_unittest.cc @@ -13,6 +13,7 @@ // PERFORMANCE OF THIS SOFTWARE. // $Id$ +#include #include #include diff --git a/src/lib/nsas/tests/run_unittests.cc b/src/lib/nsas/tests/run_unittests.cc index c8e9189589..52f3e13789 100644 --- a/src/lib/nsas/tests/run_unittests.cc +++ b/src/lib/nsas/tests/run_unittests.cc @@ -13,6 +13,7 @@ // PERFORMANCE OF THIS SOFTWARE. // $Id: run_unittests.cc 3020 2010-09-26 03:47:26Z jinmei $ +#include #include diff --git a/src/lib/nsas/tests/zone_entry_unittest.cc b/src/lib/nsas/tests/zone_entry_unittest.cc index 8de50ce808..0fe5f34d4c 100644 --- a/src/lib/nsas/tests/zone_entry_unittest.cc +++ b/src/lib/nsas/tests/zone_entry_unittest.cc @@ -13,6 +13,7 @@ // PERFORMANCE OF THIS SOFTWARE. // $Id$ +#include #include #include @@ -711,7 +712,7 @@ TEST_F(ZoneEntryTest, AddressSelection) { for (size_t i(0); i < 3; ++ i) { double mu = repeats * ps[i]; double sigma = sqrt(repeats * ps[i] * (1 - ps[i])); - ASSERT_TRUE(fabs(counts[i] - mu < 4 * sigma)); + ASSERT_TRUE(fabs(counts[i] - mu) < 4 * sigma); } // reset the environment diff --git a/src/lib/nsas/zone_entry.cc b/src/lib/nsas/zone_entry.cc index 370f5e9b89..718dc2225f 100644 --- a/src/lib/nsas/zone_entry.cc +++ b/src/lib/nsas/zone_entry.cc @@ -14,6 +14,8 @@ // $id$ +#include + #include "zone_entry.h" #include "address_request_callback.h" #include "nameserver_entry.h" diff --git a/src/lib/nsas/zone_entry.h b/src/lib/nsas/zone_entry.h index 82eadf6fbe..758f2c9e69 100644 --- a/src/lib/nsas/zone_entry.h +++ b/src/lib/nsas/zone_entry.h @@ -17,6 +17,18 @@ #ifndef __ZONE_ENTRY_H #define __ZONE_ENTRY_H +// Workaround for a problem with boost and sunstudio 5.10 +// There is a version check in there that appears wrong, +// which makes including boost/thread.hpp fail +// This will probably be fixed in a future version of boost, +// in which case this part can be removed then +#ifdef NEED_SUNPRO_WORKAROUND +#if defined(__SUNPRO_CC) && __SUNPRO_CC == 0x5100 +#undef __SUNPRO_CC +#define __SUNPRO_CC 0x5090 +#endif +#endif // NEED_SUNPRO_WORKAROUND + #include #include #include