mirror of
https://github.com/dashpay/dash.git
synced 2024-12-24 11:32:46 +01:00
merge bitcoin#20156: Make sqlite support optional (compile-time)
This commit is contained in:
parent
90c7f16596
commit
4c7112b106
30
configure.ac
30
configure.ac
@ -120,6 +120,12 @@ AC_ARG_ENABLE([wallet],
|
||||
[enable_wallet=$enableval],
|
||||
[enable_wallet=yes])
|
||||
|
||||
AC_ARG_WITH([sqlite],
|
||||
[AS_HELP_STRING([--with-sqlite=yes|no|auto],
|
||||
[enable sqlite wallet support (default: auto, i.e., enabled if wallet is enabled and sqlite is found)])],
|
||||
[use_sqlite=$withval],
|
||||
[use_sqlite=auto])
|
||||
|
||||
AC_ARG_WITH([miniupnpc],
|
||||
[AS_HELP_STRING([--with-miniupnpc],
|
||||
[enable UPNP (default is yes if libminiupnpc is found)])],
|
||||
@ -1281,7 +1287,24 @@ if test x$enable_wallet != xno; then
|
||||
fi
|
||||
|
||||
dnl Check for sqlite3
|
||||
PKG_CHECK_MODULES([SQLITE], [sqlite3 >= 3.7.17], , [AC_MSG_ERROR([sqlite3 not found.])])
|
||||
if test "x$use_sqlite" != "xno"; then
|
||||
PKG_CHECK_MODULES([SQLITE], [sqlite3 >= 3.7.17], [have_sqlite=yes], [have_sqlite=no])
|
||||
fi
|
||||
AC_MSG_CHECKING([whether to build wallet with support for sqlite])
|
||||
if test "x$use_sqlite" = "xno"; then
|
||||
use_sqlite=no
|
||||
elif test "x$have_sqlite" = "xno"; then
|
||||
if test "x$use_sqlite" = "xyes"; then
|
||||
AC_MSG_ERROR([sqlite support requested but cannot be built. Use --without-sqlite])
|
||||
fi
|
||||
use_sqlite=no
|
||||
else
|
||||
if test x$use_sqlite != xno; then
|
||||
AC_DEFINE([USE_SQLITE],[1],[Define if sqlite support should be compiled in])
|
||||
use_sqlite=yes
|
||||
fi
|
||||
fi
|
||||
AC_MSG_RESULT([$use_sqlite])
|
||||
fi
|
||||
|
||||
dnl Check for libminiupnpc (optional)
|
||||
@ -1649,6 +1672,7 @@ AM_CONDITIONAL([BUILD_DARWIN], [test x$BUILD_OS = xdarwin])
|
||||
AM_CONDITIONAL([TARGET_LINUX], [test x$TARGET_OS = xlinux])
|
||||
AM_CONDITIONAL([TARGET_WINDOWS], [test x$TARGET_OS = xwindows])
|
||||
AM_CONDITIONAL([ENABLE_WALLET],[test x$enable_wallet = xyes])
|
||||
AM_CONDITIONAL([USE_SQLITE], [test "x$use_sqlite" = "xyes"])
|
||||
AM_CONDITIONAL([ENABLE_TESTS],[test x$BUILD_TEST = xyes])
|
||||
AM_CONDITIONAL([ENABLE_FUZZ],[test x$enable_fuzz = xyes])
|
||||
AM_CONDITIONAL([ENABLE_FUZZ_LINK_ALL],[test x$enable_danger_fuzz_link_all = xyes])
|
||||
@ -1714,6 +1738,7 @@ AC_SUBST(X86_SHANI_CXXFLAGS)
|
||||
AC_SUBST(ARM_CRC_CXXFLAGS)
|
||||
AC_SUBST(ARM_SHANI_CXXFLAGS)
|
||||
AC_SUBST(LIBTOOL_APP_LDFLAGS)
|
||||
AC_SUBST(USE_SQLITE)
|
||||
AC_SUBST(USE_UPNP)
|
||||
AC_SUBST(USE_QRCODE)
|
||||
AC_SUBST(BOOST_LIBS)
|
||||
@ -1787,6 +1812,9 @@ echo
|
||||
echo "Options used to compile and link:"
|
||||
echo " with wallet = $enable_wallet"
|
||||
echo " with gui / qt = $bitcoin_enable_qt"
|
||||
if test "x$enable_wallet" != "xno"; then
|
||||
echo " with sqlite = $use_sqlite"
|
||||
fi
|
||||
if test x$bitcoin_enable_qt != xno; then
|
||||
echo " with qr = $use_qr"
|
||||
fi
|
||||
|
@ -39,7 +39,7 @@ Some dependencies are not needed in all configurations. The following are some f
|
||||
#### Options passed to `./configure`
|
||||
* MiniUPnPc is not needed with `--without-miniupnpc`.
|
||||
* Berkeley DB is not needed with `--disable-wallet`.
|
||||
* SQLite is not needed with `--disable-wallet`.
|
||||
* SQLite is not needed with `--disable-wallet` or `--without-sqlite`.
|
||||
* libnatpmp is not needed with `--without-natpmp`.
|
||||
* Qt is not needed with `--without-gui`.
|
||||
* If the qrencode dependency is absent, QR support won't be added. To force an error when that happens, pass `--with-qrencode`.
|
||||
|
@ -484,7 +484,7 @@ endif
|
||||
|
||||
# wallet: shared between dashd and dash-qt, but only linked
|
||||
# when wallet enabled
|
||||
libbitcoin_wallet_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
|
||||
libbitcoin_wallet_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(SQLITE_CFLAGS)
|
||||
libbitcoin_wallet_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
|
||||
libbitcoin_wallet_a_SOURCES = \
|
||||
coinjoin/client.cpp \
|
||||
@ -503,13 +503,16 @@ libbitcoin_wallet_a_SOURCES = \
|
||||
wallet/rpcwallet.cpp \
|
||||
wallet/salvage.cpp \
|
||||
wallet/scriptpubkeyman.cpp \
|
||||
wallet/sqlite.cpp \
|
||||
wallet/wallet.cpp \
|
||||
wallet/walletdb.cpp \
|
||||
wallet/walletutil.cpp \
|
||||
wallet/coinselection.cpp \
|
||||
$(BITCOIN_CORE_H)
|
||||
|
||||
if USE_SQLITE
|
||||
libbitcoin_wallet_a_SOURCES += wallet/sqlite.cpp
|
||||
endif
|
||||
|
||||
libbitcoin_wallet_tool_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
|
||||
libbitcoin_wallet_tool_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
|
||||
libbitcoin_wallet_tool_a_SOURCES = \
|
||||
|
@ -19,7 +19,9 @@
|
||||
#include <util/time.h>
|
||||
#include <util/translation.h>
|
||||
#include <wallet/bdb.h>
|
||||
#ifdef USE_SQLITE
|
||||
#include <wallet/sqlite.h>
|
||||
#endif
|
||||
#include <wallet/wallet.h>
|
||||
#include <validation.h>
|
||||
|
||||
@ -829,6 +831,7 @@ std::unique_ptr<WalletDatabase> MakeDatabase(const fs::path& path, const Databas
|
||||
if (ExistsBerkeleyDatabase(path)) {
|
||||
format = DatabaseFormat::BERKELEY;
|
||||
}
|
||||
#ifdef USE_SQLITE
|
||||
if (ExistsSQLiteDatabase(path)) {
|
||||
if (format) {
|
||||
error = Untranslated(strprintf("Failed to load database path '%s'. Data is in ambiguous format.", path.string()));
|
||||
@ -837,6 +840,7 @@ std::unique_ptr<WalletDatabase> MakeDatabase(const fs::path& path, const Databas
|
||||
}
|
||||
format = DatabaseFormat::SQLITE;
|
||||
}
|
||||
#endif
|
||||
} else if (options.require_existing) {
|
||||
error = Untranslated(strprintf("Failed to load database path '%s'. Path does not exist.", path.string()));
|
||||
status = DatabaseStatus::FAILED_NOT_FOUND;
|
||||
@ -865,9 +869,13 @@ std::unique_ptr<WalletDatabase> MakeDatabase(const fs::path& path, const Databas
|
||||
// Format is not set when a db doesn't already exist, so use the format specified by the options if it is set.
|
||||
if (!format && options.require_format) format = options.require_format;
|
||||
|
||||
#ifdef USE_SQLITE
|
||||
if (format && format == DatabaseFormat::SQLITE) {
|
||||
return MakeSQLiteDatabase(path, options, status, error);
|
||||
}
|
||||
#else
|
||||
assert(format != DatabaseFormat::SQLITE);
|
||||
#endif
|
||||
|
||||
return MakeBerkeleyDatabase(path, options, status, error);
|
||||
}
|
||||
|
@ -8,7 +8,11 @@
|
||||
#include <util/system.h>
|
||||
|
||||
bool ExistsBerkeleyDatabase(const fs::path& path);
|
||||
#ifdef USE_SQLITE
|
||||
bool ExistsSQLiteDatabase(const fs::path& path);
|
||||
#else
|
||||
# define ExistsSQLiteDatabase(path) (false)
|
||||
#endif
|
||||
|
||||
fs::path GetWalletDir()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user