3 # This is the experimental scons build script for Samba 4. For a proper
4 # build use the old build system (configure + make). scons may
5 # eventually replace this system.
7 # Copyright (C) 2005 Jelmer Vernooij <jelmer@samba.org>
8 # Published under the GNU GPL
10 # We don't care about NFS builds...
12 opts = Options(None, ARGUMENTS)
14 BoolOption('developer','enable developer flags', 0),
15 PathOption('prefix','installation prefix','/usr/local/samba'),
16 BoolOption('configh','use config.h file', 0)
19 hostenv = Environment(
20 toolpath=['build/scons','.'],
21 tools=['default','pidl','proto','et','asn1'],
23 CPPPATH=['#include','#','#lib'],
24 CPPDEFINES={'_SAMBA_BUILD_': None},
27 hostenv.SetOption('max_drift', 1)
29 if hostenv['developer']:
30 hostenv.Append(CCFLAGS='-Wall')
31 hostenv.Append(CCFLAGS='-Wshadow')
32 hostenv.Append(CCFLAGS='-Werror-implicit-function-declaration')
33 hostenv.Append(CCFLAGS='-Wstrict-prototypes')
34 hostenv.Append(CCFLAGS='-Wpointer-arith')
35 hostenv.Append(CCFLAGS='-Wcast-qual')
36 hostenv.Append(CCFLAGS='-Wcast-align')
37 hostenv.Append(CCFLAGS='-Wwrite-strings')
38 hostenv.Append(CCFLAGS='-Wmissing-format-attribute')
39 hostenv.Append(CCFLAGS='-Wformat=2')
40 hostenv.Append(CCFLAGS='-Wno-format-y2k')
41 hostenv.Append(CCFLAGS='-Wno-declaration-after-statement')
46 hostenv.Append(CPPPATH = ['#heimdal_build', '#heimdal/lib/krb5',
47 '#heimdal/lib/hdb', '#heimdal/lib/gssapi',
48 '#heimdal/lib/asn1', '#heimdal/lib/des',
49 '#heimdal/kdc', '#heimdal/lib/roken',
50 '#heimdal/lib/com_err'])
61 buildenv = hostenv.Copy()
62 buildenv.BuildDir('build-env','.')
64 dynenv = hostenv.Copy()
71 'NCALRPCDIR': 'ncalrpc',
72 'LMHOSTSFILE': 'lmhosts',
77 'PRIVATE_DIR': 'private',
83 conf = hostenv.Configure()
84 for h in ['sys/select.h','fcntl.h','sys/fcntl.h','sys/time.h'] + \
85 ['utime.h','grp.h','sys/id.h','limits.h','memory.h'] + \
86 ['compat.h','math.h','sys/param.h','ctype.h','sys/wait.h'] + \
87 ['sys/resource.h','sys/ioctl.h','sys/ipc.h','sys/mode.h'] + \
88 ['sys/mman.h','sys/filio.h','sys/priv.h','sys/shm.h','string.h'] + \
89 ['strings.h','stdlib.h','sys/vfs.h','sys/fs/s5param.h','sys/filsys.h'] + \
90 ['termios.h','termio.h','fnmatch.h','pwd.h','sys/termio.h'] + \
91 ['sys/time.h','sys/statfs.h','sys/statvfs.h','stdarg.h'] + \
92 ['security/pam_modules.h','security/_pam_macros.h','dlfcn.h'] + \
93 ['sys/syslog.h','syslog.h','stdint.h','inttypes.h','locale.h'] + \
94 ['shadow.h','nss.h','nss_common.h','ns_api.h','sys/security.h'] + \
95 ['security/pam_appl.h','sys/capability.h','syscall.h','sys/syscall.h'] + \
97 if conf.CheckCHeader(h):
98 defines['HAVE_' + h.upper().replace('.','_').replace('/','_')] = 1
100 for f in ['dlopen','dlsym','dlerror','waitpid','getcwd','strdup'] + \
101 ['strndup','strnlen','strerror','chroot','bzero','memset','strlcpy'] + \
102 ['strlcat','memmove','vsnprintf','snprintf','asprintf','vasprintf'] + \
103 ['setsid','pipe','crypt16','getauthuid','strftime','sigprocmask'] + \
104 ['sigblock','sigaction','innetgr','setnetgrent','getnetgrent'] + \
105 ['endnetgrent','initgroups','setgroups','sysconf','mktime','rename'] + \
106 ['ftruncate','chsize','getpwanam','setlinebuf','srandom','random'] + \
107 ['srand','rand','setenv','usleep','syslog','vsyslog','timegm'] + \
108 ['backtrace','setbuffer','pread','pwrite']:
109 if conf.CheckFunc(f):
110 defines['HAVE_' + f.upper()] = 1
114 [dynenv.Append(CPPDEFINES = {p: '\\"%s\\"' % paths[p]}) for p in paths]
116 dynconfig = dynenv.Object('dynconfig.c')
120 Export('proto_files')
123 dirs=['lib','torture','rpc_server','cldap_server','libcli',
124 'nbt_server','client','ldap_server','libnet','nsswitch','web_server',
125 'smbd','dsdb','heimdal_build','ntptr','kdc','smb_server','ntvfs',
126 'winbind','scripting','auth'])
128 hostenv.CProtoHeader(target='include/proto.h',source=proto_files)
130 if hostenv['configh']:
131 def create_config_h(env,target,source):
133 hostenv.Command('include/config.h',[],create_config_h)
134 hostenv.Append(CPPDEFINES = {HAVE_CONFIG_H: 1})
136 [hostenv.Append(CPPDEFINES = {p: defines[p]}) for p in defines]