3 import string
, Utils
, Options
, sys
, Build
, os
, intltool
4 from samba_utils
import EXPAND_VARIABLES
, os_path_relpath
6 # list of directory options to offer in configure
8 'with-piddir' : [ '${LOCALSTATEDIR}/run', 'where to put pid files' ],
9 'with-privatedir' : [ '${PREFIX}/private', 'Where to put sam.ldb and other private files' ],
10 'with-sockets-dir' : [ '${LOCALSTATEDIR}/run', 'sockets directory' ],
11 'with-winbindd-privileged-socket-dir' : [ '${LOCALSTATEDIR}/lib/winbindd_privileged', 'winbind privileged socket directory'],
12 'with-lockdir' : [ '${LOCALSTATEDIR}/lock', 'where to put short term disposable state files' ],
13 'with-cachedir' : [ '${LOCALSTATEDIR}/cache', 'where to put cache files' ],
14 'with-logfilebase' : [ '${LOCALSTATEDIR}', 'Where to put log files' ],
15 'with-pammodulesdir' : [ '${LIBDIR}', 'Which directory to use for PAM modules' ],
16 'with-statedir' : [ '${LOCALSTATEDIR}/locks', 'where to put persistent state files' ],
19 # list of cflags to use for dynconfig.c
21 'BINDIR' : '${BINDIR}',
22 'SBINDIR' : '${SBINDIR}',
23 'SCRIPTSBINDIR' : '${SBINDIR}',
24 'CONFIGDIR' : '${SYSCONFDIR}',
25 'CONFIGFILE' : '${SYSCONFDIR}/smb.conf',
26 'LMHOSTSFILE' : '${SYSCONFDIR}/lmhosts',
27 'PRIVATE_DIR' : '${PRIVATEDIR}',
28 'LOGFILEBASE' : '${LOGFILEBASE}',
29 'LOCKDIR' : '${LOCKDIR}',
30 'PIDDIR' : '${PIDDIR}',
31 'DATADIR' : '${DATADIR}',
32 'LOCALEDIR' : '${LOCALEDIR}',
33 'SETUPDIR' : '${DATADIR}/setup',
34 'WINBINDD_SOCKET_DIR' : '${SOCKETS_DIR}/winbindd',
35 'WINBINDD_PRIVILEGED_SOCKET_DIR' : '${WINBINDD_PRIVILEGED_SOCKET_DIR}',
36 'NTP_SIGND_SOCKET_DIR' : '${SOCKETS_DIR}/ntp_signd',
37 'NCALRPCDIR' : '${SOCKETS_DIR}/ncalrpc',
38 'PYTHONDIR' : '${PYTHONDIR}',
39 'PYTHONARCHDIR' : '${PYTHONARCHDIR}',
40 'MODULESDIR' : '${PREFIX}/modules',
41 'INCLUDEDIR' : '${PREFIX}/include',
42 'PKGCONFIGDIR' : '${LIBDIR}/pkgconfig',
43 'SWATDIR' : '${DATADIR}/swat',
44 'CODEPAGEDIR' : '${DATADIR}/codepages',
45 'LIBDIR' : '${LIBDIR}',
46 'LIBEXECDIR' : '${LIBEXECDIR}',
47 'STATEDIR' : '${STATEDIR}',
48 'CACHEDIR' : '${CACHEDIR}',
49 'SMB_PASSWD_FILE' : '${PRIVATEDIR}/smbpasswd',
50 'NMBDSOCKETDIR' : '${SOCKETS_DIR}/nmbd',
51 'PAMMODULESDIR' : '${PAMMODULESDIR}',
55 '''work out a variable name from a configure option name'''
56 if v
.startswith('with-'):
59 v
= v
.replace('-', '_')
64 # get all the basic GNU options from the gnu_dirs tool
65 for option
in dir_options
.keys():
66 default
= dir_options
[option
][0]
67 help = dir_options
[option
][1]
68 varname
= get_varname(option
)
69 opt
.add_option('--%s' % option
,
70 help=(help + ' [%s]' % default
),
71 action
="store", dest
=varname
, default
=default
)
74 # get all the basic GNU options from the gnu_dirs tool
75 for option
in dir_options
.keys():
76 varname
= get_varname(option
)
77 value
= getattr(Options
.options
, varname
, None)
78 conf
.ASSERT(value
is not None, "Missing configure option %s" % varname
)
79 conf
.ASSERT(varname
not in conf
.env
, "Variable %s already defined" % varname
)
80 conf
.env
[varname
] = value
82 for f
in dyn_cflags
.keys():
83 v
= EXPAND_VARIABLES(conf
, dyn_cflags
[f
])
84 conf
.ASSERT(v
!= '', "Empty dynconfig value for %s" % f
)
87 def dynconfig_cflags(bld
, list=None):
88 '''work out the extra CFLAGS for dynconfig.c'''
90 # override some paths when running from the build directory
91 override
= { 'MODULESDIR' : 'bin/modules',
92 'PYTHONDIR' : 'bin/python',
93 'PYTHONARCHDIR' : 'bin/python',
94 'CODEPAGEDIR' : os
.path
.join(bld
.env
.srcdir
, 'codepages'),
95 'SCRIPTSBINDIR' : os
.path
.join(bld
.env
.srcdir
, 'source4/scripting/bin'),
96 'SETUPDIR' : os
.path
.join(bld
.env
.srcdir
, 'source4/setup') }
97 for f
in dyn_cflags
.keys():
98 if list and not f
in list:
101 if not Options
.is_install
:
103 value
= os
.path
.join(os
.getcwd(), override
[f
])
104 cflags
.append('-D%s="%s"' % (f
, value
))
106 Build
.BuildContext
.dynconfig_cflags
= dynconfig_cflags
109 cflags
= bld
.dynconfig_cflags()
110 version_header
= 'version.h'
111 if not os
.getenv('TOPLEVEL_BUILD'):
112 version_header
= 'include/version.h'
113 bld
.SAMBA_SUBSYSTEM('DYNCONFIG',
115 deps
='replace talloc',
116 public_headers
=os_path_relpath(os
.path
.join(Options
.launch_dir
, version_header
), bld
.curdir
),