Update with job builder.
[awesomized/libmemcached] / m4 / ax_libevent.m4
1 # https://github.com/BrianAker/ddm4
2 # ===========================================================================
3 #
4 # SYNOPSIS
5 #
6 # AX_LIBEVENT()
7 #
8 # DESCRIPTION
9 #
10 # libevent library
11 #
12 # LICENSE
13 #
14 # Copyright (c) 2012 Brian Aker <brian@tangent.org>
15 #
16 # Copying and distribution of this file, with or without modification, are
17 # permitted in any medium without royalty provided the copyright notice
18 # and this notice are preserved. This file is offered as-is, without any
19 # warranty.
20
21 #serial 1
22
23 AC_DEFUN([AX_LIBEVENT],[
24 AC_CACHE_CHECK([test for a working libevent], [ax_cv_libevent], [
25 AX_SAVE_FLAGS
26 LIBS="-levent $LIBS"
27 AC_LANG_PUSH([C])
28 AC_RUN_IFELSE([
29 AC_LANG_PROGRAM([#include <event.h>], [
30 struct event_base *tmp_event= event_init();
31 event_base_free(tmp_event);
32 ])],
33 [ax_cv_libevent=yes],
34 [ax_cv_libevent=no],
35 [AC_MSG_WARN([test program execution failed])])
36 AC_LANG_POP
37 AX_RESTORE_FLAGS
38 ])
39
40 AS_IF([test "x$ax_cv_libevent" = "xyes"],[
41 LIBEVENT_LDFLAGS="-levent"
42 AC_SUBST(LIBEVENT_LDFLAGS)
43 AC_DEFINE([HAVE_LIBEVENT],[1],[Define if event_init is present in event.h.])],[
44 AC_DEFINE([HAVE_LIBEVENT],[0],[Define if event_init is present in event_init.h.])
45 ])
46
47 AM_CONDITIONAL(HAVE_LIBEVENT, test "x$ax_cv_libevent" = "xyes")
48 ])
49