X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=m4%2Fax_libevent.m4;h=c576bad5f082d703c11d41306aa19933c9c6dd39;hb=refs%2Ftags%2Fpre_cmake;hp=41392f9d975899178188bcf992ae0d551759be8f;hpb=b973bd495b75c6c0f7fd38d32e73a8383d4b1dc8;p=awesomized%2Flibmemcached diff --git a/m4/ax_libevent.m4 b/m4/ax_libevent.m4 index 41392f9d..c576bad5 100644 --- a/m4/ax_libevent.m4 +++ b/m4/ax_libevent.m4 @@ -3,7 +3,9 @@ # # SYNOPSIS # -# AX_LIBEVENT(), AX_LIBEVENT2(), AX_LIBEVENT2_EVHTTP() +# AX_LIBEVENT([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) +# AX_LIBEVENT2() +# AX_LIBEVENT2_EVHTTP() # # DESCRIPTION # @@ -18,101 +20,109 @@ # and this notice are preserved. This file is offered as-is, without any # warranty. -#serial 2 +#serial 5 AC_DEFUN([AX_LIBEVENT], [AC_PREREQ([2.63])dnl AC_CACHE_CHECK([test for a working libevent],[ax_cv_libevent], - [AX_SAVE_FLAGS - LIBS="-levent $LIBS" - AC_LANG_PUSH([C]) - AC_RUN_IFELSE([ - AC_LANG_PROGRAM([ + [AX_SAVE_FLAGS + LIBS="-levent $LIBS" + AC_LANG_PUSH([C]) + AC_RUN_IFELSE([AC_LANG_PROGRAM([[ #include #include #include #include - ],[ - struct event_base *tmp_event= event_init(); - event_base_free(tmp_event); - ])], - [ax_cv_libevent=yes], - [ax_cv_libevent=no], - [AC_MSG_WARN([test program execution failed])]) - AC_LANG_POP - AX_RESTORE_FLAGS - ]) + ]],[[ + struct event_base *tmp_event= event_init(); + event_base_free(tmp_event); + ]])], + [ax_cv_libevent=yes], + [ax_cv_libevent=no], + [AC_MSG_WARN([test program execution failed])]) + AC_LANG_POP + AX_RESTORE_FLAGS + ]) AS_IF([test "x$ax_cv_libevent" = "xyes"], - [LIBEVENT_LDFLAGS="-levent" - AC_SUBST(LIBEVENT_LDFLAGS) - AC_DEFINE([HAVE_LIBEVENT],[1],[Define if event_init is present in event.h.])], - [AC_DEFINE([HAVE_LIBEVENT],[0],[Define if event_init is present in event.h.])]) + [AC_SUBST([LIBEVENT_LIB],[-levent]) + AC_DEFINE([HAVE_LIBEVENT],[1],[Define if event_init is present in event.h.])], + [AC_DEFINE([HAVE_LIBEVENT],[0],[Define if event_init is present in event.h.])]) AM_CONDITIONAL(HAVE_LIBEVENT, test "x$ax_cv_libevent" = "xyes") +# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: + AS_IF([test "x$ax_cv_libevent" = xyes], + [$1], + [$2]) ]) - AC_DEFUN([AX_LIBEVENT2], - [AC_REQUIRE([AX_LIBEVENT]) - AC_CACHE_CHECK([test for a working libevent version 2],[ax_cv_libevent2], - [AX_SAVE_FLAGS - LIBS="-levent $LIBS" - AC_LANG_PUSH([C]) - AC_RUN_IFELSE([ - AC_LANG_PROGRAM([ +AC_DEFUN([AX_LIBEVENT2], + [AC_REQUIRE([AX_LIBEVENT]) + AC_CACHE_CHECK([test for a working libevent version 2],[ax_cv_libevent2], + [AX_SAVE_FLAGS + LIBS="-levent $LIBS" + AC_LANG_PUSH([C]) + AC_RUN_IFELSE([AC_LANG_PROGRAM([[ #include #include #include #include - ],[ - struct event_base *tmp_event= event_init(); - event_base_free(tmp_event); - ])], - [ax_cv_libevent2=yes], - [ax_cv_libevent2=no], - [AC_MSG_WARN([test program execution failed])]) - AC_LANG_POP - AX_RESTORE_FLAGS - ]) + ]],[[ + struct event_base *___event_base= event_base_new(); + event_base_free(___event_base); + ]])], + [ax_cv_libevent2=yes], + [ax_cv_libevent2=no], + [AC_MSG_WARN([test program execution failed])]) + AC_LANG_POP([C]) + AX_RESTORE_FLAGS + ]) - AS_IF([test "x$ax_cv_libevent2" = xyes], - [LIBEVENT2_LDFLAGS="-levent" - AC_SUBST(LIBEVENT2_LDFLAGS) - AC_DEFINE([HAVE_LIBEVENT2],[1],[Define if event_init is present in event2/event.h.])], - [AC_DEFINE([HAVE_LIBEVENT2],[0],[Define if event_init is present in event2/event.h.])]) + AS_IF([test "x$ax_cv_libevent2" = xyes], + [AC_SUBST([LIBEVENT2_LIB],[-levent]) + AC_DEFINE([HAVE_LIBEVENT2],[1],[Define if event_init is present in event2/event.h.])], + [AC_DEFINE([HAVE_LIBEVENT2],[0],[Define if event_init is present in event2/event.h.])]) - AM_CONDITIONAL([HAVE_LIBEVENT2], [test "x$ax_cv_libevent2" = xyes]) - ]) + 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([ +# +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 #include #include #include #include - ],[ - struct event_base *libbase= event_base_new(); - struct evhttp *libsrvr= evhttp_new(libbase); - ])], - [ax_cv_libevent2_evhttp=yes], - [ax_cv_libevent2_evhttp=no], - [AC_MSG_WARN([test program execution failed])]) - AC_LANG_POP - AX_RESTORE_FLAGS - ]) + ]],[[ + 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 + ]) - AS_IF([test "x$ax_cv_libevent2_evhttp" = "xyes"], - [LIBEVENT2_LDFLAGS="-levent" - AC_SUBST(LIBEVENT2_LDFLAGS) - AC_DEFINE([HAVE_LIBEVENT2],[1],[Define if event_init is present in event2/event.h.])], - [AC_DEFINE([HAVE_LIBEVENT2],[0],[Define if event_init is present in event2/event.h.])]) + AS_IF([test "x$ax_cv_libevent2_evhttp" = "xyes"], + [AC_DEFINE([HAVE_LIBEVENT2_EVHTTP],[1],[Define if event_init is present in event2/http.h.])], + [AC_DEFINE([HAVE_LIBEVENT2_EVHTTP],[0],[Define if event_init is present in event2/http.h.])]) - AM_CONDITIONAL([HAVE_LIBEVENT2_EVHTTP],[test "x$ax_cv_libevent2_evhttp" = xyes]) - ]) + AM_CONDITIONAL([HAVE_LIBEVENT2_EVHTTP],[test "x$ax_cv_libevent2_evhttp" = xyes]) +# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: + AS_IF([test "x$ax_cv_libevent2_evhttp" = xyes], + [$1], + [$2]) + ])dnl AX_LIBEVENT2_EVHTTP