| 1 | import string, Utils | 
|---|
| 2 |  | 
|---|
| 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' ], | 
|---|
| 22 | } | 
|---|
| 23 |  | 
|---|
| 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 | 'LOCALEDIR'                      : '${LOCALEDIR}', | 
|---|
| 34 | 'LMHOSTSFILE'                    : '${SYSCONFDIR}/lmhosts', | 
|---|
| 35 | 'LOCKDIR'                        : '${LOCALSTATEDIR}/locks', | 
|---|
| 36 | 'LOGFILEBASE'                    : '${LOCALSTATEDIR}', | 
|---|
| 37 | 'MODULESDIR'                     : '${PREFIX}/modules', | 
|---|
| 38 | 'NCALRPCDIR'                     : '${LOCALSTATEDIR}/ncalrpc', | 
|---|
| 39 | 'NMBDSOCKETDIR'                  : '${LOCKDIR}/.nmbd', | 
|---|
| 40 | 'NTP_SIGND_SOCKET_DIR'           : '${NTP_SIGND_SOCKET_DIR}', | 
|---|
| 41 | 'PIDDIR'                         : '${LOCALSTATEDIR}/run', | 
|---|
| 42 | 'PKGCONFIGDIR'                   : '${LIBDIR}/pkgconfigdir', | 
|---|
| 43 | 'PRIVATE_DIR'                    : '${PRIVATEDIR}', | 
|---|
| 44 | 'SBINDIR'                        : '${SBINDIR}', | 
|---|
| 45 | 'SETUPDIR'                       : '${DATADIR}/setup', | 
|---|
| 46 | 'SMB_PASSWD_FILE'                : '${PRIVATEDIR}/smbpasswd', | 
|---|
| 47 | 'STATEDIR'                       : '${LOCALSTATEDIR}', | 
|---|
| 48 | 'SWATDIR'                        : '${PREFIX}/swat', | 
|---|
| 49 | 'WINBINDD_PRIVILEGED_SOCKET_DIR' : '${WINBINDD_PRIVILEGED_SOCKET_DIR}', | 
|---|
| 50 | 'WINBINDD_SOCKET_DIR'            : '${WINBINDD_SOCKET_DIR}', | 
|---|
| 51 | } | 
|---|
| 52 |  | 
|---|
| 53 | def get_varname(v): | 
|---|
| 54 | '''work out a variable name from a configure option name''' | 
|---|
| 55 | if v.startswith('with-'): | 
|---|
| 56 | v = v[5:] | 
|---|
| 57 | v = v.upper() | 
|---|
| 58 | v = string.replace(v, '-', '_') | 
|---|
| 59 | return v | 
|---|
| 60 |  | 
|---|
| 61 |  | 
|---|
| 62 | def dynconfig_cflags(bld): | 
|---|
| 63 | '''work out the extra CFLAGS for dynconfig.c''' | 
|---|
| 64 | cflags = [] | 
|---|
| 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], bld.env) | 
|---|
| 68 | v = Utils.subst_vars(v, bld.env) | 
|---|
| 69 | bld.ASSERT(v != '', "Empty dynconfig value for %s" % f) | 
|---|
| 70 | bld.ASSERT(v.find('${') == -1, "Unsubstituted variable in %s : %s : %s" % (f, dyn_cflags[f], v)) | 
|---|
| 71 | cflags.append('-D%s="%s"' % (f, v)) | 
|---|
| 72 | return cflags | 
|---|