bfc0460
From 0d2fea4f142a26b48f6fd93f4fd885ad2720a4c4 Mon Sep 17 00:00:00 2001
ce9f2c4
From: Peter Lemenkov <lemenkov@gmail.com>
ce9f2c4
Date: Sat, 19 May 2012 09:27:13 +0400
bfc0460
Subject: [PATCH 1/6] Initial commit of the autotools stuff
ce9f2c4
ce9f2c4
Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
ce9f2c4
---
2b4f7b2
 Makefile.am                | 134 +++++++++++++++++++++++++++++++++++++++++++++
2b4f7b2
 configure.ac               |  93 +++++++++++++++++++++++++++++++
2b4f7b2
 db/Makefile.am             |  33 +++++++++++
2b4f7b2
 helpers/memenv/Makefile.am |   6 ++
2b4f7b2
 leveldb.pc.in              |   9 +++
2b4f7b2
 port/Makefile.am           |  10 ++++
2b4f7b2
 table/Makefile.am          |  20 +++++++
2b4f7b2
 util/Makefile.am           |  33 +++++++++++
2b4f7b2
 8 files changed, 338 insertions(+)
ce9f2c4
 create mode 100644 Makefile.am
ce9f2c4
 create mode 100644 configure.ac
ce9f2c4
 create mode 100644 db/Makefile.am
ce9f2c4
 create mode 100644 helpers/memenv/Makefile.am
ce9f2c4
 create mode 100644 leveldb.pc.in
ce9f2c4
 create mode 100644 port/Makefile.am
ce9f2c4
 create mode 100644 table/Makefile.am
ce9f2c4
 create mode 100644 util/Makefile.am
