Skip to content

Commit 24d02a9

Browse files
committed
build: Update build system for new leveldb
Upstream leveldb switched build systems, which means we need to define a few different values.
1 parent 3acaa13 commit 24d02a9

File tree

2 files changed

+44
-52
lines changed

2 files changed

+44
-52
lines changed

configure.ac

Lines changed: 26 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,6 @@ case $host in
517517
fi
518518

519519
CPPFLAGS="$CPPFLAGS -D_MT -DWIN32 -D_WINDOWS -DBOOST_THREAD_USE_LIB -D_WIN32_WINNT=0x0601"
520-
LEVELDB_TARGET_FLAGS="-DOS_WINDOWS"
521520
if test "x$CXXFLAGS_overridden" = "xno"; then
522521
CXXFLAGS="$CXXFLAGS -w"
523522
fi
@@ -533,7 +532,6 @@ case $host in
533532
;;
534533
*darwin*)
535534
TARGET_OS=darwin
536-
LEVELDB_TARGET_FLAGS="-DOS_MACOSX"
537535
if test x$cross_compiling != xyes; then
538536
BUILD_OS=darwin
539537
AC_PATH_PROGS([RSVG_CONVERT], [rsvg-convert rsvg],rsvg-convert)
@@ -585,35 +583,9 @@ case $host in
585583
*android*)
586584
dnl make sure android stays above linux for hosts like *linux-android*
587585
TARGET_OS=android
588-
LEVELDB_TARGET_FLAGS="-DOS_ANDROID"
589586
;;
590587
*linux*)
591588
TARGET_OS=linux
592-
LEVELDB_TARGET_FLAGS="-DOS_LINUX"
593-
;;
594-
*kfreebsd*)
595-
LEVELDB_TARGET_FLAGS="-DOS_KFREEBSD"
596-
;;
597-
*freebsd*)
598-
LEVELDB_TARGET_FLAGS="-DOS_FREEBSD"
599-
;;
600-
*openbsd*)
601-
LEVELDB_TARGET_FLAGS="-DOS_OPENBSD"
602-
;;
603-
*netbsd*)
604-
LEVELDB_TARGET_FLAGS="-DOS_NETBSD"
605-
;;
606-
*dragonfly*)
607-
LEVELDB_TARGET_FLAGS="-DOS_DRAGONFLYBSD"
608-
;;
609-
*solaris*)
610-
LEVELDB_TARGET_FLAGS="-DOS_SOLARIS"
611-
;;
612-
*hpux*)
613-
LEVELDB_TARGET_FLAGS="-DOS_HPUX"
614-
;;
615-
*)
616-
AC_MSG_ERROR(Cannot build leveldb for $host. Please file a bug report.)
617589
;;
618590
esac
619591

@@ -962,6 +934,28 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdint.h>
962934
[ AC_MSG_RESULT(no)]
963935
)
964936

