diff --git a/configure.ac b/configure.ac index 956c3872dd..066dcb257f 100644 --- a/configure.ac +++ b/configure.ac @@ -884,6 +884,17 @@ if test "$BOOST_NUMERIC_CAST_WOULDFAIL" = "yes" -a X"$werror_ok" = X1 -a $CLANGP AC_MSG_ERROR([Failed to compile a required header file. If you are using FreeBSD and Boost installed via ports, retry with specifying --without-werror. See the ChangeLog entry for Trac no. 1991 for more details.]) fi +use_shared_memory=yes +AC_ARG_WITH(shared-memory, + AC_HELP_STRING([--with-shared-memory], + [Build with Boost shared memory support; for large scale authoritative DNS servers]), + [use_shared_memory=$withval]) +if test X$use_shared_memory = Xyes -a "$BOOST_MAPPED_FILE_WOULDFAIL" = "yes"; then + AC_MSG_ERROR([Boost shared memory does not compile on this system. If you don't need it (most normal users won't) build without it; using a different compiler or a different version of Boost may also help.]) +fi +AM_CONDITIONAL([USE_SHARED_MEMORY], [test x$use_shared_memory = xyes]) +AC_SUBST(BOOST_MAPPED_FILE_CXXFLAG) + # Add some default CPP flags needed for Boost, identified by the AX macro. CPPFLAGS="$CPPFLAGS $CPPFLAGS_BOOST_THREADCONF" diff --git a/src/lib/util/Makefile.am b/src/lib/util/Makefile.am index 1fd2de46e6..ca03cd996c 100644 --- a/src/lib/util/Makefile.am +++ b/src/lib/util/Makefile.am @@ -18,7 +18,9 @@ libb10_util_la_SOURCES += interprocess_sync_file.h interprocess_sync_file.cc libb10_util_la_SOURCES += interprocess_sync_null.h interprocess_sync_null.cc libb10_util_la_SOURCES += memory_segment.h libb10_util_la_SOURCES += memory_segment_local.h memory_segment_local.cc +if USE_SHARED_MEMORY libb10_util_la_SOURCES += memory_segment_mapped.h memory_segment_mapped.cc +endif libb10_util_la_SOURCES += range_utilities.h libb10_util_la_SOURCES += hash/sha1.h hash/sha1.cc libb10_util_la_SOURCES += encode/base16_from_binary.h diff --git a/src/lib/util/tests/Makefile.am b/src/lib/util/tests/Makefile.am index 038d2f078f..0a9eea4974 100644 --- a/src/lib/util/tests/Makefile.am +++ b/src/lib/util/tests/Makefile.am @@ -8,6 +8,18 @@ AM_CPPFLAGS += -DTEST_DATA_BUILDDIR=\"$(abs_builddir)\" # the limit of file name path size. AM_CPPFLAGS += -DTEST_DATA_TOPBUILDDIR=\"$(abs_top_builddir)\" AM_CXXFLAGS = $(B10_CXXFLAGS) +# If we use the shared-memory support, corresponding Boost library may +# cause build failures especially if it's strict about warnings. We've +# detected it in ./configure and set BOOST_MAPPED_FILE_CXXFLAG to be more +# lenient as necessary (specifically, when set it'd usually supporess -Werror). +# This is a module wide setting, and has a possible bad side effect of hiding +# issues in other files, but making it per-file seems to be too costly. +# So we begin with the wider setting. If the side effect turns out to be too +# harmful, we'll consider other measure, e.g, moving the related files into +# a subdirectory. +if USE_SHARED_MEMORY +AM_CXXFLAGS += $(BOOST_MAPPED_FILE_CXXFLAG) +endif if USE_STATIC_LINK AM_LDFLAGS = -static @@ -34,7 +46,9 @@ run_unittests_SOURCES += lru_list_unittest.cc run_unittests_SOURCES += interprocess_sync_file_unittest.cc run_unittests_SOURCES += interprocess_sync_null_unittest.cc run_unittests_SOURCES += memory_segment_local_unittest.cc +if USE_SHARED_MEMORY run_unittests_SOURCES += memory_segment_mapped_unittest.cc +endif run_unittests_SOURCES += memory_segment_common_unittest.h run_unittests_SOURCES += memory_segment_common_unittest.cc run_unittests_SOURCES += qid_gen_unittest.cc