Detect if we need to use libevent EVENT_BASE_FLAG_PRECISE_TIMER
This commit is contained in:
parent
d7a1ada9d3
commit
da45ef0d79
@ -5,6 +5,7 @@ import sys
|
|||||||
env = Environment(ENV = os.environ)
|
env = Environment(ENV = os.environ)
|
||||||
|
|
||||||
env['HAVE_POSIX_BARRIER'] = True
|
env['HAVE_POSIX_BARRIER'] = True
|
||||||
|
env['HAVE_EVENT_PRECISE_TIMER'] = False
|
||||||
|
|
||||||
env.Append(CPPPATH = ['/usr/local/include', '/opt/local/include'])
|
env.Append(CPPPATH = ['/usr/local/include', '/opt/local/include'])
|
||||||
env.Append(LIBPATH = ['/opt/local/lib'])
|
env.Append(LIBPATH = ['/opt/local/lib'])
|
||||||
@ -26,6 +27,8 @@ else: print "found"
|
|||||||
if not conf.CheckLibWithHeader("event", "event2/event.h", "C++"):
|
if not conf.CheckLibWithHeader("event", "event2/event.h", "C++"):
|
||||||
print "libevent required"
|
print "libevent required"
|
||||||
Exit(1)
|
Exit(1)
|
||||||
|
if conf.CheckDeclaration("EVENT_BASE_FLAG_PRECISE_TIMER", '#include <event2/event.h>', "C++"):
|
||||||
|
conf.env['HAVE_EVENT_PRECISE_TIMER'] = True
|
||||||
if not conf.CheckLibWithHeader("pthread", "pthread.h", "C++"):
|
if not conf.CheckLibWithHeader("pthread", "pthread.h", "C++"):
|
||||||
print "pthread required"
|
print "pthread required"
|
||||||
Exit(1)
|
Exit(1)
|
||||||
|
@ -773,8 +773,10 @@ void do_mutilate(const vector<string>& servers, options_t& options,
|
|||||||
|
|
||||||
if ((config = event_config_new()) == NULL) DIE("event_config_new() fail");
|
if ((config = event_config_new()) == NULL) DIE("event_config_new() fail");
|
||||||
|
|
||||||
|
#ifdef HAVE_DECL_EVENT_BASE_FLAG_PRECISE_TIMER
|
||||||
if (event_config_set_flag(config, EVENT_BASE_FLAG_PRECISE_TIMER))
|
if (event_config_set_flag(config, EVENT_BASE_FLAG_PRECISE_TIMER))
|
||||||
DIE("event_config_set_flag(EVENT_BASE_FLAG_PRECISE_TIMER) fail");
|
DIE("event_config_set_flag(EVENT_BASE_FLAG_PRECISE_TIMER) fail");
|
||||||
|
#endif
|
||||||
|
|
||||||
if ((base = event_base_new_with_config(config)) == NULL)
|
if ((base = event_base_new_with_config(config)) == NULL)
|
||||||
DIE("event_base_new() fail");
|
DIE("event_base_new() fail");
|
||||||
|
Loading…
Reference in New Issue
Block a user