Skip to content

Commit 87a9794

Browse files
committed
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
1 parent 5bb64ac commit 87a9794

File tree

7 files changed

+59
-52
lines changed

7 files changed

+59
-52
lines changed

build_msvc/bitcoin_config.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@
5050
/* define if the Boost::Filesystem library is available */
5151
#define HAVE_BOOST_FILESYSTEM /**/
5252

53-
/* define if the Boost::Process library is available */
54-
#define HAVE_BOOST_PROCESS /**/
53+
/* define if external signer support is enabled (requires Boost::Process) */
54+
#define ENABLE_EXTERNAL_SIGNER /**/
5555

5656
/* define if the Boost::System library is available */
5757
#define HAVE_BOOST_SYSTEM /**/

configure.ac

+44-38
Original file line numberDiff line numberDiff line change
@@ -338,10 +338,10 @@ AC_ARG_ENABLE([werror],
338338
[enable_werror=$enableval],
339339
[enable_werror=no])
340340

341-
AC_ARG_WITH([boost-process],
342-
[AS_HELP_STRING([--with-boost-process],[Opt in to using Boost Process (default is no)])],
343-
[boost_process=$withval],
344-
[boost_process=no])
341+
AC_ARG_ENABLE([external-signer],
342+
[AS_HELP_STRING([--enable-external-signer],[compile external signer support (default is no, requires Boost::Process)])],
343+
[use_external_signer=$enableval],
344+
[use_external_signer=no])
345345

346346
AC_LANG_PUSH([C++])
347347

@@ -1253,6 +1253,7 @@ if test "x$enable_fuzz" = "xyes"; then
12531253
bitcoin_enable_qt_dbus=no
12541254
enable_wallet=no
12551255
use_bench=no
1256+
use_external_signer=no
12561257
use_upnp=no
12571258
use_natpmp=no
12581259
use_zmq=no
@@ -1390,16 +1391,20 @@ fi
13901391
AX_BOOST_SYSTEM
13911392
AX_BOOST_FILESYSTEM
13921393

1393-
dnl Opt-in to Boost Process
1394-
if test "x$boost_process" != xno; then
1394+
dnl Opt-in to Boost Process if external signer support is requested
1395+
if test "x$use_external_signer" != xno; then
13951396
AC_MSG_CHECKING(for Boost Process)
13961397
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <boost/process.hpp>]],
13971398
[[ boost::process::child* child = new boost::process::child; delete child; ]])],
1398-
[ AC_MSG_RESULT(yes); AC_DEFINE([HAVE_BOOST_PROCESS],,[define if Boost::Process is available])],
1399-
[ AC_MSG_ERROR([Boost::Process is not available!])]
1399+
[ AC_MSG_RESULT(yes)
1400+
AC_DEFINE([ENABLE_EXTERNAL_SIGNER],,[define if external signer support is enabled])
1401+
],
1402+
[ AC_MSG_ERROR([Boost::Process is required for external signer support, but not available!])]
14001403
)
14011404
fi
14021405

1406+
AM_CONDITIONAL([ENABLE_EXTERNAL_SIGNER], [test "x$use_external_signer" = "xyes"])
1407+
14031408
if test x$suppress_external_warnings != xno; then
14041409
BOOST_CPPFLAGS=SUPPRESS_WARNINGS($BOOST_CPPFLAGS)
14051410
fi
@@ -1810,6 +1815,7 @@ AC_SUBST(ARM_CRC_CXXFLAGS)
18101815
AC_SUBST(LIBTOOL_APP_LDFLAGS)
18111816
AC_SUBST(USE_SQLITE)
18121817
AC_SUBST(USE_BDB)
1818+
AC_SUBST(ENABLE_EXTERNAL_SIGNER)
18131819
AC_SUBST(USE_UPNP)
18141820
AC_SUBST(USE_QRCODE)
18151821
AC_SUBST(BOOST_LIBS)
@@ -1885,43 +1891,43 @@ esac
18851891

