diff --git a/build-aux/m4/ax_cxx_compile_stdcxx.m4 b/build-aux/m4/ax_cxx_compile_stdcxx.m4 index 94de9e8a146f86..a4266d95369dec 100644 --- a/build-aux/m4/ax_cxx_compile_stdcxx.m4 +++ b/build-aux/m4/ax_cxx_compile_stdcxx.m4 @@ -986,7 +986,7 @@ m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_20], [[ #error "This is not a C++ compiler" -#elif __cplusplus < 202002L +#elif __cplusplus < 201709L // Temporary patch on top of upstream to allow g++-10 #error "This is not a C++20 compiler" diff --git a/configure.ac b/configure.ac index 4dae9c74525e02..f8e78bea654a69 100644 --- a/configure.ac +++ b/configure.ac @@ -66,18 +66,8 @@ case $host in ;; esac -AC_ARG_ENABLE([c++20], - [AS_HELP_STRING([--enable-c++20], - [enable compilation in c++20 mode (disabled by default)])], - [use_cxx20=$enableval], - [use_cxx20=no]) - -dnl Require C++17 or C++20 compiler (no GNU extensions) -if test "x$use_cxx20" = xyes; then - AX_CXX_COMPILE_STDCXX([20], [noext], [mandatory]) -else - AX_CXX_COMPILE_STDCXX([17], [noext], [mandatory]) -fi +dnl Require C++20 compiler (no GNU extensions) +AX_CXX_COMPILE_STDCXX([20], [noext], [mandatory]) dnl Check if -latomic is required for CHECK_ATOMIC diff --git a/depends/Makefile b/depends/Makefile index 823be933a7b254..db63acfe0f42dd 100644 --- a/depends/Makefile +++ b/depends/Makefile @@ -43,6 +43,9 @@ NO_NATPMP ?= MULTIPROCESS ?= FALLBACK_DOWNLOAD_PATH ?= https://bitcoincore.org/depends-sources +C_STANDARD ?= c11 +CXX_STANDARD ?= c++20 + BUILD = $(shell ./config.guess) HOST ?= $(BUILD) PATCHES_PATH = $(BASEDIR)/patches diff --git a/depends/README.md b/depends/README.md index ab6a01b8c03ece..2bd44a33b0e94d 100644 --- a/depends/README.md +++ b/depends/README.md @@ -99,6 +99,8 @@ The following can be set when running make: `make FOO=bar` - `BASE_CACHE`: Built packages will be placed here - `SDK_PATH`: Path where SDKs can be found (used by macOS) - `FALLBACK_DOWNLOAD_PATH`: If a source file can't be fetched, try here before giving up +- `C_STANDARD`: Set the C standard version used. Defaults to `c11`. +- `CXX_STANDARD`: Set the C++ standard version used. Defaults to `c++20`. - `NO_QT`: Don't download/build/cache Qt and its dependencies - `NO_QR`: Don't download/build/cache packages needed for enabling qrencode - `NO_ZMQ`: Don't download/build/cache packages needed for enabling ZeroMQ diff --git a/depends/packages/qt.mk b/depends/packages/qt.mk index 6dbae734b5dfda..da0e1a819edc83 100644 --- a/depends/packages/qt.mk +++ b/depends/packages/qt.mk @@ -39,7 +39,7 @@ $(package)_config_opts_release += -silent $(package)_config_opts_debug = -debug $(package)_config_opts_debug += -optimized-tools $(package)_config_opts += -bindir $(build_prefix)/bin -$(package)_config_opts += -c++std c++17 +$(package)_config_opts += -c++std c++2a $(package)_config_opts += -confirm-license $(package)_config_opts += -hostprefix $(build_prefix) $(package)_config_opts += -no-compile-examples