Blob Blame History Raw
From 0bfe5692de28ae1c7dde5f80d3c8591d5ed57df2 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/2] Initial commit of the autotools stuff

Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
---
 Makefile                   |  200 --------------------------------------------
 Makefile.am                |  134 +++++++++++++++++++++++++++++
 configure.ac               |   93 ++++++++++++++++++++
 db/Makefile.am             |   33 ++++++++
 helpers/memenv/Makefile.am |    6 ++
 leveldb.pc.in              |    9 ++
 port/Makefile.am           |    8 ++
 table/Makefile.am          |   20 +++++
 util/Makefile.am           |   31 +++++++
 9 files changed, 334 insertions(+), 200 deletions(-)
 delete mode 100644 Makefile
 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 b/Makefile
deleted file mode 100644
index c648a28..0000000
--- a/Makefile
+++ /dev/null
@@ -1,200 +0,0 @@
-# Copyright (c) 2011 The LevelDB Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file. See the AUTHORS file for names of contributors.
-
-# Inherit some settings from environment variables, if available
-INSTALL_PATH ?= $(CURDIR)
-
-#-----------------------------------------------
-# Uncomment exactly one of the lines labelled (A), (B), and (C) below
-# to switch between compilation modes.
-
-OPT ?= -O2 -DNDEBUG       # (A) Production use (optimized mode)
-# OPT ?= -g2              # (B) Debug mode, w/ full line-level debugging symbols
-# OPT ?= -O2 -g2 -DNDEBUG # (C) Profiling mode: opt, but w/debugging symbols
-#-----------------------------------------------
-
-# detect what platform we're building on
-$(shell ./build_detect_platform build_config.mk)
-# this file is generated by the previous line to set build flags and sources
-include build_config.mk
-
-CFLAGS += -I. -I./include $(PLATFORM_CCFLAGS) $(OPT)
-CXXFLAGS += -I. -I./include $(PLATFORM_CXXFLAGS) $(OPT)
-
-LDFLAGS += $(PLATFORM_LDFLAGS)
-
-LIBOBJECTS = $(SOURCES:.cc=.o)
-MEMENVOBJECTS = $(MEMENV_SOURCES:.cc=.o)
-
-TESTUTIL = ./util/testutil.o
-TESTHARNESS = ./util/testharness.o $(TESTUTIL)
-
-TESTS = \
-	arena_test \
-	bloom_test \
-	c_test \
-	cache_test \
-	coding_test \
-	corruption_test \
-	crc32c_test \
-	db_test \
-	dbformat_test \
-	env_test \
-	filename_test \
-	filter_block_test \
-	log_test \
-	memenv_test \
-	skiplist_test \
-	table_test \
-	version_edit_test \
-	version_set_test \
-	write_batch_test
-
-PROGRAMS = db_bench $(TESTS)
-BENCHMARKS = db_bench_sqlite3 db_bench_tree_db
-
-LIBRARY = libleveldb.a
-MEMENVLIBRARY = libmemenv.a
-
-default: all
-
-# Should we build shared libraries?
-ifneq ($(PLATFORM_SHARED_EXT),)
-
-ifneq ($(PLATFORM_SHARED_VERSIONED),true)
-SHARED1 = libleveldb.$(PLATFORM_SHARED_EXT)
-SHARED2 = $(SHARED1)
-SHARED3 = $(SHARED1)
-SHARED = $(SHARED1)
-else
-# Update db.h if you change these.
-SHARED_MAJOR = 1
-SHARED_MINOR = 5
-SHARED1 = libleveldb.$(PLATFORM_SHARED_EXT)
-SHARED2 = $(SHARED1).$(SHARED_MAJOR)
-SHARED3 = $(SHARED1).$(SHARED_MAJOR).$(SHARED_MINOR)
-SHARED = $(SHARED1) $(SHARED2) $(SHARED3)
-$(SHARED1): $(SHARED3)
-	ln -fs $(SHARED3) $(SHARED1)
-$(SHARED2): $(SHARED3)
-	ln -fs $(SHARED3) $(SHARED2)
-endif
-
-$(SHARED3):
-	$(CXX) $(LDFLAGS) $(PLATFORM_SHARED_LDFLAGS)$(SHARED2) $(CXXFLAGS) $(PLATFORM_SHARED_CFLAGS) $(SOURCES) -o $(SHARED3)
-
-endif  # PLATFORM_SHARED_EXT
-
-all: $(SHARED) $(LIBRARY)
-
-check: all $(PROGRAMS) $(TESTS)
-	for t in $(TESTS); do echo "***** Running $$t"; ./$$t || exit 1; done
-
-clean:
-	-rm -f $(PROGRAMS) $(BENCHMARKS) $(LIBRARY) $(SHARED) $(MEMENVLIBRARY) */*.o */*/*.o ios-x86/*/*.o ios-arm/*/*.o build_config.mk
-	-rm -rf ios-x86/* ios-arm/*
-
-$(LIBRARY): $(LIBOBJECTS)
-	rm -f $@
-	$(AR) -rs $@ $(LIBOBJECTS)
-
-db_bench: db/db_bench.o $(LIBOBJECTS) $(TESTUTIL)
-	$(CXX) db/db_bench.o $(LIBOBJECTS) $(TESTUTIL) -o $@  $(LDFLAGS)
-
-db_bench_sqlite3: doc/bench/db_bench_sqlite3.o $(LIBOBJECTS) $(TESTUTIL)
-	$(CXX) doc/bench/db_bench_sqlite3.o $(LIBOBJECTS) $(TESTUTIL) -o $@ $(LDFLAGS) -lsqlite3
-
-db_bench_tree_db: doc/bench/db_bench_tree_db.o $(LIBOBJECTS) $(TESTUTIL)
-	$(CXX) doc/bench/db_bench_tree_db.o $(LIBOBJECTS) $(TESTUTIL) -o $@ $(LDFLAGS) -lkyotocabinet
-
-arena_test: util/arena_test.o $(LIBOBJECTS) $(TESTHARNESS)
-	$(CXX) util/arena_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LDFLAGS)
-
-bloom_test: util/bloom_test.o $(LIBOBJECTS) $(TESTHARNESS)
-	$(CXX) util/bloom_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LDFLAGS)
-
-c_test: db/c_test.o $(LIBOBJECTS) $(TESTHARNESS)
-	$(CXX) db/c_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LDFLAGS)
-
-cache_test: util/cache_test.o $(LIBOBJECTS) $(TESTHARNESS)
-	$(CXX) util/cache_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LDFLAGS)
-
-coding_test: util/coding_test.o $(LIBOBJECTS) $(TESTHARNESS)
-	$(CXX) util/coding_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LDFLAGS)
-
-corruption_test: db/corruption_test.o $(LIBOBJECTS) $(TESTHARNESS)
-	$(CXX) db/corruption_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LDFLAGS)
-
-crc32c_test: util/crc32c_test.o $(LIBOBJECTS) $(TESTHARNESS)
-	$(CXX) util/crc32c_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LDFLAGS)
-
-db_test: db/db_test.o $(LIBOBJECTS) $(TESTHARNESS)
-	$(CXX) db/db_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LDFLAGS)
-
-dbformat_test: db/dbformat_test.o $(LIBOBJECTS) $(TESTHARNESS)
-	$(CXX) db/dbformat_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LDFLAGS)
-
-env_test: util/env_test.o $(LIBOBJECTS) $(TESTHARNESS)
-	$(CXX) util/env_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LDFLAGS)
-
-filename_test: db/filename_test.o $(LIBOBJECTS) $(TESTHARNESS)
-	$(CXX) db/filename_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LDFLAGS)
-
-filter_block_test: table/filter_block_test.o $(LIBOBJECTS) $(TESTHARNESS)
-	$(CXX) table/filter_block_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LDFLAGS)
-
-log_test: db/log_test.o $(LIBOBJECTS) $(TESTHARNESS)
-	$(CXX) db/log_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LDFLAGS)
-
-table_test: table/table_test.o $(LIBOBJECTS) $(TESTHARNESS)
-	$(CXX) table/table_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LDFLAGS)
-
-skiplist_test: db/skiplist_test.o $(LIBOBJECTS) $(TESTHARNESS)
-	$(CXX) db/skiplist_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LDFLAGS)
-
-version_edit_test: db/version_edit_test.o $(LIBOBJECTS) $(TESTHARNESS)
-	$(CXX) db/version_edit_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LDFLAGS)
-
-version_set_test: db/version_set_test.o $(LIBOBJECTS) $(TESTHARNESS)
-	$(CXX) db/version_set_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LDFLAGS)
-
-write_batch_test: db/write_batch_test.o $(LIBOBJECTS) $(TESTHARNESS)
-	$(CXX) db/write_batch_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LDFLAGS)
-
-$(MEMENVLIBRARY) : $(MEMENVOBJECTS)
-	rm -f $@
-	$(AR) -rs $@ $(MEMENVOBJECTS)
-
-memenv_test : helpers/memenv/memenv_test.o $(MEMENVLIBRARY) $(LIBRARY) $(TESTHARNESS)
-	$(CXX) helpers/memenv/memenv_test.o $(MEMENVLIBRARY) $(LIBRARY) $(TESTHARNESS) -o $@ $(LDFLAGS)
-
-ifeq ($(PLATFORM), IOS)
-# For iOS, create universal object files to be used on both the simulator and
-# a device.
-PLATFORMSROOT=/Applications/Xcode.app/Contents/Developer/Platforms
-SIMULATORROOT=$(PLATFORMSROOT)/iPhoneSimulator.platform/Developer
-DEVICEROOT=$(PLATFORMSROOT)/iPhoneOS.platform/Developer
-IOSVERSION=$(shell defaults read $(PLATFORMSROOT)/iPhoneOS.platform/version CFBundleShortVersionString)
-
-.cc.o:
-	mkdir -p ios-x86/$(dir $@)
-	$(SIMULATORROOT)/usr/bin/$(CXX) $(CXXFLAGS) -isysroot $(SIMULATORROOT)/SDKs/iPhoneSimulator$(IOSVERSION).sdk -arch i686 -c $< -o ios-x86/$@
-	mkdir -p ios-arm/$(dir $@)
-	$(DEVICEROOT)/usr/bin/$(CXX) $(CXXFLAGS) -isysroot $(DEVICEROOT)/SDKs/iPhoneOS$(IOSVERSION).sdk -arch armv6 -arch armv7 -c $< -o ios-arm/$@
-	lipo ios-x86/$@ ios-arm/$@ -create -output $@
-
-.c.o:
-	mkdir -p ios-x86/$(dir $@)
-	$(SIMULATORROOT)/usr/bin/$(CC) $(CFLAGS) -isysroot $(SIMULATORROOT)/SDKs/iPhoneSimulator$(IOSVERSION).sdk -arch i686 -c $< -o ios-x86/$@
-	mkdir -p ios-arm/$(dir $@)
-	$(DEVICEROOT)/usr/bin/$(CC) $(CFLAGS) -isysroot $(DEVICEROOT)/SDKs/iPhoneOS$(IOSVERSION).sdk -arch armv6 -arch armv7 -c $< -o ios-arm/$@
-	lipo ios-x86/$@ ios-arm/$@ -create -output $@
-
-else
-.cc.o:
-	$(CXX) $(CXXFLAGS) -c $< -o $@
-
-.c.o:
-	$(CC) $(CFLAGS) -c $< -o $@
-endif
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..166fc39
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,93 @@
+AC_INIT([leveldb], [1.5.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:5: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..8a0b980
--- /dev/null
+++ b/port/Makefile.am
@@ -0,0 +1,8 @@
+noinst_LTLIBRARIES = libport.la
+
+libport_la_SOURCES = atomic_pointer.h \
+		   port.h \
+		   port_posix.h \
+		   port_posix.cc
+
+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..bb953e5
--- /dev/null
+++ b/util/Makefile.am
@@ -0,0 +1,31 @@
+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 \
+		     testutil.cc
+
+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.7.10.4