Portable with event1.x, test succeeds on FreeBSD

This commit is contained in:
W.C.A. Wijngaards 2013-11-30 13:53:57 +01:00
parent 0761834cf5
commit 64c057b82d
7 changed files with 49 additions and 9 deletions

View File

@ -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

View File

@ -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

View File

@ -28,9 +28,13 @@
* THE SOFTWARE.
*/
#include "config.h"
#ifdef HAVE_EVENT2_EVENT_H
# include <event2/event.h>
#else
# include <event.h>
#endif
#include <arpa/inet.h>
#include <event2/event.h>
#include <ldns/ldns.h>
#include <string.h>
#include <stdio.h>

View File

@ -34,10 +34,18 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#ifdef HAVE_EVENT2_EVENT_H
# include <event2/event.h>
#else
# include <event.h>
# define evutil_socket_t int
# define event_free free
# define evtimer_new(b, cb, arg) event_new((b), -1, 0, (cb), (arg))
#endif
#include <string.h>
#include <unbound.h>
#include <unbound-event.h>
#include <event2/event.h>
#include <ldns/ldns.h>
#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)

View File

@ -33,10 +33,16 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#ifdef HAVE_EVENT2_EVENT_H
# include <event2/event.h>
#else
# include <event.h>
# define event_free free
#endif
#include "types-internal.h"
#include "util-internal.h"
#include <unbound.h>
#include <event2/event.h>
/* useful macros */
#define gd_malloc(sz) context->malloc(sz)

View File

@ -33,8 +33,13 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#ifdef HAVE_EVENT2_EVENT_H
# include <event2/event.h>
#else
# include <event.h>
#endif
#include <getdns/getdns.h>
#include <event2/event.h>
#include <unbound-event.h>
#include "context.h"
#include "general.h"

View File

@ -26,12 +26,17 @@
* THE SOFTWARE.
*/
#include "config.h"
#ifdef HAVE_EVENT2_EVENT_H
# include <event2/event.h>
#else
# include <event.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "testmessages.h"
#include <getdns/getdns.h>
#include <event2/event.h>
/* Set up the callback function, which will also do the processing of the results */
void