Browse Source

Merge #9705: build: Add options to override BDB cflags/libs

5cc2ebb Update OpenBSD and FreeBSD build steps (Wladimir J. van der Laan)
8713de8 build: Add options to override BDB cflags/libs (Wladimir J. van der Laan)
0.14
Wladimir J. van der Laan 8 years ago
parent
commit
6a55515a9b
No known key found for this signature in database
GPG Key ID: 74810B012346C9A6
  1. 120
      build-aux/m4/bitcoin_find_bdb48.m4
  2. 6
      doc/build-openbsd.md
  3. 4
      doc/build-unix.md

120
build-aux/m4/bitcoin_find_bdb48.m4

@ -3,68 +3,76 @@ dnl Distributed under the MIT software license, see the accompanying
dnl file COPYING or http://www.opensource.org/licenses/mit-license.php. dnl file COPYING or http://www.opensource.org/licenses/mit-license.php.
AC_DEFUN([BITCOIN_FIND_BDB48],[ AC_DEFUN([BITCOIN_FIND_BDB48],[
AC_MSG_CHECKING([for Berkeley DB C++ headers]) AC_ARG_VAR(BDB_CFLAGS, [C compiler flags for BerkeleyDB, bypasses autodetection])
BDB_CPPFLAGS= AC_ARG_VAR(BDB_LIBS, [Linker flags for BerkeleyDB, bypasses autodetection])
BDB_LIBS=
bdbpath=X if test "x$BDB_CFLAGS" = "x"; then
bdb48path=X AC_MSG_CHECKING([for Berkeley DB C++ headers])
bdbdirlist= BDB_CPPFLAGS=
for _vn in 4.8 48 4 5 ''; do bdbpath=X
for _pfx in b lib ''; do bdb48path=X
bdbdirlist="$bdbdirlist ${_pfx}db${_vn}" bdbdirlist=
for _vn in 4.8 48 4 5 ''; do
for _pfx in b lib ''; do
bdbdirlist="$bdbdirlist ${_pfx}db${_vn}"
done
done
for searchpath in $bdbdirlist ''; do
test -n "${searchpath}" && searchpath="${searchpath}/"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <${searchpath}db_cxx.h>
]],[[
#if !((DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 8) || DB_VERSION_MAJOR > 4)
#error "failed to find bdb 4.8+"
#endif
]])],[
if test "x$bdbpath" = "xX"; then
bdbpath="${searchpath}"
fi
],[
continue
])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <${searchpath}db_cxx.h>
]],[[
#if !(DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR == 8)
#error "failed to find bdb 4.8"
#endif
]])],[
bdb48path="${searchpath}"
break
],[])
done done
done if test "x$bdbpath" = "xX"; then
for searchpath in $bdbdirlist ''; do AC_MSG_RESULT([no])
test -n "${searchpath}" && searchpath="${searchpath}/" AC_MSG_ERROR([libdb_cxx headers missing, ]AC_PACKAGE_NAME[ requires this library for wallet functionality (--disable-wallet to disable wallet functionality)])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ elif test "x$bdb48path" = "xX"; then
#include <${searchpath}db_cxx.h> BITCOIN_SUBDIR_TO_INCLUDE(BDB_CPPFLAGS,[${bdbpath}],db_cxx)
]],[[ AC_ARG_WITH([incompatible-bdb],[AS_HELP_STRING([--with-incompatible-bdb], [allow using a bdb version other than 4.8])],[
#if !((DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 8) || DB_VERSION_MAJOR > 4) AC_MSG_WARN([Found Berkeley DB other than 4.8; wallets opened by this build will not be portable!])
#error "failed to find bdb 4.8+" ],[
#endif AC_MSG_ERROR([Found Berkeley DB other than 4.8, required for portable wallets (--with-incompatible-bdb to ignore or --disable-wallet to disable wallet functionality)])
]])],[ ])
if test "x$bdbpath" = "xX"; then else
bdbpath="${searchpath}" BITCOIN_SUBDIR_TO_INCLUDE(BDB_CPPFLAGS,[${bdb48path}],db_cxx)
fi bdbpath="${bdb48path}"
],[ fi
continue
])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <${searchpath}db_cxx.h>
]],[[
#if !(DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR == 8)
#error "failed to find bdb 4.8"
#endif
]])],[
bdb48path="${searchpath}"
break
],[])
done
if test "x$bdbpath" = "xX"; then
AC_MSG_RESULT([no])
AC_MSG_ERROR([libdb_cxx headers missing, ]AC_PACKAGE_NAME[ requires this library for wallet functionality (--disable-wallet to disable wallet functionality)])
elif test "x$bdb48path" = "xX"; then
BITCOIN_SUBDIR_TO_INCLUDE(BDB_CPPFLAGS,[${bdbpath}],db_cxx)
AC_ARG_WITH([incompatible-bdb],[AS_HELP_STRING([--with-incompatible-bdb], [allow using a bdb version other than 4.8])],[
AC_MSG_WARN([Found Berkeley DB other than 4.8; wallets opened by this build will not be portable!])
],[
AC_MSG_ERROR([Found Berkeley DB other than 4.8, required for portable wallets (--with-incompatible-bdb to ignore or --disable-wallet to disable wallet functionality)])
])
else else
BITCOIN_SUBDIR_TO_INCLUDE(BDB_CPPFLAGS,[${bdb48path}],db_cxx) BDB_CPPFLAGS=${BDB_CFLAGS}
bdbpath="${bdb48path}"
fi fi
AC_SUBST(BDB_CPPFLAGS) AC_SUBST(BDB_CPPFLAGS)
# TODO: Ideally this could find the library version and make sure it matches the headers being used
for searchlib in db_cxx-4.8 db_cxx; do
AC_CHECK_LIB([$searchlib],[main],[
BDB_LIBS="-l${searchlib}"
break
])
done
if test "x$BDB_LIBS" = "x"; then if test "x$BDB_LIBS" = "x"; then
AC_MSG_ERROR([libdb_cxx missing, ]AC_PACKAGE_NAME[ requires this library for wallet functionality (--disable-wallet to disable wallet functionality)]) # TODO: Ideally this could find the library version and make sure it matches the headers being used
for searchlib in db_cxx-4.8 db_cxx; do
AC_CHECK_LIB([$searchlib],[main],[
BDB_LIBS="-l${searchlib}"
break
])
done
if test "x$BDB_LIBS" = "x"; then
AC_MSG_ERROR([libdb_cxx missing, ]AC_PACKAGE_NAME[ requires this library for wallet functionality (--disable-wallet to disable wallet functionality)])
fi
fi fi
AC_SUBST(BDB_LIBS) AC_SUBST(BDB_LIBS)
]) ])

