1 # a waf tool to add autoconf-like macros to the configure section
4 from Configure import conf
8 conf.define(d, v, quote=False)
9 conf.env.append_value('CCDEFINES', d + '=' + str(v))
12 def CHECK_HEADERS(conf, list):
13 for hdr in list.rsplit(' '):
14 if conf.check(header_name=hdr):
15 conf.env.hlist.append(hdr)
18 def CHECK_TYPES(conf, list):
19 for t in list.rsplit(' '):
20 conf.check(type_name=t, header_name=conf.env.hlist)
23 def CHECK_TYPE_IN(conf, t, hdr):
24 if conf.check(header_name=hdr):
25 conf.check(type_name=t, header_name=hdr)
28 def CHECK_TYPE(conf, t, alternate):
29 if not conf.check(type_name=t, header_name=conf.env.hlist):
30 conf.DEFUN(t, alternate)
33 def CHECK_FUNCS(conf, list):
34 for f in list.rsplit(' '):
35 conf.check(function_name=f, header_name=conf.env.hlist)
38 def CHECK_FUNCS_IN(conf, list, library):
39 if conf.check(lib=library, uselib_store=library):
40 for f in list.rsplit(' '):
41 conf.check(function_name=f, lib=library, header_name=conf.env.hlist)
43 # we want a different rpath when installing and when building
44 # this should really check if rpath is available on this platform
45 # and it should also honor an --enable-rpath option
48 if Options.is_install:
49 bld.env['RPATH'] = ['-Wl,-rpath=' + bld.env.PREFIX + '/lib']
51 bld.env.append_value('RPATH', '-Wl,-rpath=build/default')
52 Build.BuildContext.set_rpath = set_rpath
54 # this will contain the set of includes needed per Samba library
55 Build.BuildContext.SAMBA_LIBRARY_INCLUDES = {}
57 # this will contain the library dependencies of each Samba library
58 Build.BuildContext.SAMBA_LIBRARY_DEPS = {}
60 #################################################################
61 # return a include list for a set of library dependencies
62 def SAMBA_LIBRARY_INCLUDE_LIST(bld, libdeps):
63 ret = bld.curdir + ' '
64 for l in libdeps.rsplit(' '):
65 if l in bld.SAMBA_LIBRARY_INCLUDES:
66 ret = ret + bld.SAMBA_LIBRARY_INCLUDES[l] + ' '
68 Build.BuildContext.SAMBA_LIBRARY_INCLUDE_LIST = SAMBA_LIBRARY_INCLUDE_LIST
70 #################################################################
71 # define a Samba library
72 def SAMBA_LIBRARY(bld, libname, source_list, libdeps='', include_list=''):
73 ilist = bld.SAMBA_LIBRARY_INCLUDE_LIST(libdeps) + include_list
75 features = 'cc cshlib',
79 bld.SAMBA_LIBRARY_INCLUDES[libname] = ilist
80 Build.BuildContext.SAMBA_LIBRARY = SAMBA_LIBRARY
82 #################################################################
83 # define a Samba binary
84 def SAMBA_BINARY(bld, binname, source_list, libdeps='', include_list=''):
86 features = 'cc cprogram',
89 uselib_local = libdeps,
90 includes = bld.SAMBA_LIBRARY_INCLUDE_LIST(libdeps) + include_list)
91 Build.BuildContext.SAMBA_BINARY = SAMBA_BINARY
94 # this overrides the normal -v debug output to be in a nice
96 def exec_command(self, cmd, **kw):
98 from Logs import debug
100 if isinstance(cmd, list):
102 debug('runner: %s' % _cmd)
104 self.log.write('%s\n' % cmd)
107 if not kw.get('cwd', None):
109 except AttributeError:
110 self.cwd = kw['cwd'] = self.bldnode.abspath()
111 return Utils.exec_command(cmd, **kw)
114 Build.BuildContext.exec_command = exec_command