ce9f2c4
ce9f2c4
diff --git a/Makefile.am b/Makefile.am
ce9f2c4
new file mode 100644
ce9f2c4
index 0000000..18da42d
ce9f2c4
--- /dev/null
ce9f2c4
+++ b/Makefile.am
ce9f2c4
@@ -0,0 +1,134 @@
ce9f2c4
+SUBDIRS = db helpers/memenv port table util
ce9f2c4
+
ce9f2c4
+lib_LTLIBRARIES = libleveldb.la
ce9f2c4
+
ce9f2c4
+libleveldbnobase_includedir = $(includedir)/leveldb
ce9f2c4
+libleveldbnobase_include_HEADERS = ./include/leveldb/c.h \
ce9f2c4
+				   ./include/leveldb/cache.h \
ce9f2c4
+				   ./include/leveldb/comparator.h \
ce9f2c4
+				   ./include/leveldb/db.h \
ce9f2c4
+				   ./include/leveldb/env.h \
ce9f2c4
+				   ./include/leveldb/filter_policy.h \
ce9f2c4
+				   ./include/leveldb/iterator.h \
ce9f2c4
+				   ./include/leveldb/options.h \
ce9f2c4
+				   ./include/leveldb/slice.h \
ce9f2c4
+				   ./include/leveldb/status.h \
ce9f2c4
+				   ./include/leveldb/table.h \
ce9f2c4
+				   ./include/leveldb/table_builder.h \
ce9f2c4
+				   ./include/leveldb/write_batch.h
ce9f2c4
+
ce9f2c4
+libleveldb_la_SOURCES =
ce9f2c4
+
ce9f2c4
+libleveldb_la_LIBADD = @SNAPPY_LIBS@ \
ce9f2c4
+		      $(top_builddir)/db/libdb.la \
ce9f2c4
+		      $(top_builddir)/port/libport.la \
ce9f2c4
+		      $(top_builddir)/table/libtable.la \
ce9f2c4
+		      $(top_builddir)/util/libutil.la
ce9f2c4
+
ce9f2c4
+libleveldb_la_LDFLAGS = $(AM_LDFLAGS) -version-info $(LEVELDB_VERSION_INFO)
ce9f2c4
+
ce9f2c4
+pkgconfigdir = $(libdir)/pkgconfig
ce9f2c4
+pkgconfig_DATA = leveldb.pc
ce9f2c4
+
ce9f2c4
+EXTRA_DIST = doc AUTHORS LICENSE NEWS README TODO
ce9f2c4
+
ce9f2c4
+TESTS = c_test \
ce9f2c4
+	corruption_test  \
ce9f2c4
+	db_test \
ce9f2c4
+	dbformat_test \
ce9f2c4
+	filename_test \
ce9f2c4
+	log_test \
ce9f2c4
+	skiplist_test \
ce9f2c4
+	version_edit_test \
ce9f2c4
+	version_set_test \
ce9f2c4
+	write_batch_test \
ce9f2c4
+	\
ce9f2c4
+	memenv_test \
ce9f2c4
+	\
ce9f2c4
+	filter_block_test \
ce9f2c4
+	table_test \
ce9f2c4
+	\
ce9f2c4
+	arena_test \
ce9f2c4
+	bloom_test \
ce9f2c4
+	cache_test \
ce9f2c4
+	coding_test \
ce9f2c4
+	crc32c_test \
ce9f2c4
+	env_test
ce9f2c4
+
ce9f2c4
+noinst_PROGRAMS = $(TESTS)
ce9f2c4
+
ce9f2c4
+c_test_SOURCES = ./db/c_test.c
ce9f2c4
+c_test_CFLAGS = $(AM_CXXFLAGS) -I$(top_srcdir)/include
ce9f2c4
+c_test_LDADD = libleveldb.la util/libtest.la
ce9f2c4
+
ce9f2c4
+corruption_test_SOURCES = ./db/corruption_test.cc
ce9f2c4
+corruption_test_CXXFLAGS = $(AM_CXXFLAGS) -I$(top_srcdir)/include
ce9f2c4
+corruption_test_LDADD = libleveldb.la util/libtest.la
ce9f2c4
+
ce9f2c4
+db_test_SOURCES = ./db/db_test.cc
ce9f2c4
+db_test_CXXFLAGS = $(AM_CXXFLAGS) -I$(top_srcdir)/include
ce9f2c4
+db_test_LDADD = libleveldb.la util/libtest.la
ce9f2c4
+
ce9f2c4
+dbformat_test_SOURCES = ./db/dbformat_test.cc
ce9f2c4
+dbformat_test_CXXFLAGS = $(AM_CXXFLAGS) -I$(top_srcdir)/include
ce9f2c4
+dbformat_test_LDADD = libleveldb.la util/libtest.la
ce9f2c4
+
ce9f2c4
+filename_test_SOURCES = ./db/filename_test.cc
ce9f2c4
+filename_test_CXXFLAGS = $(AM_CXXFLAGS) -I$(top_srcdir)/include
ce9f2c4
+filename_test_LDADD = libleveldb.la util/libtest.la
ce9f2c4
+
ce9f2c4
+log_test_SOURCES = ./db/log_test.cc
ce9f2c4
+log_test_CXXFLAGS = $(AM_CXXFLAGS) -I$(top_srcdir)/include
ce9f2c4
+log_test_LDADD = libleveldb.la util/libtest.la
ce9f2c4
+
ce9f2c4
+skiplist_test_SOURCES = ./db/skiplist_test.cc
ce9f2c4
+skiplist_test_CXXFLAGS = $(AM_CXXFLAGS) -I$(top_srcdir)/include
ce9f2c4
+skiplist_test_LDADD = libleveldb.la util/libtest.la
ce9f2c4
+
ce9f2c4
+version_edit_test_SOURCES = ./db/version_edit_test.cc
ce9f2c4
+version_edit_test_CXXFLAGS = $(AM_CXXFLAGS) -I$(top_srcdir)/include
ce9f2c4
+version_edit_test_LDADD = libleveldb.la util/libtest.la
ce9f2c4
+
ce9f2c4
+version_set_test_SOURCES = ./db/version_set_test.cc
ce9f2c4
+version_set_test_CXXFLAGS = $(AM_CXXFLAGS) -I$(top_srcdir)/include
ce9f2c4
+version_set_test_LDADD = libleveldb.la util/libtest.la
ce9f2c4
+
ce9f2c4
+write_batch_test_SOURCES = ./db/write_batch_test.cc
ce9f2c4
+write_batch_test_CXXFLAGS = $(AM_CXXFLAGS) -I$(top_srcdir)/include
ce9f2c4
+write_batch_test_LDADD = libleveldb.la util/libtest.la
ce9f2c4
+
ce9f2c4
+memenv_test_SOURCES = ./helpers/memenv/memenv_test.cc
ce9f2c4
+memenv_test_CXXFLAGS = $(AM_CXXFLAGS) -I$(top_srcdir)/include
ce9f2c4
+memenv_test_LDADD = libleveldb.la helpers/memenv/libmemenv.la util/libtest.la
ce9f2c4
+
ce9f2c4
+filter_block_test_SOURCES = ./table/filter_block_test.cc
ce9f2c4
+filter_block_test_CXXFLAGS = $(AM_CXXFLAGS) -I$(top_srcdir)/include
ce9f2c4
+filter_block_test_LDADD = libleveldb.la util/libtest.la
ce9f2c4
+
ce9f2c4
+table_test_SOURCES = ./table/table_test.cc
ce9f2c4
+table_test_CXXFLAGS = $(AM_CXXFLAGS) -I$(top_srcdir)/include
ce9f2c4
+table_test_LDADD = libleveldb.la util/libtest.la
ce9f2c4
+
ce9f2c4
+arena_test_SOURCES = ./util/arena_test.cc
ce9f2c4
+arena_test_CXXFLAGS = $(AM_CXXFLAGS) -I$(top_srcdir)/include
ce9f2c4
+arena_test_LDADD = libleveldb.la util/libtest.la
ce9f2c4
+
ce9f2c4
+bloom_test_SOURCES = ./util/bloom_test.cc
ce9f2c4
+bloom_test_CXXFLAGS = $(AM_CXXFLAGS) -I$(top_srcdir)/include
ce9f2c4
+bloom_test_LDADD = libleveldb.la util/libtest.la
ce9f2c4
+
ce9f2c4
+cache_test_SOURCES = ./util/cache_test.cc
ce9f2c4
+cache_test_CXXFLAGS = $(AM_CXXFLAGS) -I$(top_srcdir)/include
ce9f2c4
+cache_test_LDADD = libleveldb.la util/libtest.la
ce9f2c4
+
ce9f2c4
+coding_test_SOURCES = ./util/coding_test.cc
ce9f2c4
+coding_test_CXXFLAGS = $(AM_CXXFLAGS) -I$(top_srcdir)/include
ce9f2c4
+coding_test_LDADD = libleveldb.la util/libtest.la
ce9f2c4
+
ce9f2c4
+crc32c_test_SOURCES = ./util/crc32c_test.cc
ce9f2c4
+crc32c_test_CXXFLAGS = $(AM_CXXFLAGS) -I$(top_srcdir)/include
ce9f2c4
+crc32c_test_LDADD = libleveldb.la util/libtest.la
ce9f2c4
+
ce9f2c4
+env_test_SOURCES = ./util/env_test.cc
ce9f2c4
+env_test_CXXFLAGS = $(AM_CXXFLAGS) -I$(top_srcdir)/include
ce9f2c4
+env_test_LDADD = libleveldb.la util/libtest.la
ce9f2c4
diff --git a/configure.ac b/configure.ac
ce9f2c4
new file mode 100644
bfc0460
index 0000000..4a290d7
ce9f2c4
--- /dev/null
ce9f2c4
+++ b/configure.ac
ce9f2c4
@@ -0,0 +1,93 @@
bfc0460
+AC_INIT([leveldb], [1.12.0], [http://groups.google.com/group/leveldb])
ce9f2c4
+
ce9f2c4
+AC_CANONICAL_TARGET
ce9f2c4
+
ce9f2c4
+AM_INIT_AUTOMAKE([dist-bzip2 no-dist-gzip tar-ustar foreign])
ce9f2c4
+
2b4f7b2
+AC_SUBST(LEVELDB_VERSION_INFO, [1:7:0])
ce9f2c4
+
ce9f2c4
+# Checks for programs.
ce9f2c4
+AC_PROG_CXX
ce9f2c4
+#AC_PROG_CC
ce9f2c4
+AC_PROG_LIBTOOL
ce9f2c4
+AC_PROG_INSTALL
ce9f2c4
+
ce9f2c4
+AC_LANG_CPLUSPLUS
ce9f2c4
+
ce9f2c4
+# Checks for libraries.
ce9f2c4
+# FIXME: Replace `main' with a function in `-lkyotocabinet':
ce9f2c4
+#AC_CHECK_LIB([kyotocabinet], [main])
ce9f2c4
+# FIXME: Replace `main' with a function in `-lsqlite3':
ce9f2c4
+#AC_CHECK_LIB([sqlite3], [main])
ce9f2c4
+
ce9f2c4
+AC_CHECK_LIB(
ce9f2c4
+	     [snappy],
ce9f2c4
+	     [snappy_compress],
ce9f2c4
+	     [
ce9f2c4
+	      CXXFLAGS="$CXXFLAGS -DSNAPPY"
ce9f2c4
+	      SNAPPY_LIBS="-lsnappy"
ce9f2c4
+	      AC_SUBST([SNAPPY_LIBS])
ce9f2c4
+	     ],
ce9f2c4
+	     [AC_MSG_ERROR([snappy library not found])],
ce9f2c4
+	     []
ce9f2c4
+	    )
ce9f2c4
+
ce9f2c4
+# Checks for header files.
ce9f2c4
+AC_CHECK_HEADERS([fcntl.h stddef.h stdint.h stdlib.h string.h sys/time.h unistd.h])
ce9f2c4
+
ce9f2c4
+case "$target_os" in
ce9f2c4
+	linux*)
ce9f2c4
+		CXXFLAGS="$CXXFLAGS -fno-builtin-memcmp -pthread -DOS_LINUX -DLEVELDB_PLATFORM_POSIX"
ce9f2c4
+		;;
ce9f2c4
+	darwin*)
ce9f2c4
+		CXXFLAGS="$CXXFLAGS -fno-builtin-memcmp -DOS_MACOSX -DLEVELDB_PLATFORM_POSIX"
ce9f2c4
+		;;
ce9f2c4
+	freebsd*)
ce9f2c4
+		CXXFLAGS="$CXXFLAGS -fno-builtin-memcmp -D_REENTRANT -DOS_FREEBSD -DLEVELDB_PLATFORM_POSIX"
ce9f2c4
+		;;
ce9f2c4
+	openbsd*)
ce9f2c4
+		CXXFLAGS="$CXXFLAGS -fno-builtin-memcmp -D_REENTRANT -DOS_OPENBSD -DLEVELDB_PLATFORM_POSIX"
ce9f2c4
+		;;
ce9f2c4
+	netbsd*)
ce9f2c4
+		CXXFLAGS="$CXXFLAGS -fno-builtin-memcmp -D_REENTRANT -DOS_NETBSD -DLEVELDB_PLATFORM_POSIX"
ce9f2c4
+		;;
ce9f2c4
+	*solaris*)
ce9f2c4
+		CXXFLAGS="$CXXFLAGS -fno-builtin-memcmp -D_REENTRANT -DOS_SOLARIS -DLEVELDB_PLATFORM_POSIX"
ce9f2c4
+		;;
ce9f2c4
+	*)
ce9f2c4
+		AC_MSG_ERROR([No support for this OS ($target_os) yet])
ce9f2c4
+		;;
ce9f2c4
+esac
ce9f2c4
+
ce9f2c4
+# Checks for typedefs, structures, and compiler characteristics.
ce9f2c4
+#AC_CHECK_HEADER_STDBOOL
ce9f2c4
+AC_C_INLINE
ce9f2c4
+AC_TYPE_INT16_T
ce9f2c4
+AC_TYPE_INT32_T
ce9f2c4
+AC_TYPE_INT64_T
ce9f2c4
+AC_TYPE_INT8_T
ce9f2c4
+AC_TYPE_OFF_T
ce9f2c4
+AC_TYPE_SIZE_T
ce9f2c4
+AC_TYPE_SSIZE_T
ce9f2c4
+AC_TYPE_UINT16_T
ce9f2c4
+AC_TYPE_UINT32_T
ce9f2c4
+AC_TYPE_UINT64_T
ce9f2c4
+AC_TYPE_UINT8_T
ce9f2c4
+
ce9f2c4
+# Checks for library functions.
ce9f2c4
+AC_FUNC_ERROR_AT_LINE
ce9f2c4
+AC_FUNC_MALLOC
ce9f2c4
+AC_FUNC_MMAP
ce9f2c4
+AC_CHECK_FUNCS([fdatasync ftruncate getpagesize gettimeofday localtime_r memset mkdir munmap rmdir sqrt strchr strdup strerror strrchr strstr strtoull])
ce9f2c4
+
ce9f2c4
+AC_CONFIG_FILES([
ce9f2c4
+Makefile
ce9f2c4
+db/Makefile
ce9f2c4
+helpers/memenv/Makefile
ce9f2c4
+port/Makefile
ce9f2c4
+table/Makefile
ce9f2c4
+util/Makefile
ce9f2c4
+leveldb.pc
ce9f2c4
+])
ce9f2c4
+
ce9f2c4
+AC_OUTPUT
ce9f2c4
diff --git a/db/Makefile.am b/db/Makefile.am
ce9f2c4
new file mode 100644
ce9f2c4
index 0000000..0efdc03
ce9f2c4
--- /dev/null
ce9f2c4
+++ b/db/Makefile.am
ce9f2c4
@@ -0,0 +1,33 @@
ce9f2c4
+noinst_LTLIBRARIES = libdb.la
ce9f2c4
+
ce9f2c4
+libdb_la_SOURCES = builder.cc \
ce9f2c4
+		   builder.h \
ce9f2c4
+		   c.cc \
ce9f2c4
+		   db_impl.cc \
ce9f2c4
+		   db_impl.h \
ce9f2c4
+		   db_iter.cc \
ce9f2c4
+		   db_iter.h \
ce9f2c4
+		   dbformat.cc \
ce9f2c4
+		   dbformat.h \
ce9f2c4
+		   filename.cc \
ce9f2c4
+		   filename.h \
ce9f2c4
+		   log_format.h \
ce9f2c4
+		   log_reader.cc \
ce9f2c4
+		   log_reader.h \
ce9f2c4
+		   log_writer.cc \
ce9f2c4
+		   log_writer.h \
ce9f2c4
+		   memtable.cc \
ce9f2c4
+		   memtable.h \
ce9f2c4
+		   repair.cc \
ce9f2c4
+		   skiplist.h \
ce9f2c4
+		   snapshot.h \
ce9f2c4
+		   table_cache.cc \
ce9f2c4
+		   table_cache.h \
ce9f2c4
+		   version_edit.cc \
ce9f2c4
+		   version_edit.h \
ce9f2c4
+		   version_set.cc \
ce9f2c4
+		   version_set.h \
ce9f2c4
+		   write_batch.cc \
ce9f2c4
+		   write_batch_internal.h
ce9f2c4
+
ce9f2c4
+libdb_la_CXXFLAGS = $(AM_CXXFLAGS) -I$(top_srcdir) -I$(top_srcdir)/include
ce9f2c4
diff --git a/helpers/memenv/Makefile.am b/helpers/memenv/Makefile.am
ce9f2c4
new file mode 100644
ce9f2c4
index 0000000..cd52bfe
ce9f2c4
--- /dev/null
ce9f2c4
+++ b/helpers/memenv/Makefile.am
ce9f2c4
@@ -0,0 +1,6 @@
ce9f2c4
+noinst_LTLIBRARIES = libmemenv.la
ce9f2c4
+
ce9f2c4
+libmemenv_la_SOURCES = memenv.cc
ce9f2c4
+
ce9f2c4
+
ce9f2c4
+libmemenv_la_CXXFLAGS = $(AM_CXXFLAGS) -I$(top_srcdir) -I$(top_srcdir)/include
ce9f2c4
diff --git a/leveldb.pc.in b/leveldb.pc.in
ce9f2c4
new file mode 100644
ce9f2c4
index 0000000..1511011
ce9f2c4
--- /dev/null
ce9f2c4
+++ b/leveldb.pc.in
ce9f2c4
@@ -0,0 +1,9 @@
ce9f2c4
+prefix=@prefix@
ce9f2c4
+exec_prefix=@exec_prefix@
ce9f2c4
+libdir=@libdir@
ce9f2c4
+includedir=@includedir@
ce9f2c4
+
ce9f2c4
+Name: leveldb
ce9f2c4
+Description: a fast key-value storage library
ce9f2c4
+Version: @PACKAGE_VERSION@
ce9f2c4
+Libs: -lleveldb
ce9f2c4
diff --git a/port/Makefile.am b/port/Makefile.am
ce9f2c4
new file mode 100644
2b4f7b2
index 0000000..e392c46
ce9f2c4
--- /dev/null
ce9f2c4
+++ b/port/Makefile.am
2b4f7b2
@@ -0,0 +1,10 @@
ce9f2c4
+noinst_LTLIBRARIES = libport.la
ce9f2c4
+
ce9f2c4
+libport_la_SOURCES = atomic_pointer.h \
2b4f7b2
+		     port.h \
2b4f7b2
+		     port_example.h \
2b4f7b2
+		     port_posix.cc \
2b4f7b2
+		     port_posix.h \
2b4f7b2
+		     thread_annotations.h
ce9f2c4
+
ce9f2c4
+libport_la_CXXFLAGS = $(AM_CXXFLAGS) -I$(top_srcdir) -I$(top_srcdir)/include
ce9f2c4
diff --git a/table/Makefile.am b/table/Makefile.am
ce9f2c4
new file mode 100644
ce9f2c4
index 0000000..239e7ba
ce9f2c4
--- /dev/null
ce9f2c4
+++ b/table/Makefile.am
ce9f2c4
@@ -0,0 +1,20 @@
ce9f2c4
+noinst_LTLIBRARIES = libtable.la
ce9f2c4
+
ce9f2c4
+libtable_la_SOURCES = block.h \
ce9f2c4
+		      block_builder.h \
ce9f2c4
+		      filter_block.h \
ce9f2c4
+		      format.h \
ce9f2c4
+		      iterator_wrapper.h \
ce9f2c4
+		      merger.h \
ce9f2c4
+		      two_level_iterator.h \
ce9f2c4
+		      block.cc \
ce9f2c4
+		      block_builder.cc \
ce9f2c4
+		      filter_block.cc \
ce9f2c4
+		      format.cc \
ce9f2c4
+		      iterator.cc \
ce9f2c4
+		      merger.cc \
ce9f2c4
+		      table.cc \
ce9f2c4
+		      table_builder.cc \
ce9f2c4
+		      two_level_iterator.cc
ce9f2c4
+
ce9f2c4
+libtable_la_CXXFLAGS = $(AM_CXXFLAGS) -I$(top_srcdir) -I$(top_srcdir)/include
ce9f2c4
diff --git a/util/Makefile.am b/util/Makefile.am
ce9f2c4
new file mode 100644
2b4f7b2
index 0000000..eb637ba
ce9f2c4
--- /dev/null
ce9f2c4
+++ b/util/Makefile.am
2b4f7b2
@@ -0,0 +1,33 @@
ce9f2c4
+noinst_LTLIBRARIES = libutil.la libtest.la
ce9f2c4
+
ce9f2c4
+libutil_la_SOURCES = arena.h \
ce9f2c4
+		     coding.h \
ce9f2c4
+		     crc32c.h \
ce9f2c4
+		     hash.h \
ce9f2c4
+		     histogram.h \
ce9f2c4
+		     logging.h \
ce9f2c4
+		     mutexlock.h \
ce9f2c4
+		     posix_logger.h \
ce9f2c4
+		     random.h \
ce9f2c4
+		     arena.cc \
ce9f2c4
+		     bloom.cc \
ce9f2c4
+		     cache.cc \
ce9f2c4
+		     coding.cc \
ce9f2c4
+		     comparator.cc \
ce9f2c4
+		     crc32c.cc \
ce9f2c4
+		     env.cc \
ce9f2c4
+		     env_posix.cc \
ce9f2c4
+		     filter_policy.cc \
ce9f2c4
+		     hash.cc \
ce9f2c4
+		     histogram.cc \
ce9f2c4
+		     logging.cc \
ce9f2c4
+		     options.cc \
ce9f2c4
+		     status.cc
ce9f2c4
+
ce9f2c4
+libtest_la_SOURCES = testharness.cc \
2b4f7b2
+		     testharness.h \
2b4f7b2
+		     testutil.cc \
2b4f7b2
+		     testutil.h
ce9f2c4
+
ce9f2c4
+libutil_la_CXXFLAGS = $(AM_CXXFLAGS) -I$(top_srcdir) -I$(top_srcdir)/include
ce9f2c4
+libtest_la_CXXFLAGS = $(AM_CXXFLAGS) -I$(top_srcdir) -I$(top_srcdir)/include
ce9f2c4
-- 
bfc0460
1.8.3.1
ce9f2c4