3c15e3c6d12dada39e6ebf7bd349cdbb7ef89a8c
[awesomized/libmemcached] / m4 / pandora_have_libevent.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 #--------------------------------------------------------------------
7 # Check for libevent
8 #--------------------------------------------------------------------
9
10
11 AC_DEFUN([_PANDORA_SEARCH_LIBEVENT],[
12 AC_REQUIRE([AC_LIB_PREFIX])
13
14 AC_LIB_HAVE_LINKFLAGS(event,,
15 [
16 #include <sys/types.h>
17 #include <sys/time.h>
18 #include <stdlib.h>
19 #include <event.h>
20 ],[
21 struct bufferevent bev;
22 bufferevent_settimeout(&bev, 1, 1);
23 event_init();
24 event_loop(EVLOOP_ONCE);
25 ])
26
27 AM_CONDITIONAL(HAVE_LIBEVENT, [test "x${ac_cv_libevent}" = "xyes"])
28 ])
29
30 AC_DEFUN([_PANDORA_HAVE_LIBEVENT],[
31
32 AC_ARG_ENABLE([libevent],
33 [AS_HELP_STRING([--disable-libevent],
34 [Build with libevent support @<:@default=on@:>@])],
35 [ac_enable_libevent="$enableval"],
36 [ac_enable_libevent="yes"])
37
38 _PANDORA_SEARCH_LIBEVENT
39 ])
40
41
42 AC_DEFUN([PANDORA_HAVE_LIBEVENT],[
43 AC_REQUIRE([_PANDORA_HAVE_LIBEVENT])
44 ])
45
46 AC_DEFUN([_PANDORA_REQUIRE_LIBEVENT],[
47 ac_enable_libevent="yes"
48 _PANDORA_SEARCH_LIBEVENT
49
50 AS_IF([test x$ac_cv_libevent = xno],[
51 AC_MSG_ERROR([libevent is required for ${PACKAGE}. On Debian this can be found in libevent-dev. On RedHat this can be found in libevent-devel.])
52 ])
53 ])
54
55 AC_DEFUN([PANDORA_REQUIRE_LIBEVENT],[
56 AC_REQUIRE([_PANDORA_REQUIRE_LIBEVENT])
57 ])