Merged trunk.
[awesomized/libmemcached] / m4 / pandora_have_libtokyocabinet.m4
1 dnl Copyright (C) 2009 Sun Microsystems, Inc.
2 dnl This file is free software; Sun Microsystems, Inc.
3 dnl gives unlimited permission to copy and/or distribute it,
4 dnl with or without modifications, as long as this notice is preserved.
5
6 dnl Provides support for finding libtokyocabinet.
7 dnl LIBTOKYOCABINET_CFLAGS will be set, in addition to LIBTOKYOCABINET and LTLIBTOKYOCABINET
8
9 AC_DEFUN([_PANDORA_SEARCH_LIBTOKYOCABINET],[
10 AC_REQUIRE([AC_LIB_PREFIX])
11
12 dnl --------------------------------------------------------------------
13 dnl Check for libtokyocabinet
14 dnl --------------------------------------------------------------------
15
16 AC_ARG_ENABLE([libtokyocabinet],
17 [AS_HELP_STRING([--disable-libtokyocabinet],
18 [Build with libtokyocabinet support @<:@default=on@:>@])],
19 [ac_enable_libtokyocabinet="$enableval"],
20 [ac_enable_libtokyocabinet="yes"])
21
22 AS_IF([test "x$ac_enable_libtokyocabinet" = "xyes"],[
23 AC_LIB_HAVE_LINKFLAGS(tokyocabinet,,[
24 #include <tcutil.h>
25 #include <tcadb.h>
26 ],[
27 const char *test= tcversion;
28 bool ret= tcadboptimize(NULL, "params");
29 ])
30 ],[
31 ac_cv_libtokyocabinet="no"
32 ])
33
34 AS_IF([test "${ac_cv_libtokyocabinet}" = "no" -a "${ac_enable_libtokyocabinet}" = "yes"],[
35
36 PKG_CHECK_MODULES([LIBTOKYOCABINET], [libtokyocabinet >= 1.4.15], [
37 ac_cv_libtokyocabinet=yes
38 LTLIBTOKYOCABINET=${LIBTOKYOCABINET_LIBS}
39 LIBTOKYOCABINET=${LIBTOKYOCABINET_LIBS}
40 ],[test x = y])
41 ])
42
43 AM_CONDITIONAL(HAVE_LIBTOKYOCABINET, [test "${ac_cv_libtokyocabinet}" = "yes"])
44 ])
45
46 AC_DEFUN([PANDORA_HAVE_LIBTOKYOCABINET],[
47 AC_REQUIRE([_PANDORA_SEARCH_LIBTOKYOCABINET])
48 ])
49
50 AC_DEFUN([PANDORA_REQUIRE_LIBTOKYOCABINET],[
51 AC_REQUIRE([_PANDORA_SEARCH_LIBTOKYOCABINET])
52 AS_IF([test "x${ac_cv_libtokyocabinet}" = "xno"],
53 AC_MSG_ERROR([libtokyocabinet is required for ${PACKAGE}. On Debian systems this is found in libtokyocabinet-dev. On RedHat, in tokyocabinet-devel.]))
54 ])