1 # https://github.com/BrianAker/ddm4
2 # ===========================================================================
6 # AX_LIBEVENT(), AX_LIBEVENT2()
14 # Copyright (c) 2012 Brian Aker <brian@tangent.org>
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
23 AC_DEFUN([AX_LIBEVENT],[
24 AC_CACHE_CHECK([test for a working libevent], [ax_cv_libevent], [
30 #include <sys/types.h>
35 struct event_base *tmp_event= event_init();
36 event_base_free(tmp_event);
40 [AC_MSG_WARN([test program execution failed])])
45 AS_IF([test "x$ax_cv_libevent" = "xyes"],[
46 LIBEVENT_LDFLAGS="-levent"
47 AC_SUBST(LIBEVENT_LDFLAGS)
48 AC_DEFINE([HAVE_LIBEVENT],[1],[Define if event_init is present in event.h.])],[
49 AC_DEFINE([HAVE_LIBEVENT],[0],[Define if event_init is present in event.h.])
52 AM_CONDITIONAL(HAVE_LIBEVENT, test "x$ax_cv_libevent" = "xyes")
55 AC_DEFUN([AX_LIBEVENT2],[
56 AC_REQUIRE([AX_LIBEVENT])
57 AC_CACHE_CHECK([test for a working libevent version 2], [ax_cv_libevent2], [
63 #include <sys/types.h>
66 #include <event2/event.h>
67 #include <event2/http.h>
69 struct event_base *tmp_event= event_init();
70 event_base_free(tmp_event);
72 [ax_cv_libevent2=yes],
74 [AC_MSG_WARN([test program execution failed])])
79 AS_IF([test "x$ax_cv_libevent2" = "xyes"],[
80 LIBEVENT2_LDFLAGS="-levent"
81 AC_SUBST(LIBEVENT2_LDFLAGS)
82 AC_DEFINE([HAVE_LIBEVENT2],[1],[Define if event_init is present in event2/event.h.])],[
83 AC_DEFINE([HAVE_LIBEVENT2],[0],[Define if event_init is present in event2/event.h.])
86 AM_CONDITIONAL(HAVE_LIBEVENT2, test "x$ax_cv_libevent2" = "xyes")