build: amend typo for address sanitizer help
[Samba.git] / buildtools / wafsamba / wscript
blob8027c00dd213eea76f3a6660e14770ba204620bf
1 #!/usr/bin/env python
3 # this is a base set of waf rules that everything else pulls in first
5 import sys, wafsamba, Configure, Logs
6 import Options, os, preproc
7 from samba_utils import *
8 from optparse import SUPPRESS_HELP
10 # this forces configure to be re-run if any of the configure
11 # sections of the build scripts change. We have to check
12 # for this in sys.argv as options have not yet been parsed when
13 # we need to set this. This is off by default until some issues
14 # are resolved related to WAFCACHE. It will need a lot of testing
15 # before it is enabled by default.
16 if '--enable-auto-reconfigure' in sys.argv:
17 Configure.autoconfig = True
19 def set_options(opt):
20 opt.tool_options('compiler_cc')
22 opt.tool_options('gnu_dirs')
24 gr = opt.option_group('library handling options')
26 gr.add_option('--bundled-libraries',
27 help=("comma separated list of bundled libraries. May include !LIBNAME to disable bundling a library. Can be 'NONE' or 'ALL' [auto]"),
28 action="store", dest='BUNDLED_LIBS', default='')
30 gr.add_option('--private-libraries',
31 help=("comma separated list of normally public libraries to build instead as private libraries. May include !LIBNAME to disable making a library private. Can be 'NONE' or 'ALL' [auto]"),
32 action="store", dest='PRIVATE_LIBS', default='')
34 extension_default = Options.options['PRIVATE_EXTENSION_DEFAULT']
35 gr.add_option('--private-library-extension',
36 help=("name extension for private libraries [%s]" % extension_default),
37 action="store", dest='PRIVATE_EXTENSION', default=extension_default)
39 extension_exception = Options.options['PRIVATE_EXTENSION_EXCEPTION']
40 gr.add_option('--private-extension-exception',
41 help=("comma separated list of libraries to not apply extension to [%s]" % extension_exception),
42 action="store", dest='PRIVATE_EXTENSION_EXCEPTION', default=extension_exception)
44 builtin_defauilt = Options.options['BUILTIN_LIBRARIES_DEFAULT']
45 gr.add_option('--builtin-libraries',
46 help=("command separated list of libraries to build directly into binaries [%s]" % builtin_defauilt),
47 action="store", dest='BUILTIN_LIBRARIES', default=builtin_defauilt)
49 gr.add_option('--minimum-library-version',
50 help=("list of minimum system library versions (LIBNAME1:version,LIBNAME2:version)"),
51 action="store", dest='MINIMUM_LIBRARY_VERSION', default='')
53 gr.add_option('--disable-rpath',
54 help=("Disable use of rpath for build binaries"),
55 action="store_true", dest='disable_rpath_build', default=False)
56 gr.add_option('--disable-rpath-install',
57 help=("Disable use of rpath for library path in installed files"),
58 action="store_true", dest='disable_rpath_install', default=False)
59 gr.add_option('--disable-rpath-private-install',
60 help=("Disable use of rpath for private library path in installed files"),
61 action="store_true", dest='disable_rpath_private_install', default=False)
62 gr.add_option('--nonshared-binary',
63 help=("Disable use of shared libs for the listed binaries"),
64 action="store", dest='NONSHARED_BINARIES', default='')
65 gr.add_option('--disable-symbol-versions',
66 help=("Disable use of the --version-script linker option"),
67 action="store_true", dest='disable_symbol_versions', default=False)
69 opt.add_option('--with-modulesdir',
70 help=("modules directory [PREFIX/modules]"),
71 action="store", dest='MODULESDIR', default='${PREFIX}/modules')
73 opt.add_option('--with-privatelibdir',
74 help=("private library directory [PREFIX/lib/%s]" % Utils.g_module.APPNAME),
75 action="store", dest='PRIVATELIBDIR', default=None)
77 opt.add_option('--with-libiconv',
78 help='additional directory to search for libiconv',
79 action='store', dest='iconv_open', default='/usr/local',
80 match = ['Checking for library iconv', 'Checking for iconv_open', 'Checking for header iconv.h'])
81 opt.add_option('--with-gettext',
82 help='additional directory to search for gettext',
83 action='store', dest='gettext_location', default='None')
84 opt.add_option('--without-gettext',
85 help=("Disable use of gettext"),
86 action="store_true", dest='disable_gettext', default=False)
88 gr = opt.option_group('developer options')
90 gr.add_option('-C',
91 help='enable configure cacheing',
92 action='store_true', dest='enable_configure_cache')
93 gr.add_option('--enable-auto-reconfigure',
94 help='enable automatic reconfigure on build',
95 action='store_true', dest='enable_auto_reconfigure')
96 gr.add_option('--enable-debug',
97 help=("Turn on debugging symbols"),
98 action="store_true", dest='debug', default=False)
99 gr.add_option('--enable-developer',
100 help=("Turn on developer warnings and debugging"),
101 action="store_true", dest='developer', default=False)
102 gr.add_option('--picky-developer',
103 help=("Treat all warnings as errors (enable -Werror)"),
104 action="store_true", dest='picky_developer', default=False)
105 gr.add_option('--fatal-errors',
106 help=("Stop compilation on first error (enable -Wfatal-errors)"),
107 action="store_true", dest='fatal_errors', default=False)
108 gr.add_option('--enable-gccdeps',
109 help=("Enable use of gcc -MD dependency module"),
110 action="store_true", dest='enable_gccdeps', default=True)
111 gr.add_option('--timestamp-dependencies',
112 help=("use file timestamps instead of content for build dependencies (BROKEN)"),
113 action="store_true", dest='timestamp_dependencies', default=False)
114 gr.add_option('--pedantic',
115 help=("Enable even more compiler warnings"),
116 action='store_true', dest='pedantic', default=False)
117 gr.add_option('--git-local-changes',
118 help=("mark version with + if local git changes"),
119 action='store_true', dest='GIT_LOCAL_CHANGES', default=False)
120 gr.add_option('--address-sanitizer',
121 help=("Enable address sanitizer compile and linker flags"),
122 action="store_true", dest='address_sanitizer', default=False)
124 gr.add_option('--abi-check',
125 help=("Check ABI signatures for libraries"),
126 action='store_true', dest='ABI_CHECK', default=False)
127 gr.add_option('--abi-check-disable',
128 help=("Disable ABI checking (used with --enable-developer)"),
129 action='store_true', dest='ABI_CHECK_DISABLE', default=False)
130 gr.add_option('--abi-update',
131 help=("Update ABI signature files for libraries"),
132 action='store_true', dest='ABI_UPDATE', default=False)
134 gr.add_option('--show-deps',
135 help=("Show dependency tree for the given target"),
136 dest='SHOWDEPS', default='')
138 gr.add_option('--symbol-check',
139 help=("check symbols in object files against project rules"),
140 action='store_true', dest='SYMBOLCHECK', default=False)
142 gr.add_option('--dup-symbol-check',
143 help=("check for duplicate symbols in object files and system libs (must be configured with --enable-developer)"),
144 action='store_true', dest='DUP_SYMBOLCHECK', default=False)
146 gr.add_option('--why-needed',
147 help=("TARGET:DEPENDENCY check why TARGET needs DEPENDENCY"),
148 action='store', type='str', dest='WHYNEEDED', default=None)
150 gr.add_option('--show-duplicates',
151 help=("Show objects which are included in multiple binaries or libraries"),
152 action='store_true', dest='SHOW_DUPLICATES', default=False)
154 gr = opt.add_option_group('cross compilation options')
156 gr.add_option('--cross-compile',
157 help=("configure for cross-compilation"),
158 action='store_true', dest='CROSS_COMPILE', default=False)
159 gr.add_option('--cross-execute',
160 help=("command prefix to use for cross-execution in configure"),
161 action='store', dest='CROSS_EXECUTE', default='')
162 gr.add_option('--cross-answers',
163 help=("answers to cross-compilation configuration (auto modified)"),
164 action='store', dest='CROSS_ANSWERS', default='')
165 gr.add_option('--hostcc',
166 help=("set host compiler when cross compiling"),
167 action='store', dest='HOSTCC', default=False)
169 # we use SUPPRESS_HELP for these, as they are ignored, and are there only
170 # to allow existing RPM spec files to work
171 opt.add_option('--build',
172 help=SUPPRESS_HELP,
173 action='store', dest='AUTOCONF_BUILD', default='')
174 opt.add_option('--host',
175 help=SUPPRESS_HELP,
176 action='store', dest='AUTOCONF_HOST', default='')
177 opt.add_option('--target',
178 help=SUPPRESS_HELP,
179 action='store', dest='AUTOCONF_TARGET', default='')
180 opt.add_option('--program-prefix',
181 help=SUPPRESS_HELP,
182 action='store', dest='AUTOCONF_PROGRAM_PREFIX', default='')
183 opt.add_option('--disable-dependency-tracking',
184 help=SUPPRESS_HELP,
185 action='store_true', dest='AUTOCONF_DISABLE_DEPENDENCY_TRACKING', default=False)
186 opt.add_option('--disable-silent-rules',
187 help=SUPPRESS_HELP,
188 action='store_true', dest='AUTOCONF_DISABLE_SILENT_RULES', default=False)
190 gr = opt.option_group('dist options')
191 gr.add_option('--sign-release',
192 help='sign the release tarball created by waf dist',
193 action='store_true', dest='SIGN_RELEASE')
194 gr.add_option('--tag',
195 help='tag release in git at the same time',
196 type='string', action='store', dest='TAG_RELEASE')
199 @wafsamba.runonce
200 def configure(conf):
201 conf.env.hlist = []
202 conf.env.srcdir = conf.srcdir
204 if Options.options.timestamp_dependencies:
205 conf.ENABLE_TIMESTAMP_DEPENDENCIES()
207 conf.SETUP_CONFIGURE_CACHE(Options.options.enable_configure_cache)
209 # load our local waf extensions
210 conf.check_tool('gnu_dirs')
211 conf.check_tool('wafsamba')
213 conf.CHECK_CC_ENV()
215 conf.check_tool('compiler_cc')
217 conf.CHECK_STANDARD_LIBPATH()
219 # we need git for 'waf dist'
220 conf.find_program('git', var='GIT')
222 # older gcc versions (< 4.4) does not work with gccdeps, so we have to see if the .d file is generated
223 if Options.options.enable_gccdeps:
224 from TaskGen import feature, after
225 @feature('testd')
226 @after('apply_core')
227 def check_d(self):
228 tsk = self.compiled_tasks[0]
229 tsk.outputs.append(tsk.outputs[0].change_ext('.d'))
231 import Task
232 cc = Task.TaskBase.classes['cc']
233 oldmeth = cc.run
235 cc.run = Task.compile_fun_noshell('cc', '${CC} ${CCFLAGS} ${CPPFLAGS} ${_CCINCFLAGS} ${_CCDEFFLAGS} ${CC_SRC_F}${SRC} ${CC_TGT_F}${TGT[0].abspath(env)}')[0]
236 try:
237 try:
238 conf.check(features='cc testd', fragment='int main() {return 0;}\n', ccflags=['-MD'], mandatory=True, msg='Check for -MD')
239 except:
240 pass
241 else:
242 conf.check_tool('gccdeps', tooldir=conf.srcdir + "/buildtools/wafsamba")
243 finally:
244 cc.run = oldmeth
246 # make the install paths available in environment
247 conf.env.LIBDIR = Options.options.LIBDIR or '${PREFIX}/lib'
248 conf.env.BINDIR = Options.options.BINDIR or '${PREFIX}/bin'
249 conf.env.SBINDIR = Options.options.SBINDIR or '${PREFIX}/sbin'
250 conf.env.MODULESDIR = Options.options.MODULESDIR
251 conf.env.PRIVATELIBDIR = Options.options.PRIVATELIBDIR
252 conf.env.BUNDLED_LIBS = Options.options.BUNDLED_LIBS.split(',')
253 conf.env.PRIVATE_LIBS = Options.options.PRIVATE_LIBS.split(',')
254 conf.env.BUILTIN_LIBRARIES = Options.options.BUILTIN_LIBRARIES.split(',')
255 conf.env.NONSHARED_BINARIES = Options.options.NONSHARED_BINARIES.split(',')
257 conf.env.PRIVATE_EXTENSION = Options.options.PRIVATE_EXTENSION
258 conf.env.PRIVATE_EXTENSION_EXCEPTION = Options.options.PRIVATE_EXTENSION_EXCEPTION.split(',')
260 conf.env.CROSS_COMPILE = Options.options.CROSS_COMPILE
261 conf.env.CROSS_EXECUTE = Options.options.CROSS_EXECUTE
262 conf.env.CROSS_ANSWERS = Options.options.CROSS_ANSWERS
263 conf.env.HOSTCC = Options.options.HOSTCC
265 conf.env.AUTOCONF_BUILD = Options.options.AUTOCONF_BUILD
266 conf.env.AUTOCONF_HOST = Options.options.AUTOCONF_HOST
267 conf.env.AUTOCONF_PROGRAM_PREFIX = Options.options.AUTOCONF_PROGRAM_PREFIX
269 if (conf.env.AUTOCONF_HOST and
270 conf.env.AUTOCONF_BUILD and
271 conf.env.AUTOCONF_BUILD != conf.env.AUTOCONF_HOST):
272 Logs.error('ERROR: Mismatch between --build and --host. Please use --cross-compile instead')
273 sys.exit(1)
274 if conf.env.AUTOCONF_PROGRAM_PREFIX:
275 Logs.error('ERROR: --program-prefix not supported')
276 sys.exit(1)
278 # enable ABI checking for developers
279 conf.env.ABI_CHECK = Options.options.ABI_CHECK or Options.options.developer
280 if Options.options.ABI_CHECK_DISABLE:
281 conf.env.ABI_CHECK = False
282 try:
283 conf.find_program('gdb', mandatory=True)
284 except:
285 conf.env.ABI_CHECK = False
287 conf.env.GIT_LOCAL_CHANGES = Options.options.GIT_LOCAL_CHANGES
289 conf.CHECK_COMMAND(['uname', '-a'],
290 msg='Checking build system',
291 define='BUILD_SYSTEM',
292 on_target=False)
293 conf.CHECK_UNAME()
295 # see if we can compile and run a simple C program
296 conf.CHECK_CODE('printf("hello world")',
297 define='HAVE_SIMPLE_C_PROG',
298 mandatory=True,
299 execute=True,
300 headers='stdio.h',
301 msg='Checking simple C program')
303 # Try to find the right extra flags for -Werror behaviour
304 for f in ["-Werror", # GCC
305 "-errwarn=%all", # Sun Studio
306 "-qhalt=w", # IBM xlc
307 "-w2", # Tru64
309 if conf.CHECK_CFLAGS([f], '''
310 '''):
311 if not 'WERROR_CFLAGS' in conf.env:
312 conf.env['WERROR_CFLAGS'] = []
313 conf.env['WERROR_CFLAGS'].extend([f])
314 break
316 # check which compiler/linker flags are needed for rpath support
317 if not conf.CHECK_LDFLAGS(['-Wl,-rpath,.']) and conf.CHECK_LDFLAGS(['-Wl,-R,.']):
318 conf.env['RPATH_ST'] = '-Wl,-R,%s'
320 # check for rpath
321 if conf.CHECK_LIBRARY_SUPPORT(rpath=True):
322 support_rpath = True
323 conf.env.RPATH_ON_BUILD = not Options.options.disable_rpath_build
324 conf.env.RPATH_ON_INSTALL = (conf.env.RPATH_ON_BUILD and
325 not Options.options.disable_rpath_install)
326 if not conf.env.PRIVATELIBDIR:
327 conf.env.PRIVATELIBDIR = '%s/%s' % (conf.env.LIBDIR, Utils.g_module.APPNAME)
328 conf.env.RPATH_ON_INSTALL_PRIVATE = (
329 not Options.options.disable_rpath_private_install)
330 else:
331 support_rpath = False
332 conf.env.RPATH_ON_INSTALL = False
333 conf.env.RPATH_ON_BUILD = False
334 conf.env.RPATH_ON_INSTALL_PRIVATE = False
335 if not conf.env.PRIVATELIBDIR:
336 # rpath is not possible so there is no sense in having a
337 # private library directory by default.
338 # the user can of course always override it.
339 conf.env.PRIVATELIBDIR = conf.env.LIBDIR
341 if (not Options.options.disable_symbol_versions and
342 conf.CHECK_LIBRARY_SUPPORT(rpath=support_rpath,
343 version_script=True,
344 msg='-Wl,--version-script support')):
345 conf.env.HAVE_LD_VERSION_SCRIPT = True
346 else:
347 conf.env.HAVE_LD_VERSION_SCRIPT = False
349 if conf.CHECK_CFLAGS(['-fvisibility=hidden'] + conf.env.WERROR_CFLAGS):
350 conf.env.VISIBILITY_CFLAGS = '-fvisibility=hidden'
351 conf.CHECK_CODE('''int main(void) { return 0; }
352 __attribute__((visibility("default"))) void vis_foo2(void) {}''',
353 cflags=conf.env.VISIBILITY_CFLAGS,
354 define='HAVE_VISIBILITY_ATTR', addmain=False)
356 if sys.platform.startswith('aix'):
357 conf.DEFINE('_ALL_SOURCE', 1, add_to_cflags=True)
358 # Might not be needed if ALL_SOURCE is defined
359 # conf.DEFINE('_XOPEN_SOURCE', 600, add_to_cflags=True)
361 # we should use the PIC options in waf instead
362 # Some compilo didn't support -fPIC but just print a warning
363 if conf.env['COMPILER_CC'] == "suncc":
364 conf.ADD_CFLAGS('-KPIC', testflags=True)
365 # we really want define here as we need to have this
366 # define even during the tests otherwise detection of
367 # boolean is broken
368 conf.DEFINE('_STDC_C99', 1, add_to_cflags=True)
369 conf.DEFINE('_XPG6', 1, add_to_cflags=True)
370 else:
371 conf.ADD_CFLAGS('-fPIC', testflags=True)
373 # On Solaris 8 with suncc (at least) the flags for the linker to define the name of the
374 # library are not always working (if the command line is very very long and with a lot
375 # files)
377 if conf.env['COMPILER_CC'] == "suncc":
378 save = conf.env['SONAME_ST']
379 conf.env['SONAME_ST'] = '-Wl,-h,%s'
380 if not conf.CHECK_SHLIB_INTRASINC_NAME_FLAGS("Checking if flags %s are ok" % conf.env['SONAME_ST']):
381 conf.env['SONAME_ST'] = save
383 conf.CHECK_INLINE()
385 # check for pkgconfig
386 conf.check_cfg(atleast_pkgconfig_version='0.0.0')
388 conf.DEFINE('_GNU_SOURCE', 1, add_to_cflags=True)
389 conf.DEFINE('_XOPEN_SOURCE_EXTENDED', 1, add_to_cflags=True)
391 # on Tru64 certain features are only available with _OSF_SOURCE set to 1
392 # and _XOPEN_SOURCE set to 600
393 if conf.env['SYSTEM_UNAME_SYSNAME'] == 'OSF1':
394 conf.DEFINE('_OSF_SOURCE', 1, add_to_cflags=True)
395 conf.DEFINE('_XOPEN_SOURCE', 600, add_to_cflags=True)
397 # SCM_RIGHTS is only avail if _XOPEN_SOURCE iѕ defined on IRIX
398 if conf.env['SYSTEM_UNAME_SYSNAME'] == 'IRIX':
399 conf.DEFINE('_XOPEN_SOURCE', 600, add_to_cflags=True)
400 conf.DEFINE('_BSD_TYPES', 1, add_to_cflags=True)
402 # Try to find the right extra flags for C99 initialisers
403 for f in ["", "-AC99", "-qlanglvl=extc99", "-qlanglvl=stdc99", "-c99"]:
404 if conf.CHECK_CFLAGS([f], '''
405 struct foo {int x;char y;};
406 struct foo bar = { .y = 'X', .x = 1 };
407 '''):
408 if f != "":
409 conf.ADD_CFLAGS(f)
410 break
412 # get the base headers we'll use for the rest of the tests
413 conf.CHECK_HEADERS('stdio.h sys/types.h sys/stat.h stdlib.h stddef.h memory.h string.h',
414 add_headers=True)
415 conf.CHECK_HEADERS('strings.h inttypes.h stdint.h unistd.h minix/config.h', add_headers=True)
416 conf.CHECK_HEADERS('ctype.h', add_headers=True)
418 if sys.platform != 'darwin':
419 conf.CHECK_HEADERS('standards.h', add_headers=True)
421 conf.CHECK_HEADERS('stdbool.h stdint.h stdarg.h vararg.h', add_headers=True)
422 conf.CHECK_HEADERS('limits.h assert.h')
424 # see if we need special largefile flags
425 if not conf.CHECK_LARGEFILE():
426 raise Utils.WafError('Samba requires large file support support, but not available on this platform: sizeof(off_t) < 8')
428 if 'HAVE_STDDEF_H' in conf.env and 'HAVE_STDLIB_H' in conf.env:
429 conf.DEFINE('STDC_HEADERS', 1)
431 conf.CHECK_HEADERS('sys/time.h time.h', together=True)
433 if 'HAVE_SYS_TIME_H' in conf.env and 'HAVE_TIME_H' in conf.env:
434 conf.DEFINE('TIME_WITH_SYS_TIME', 1)
436 # cope with different extensions for libraries
437 (root, ext) = os.path.splitext(conf.env.shlib_PATTERN)
438 if ext[0] == '.':
439 conf.define('SHLIBEXT', ext[1:], quote=True)
440 else:
441 conf.define('SHLIBEXT', "so", quote=True)
443 # First try a header check for cross-compile friendlyness
444 conf.CHECK_CODE(code = """#ifdef __BYTE_ORDER
445 #define B __BYTE_ORDER
446 #elif defined(BYTE_ORDER)
447 #define B BYTE_ORDER
448 #endif
450 #ifdef __LITTLE_ENDIAN
451 #define LITTLE __LITTLE_ENDIAN
452 #elif defined(LITTLE_ENDIAN)
453 #define LITTLE LITTLE_ENDIAN
454 #endif
456 #if !defined(LITTLE) || !defined(B) || LITTLE != B
457 #error Not little endian.
458 #endif
459 int main(void) { return 0; }""",
460 addmain=False,
461 headers="endian.h sys/endian.h",
462 define="HAVE_LITTLE_ENDIAN")
463 conf.CHECK_CODE(code = """#ifdef __BYTE_ORDER
464 #define B __BYTE_ORDER
465 #elif defined(BYTE_ORDER)
466 #define B BYTE_ORDER
467 #endif
469 #ifdef __BIG_ENDIAN
470 #define BIG __BIG_ENDIAN
471 #elif defined(BIG_ENDIAN)
472 #define BIG BIG_ENDIAN
473 #endif
475 #if !defined(BIG) || !defined(B) || BIG != B
476 #error Not big endian.
477 #endif
478 int main(void) { return 0; }""",
479 addmain=False,
480 headers="endian.h sys/endian.h",
481 define="HAVE_BIG_ENDIAN")
483 if not conf.CONFIG_SET("HAVE_BIG_ENDIAN") and not conf.CONFIG_SET("HAVE_LITTLE_ENDIAN"):
484 # That didn't work! Do runtime test.
485 conf.CHECK_CODE("""union { int i; char c[sizeof(int)]; } u;
486 u.i = 0x01020304;
487 return u.c[0] == 0x04 && u.c[1] == 0x03 && u.c[2] == 0x02 && u.c[3] == 0x01 ? 0 : 1;""",
488 addmain=True, execute=True,
489 define='HAVE_LITTLE_ENDIAN',
490 msg="Checking for HAVE_LITTLE_ENDIAN - runtime")
491 conf.CHECK_CODE("""union { int i; char c[sizeof(int)]; } u;
492 u.i = 0x01020304;
493 return u.c[0] == 0x01 && u.c[1] == 0x02 && u.c[2] == 0x03 && u.c[3] == 0x04 ? 0 : 1;""",
494 addmain=True, execute=True,
495 define='HAVE_BIG_ENDIAN',
496 msg="Checking for HAVE_BIG_ENDIAN - runtime")
498 # Extra sanity check.
499 if conf.CONFIG_SET("HAVE_BIG_ENDIAN") == conf.CONFIG_SET("HAVE_LITTLE_ENDIAN"):
500 Logs.error("Failed endian determination. The PDP-11 is back?")
501 sys.exit(1)
502 else:
503 if conf.CONFIG_SET("HAVE_BIG_ENDIAN"):
504 conf.DEFINE('WORDS_BIGENDIAN', 1)
506 # check if signal() takes a void function
507 if conf.CHECK_CODE('return *(signal (0, 0)) (0) == 1',
508 define='RETSIGTYPE_INT',
509 execute=False,
510 headers='signal.h',
511 msg='Checking if signal handlers return int'):
512 conf.DEFINE('RETSIGTYPE', 'int')
513 else:
514 conf.DEFINE('RETSIGTYPE', 'void')
516 conf.CHECK_VARIABLE('__FUNCTION__', define='HAVE_FUNCTION_MACRO')
518 conf.CHECK_CODE('va_list ap1,ap2; va_copy(ap1,ap2)',
519 define="HAVE_VA_COPY",
520 msg="Checking for va_copy")
522 conf.CHECK_CODE('''
523 #define eprintf(...) fprintf(stderr, __VA_ARGS__)
524 eprintf("bla", "bar")
525 ''', define='HAVE__VA_ARGS__MACRO')
527 conf.SAMBA_BUILD_ENV()
530 def build(bld):
531 # give a more useful message if the source directory has moved
532 relpath = os_path_relpath(bld.curdir, bld.srcnode.abspath())
533 if relpath.find('../') != -1:
534 Logs.error('bld.curdir %s is not a child of %s' % (bld.curdir, bld.srcnode.abspath()))
535 raise Utils.WafError('''The top source directory has moved. Please run distclean and reconfigure''')
537 bld.CHECK_MAKEFLAGS()
538 bld.SETUP_BUILD_GROUPS()
539 bld.ENFORCE_GROUP_ORDERING()
540 bld.CHECK_PROJECT_RULES()