]> granicus.if.org Git - libevent/commitdiff
configure evdns and make it compile
authorNiels Provos <provos@gmail.com>
Sun, 13 Aug 2006 06:59:37 +0000 (06:59 +0000)
committerNiels Provos <provos@gmail.com>
Sun, 13 Aug 2006 06:59:37 +0000 (06:59 +0000)
svn:r225

Makefile.am
configure.in
evdns.c

index 7b16cad20e04ba2af9dc006a0ced16bdf98b295c..fd90f500306f29ef057e5410ebf4cdb59f9f2373 100644 (file)
@@ -23,7 +23,7 @@ EXTRA_DIST = acconfig.h event.h event-internal.h log.h evsignal.h event.3 \
 lib_LTLIBRARIES = libevent.la
 
 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_LDFLAGS = -release @VERSION@ -version-info 1:3:0
 
index 45ec39e6eff5bb46f1bd6ab4d78371907d1a2b43..a3f0a39e4582d30ca790e9d2fa683405c49ac8cc 100644 (file)
@@ -117,9 +117,15 @@ AC_C_INLINE
 AC_HEADER_TIME
 
 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)
 
+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_EGREP_CPP(yes,
 [
diff --git a/evdns.c b/evdns.c
index afead96f952b72e277f871cbdcb38c8366b7295f..3bccac66db34267477c64e2eac4ba7cee878e711 100644 (file)
--- a/evdns.c
+++ b/evdns.c
  * with the next probe.
  */
 
-#include "eventdns.h"
-#include "eventdns_tor.h"
+#include <sys/types.h>
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 //#define NDEBUG
 
 #ifndef DNS_USE_CPU_CLOCK_FOR_ID
 #define _FORTIFY_SOURCE 3
 
 #include <string.h>
-#include <sys/types.h>
 #include <fcntl.h>
 #include <sys/socket.h>
 #include <sys/time.h>
 #include <stdio.h>
 #include <stdarg.h>
 
+#include "evdns.h"
+
 #ifndef HOST_NAME_MAX
 #define HOST_NAME_MAX 255
 #endif
@@ -299,8 +303,6 @@ typedef unsigned int uint;
 #define u16 uint16_t
 #define u8  uint8_t
 
-#include "eventdns.h"
-
 #define MAX_ADDRS 4  // maximum number of addresses from a single packet
 // which we bother recording
 
@@ -847,7 +849,7 @@ transaction_id_pick(void) {
 #ifdef DNS_USE_CPU_CLOCK_FOR_ID
                struct timespec ts;
                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
 
 #ifdef DNS_USE_GETTIMEOFDAY_FOR_ID