libads: record service ticket endtime for sealed ldap connections
[Samba.git] / buildtools / wafsamba / samba_perl.py
blob3909aba2ee47e5134c1609a385d26f1aa1e49b6b
1 import Build
2 from samba_utils import *
3 from Configure import conf
5 done = {}
7 @conf
8 def SAMBA_CHECK_PERL(conf, mandatory=True, version=(5,0,0)):
10 # TODO: use the @runonce mechanism for this.
11 # The problem is that @runonce currently does
12 # not seem to work together with @conf...
13 # So @runonce (and/or) @conf needs fixing.
15 if "done" in done:
16 return
17 done["done"] = True
18 conf.find_program('perl', var='PERL', mandatory=mandatory)
19 conf.check_tool('perl')
20 path_perl = conf.find_program('perl')
21 conf.env.PERL_SPECIFIED = (conf.env.PERL != path_perl)
22 conf.check_perl_version(version)
24 def read_perl_config_var(cmd):
25 return Utils.to_list(Utils.cmd_output([conf.env.PERL, '-MConfig', '-e', cmd]))
27 def check_perl_config_var(var):
28 conf.start_msg("Checking for perl $Config{%s}:" % var)
29 try:
30 v = read_perl_config_var('print $Config{%s}' % var)[0]
31 conf.end_msg("'%s'" % (v), 'GREEN')
32 return v
33 except IndexError:
34 conf.end_msg(False, 'YELLOW')
35 pass
36 return None
38 vendor_prefix = check_perl_config_var('vendorprefix')
40 perl_arch_install_dir = None
41 if vendor_prefix == conf.env.PREFIX:
42 perl_arch_install_dir = check_perl_config_var('vendorarch');
43 if perl_arch_install_dir is None:
44 perl_arch_install_dir = "${LIBDIR}/perl5";
45 conf.start_msg("PERL_ARCH_INSTALL_DIR: ")
46 conf.end_msg("'%s'" % (perl_arch_install_dir), 'GREEN')
47 conf.env.PERL_ARCH_INSTALL_DIR = perl_arch_install_dir
49 perl_lib_install_dir = None
50 if vendor_prefix == conf.env.PREFIX:
51 perl_lib_install_dir = check_perl_config_var('vendorlib');
52 if perl_lib_install_dir is None:
53 perl_lib_install_dir = "${DATADIR}/perl5";
54 conf.start_msg("PERL_LIB_INSTALL_DIR: ")
55 conf.end_msg("'%s'" % (perl_lib_install_dir), 'GREEN')
56 conf.env.PERL_LIB_INSTALL_DIR = perl_lib_install_dir
58 perl_inc = read_perl_config_var('print "@INC"')
59 perl_inc.remove('.')
60 conf.start_msg("PERL_INC: ")
61 conf.end_msg("%s" % (perl_inc), 'GREEN')
62 conf.env.PERL_INC = perl_inc