mirror of
https://github.com/dogecoin/dogecoin.git
synced 2026-01-31 10:30:52 +00:00
build: explicitly enable experimental functions
Introduces a configure flag --enable-experimental that controls at configure time whether or not experimental features can be enabled. This serves as a circuit breaker to both make sure that CI jobs are configured properly, and ensures manual compilations are intentionally configuring experimental / non-production code. Additionally, experimental features get listed in the summary after configuration completes if enabled. Further work can insert compile time checks with static_asserts against the ALLOW_DOGECOIN_EXPERIMENTAL macro.
This commit is contained in:
parent
6198d674fc
commit
5446a74f08
11
build-aux/m4/dogecoin_experimental.m4
Normal file
11
build-aux/m4/dogecoin_experimental.m4
Normal file
@ -0,0 +1,11 @@
|
||||
dnl Copyright (c) 2022 The Dogecoin Core developers
|
||||
dnl Distributed under the MIT software license, see the accompanying
|
||||
dnl file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
dnl Helper function to make experimental flag checking easy
|
||||
dnl experimental functions simply call this macro inside their checks
|
||||
AC_DEFUN([DOGECOIN_REQUIRE_EXPERIMENTAL],[
|
||||
if test x$allow_experimental != xyes; then
|
||||
AC_MSG_ERROR([Experimental features need to be enabled explicitly. Use --enable-experimental.])
|
||||
fi
|
||||
])
|
||||
23
configure.ac
23
configure.ac
@ -177,6 +177,12 @@ AC_ARG_ENABLE([zmq],
|
||||
[use_zmq=$enableval],
|
||||
[use_zmq=yes])
|
||||
|
||||
AC_ARG_ENABLE([experimental],
|
||||
[AS_HELP_STRING([--enable-experimental],
|
||||
[Allow experimental features to be configured (default is no)])],
|
||||
[allow_experimental=$enableval],
|
||||
[allow_experimental=no])
|
||||
|
||||
AC_ARG_ENABLE([scrypt-sse2],
|
||||
[AS_HELP_STRING([--enable-scrypt-sse2],
|
||||
[Build with scrypt sse2 implementation (default is no)])],
|
||||
@ -731,12 +737,19 @@ BOOST_LIBS="$BOOST_LDFLAGS $BOOST_SYSTEM_LIB $BOOST_FILESYSTEM_LIB $BOOST_PROGRA
|
||||
|
||||
fi
|
||||
|
||||
# Configure experimental for compile-time asserts
|
||||
if test x$allow_experimental = xyes; then
|
||||
AC_DEFINE(ALLOW_DOGECOIN_EXPERIMENTAL, 1, [Define this symbol if experimental features are allowed])
|
||||
fi
|
||||
|
||||
# Configure Scrypt SSE2
|
||||
if test x$use_scrypt_sse2 = xyes; then
|
||||
DOGECOIN_REQUIRE_EXPERIMENTAL
|
||||
AC_DEFINE(USE_SSE2, 1, [Define this symbol if SSE2 works])
|
||||
fi
|
||||
|
||||
if test x$armv8_crypto = xyes; then
|
||||
DOGECOIN_REQUIRE_EXPERIMENTAL
|
||||
AC_MSG_CHECKING([whether to build with armv8 crypto])
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(USE_ARMV8, 1, [Define this symbol if armv8 crypto works])
|
||||
@ -744,6 +757,7 @@ if test x$armv8_crypto = xyes; then
|
||||
fi
|
||||
|
||||
if test x$armv82_crypto = xyes; then
|
||||
DOGECOIN_REQUIRE_EXPERIMENTAL
|
||||
AC_CHECK_DECLS([vsha512su0q_u64],
|
||||
[AC_DEFINE(USE_ARMV82, 1, [Define this symbol if armv8.2 crypto works])
|
||||
CXXFLAGS="$CXXFLAGS -march=armv8.2-a+crypto+sha3"], AC_MSG_ERROR(sha512 missing), [#include <arm_neon.h>])
|
||||
@ -824,6 +838,7 @@ else
|
||||
fi
|
||||
|
||||
if test x$intel_avx2 = xyes; then
|
||||
DOGECOIN_REQUIRE_EXPERIMENTAL
|
||||
case $host in
|
||||
x86_64-*-linux*)
|
||||
AC_CHECK_LIB([IPSec_MB],[sha1_one_block_avx2],LIBS=-lIPSec_MB, AC_MSG_ERROR(IPSec_MB missing))
|
||||
@ -1188,6 +1203,14 @@ echo " with upnp = $use_upnp"
|
||||
echo " debug enabled = $enable_debug"
|
||||
echo " werror = $enable_werror"
|
||||
echo
|
||||
echo " experimental = $allow_experimental"
|
||||
if test x$allow_experimental = xyes; then
|
||||
echo " SSE2 Scrypt = $use_scrypt_sse2"
|
||||
echo " AVX2 crypto = $intel_avx2"
|
||||
echo " ARMv8 crypto = $armv8_crypto"
|
||||
echo " ARMv82 crypto = $armv82_crypto"
|
||||
fi
|
||||
echo
|
||||
echo " target os = $TARGET_OS"
|
||||
echo " build os = $BUILD_OS"
|
||||
echo
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user