6
doc/build-openbsd.md

@ -1,6 +1,6 @@
OpenBSD build guide OpenBSD build guide
====================== ======================
(updated for OpenBSD 5.9) (updated for OpenBSD 6.0)
This guide describes how to build bitcoind and command-line utilities on OpenBSD. This guide describes how to build bitcoind and command-line utilities on OpenBSD.
@ -124,7 +124,7 @@ To configure with wallet:
```bash ```bash
./configure --with-gui=no --with-boost=$BOOST_PREFIX \ ./configure --with-gui=no --with-boost=$BOOST_PREFIX \
CC=egcc CXX=eg++ CPP=ecpp \ CC=egcc CXX=eg++ CPP=ecpp \
LDFLAGS="-L${BDB_PREFIX}/lib/" CPPFLAGS="-I${BDB_PREFIX}/include/" BDB_LIBS="-L${BDB_PREFIX}/lib -ldb_cxx-4.8" BDB_CFLAGS="-I${BDB_PREFIX}/include"
``` ```
To configure without wallet: To configure without wallet:
@ -142,6 +142,8 @@ gmake check
Clang (not currently working) Clang (not currently working)
------------------------------ ------------------------------
WARNING: This is outdated, needs to be updated for OpenBSD 6.0 and re-tried.
Using a newer g++ results in linking the new code to a new libstdc++. Using a newer g++ results in linking the new code to a new libstdc++.
Libraries built with the old g++, will still import the old library. Libraries built with the old g++, will still import the old library.
This gives conflicts, necessitating rebuild of all C++ dependencies of the application. This gives conflicts, necessitating rebuild of all C++ dependencies of the application.

4
doc/build-unix.md

@ -315,7 +315,7 @@ For further documentation on the depends system see [README.md](../depends/READM
Building on FreeBSD Building on FreeBSD
-------------------- --------------------
(Updated as of FreeBSD 10.3) (Updated as of FreeBSD 11.0)
Clang is installed by default as `cc` compiler, this makes it easier to get Clang is installed by default as `cc` compiler, this makes it easier to get
started than on [OpenBSD](build-openbsd.md). Installing dependencies: started than on [OpenBSD](build-openbsd.md). Installing dependencies:
@ -337,7 +337,7 @@ with 4.8-built Bitcoin Core is needed follow the steps under "Berkeley DB" above
Then build using: Then build using:
./autogen.sh ./autogen.sh
./configure --with-incompatible-bdb CPPFLAGS=-I/usr/local/include/db5 LDFLAGS=-L/usr/local/lib/db5 ./configure --with-incompatible-bdb BDB_CFLAGS="-I/usr/local/include/db5" BDB_LIBS="-L/usr/local/lib -ldb_cxx-5"
make make
*Note on debugging*: The version of `gdb` installed by default is [ancient and considered harmful](https://wiki.freebsd.org/GdbRetirement). *Note on debugging*: The version of `gdb` installed by default is [ancient and considered harmful](https://wiki.freebsd.org/GdbRetirement).

Loading…
Cancel
Save