From: Wouter Wijngaards Date: Fri, 29 Oct 2010 15:03:20 +0000 (+0000) Subject: - Configure detects libev-4.00. X-Git-Tag: release-1.4.7rc1~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fcf1157fa4f51bbcd962265dd7159cfa7cd06f21;p=thirdparty%2Funbound.git - Configure detects libev-4.00. git-svn-id: file:///svn/unbound/trunk@2322 be551aaa-1e26-0410-a405-d3ace91eadb9 --- diff --git a/config.h.in b/config.h.in index d962977f4..2c72be45f 100644 --- a/config.h.in +++ b/config.h.in @@ -81,6 +81,9 @@ /* Define to 1 if you have the `EVP_sha512' function. */ #undef HAVE_EVP_SHA512 +/* Define to 1 if you have the `ev_default_loop' function. */ +#undef HAVE_EV_DEFAULT_LOOP + /* Define to 1 if you have the `ev_loop' function. */ #undef HAVE_EV_LOOP @@ -824,7 +827,7 @@ struct tm; char *strptime(const char *s, const char *format, struct tm *tm); #endif -#if defined(HAVE_EVENT_H) && !defined(HAVE_EVENT_BASE_ONCE) && (defined(HAVE_PTHREAD) || defined(HAVE_SOLARIS_THREADS)) +#if defined(HAVE_EVENT_H) && !defined(HAVE_EVENT_BASE_ONCE) && !(defined(HAVE_EV_LOOP) || defined(HAVE_EV_DEFAULT_LOOP)) && (defined(HAVE_PTHREAD) || defined(HAVE_SOLARIS_THREADS)) /* using version of libevent that is not threadsafe. */ # define LIBEVENT_SIGNAL_PROBLEM 1 #endif diff --git a/configure b/configure index abb43c943..4929af358 100755 --- a/configure +++ b/configure @@ -15649,6 +15649,17 @@ _ACEOF fi done # only in libev. (tested on 3.51) + for ac_func in ev_default_loop +do : + ac_fn_c_check_func "$LINENO" "ev_default_loop" "ac_cv_func_ev_default_loop" +if test "x$ac_cv_func_ev_default_loop" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_EV_DEFAULT_LOOP 1 +_ACEOF + +fi +done + # only in libev. (tested on 4.00) if test -n "$BAK_LDFLAGS_SET"; then LDFLAGS="$BAK_LDFLAGS" fi diff --git a/configure.ac b/configure.ac index c625b97e4..d3e5d17df 100644 --- a/configure.ac +++ b/configure.ac @@ -549,6 +549,7 @@ large outgoing port ranges. ]) AC_CHECK_FUNCS([event_base_new]) # only in libevent 1.4.1 and later AC_CHECK_FUNCS([event_base_get_method]) # only in libevent 1.4.3 and later AC_CHECK_FUNCS([ev_loop]) # only in libev. (tested on 3.51) + AC_CHECK_FUNCS([ev_default_loop]) # only in libev. (tested on 4.00) if test -n "$BAK_LDFLAGS_SET"; then LDFLAGS="$BAK_LDFLAGS" fi @@ -872,7 +873,7 @@ struct tm; char *strptime(const char *s, const char *format, struct tm *tm); #endif -#if defined(HAVE_EVENT_H) && !defined(HAVE_EVENT_BASE_ONCE) && (defined(HAVE_PTHREAD) || defined(HAVE_SOLARIS_THREADS)) +#if defined(HAVE_EVENT_H) && !defined(HAVE_EVENT_BASE_ONCE) && !(defined(HAVE_EV_LOOP) || defined(HAVE_EV_DEFAULT_LOOP)) && (defined(HAVE_PTHREAD) || defined(HAVE_SOLARIS_THREADS)) /* using version of libevent that is not threadsafe. */ # define LIBEVENT_SIGNAL_PROBLEM 1 #endif diff --git a/daemon/daemon.c b/daemon/daemon.c index 941324759..36b6caae5 100644 --- a/daemon/daemon.c +++ b/daemon/daemon.c @@ -449,7 +449,7 @@ daemon_fork(struct daemon* daemon) */ daemon_create_workers(daemon); -#ifdef HAVE_EV_LOOP +#if defined(HAVE_EV_LOOP) || defined(HAVE_EV_DEFAULT_LOOP) /* in libev the first inited base gets signals */ if(!worker_init(daemon->workers[0], daemon->cfg, daemon->ports, 1)) fatal_exit("Could not initialize main thread"); @@ -463,7 +463,7 @@ daemon_fork(struct daemon* daemon) /* Special handling for the main thread. This is the thread * that handles signals and remote control. */ -#ifndef HAVE_EV_LOOP +#if !(defined(HAVE_EV_LOOP) || defined(HAVE_EV_DEFAULT_LOOP)) /* libevent has the last inited base get signals (or any base) */ if(!worker_init(daemon->workers[0], daemon->cfg, daemon->ports, 1)) fatal_exit("Could not initialize main thread"); diff --git a/daemon/unbound.c b/daemon/unbound.c index 22074985d..b61fd4f34 100644 --- a/daemon/unbound.c +++ b/daemon/unbound.c @@ -89,7 +89,7 @@ /** global debug value to keep track of heap memory allocation */ void* unbound_start_brk = 0; -#if !defined(HAVE_EVENT_BASE_GET_METHOD) && defined(HAVE_EV_LOOP) +#if !defined(HAVE_EVENT_BASE_GET_METHOD) && (defined(HAVE_EV_LOOP) || defined(HAVE_EV_DEFAULT_LOOP)) static const char* ev_backend2str(int b) { switch(b) { @@ -122,11 +122,12 @@ static void get_event_sys(const char** n, const char** s, const char** m) *n = "libevent"; b = event_base_new(); *m = event_base_get_method(b); -# elif defined(HAVE_EV_LOOP) +# elif defined(HAVE_EV_LOOP) || defined(HAVE_EV_DEFAULT_LOOP) *n = "libev"; b = (struct event_base*)ev_default_loop(EVFLAG_AUTO); *m = ev_backend2str(ev_backend((struct ev_loop*)b)); # else + *n = "unknown"; *m = "not obtainable"; b = NULL; # endif diff --git a/doc/Changelog b/doc/Changelog index 32522a8eb..17901e0b6 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -2,6 +2,7 @@ - Fix uninit value in dump_infra print. - Fix validation failure for parent and child on same server with an insecure childzone and a CNAME from parent to child. + - Configure detects libev-4.00. 26 October 2010: Wouter - dump_infra and flush_infra commands for unbound-control. diff --git a/testcode/petal.c b/testcode/petal.c index 5cfc7da54..14a187e3f 100644 --- a/testcode/petal.c +++ b/testcode/petal.c @@ -56,12 +56,14 @@ #include #include #include +#if defined(UNBOUND_ALLOC_LITE) || defined(UNBOUND_ALLOC_STATS) #ifdef malloc #undef malloc #endif #ifdef free #undef free #endif +#endif /* alloc lite or alloc stats */ /** verbosity for this application */ static int verb = 0; diff --git a/util/netevent.c b/util/netevent.c index c04d192e5..aabef4164 100644 --- a/util/netevent.c +++ b/util/netevent.c @@ -176,7 +176,7 @@ comm_base_create(int sigs) /* use mini event time-sharing feature */ b->eb->base = event_init(&b->eb->secs, &b->eb->now); #else -# ifdef HAVE_EV_LOOP +# if defined(HAVE_EV_LOOP) || defined(HAVE_EV_DEFAULT_LOOP) /* libev */ if(sigs) b->eb->base=(struct event_base *)ev_default_loop(EVFLAG_AUTO); @@ -200,7 +200,7 @@ comm_base_create(int sigs) /* avoid event_get_method call which causes crashes even when * not printing, because its result is passed */ verbose(VERB_ALGO, -#ifdef HAVE_EV_LOOP +#if defined(HAVE_EV_LOOP) || defined(HAVE_EV_DEFAULT_LOOP) "libev" #elif defined(USE_MINI_EVENT) "event "