diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2012-01-31 11:10:18 +0100 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2012-01-31 13:44:17 +0100 |
commit | 5c50e08983ff276dc472d00baba7a835dbda6cc5 (patch) | |
tree | 680efc024ba8e80e96e58503a3eead9f740da5cd /lib/replace/wscript | |
parent | bfa951db975417facda3e92d9b1075616e6c7581 (diff) | |
download | samba-5c50e08983ff276dc472d00baba7a835dbda6cc5.tar.gz samba-5c50e08983ff276dc472d00baba7a835dbda6cc5.tar.bz2 samba-5c50e08983ff276dc472d00baba7a835dbda6cc5.zip |
replace: use libbsd for strlcat/strlcpy when available.
Diffstat (limited to 'lib/replace/wscript')
-rw-r--r-- | lib/replace/wscript | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/lib/replace/wscript b/lib/replace/wscript index e4fc72b50e..e85d33cf61 100644 --- a/lib/replace/wscript +++ b/lib/replace/wscript @@ -163,12 +163,18 @@ def configure(conf): conf.CHECK_FUNCS('pipe strftime srandom random srand rand usleep setbuffer') conf.CHECK_FUNCS('lstat getpgrp utime utimes seteuid setreuid setresuid setegid') conf.CHECK_FUNCS('setregid setresgid chroot strerror vsyslog setlinebuf mktime') - conf.CHECK_FUNCS('ftruncate chsize rename waitpid wait4 strlcpy strlcat') + conf.CHECK_FUNCS('ftruncate chsize rename waitpid wait4') conf.CHECK_FUNCS('initgroups pread pwrite strndup strcasestr') conf.CHECK_FUNCS('strtok_r mkdtemp dup2 dprintf vdprintf isatty chown lchown') conf.CHECK_FUNCS('link readlink symlink realpath snprintf vsnprintf') conf.CHECK_FUNCS('asprintf vasprintf setenv unsetenv strnlen strtoull __strtoull') conf.CHECK_FUNCS('strtouq strtoll __strtoll strtoq') + + # libbsd on some platforms provides strlcpy and strlcat + if not conf.CHECK_FUNCS('strlcpy strlcat'): + conf.CHECK_FUNCS_IN('strlcpy strlcat', 'bsd', headers='bsd/string.h', + checklibc=True) + #Some OS (ie. freebsd) return EINVAL if the convertion could not be done, it's not what we expect #Let's detect those cases if conf.CONFIG_SET('HAVE_STRTOLL'): @@ -206,19 +212,19 @@ def configure(conf): if conf.CHECK_FUNCS_IN('clock_gettime', 'rt', checklibc=True): for c in ['CLOCK_MONOTONIC', 'CLOCK_PROCESS_CPUTIME_ID', 'CLOCK_REALTIME']: conf.CHECK_CODE(''' - #if TIME_WITH_SYS_TIME - # include <sys/time.h> - # include <time.h> - #else - # if HAVE_SYS_TIME_H - # include <sys/time.h> - # else - # include <time.h> - # endif - #endif - clockid_t clk = %s''' % c, - 'HAVE_%s' % c, - msg='Checking whether the clock_gettime clock ID %s is available' % c) + #if TIME_WITH_SYS_TIME + # include <sys/time.h> + # include <time.h> + #else + # if HAVE_SYS_TIME_H + # include <sys/time.h> + # else + # include <time.h> + # endif + #endif + clockid_t clk = %s''' % c, + 'HAVE_%s' % c, + msg='Checking whether the clock_gettime clock ID %s is available' % c) conf.CHECK_TYPE('struct timespec', headers='sys/time.h time.h') @@ -436,7 +442,7 @@ def build(bld): # at the moment: # hide_symbols=bld.BUILTIN_LIBRARY('replace'), private_library=True, - deps='crypt dl nsl socket rt') + deps='crypt dl nsl socket rt bsd') bld.SAMBA_SUBSYSTEM('replace-test', source='''test/testsuite.c test/strptime.c |