Skip to content

Commit

Permalink
Search ev.h also in ${includedir}/libev
Browse files Browse the repository at this point in the history
Change-Id: I046cc4f51adf77e37394745251f4ddaaee4cdbb4
Reviewed-on: http://review.couchbase.org/21548
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Reviewed-by: Trond Norbye <trond.norbye@gmail.com>
  • Loading branch information
avsej authored and trondn committed Oct 12, 2012
1 parent ee02814 commit 2997b0a
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 11 deletions.
14 changes: 13 additions & 1 deletion configure.ac
Expand Up @@ -178,11 +178,15 @@ AC_ARG_WITH([couchbasemock],
AC_CHECK_HEADERS_ONCE([mach/mach_time.h sys/socket.h sys/time.h
netinet/in.h inttypes.h netdb.h unistd.h
ws2tcpip.h winsock2.h event.h stdint.h
sys/uio.h sys/types.h fcntl.h dlfcn.h])
sys/uio.h sys/types.h fcntl.h dlfcn.h
ev.h libev/ev.h])

AS_IF([test "x$ac_cv_header_stdint_h" != "xyes"],
[AC_MSG_ERROR(Failed to locate stdint.h)])

AS_IF([test "x$ac_cv_header_libev_ev_h" = "xyes"],
[AC_DEFINE([HAVE_LIBEV_EV_H], [1], [Have non-standard place for libev header])])

dnl Allow to build library without event library dependency, which is useful
dnl if the application already have one.
AC_ARG_ENABLE([plugins],
Expand Down Expand Up @@ -217,7 +221,11 @@ AC_CACHE_CHECK([for libev3], [ac_cv_have_libev3],
LIBS=-lev
AC_TRY_LINK([
#include <sys/types.h>
#ifdef HAVE_LIBEV_EV_H
#include <libev/ev.h>
#else
#include <ev.h>
#endif
],[
struct ev_loop *loop = ev_loop_new(EVFLAG_AUTO|EVFLAG_NOENV);
ev_loop(loop, 0);
Expand All @@ -238,7 +246,11 @@ AC_CACHE_CHECK([for libev4], [ac_cv_have_libev4],
LIBS=-lev
AC_TRY_LINK([
#include <sys/types.h>
#ifdef HAVE_LIBEV_EV_H
#include <libev/ev.h>
#else
#include <ev.h>
#endif
],[
struct ev_loop *loop = ev_loop_new(EVFLAG_AUTO|EVFLAG_NOENV);
ev_run(loop, 0);
Expand Down
8 changes: 4 additions & 4 deletions plugins/io/libev/libev_io_opts.h
Expand Up @@ -27,7 +27,6 @@
#define LIBCOUCHBASE_LIBEV_IO_OPTS_H 1

#include <libcouchbase/couchbase.h>
#include <ev.h>

#ifdef __cplusplus
extern "C" {
Expand All @@ -37,13 +36,14 @@ extern "C" {
* Create an instance of an event handler that utilize libev for
* event notification.
*
* @param loop the event loop to hook use (please note that you shouldn't
* reference the event loop from multiple threads)
* @param loop the event loop (struct ev_loop *) to hook use (please
* note that you shouldn't reference the event loop from
* multiple threads)
* @param io a pointer to a newly created and initialized event handler
* @return status of the operation
*/
LIBCOUCHBASE_API
lcb_error_t lcb_create_libev_io_opts(lcb_io_opt_t *io, struct ev_loop *loop);
lcb_error_t lcb_create_libev_io_opts(lcb_io_opt_t *io, void *loop);
#ifdef __cplusplus
}
#endif
Expand Down
8 changes: 7 additions & 1 deletion plugins/io/libev/plugin-libev.c
Expand Up @@ -21,6 +21,11 @@
* @author Sergey Avseyev
*/
#include "config.h"
#ifdef HAVE_LIBEV_EV_H
#include <libev/ev.h>
#else
#include <ev.h>
#endif
#include "libev_io_opts.h"
#include <errno.h>
#include <sys/types.h>
Expand Down Expand Up @@ -338,8 +343,9 @@ static void lcb_destroy_io_opts(struct lcb_io_opt_st *iops)
}

LIBCOUCHBASE_API
lcb_error_t lcb_create_libev_io_opts(lcb_io_opt_t *io, struct ev_loop *loop)
lcb_error_t lcb_create_libev_io_opts(lcb_io_opt_t *io, void *arg)
{
struct ev_loop *loop = arg;
struct lcb_io_opt_st *ret = calloc(1, sizeof(*ret));
struct libev_cookie *cookie = calloc(1, sizeof(*cookie));
if (ret == NULL || cookie == NULL) {
Expand Down
8 changes: 4 additions & 4 deletions plugins/io/libevent/libevent_io_opts.h
Expand Up @@ -27,7 +27,6 @@
#define LIBCOUCHBASE_LIBEVENT_IO_OPTS_H 1

#include <libcouchbase/couchbase.h>
#include <event.h>

#ifdef __cplusplus
extern "C" {
Expand All @@ -37,13 +36,14 @@ extern "C" {
* Create an instance of an event handler that utilize libevent for
* event notification.
*
* @param base the event base to hook use (please note that you shouldn't
* reference the event base from multiple threads)
* @param base the event base (struct event_base *) to hook use (please
* note that you shouldn't reference the event base from
* multiple threads)
* @param io a pointer to a newly created and initialized event handler
* @return status of the operation
*/
LIBCOUCHBASE_API
lcb_error_t lcb_create_libevent_io_opts(lcb_io_opt_t *io, struct event_base *base);
lcb_error_t lcb_create_libevent_io_opts(lcb_io_opt_t *io, void *base);

#ifdef __cplusplus
}
Expand Down
4 changes: 3 additions & 1 deletion plugins/io/libevent/plugin-libevent.c
Expand Up @@ -23,6 +23,7 @@
*/

#include "config.h"
#include <event.h>
#include "libevent_io_opts.h"
#include <errno.h>
#include <sys/types.h>
Expand Down Expand Up @@ -329,8 +330,9 @@ static void lcb_destroy_io_opts(struct lcb_io_opt_st *iops)
}

LIBCOUCHBASE_API
lcb_error_t lcb_create_libevent_io_opts(lcb_io_opt_t *io, struct event_base *base)
lcb_error_t lcb_create_libevent_io_opts(lcb_io_opt_t *io, void *arg)
{
struct event_base *base = arg;
struct lcb_io_opt_st *ret = calloc(1, sizeof(*ret));
struct libevent_cookie *cookie = calloc(1, sizeof(*cookie));
if (ret == NULL || cookie == NULL) {
Expand Down

0 comments on commit 2997b0a

Please sign in to comment.