2012-08-23 21:30:32 +00:00
|
|
|
#!/usr/bin/python
|
|
|
|
import os
|
2013-01-31 03:46:39 +00:00
|
|
|
import sys
|
2012-08-23 21:30:32 +00:00
|
|
|
|
|
|
|
env = Environment(ENV = os.environ)
|
|
|
|
|
|
|
|
env['HAVE_POSIX_BARRIER'] = True
|
|
|
|
|
2012-12-27 00:50:27 +00:00
|
|
|
env.Append(CPPPATH = ['/usr/local/include', '/opt/local/include'])
|
|
|
|
env.Append(LIBPATH = ['/opt/local/lib'])
|
2014-12-12 05:04:37 +00:00
|
|
|
env.Append(CCFLAGS = '-std=c++11 -D_GNU_SOURCE')
|
2013-01-31 03:46:39 +00:00
|
|
|
if sys.platform == 'darwin':
|
|
|
|
env['CC'] = 'clang'
|
|
|
|
env['CXX'] = 'clang++'
|
2012-08-23 21:30:32 +00:00
|
|
|
|
|
|
|
conf = env.Configure(config_h = "config.h")
|
|
|
|
conf.Define("__STDC_FORMAT_MACROS")
|
|
|
|
if not conf.CheckCXX():
|
|
|
|
print "A compiler with C++11 support is required."
|
|
|
|
Exit(1)
|
|
|
|
print "Checking for gengetopt...",
|
2012-12-27 00:50:27 +00:00
|
|
|
if env.Execute("@which gengetopt &> /dev/null"):
|
2012-08-23 21:30:32 +00:00
|
|
|
print "not found (required)"
|
|
|
|
Exit(1)
|
|
|
|
else: print "found"
|
|
|
|
if not conf.CheckLibWithHeader("event", "event2/event.h", "C++"):
|
|
|
|
print "libevent required"
|
|
|
|
Exit(1)
|
2013-07-01 17:29:49 +00:00
|
|
|
conf.CheckDeclaration("EVENT_BASE_FLAG_PRECISE_TIMER", '#include <event2/event.h>', "C++")
|
2012-08-23 21:30:32 +00:00
|
|
|
if not conf.CheckLibWithHeader("pthread", "pthread.h", "C++"):
|
|
|
|
print "pthread required"
|
|
|
|
Exit(1)
|
|
|
|
conf.CheckLib("rt", "clock_gettime", language="C++")
|
|
|
|
conf.CheckLibWithHeader("zmq", "zmq.hpp", "C++")
|
2012-12-27 00:50:27 +00:00
|
|
|
if not conf.CheckFunc('pthread_barrier_init'):
|
2012-08-23 21:30:32 +00:00
|
|
|
conf.env['HAVE_POSIX_BARRIER'] = False
|
|
|
|
|
|
|
|
env = conf.Finish()
|
|
|
|
|
|
|
|
env.Append(CFLAGS = ' -O3 -Wall -g')
|
2013-07-10 18:09:31 +00:00
|
|
|
env.Append(CPPFLAGS = ' -O3 -Wall -g')
|
2012-08-23 21:30:32 +00:00
|
|
|
|
|
|
|
env.Command(['cmdline.cc', 'cmdline.h'], 'cmdline.ggo', 'gengetopt < $SOURCE')
|
|
|
|
|
|
|
|
src = Split("""mutilate.cc cmdline.cc log.cc distributions.cc util.cc
|
2014-09-12 20:47:01 +00:00
|
|
|
Connection.cc Protocol.cc Generator.cc""")
|
2012-08-23 21:30:32 +00:00
|
|
|
|
|
|
|
if not env['HAVE_POSIX_BARRIER']: # USE_POSIX_BARRIER:
|
|
|
|
src += ['barrier.cc']
|
|
|
|
|
|
|
|
env.Program(target='mutilate', source=src)
|
|
|
|
env.Program(target='gtest', source=['TestGenerator.cc', 'log.cc', 'util.cc',
|
|
|
|
'Generator.cc'])
|