18861892
echo
18871893
echo "Options used to compile and link:"
1888-
echo " boost process = $with_boost_process"
1889-
echo " multiprocess = $build_multiprocess"
1890-
echo " with libs = $build_bitcoin_libs"
1891-
echo " with wallet = $enable_wallet"
1894+
echo " external signer = $use_external_signer"
1895+
echo " multiprocess = $build_multiprocess"
1896+
echo " with libs = $build_bitcoin_libs"
1897+
echo " with wallet = $enable_wallet"
18921898
if test "x$enable_wallet" != "xno"; then
1893-
echo " with sqlite = $use_sqlite"
1894-
echo " with bdb = $use_bdb"
1899+
echo " with sqlite = $use_sqlite"
1900+
echo " with bdb = $use_bdb"
18951901
fi
1896-
echo " with gui / qt = $bitcoin_enable_qt"
1902+
echo " with gui / qt = $bitcoin_enable_qt"
18971903
if test x$bitcoin_enable_qt != xno; then
1898-
echo " with qr = $use_qr"
1904+
echo " with qr = $use_qr"
18991905
fi
1900-
echo " with zmq = $use_zmq"
1906+
echo " with zmq = $use_zmq"
19011907
if test x$enable_fuzz == xno; then
1902-
echo " with test = $use_tests"
1908+
echo " with test = $use_tests"
19031909
else
1904-
echo " with test = not building test_bitcoin because fuzzing is enabled"
1905-
echo " with fuzz = $enable_fuzz"
1910+
echo " with test = not building test_bitcoin because fuzzing is enabled"
1911+
echo " with fuzz = $enable_fuzz"
19061912
fi
1907-
echo " with bench = $use_bench"
1908-
echo " with upnp = $use_upnp"
1909-
echo " with natpmp = $use_natpmp"
1910-
echo " use asm = $use_asm"
1911-
echo " ebpf tracing = $have_sdt"
1912-
echo " sanitizers = $use_sanitizers"
1913-
echo " debug enabled = $enable_debug"
1914-
echo " gprof enabled = $enable_gprof"
1915-
echo " werror = $enable_werror"
1913+
echo " with bench = $use_bench"
1914+
echo " with upnp = $use_upnp"
1915+
echo " with natpmp = $use_natpmp"
1916+
echo " use asm = $use_asm"
1917+
echo " ebpf tracing = $have_sdt"
1918+
echo " sanitizers = $use_sanitizers"
1919+
echo " debug enabled = $enable_debug"
1920+
echo " gprof enabled = $enable_gprof"
1921+
echo " werror = $enable_werror"
19161922
echo
1917-
echo " target os = $TARGET_OS"
1918-
echo " build os = $build_os"
1923+
echo " target os = $TARGET_OS"
1924+
echo " build os = $build_os"
19191925
echo
1920-
echo " CC = $CC"
1921-
echo " CFLAGS = $PTHREAD_CFLAGS $CFLAGS"
1922-
echo " CPPFLAGS = $DEBUG_CPPFLAGS $HARDENED_CPPFLAGS $CPPFLAGS"
1923-
echo " CXX = $CXX"
1924-
echo " CXXFLAGS = $DEBUG_CXXFLAGS $HARDENED_CXXFLAGS $WARN_CXXFLAGS $NOWARN_CXXFLAGS $ERROR_CXXFLAGS $GPROF_CXXFLAGS $CXXFLAGS"
1925-
echo " LDFLAGS = $PTHREAD_LIBS $HARDENED_LDFLAGS $GPROF_LDFLAGS $LDFLAGS"
1926-
echo " ARFLAGS = $ARFLAGS"
1926+
echo " CC = $CC"
1927+
echo " CFLAGS = $PTHREAD_CFLAGS $CFLAGS"
1928+
echo " CPPFLAGS = $DEBUG_CPPFLAGS $HARDENED_CPPFLAGS $CPPFLAGS"
1929+
echo " CXX = $CXX"
1930+
echo " CXXFLAGS = $DEBUG_CXXFLAGS $HARDENED_CXXFLAGS $WARN_CXXFLAGS $NOWARN_CXXFLAGS $ERROR_CXXFLAGS $GPROF_CXXFLAGS $CXXFLAGS"
1931+
echo " LDFLAGS = $PTHREAD_LIBS $HARDENED_LDFLAGS $GPROF_LDFLAGS $LDFLAGS"
1932+
echo " ARFLAGS = $ARFLAGS"
19271933
echo

doc/Doxyfile.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -2073,7 +2073,7 @@ INCLUDE_FILE_PATTERNS =
20732073
# recursively expanded use the := operator instead of the = operator.
20742074
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
20752075

