mirror of
https://github.com/samba-team/samba.git
synced 2025-02-07 01:58:28 +03:00
r10456: More SCons fixes:
- Add framework for fallback generating code - Move pread / pwrite replacement functions to libreplace - Support pidl builds correctly - Support asn1 builds correctly - Move OS-specific checks to lib/replace/SConscript
This commit is contained in:
parent
7be3ec4dbb
commit
fbbfad0a1f
@ -6,6 +6,11 @@
|
||||
#
|
||||
# Copyright (C) 2005 Jelmer Vernooij <jelmer@samba.org>
|
||||
# Published under the GNU GPL
|
||||
#
|
||||
# TODO:
|
||||
# - finish fallback code
|
||||
# - finish proto code
|
||||
# - support for init functions
|
||||
|
||||
import cPickle, string, os
|
||||
|
||||
@ -21,7 +26,7 @@ hostenv = Environment(
|
||||
tools=['default','pidl','proto','et','asn1'],
|
||||
options=opts,
|
||||
CPPPATH=['#include','#','#lib'],
|
||||
CPPDEFINES={'_SAMBA_BUILD_': None},
|
||||
CPPDEFINES={'_SAMBA_BUILD_': None},
|
||||
)
|
||||
|
||||
# We don't care about NFS builds...
|
||||
@ -114,23 +119,17 @@ if hostenv['configure']:
|
||||
['strings.h','stdlib.h','sys/vfs.h','sys/fs/s5param.h','sys/filsys.h'] + \
|
||||
['termios.h','termio.h','fnmatch.h','pwd.h','sys/termio.h'] + \
|
||||
['sys/time.h','sys/statfs.h','sys/statvfs.h','stdarg.h'] + \
|
||||
['security/pam_modules.h','security/_pam_macros.h','dlfcn.h'] + \
|
||||
['sys/syslog.h','syslog.h','stdint.h','inttypes.h','locale.h'] + \
|
||||
['shadow.h','nss.h','nss_common.h','ns_api.h','sys/security.h'] + \
|
||||
['security/pam_appl.h','sys/capability.h','syscall.h','sys/syscall.h'] + \
|
||||
['security/pam_appl.h','sys/capability.h'] + \
|
||||
['sys/acl.h','stdbool.h']:
|
||||
if conf.CheckCHeader(h):
|
||||
defines['HAVE_' + h.upper().replace('.','_').replace('/','_')] = 1
|
||||
|
||||
for f in ['dlopen','dlsym','dlerror','waitpid','getcwd','strdup'] + \
|
||||
['strndup','strnlen','strerror','chroot','bzero','memset','strlcpy'] + \
|
||||
['strlcat','memmove','vsnprintf','snprintf','asprintf','vasprintf'] + \
|
||||
['setsid','pipe','crypt16','getauthuid','strftime','sigprocmask'] + \
|
||||
['sigblock','sigaction','innetgr','setnetgrent','getnetgrent'] + \
|
||||
['endnetgrent','initgroups','setgroups','sysconf','mktime','rename'] + \
|
||||
['ftruncate','chsize','getpwanam','setlinebuf','srandom','random'] + \
|
||||
['srand','rand','setenv','usleep','syslog','vsyslog','timegm'] + \
|
||||
['backtrace','setbuffer','pread','pwrite']:
|
||||
for f in ['setsid','pipe','crypt16','getauthuid','strftime','sigprocmask',
|
||||
'sigblock','sigaction','initgroups','setgroups','sysconf', 'getpwanam',
|
||||
'setlinebuf','srandom','random','srand','rand','usleep','timegm',
|
||||
'backtrace','setbuffer']:
|
||||
if conf.CheckFunc(f):
|
||||
defines['HAVE_' + f.upper()] = 1
|
||||
|
||||
@ -210,7 +209,7 @@ SConscript(
|
||||
dirs=['lib','torture','rpc_server','cldap_server','libcli',
|
||||
'nbt_server','client','ldap_server','libnet','nsswitch','web_server',
|
||||
'smbd','dsdb','heimdal_build','ntptr','kdc','smb_server','ntvfs',
|
||||
'winbind','scripting','auth', 'librpc'])
|
||||
'winbind','scripting','auth', 'librpc','script/tests'])
|
||||
|
||||
hostenv.CProtoHeader(target='include/proto.h',source=proto_files)
|
||||
|
||||
|
@ -102,7 +102,7 @@ AC_FUNC_MEMCMP
|
||||
AC_CHECK_FUNCS(setsid pipe crypt16 getauthuid)
|
||||
AC_CHECK_FUNCS(strftime sigprocmask sigblock sigaction)
|
||||
AC_CHECK_FUNCS(setgroups sysconf getpwanam srandom random srand rand usleep)
|
||||
AC_CHECK_FUNCS(backtrace setbuffer pread pwrite)
|
||||
AC_CHECK_FUNCS(backtrace setbuffer)
|
||||
|
||||
# Assume non-shared by default and override below
|
||||
BLDSHARED="false"
|
||||
@ -393,9 +393,6 @@ if test x"$samba_cv_HAVE_KERNEL_SHARE_MODES" = x"yes"; then
|
||||
AC_DEFINE(HAVE_KERNEL_SHARE_MODES,1,[Whether the kernel supports share modes])
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
AC_CACHE_CHECK([for IRIX kernel oplock type definitions],samba_cv_HAVE_KERNEL_OPLOCKS_IRIX,[
|
||||
AC_TRY_COMPILE([#include <sys/types.h>
|
||||
#include <fcntl.h>],
|
||||
|
@ -17,17 +17,20 @@ def asn1_emitter(target,source,env):
|
||||
contents = node.get_contents()
|
||||
for j in output_re.findall(contents):
|
||||
targets.append(str(node.get_dir()) + '/asn1_' + j + '.c')
|
||||
targets.append("%s/%s.h" % (str(node.get_dir()), env['ASN1PREFIX']))
|
||||
return targets, source
|
||||
|
||||
asn1_builder = SCons.Builder.Builder(action='$ASN1COM',
|
||||
src_suffix = '.asn1',
|
||||
suffix='.c',
|
||||
single_source=True,
|
||||
emitter = asn1_emitter)
|
||||
|
||||
def generate(env):
|
||||
env['ASN1'] = './bin/asn1_compile'
|
||||
env['ASN1COM'] = '$ASN1 $SOURCE'
|
||||
env['BUILDERS']['ASN1'] = asn1_builder
|
||||
env['ASN1'] = './bin/asn1_compile'
|
||||
env['ASN1PREFIX'] = 'asn1'
|
||||
env['ASN1COM'] = 'cd ${SOURCE.dir} && $ASN1 $ASN1PREFIX ${SOURCE.file}'
|
||||
env['BUILDERS']['ASN1'] = asn1_builder
|
||||
|
||||
def exists(env):
|
||||
return env.Detect('asn1_compile')
|
||||
|
34
source/build/scons/fallback.py
Normal file
34
source/build/scons/fallback.py
Normal file
@ -0,0 +1,34 @@
|
||||
# Generate fallback configure + Makefile
|
||||
# Copyright (C) 2005 Jelmer Vernooij <jelmer@samba.org>
|
||||
|
||||
# No support for:
|
||||
# - cross-compilation
|
||||
# - caching
|
||||
# - config.status (?)
|
||||
|
||||
import SCons.Defaults
|
||||
import SCons.Util
|
||||
import SCons.Tool
|
||||
|
||||
# Configure structure:
|
||||
# - Check for available tools first
|
||||
# - Check for available tool capabilities (C99, volatile, etc)
|
||||
# - Check for available `base' headers
|
||||
# - Check for available types
|
||||
# - Check for libs / headers
|
||||
def configure_builder(target, source, env):
|
||||
pass
|
||||
|
||||
# Makefile structure:
|
||||
# - Declare all variables first
|
||||
# - Declare targets + dependencies + actions
|
||||
|
||||
def makefile_builder(target, source, env):
|
||||
pass
|
||||
|
||||
def generate(env):
|
||||
env['BUILDERS']['ConfigureScript'] = configure_builder
|
||||
env['BUILDERS']['MakefileIn'] = makefile_in_builder
|
||||
|
||||
def exists(env):
|
||||
return 1
|
@ -1,81 +0,0 @@
|
||||
# Based on the M4 macro by Bruno Haible.
|
||||
|
||||
def exists(env):
|
||||
return True
|
||||
|
||||
def generate(env):
|
||||
env['custom_tests']['CheckIconv'] = CheckIconv
|
||||
|
||||
def _CheckIconvPath(context,path):
|
||||
# Some systems have iconv in libc, some have it in libiconv (OSF/1 and
|
||||
# those with the standalone portable libiconv installed).
|
||||
context.Message("checking for iconv in " + path)
|
||||
|
||||
main = """
|
||||
int main()
|
||||
{
|
||||
iconv_t cd = iconv_open("","");
|
||||
iconv(cd,NULL,NULL,NULL,NULL);
|
||||
iconv_close(cd);
|
||||
return 0;
|
||||
}"""
|
||||
|
||||
have_giconv_iconv = context.TryLink("""
|
||||
#include <stdlib.h>
|
||||
#include <giconv.h>
|
||||
""" + main, '.c')
|
||||
if have_giconv_iconv:
|
||||
context.Result(1)
|
||||
return ("giconv.h", "")
|
||||
|
||||
have_iconv_iconv = context.TryLink("""
|
||||
#include <stdlib.h>
|
||||
#include <iconv.h>
|
||||
""" + main, '.c')
|
||||
|
||||
if have_iconv_iconv:
|
||||
context.Result(1)
|
||||
return ("iconv.h", "")
|
||||
|
||||
#FIXME: Add -lgiconv
|
||||
have_giconv_lib_iconv = context.TryLink("""
|
||||
#include <stdlib.h>
|
||||
#include <giconv.h>
|
||||
""" + main, '.c')
|
||||
if have_giconv_lib_iconv:
|
||||
context.Result(1)
|
||||
return ("giconv.h", "-lgiconv")
|
||||
|
||||
#FIXME: Add -liconv
|
||||
have_iconv_lib_iconv = context.TryLink("""
|
||||
#include <stdlib.h>
|
||||
#include <iconv.h>
|
||||
"""+main,'.c')
|
||||
|
||||
if have_iconv_lib_iconv:
|
||||
context.Result(1)
|
||||
return ("iconv.h", "-liconv")
|
||||
|
||||
return None
|
||||
|
||||
def CheckIconv(context):
|
||||
context.Message("checking for iconv")
|
||||
|
||||
look_dirs = ['/usr','/usr/local','/sw']
|
||||
|
||||
for p in look_dirs:
|
||||
_CheckIconvPath(context,p) #FIXME: Handle return value
|
||||
|
||||
if context.TryRun("""
|
||||
#include <iconv.h>
|
||||
main() {
|
||||
iconv_t cd = iconv_open("ASCII", "UCS-2LE");
|
||||
if (cd == 0 || cd == (iconv_t)-1) return -1;
|
||||
return 0;
|
||||
}
|
||||
""", '.c'):
|
||||
context.Result(1)
|
||||
return (1,[])
|
||||
|
||||
context.Result(0)
|
||||
return (0,[])
|
@ -10,7 +10,7 @@ import SCons.Scanner
|
||||
|
||||
idl_scanner = SCons.Scanner.ClassicCPP("PIDLScan", '.idl', 'CPPPATH', r'depends\(([^,]+),+\)', SCons.Node.FS.default_fs)
|
||||
|
||||
def idl_emitter(target, source, env):
|
||||
def ndr_emitter(target, source, env):
|
||||
result = []
|
||||
for s in source:
|
||||
base, ext = SCons.Util.splitext(str(s).split('/')[-1])
|
||||
@ -19,16 +19,34 @@ def idl_emitter(target, source, env):
|
||||
result.append('gen_ndr/%s.h' % base)
|
||||
return result, source
|
||||
|
||||
pidl_builder = SCons.Builder.Builder(action='$PIDLCOM',
|
||||
emitter = idl_emitter,
|
||||
ndr_builder = SCons.Builder.Builder(action='$NDRCOM',
|
||||
emitter = ndr_emitter,
|
||||
src_suffix = '.idl',
|
||||
scanner = idl_scanner)
|
||||
|
||||
def tdr_emitter(target, source, env):
|
||||
result = []
|
||||
for s in source:
|
||||
base, ext = SCons.Util.splitext(str(s).split('/')[-1])
|
||||
result.append('%s/tdr_%s.c' % (s.get_dir(), base))
|
||||
result.append('%s/tdr_%s.h' % (s.get_dir(), base))
|
||||
result.append('%s/%s.h' % (s.get_dir(), base))
|
||||
return result, source
|
||||
|
||||
tdr_builder = SCons.Builder.Builder(action='$TDRCOM',
|
||||
emitter = tdr_emitter,
|
||||
src_suffix = '.idl',
|
||||
single_source = True,
|
||||
scanner = idl_scanner)
|
||||
|
||||
def generate(env):
|
||||
env['PIDL'] = env.Detect(['./pidl/pidl', 'pidl'])
|
||||
env['PIDLFLAGS'] = ['--outputdir', 'librpc/gen_ndr', '--ndr-header', '--ndr-parser', '--header']
|
||||
env['PIDLCOM'] = '$PIDL $PIDLFLAGS -- $SOURCE'
|
||||
env['BUILDERS']['NdrMarshaller'] = pidl_builder
|
||||
env['NDRFLAGS'] = ['--outputdir', 'librpc/gen_ndr','--ndr-header', '--ndr-parser','--header']
|
||||
env['TDRFLAGS'] = ['--tdr-parser', '--tdr-header','--header']
|
||||
env['NDRCOM'] = '$PIDL $NDRFLAGS -- $SOURCES'
|
||||
env['TDRCOM'] = 'cd ${SOURCE.dir} && $PIDL $TDRFLAGS -- ${SOURCE.file}'
|
||||
env['BUILDERS']['NdrMarshaller'] = ndr_builder
|
||||
env['BUILDERS']['TdrMarshaller'] = tdr_builder
|
||||
|
||||
def exists(env):
|
||||
return env.Detect(['./pidl/pidl','pidl'])
|
||||
|
@ -5,9 +5,9 @@ hostenv.StaticLibrary('heimdal_kdc',
|
||||
'../kdc/log.c','../kdc/misc.c','../kdc/524.c','../kdc/kerberos4.c',
|
||||
'../kdc/kaserver.c','../kdc/process.c'])
|
||||
|
||||
hdb_asn1 = hostenv.ASN1('../heimdal/lib/hdb/hdb.asn1')
|
||||
gssapi_asn1 = hostenv.ASN1('../heimdal/lib/gssapi/spnego.asn1')
|
||||
k5_asn1 = hostenv.ASN1('../heimdal/lib/asn1/k5.asn1')
|
||||
hdb_asn1 = hostenv.ASN1('../heimdal/lib/hdb/hdb.asn1',ASN1PREFIX='hdb_asn1')
|
||||
gssapi_asn1 = hostenv.ASN1('../heimdal/lib/gssapi/spnego.asn1',ASN1PREFIX='spnego_asn1')
|
||||
k5_asn1 = hostenv.ASN1('../heimdal/lib/asn1/k5.asn1',ASN1PREFIX='k5_asn1')
|
||||
|
||||
hostenv.StaticLibrary('heimdal_hdb',
|
||||
['../heimdal/lib/hdb/db.c','../heimdal/lib/hdb/hdb.c','../heimdal/lib/hdb/ext.c','../heimdal/lib/hdb/keys.c',
|
||||
|
@ -1,15 +1,91 @@
|
||||
#!/usr/bin/env python
|
||||
# tastes like -*- python -*-
|
||||
|
||||
Import('hostenv')
|
||||
SConscript('../../build/scons/iconv.py')
|
||||
# tastes like -*- python -*-
|
||||
|
||||
#conf = Configure( custom_tests = { 'CheckIconv' : CheckIconv })
|
||||
#(have_iconv,iconv) = conf.CheckIconv()
|
||||
#conf.Finish()
|
||||
def _CheckIconvPath(context,path):
|
||||
# Some systems have iconv in libc, some have it in libiconv (OSF/1 and
|
||||
# those with the standalone portable libiconv installed).
|
||||
context.Message("checking for iconv in " + path + " ... ")
|
||||
|
||||
#if not have_iconv:
|
||||
# print "Install iconv for better charset compatibility"
|
||||
main = """
|
||||
int main()
|
||||
{
|
||||
iconv_t cd = iconv_open("","");
|
||||
iconv(cd,NULL,NULL,NULL,NULL);
|
||||
iconv_close(cd);
|
||||
return 0;
|
||||
}"""
|
||||
|
||||
iconv = []
|
||||
have_giconv_iconv = context.TryLink("""
|
||||
#include <stdlib.h>
|
||||
#include <giconv.h>
|
||||
""" + main, '.c')
|
||||
if have_giconv_iconv:
|
||||
context.Result(1)
|
||||
return ("giconv.h", "")
|
||||
|
||||
have_iconv_iconv = context.TryLink("""
|
||||
#include <stdlib.h>
|
||||
#include <iconv.h>
|
||||
""" + main, '.c')
|
||||
|
||||
if have_iconv_iconv:
|
||||
context.Result(1)
|
||||
return ("iconv.h", "")
|
||||
|
||||
#FIXME: Add -lgiconv
|
||||
have_giconv_lib_iconv = context.TryLink("""
|
||||
#include <stdlib.h>
|
||||
#include <giconv.h>
|
||||
""" + main, '.c')
|
||||
if have_giconv_lib_iconv:
|
||||
context.Result(1)
|
||||
return ("giconv.h", "-lgiconv")
|
||||
|
||||
#FIXME: Add -liconv
|
||||
have_iconv_lib_iconv = context.TryLink("""
|
||||
#include <stdlib.h>
|
||||
#include <iconv.h>
|
||||
"""+main,'.c')
|
||||
|
||||
if have_iconv_lib_iconv:
|
||||
context.Result(1)
|
||||
return ("iconv.h", "-liconv")
|
||||
|
||||
return None
|
||||
|
||||
def CheckIconv(context):
|
||||
context.Message("checking for iconv ... ")
|
||||
|
||||
look_dirs = ['/usr','/usr/local','/sw']
|
||||
|
||||
for p in look_dirs:
|
||||
_CheckIconvPath(context,p) #FIXME: Handle return value
|
||||
|
||||
if context.TryRun("""
|
||||
#include <iconv.h>
|
||||
main() {
|
||||
iconv_t cd = iconv_open("ASCII", "UCS-2LE");
|
||||
if (cd == 0 || cd == (iconv_t)-1) return -1;
|
||||
return 0;
|
||||
}
|
||||
""", '.c'):
|
||||
context.Result(1)
|
||||
return (1,[])
|
||||
|
||||
context.Result(0)
|
||||
return (0,[])
|
||||
|
||||
if hostenv['configure']:
|
||||
conf = hostenv.Configure( custom_tests = { 'CheckIconv' : CheckIconv })
|
||||
(have_iconv,iconv) = conf.CheckIconv()
|
||||
conf.Finish()
|
||||
|
||||
if not have_iconv:
|
||||
print "Install iconv for better charset compatibility"
|
||||
else:
|
||||
iconv = [] # FIXME
|
||||
|
||||
charset = hostenv.StaticLibrary('charset',['iconv.c','charcnv.c',iconv])
|
||||
Export('charset')
|
||||
|
@ -9,4 +9,12 @@ regshell = hostenv.Program('regshell', ['tools/regshell.c',registry,talloc,basic
|
||||
regpatch = hostenv.Program('regpatch', ['tools/regpatch.c',registry,talloc,basic,popt_common,popt,param])
|
||||
regdiff = hostenv.Program('regdiff', ['tools/regdiff.c',registry,talloc,basic,popt_common,popt,param])
|
||||
|
||||
hostenv.StaticLibrary('reg_backend_dir.c')
|
||||
hostenv.StaticLibrary('reg_backend_gconf.c')
|
||||
hostenv.StaticLibrary('reg_backend_ldb.c')
|
||||
hostenv.StaticLibrary('reg_backend_nt4', ['reg_backend_nt4.c',hostenv.TdrMarshaller('regf.idl')])
|
||||
hostenv.StaticLibrary('reg_backend_rpc.c')
|
||||
hostenv.StaticLibrary('reg_backend_w95.c')
|
||||
hostenv.StaticLibrary('reg_backend_wine.c')
|
||||
|
||||
hostenv.Install(paths['BINDIR'], [regtree,regshell,regpatch,regdiff])
|
||||
|
@ -46,6 +46,8 @@ bzero
|
||||
strerror
|
||||
errno
|
||||
mkstemp (a secure one!)
|
||||
pread
|
||||
pwrite
|
||||
|
||||
Types:
|
||||
socklen_t
|
||||
|
@ -1,11 +1,31 @@
|
||||
Import('hostenv')
|
||||
#!/usr/bin/env python
|
||||
Import('hostenv defines')
|
||||
|
||||
if hostenv['configure']:
|
||||
conf = Configure(hostenv)
|
||||
#FIXME: conf.CheckBrokenInetNtoa()
|
||||
for f in ['memset','syslog','setnetgrent','getnetgrent','endnetgrent', \
|
||||
'mktemp']:
|
||||
if not conf.CheckFunc(f,'c'):
|
||||
print "Required function `%s' not found" % f
|
||||
exit(1)
|
||||
|
||||
for f in ['strtoull','__strtoull','strtouq','strtoll','__strtoll','strtoq',
|
||||
'seteuid','setresuid','setegid','setresgid']:
|
||||
conf.CheckFunc(f,'c')
|
||||
'seteuid','setresuid','setegid','setresgid','dlsym','dlopen',
|
||||
'dlerror','dlclose','waitpid','getcwd','strdup','strndup',
|
||||
'strnlen','strerror','bzero','chroot','strlcpy','strlcat',
|
||||
'memmove','vsnprintf','asprintf','snprintf','vasprintf',
|
||||
'innetgr','mktime','rename','ftruncate','chsize','setlinebuf',
|
||||
'setenv','vsyslog','pread','pwrite']:
|
||||
if conf.CheckFunc(f,'c'):
|
||||
defines['HAVE_' + f.upper()] = 1
|
||||
|
||||
for h in ['dlfcn.h']:
|
||||
if conf.CheckCHeader('dlfcn.h'):
|
||||
defines['HAVE_' + h.upper().replace('.','_').replace('/','_')] = 1
|
||||
|
||||
if not conf.CheckType('socklen_t'):
|
||||
defines['socklen_t'] = 'int'
|
||||
|
||||
conf.Finish()
|
||||
|
||||
hostenv.StaticLibrary('repdir', ['repdir/repdir.c'])
|
||||
|
@ -22,6 +22,7 @@ AC_CHECK_FUNCS(strtoull __strtoull strtouq strtoll __strtoll strtoq)
|
||||
AC_CHECK_FUNCS(seteuid setresuid setegid setresgid chroot bzero strerror)
|
||||
AC_CHECK_FUNCS(timegm setenv vsyslog setlinebuf mktime ftruncate chsize rename)
|
||||
AC_CHECK_FUNCS(waitpid strnlen strlcpy strlcat innetgr initgroups memmove strdup)
|
||||
AC_CHECK_FUNCS(pread pwrite)
|
||||
AC_HAVE_DECL(setresuid, [#include <unistd.h>])
|
||||
AC_HAVE_DECL(setresgid, [#include <unistd.h>])
|
||||
AC_HAVE_DECL(errno, [#include <errno.h>])
|
||||
|
@ -523,3 +523,25 @@ int rep_mkstemp(char *template)
|
||||
return open(p, O_CREAT|O_EXCL|O_RDWR, 0600);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_PREAD
|
||||
static ssize_t pread(int __fd, void *__buf, size_t __nbytes, off_t __offset)
|
||||
{
|
||||
if (lseek(__fd, __offset, SEEK_SET) != __offset) {
|
||||
return -1;
|
||||
}
|
||||
return read(__fd, __buf, __nbytes);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_PWRITE
|
||||
static ssize_t pwrite(int __fd, const void *__buf, size_t __nbytes, off_t __offset)
|
||||
{
|
||||
if (lseek(__fd, __offset, SEEK_SET) != __offset) {
|
||||
return -1;
|
||||
}
|
||||
return write(__fd, __buf, __nbytes);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -1,5 +1,64 @@
|
||||
#!/usr/bin/env python
|
||||
Import('hostenv')
|
||||
|
||||
if hostenv['configure']:
|
||||
conf = hostenv.Configure()
|
||||
conf.CheckCHeader('sys/socket.h')
|
||||
conf.CheckCHeader('sys/sockio.h')
|
||||
conf.CheckCHeader('sys/un.h')
|
||||
#HAVE_SOCK_SIN_LEN
|
||||
conf.TryCompile("""
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
struct sockaddr_in sock; sock.sin_len = sizeof(sock);
|
||||
return 0;
|
||||
}""", '.c')
|
||||
|
||||
#HAVE_UNIXSOCKET
|
||||
conf.TryCompile("""
|
||||
#include <sys/types.h>
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/un.h>],
|
||||
|
||||
int main(void)
|
||||
{
|
||||
struct sockaddr_un sunaddr;
|
||||
sunaddr.sun_family = AF_UNIX;
|
||||
return 0;
|
||||
}""", '.c')
|
||||
|
||||
# HAVE_IPV6
|
||||
conf.CheckFunc('gethostbyname2')
|
||||
|
||||
# The following test taken from the cvs sources
|
||||
# If we can't find connect, try looking in -lsocket, -lnsl, and -linet.
|
||||
# The Irix 5 libc.so has connect and gethostbyname, but Irix 5 also has
|
||||
# libsocket.so which has a bad implementation of gethostbyname (it
|
||||
# only looks in /etc/hosts), so we only look for -lsocket if we need
|
||||
# it.
|
||||
|
||||
connect_libs = []
|
||||
|
||||
if not conf.CheckFunc('connect'):
|
||||
for l in ['nsl_s','nsl','socket','inet']:
|
||||
if conf.CheckLib(l, 'connect'):
|
||||
connect_libs.append(l)
|
||||
break
|
||||
|
||||
# HAVE_WORKING_AF_LOCAL
|
||||
# FIXME: Try compiling build/tests/unixsock.c
|
||||
|
||||
|
||||
conf.Finish()
|
||||
|
||||
hostenv.StaticLibrary('socket_ipv4.c')
|
||||
hostenv.StaticLibrary('socket_ipv6.c')
|
||||
hostenv.StaticLibrary('socket_unix.c')
|
||||
hostenv.StaticLibrary('socket', ['socket.c','access.c','connect.c'])
|
||||
|
||||
|
@ -40,26 +40,6 @@
|
||||
|
||||
#define CHECK_READ_ONLY(req) do { if (lp_readonly(req->tcon->service)) return NT_STATUS_ACCESS_DENIED; } while (0)
|
||||
|
||||
#ifndef HAVE_PREAD
|
||||
static ssize_t pread(int __fd, void *__buf, size_t __nbytes, off_t __offset)
|
||||
{
|
||||
if (lseek(__fd, __offset, SEEK_SET) != __offset) {
|
||||
return -1;
|
||||
}
|
||||
return read(__fd, __buf, __nbytes);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_PWRITE
|
||||
static ssize_t pwrite(int __fd, const void *__buf, size_t __nbytes, off_t __offset)
|
||||
{
|
||||
if (lseek(__fd, __offset, SEEK_SET) != __offset) {
|
||||
return -1;
|
||||
}
|
||||
return write(__fd, __buf, __nbytes);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
connect to a share - used when a tree_connect operation comes
|
||||
in. For a disk based backend we needs to ensure that the base
|
||||
|
2
source/script/tests/SConscript
Normal file
2
source/script/tests/SConscript
Normal file
@ -0,0 +1,2 @@
|
||||
Alias('quicktest', '#selftest.sh st quick SOCKET_WRAPPER')
|
||||
Alias('test', '#selftest.sh st all SOCKET_WRAPPER')
|
Loading…
x
Reference in New Issue
Block a user