2 from Configure
import conf
7 def SAMBA_CHECK_PERL(conf
, mandatory
=True, version
=(5,0,0)):
11 conf
.find_program('perl', var
='PERL', mandatory
=mandatory
)
12 conf
.check_tool('perl')
13 path_perl
= conf
.find_program('perl')
14 conf
.env
.PERL_SPECIFIED
= (conf
.env
.PERL
!= path_perl
)
15 conf
.check_perl_version(version
)
17 def read_perl_config_var(cmd
):
18 return Utils
.to_list(Utils
.cmd_output([conf
.env
.PERL
, '-MConfig', '-e', cmd
]))
20 def check_perl_config_var(var
):
21 conf
.start_msg("Checking for perl $Config{%s}:" % var
)
23 v
= read_perl_config_var('print $Config{%s}' % var
)[0]
24 conf
.end_msg("'%s'" % (v
), 'GREEN')
27 conf
.end_msg(False, 'YELLOW')
31 vendor_prefix
= check_perl_config_var('vendorprefix')
33 perl_arch_install_dir
= None
34 if vendor_prefix
== conf
.env
.PREFIX
:
35 perl_arch_install_dir
= check_perl_config_var('vendorarch');
36 if perl_arch_install_dir
is None:
37 perl_arch_install_dir
= "${LIBDIR}/perl5";
38 conf
.start_msg("PERL_ARCH_INSTALL_DIR: ")
39 conf
.end_msg("'%s'" % (perl_arch_install_dir
), 'GREEN')
40 conf
.env
.PERL_ARCH_INSTALL_DIR
= perl_arch_install_dir
42 perl_lib_install_dir
= None
43 if vendor_prefix
== conf
.env
.PREFIX
:
44 perl_lib_install_dir
= check_perl_config_var('vendorlib');
45 if perl_lib_install_dir
is None:
46 perl_lib_install_dir
= "${DATADIR}/perl5";
47 conf
.start_msg("PERL_LIB_INSTALL_DIR: ")
48 conf
.end_msg("'%s'" % (perl_lib_install_dir
), 'GREEN')
49 conf
.env
.PERL_LIB_INSTALL_DIR
= perl_lib_install_dir
51 perl_inc
= read_perl_config_var('print "@INC"')
54 conf
.start_msg("PERL_INC: ")
55 conf
.end_msg("%s" % (perl_inc
), 'GREEN')
56 conf
.env
.PERL_INC
= perl_inc