diff --git a/Makefile.in b/Makefile.in index 3700736d..e052d610 100644 --- a/Makefile.in +++ b/Makefile.in @@ -63,8 +63,7 @@ $(distdir): cp $(srcdir)/config.sub $(distdir) cp $(srcdir)/config.guess $(distdir) cp $(srcdir)/ltmain.sh $(distdir) - cp $(srcdir)/src/Makefile.in $(distdir)/src - cp $(srcdir)/src/Doxyfile.in $(distdir)/src + cp $(srcdir)/src/*.in $(distdir)/src cp $(srcdir)/src/*.[ch] $(distdir)/src cp $(srcdir)/src/getdns/*.in $(distdir)/src/getdns cp $(srcdir)/src/getdns/*.h $(distdir)/src/getdns diff --git a/configure.ac b/configure.ac index d0b44bc0..06ca9eb9 100644 --- a/configure.ac +++ b/configure.ac @@ -141,7 +141,7 @@ if test -z "$DOXYGEN"; fi # Checks for header files. -AC_CHECK_HEADERS([inttypes.h netinet/in.h stdint.h stdlib.h string.h]) +AC_CHECK_HEADERS([inttypes.h netinet/in.h stdint.h stdlib.h string.h event2/event.h]) # Checks for typedefs, structures, and compiler characteristics. AC_HEADER_STDBOOL @@ -155,4 +155,5 @@ AC_CONFIG_FILES([Makefile src/Makefile src/getdns/Makefile src/example/Makefile if [ test -n "$DOXYGEN" ] then AC_CONFIG_FILES([src/Doxyfile]) fi +AC_CONFIG_HEADER([src/config.h]) AC_OUTPUT diff --git a/src/context.c b/src/context.c index b66642f2..18ec3b48 100644 --- a/src/context.c +++ b/src/context.c @@ -28,9 +28,13 @@ * THE SOFTWARE. */ +#include "config.h" +#ifdef HAVE_EVENT2_EVENT_H +# include +#else +# include +#endif #include - -#include #include #include #include diff --git a/src/general.c b/src/general.c index 8f4f1e39..d33c01cb 100644 --- a/src/general.c +++ b/src/general.c @@ -34,10 +34,18 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" +#ifdef HAVE_EVENT2_EVENT_H +# include +#else +# include +# define evutil_socket_t int +# define event_free free +# define evtimer_new(b, cb, arg) event_new((b), -1, 0, (cb), (arg)) +#endif #include #include #include -#include #include #include "context.h" #include "types-internal.h" @@ -67,6 +75,18 @@ typedef struct netreq_cb_data char *bogus; } netreq_cb_data; +#ifndef HAVE_EVENT2_EVENT_H +static struct event * +event_new(struct event_base *b, evutil_socket_t fd, short ev, void* cb, void *arg) +{ + struct event* e = (struct event*)calloc(1, sizeof(struct event)); + if(!e) return NULL; + event_set(e, fd, ev, cb, arg); + event_base_set(b, e); + return e; +} +#endif /* no event2 */ + /* cancel, cleanup and send timeout to callback */ static void ub_resolve_timeout(evutil_socket_t fd, short what, void *arg) diff --git a/src/request-internal.c b/src/request-internal.c index c7bee15f..ab1db272 100644 --- a/src/request-internal.c +++ b/src/request-internal.c @@ -33,10 +33,16 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" +#ifdef HAVE_EVENT2_EVENT_H +# include +#else +# include +# define event_free free +#endif #include "types-internal.h" #include "util-internal.h" #include -#include /* useful macros */ #define gd_malloc(sz) context->malloc(sz) diff --git a/src/sync.c b/src/sync.c index de265b04..bcd82650 100644 --- a/src/sync.c +++ b/src/sync.c @@ -33,8 +33,13 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" +#ifdef HAVE_EVENT2_EVENT_H +# include +#else +# include +#endif #include -#include #include #include "context.h" #include "general.h" diff --git a/src/test/tests_stub_async.c b/src/test/tests_stub_async.c index 287ce8a4..9c7bbac2 100644 --- a/src/test/tests_stub_async.c +++ b/src/test/tests_stub_async.c @@ -26,12 +26,17 @@ * THE SOFTWARE. */ +#include "config.h" +#ifdef HAVE_EVENT2_EVENT_H +# include +#else +# include +#endif #include #include #include #include "testmessages.h" #include -#include /* Set up the callback function, which will also do the processing of the results */ void