heimdal_build: Try again to sort out the strerror_r mess
[Samba.git] / lib / tevent / wscript
blob684286d8c4ee7c80f69a64357be42cabc7b9df0c
1 #!/usr/bin/env python
3 APPNAME = 'tevent'
4 VERSION = '0.9.17'
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')
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 conf.env.disable_python = getattr(Options.options, 'disable_python', False)
49 if not conf.env.disable_python:
50 # also disable if we don't have the python libs installed
51 conf.find_program('python', var='PYTHON')
52 conf.check_tool('python')
53 conf.check_python_version((2,4,2))
54 conf.SAMBA_CHECK_PYTHON_HEADERS(mandatory=False)
55 if not conf.env.HAVE_PYTHON_H:
56 Logs.warn('Disabling pytevent as python devel libs not found')
57 conf.env.disable_python = True
59 conf.SAMBA_CONFIG_H()
61 conf.SAMBA_CHECK_UNDEFINED_SYMBOL_FLAGS()
63 def build(bld):
64 bld.RECURSE('lib/replace')
65 bld.RECURSE('lib/talloc')
67 SRC = '''tevent.c tevent_debug.c tevent_fd.c tevent_immediate.c
68 tevent_queue.c tevent_req.c tevent_select.c
69 tevent_poll.c
70 tevent_signal.c tevent_standard.c tevent_timed.c tevent_util.c tevent_wakeup.c'''
72 if bld.CONFIG_SET('HAVE_EPOLL'):
73 SRC += ' tevent_epoll.c'
75 if bld.env.standalone_tevent:
76 bld.env.PKGCONFIGDIR = '${LIBDIR}/pkgconfig'
77 private_library = False
78 else:
79 private_library = True
81 if not bld.CONFIG_SET('USING_SYSTEM_TEVENT'):
82 bld.SAMBA_LIBRARY('tevent',
83 SRC,
84 deps='replace talloc',
85 enabled= not bld.CONFIG_SET('USING_SYSTEM_TEVENT'),
86 includes='.',
87 abi_directory='ABI',
88 abi_match='tevent_* _tevent_*',
89 vnum=VERSION,
90 public_headers='tevent.h',
91 public_headers_install=not private_library,
92 pc_files='tevent.pc',
93 private_library=private_library)
95 if not bld.CONFIG_SET('USING_SYSTEM_PYTEVENT'):
96 bld.SAMBA_PYTHON('pytevent',
97 'pytevent.c',
98 deps='tevent',
99 realname='_tevent.so',
100 cflags='-DPACKAGE_VERSION=\"%s\"' % VERSION)
101 # install out various python scripts for use by make test
102 bld.SAMBA_SCRIPT('tevent_python',
103 pattern='tevent.py',
104 installdir='python')
106 bld.INSTALL_WILDCARD('${PYTHONARCHDIR}', 'tevent.py', flat=False)
109 def test(ctx):
110 '''test tevent'''
111 print("The tevent testsuite is part of smbtorture in samba4")
114 def dist():
115 '''makes a tarball for distribution'''
116 samba_dist.dist()
118 def reconfigure(ctx):
119 '''reconfigure if config scripts have changed'''
120 import samba_utils
121 samba_utils.reconfigure(ctx)