configure.ac 3.62 KB
Newer Older
1 2 3 4 5
#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_PREREQ([2.69])
AC_INIT([sds-keyval], [0.1], [robl@mcs.anl.gov])
Rob Latham's avatar
Rob Latham committed
6
AM_INIT_AUTOMAKE([1.13.4 -Wall -Werror foreign subdir-objects silent-rules])
7 8 9
AM_SILENT_RULES([yes])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_SRCDIR([src/sds-keyval.h])
Rob Latham's avatar
Rob Latham committed
10
AC_CONFIG_HEADERS([src/kv-config.h])
11 12 13 14 15 16 17
LT_PREREQ([2.2])
# LT_INIT needs to know about AR
AM_PROG_AR
LT_INIT([dlopen])

# Checks for programs.
AC_PROG_CC
18 19
# subdir objects needs a bit of help
AM_PROG_CC_C_O
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
AC_PROG_CXX
AC_PROG_INSTALL

# Checks for libraries.
# Checks for header files.

# Checks for typedefs, structures, and compiler characteristics.
AC_C_INLINE
AC_TYPE_INT64_T
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T

# Checks for library functions.
AC_FUNC_MALLOC
AC_FUNC_REALLOC

36 37 38 39 40 41
#pkg-config and libraries supporting that
PKG_PROG_PKG_CONFIG
if test "x$PKG_CONFIG" == "x"; then
   AC_MSG_ERROR([Could not find pkg-config utility!])
fi

42 43 44 45 46 47
PKG_CHECK_MODULES([MARGO],[margo],[],
      AC_MSG_ERROR([Could not find working margo installation!]) )
LIBS="$MARGO_LIBS $LIBS"
CPPFLAGS="$MARGO_CFLAGS $CPPFLAGS"
CFLAGS="$MARGO_CFLAGS $CFLAGS"

48 49 50 51 52 53 54 55 56 57 58 59 60
PKG_CHECK_MODULES([SSG], [ssg], [],
		  AC_MSG_ERROR([Could not find ssg]) )
CFLAGS="$SSG_CFLAGS $CFLAGS"
SERVER_LIBS="$SSG_LIBS $SERVER_LIBS"

PKG_CHECK_MODULES([CHPLACEMENT], [ch-placement], [],
		  AC_MSG_ERROR([Could not find ch-placement]) )
CFLAGS="$CHPLACEMENT_CFLAGS $CFLAGS"
SERVER_LIBS="$CHPLAEMENT_LIBS $SERVER_LIBS"

# todo: proper configure checks for boost
SERVER_LIBS="$SERVER_LIBS -lboost_filesystem -lboost_system"

61 62 63 64
# we have three possible backends for our datastore.  If none are selected,
# then nothing will initialize the class and well that doesn't make any sense
# anyway.  Set BwTree as a default option as it's self-contained to the tree.
# Other backends can be selected
65 66

bwtree_backend=yes
67 68 69 70 71 72 73 74 75 76 77 78 79
leveldb_backend=no
berkelydb_backend=no

AC_ARG_ENABLE([berkeleydb],
	      AS_HELP_STRING([--enable-berkeleydb], [Select "berkeleydb" as
			      storage backend (default is no)]),
	      [berkelydb_backend=${enableval}]
)
AC_ARG_ENABLE([leveldb],
	      AS_HELP_STRING([--enable-leveldb], [Select "leveldb" as storage
			      backend (default is no)]),
	      [leveldb_backend=${enableval}]
)
80
AC_ARG_ENABLE([bwtree],
81 82
	     AS_HELP_STRING([--enable-bwtree], [Enable BwTree as server
			     backend.  (default is yes) ]),
83 84 85
	     [bwtree_backend=${enableval}], [bwtree_backend=yes]
)

86 87 88 89 90 91 92 93 94 95

if test "x${berkelydb_backend}" == xyes ; then
	AC_LANG_PUSH([C++])
	AC_CHECK_HEADERS([db_cxx.h], ,
			 AC_ERROR("Could not find Berkely DB C++ headers"))
	AC_CHECK_HEADERS([dbstl_map.h],,
			 AC_ERROR("Could not find Berkely DB STL headers"))
	AC_DEFINE([USE_BDB], 1, [Use Berkely DB backend])
	bwtree_backend=no
	leveldb_backend=no
96
	SERVER_LIBS="${SERVER_LIBS} -ldb_cxx -ldb_stl"
97 98 99 100 101 102 103 104 105
	AC_LANG_POP
fi

if test "x${leveldb_backend}" == xyes ; then
	# spack provides a pkgconfig file for leveldb but other leveldb
	# packages probably do not provide one
	AC_CHECK_HEADERS([leveldb/c.h], ,
			 AC_ERROR("Could not find leveldb headers"))
	AC_DEFINE([USE_LEVELDB], 1, [use leveldb backend])
106
	SERVER_LIBS="${SERVER_LIBS} -lleveldb"
107 108 109 110 111 112
	berkelydb_backend=no
	bwtree_backend=no
fi

if test "x${bwtree_backend}" == xyes ; then
	AC_DEFINE([USE_BWTREE], 1, [use BwTree backend])
Rob Latham's avatar
Rob Latham committed
113 114
	CPPFLAGS="-I${srcdir}/src/BwTree/src ${CPPFLAGS}"

115 116 117
	CXXFLAGS="-pthread -std=c++11 -g -Wall -mcx16 -Wno-invalid-offsetof ${CXXFLAGS}"
	berkeleydb_backend=no
	leveldb_backend=no
118
fi
Rob Latham's avatar
Rob Latham committed
119 120
AM_CONDITIONAL([BUILD_BWTREE], [test "x${bwtree_backend}" == xyes])

121

122
AC_SUBST(SERVER_LIBS)
123
AC_CONFIG_FILES([Makefile maint/kv-client.pc maint/kv-server.pc])
124 125
AC_OUTPUT