1 # https://github.com/BrianAker/ddm4
2 # ===========================================================================
6 # AX_LIBEVENT(), AX_LIBEVENT2(), AX_LIBEVENT2_EVHTTP()
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],
25 AC_CACHE_CHECK([test for a working libevent],[ax_cv_libevent],
31 #include <sys/types.h>
36 struct event_base *tmp_event= event_init();
37 event_base_free(tmp_event);
41 [AC_MSG_WARN([test program execution failed])])
46 AS_IF([test "x$ax_cv_libevent" = "xyes"],
47 [LIBEVENT_LDFLAGS="-levent"
48 AC_SUBST(LIBEVENT_LDFLAGS)
49 AC_DEFINE([HAVE_LIBEVENT],[1],[Define if event_init is present in event.h.])],
50 [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>
68 struct event_base *tmp_event= event_init();
69 event_base_free(tmp_event);
71 [ax_cv_libevent2=yes],
73 [AC_MSG_WARN([test program execution failed])])
78 AS_IF([test "x$ax_cv_libevent2" = xyes],
79 [LIBEVENT2_LDFLAGS="-levent"
80 AC_SUBST(LIBEVENT2_LDFLAGS)
81 AC_DEFINE([HAVE_LIBEVENT2],[1],[Define if event_init is present in event2/event.h.])],
82 [AC_DEFINE([HAVE_LIBEVENT2],[0],[Define if event_init is present in event2/event.h.])])
84 AM_CONDITIONAL([HAVE_LIBEVENT2], [test "x$ax_cv_libevent2" = xyes])
87 AC_DEFUN([AX_LIBEVENT2_EVHTTP],
88 [AC_REQUIRE([AX_LIBEVENT2])
89 AC_CACHE_CHECK([test for a working libevent2 evhttp interface], [ax_cv_libevent2_evhttp],
95 #include <sys/types.h>
98 #include <event2/event.h>
99 #include <event2/http.h>
101 struct event_base *libbase= event_base_new();
102 struct evhttp *libsrvr= evhttp_new(libbase);
104 [ax_cv_libevent2_evhttp=yes],
105 [ax_cv_libevent2_evhttp=no],
106 [AC_MSG_WARN([test program execution failed])])
111 AS_IF([test "x$ax_cv_libevent2_evhttp" = "xyes"],
112 [LIBEVENT2_LDFLAGS="-levent"
113 AC_SUBST(LIBEVENT2_LDFLAGS)
114 AC_DEFINE([HAVE_LIBEVENT2],[1],[Define if event_init is present in event2/event.h.])],
115 [AC_DEFINE([HAVE_LIBEVENT2],[0],[Define if event_init is present in event2/event.h.])])
117 AM_CONDITIONAL([HAVE_LIBEVENT2_EVHTTP],[test "x$ax_cv_libevent2_evhttp" = xyes])