1 # https://github.com/BrianAker/ddm4
2 # ===========================================================================
6 # AX_LIBEVENT([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
8 # AX_LIBEVENT2_EVHTTP()
16 # Copyright (c) 2012 Brian Aker <brian@tangent.org>
18 # Copying and distribution of this file, with or without modification, are
19 # permitted in any medium without royalty provided the copyright notice
20 # and this notice are preserved. This file is offered as-is, without any
25 AC_DEFUN([AX_LIBEVENT],
27 AC_CACHE_CHECK([test for a working libevent],[ax_cv_libevent],
31 AC_RUN_IFELSE([AC_LANG_PROGRAM([
32 #include <sys/types.h>
37 struct event_base *tmp_event= event_init();
38 event_base_free(tmp_event);
42 [AC_MSG_WARN([test program execution failed])])
47 AS_IF([test "x$ax_cv_libevent" = "xyes"],
48 [AC_SUBST([LIBEVENT_LIB],[-levent])
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")
53 # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
54 AS_IF([test "x$ax_cv_libevent" = xyes],
59 AC_DEFUN([AX_LIBEVENT2],
60 [AC_REQUIRE([AX_LIBEVENT])
61 AC_CACHE_CHECK([test for a working libevent version 2],[ax_cv_libevent2],
65 AC_RUN_IFELSE([AC_LANG_PROGRAM([
66 #include <sys/types.h>
69 #include <event2/event.h>
71 struct event_base *tmp_event= event_init();
72 event_base_free(tmp_event);
74 [ax_cv_libevent2=yes],
76 [AC_MSG_WARN([test program execution failed])])
81 AS_IF([test "x$ax_cv_libevent2" = xyes],
82 [AC_SUBST([LIBEVENT2_LIB],[-levent])
83 AC_DEFINE([HAVE_LIBEVENT2],[1],[Define if event_init is present in event2/event.h.])],
84 [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])
87 # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
88 AS_IF([test "x$ax_cv_libevent2" = xyes],
94 AC_DEFUN([AX_LIBEVENT2_EVHTTP],
95 [AC_REQUIRE([AX_LIBEVENT2])
96 AC_CACHE_CHECK([test for a working libevent2 evhttp interface], [ax_cv_libevent2_evhttp],
100 AC_RUN_IFELSE([AC_LANG_PROGRAM([
101 #include <sys/types.h>
102 #include <sys/time.h>
104 #include <event2/event.h>
105 #include <event2/http.h>
107 struct event_base *libbase= event_base_new();
108 struct evhttp *libsrvr= evhttp_new(libbase);
110 [ax_cv_libevent2_evhttp=yes],
111 [ax_cv_libevent2_evhttp=no],
112 [AC_MSG_WARN([test program execution failed])])
117 AS_IF([test "x$ax_cv_libevent2_evhttp" = "xyes"],
118 [AC_DEFINE([HAVE_LIBEVENT2_EVHTTP],[1],[Define if event_init is present in event2/http.h.])],
119 [AC_DEFINE([HAVE_LIBEVENT2_EVHTTP],[0],[Define if event_init is present in event2/http.h.])])
121 AM_CONDITIONAL([HAVE_LIBEVENT2_EVHTTP],[test "x$ax_cv_libevent2_evhttp" = xyes])
122 # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
123 AS_IF([test "x$ax_cv_libevent2_evhttp" = xyes],
126 ])dnl AX_LIBEVENT2_EVHTTP