From 4c75f0296b691362cc8e706a83a21460269e0ef7 Mon Sep 17 00:00:00 2001 From: Pieter Lexis Date: Wed, 17 Jul 2019 17:03:15 +0200 Subject: [PATCH] Use the boost.m4 boost::context detection --- pdns/recursordist/configure.ac | 48 +++++----------------------------- 1 file changed, 7 insertions(+), 41 deletions(-) diff --git a/pdns/recursordist/configure.ac b/pdns/recursordist/configure.ac index 3d2b20f555..e63fc7b167 100644 --- a/pdns/recursordist/configure.ac +++ b/pdns/recursordist/configure.ac @@ -40,46 +40,6 @@ PDNS_CHECK_OS PDNS_CHECK_NETWORK_LIBS PTHREAD_SET_NAME -# Boost Context was introduced in 1.51 (Aug 2012), but there was an immediate -# API break in 1.52 (Nov 2012), so we only support that, and later. -pdns_context_library="System V ucontexts" - -AC_DEFUN([PDNS_SELECT_CONTEXT_IMPL], [ - AC_MSG_CHECKING([whether Boost is new enough to use the context library...]) - if test $boost_major_version -ge 152; then - AC_MSG_RESULT([yes]) - if test $boost_major_version -ge 157; then - BOOST_THREAD([$1]) - m4_pattern_allow([^BOOST_THREAD_(LIBS|LDFLAGS)$])dnl - LIBS="$LIBS $BOOST_THREAD_LIBS" - LDFLAGS="$LDFLAGS $BOOST_THREAD_LDFLAGS" - fi - AC_MSG_NOTICE([checking whether the Boost context library actually links...]) - if test $boost_major_version -ge 161; then - BOOST_FIND_HEADER([boost/context/detail/fcontext.hpp], [ : ], [ - BOOST_FIND_LIB([context], [$1], [boost/context/detail/fcontext.hpp], [[]]) - ]) - else - BOOST_FIND_HEADER([boost/context/fcontext.hpp], [ : ], [ - BOOST_FIND_LIB([context], [$1], [boost/context/fcontext.hpp], [[]]) - ]) - fi - case $boost_cv_lib_context in - (yes) - pdns_context_library="Boost context" - AC_MSG_NOTICE([MTasker will use the Boost context library for context switching]) - ;; - *) - AC_MSG_NOTICE([Boost context library is missing]) - AC_MSG_NOTICE([MTasker will use System V ucontexts for context switching]) - ;; - esac - else - AC_MSG_RESULT([no]) - AC_MSG_NOTICE([MTasker will use System V ucontexts for context switching]) - fi -]) - PDNS_CHECK_CLOCK_GETTIME PDNS_WITH_PROTOBUF @@ -89,7 +49,13 @@ BOOST_REQUIRE([1.42]) # Check against flat_set header that requires boost >= 1.48 BOOST_FIND_HEADER([boost/container/flat_set.hpp], [AC_MSG_NOTICE([boost::container::flat_set not available, will fallback to std::set])]) -PDNS_SELECT_CONTEXT_IMPL +# Boost Context was introduced in 1.51 (Aug 2012), but there was an immediate +# API break in 1.52 (Nov 2012), so we only support that, and later. +pdns_context_library="System V ucontexts" +AS_IF([test $boost_major_version -ge 152], [BOOST_CONTEXT([], [no])]) +AC_MSG_CHECKING([what context library to use for MTasker]) +AS_IF([test x"$boost_cv_lib_context" = "xyes"], [pdns_context_library="Boost Context"]) +AC_MSG_RESULT([$pdns_context_library]) PDNS_ENABLE_UNIT_TESTS PDNS_ENABLE_REPRODUCIBLE -- 2.47.2