2 Import('hostenv defines')
4 rep_files = ['replace.c', 'snprintf.c','dlfcn.c']
6 if hostenv['configure']:
7 conf = Configure(hostenv)
8 for f in ['memset','syslog','setnetgrent','getnetgrent','endnetgrent', \
10 if not conf.CheckFunc(f,'c'):
11 print "Required function `%s' not found" % f
14 for f in ['strtoull','__strtoull','strtouq','strtoll','__strtoll','strtoq',
15 'seteuid','setresuid','setegid','setresgid','dlsym','dlopen',
16 'dlerror','dlclose','waitpid','getcwd','strdup','strndup',
17 'strnlen','strerror','bzero','chroot','strlcpy','strlcat',
18 'memmove','vsnprintf','asprintf','snprintf','vasprintf',
19 'innetgr','mktime','rename','ftruncate','chsize','setlinebuf',
20 'setenv','vsyslog','pread','pwrite']:
21 if conf.CheckFunc(f,'c'):
22 defines['HAVE_' + f.upper()] = 1
24 # Check for errno declaration
25 if conf.TryCompile("""
32 defines['HAVE_ERRNO_DECL'] = 1
35 if conf.CheckCHeader('dlfcn.h'):
36 defines['HAVE_' + h.upper().replace('.','_').replace('/','_')] = 1
38 if not conf.CheckType('socklen_t', "#include <sys/socket.h>"):
39 defines['socklen_t'] = 'int'
42 'uint_t': 'unsigned int',
43 'int8_t': 'signed char',
44 'uint8_t': 'unsigned char',
45 'u_int8_t': 'unsigned char',
47 'uint16_t': 'unsigned short',
48 'u_int16_t': 'unsigned short',
50 'uint32_t': 'unsigned long',
51 'u_int32_t': 'unsigned long',
52 'int64_t': 'long long',
53 'uint64_t': 'unsigned long long',
59 #include <sys/types.h>
61 for t in needed_types:
62 if not conf.CheckType(t,type_headers):
63 defines[t] = needed_types[t]
65 if not conf.TryRun(open("../../build/tests/os2_delete.c").read(), '.c'):
66 rep_files += ['repdir/repdir.c']
70 hostenv.StaticLibrary('replace', rep_files)
71 SConscript(dirs=['win32'])