@@ -1075,6 +1075,68 @@ if test "$have_any_system" != "no"; then
1075
1075
AC_DEFINE ( [ HAVE_SYSTEM] , [ 1] , [ Define to 1 if std::system or ::wsystem is available.] )
1076
1076
fi
1077
1077
1078
+ dnl Check for leveldb, only if explicitly requested
1079
+ LEVELDB_CPPFLAGS=
1080
+ LIBLEVELDB=
1081
+ LIBMEMENV=
1082
+ AC_ARG_WITH ( [ system-leveldb] ,
1083
+ [ AS_HELP_STRING ( [ --with-system-leveldb] ,
1084
+ [ Build with system LevelDB (default is no; DANGEROUS; NOT SUPPORTED)] ) ] ,
1085
+ [ system_leveldb=$withval] ,
1086
+ [ system_leveldb=no]
1087
+ )
1088
+ if test x$system_leveldb != xno; then
1089
+ LEVELDB_CPPFLAGS=
1090
+ AC_CHECK_LIB ( [ leveldb] ,[ main] ,[
1091
+ LIBLEVELDB=-lleveldb
1092
+ ] ,[
1093
+ AC_MSG_ERROR ( [ leveldb library not found; using --with-system-leveldb is not supported anyway] )
1094
+ ] )
1095
+ AC_CHECK_HEADER ( [ leveldb/filter_policy.h] ,[ ] ,[
1096
+ AC_MSG_ERROR ( [ LevelDB headers not found; using --with-system-leveldb is not supported anyway] )
1097
+ ] )
1098
+ AC_CHECK_HEADER ( [ leveldb/helpers/memenv.h] ,[
1099
+ AC_MSG_CHECKING ( [ for memenv.h path] )
1100
+ BITCOIN_SUBDIR_TO_INCLUDE([ LEVELDB_CPPFLAGS] ,[ leveldb/helpers/] ,[ memenv] )
1101
+ ] ,[
1102
+ AC_CHECK_HEADER ( [ memenv.h] ,[ ] ,[
1103
+ AC_MSG_ERROR ( [ LevelDB headers not found; using --with-system-leveldb is not supported anyway] )
1104
+ ] )
1105
+ ] )
1106
+
1107
+ AC_MSG_CHECKING ( [ library containing leveldb::NewMemEnv] )
1108
+ TEMP_LIBS="$LIBS"
1109
+ TEMP_CPPFLAGS="$CPPFLAGS"
1110
+ CPPFLAGS="$CPPFLAGS $LEVELDB_CPPFLAGS"
1111
+ for searchlib in "" "-lmemenv" ERR; do
1112
+ if test "x$searchlib" = "xERR"; then
1113
+ AC_MSG_RESULT ( [ no] )
1114
+ AC_MSG_ERROR ( [ LevelDB's memenv helper not found; using --with-system-leveldb is not supported anyway] )
1115
+ fi
1116
+ searchlib="$searchlib $LIBLEVELDB"
1117
+ LIBS="$searchlib $TEMP_LIBS"
1118
+ AC_LINK_IFELSE ( [ AC_LANG_SOURCE ( [
1119
+ #include <leveldb/env.h>
1120
+ #include <memenv.h>
1121
+
1122
+ int main() {
1123
+ leveldb::Env *myenv = leveldb::NewMemEnv(leveldb::Env::Default());
1124
+ delete myenv;
1125
+ }
1126
+ ] ) ] ,[
1127
+ AC_MSG_RESULT ( [ $searchlib] )
1128
+ LIBMEMENV="$searchlib"
1129
+ break
1130
+ ] )
1131
+ done
1132
+ LIBS="$TEMP_LIBS"
1133
+ CPPFLAGS="$TEMP_CPPFLAGS"
1134
+ fi
1135
+ AM_CONDITIONAL([ EMBEDDED_LEVELDB] ,[ test x$system_leveldb = xno] )
1136
+ AC_SUBST ( LEVELDB_CPPFLAGS )
1137
+ AC_SUBST ( LIBLEVELDB )
1138
+ AC_SUBST ( LIBMEMENV )
1139
+
1078
1140
dnl SUPPRESSED_CPPFLAGS=SUPPRESS_WARNINGS([$SOME_CPPFLAGS])
1079
1141
dnl Replace -I with -isystem in $SOME_CPPFLAGS to suppress warnings from
1080
1142
dnl headers from its include directories and return the result.
0 commit comments