2076-
PREDEFINED = HAVE_BOOST_PROCESS
2076+
PREDEFINED = ENABLE_EXTERNAL_SIGNER
20772077

20782078
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
20792079
# tag can be used to specify a list of macro names that should be expanded. The

src/test/system_tests.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,22 @@
66
#include <util/system.h>
77
#include <univalue.h>
88

9-
#ifdef HAVE_BOOST_PROCESS
9+
#ifdef ENABLE_EXTERNAL_SIGNER
1010
#include <boost/process.hpp>
11-
#endif // HAVE_BOOST_PROCESS
11+
#endif // ENABLE_EXTERNAL_SIGNER
1212

1313
#include <boost/test/unit_test.hpp>
1414

1515
BOOST_FIXTURE_TEST_SUITE(system_tests, BasicTestingSetup)
1616

17-
// At least one test is required (in case HAVE_BOOST_PROCESS is not defined).
17+
// At least one test is required (in case ENABLE_EXTERNAL_SIGNER is not defined).
1818
// Workaround for https://github.com/bitcoin/bitcoin/issues/19128
1919
BOOST_AUTO_TEST_CASE(dummy)
2020
{
2121
BOOST_CHECK(true);
2222
}
2323

24-
#ifdef HAVE_BOOST_PROCESS
24+
#ifdef ENABLE_EXTERNAL_SIGNER
2525

2626
bool checkMessage(const std::runtime_error& ex)
2727
{
@@ -90,6 +90,6 @@ BOOST_AUTO_TEST_CASE(run_command)
9090
}
9191
#endif
9292
}
93-
#endif // HAVE_BOOST_PROCESS
93+
#endif // ENABLE_EXTERNAL_SIGNER
9494

9595
BOOST_AUTO_TEST_SUITE_END()

src/util/system.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55

66
#include <util/system.h>
77

8-
#ifdef HAVE_BOOST_PROCESS
8+
#ifdef ENABLE_EXTERNAL_SIGNER
99
#include <boost/process.hpp>
10-
#endif // HAVE_BOOST_PROCESS
10+
#endif // ENABLE_EXTERNAL_SIGNER
1111

1212
#include <chainparamsbase.h>
1313
#include <sync.h>
@@ -1247,7 +1247,7 @@ void runCommand(const std::string& strCommand)
12471247
}
12481248
#endif
12491249

1250-
#ifdef HAVE_BOOST_PROCESS
1250+
#ifdef ENABLE_EXTERNAL_SIGNER
12511251
UniValue RunCommandParseJSON(const std::string& str_command, const std::string& str_std_in)
12521252
{
12531253
namespace bp = boost::process;
@@ -1282,7 +1282,7 @@ UniValue RunCommandParseJSON(const std::string& str_command, const std::string&
12821282

12831283
return result_json;
12841284
}
1285-
#endif // HAVE_BOOST_PROCESS
1285+
#endif // ENABLE_EXTERNAL_SIGNER
12861286

12871287
void SetupEnvironment()
12881288
{

src/util/system.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ std::string ShellEscape(const std::string& arg);
108108
#if HAVE_SYSTEM
109109
void runCommand(const std::string& strCommand);
110110
#endif
111-
#ifdef HAVE_BOOST_PROCESS
111+
#ifdef ENABLE_EXTERNAL_SIGNER
112112
/**
113113
* Execute a command which returns JSON, and parse the result.
114114
*
@@ -117,7 +117,7 @@ void runCommand(const std::string& strCommand);
117117
* @return parsed JSON
118118
*/
119119
UniValue RunCommandParseJSON(const std::string& str_command, const std::string& str_std_in="");
120-
#endif // HAVE_BOOST_PROCESS
120+
#endif // ENABLE_EXTERNAL_SIGNER
121121

122122
/**
123123
* Most paths passed as configuration arguments are treated as relative to

test/config.ini.in

+1
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,4 @@ RPCAUTH=@abs_top_srcdir@/share/rpcauth/rpcauth.py
2323
@BUILD_BITCOIND_TRUE@ENABLE_BITCOIND=true
2424
@ENABLE_FUZZ_TRUE@ENABLE_FUZZ=true
2525
@ENABLE_ZMQ_TRUE@ENABLE_ZMQ=true
26+
@ENABLE_EXTERNAL_SIGNER_TRUE@ENABLE_EXTERNAL_SIGNER=true

0 commit comments

Comments
 (0)