Blob Blame Raw
From 0d2fea4f142a26b48f6fd93f4fd885ad2720a4c4 Mon Sep 17 00:00:00 2001
From: Peter Lemenkov <lemenkov@gmail.com>
Date: Sat, 19 May 2012 09:27:13 +0400
Subject: [PATCH 1/6] Initial commit of the autotools stuff

Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
---
 Makefile.am                | 134 +++++++++++++++++++++++++++++++++++++++++++++
 configure.ac               |  93 +++++++++++++++++++++++++++++++
 db/Makefile.am             |  33 +++++++++++
 helpers/memenv/Makefile.am |   6 ++
 leveldb.pc.in              |   9 +++
 port/Makefile.am           |  10 ++++
 table/Makefile.am          |  20 +++++++
 util/Makefile.am           |  33 +++++++++++
 8 files changed, 338 insertions(+)
 create mode 100644 Makefile.am
 create mode 100644 configure.ac
 create mode 100644 db/Makefile.am
 create mode 100644 helpers/memenv/Makefile.am
 create mode 100644 leveldb.pc.in
 create mode 100644 port/Makefile.am
 create mode 100644 table/Makefile.am
 create mode 100644 util/Makefile.am

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