3 import string, Utils, Options
5 # list of directory options to offer in configure
7 'with-piddir' : [ '${PREFIX}/var/run', 'where to put pid files' ],
8 'with-privatedir' : [ '${PREFIX}/private', 'Where to put sam.ldb and other private files' ],
9 'with-winbindd-socket-dir' : [ '${PREFIX}/var/lib/winbindd', 'winbind socket directory' ],
10 'with-winbindd-privileged-socket-dir' : [ '${PREFIX}/var/lib/winbindd_privileged', 'winbind privileged socket directory'],
11 'with-ntp-signd-socket-dir' : [ '${PREFIX}/var/run/ntp_signd', 'NTP signed directory'],
12 'with-lockdir' : [ '${PREFIX}/var/locks', 'where to put lock files' ]
15 # list of cflags to use for dynconfig.c
17 'CONFIGFILE' : '${SYSCONFDIR}/smb.conf',
18 'BINDIR' : '${BINDIR}',
19 'SBINDIR' : '${SBINDIR}',
20 'LMHOSTSFILE' : '${SYSCONFDIR}/lmhosts',
21 'LOCKDIR' : '${LOCALSTATEDIR}/locks',
22 'PIDDIR' : '${LOCALSTATEDIR}/run',
23 'DATADIR' : '${DATADIR}',
24 'LOGFILEBASE' : '${LOCALSTATEDIR}',
25 'CONFIGDIR' : '${SYSCONFDIR}',
26 'NCALRPCDIR' : '${LOCALSTATEDIR}/ncalrpc',
27 'SWATDIR' : '${DATADIR}/swat',
28 'PRIVATE_DIR' : '${PRIVATEDIR}',
29 'MODULESDIR' : '${PREFIX}/modules',
30 'SETUPDIR' : '${DATADIR}/setup',
31 'INCLUDEDIR' : '${PREFIX}/include',
32 'WINBINDD_PRIVILEGED_SOCKET_DIR' : '${WINBINDD_PRIVILEGED_SOCKET_DIR}',
33 'WINBINDD_SOCKET_DIR' : '${WINBINDD_SOCKET_DIR}',
34 'NTP_SIGND_SOCKET_DIR' : '${NTP_SIGND_SOCKET_DIR}',
35 'PKGCONFIGDIR' : '${LIBDIR}/pkgconfig',
39 '''work out a variable name from a configure option name'''
40 if v.startswith('with-'):
43 v = string.replace(v, '-', '_')
48 # get all the basic GNU options from the gnu_dirs tool
49 for option in dir_options.keys():
50 default = dir_options[option][0]
51 help = dir_options[option][1]
52 varname = get_varname(option)
53 opt.add_option('--%s' % option,
54 help=(help + ' [%s]' % default),
55 action="store", dest=varname, default=default)
58 # get all the basic GNU options from the gnu_dirs tool
59 for option in dir_options.keys():
60 varname = get_varname(option)
61 value = getattr(Options.options, varname, None)
62 conf.ASSERT(value is not None, "Missing configure option %s" % varname)
63 conf.ASSERT(varname not in conf.env, "Variable %s already defined" % varname)
64 conf.env[varname] = value
66 for f in dyn_cflags.keys():
67 # substitute twice, as we could have substitutions containing variables
68 v = Utils.subst_vars(dyn_cflags[f], conf.env)
69 v = Utils.subst_vars(v, conf.env)
70 conf.ASSERT(v != '', "Empty dynconfig value for %s" % f)
71 conf.ASSERT(v.find('${') == -1, "Unsubstituted variable in %s : %s : %s" % (f, dyn_cflags[f], v))
74 def dynconfig_cflags(bld):
75 '''work out the extra CFLAGS for dynconfig.c'''
77 for f in dyn_cflags.keys():
78 cflags.append('-D%s="%s"' % (f, bld.env[f]))
82 cflags = dynconfig_cflags(bld)
83 bld.SAMBA_SUBSYSTEM('DYNCONFIG',
85 deps='replace talloc',
86 public_headers='../version.h',