aboutsummaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorLuke Dashjr <luke-jr+git@utopios.org>2022-05-12 02:58:35 +0000
committerHennadii Stepanov <32963518+hebasto@users.noreply.github.com>2023-01-06 10:51:01 +0000
commit989451d0689543b25ee6bf1d5b82c863d583597b (patch)
tree0cd02cd664c27ff1a4648eed10d875bbc02ce415 /configure.ac
parent911a40ead256b8849166cff1b745b9c9898e2da8 (diff)
downloadbitcoin-989451d0689543b25ee6bf1d5b82c863d583597b.tar.xz
configure: Detect compatibility of Boost.Process rather than hardcode non-Windows
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac78
1 files changed, 39 insertions, 39 deletions
diff --git a/configure.ac b/configure.ac
index 4b55bef5c7..b903ea5e55 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1493,45 +1493,45 @@ if test "$use_boost" = "yes"; then
fi
if test "$use_external_signer" != "no"; then
- case $host in
- *mingw*)
- dnl Boost Process uses Boost Filesystem when targeting Windows. Also,
- dnl since Boost 1.71.0, Process does not work with mingw-w64 without
- dnl workarounds. See 67669ab425b52a2b6be3d2f3b3b7e3939b676a2c.
- if test "$use_external_signer" = "yes"; then
- AC_MSG_ERROR([External signing is not supported on Windows])
- fi
- use_external_signer="no";
- ;;
- *)
- AC_MSG_CHECKING([whether Boost.Process can be used])
- TEMP_CXXFLAGS="$CXXFLAGS"
- dnl Boost 1.78 requires the following workaround.
- dnl See: https://github.com/boostorg/process/issues/235
- CXXFLAGS="$CXXFLAGS -Wno-error=narrowing"
- TEMP_CPPFLAGS="$CPPFLAGS"
- CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
- TEMP_LDFLAGS="$LDFLAGS"
- dnl Boost 1.73 and older require the following workaround.
- LDFLAGS="$LDFLAGS $PTHREAD_CFLAGS"
- AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <boost/process.hpp>]])],
- [have_boost_process="yes"],
- [have_boost_process="no"])
- LDFLAGS="$TEMP_LDFLAGS"
- CPPFLAGS="$TEMP_CPPFLAGS"
- CXXFLAGS="$TEMP_CXXFLAGS"
- AC_MSG_RESULT([$have_boost_process])
- if test "$have_boost_process" = "yes"; then
- use_external_signer="yes"
- AC_DEFINE([ENABLE_EXTERNAL_SIGNER], [1], [Define if external signer support is enabled])
- else
- if test "$use_external_signer" = "yes"; then
- AC_MSG_ERROR([External signing is not supported for this Boost version])
- fi
- use_external_signer="no";
- fi
- ;;
- esac
+ AC_MSG_CHECKING([whether Boost.Process can be used])
+ TEMP_CXXFLAGS="$CXXFLAGS"
+ dnl Boost 1.78 requires the following workaround.
+ dnl See: https://github.com/boostorg/process/issues/235
+ CXXFLAGS="$CXXFLAGS -Wno-error=narrowing"
+ TEMP_CPPFLAGS="$CPPFLAGS"
+ CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
+ TEMP_LDFLAGS="$LDFLAGS"
+ dnl Boost 1.73 and older require the following workaround.
+ LDFLAGS="$LDFLAGS $PTHREAD_CFLAGS"
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[
+ #define BOOST_PROCESS_USE_STD_FS
+ #include <boost/process.hpp>
+ ]],[[
+ namespace bp = boost::process;
+ bp::opstream stdin_stream;
+ bp::ipstream stdout_stream;
+ bp::child c("dummy", bp::std_out > stdout_stream, bp::std_err > stdout_stream, bp::std_in < stdin_stream);
+ stdin_stream << std::string{"test"} << std::endl;
+ if (c.running()) c.terminate();
+ c.wait();
+ c.exit_code();
+ ]])],
+ [have_boost_process="yes"],
+ [have_boost_process="no"])
+ LDFLAGS="$TEMP_LDFLAGS"
+ CPPFLAGS="$TEMP_CPPFLAGS"
+ CXXFLAGS="$TEMP_CXXFLAGS"
+ AC_MSG_RESULT([$have_boost_process])
+ if test "$have_boost_process" = "yes"; then
+ use_external_signer="yes"
+ AC_DEFINE([ENABLE_EXTERNAL_SIGNER], [1], [Define if external signer support is enabled])
+ AC_DEFINE([BOOST_PROCESS_USE_STD_FS], [1], [Defined to avoid Boost::Process trying to use Boost Filesystem])
+ else
+ if test "$use_external_signer" = "yes"; then
+ AC_MSG_ERROR([External signing is not supported for this Boost version])
+ fi
+ use_external_signer="no";
+ fi
fi
AM_CONDITIONAL([ENABLE_EXTERNAL_SIGNER], [test "$use_external_signer" = "yes"])