configure: add --enable-external-signer

This option replaces --with-boost-process

This prepares external signer support to be disabled by default.
It adds a configure option to enable this feature and to check
if Boost::Process is present.

This also exposes ENABLE_EXTERNAL_SIGNER to the test suite via test/config.ini
pull/826/head
Sjors Provoost 5 years ago
parent 5bb64acd9d
commit 87a97941f6
No known key found for this signature in database
GPG Key ID: 57FF9BDBCC301009

@ -50,8 +50,8 @@
/* define if the Boost::Filesystem library is available */
#define HAVE_BOOST_FILESYSTEM /**/
/* define if the Boost::Process library is available */
#define HAVE_BOOST_PROCESS /**/
/* define if external signer support is enabled (requires Boost::Process) */
#define ENABLE_EXTERNAL_SIGNER /**/
/* define if the Boost::System library is available */
#define HAVE_BOOST_SYSTEM /**/

@ -338,10 +338,10 @@ AC_ARG_ENABLE([werror],
[enable_werror=$enableval],
[enable_werror=no])
AC_ARG_WITH([boost-process],
[AS_HELP_STRING([--with-boost-process],[Opt in to using Boost Process (default is no)])],
[boost_process=$withval],
[boost_process=no])
AC_ARG_ENABLE([external-signer],
[AS_HELP_STRING([--enable-external-signer],[compile external signer support (default is no, requires Boost::Process)])],
[use_external_signer=$enableval],
[use_external_signer=no])
AC_LANG_PUSH([C++])
@ -1253,6 +1253,7 @@ if test "x$enable_fuzz" = "xyes"; then
bitcoin_enable_qt_dbus=no
enable_wallet=no
use_bench=no
use_external_signer=no
use_upnp=no
use_natpmp=no
use_zmq=no
@ -1390,16 +1391,20 @@ fi
AX_BOOST_SYSTEM
AX_BOOST_FILESYSTEM
dnl Opt-in to Boost Process
if test "x$boost_process" != xno; then
dnl Opt-in to Boost Process if external signer support is requested
if test "x$use_external_signer" != xno; then
AC_MSG_CHECKING(for Boost Process)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <boost/process.hpp>]],
[[ boost::process::child* child = new boost::process::child; delete child; ]])],
[ AC_MSG_RESULT(yes); AC_DEFINE([HAVE_BOOST_PROCESS],,[define if Boost::Process is available])],
[ AC_MSG_ERROR([Boost::Process is not available!])]
[ AC_MSG_RESULT(yes)
AC_DEFINE([ENABLE_EXTERNAL_SIGNER],,[define if external signer support is enabled])
],
[ AC_MSG_ERROR([Boost::Process is required for external signer support, but not available!])]
)
fi
AM_CONDITIONAL([ENABLE_EXTERNAL_SIGNER], [test "x$use_external_signer" = "xyes"])
if test x$suppress_external_warnings != xno; then
BOOST_CPPFLAGS=SUPPRESS_WARNINGS($BOOST_CPPFLAGS)
fi
@ -1810,6 +1815,7 @@ AC_SUBST(ARM_CRC_CXXFLAGS)
AC_SUBST(LIBTOOL_APP_LDFLAGS)
AC_SUBST(USE_SQLITE)
AC_SUBST(USE_BDB)
AC_SUBST(ENABLE_EXTERNAL_SIGNER)
AC_SUBST(USE_UPNP)
AC_SUBST(USE_QRCODE)
AC_SUBST(BOOST_LIBS)
@ -1885,43 +1891,43 @@ esac
echo
echo "Options used to compile and link:"
echo " boost process = $with_boost_process"
echo " multiprocess = $build_multiprocess"
echo " with libs = $build_bitcoin_libs"
echo " with wallet = $enable_wallet"
echo " external signer = $use_external_signer"
echo " multiprocess = $build_multiprocess"
echo " with libs = $build_bitcoin_libs"
echo " with wallet = $enable_wallet"
if test "x$enable_wallet" != "xno"; then
echo " with sqlite = $use_sqlite"
echo " with bdb = $use_bdb"
echo " with sqlite = $use_sqlite"
echo " with bdb = $use_bdb"
fi
echo " with gui / qt = $bitcoin_enable_qt"
echo " with gui / qt = $bitcoin_enable_qt"
if test x$bitcoin_enable_qt != xno; then
echo " with qr = $use_qr"
echo " with qr = $use_qr"
fi
echo " with zmq = $use_zmq"
echo " with zmq = $use_zmq"
if test x$enable_fuzz == xno; then
echo " with test = $use_tests"
echo " with test = $use_tests"
else
echo " with test = not building test_bitcoin because fuzzing is enabled"
echo " with fuzz = $enable_fuzz"
echo " with test = not building test_bitcoin because fuzzing is enabled"
echo " with fuzz = $enable_fuzz"
fi
echo " with bench = $use_bench"
echo " with upnp = $use_upnp"
echo " with natpmp = $use_natpmp"
echo " use asm = $use_asm"
echo " ebpf tracing = $have_sdt"
echo " sanitizers = $use_sanitizers"
echo " debug enabled = $enable_debug"
echo " gprof enabled = $enable_gprof"
echo " werror = $enable_werror"
echo " with bench = $use_bench"
echo " with upnp = $use_upnp"
echo " with natpmp = $use_natpmp"
echo " use asm = $use_asm"
echo " ebpf tracing = $have_sdt"
echo " sanitizers = $use_sanitizers"
echo " debug enabled = $enable_debug"
echo " gprof enabled = $enable_gprof"
echo " werror = $enable_werror"
echo
echo " target os = $TARGET_OS"
echo " build os = $build_os"
echo " target os = $TARGET_OS"
echo " build os = $build_os"
echo
echo " CC = $CC"
echo " CFLAGS = $PTHREAD_CFLAGS $CFLAGS"
echo " CPPFLAGS = $DEBUG_CPPFLAGS $HARDENED_CPPFLAGS $CPPFLAGS"
echo " CXX = $CXX"
echo " CXXFLAGS = $DEBUG_CXXFLAGS $HARDENED_CXXFLAGS $WARN_CXXFLAGS $NOWARN_CXXFLAGS $ERROR_CXXFLAGS $GPROF_CXXFLAGS $CXXFLAGS"
echo " LDFLAGS = $PTHREAD_LIBS $HARDENED_LDFLAGS $GPROF_LDFLAGS $LDFLAGS"
echo " ARFLAGS = $ARFLAGS"
echo " CC = $CC"
echo " CFLAGS = $PTHREAD_CFLAGS $CFLAGS"
echo " CPPFLAGS = $DEBUG_CPPFLAGS $HARDENED_CPPFLAGS $CPPFLAGS"
echo " CXX = $CXX"
echo " CXXFLAGS = $DEBUG_CXXFLAGS $HARDENED_CXXFLAGS $WARN_CXXFLAGS $NOWARN_CXXFLAGS $ERROR_CXXFLAGS $GPROF_CXXFLAGS $CXXFLAGS"
echo " LDFLAGS = $PTHREAD_LIBS $HARDENED_LDFLAGS $GPROF_LDFLAGS $LDFLAGS"
echo " ARFLAGS = $ARFLAGS"
echo

