s3:configure: fix a comment.
[Samba.git] / source3 / build / dynconfig.py
blobf243baa92d6b29256ebdca88de94d3a7afa910eb
1 import string, Utils
3 # list of directory options to offer in configure
4 dir_options = {
5 'with-cachedir' : [ '${PREFIX}/var/locks', 'where to put temporary cache files' ],
6 'with-codepagedir' : [ '${PREFIX}/lib/samba', 'where to put codepages' ],
7 'with-configdir' : [ '${PREFIX}/etc/samba', 'Where to put configuration files' ],
8 'with-lockdir' : [ '${PREFIX}/var/locks', 'where to put lock files' ],
9 'with-logfilebase' : [ '${PREFIX}/var/log/samba', 'Where to put log files' ],
10 'with-ncalrpcdir' : [ '${PREFIX}/var/ncalrpc', 'where to put ncalrpc sockets' ],
11 'with-nmbdsocketdir' : [ '${PREFIX}/var/locks/.nmbd', 'Where to put the nmbd socket directory' ],
12 'with-ntp-signd-socket-dir' : [ '${PREFIX}/var/run/ntp_signd', 'NTP signed directory'],
13 'with-pammodulesdir' : [ '', 'Which directory to use for PAM modules' ],
14 'with-piddir' : [ '${PREFIX}/var/locks', 'where to put pid files' ],
15 'with-privatedir' : [ '${PREFIX}/private', 'where to put smbpasswd' ],
16 'with-selftest-prefix' : [ '', 'The prefix where make test will be run' ],
17 'with-selftest-shrdir' : [ '', 'The share directory that make test will be run against' ],
18 'with-statedir' : [ '${PREFIX}/var/locks', 'where to put persistent state files' ],
19 'with-swatdir' : [ '${PREFIX}/swat', 'Where to put SWAT files' ],
20 'with-winbindd-privileged-socket-dir' : [ '${PREFIX}/var/lib/winbindd_privileged', 'winbind privileged socket directory'],
21 'with-winbindd-socket-dir' : [ '${PREFIX}/var/lib/winbindd', 'winbind socket directory' ],
24 # list of cflags to use for dynconfig.c
25 dyn_cflags = {
26 'BINDIR' : '${BINDIR}',
27 'CACHEDIR' : '${CACHEDIR}',
28 'CODEPAGEDIR' : '${CODEPAGEDIR}',
29 'CONFIGDIR' : '${SYSCONFDIR}',
30 'CONFIGFILE' : '${SYSCONFDIR}/smb.conf',
31 'DATADIR' : '${DATADIR}',
32 'LIBDIR' : '${LIBDIR}',
33 'LMHOSTSFILE' : '${SYSCONFDIR}/lmhosts',
34 'LOCKDIR' : '${LOCALSTATEDIR}/locks',
35 'LOGFILEBASE' : '${LOCALSTATEDIR}',
36 'MODULESDIR' : '${PREFIX}/modules',
37 'NCALRPCDIR' : '${LOCALSTATEDIR}/ncalrpc',
38 'NMBDSOCKETDIR' : '${LOCKDIR}/.nmbd',
39 'NTP_SIGND_SOCKET_DIR' : '${NTP_SIGND_SOCKET_DIR}',
40 'PIDDIR' : '${LOCALSTATEDIR}/run',
41 'PKGCONFIGDIR' : '${LIBDIR}/pkgconfigdir',
42 'PRIVATE_DIR' : '${PRIVATEDIR}',
43 'SBINDIR' : '${SBINDIR}',
44 'SETUPDIR' : '${DATADIR}/setup',
45 'SMB_PASSWD_FILE' : '${PRIVATEDIR}/smbpasswd',
46 'STATEDIR' : '${LOCALSTATEDIR}',
47 'SWATDIR' : '${PREFIX}/swat',
48 'WINBINDD_PRIVILEGED_SOCKET_DIR' : '${WINBINDD_PRIVILEGED_SOCKET_DIR}',
49 'WINBINDD_SOCKET_DIR' : '${WINBINDD_SOCKET_DIR}',
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