nsstest: no need for two copies of the same tool.
[Samba/vl.git] / source3 / build / dynconfig.py
blob4bc97e5eddb4a5aa9b0f621833409f78dbba6fd2
1 import string, Utils
3 # list of directory options to offer in configure
4 dir_options = {
5 'with-piddir' : [ '${PREFIX}/var/locks', 'where to put pid files' ],
6 'with-privatedir' : [ '${PREFIX}/private', 'Where to put sam.ldb and other private files' ],
7 'with-winbindd-socket-dir' : [ '${PREFIX}/var/lib/winbindd', 'winbind socket directory' ],
8 'with-winbindd-privileged-socket-dir' : [ '${PREFIX}/var/lib/winbindd_privileged', 'winbind privileged socket directory'],
9 'with-ntp-signd-socket-dir' : [ '${PREFIX}/var/run/ntp_signd', 'NTP signed directory'],
10 'with-lockdir' : [ '${PREFIX}/var/locks', 'where to put lock files' ],
11 'with-codepagedir' : [ '${PREFIX}/lib/samba', 'where to put codepages' ],
12 'with-privatedir' : [ '${PREFIX}/private', 'where to put smbpasswd' ],
13 'with-cachedir' : [ '${PREFIX}/var/locks', 'where to put temporary cache files' ],
14 'with-logfilebase' : [ '${PREFIX}/var/log/samba', 'Where to put log files' ],
15 'with-configdir' : [ '${PREFIX}/etc/samba', 'Where to put configuration files' ],
16 'with-swatdir' : [ '${PREFIX}/swat', 'Where to put SWAT files' ],
17 'with-statedir' : [ '${PREFIX}/var/locks', 'where to put persistent state files' ],
18 'with-cachedir' : [ '${PREFIX}/var/locks', 'where to put temporary cache files' ],
19 'with-ncalrpcdir' : [ '${PREFIX}/var/ncalrpc', 'where to put ncalrpc sockets' ],
20 'with-pammodulesdir' : [ '', 'Which directory to use for PAM modules' ],
21 'with-codepagedir' : [ '${PREFIX}/lib/samba', 'Where to put codepages' ],
22 'with-selftest-prefix' : [ '', 'The prefix where make test will be run' ],
23 'with-selftest-shrdir' : [ '', 'The share directory that make test will be run against' ]
26 # list of cflags to use for dynconfig.c
27 dyn_cflags = {
28 'CONFIGFILE' : '${SYSCONFDIR}/smb.conf',
29 'BINDIR' : '${BINDIR}',
30 'SBINDIR' : '${SBINDIR}',
31 'LIBDIR' : '${LIBDIR}',
32 'STATEDIR' : '${LOCALSTATEDIR}',
33 'LMHOSTSFILE' : '${SYSCONFDIR}/lmhosts',
34 'LOCKDIR' : '${LOCALSTATEDIR}/locks',
35 'PIDDIR' : '${LOCALSTATEDIR}/run',
36 'DATADIR' : '${DATADIR}',
37 'LOGFILEBASE' : '${LOCALSTATEDIR}',
38 'CONFIGDIR' : '${SYSCONFDIR}',
39 'NCALRPCDIR' : '${LOCALSTATEDIR}/ncalrpc',
40 'SWATDIR' : '${PREFIX}/swat',
41 'PRIVATE_DIR' : '${PRIVATEDIR}',
42 'MODULESDIR' : '${PREFIX}/modules',
43 'SETUPDIR' : '${DATADIR}/setup',
44 'WINBINDD_PRIVILEGED_SOCKET_DIR' : '${WINBINDD_PRIVILEGED_SOCKET_DIR}',
45 'WINBINDD_SOCKET_DIR' : '${WINBINDD_SOCKET_DIR}',
46 'NTP_SIGND_SOCKET_DIR' : '${NTP_SIGND_SOCKET_DIR}',
47 'CODEPAGEDIR' : '${CODEPAGEDIR}',
48 'CACHEDIR' : '${CACHEDIR}',
49 'SMB_PASSWD_FILE' : '${PRIVATEDIR}/smbpasswd',
52 def get_varname(v):
53 '''work out a variable name from a configure option name'''
54 if v.startswith('with-'):
55 v = v[5:]
56 v = v.upper()
57 v = string.replace(v, '-', '_')
58 return v
61 def dynconfig_cflags(bld):
62 '''work out the extra CFLAGS for dynconfig.c'''
63 cflags = []
64 for f in dyn_cflags.keys():
65 # substitute twice, as we could have substitutions containing variables
66 v = Utils.subst_vars(dyn_cflags[f], bld.env)
67 v = Utils.subst_vars(v, bld.env)
68 bld.ASSERT(v != '', "Empty dynconfig value for %s" % f)
69 bld.ASSERT(v.find('${') == -1, "Unsubstituted variable in %s : %s : %s" % (f, dyn_cflags[f], v))
70 cflags.append('-D%s="%s"' % (f, v))
71 return cflags