937+
dnl LevelDB platform checks
938+
AC_MSG_CHECKING(for fdatasync)
939+
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]],
940+
[[ fdatasync(0); ]])],
941+
[ AC_MSG_RESULT(yes); HAVE_FDATASYNC=1 ],
942+
[ AC_MSG_RESULT(no); HAVE_FDATASYNC=0 ]
943+
)
944+
945+
AC_MSG_CHECKING(for F_FULLFSYNC)
946+
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <fcntl.h>]],
947+
[[ fcntl(0, F_FULLFSYNC, 0); ]])],
948+
[ AC_MSG_RESULT(yes); HAVE_FULLFSYNC=1 ],
949+
[ AC_MSG_RESULT(no); HAVE_FULLFSYNC=0 ]
950+
)
951+
952+
AC_MSG_CHECKING(for O_CLOEXEC)
953+
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <fcntl.h>]],
954+
[[ open("", O_CLOEXEC); ]])],
955+
[ AC_MSG_RESULT(yes); HAVE_O_CLOEXEC=1 ],
956+
[ AC_MSG_RESULT(no); HAVE_O_CLOEXEC=0 ]
957+
)
958+
965959
dnl Check for reduced exports
966960
if test x$use_reduce_exports = xyes; then
967961
AX_CHECK_COMPILE_FLAG([-fvisibility=hidden],[RE_CXXFLAGS="-fvisibility=hidden"],
@@ -1522,6 +1516,7 @@ AM_CONDITIONAL([ENABLE_SSE41],[test x$enable_sse41 = xyes])
15221516
AM_CONDITIONAL([ENABLE_AVX2],[test x$enable_avx2 = xyes])
15231517
AM_CONDITIONAL([ENABLE_SHANI],[test x$enable_shani = xyes])
15241518
AM_CONDITIONAL([USE_ASM],[test x$use_asm = xyes])
1519+
AM_CONDITIONAL([WORDS_BIGENDIAN],[test x$ac_cv_c_bigendian = xyes])
15251520

15261521
AC_DEFINE(CLIENT_VERSION_MAJOR, _CLIENT_VERSION_MAJOR, [Major version])
15271522
AC_DEFINE(CLIENT_VERSION_MINOR, _CLIENT_VERSION_MINOR, [Minor version])
@@ -1573,13 +1568,15 @@ AC_SUBST(USE_UPNP)
15731568
AC_SUBST(USE_QRCODE)
15741569
AC_SUBST(BOOST_LIBS)
15751570
AC_SUBST(TESTDEFS)
1576-
AC_SUBST(LEVELDB_TARGET_FLAGS)
15771571
AC_SUBST(MINIUPNPC_CPPFLAGS)
15781572
AC_SUBST(MINIUPNPC_LIBS)
15791573
AC_SUBST(EVENT_LIBS)
15801574
AC_SUBST(EVENT_PTHREADS_LIBS)
15811575
AC_SUBST(ZMQ_LIBS)
15821576
AC_SUBST(QR_LIBS)
1577+
AC_SUBST(HAVE_FDATASYNC)
1578+
AC_SUBST(HAVE_FULLFSYNC)
1579+
AC_SUBST(HAVE_O_CLOEXEC)
15831580
AC_CONFIG_FILES([Makefile src/Makefile doc/man/Makefile share/setup.nsi share/qt/Info.plist test/config.ini])
15841581
AC_CONFIG_FILES([contrib/devtools/split-debug.sh],[chmod +x contrib/devtools/split-debug.sh])
15851582
AM_COND_IF([HAVE_DOXYGEN], [AC_CONFIG_FILES([doc/Doxyfile])])

src/Makefile.leveldb.include

Lines changed: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,32 @@
44

55
LIBLEVELDB_INT = leveldb/libleveldb.a
66
LIBMEMENV_INT = leveldb/libmemenv.a
7-
LIBLEVELDB_SSE42_INT = leveldb/libleveldb_sse42.a
87

98
EXTRA_LIBRARIES += $(LIBLEVELDB_INT)
109
EXTRA_LIBRARIES += $(LIBMEMENV_INT)
11-
EXTRA_LIBRARIES += $(LIBLEVELDB_SSE42_INT)
1210

1311
LIBLEVELDB += $(LIBLEVELDB_INT)
1412
LIBMEMENV += $(LIBMEMENV_INT)
15-
LIBLEVELDB_SSE42 = $(LIBLEVELDB_SSE42_INT)
1613

1714
LEVELDB_CPPFLAGS += -I$(srcdir)/leveldb/include
1815
LEVELDB_CPPFLAGS += -I$(srcdir)/leveldb/helpers/memenv
1916

2017
LEVELDB_CPPFLAGS_INT =
2118
LEVELDB_CPPFLAGS_INT += -I$(srcdir)/leveldb
22-
LEVELDB_CPPFLAGS_INT += $(LEVELDB_TARGET_FLAGS)
23-
LEVELDB_CPPFLAGS_INT += -DLEVELDB_ATOMIC_PRESENT
2419
LEVELDB_CPPFLAGS_INT += -D__STDC_LIMIT_MACROS
20+
LEVELDB_CPPFLAGS_INT += -DHAVE_SNAPPY=0 -DHAVE_CRC32C=0
21+
LEVELDB_CPPFLAGS_INT += -DHAVE_FDATASYNC=@HAVE_FDATASYNC@
22+
LEVELDB_CPPFLAGS_INT += -DHAVE_FULLFSYNC=@HAVE_FULLFSYNC@
23+
LEVELDB_CPPFLAGS_INT += -DHAVE_O_CLOEXEC=@HAVE_O_CLOEXEC@
24+
25+
if WORDS_BIGENDIAN
26+
LEVELDB_CPPFLAGS_INT += -DLEVELDB_IS_BIG_ENDIAN=1
27+
else
28+
LEVELDB_CPPFLAGS_INT += -DLEVELDB_IS_BIG_ENDIAN=0
29+
endif
2530

2631
if TARGET_WINDOWS
27-
LEVELDB_CPPFLAGS_INT += -DLEVELDB_PLATFORM_WINDOWS -D__USE_MINGW_ANSI_STDIO=1
32+
LEVELDB_CPPFLAGS_INT += -DLEVELDB_PLATFORM_WINDOWS -D_UNICODE -DUNICODE -D__USE_MINGW_ANSI_STDIO=1
2833
else
2934
LEVELDB_CPPFLAGS_INT += -DLEVELDB_PLATFORM_POSIX
3035
endif
@@ -33,12 +38,8 @@ leveldb_libleveldb_a_CPPFLAGS = $(AM_CPPFLAGS) $(LEVELDB_CPPFLAGS_INT) $(LEVELDB
3338
leveldb_libleveldb_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
3439

3540
leveldb_libleveldb_a_SOURCES=
36-
leveldb_libleveldb_a_SOURCES += leveldb/port/atomic_pointer.h
37-
leveldb_libleveldb_a_SOURCES += leveldb/port/port_example.h
38-
leveldb_libleveldb_a_SOURCES += leveldb/port/port_posix.h
39-
leveldb_libleveldb_a_SOURCES += leveldb/port/win/stdint.h
41+
leveldb_libleveldb_a_SOURCES += leveldb/port/port_stdcxx.h
4042
leveldb_libleveldb_a_SOURCES += leveldb/port/port.h
41-
leveldb_libleveldb_a_SOURCES += leveldb/port/port_win.h
4243
leveldb_libleveldb_a_SOURCES += leveldb/port/thread_annotations.h
4344
leveldb_libleveldb_a_SOURCES += leveldb/include/leveldb/db.h
4445
leveldb_libleveldb_a_SOURCES += leveldb/include/leveldb/options.h
@@ -47,6 +48,7 @@ leveldb_libleveldb_a_SOURCES += leveldb/include/leveldb/filter_policy.h
4748
leveldb_libleveldb_a_SOURCES += leveldb/include/leveldb/slice.h
4849
leveldb_libleveldb_a_SOURCES += leveldb/include/leveldb/table_builder.h
4950
leveldb_libleveldb_a_SOURCES += leveldb/include/leveldb/env.h
51+
leveldb_libleveldb_a_SOURCES += leveldb/include/leveldb/export.h
5052
leveldb_libleveldb_a_SOURCES += leveldb/include/leveldb/c.h
5153
leveldb_libleveldb_a_SOURCES += leveldb/include/leveldb/iterator.h
5254
leveldb_libleveldb_a_SOURCES += leveldb/include/leveldb/cache.h
@@ -78,6 +80,7 @@ leveldb_libleveldb_a_SOURCES += leveldb/table/format.h
7880
leveldb_libleveldb_a_SOURCES += leveldb/table/iterator_wrapper.h
7981
leveldb_libleveldb_a_SOURCES += leveldb/util/crc32c.h
8082
leveldb_libleveldb_a_SOURCES += leveldb/util/env_posix_test_helper.h
83+
leveldb_libleveldb_a_SOURCES += leveldb/util/env_windows_test_helper.h
8184
leveldb_libleveldb_a_SOURCES += leveldb/util/arena.h
8285
leveldb_libleveldb_a_SOURCES += leveldb/util/random.h
8386
leveldb_libleveldb_a_SOURCES += leveldb/util/posix_logger.h
@@ -87,7 +90,9 @@ leveldb_libleveldb_a_SOURCES += leveldb/util/coding.h
8790
leveldb_libleveldb_a_SOURCES += leveldb/util/testutil.h
8891
leveldb_libleveldb_a_SOURCES += leveldb/util/mutexlock.h
8992
leveldb_libleveldb_a_SOURCES += leveldb/util/logging.h
93+
leveldb_libleveldb_a_SOURCES += leveldb/util/no_destructor.h
9094
leveldb_libleveldb_a_SOURCES += leveldb/util/testharness.h
95+
leveldb_libleveldb_a_SOURCES += leveldb/util/windows_logger.h
9196

9297
leveldb_libleveldb_a_SOURCES += leveldb/db/builder.cc
9398
leveldb_libleveldb_a_SOURCES += leveldb/db/c.cc
@@ -120,7 +125,6 @@ leveldb_libleveldb_a_SOURCES += leveldb/util/coding.cc
120125
leveldb_libleveldb_a_SOURCES += leveldb/util/comparator.cc
121126
leveldb_libleveldb_a_SOURCES += leveldb/util/crc32c.cc
122127
leveldb_libleveldb_a_SOURCES += leveldb/util/env.cc
123-
leveldb_libleveldb_a_SOURCES += leveldb/util/env_posix.cc
124128
leveldb_libleveldb_a_SOURCES += leveldb/util/filter_policy.cc
125129
leveldb_libleveldb_a_SOURCES += leveldb/util/hash.cc
126130
leveldb_libleveldb_a_SOURCES += leveldb/util/histogram.cc
@@ -129,21 +133,12 @@ leveldb_libleveldb_a_SOURCES += leveldb/util/options.cc
129133
leveldb_libleveldb_a_SOURCES += leveldb/util/status.cc
130134

131135
if TARGET_WINDOWS
132-
leveldb_libleveldb_a_SOURCES += leveldb/util/env_win.cc
133-
leveldb_libleveldb_a_SOURCES += leveldb/port/port_win.cc
136+
leveldb_libleveldb_a_SOURCES += leveldb/util/env_windows.cc
134137
else
135-
leveldb_libleveldb_a_SOURCES += leveldb/port/port_posix.cc
138+
leveldb_libleveldb_a_SOURCES += leveldb/util/env_posix.cc
136139
endif
137140

138141
leveldb_libmemenv_a_CPPFLAGS = $(leveldb_libleveldb_a_CPPFLAGS)
139142
leveldb_libmemenv_a_CXXFLAGS = $(leveldb_libleveldb_a_CXXFLAGS)
140143
leveldb_libmemenv_a_SOURCES = leveldb/helpers/memenv/memenv.cc
141144
leveldb_libmemenv_a_SOURCES += leveldb/helpers/memenv/memenv.h
142-
143-
leveldb_libleveldb_sse42_a_CPPFLAGS = $(leveldb_libleveldb_a_CPPFLAGS)
144-
leveldb_libleveldb_sse42_a_CXXFLAGS = $(leveldb_libleveldb_a_CXXFLAGS)
145-
if ENABLE_HWCRC32
146-
leveldb_libleveldb_sse42_a_CPPFLAGS += -DLEVELDB_PLATFORM_POSIX_SSE
147-
leveldb_libleveldb_sse42_a_CXXFLAGS += $(SSE42_CXXFLAGS)
148-
endif
149-
leveldb_libleveldb_sse42_a_SOURCES = leveldb/port/port_posix_sse.cc

0 commit comments

Comments
 (0)