configure evdns and make it compile

svn:r225
This commit is contained in:
Niels Provos 2006-08-13 06:59:37 +00:00
parent cca7249ed6
commit d0d8f9b468
3 changed files with 16 additions and 8 deletions

View File

@ -23,7 +23,7 @@ EXTRA_DIST = acconfig.h event.h event-internal.h log.h evsignal.h event.3 \
lib_LTLIBRARIES = libevent.la lib_LTLIBRARIES = libevent.la
libevent_la_SOURCES = event.c buffer.c evbuffer.c log.c event_tagging.c \ libevent_la_SOURCES = event.c buffer.c evbuffer.c log.c event_tagging.c \
http.c evhttp.h http-internal.h http.c evhttp.h http-internal.h evdns.c evdns.h
libevent_la_LIBADD = @LTLIBOBJS@ libevent_la_LIBADD = @LTLIBOBJS@
libevent_la_LDFLAGS = -release @VERSION@ -version-info 1:3:0 libevent_la_LDFLAGS = -release @VERSION@ -version-info 1:3:0

View File

@ -117,9 +117,15 @@ AC_C_INLINE
AC_HEADER_TIME AC_HEADER_TIME
dnl Checks for library functions. dnl Checks for library functions.
AC_CHECK_FUNCS(gettimeofday vasprintf fcntl clock_gettime) AC_CHECK_FUNCS(gettimeofday vasprintf fcntl clock_gettime strtok_r)
AC_REPLACE_FUNCS(strlcpy) AC_REPLACE_FUNCS(strlcpy)
if test "x$ac_cv_func_clock_gettime" = "xyes"; then
AC_DEFINE(DNS_USE_CPU_CLOCK_FOR_ID, 1, [Define if clock_gettime is available in libc])
else
AC_DEFINE(DNS_USE_GETTIMEOFDAY_FOR_ID, 1, [Define is no secure id variant is available])
fi
AC_MSG_CHECKING(for F_SETFD in fcntl.h) AC_MSG_CHECKING(for F_SETFD in fcntl.h)
AC_EGREP_CPP(yes, AC_EGREP_CPP(yes,
[ [

14
evdns.c
View File

@ -222,8 +222,11 @@
* with the next probe. * with the next probe.
*/ */
#include "eventdns.h" #include <sys/types.h>
#include "eventdns_tor.h" #ifdef HAVE_CONFIG_H
#include "config.h"
#endif
//#define NDEBUG //#define NDEBUG
#ifndef DNS_USE_CPU_CLOCK_FOR_ID #ifndef DNS_USE_CPU_CLOCK_FOR_ID
@ -258,7 +261,6 @@
#define _FORTIFY_SOURCE 3 #define _FORTIFY_SOURCE 3
#include <string.h> #include <string.h>
#include <sys/types.h>
#include <fcntl.h> #include <fcntl.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/time.h> #include <sys/time.h>
@ -276,6 +278,8 @@
#include <stdio.h> #include <stdio.h>
#include <stdarg.h> #include <stdarg.h>
#include "evdns.h"
#ifndef HOST_NAME_MAX #ifndef HOST_NAME_MAX
#define HOST_NAME_MAX 255 #define HOST_NAME_MAX 255
#endif #endif
@ -299,8 +303,6 @@ typedef unsigned int uint;
#define u16 uint16_t #define u16 uint16_t
#define u8 uint8_t #define u8 uint8_t
#include "eventdns.h"
#define MAX_ADDRS 4 // maximum number of addresses from a single packet #define MAX_ADDRS 4 // maximum number of addresses from a single packet
// which we bother recording // which we bother recording
@ -847,7 +849,7 @@ transaction_id_pick(void) {
#ifdef DNS_USE_CPU_CLOCK_FOR_ID #ifdef DNS_USE_CPU_CLOCK_FOR_ID
struct timespec ts; struct timespec ts;
const u16 trans_id = ts.tv_nsec & 0xffff; const u16 trans_id = ts.tv_nsec & 0xffff;
if (clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &ts)) abort(); if (clock_gettime(CLOCK_PROF, &ts)) abort();
#endif #endif
#ifdef DNS_USE_GETTIMEOFDAY_FOR_ID #ifdef DNS_USE_GETTIMEOFDAY_FOR_ID