Commit 9f8828fc authored by vvaltman's avatar vvaltman

Try to add support of libevent 1.4.*

parent d7f9fcc6
/* config.h.in. Generated from configure.ac by autoheader. */
/* Use libevent v1 */
#undef EVENT_V1
/* Use libevent v2 */
#undef EVENT_V2
/* Define to 1 if you have the `alarm' function. */
#undef HAVE_ALARM
......@@ -24,9 +30,6 @@
/* Define to 1 if you have the `config' library (-lconfig). */
#undef HAVE_LIBCONFIG
/* Define to 1 if you have the `edit' library (-ledit). */
#undef HAVE_LIBEDIT
/* Define to 1 if you have the `event' library (-levent). */
#undef HAVE_LIBEVENT
......@@ -143,12 +146,6 @@
/* Use custom prog name */
#undef PROG_NAME
/* Use libedit */
#undef READLINE_EDIT
/* Use gnu libreadline */
#undef READLINE_GNU
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
......
This diff is collapsed.
......@@ -19,6 +19,13 @@ AC_CHECK_LIB([m], [sqrt])
AC_SEARCH_LIBS([clock_gettime], [rt])
AC_SEARCH_LIBS([backtrace], [execinfo])
AC_CHECK_LIB([event], [event_base_new], [], [AC_MSG_ERROR([no libevent found])])
EVENT_VER=""
AC_CHECK_HEADER(event2/event.h, [AC_DEFINE([EVENT_V2], [1], [Use libevent v2])], [
AC_CHECK_HEADER(event.h, [AC_DEFINE([EVENT_V1], [1], [Use libevent v1])], [AC_MSG_ERROR([no libevent found])])
])
EXTRA_LIBS=""
# OPENSSL_INCLUDES to the include directives required
......@@ -28,18 +35,7 @@ EXTRA_LIBS=""
AX_CHECK_OPENSSL(,[AC_MSG_ERROR([No openssl found])])
AX_CHECK_ZLIB(, [AC_MSG_ERROR([No zlib found])])
AC_CHECK_LIB([readline], [rl_save_prompt],
[
AC_DEFINE([READLINE_GNU], [1], [Use gnu libreadline])
[ EXTRA_LIBS="${EXTRA_LIBS} -lreadline" ; ]
],
[
AC_SEARCH_LIBS([tgetnum], [ncursesw ncurses curses])
AC_CHECK_LIB([edit], [rl_set_prompt])
AC_DEFINE([READLINE_EDIT], [1], [Use libedit])
[ EXTRA_LIBS="${EXTRA_LIBS} -ledit" ; ]
]
)
AC_CHECK_LIB([readline], [rl_save_prompt], [ EXTRA_LIBS="${EXTRA_LIBS} -lreadline" ; ], [AC_MSG_ERROR([no libreadline found])])
AC_MSG_CHECKING([for libconfig])
AC_ARG_ENABLE(libconfig,[--enable-libconfig/--disable-libconfig],
......
#ifndef __EVENT_OLD_H__
#define __EVENT_OLD_H__
typedef evutil_socket_t int
static inline struct event *event_new (struct event_base *base, int fd, int what, void(*callback)(int, short, void *), void *arg) {
struct event *ev = malloc (sizeof (*ec));
event_set (ev, base, fd, what, callback, arg);
}
static inline struct event *evtimer_new (struct event_base *base, void(*callback)(int, short, void *), void *arg) {
struct event *ev = malloc (sizeof (*ec));
evtimer_set (ev, base, callback, arg);
}
static void event_free (struct event *ev) {
event_del (ev);
free (ev);
}
#endif
......@@ -42,7 +42,13 @@
#include "interface.h"
#include "telegram.h"
#ifdef EVENT_V2
#include <event2/event.h>
#else
#include <event.h>
#include "event-old.h"
#endif
//#include "auto/constants.h"
//#include "tools.h"
//#include "structures.h"
......
......@@ -43,7 +43,12 @@
#include <sys/stat.h>
#include <fcntl.h>
#ifdef EVENT_V2
#include <event2/event.h>
#else
#include <event.h>
#include "event-old.h"
#endif
#include "interface.h"
#include "telegram.h"
......
......@@ -32,7 +32,12 @@
#include <lua.h>
#include <lualib.h>
#include <lauxlib.h>
#ifdef EVENT_V2
#include <event2/event.h>
#else
#include <event.h>
#include "event-old.h"
#endif
lua_State *luaState;
//#include "interface.h"
......
......@@ -58,7 +58,12 @@
#include "tools.h"
#include "tree.h"
#include "updates.h"
#ifdef EVENT_V2
#include <event2/event.h>
#else
#include <event.h>
#include "event-old.h"
#endif
#if defined(__FreeBSD__)
#define __builtin_bswap32(x) bswap32(x)
......
......@@ -38,7 +38,12 @@
#include <poll.h>
#include <openssl/rand.h>
#include <arpa/inet.h>
#ifdef EVENT_V2
#include <event2/event.h>
#else
#include <event.h>
#include "event-old.h"
#endif
#include <sys/time.h>
#include <time.h>
......
......@@ -54,7 +54,12 @@
#include "updates.h"
#include "auto.h"
#include "tgl.h"
#ifdef EVENT_V2
#include <event2/event.h>
#else
#include <event.h>
#include "event-old.h"
#endif
#define sha1 SHA1
......
......@@ -28,7 +28,12 @@
#include "structures.h"
#include "net.h"
#ifdef EVENT_V2
#include <event2/event.h>
#else
#include <event.h>
#include "event-old.h"
#endif
#include <assert.h>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment