ctdb-scripts: Drop all public IP addresses from 10.interface
[Samba.git] / lib / tevent / wscript
blob026cd9a1c1b4f996eb46875d40a923de94c960b2
1 #!/usr/bin/env python
3 APPNAME = 'tevent'
4 VERSION = '0.9.24'
6 blddir = 'bin'
8 import sys, os
10 # find the buildtools directory
11 srcdir = '.'
12 while not os.path.exists(srcdir+'/buildtools') and len(srcdir.split('/')) < 5:
13 srcdir = srcdir + '/..'
14 sys.path.insert(0, srcdir + '/buildtools/wafsamba')
16 import wafsamba, samba_dist, Options, Logs
18 samba_dist.DIST_DIRS('lib/tevent:. lib/replace:lib/replace lib/talloc:lib/talloc buildtools:buildtools third_party/waf:third_party/waf')
20 def set_options(opt):
21 opt.BUILTIN_DEFAULT('replace')
22 opt.PRIVATE_EXTENSION_DEFAULT('tevent', noextension='tevent')
23 opt.RECURSE('lib/replace')
24 opt.RECURSE('lib/talloc')
25 if opt.IN_LAUNCH_DIR():
26 opt.add_option('--disable-python',
27 help=("disable the pytevent module"),
28 action="store_true", dest='disable_python', default=False)
31 def configure(conf):
32 conf.RECURSE('lib/replace')
33 conf.RECURSE('lib/talloc')
35 conf.env.standalone_tevent = conf.IN_LAUNCH_DIR()
37 if not conf.env.standalone_tevent:
38 if conf.CHECK_BUNDLED_SYSTEM_PKG('tevent', minversion=VERSION,
39 onlyif='talloc', implied_deps='replace talloc'):
40 conf.define('USING_SYSTEM_TEVENT', 1)
41 if conf.CHECK_BUNDLED_SYSTEM_PYTHON('pytevent', 'tevent', minversion=VERSION):
42 conf.define('USING_SYSTEM_PYTEVENT', 1)
44 if conf.CHECK_FUNCS('epoll_create', headers='sys/epoll.h'):
45 conf.DEFINE('HAVE_EPOLL', 1)
47 tevent_num_signals = 64
48 v = conf.CHECK_VALUEOF('NSIG', headers='signal.h')
49 if v is not None:
50 tevent_num_signals = max(tevent_num_signals, v)
51 v = conf.CHECK_VALUEOF('_NSIG', headers='signal.h')
52 if v is not None:
53 tevent_num_signals = max(tevent_num_signals, v)
54 v = conf.CHECK_VALUEOF('SIGRTMAX', headers='signal.h')
55 if v is not None:
56 tevent_num_signals = max(tevent_num_signals, v)
57 v = conf.CHECK_VALUEOF('SIGRTMIN', headers='signal.h')
58 if v is not None:
59 tevent_num_signals = max(tevent_num_signals, v*2)
61 if not conf.CONFIG_SET('USING_SYSTEM_TEVENT'):
62 conf.DEFINE('TEVENT_NUM_SIGNALS', tevent_num_signals)
64 conf.env.disable_python = getattr(Options.options, 'disable_python', False)
66 if not conf.env.disable_python:
67 # also disable if we don't have the python libs installed
68 conf.find_program('python', var='PYTHON')
69 conf.check_tool('python')
70 conf.check_python_version((2,4,2))
71 conf.SAMBA_CHECK_PYTHON_HEADERS(mandatory=False)
72 if not conf.env.HAVE_PYTHON_H:
73 Logs.warn('Disabling pytevent as python devel libs not found')
74 conf.env.disable_python = True
76 conf.SAMBA_CONFIG_H()
78 conf.SAMBA_CHECK_UNDEFINED_SYMBOL_FLAGS()
80 def build(bld):
81 bld.RECURSE('lib/replace')
82 bld.RECURSE('lib/talloc')
84 SRC = '''tevent.c tevent_debug.c tevent_fd.c tevent_immediate.c
85 tevent_queue.c tevent_req.c tevent_select.c
86 tevent_poll.c
87 tevent_signal.c tevent_standard.c tevent_timed.c tevent_util.c tevent_wakeup.c'''
89 if bld.CONFIG_SET('HAVE_EPOLL'):
90 SRC += ' tevent_epoll.c'
92 if bld.CONFIG_SET('HAVE_SOLARIS_PORTS'):
93 SRC += ' tevent_port.c'
95 if bld.env.standalone_tevent:
96 bld.env.PKGCONFIGDIR = '${LIBDIR}/pkgconfig'
97 private_library = False
98 else:
99 private_library = True
101 if not bld.CONFIG_SET('USING_SYSTEM_TEVENT'):
102 bld.SAMBA_LIBRARY('tevent',
103 SRC,
104 deps='replace talloc',
105 enabled= not bld.CONFIG_SET('USING_SYSTEM_TEVENT'),
106 includes='.',
107 abi_directory='ABI',
108 abi_match='tevent_* _tevent_*',
109 vnum=VERSION,
110 public_headers='tevent.h',
111 public_headers_install=not private_library,
112 pc_files='tevent.pc',
113 private_library=private_library)
115 if not bld.CONFIG_SET('USING_SYSTEM_PYTEVENT') and not bld.env.disable_python:
116 bld.SAMBA_PYTHON('pytevent',
117 'pytevent.c',
118 deps='tevent',
119 realname='_tevent.so',
120 cflags='-DPACKAGE_VERSION=\"%s\"' % VERSION)
121 # install out various python scripts for use by make test
122 bld.SAMBA_SCRIPT('tevent_python',
123 pattern='tevent.py',
124 installdir='python')
126 bld.INSTALL_WILDCARD('${PYTHONARCHDIR}', 'tevent.py', flat=False)
129 def test(ctx):
130 '''test tevent'''
131 print("The tevent testsuite is part of smbtorture in samba4")
134 def dist():
135 '''makes a tarball for distribution'''
136 samba_dist.dist()
138 def reconfigure(ctx):
139 '''reconfigure if config scripts have changed'''
140 import samba_utils
141 samba_utils.reconfigure(ctx)