2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-09-03 07:25:18 +00:00

more fixes, mostly for sunstudio:

- removed all #include <config.h> from nsas .h files (and moved them to .cc files)
- added the (hopefully temporary) workaround for boost/sunstudio (a check in configure.ac, and the redefinition of __SUNPRO_CC in the header files that include boost/thread.hpp)
- changed AC_COMPILE_IFELSE to AC_LINK_IFELSE to the compiler flags check functi
on (some flags will not fail until it gets to ld)
- changed a wrong ) in zone_entry_unittest
- changed nsas_entry_unittests so the hashkey string value would not fall out of scope
(diff checked by jreed)


git-svn-id: svn://bind10.isc.org/svn/bind10/trunk@3887 e5f2f494-b856-4b98-b285-d166d9295462
This commit is contained in:
Jelte Jansen
2010-12-20 15:08:19 +00:00
parent fd5a756404
commit 88441f682d
25 changed files with 118 additions and 15 deletions

View File

@@ -202,7 +202,7 @@ AC_DEFUN([BIND10_CXX_TRY_FLAG], [
bind10_save_CXXFLAGS="$CXXFLAGS" bind10_save_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS $1" 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" CXXFLAGS="$bind10_save_CXXFLAGS"
if test "x$bind10_cxx_flag" = "xyes"; then if test "x$bind10_cxx_flag" = "xyes"; then
@@ -367,13 +367,31 @@ CPPFLAGS_SAVES="$CPPFLAGS"
LIBS_SAVES="$LIBS" LIBS_SAVES="$LIBS"
CPPFLAGS="$BOOST_INCLUDES $CPPFLAGS $MULTITHREADING_FLAG" CPPFLAGS="$BOOST_INCLUDES $CPPFLAGS $MULTITHREADING_FLAG"
need_libboost_thread=0 need_libboost_thread=0
need_sunpro_workaround=0
AC_TRY_LINK([ AC_TRY_LINK([
#include <boost/thread.hpp> #include <boost/thread.hpp>
],[ ],[
boost::mutex m; boost::mutex m;
], ],
[ AC_MSG_RESULT(yes (without libboost_thread)) ], [ 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/thread.hpp>
],[
boost::mutex m;
],
[ AC_MSG_RESULT(yes (with SUNOS workaround))
need_sunpro_workaround=1 ],
[ LIBS=" $LIBS -lboost_thread"
AC_TRY_LINK([ AC_TRY_LINK([
#include <boost/thread.hpp> #include <boost/thread.hpp>
],[ ],[
@@ -385,10 +403,13 @@ boost::mutex m;
AC_MSG_ERROR([boost::mutex cannot be linked in this build environment. 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. 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.]) You may want to check the availability of the library or to upgrade Boost.])
])]) ])])])
CPPFLAGS="$CPPFLAGS_SAVES" CPPFLAGS="$CPPFLAGS_SAVES"
LIBS="$LIBS_SAVES" LIBS="$LIBS_SAVES"
AM_CONDITIONAL(NEED_LIBBOOST_THREAD, test $need_libboost_thread = 1) 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. # Check availability of gtest, which will be used for unit tests.

View File

