1 import string, Utils, Options
3 # list of directory options to offer in configure
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' ]
13 # list of cflags to use for dynconfig.c
15 'CONFIGFILE' : '${SYSCONFDIR}/smb.conf',
16 'BINDIR' : '${BINDIR}',
17 'SBINDIR' : '${SBINDIR}',
18 'LMHOSTSFILE' : '${SYSCONFDIR}/lmhosts',
19 'LOCKDIR' : '${LOCALSTATEDIR}/locks',
20 'PIDDIR' : '${LOCALSTATEDIR}/run',
21 'DATADIR' : '${DATADIR}',
22 'LOGFILEBASE' : '${LOCALSTATEDIR}',
23 'CONFIGDIR' : '${SYSCONFDIR}',
24 'NCALRPCDIR' : '${LOCALSTATEDIR}/ncalrpc',
25 'SWATDIR' : '${DATADIR}/swat',
26 'PRIVATE_DIR' : '${PRIVATEDIR}',
27 'MODULESDIR' : '${PREFIX}/modules',
28 'SETUPDIR' : '${DATADIR}/setup',
29 'INCLUDEDIR' : '${PREFIX}/include',
30 'WINBINDD_PRIVILEGED_SOCKET_DIR' : '${WINBINDD_PRIVILEGED_SOCKET_DIR}',
31 'WINBINDD_SOCKET_DIR' : '${WINBINDD_SOCKET_DIR}',
32 'NTP_SIGND_SOCKET_DIR' : '${NTP_SIGND_SOCKET_DIR}',
36 '''work out a variable name from a configure option name'''
37 if v.startswith('with-'):
40 v = string.replace(v, '-', '_')
45 # get all the basic GNU options from the gnu_dirs tool
46 opt.tool_options('gnu_dirs')
47 for option in dir_options.keys():
48 default = dir_options[option][0]
49 help = dir_options[option][1]
50 varname = get_varname(option)
51 opt.add_option('--%s' % option,
52 help=(help + ' [%s]' % default),
53 action="store", dest=varname, default=default)
56 # get all the basic GNU options from the gnu_dirs tool
57 conf.check_tool('gnu_dirs')
58 for option in dir_options.keys():
59 varname = get_varname(option)
60 value = getattr(Options.options, varname, None)
61 conf.ASSERT(value is not None, "Missing configure option %s" % varname)
62 conf.ASSERT(varname not in conf.env, "Variable %s already defined" % varname)
63 conf.env[varname] = value
65 for f in dyn_cflags.keys():
66 # substitute twice, as we could have substitutions containing variables
67 v = Utils.subst_vars(dyn_cflags[f], conf.env)
68 v = Utils.subst_vars(v, conf.env)
69 conf.ASSERT(v != '', "Empty dynconfig value for %s" % f)
70 conf.ASSERT(v.find('${') == -1, "Unsubstituted variable in %s : %s : %s" % (f, dyn_cflags[f], v))
73 def dynconfig_cflags(bld):
74 '''work out the extra CFLAGS for dynconfig.c'''
76 for f in dyn_cflags.keys():
77 cflags.append('-D%s="%s"' % (f, bld.env[f]))
81 cflags = dynconfig_cflags(bld)
82 bld.SAMBA_SUBSYSTEM('DYNCONFIG',
84 deps='replace talloc',
85 public_headers='../version.h',