From c83ce7bcc6dbee5b3b8c9cceb7de698763d2d10e Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 31 Jan 2012 11:25:17 +0100 Subject: replace: Only include C files from which there are actually functions used. Autobuild-User: Jelmer Vernooij Autobuild-Date: Tue Jan 31 15:21:04 CET 2012 on sn-devel-104 --- lib/replace/wscript | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'lib/replace/wscript') diff --git a/lib/replace/wscript b/lib/replace/wscript index e85d33cf61..4b4f0a8a6a 100644 --- a/lib/replace/wscript +++ b/lib/replace/wscript @@ -401,13 +401,32 @@ def configure(conf): conf.SAMBA_CONFIG_H() +REPLACEMENT_FUNCTIONS = { + 'replace.c': ['ftruncate', 'strlcpy', 'strlcat', 'mktime', 'initgroups', + 'memmove', 'strdup', 'setlinebuf', 'vsyslog', 'strnlen', + 'strndup', 'waitpid', 'seteuid', 'setegid', 'chroot', + 'mkstemp', 'mkdtemp', 'pread', 'pwrite', 'strcasestr', + 'strtok_r', 'strtoll', 'strtoull', 'setenv', 'unsetenv', + 'utime', 'utimes', 'dup2', 'chown', 'link', 'readlink', + 'symlink', 'lchown', 'realpath', 'memmem', 'vdprintf', + 'dprintf', 'get_current_dir_name', + 'strerror_r', 'clock_gettime'], + 'timegm.c': ['timegm'], + 'snprintf.c': ['snprintf'], + } + + def build(bld): bld.RECURSE('buildtools/wafsamba') - REPLACE_HOSTCC_SOURCE = 'replace.c snprintf.c' + REPLACE_HOSTCC_SOURCE = '' if bld.CONFIG_SET('REPLACE_STRPTIME'): REPLACE_HOSTCC_SOURCE += ' strptime.c' - if not bld.CONFIG_SET('HAVE_TIMEGM'): REPLACE_HOSTCC_SOURCE += ' timegm.c' + for filename, functions in REPLACEMENT_FUNCTIONS.iteritems(): + for function in functions: + if not bld.CONFIG_SET('HAVE_%s' % function.upper()): + REPLACE_HOSTCC_SOURCE += ' %s' % filename + break bld.SAMBA_SUBSYSTEM('LIBREPLACE_HOSTCC', REPLACE_HOSTCC_SOURCE, -- cgit