Updated pandora-build.
[awesomized/libmemcached] / m4 / pandora_have_libmemcached.m4
1 dnl Copyright (C) 2009 Sun Microsystems
2 dnl This file is free software; Sun Microsystems
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 AC_DEFUN([_PANDORA_SEARCH_LIBMEMCACHED],[
7 AC_REQUIRE([AC_LIB_PREFIX])
8
9 dnl --------------------------------------------------------------------
10 dnl Check for libmemcached
11 dnl --------------------------------------------------------------------
12
13 AC_ARG_ENABLE([libmemcached],
14 [AS_HELP_STRING([--disable-libmemcached],
15 [Build with libmemcached support @<:@default=on@:>@])],
16 [ac_enable_libmemcached="$enableval"],
17 [ac_enable_libmemcached="yes"])
18
19 AS_IF([test "x$ac_enable_libmemcached" = "xyes"],[
20 AC_LIB_HAVE_LINKFLAGS(memcached,,[
21 #include <libmemcached/memcached.h>
22 ],[
23 memcached_st memc;
24 memcached_dump_func *df;
25 memcached_lib_version();
26 ])
27 AC_LIB_HAVE_LINKFLAGS(memcachedprotocol,,[
28 #include <libmemcached/protocol_handler.h>
29 ],[
30 struct memcached_protocol_st *protocol_handle= NULL;
31 protocol_handle= memcached_protocol_create_instance();
32 ])
33 ],[
34 ac_cv_libmemcached="no"
35 ])
36
37 AC_CACHE_CHECK([if libmemcached has memcached_server_fn],
38 [pandora_cv_libmemcached_server_fn],
39 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
40 #include <libmemcached/memcached.h>
41 memcached_server_fn callbacks[1];
42 ]])],
43 [pandora_cv_libmemcached_server_fn=yes],
44 [pandora_cv_libmemcached_server_fn=no])])
45 AS_IF([test "x$pandora_cv_libmemcached_server_fn" = "xyes"],[
46 AC_DEFINE([HAVE_MEMCACHED_SERVER_FN],[1],[If we have the new memcached_server_fn typedef])
47 ])
48
49 AM_CONDITIONAL(HAVE_LIBMEMCACHED, [test "x${ac_cv_libmemcached}" = "xyes"])
50
51 ])
52
53 AC_DEFUN([PANDORA_HAVE_LIBMEMCACHED],[
54 AC_REQUIRE([_PANDORA_SEARCH_LIBMEMCACHED])
55 ])
56
57 AC_DEFUN([PANDORA_REQUIRE_LIBMEMCACHED],[
58 AC_REQUIRE([PANDORA_HAVE_LIBMEMCACHED])
59 AS_IF([test x$ac_cv_libmemcached = xno],
60 AC_MSG_ERROR([libmemcached is required for ${PACKAGE}]))
61 ])
62