s3-waf: remove duplicate CONFIGFILE from dynconfig.py which caused sysconfigdir
[sfrench/samba-autobuild/.git] / source3 / build / dynconfig.py
1 import string, Utils
2
3 # list of directory options to offer in configure
4 dir_options = {
5     'with-piddir'                         : [ '${PREFIX}/var/run', '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     }
15
16 # list of cflags to use for dynconfig.c
17 dyn_cflags = {
18     'CONFIGFILE'                     : '${SYSCONFDIR}/smb.conf',
19     'BINDIR'                         : '${BINDIR}',
20     'SBINDIR'                        : '${SBINDIR}',
21     'LIBDIR'                         : '${LIBDIR}',
22     'STATEDIR'                       : '${LOCALSTATEDIR}',
23     'LMHOSTSFILE'                    : '${SYSCONFDIR}/lmhosts',
24     'LOCKDIR'                        : '${LOCALSTATEDIR}/locks',
25     'PIDDIR'                         : '${LOCALSTATEDIR}/run',
26     'DATADIR'                        : '${DATADIR}',
27     'LOGFILEBASE'                    : '${LOCALSTATEDIR}',
28     'CONFIGDIR'                      : '${SYSCONFDIR}',
29     'NCALRPCDIR'                     : '${LOCALSTATEDIR}/ncalrpc',
30     'SWATDIR'                        : '${PREFIX}/swat',
31     'PRIVATE_DIR'                    : '${PRIVATEDIR}',
32     'MODULESDIR'                     : '${PREFIX}/modules',
33     'SETUPDIR'                       : '${DATADIR}/setup',
34     'WINBINDD_PRIVILEGED_SOCKET_DIR' : '${WINBINDD_PRIVILEGED_SOCKET_DIR}',
35     'WINBINDD_SOCKET_DIR'            : '${WINBINDD_SOCKET_DIR}',
36     'NTP_SIGND_SOCKET_DIR'           : '${NTP_SIGND_SOCKET_DIR}',
37     'CODEPAGEDIR'                    : '${CODEPAGEDIR}',
38     'CACHEDIR'                       : '${CACHEDIR}',
39     'SMB_PASSWD_FILE'                : '${PRIVATEDIR}/smbpasswd',
40     }
41
42 def get_varname(v):
43     '''work out a variable name from a configure option name'''
44     if v.startswith('with-'):
45         v = v[5:]
46     v = v.upper()
47     v = string.replace(v, '-', '_')
48     return v
49
50
51 def dynconfig_cflags(bld):
52     '''work out the extra CFLAGS for dynconfig.c'''
53     cflags = []
54     for f in dyn_cflags.keys():
55         # substitute twice, as we could have substitutions containing variables
56         v = Utils.subst_vars(dyn_cflags[f], bld.env)
57         v = Utils.subst_vars(v, bld.env)
58         bld.ASSERT(v != '', "Empty dynconfig value for %s" % f)
59         bld.ASSERT(v.find('${') == -1, "Unsubstituted variable in %s : %s : %s" % (f, dyn_cflags[f], v))
60         cflags.append('-D%s="%s"' % (f, v))
61     return cflags