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

AC_PREREQ([2.69])
5
AC_INIT([sds-keyval], [0.1.4], [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
AM_SILENT_RULES([yes])
AC_CONFIG_MACRO_DIR([m4])
9
AC_CONFIG_SRCDIR([src/sdskv-rpc-types.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
AX_CXX_COMPILE_STDCXX(11, noext, mandatory)
37

38 39 40 41 42 43
#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

44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
# coreutils checks for OSX
AC_ARG_VAR([TIMEOUT], timeout program)
AC_ARG_VAR([MKTEMP], mktemp program)

if test -z "$TIMEOUT" ; then
    AC_CHECK_PROGS(TIMEOUT, [timeout gtimeout])
    if test -z "$TIMEOUT" ; then
        AC_MSG_ERROR([Could not find timeout command (can optionally provide via the TIMEOUT variable)])
    fi
else
    AC_SUBST([TIMEOUT], ["$TIMEOUT"])
fi

if test -z "$MKTEMP" ; then
    AC_CHECK_PROGS(MKTEMP, [mktemp gmktemp])
    if test -z "$MKTEMP" ; then
        AC_MSG_ERROR([Could not find mktemp command (can optionally provide via the MKTEMP variable)])
    fi
else
    AC_SUBST([MKTEMP], ["$MKTEMP"])
fi

66 67 68 69 70 71
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"

72 73 74 75 76 77
PKG_CHECK_MODULES([ABTIO],[abt-io],[],
      AC_MSG_ERROR([Could not find working abt-io installation!]) )
LIBS="$ABTIO_LIBS $LIBS"
CPPFLAGS="$ABTIO_CFLAGS $CPPFLAGS"
CFLAGS="$ABTIO_CFLAGS $CFLAGS"

78 79
SERVER_DEPS_PKG=""

80 81 82 83
#PKG_CHECK_MODULES([SSG], [ssg], [],
#		  AC_MSG_ERROR([Could not find ssg]) )
#CFLAGS="$SSG_CFLAGS $CFLAGS"
#SERVER_LIBS_PKG="$SSG_LIBS $SERVER_LIBS_PKG"
84

85 86 87 88 89
#PKG_CHECK_MODULES([CHPLACEMENT], [ch-placement], [],
#		  AC_MSG_ERROR([Could not find ch-placement]) )
#CFLAGS="$CHPLACEMENT_CFLAGS $CFLAGS"
#SERVER_LIBS_PKG="$CHPLAEMENT_LIBS $SERVER_LIBS_PKG"
#GROUP_LIBS="$CHPLACEMENT_LIBS $CLIENT_LIBS"
90

91 92
# uncertain what the lowest Boost we need is.
# Ubuntu 14.04 has boost 1.54. Seems like a good starting point
93 94 95 96
#AX_BOOST_BASE([1.54], ,
#	      AC_MSG_ERROR([sdskeyval requires Boost but was unable to find it]))
#AX_BOOST_SYSTEM
#AX_BOOST_FILESYSTEM
97

98
#SERVER_LIBS_EXT="$SERVER_LIBS_EXT ${BOOST_LDFLAGS} ${BOOST_FILESYSTEM_LIB} ${BOOST_SYSTEM_LIB}"
99

100 101 102 103
# 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
104 105

bwtree_backend=yes
106 107 108
leveldb_backend=no
berkelydb_backend=no

109
SERVER_LIBS_EXT=""
110

111 112 113 114 115
AC_ARG_ENABLE([leveldb],
	      AS_HELP_STRING([--enable-leveldb], [Select "leveldb" as storage
			      backend (default is no)]),
	      [leveldb_backend=${enableval}]
)
116
AC_ARG_ENABLE([bwtree],
117
	     AS_HELP_STRING([--enable-bwtree], [Enable BwTree as server
118 119
			     backend.  (default is no) ]),
	     [bwtree_backend=${enableval}], [bwtree_backend=no]
120 121
)

122 123 124
AC_ARG_WITH([berkeleydb],[AS_HELP_STRING([--with-berkeleydb@<:@=DIR@:>@],
			[location of BerkeleyDB installation])])
if test "x${with_berkeleydb}" != "x" ; then
125
	AC_LANG_PUSH([C++])
126 127
	CPPFLAGS="$CPPFLAGS -I${with_berkeleydb}/include"
	CXXFLAGS="$CXXFLAGS -I${with_berkeleydb}/include"
128
#LIBS="$LIBS -L${with_berkeleydb}/lib/ -ldb_cxx -ldb_stl"
129
	AC_CHECK_HEADERS([db_cxx.h], ,
130
			AC_ERROR("Could not find Berkely DB C++ headers"))
131
	AC_CHECK_HEADERS([dbstl_map.h],,
132
			AC_ERROR("Could not find Berkely DB STL headers"))
133
	AC_DEFINE([USE_BDB], 1, [Use Berkely DB backend])
Matthieu Dorier's avatar
Matthieu Dorier committed
134
	SERVER_LIBS_EXT="${SERVER_LIBS_EXT} -L${with_berkeleydb}/lib -ldb_cxx -ldb_stl"
135
	AC_LANG_POP
136
	berkelydb_backend=yes
137 138 139
fi

if test "x${leveldb_backend}" == xyes ; then
140
        PKG_CHECK_MODULES([LEVELDB],[leveldb],[
141
            SERVER_LIBS_PKG="$LEVELDB_LIBS $SERVER_LIBS_PKG"
142 143
            CPPFLAGS="$LEVELDB_CFLAGS $CPPFLAGS"
            CFLAGS="$LEVELDB_CFLAGS $CFLAGS"
144
            SERVER_DEPS_PKG="${SERVER_DEPS_PKG} leveldb"
145
            AC_DEFINE([USE_LEVELDB], 1, [use leveldb backend])
146 147 148 149 150
        ], [
            # fall back to conventional tests if no pkgconfig
            AC_CHECK_HEADERS([leveldb/c.h], ,
                             AC_ERROR("Could not find leveldb headers"))
            AC_DEFINE([USE_LEVELDB], 1, [use leveldb backend])
151
	    SERVER_LIBS_EXT="${SERVER_LIBS_EXT} -lleveldb"
152
        ])
153 154 155 156
fi

if test "x${bwtree_backend}" == xyes ; then
	AC_DEFINE([USE_BWTREE], 1, [use BwTree backend])
157
	AC_MSG_WARN([BwTree backend is deprecated])
158
	CPPFLAGS="-I${srcdir}/src/BwTree/src ${CPPFLAGS}"
159
	CXXFLAGS="-pthread -g -Wall -mcx16 -Wno-invalid-offsetof ${CXXFLAGS}"
160
fi
Rob Latham's avatar
Rob Latham committed
161

Matthieu Dorier's avatar
Matthieu Dorier committed
162 163 164 165
AM_CONDITIONAL([BUILD_BDB], [test "x${berkelydb_backend}" == xyes])
AM_CONDITIONAL([BUILD_LEVELDB], [test "x${leveldb_backend}" == xyes])
AM_CONDITIONAL([BUILD_BWTREE], [test "x${bwtree_backend}" == xyes])

Matthieu Dorier's avatar
Matthieu Dorier committed
166 167 168 169 170 171 172 173 174 175 176 177 178
AC_ARG_ENABLE(remi,
              [AS_HELP_STRING([--enable-remi],[Enable REMI (migration) support @<:@default=no@:>@])],
              [case "${enableval}" in
                yes) enable_remi="yes" ;;
                no) enable_remi="no" ;;
                *) AC_MSG_ERROR(bad value ${enableval} for --enable-remi) ;;
               esac],
              [enable_remi="no"]
)
AM_CONDITIONAL(ENABLE_REMI, test x$enable_remi = xyes)
if test "$enable_remi" = "yes"; then
        PKG_CHECK_MODULES(REMI, remi)
        AC_DEFINE(USE_REMI, 1, [REMI support enabled.])
179
        SERVER_DEPS_PKG="${SERVER_DEPS_PKG} remi"
Matthieu Dorier's avatar
Matthieu Dorier committed
180 181 182 183 184 185 186 187
        USE_REMI=1
        LIBS="$REMI_LIBS $LIBS"
        CPPFLAGS="$REMI_CFLAGS $CPPFLAGS"
        CFLAGS="$REMI_CFLAGS $CFLAGS"
else
        USE_REMI=0
fi
AC_SUBST(USE_REMI)
188

Matthieu Dorier's avatar
Matthieu Dorier committed
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204
AC_ARG_ENABLE(benchmark,
              [AS_HELP_STRING([--enable-benchmark],[Build SDSKV benchmark @<:@default=no@:>@])],
              [case "${enableval}" in
                yes) enable_benchmark="yes" ;;
                no) enable_benchmark="no" ;;
                *) AC_MSG_ERROR(bad value ${enableval} for --enable-benchmark) ;;
               esac],
              [enable_benchmark="no"]
)
AM_CONDITIONAL(BUILD_BENCHMARK, test x$enable_benchmark = xyes)
if test "$enable_benchmark" = "yes"; then
        PKG_CHECK_MODULES(JSONCPP, jsoncpp)
        LIBS="$JSONCPP_LIBS $LIBS"
        CPPFLAGS="$JSONCPP_CFLAGS $CPPFLAGS"
        CFLAGS="$JSONCPP_CFLAGS $CFLAGS"
fi
205

206
SERVER_LIBS="$SERVER_LIBS_PKG $SERVER_LIBS_EXT -lstdc++"
207

208
AC_SUBST(SERVER_LIBS)
209 210 211
AC_SUBST(SERVER_LIBS_PKG)
AC_SUBST(SERVER_LIBS_EXT)
AC_SUBST(SERVER_DEPS_PKG)
212
AC_SUBST(GROUP_LIBS)
213
AC_CONFIG_FILES([Makefile maint/sdskv-client.pc maint/sdskv-server.pc])
214 215
AC_OUTPUT