+ AM_CONDITIONAL([HAVE_LIBEVENT2], [test "x$ax_cv_libevent2" = xyes])
+# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
+ AS_IF([test "x$ax_cv_libevent2" = xyes],
+ [$1],
+ [$2])
+ ])dnl AX_LIBEVENT2
+
+#
+AC_DEFUN([AX_LIBEVENT2_EVHTTP],
+ [AC_REQUIRE([AX_LIBEVENT2])
+ AC_CACHE_CHECK([test for a working libevent2 evhttp interface], [ax_cv_libevent2_evhttp],
+ [AX_SAVE_FLAGS
+ LIBS="-levent $LIBS"
+ AC_LANG_PUSH([C])
+ AC_RUN_IFELSE([AC_LANG_PROGRAM([[
+#include <sys/types.h>
+#include <sys/time.h>
+#include <stdlib.h>
+#include <event2/event.h>
+#include <event2/http.h>
+ ]],[[
+ struct event_base *___event_base= event_base_new();
+ struct evhttp *___evhttp= evhttp_new(___event_base);
+ evhttp_free(___evhttp);
+ event_base_free(___event_base);
+ ]])],
+ [ax_cv_libevent2_evhttp=yes],
+ [ax_cv_libevent2_evhttp=no],
+ [AC_MSG_WARN([test program execution failed])])
+ AC_LANG_POP([C])
+ AX_RESTORE_FLAGS