Skip to content

Commit

Permalink
Add --with-libev, because libev is smaller.
Browse files Browse the repository at this point in the history
When both --with-libev and --with-libevent are used, libev takes
precedence.
  • Loading branch information
rkd77 committed Nov 17, 2017
1 parent f52e318 commit 21d36fc
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 19 deletions.
32 changes: 19 additions & 13 deletions configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -1217,30 +1217,36 @@ fi
# ========
# libevent
# ========
AC_ARG_WITH(libevent, [ --with-libevent compile with libevent],
AC_ARG_WITH(libev, [ --with-libev compile with libev (libevent compatibility mode)],
[if test "$withval" = yes; then enable_libev=yes; else enable_libev=no; fi])
cf_have_libev=no
if test "$enable_libev" = yes; then
AC_CHECK_HEADERS(event.h libev/event.h)
if test "$ac_cv_header_event_h" = yes -o "$ac_cv_header_libev_event_h"; then
AC_CHECK_LIB(ev, event_loop)
if test "$ac_cv_lib_ev_event_loop" = yes; then
cf_have_libev=yes
fi
fi
fi

AC_ARG_WITH(libevent, [ --with-libevent compile with libevent. Note that --with-libev has precedence],
[if test "$withval" = yes; then enable_libevent=yes; else enable_libevent=no; fi])

cf_have_libevent=no
if test "$enable_libevent" = yes; then
AC_CHECK_HEADERS(event.h ev-event.h libev/event.h)
if test "$enable_libevent" = yes -a "$cf_have_libev" = no; then
AC_CHECK_HEADERS(event.h ev-event.h)
if test "$ac_cv_header_event_h" = yes; then
AC_CHECK_LIB(event, event_loop)
if test "$ac_cv_lib_event_event_loop" = yes; then
cf_have_libevent=libevent
fi
fi
if test "$cf_have_libevent" = no; then
if test "$ac_cv_header_event_h" = yes -o "$ac_cv_header_ev_event_h" = yes -o "$ac_cv_header_libev_event_h"; then
AC_CHECK_LIB(ev, event_loop)
if test "$ac_cv_lib_ev_event_loop" = yes; then
cf_have_libevent=libev
fi
cf_have_libevent=yes
fi
fi
fi
if test "$cf_have_libevent" != no; then
if test "$cf_have_libev" = yes -o "$cf_have_libevent" = yes; then
AC_HAVE_FUNCS(event_base_set event_get_version event_get_method event_base_free event_base_new event_reinit event_base_get_method event_config_set_flag event_get_struct_event_size)
fi
EL_LOG_CONFIG([CONFIG_LIBEV], [[libev]], [[$cf_have_libev]])
EL_LOG_CONFIG([CONFIG_LIBEVENT], [[libevent]], [[$cf_have_libevent]])


Expand Down
13 changes: 10 additions & 3 deletions src/main/select.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,20 @@
#include <poll.h>
#endif

#if (defined(HAVE_EVENT_H) || defined(HAVE_EV_EVENT_H) || defined(HAVE_LIBEV_EVENT_H)) && (defined(HAVE_LIBEVENT) || defined(HAVE_LIBEV)) && !defined(OPENVMS) && !defined(DOS)
#if defined(HAVE_LIBEV) && !defined(OPENVMS) && !defined(DOS)
#ifdef HAVE_LIBEV_EVENT_H
#include <libev/event.h>
#elif defined(HAVE_EVENT_H)
#include <event.h>
#endif
#define USE_LIBEVENT
#endif

#if (defined(HAVE_EVENT_H) || defined(HAVE_EV_EVENT_H) || defined(HAVE_LIBEV_EVENT_H)) && defined(HAVE_LIBEVENT) && !defined(OPENVMS) && !defined(DOS)
#if defined(HAVE_EVENT_H)
#include <event.h>
#elif defined(HAVE_EV_EVENT_H)
#include <ev-event.h>
#else
#include <libev/event.h>
#endif
#define USE_LIBEVENT
#endif
Expand Down
13 changes: 10 additions & 3 deletions src/main/timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,20 @@

#include <errno.h>

#if (defined(HAVE_EVENT_H) || defined(HAVE_EV_EVENT_H) || defined(HAVE_LIBEV_EVENT_H)) && (defined(HAVE_LIBEVENT) || defined(HAVE_LIBEV)) && !defined(OPENVMS) && !defined(DOS)
#if defined(HAVE_LIBEV) && !defined(OPENVMS) && !defined(DOS)
#ifdef HAVE_LIBEV_EVENT_H
#include <libev/event.h>
#elif defined(HAVE_EVENT_H)
#include <event.h>
#endif
#define USE_LIBEVENT
#endif

#if (defined(HAVE_EVENT_H) || defined(HAVE_EV_EVENT_H) || defined(HAVE_LIBEV_EVENT_H)) && defined(HAVE_LIBEVENT) && !defined(OPENVMS) && !defined(DOS)
#if defined(HAVE_EVENT_H)
#include <event.h>
#elif defined(HAVE_EV_EVENT_H)
#include <ev-event.h>
#else
#include <libev/event.h>
#endif
#define USE_LIBEVENT
#endif
Expand Down

0 comments on commit 21d36fc

Please sign in to comment.