You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

bitcoin_find_bdb48.m4 2.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. AC_DEFUN([BITCOIN_FIND_BDB48],[
  2. AC_MSG_CHECKING([for Berkeley DB C++ headers])
  3. BDB_CPPFLAGS=
  4. BDB_LIBS=
  5. bdbpath=X
  6. bdb48path=X
  7. bdbdirlist=
  8. for _vn in 4.8 48 4 5 ''; do
  9. for _pfx in b lib ''; do
  10. bdbdirlist="$bdbdirlist ${_pfx}db${_vn}"
  11. done
  12. done
  13. for searchpath in $bdbdirlist ''; do
  14. test -n "${searchpath}" && searchpath="${searchpath}/"
  15. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  16. #include <${searchpath}db_cxx.h>
  17. ]],[[
  18. #if !((DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 8) || DB_VERSION_MAJOR > 4)
  19. #error "failed to find bdb 4.8+"
  20. #endif
  21. ]])],[
  22. if test "x$bdbpath" = "xX"; then
  23. bdbpath="${searchpath}"
  24. fi
  25. ],[
  26. continue
  27. ])
  28. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  29. #include <${searchpath}db_cxx.h>
  30. ]],[[
  31. #if !(DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR == 8)
  32. #error "failed to find bdb 4.8"
  33. #endif
  34. ]])],[
  35. bdb48path="${searchpath}"
  36. break
  37. ],[])
  38. done
  39. if test "x$bdbpath" = "xX"; then
  40. AC_MSG_RESULT([no])
  41. AC_MSG_ERROR([libdb_cxx headers missing, Bitcoin Core requires this library for wallet functionality (--disable-wallet to disable wallet functionality)])
  42. elif test "x$bdb48path" = "xX"; then
  43. BITCOIN_SUBDIR_TO_INCLUDE(BDB_CPPFLAGS,[${bdbpath}],db_cxx)
  44. AC_ARG_WITH([incompatible-bdb],[AS_HELP_STRING([--with-incompatible-bdb], [allow using a bdb version other than 4.8])],[
  45. AC_MSG_WARN([Found Berkeley DB other than 4.8; wallets opened by this build will not be portable!])
  46. ],[
  47. 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)])
  48. ])
  49. else
  50. BITCOIN_SUBDIR_TO_INCLUDE(BDB_CPPFLAGS,[${bdb48path}],db_cxx)
  51. bdbpath="${bdb48path}"
  52. fi
  53. AC_SUBST(BDB_CPPFLAGS)
  54. # TODO: Ideally this could find the library version and make sure it matches the headers being used
  55. for searchlib in db_cxx-4.8 db_cxx; do
  56. AC_CHECK_LIB([$searchlib],[main],[
  57. BDB_LIBS="-l${searchlib}"
  58. break
  59. ])
  60. done
  61. if test "x$BDB_LIBS" = "x"; then
  62. AC_MSG_ERROR([libdb_cxx missing, Bitcoin Core requires this library for wallet functionality (--disable-wallet to disable wallet functionality)])
  63. fi
  64. AC_SUBST(BDB_LIBS)
  65. ])