]> granicus.if.org Git - pdns/commitdiff
Use the boost.m4 boost::context detection
authorPieter Lexis <pieter.lexis@powerdns.com>
Wed, 17 Jul 2019 15:03:15 +0000 (17:03 +0200)
committerPieter Lexis <pieter.lexis@powerdns.com>
Wed, 17 Jul 2019 15:17:36 +0000 (17:17 +0200)
pdns/recursordist/configure.ac

index 3d2b20f555f5b1e27ded837b07a238f158f4391a..e63fc7b16767a765c5b5b4e56c7a66937877e601 100644 (file)
@@ -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