@ -2073,7 +2073,7 @@ INCLUDE_FILE_PATTERNS =
# recursively expanded use the := operator instead of the = operator.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
PREDEFINED = HAVE_BOOST_PROCESS
PREDEFINED = ENABLE_EXTERNAL_SIGNER
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
# tag can be used to specify a list of macro names that should be expanded. The

@ -6,22 +6,22 @@
#include <util/system.h>
#include <univalue.h>
#ifdef HAVE_BOOST_PROCESS
#ifdef ENABLE_EXTERNAL_SIGNER
#include <boost/process.hpp>
#endif // HAVE_BOOST_PROCESS
#endif // ENABLE_EXTERNAL_SIGNER
#include <boost/test/unit_test.hpp>
BOOST_FIXTURE_TEST_SUITE(system_tests, BasicTestingSetup)
// At least one test is required (in case HAVE_BOOST_PROCESS is not defined).
// At least one test is required (in case ENABLE_EXTERNAL_SIGNER is not defined).
// Workaround for https://github.com/bitcoin/bitcoin/issues/19128
BOOST_AUTO_TEST_CASE(dummy)
{
BOOST_CHECK(true);
}
#ifdef HAVE_BOOST_PROCESS
#ifdef ENABLE_EXTERNAL_SIGNER
bool checkMessage(const std::runtime_error& ex)
{
@ -90,6 +90,6 @@ BOOST_AUTO_TEST_CASE(run_command)
}
#endif
}
#endif // HAVE_BOOST_PROCESS
#endif // ENABLE_EXTERNAL_SIGNER
BOOST_AUTO_TEST_SUITE_END()

@ -5,9 +5,9 @@
#include <util/system.h>
#ifdef HAVE_BOOST_PROCESS
#ifdef ENABLE_EXTERNAL_SIGNER
#include <boost/process.hpp>
#endif // HAVE_BOOST_PROCESS
#endif // ENABLE_EXTERNAL_SIGNER
#include <chainparamsbase.h>
#include <sync.h>
@ -1247,7 +1247,7 @@ void runCommand(const std::string& strCommand)
}
#endif
#ifdef HAVE_BOOST_PROCESS
#ifdef ENABLE_EXTERNAL_SIGNER
UniValue RunCommandParseJSON(const std::string& str_command, const std::string& str_std_in)
{
namespace bp = boost::process;
@ -1282,7 +1282,7 @@ UniValue RunCommandParseJSON(const std::string& str_command, const std::string&
return result_json;
}
#endif // HAVE_BOOST_PROCESS
#endif // ENABLE_EXTERNAL_SIGNER
void SetupEnvironment()
{

@ -108,7 +108,7 @@ std::string ShellEscape(const std::string& arg);
#if HAVE_SYSTEM
void runCommand(const std::string& strCommand);
#endif
#ifdef HAVE_BOOST_PROCESS
#ifdef ENABLE_EXTERNAL_SIGNER
/**
* Execute a command which returns JSON, and parse the result.
*
@ -117,7 +117,7 @@ void runCommand(const std::string& strCommand);
* @return parsed JSON
*/
UniValue RunCommandParseJSON(const std::string& str_command, const std::string& str_std_in="");
#endif // HAVE_BOOST_PROCESS
#endif // ENABLE_EXTERNAL_SIGNER
/**
* Most paths passed as configuration arguments are treated as relative to

@ -23,3 +23,4 @@ RPCAUTH=@abs_top_srcdir@/share/rpcauth/rpcauth.py
@BUILD_BITCOIND_TRUE@ENABLE_BITCOIND=true
@ENABLE_FUZZ_TRUE@ENABLE_FUZZ=true
@ENABLE_ZMQ_TRUE@ENABLE_ZMQ=true
@ENABLE_EXTERNAL_SIGNER_TRUE@ENABLE_EXTERNAL_SIGNER=true

Loading…
Cancel
Save