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.

starwels_find_bdb48.m4 2.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. dnl Copyright (c) 2013-2015 The Starwels developers
  2. dnl Distributed under the MIT software license, see the accompanying
  3. dnl file COPYING or http://www.opensource.org/licenses/mit-license.php.
  4. AC_DEFUN([STARWELS_FIND_BDB48],[
  5. AC_ARG_VAR(BDB_CFLAGS, [C compiler flags for BerkeleyDB, bypasses autodetection])
  6. AC_ARG_VAR(BDB_LIBS, [Linker flags for BerkeleyDB, bypasses autodetection])
  7. if test "x$BDB_CFLAGS" = "x"; then
  8. AC_MSG_CHECKING([for Berkeley DB C++ headers])
  9. BDB_CPPFLAGS=
  10. bdbpath=X
  11. bdb48path=X
  12. bdbdirlist=
  13. for _vn in 4.8 48 4 5 5.3 ''; do
  14. for _pfx in b lib ''; do
  15. bdbdirlist="$bdbdirlist ${_pfx}db${_vn}"
  16. done
  17. done
  18. for searchpath in $bdbdirlist ''; do
  19. test -n "${searchpath}" && searchpath="${searchpath}/"
  20. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  21. #include <${searchpath}db_cxx.h>
  22. ]],[[
  23. #if !((DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 8) || DB_VERSION_MAJOR > 4)
  24. #error "failed to find bdb 4.8+"
  25. #endif
  26. ]])],[
  27. if test "x$bdbpath" = "xX"; then
  28. bdbpath="${searchpath}"
  29. fi
  30. ],[
  31. continue
  32. ])
  33. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  34. #include <${searchpath}db_cxx.h>
  35. ]],[[
  36. #if !(DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR == 8)
  37. #error "failed to find bdb 4.8"
  38. #endif
  39. ]])],[
  40. bdb48path="${searchpath}"
  41. break
  42. ],[])
  43. done
  44. if test "x$bdbpath" = "xX"; then
  45. AC_MSG_RESULT([no])
  46. AC_MSG_ERROR([libdb_cxx headers missing, ]AC_PACKAGE_NAME[ requires this library for wallet functionality (--disable-wallet to disable wallet functionality)])
  47. elif test "x$bdb48path" = "xX"; then
  48. STARWELS_SUBDIR_TO_INCLUDE(BDB_CPPFLAGS,[${bdbpath}],db_cxx)
  49. AC_ARG_WITH([incompatible-bdb],[AS_HELP_STRING([--with-incompatible-bdb], [allow using a bdb version other than 4.8])],[
  50. AC_MSG_WARN([Found Berkeley DB other than 4.8; wallets opened by this build will not be portable!])
  51. ],[
  52. 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)])
  53. ])
  54. else
  55. STARWELS_SUBDIR_TO_INCLUDE(BDB_CPPFLAGS,[${bdb48path}],db_cxx)
  56. bdbpath="${bdb48path}"
  57. fi
  58. else
  59. BDB_CPPFLAGS=${BDB_CFLAGS}
  60. fi
  61. AC_SUBST(BDB_CPPFLAGS)
  62. if test "x$BDB_LIBS" = "x"; then
  63. # TODO: Ideally this could find the library version and make sure it matches the headers being used
  64. for searchlib in db_cxx-4.8 db_cxx; do
  65. AC_CHECK_LIB([$searchlib],[main],[
  66. BDB_LIBS="-l${searchlib}"
  67. break
  68. ])
  69. done
  70. if test "x$BDB_LIBS" = "x"; then
  71. AC_MSG_ERROR([libdb_cxx missing, ]AC_PACKAGE_NAME[ requires this library for wallet functionality (--disable-wallet to disable wallet functionality)])
  72. fi
  73. fi
  74. AC_SUBST(BDB_LIBS)
  75. ])