@@ -35,6 +35,8 @@
#define __STDC_LIMIT_MACROS #define __STDC_LIMIT_MACROS
#include <stdint.h> #include <stdint.h>
#include <config.h>
#include "address_entry.h" #include "address_entry.h"
namespace isc { namespace isc {

View File

@@ -21,7 +21,6 @@
#include <stdint.h> #include <stdint.h>
#include <string> #include <string>
#include <config.h>
namespace isc { namespace isc {
namespace nsas { namespace nsas {

View File

@@ -17,6 +17,18 @@
#ifndef __HASH_TABLE_H #ifndef __HASH_TABLE_H
#define __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 <boost/shared_ptr.hpp> #include <boost/shared_ptr.hpp>
#include <boost/thread.hpp> #include <boost/thread.hpp>
#include <boost/interprocess/sync/sharable_lock.hpp> #include <boost/interprocess/sync/sharable_lock.hpp>
@@ -24,8 +36,6 @@
#include <boost/interprocess/sync/interprocess_upgradable_mutex.hpp> #include <boost/interprocess/sync/interprocess_upgradable_mutex.hpp>
#include <list> #include <list>
#include <config.h>
#include "hash.h" #include "hash.h"
#include "hash_key.h" #include "hash_key.h"

View File

@@ -20,13 +20,23 @@
#include <list> #include <list>
#include <string> #include <string>
// 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 <boost/noncopyable.hpp> #include <boost/noncopyable.hpp>
#include <boost/shared_ptr.hpp> #include <boost/shared_ptr.hpp>
#include <boost/thread.hpp> #include <boost/thread.hpp>
#include <boost/interprocess/sync/scoped_lock.hpp> #include <boost/interprocess/sync/scoped_lock.hpp>
#include <config.h>
namespace isc { namespace isc {
namespace nsas { namespace nsas {

View File

@@ -14,6 +14,8 @@
// $id$ // $id$
#include <config.h>
#include "nameserver_address.h" #include "nameserver_address.h"
#include "nameserver_entry.h" #include "nameserver_entry.h"

View File

@@ -14,6 +14,21 @@
// $Id$ // $Id$
#include <config.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 <boost/thread.hpp> #include <boost/thread.hpp>
#include <boost/shared_ptr.hpp> #include <boost/shared_ptr.hpp>
#include <boost/foreach.hpp> #include <boost/foreach.hpp>

View File

@@ -14,6 +14,8 @@
// $Id$ // $Id$
#include <config.h>
#include <algorithm> #include <algorithm>
#include <functional> #include <functional>
#include <cassert> #include <cassert>

View File

@@ -17,6 +17,18 @@
#ifndef __NAMESERVER_ENTRY_H #ifndef __NAMESERVER_ENTRY_H
#define __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 <string> #include <string>
#include <vector> #include <vector>
#include <boost/thread.hpp> #include <boost/thread.hpp>

View File

@@ -13,6 +13,7 @@
// PERFORMANCE OF THIS SOFTWARE. // PERFORMANCE OF THIS SOFTWARE.
// $Id$ // $Id$
#include <config.h>
#include <limits.h> #include <limits.h>
#include <gtest/gtest.h> #include <gtest/gtest.h>

View File

@@ -13,6 +13,7 @@
// PERFORMANCE OF THIS SOFTWARE. // PERFORMANCE OF THIS SOFTWARE.
// $id$ // $id$
#include <config.h>
#include "../fetchable.h" #include "../fetchable.h"

View File

@@ -13,6 +13,7 @@
// PERFORMANCE OF THIS SOFTWARE. // PERFORMANCE OF THIS SOFTWARE.
// $Id$ // $Id$
#include <config.h>
#include <algorithm> #include <algorithm>
#include <string> #include <string>

View File

@@ -13,6 +13,7 @@
// PERFORMANCE OF THIS SOFTWARE. // PERFORMANCE OF THIS SOFTWARE.
// $Id$ // $Id$
#include <config.h>
#include <algorithm> #include <algorithm>
#include <string> #include <string>

View File

@@ -13,6 +13,7 @@
// PERFORMANCE OF THIS SOFTWARE. // PERFORMANCE OF THIS SOFTWARE.
// $Id$ // $Id$
#include <config.h>
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <boost/shared_ptr.hpp> #include <boost/shared_ptr.hpp>

View File

@@ -13,6 +13,7 @@
// PERFORMANCE OF THIS SOFTWARE. // PERFORMANCE OF THIS SOFTWARE.
// $Id$ // $Id$
#include <config.h>
#include <algorithm> #include <algorithm>
#include <string> #include <string>

View File

@@ -13,6 +13,7 @@
// PERFORMANCE OF THIS SOFTWARE. // PERFORMANCE OF THIS SOFTWARE.
// $Id$ // $Id$
#include <config.h>
#include <iostream> #include <iostream>
#include <algorithm> #include <algorithm>

View File

@@ -13,6 +13,7 @@
// PERFORMANCE OF THIS SOFTWARE. // PERFORMANCE OF THIS SOFTWARE.
// $Id$ // $Id$
#include <config.h>
/// \brief Test Deleter Objects /// \brief Test Deleter Objects
/// ///

View File

@@ -13,6 +13,7 @@
// PERFORMANCE OF THIS SOFTWARE. // PERFORMANCE OF THIS SOFTWARE.
// $Id$ // $Id$
#include <config.h>
#include <gtest/gtest.h> #include <gtest/gtest.h>

View File

@@ -13,6 +13,7 @@
// PERFORMANCE OF THIS SOFTWARE. // PERFORMANCE OF THIS SOFTWARE.
// $Id$ // $Id$
#include <config.h>
#include <iostream> #include <iostream>
#include <algorithm> #include <algorithm>

View File

@@ -13,6 +13,7 @@
// PERFORMANCE OF THIS SOFTWARE. // PERFORMANCE OF THIS SOFTWARE.
// $Id$ // $Id$
#include <config.h>
#include <algorithm> #include <algorithm>
#include <string> #include <string>
@@ -37,16 +38,18 @@ class NsasEntryCompareTest : public ::testing::Test {
// Test of the comparison // Test of the comparison
TEST_F(NsasEntryCompareTest, Compare) { TEST_F(NsasEntryCompareTest, Compare) {
std::string name1("test1");
std::string name2("test2");
// Construct a couple of different objects // Construct a couple of different objects
TestEntry entry1("test1", RRClass(42)); TestEntry entry1(name1, RRClass(42));
TestEntry entry2("test1", RRClass(24)); TestEntry entry2(name1, RRClass(24));
TestEntry entry3("test2", RRClass(42)); TestEntry entry3(name2, RRClass(42));
// Create corresponding hash key objects // Create corresponding hash key objects
HashKey key1(entry1.getName(), entry1.getClass()); HashKey key1(name1, entry1.getClass());
HashKey key2(entry2.getName(), entry2.getClass()); HashKey key2(name1, entry2.getClass());
HashKey key3(entry3.getName(), entry3.getClass()); HashKey key3(name2, entry3.getClass());
// Perform the comparison // Perform the comparison
NsasEntryCompare<TestEntry> compare; NsasEntryCompare<TestEntry> compare;

View File

@@ -13,6 +13,7 @@
// PERFORMANCE OF THIS SOFTWARE. // PERFORMANCE OF THIS SOFTWARE.
// $Id$ // $Id$
#include <config.h>
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <boost/shared_ptr.hpp> #include <boost/shared_ptr.hpp>

View File

@@ -13,6 +13,7 @@
// PERFORMANCE OF THIS SOFTWARE. // PERFORMANCE OF THIS SOFTWARE.
// $Id: run_unittests.cc 3020 2010-09-26 03:47:26Z jinmei $ // $Id: run_unittests.cc 3020 2010-09-26 03:47:26Z jinmei $
#include <config.h>
#include <gtest/gtest.h> #include <gtest/gtest.h>

View File

@@ -13,6 +13,7 @@
// PERFORMANCE OF THIS SOFTWARE. // PERFORMANCE OF THIS SOFTWARE.
// $Id$ // $Id$
#include <config.h>
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <boost/shared_ptr.hpp> #include <boost/shared_ptr.hpp>
@@ -711,7 +712,7 @@ TEST_F(ZoneEntryTest, AddressSelection) {
for (size_t i(0); i < 3; ++ i) { for (size_t i(0); i < 3; ++ i) {
double mu = repeats * ps[i]; double mu = repeats * ps[i];
double sigma = sqrt(repeats * ps[i] * (1 - 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 // reset the environment

View File

@@ -14,6 +14,8 @@
// $id$ // $id$
#include <config.h>
#include "zone_entry.h" #include "zone_entry.h"
#include "address_request_callback.h" #include "address_request_callback.h"
#include "nameserver_entry.h" #include "nameserver_entry.h"

View File

@@ -17,6 +17,18 @@
#ifndef __ZONE_ENTRY_H #ifndef __ZONE_ENTRY_H
#define __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 <string> #include <string>
#include <vector> #include <vector>
#include <set> #include <set>